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 |
|---|---|---|---|---|---|---|---|---|---|---|
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java | ExecutionChain.runOnBackgroundThread | public <T, U> ExecutionChain runOnBackgroundThread(Task<T, U> task) {
runOnThread(Context.Type.BACKGROUND, task);
return this;
} | java | public <T, U> ExecutionChain runOnBackgroundThread(Task<T, U> task) {
runOnThread(Context.Type.BACKGROUND, task);
return this;
} | [
"public",
"<",
"T",
",",
"U",
">",
"ExecutionChain",
"runOnBackgroundThread",
"(",
"Task",
"<",
"T",
",",
"U",
">",
"task",
")",
"{",
"runOnThread",
"(",
"Context",
".",
"Type",
".",
"BACKGROUND",
",",
"task",
")",
";",
"return",
"this",
";",
"}"
] | Add a {@link Task} to be run on a {@link org.gearvrf.utility.Threads#spawn(Runnable)
background thread}. It will be run after all Tasks added prior to this
call.
@param task
{@code Task} to run
@return Reference to the {@code ExecutionChain}.
@throws IllegalStateException
if the chain of execution has already been {@link #execute()
started}. | [
"Add",
"a",
"{",
"@link",
"Task",
"}",
"to",
"be",
"run",
"on",
"a",
"{",
"@link",
"org",
".",
"gearvrf",
".",
"utility",
".",
"Threads#spawn",
"(",
"Runnable",
")",
"background",
"thread",
"}",
".",
"It",
"will",
"be",
"run",
"after",
"all",
"Tasks"... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java#L302-L305 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java | A_CmsListTab.searchTreeItem | protected CmsTreeItem searchTreeItem(CmsList<? extends I_CmsListItem> list, String categoryPath) {
CmsTreeItem resultItem = (CmsTreeItem)list.getItem(categoryPath);
// item is not in this tree level
if (resultItem == null) {
// if list is not empty
for (int i = 0; i < list.getWidgetCount(); i++) {
CmsTreeItem listItem = (CmsTreeItem)list.getWidget(i);
if (listItem.getChildCount() == 0) {
continue;
}
// continue search in children
resultItem = searchTreeItem(listItem.getChildren(), categoryPath);
// break the search if result item is found
if (resultItem != null) {
break;
}
}
}
return resultItem;
} | java | protected CmsTreeItem searchTreeItem(CmsList<? extends I_CmsListItem> list, String categoryPath) {
CmsTreeItem resultItem = (CmsTreeItem)list.getItem(categoryPath);
// item is not in this tree level
if (resultItem == null) {
// if list is not empty
for (int i = 0; i < list.getWidgetCount(); i++) {
CmsTreeItem listItem = (CmsTreeItem)list.getWidget(i);
if (listItem.getChildCount() == 0) {
continue;
}
// continue search in children
resultItem = searchTreeItem(listItem.getChildren(), categoryPath);
// break the search if result item is found
if (resultItem != null) {
break;
}
}
}
return resultItem;
} | [
"protected",
"CmsTreeItem",
"searchTreeItem",
"(",
"CmsList",
"<",
"?",
"extends",
"I_CmsListItem",
">",
"list",
",",
"String",
"categoryPath",
")",
"{",
"CmsTreeItem",
"resultItem",
"=",
"(",
"CmsTreeItem",
")",
"list",
".",
"getItem",
"(",
"categoryPath",
")",... | Searches in the categories tree or list the item and returns it.<p>
@param list the list of items to start from
@param categoryPath the category id to search
@return the category item widget | [
"Searches",
"in",
"the",
"categories",
"tree",
"or",
"list",
"the",
"item",
"and",
"returns",
"it",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java#L675-L695 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/TableWriterServiceImpl.java | TableWriterServiceImpl.openWriterSeq | public OutSegment openWriterSeq(long sequence)
{
int segmentSize = _segmentSizeNew;
SegmentKelp segment = _segmentService.createSegment(segmentSize, getTableKey(), sequence);
addTableSegmentLength(segmentSize);
_activeSequenceSet.put(sequence, Boolean.TRUE);
return new OutSegment(_table, _table.getTableService(), this, segment);
} | java | public OutSegment openWriterSeq(long sequence)
{
int segmentSize = _segmentSizeNew;
SegmentKelp segment = _segmentService.createSegment(segmentSize, getTableKey(), sequence);
addTableSegmentLength(segmentSize);
_activeSequenceSet.put(sequence, Boolean.TRUE);
return new OutSegment(_table, _table.getTableService(), this, segment);
} | [
"public",
"OutSegment",
"openWriterSeq",
"(",
"long",
"sequence",
")",
"{",
"int",
"segmentSize",
"=",
"_segmentSizeNew",
";",
"SegmentKelp",
"segment",
"=",
"_segmentService",
".",
"createSegment",
"(",
"segmentSize",
",",
"getTableKey",
"(",
")",
",",
"sequence"... | Opens a new segment writer with a specified sequence. Called by the GC
which has multiple segments with the same sequence number.
@param sequence the sequence id for the new segment. | [
"Opens",
"a",
"new",
"segment",
"writer",
"with",
"a",
"specified",
"sequence",
".",
"Called",
"by",
"the",
"GC",
"which",
"has",
"multiple",
"segments",
"with",
"the",
"same",
"sequence",
"number",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/TableWriterServiceImpl.java#L523-L534 |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.customHandler | public LoggingFraction customHandler(String name, String module, String className, Properties properties, String formatter) {
Map<Object, Object> handlerProperties = new HashMap<>();
final Enumeration<?> names = properties.propertyNames();
while (names.hasMoreElements()) {
final String nextElement = (String) names.nextElement();
handlerProperties.put(nextElement, properties.getProperty(nextElement));
}
customHandler(new CustomHandler(name)
.module(module)
.attributeClass(className)
.formatter(formatter)
.properties(handlerProperties));
return this;
} | java | public LoggingFraction customHandler(String name, String module, String className, Properties properties, String formatter) {
Map<Object, Object> handlerProperties = new HashMap<>();
final Enumeration<?> names = properties.propertyNames();
while (names.hasMoreElements()) {
final String nextElement = (String) names.nextElement();
handlerProperties.put(nextElement, properties.getProperty(nextElement));
}
customHandler(new CustomHandler(name)
.module(module)
.attributeClass(className)
.formatter(formatter)
.properties(handlerProperties));
return this;
} | [
"public",
"LoggingFraction",
"customHandler",
"(",
"String",
"name",
",",
"String",
"module",
",",
"String",
"className",
",",
"Properties",
"properties",
",",
"String",
"formatter",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"handlerProperties",
"=",
... | Add a CustomHandler to this logger
@param name the name of the handler
@param module the module that the handler uses
@param className the handler class name
@param properties properties for the handler
@param formatter a pattern string for the formatter
@return this fraction | [
"Add",
"a",
"CustomHandler",
"to",
"this",
"logger"
] | train | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L249-L263 |
roboconf/roboconf-platform | core/roboconf-dm/src/main/java/net/roboconf/dm/management/ManagedApplication.java | ManagedApplication.storeAwaitingMessage | public void storeAwaitingMessage( Instance instance, Message msg ) {
Instance scopedInstance = InstanceHelpers.findScopedInstance( instance );
this.logger.finer( "Storing message " + msg.getClass().getSimpleName() + " for instance " + scopedInstance );
// We need synchronized access to the map.
// ConcurrentHashMap does not suit. We need atomic insertion in the lists (which are map values).
synchronized( this.scopedInstanceToAwaitingMessages ) {
List<Message> messages = this.scopedInstanceToAwaitingMessages.get( scopedInstance );
if( messages == null ) {
messages = new ArrayList<>( 1 );
this.scopedInstanceToAwaitingMessages.put( scopedInstance, messages );
}
messages.add( msg );
}
} | java | public void storeAwaitingMessage( Instance instance, Message msg ) {
Instance scopedInstance = InstanceHelpers.findScopedInstance( instance );
this.logger.finer( "Storing message " + msg.getClass().getSimpleName() + " for instance " + scopedInstance );
// We need synchronized access to the map.
// ConcurrentHashMap does not suit. We need atomic insertion in the lists (which are map values).
synchronized( this.scopedInstanceToAwaitingMessages ) {
List<Message> messages = this.scopedInstanceToAwaitingMessages.get( scopedInstance );
if( messages == null ) {
messages = new ArrayList<>( 1 );
this.scopedInstanceToAwaitingMessages.put( scopedInstance, messages );
}
messages.add( msg );
}
} | [
"public",
"void",
"storeAwaitingMessage",
"(",
"Instance",
"instance",
",",
"Message",
"msg",
")",
"{",
"Instance",
"scopedInstance",
"=",
"InstanceHelpers",
".",
"findScopedInstance",
"(",
"instance",
")",
";",
"this",
".",
"logger",
".",
"finer",
"(",
"\"Stori... | Stores a message to send once the root instance is online.
<p>
Can be called concurrently with {@link #removeAwaitingMessages(Instance)}.
</p>
@param instance an instance (any instance is fine, the root will be determined)
@param msg the message to store (not null) | [
"Stores",
"a",
"message",
"to",
"send",
"once",
"the",
"root",
"instance",
"is",
"online",
".",
"<p",
">",
"Can",
"be",
"called",
"concurrently",
"with",
"{",
"@link",
"#removeAwaitingMessages",
"(",
"Instance",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/management/ManagedApplication.java#L121-L137 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.sms_sendMessageWithSession | public int sms_sendMessageWithSession(Integer userId, CharSequence message)
throws FacebookException, IOException {
return extractInt(this.callMethod(FacebookMethod.SMS_SEND_MESSAGE,
new Pair<String, CharSequence>("uid", userId.toString()),
new Pair<String, CharSequence>("message", message),
new Pair<String, CharSequence>("req_session", "1")));
} | java | public int sms_sendMessageWithSession(Integer userId, CharSequence message)
throws FacebookException, IOException {
return extractInt(this.callMethod(FacebookMethod.SMS_SEND_MESSAGE,
new Pair<String, CharSequence>("uid", userId.toString()),
new Pair<String, CharSequence>("message", message),
new Pair<String, CharSequence>("req_session", "1")));
} | [
"public",
"int",
"sms_sendMessageWithSession",
"(",
"Integer",
"userId",
",",
"CharSequence",
"message",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractInt",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"SMS_SEND_MESSAGE"... | Sends a message via SMS to the user identified by <code>userId</code>, with
the expectation that the user will reply. The SMS extended permission is required for success.
The returned mobile session ID can be stored and used in {@link #sms_sendResponse} when
the user replies.
@param userId a user ID
@param message the message to be sent via SMS
@return a mobile session ID (can be used in {@link #sms_sendResponse})
@throws FacebookException in case of error, e.g. SMS is not enabled
@throws IOException
@see FacebookExtendedPerm#SMS
@see <a href="http://wiki.developers.facebook.com/index.php/Mobile#Application_generated_messages">
Developers Wiki: Mobile: Application Generated Messages</a>
@see <a href="http://wiki.developers.facebook.com/index.php/Mobile#Workflow">
Developers Wiki: Mobile: Workflow</a> | [
"Sends",
"a",
"message",
"via",
"SMS",
"to",
"the",
"user",
"identified",
"by",
"<code",
">",
"userId<",
"/",
"code",
">",
"with",
"the",
"expectation",
"that",
"the",
"user",
"will",
"reply",
".",
"The",
"SMS",
"extended",
"permission",
"is",
"required",
... | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1682-L1688 |
ModeShape/modeshape | modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/JsonReader.java | JsonReader.readMultiple | public DocumentSequence readMultiple( InputStream stream,
boolean introspectStringValues ) {
return readMultiple(new InputStreamReader(stream, Json.UTF8), introspectStringValues);
} | java | public DocumentSequence readMultiple( InputStream stream,
boolean introspectStringValues ) {
return readMultiple(new InputStreamReader(stream, Json.UTF8), introspectStringValues);
} | [
"public",
"DocumentSequence",
"readMultiple",
"(",
"InputStream",
"stream",
",",
"boolean",
"introspectStringValues",
")",
"{",
"return",
"readMultiple",
"(",
"new",
"InputStreamReader",
"(",
"stream",
",",
"Json",
".",
"UTF8",
")",
",",
"introspectStringValues",
")... | Return a {@link DocumentSequence} that can be used to pull multiple documents from the stream.
@param stream the input stream; may not be null
@param introspectStringValues true if the string values should be examined for common patterns, or false otherwise
@return the sequence that can be used to get one or more Document instances from a single input | [
"Return",
"a",
"{",
"@link",
"DocumentSequence",
"}",
"that",
"can",
"be",
"used",
"to",
"pull",
"multiple",
"documents",
"from",
"the",
"stream",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/JsonReader.java#L238-L241 |
Blazebit/blaze-utils | blaze-common-utils/src/main/java/com/blazebit/exception/ExceptionUtils.java | ExceptionUtils.getCause | public static Throwable getCause(Throwable e, Class<? extends Throwable>... causes) {
if ((e == null) || (causes == null) || (causes.length < 1)) {
return null;
} else if (isInstance(e, causes)) {
if (((e.getCause() == null) || (e.getCause()
.equals(e) || (!equals(e.getClass(), causes))))) {
return e;
} else {
return getCause(e.getCause(), causes);
}
} else if ((e.getCause() == null) && (e instanceof InvocationTargetException)) {
return getCause(((InvocationTargetException) e).getTargetException(), causes);
} else if (e.getCause() == null) {
return null;
} else {
return getCause(e.getCause(), causes);
}
} | java | public static Throwable getCause(Throwable e, Class<? extends Throwable>... causes) {
if ((e == null) || (causes == null) || (causes.length < 1)) {
return null;
} else if (isInstance(e, causes)) {
if (((e.getCause() == null) || (e.getCause()
.equals(e) || (!equals(e.getClass(), causes))))) {
return e;
} else {
return getCause(e.getCause(), causes);
}
} else if ((e.getCause() == null) && (e instanceof InvocationTargetException)) {
return getCause(((InvocationTargetException) e).getTargetException(), causes);
} else if (e.getCause() == null) {
return null;
} else {
return getCause(e.getCause(), causes);
}
} | [
"public",
"static",
"Throwable",
"getCause",
"(",
"Throwable",
"e",
",",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"...",
"causes",
")",
"{",
"if",
"(",
"(",
"e",
"==",
"null",
")",
"||",
"(",
"causes",
"==",
"null",
")",
"||",
"(",
"causes",
... | Gets the cause which are one of the given expected causes. This method is
useful when you have to find a cause within unexpected or unpredictable
exception wrappings.
@param e the exception instance to search the cause on
@param causes the causes which are searched.
@return the found cause, where the first occurring cause instance will be returned. If
the cause could not be found, then null will be returned | [
"Gets",
"the",
"cause",
"which",
"are",
"one",
"of",
"the",
"given",
"expected",
"causes",
".",
"This",
"method",
"is",
"useful",
"when",
"you",
"have",
"to",
"find",
"a",
"cause",
"within",
"unexpected",
"or",
"unpredictable",
"exception",
"wrappings",
"."
... | train | https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/exception/ExceptionUtils.java#L124-L141 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java | MarvinColorModelConverter.rgbToBinary | public static MarvinImage rgbToBinary(MarvinImage img, int threshold) {
MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY);
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11));
if (gray <= threshold) {
resultImage.setBinaryColor(x, y, true);
} else {
resultImage.setBinaryColor(x, y, false);
}
}
}
return resultImage;
} | java | public static MarvinImage rgbToBinary(MarvinImage img, int threshold) {
MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY);
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11));
if (gray <= threshold) {
resultImage.setBinaryColor(x, y, true);
} else {
resultImage.setBinaryColor(x, y, false);
}
}
}
return resultImage;
} | [
"public",
"static",
"MarvinImage",
"rgbToBinary",
"(",
"MarvinImage",
"img",
",",
"int",
"threshold",
")",
"{",
"MarvinImage",
"resultImage",
"=",
"new",
"MarvinImage",
"(",
"img",
".",
"getWidth",
"(",
")",
",",
"img",
".",
"getHeight",
"(",
")",
",",
"Ma... | Converts an image in RGB mode to BINARY mode
@param img image
@param threshold grays cale threshold
@return new MarvinImage instance in BINARY mode | [
"Converts",
"an",
"image",
"in",
"RGB",
"mode",
"to",
"BINARY",
"mode"
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinColorModelConverter.java#L19-L34 |
liferay/com-liferay-commerce | commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java | CommerceUserSegmentEntryPersistenceImpl.findByG_K | @Override
public CommerceUserSegmentEntry findByG_K(long groupId, String key)
throws NoSuchUserSegmentEntryException {
CommerceUserSegmentEntry commerceUserSegmentEntry = fetchByG_K(groupId,
key);
if (commerceUserSegmentEntry == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchUserSegmentEntryException(msg.toString());
}
return commerceUserSegmentEntry;
} | java | @Override
public CommerceUserSegmentEntry findByG_K(long groupId, String key)
throws NoSuchUserSegmentEntryException {
CommerceUserSegmentEntry commerceUserSegmentEntry = fetchByG_K(groupId,
key);
if (commerceUserSegmentEntry == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchUserSegmentEntryException(msg.toString());
}
return commerceUserSegmentEntry;
} | [
"@",
"Override",
"public",
"CommerceUserSegmentEntry",
"findByG_K",
"(",
"long",
"groupId",
",",
"String",
"key",
")",
"throws",
"NoSuchUserSegmentEntryException",
"{",
"CommerceUserSegmentEntry",
"commerceUserSegmentEntry",
"=",
"fetchByG_K",
"(",
"groupId",
",",
"key",
... | Returns the commerce user segment entry where groupId = ? and key = ? or throws a {@link NoSuchUserSegmentEntryException} if it could not be found.
@param groupId the group ID
@param key the key
@return the matching commerce user segment entry
@throws NoSuchUserSegmentEntryException if a matching commerce user segment entry could not be found | [
"Returns",
"the",
"commerce",
"user",
"segment",
"entry",
"where",
"groupId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchUserSegmentEntryException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java#L995-L1022 |
mikepenz/FastAdapter | library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java | AbstractWrapAdapter.onBindViewHolder | @Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List payloads) {
if (shouldInsertItemAtPosition(position)) {
getItem(position).bindView(holder, payloads);
} else {
mAdapter.onBindViewHolder(holder, position - itemInsertedBeforeCount(position), payloads);
}
} | java | @Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List payloads) {
if (shouldInsertItemAtPosition(position)) {
getItem(position).bindView(holder, payloads);
} else {
mAdapter.onBindViewHolder(holder, position - itemInsertedBeforeCount(position), payloads);
}
} | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"holder",
",",
"int",
"position",
",",
"List",
"payloads",
")",
"{",
"if",
"(",
"shouldInsertItemAtPosition",
"(",
"position",
")",
")",
"{",
"getItem",
"(",
"positi... | the onBindViewHolder is managed by the FastAdapter so forward this correctly
@param holder
@param position | [
"the",
"onBindViewHolder",
"is",
"managed",
"by",
"the",
"FastAdapter",
"so",
"forward",
"this",
"correctly"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/adapters/AbstractWrapAdapter.java#L180-L187 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java | MFVec2f.get1Value | public void get1Value(int index, float[] valueDestination) {
try {
SFVec2f sfVec2f = value.get(index);
valueDestination[0] = sfVec2f.x;
valueDestination[1] = sfVec2f.y;
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
} | java | public void get1Value(int index, float[] valueDestination) {
try {
SFVec2f sfVec2f = value.get(index);
valueDestination[0] = sfVec2f.x;
valueDestination[1] = sfVec2f.y;
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f get1Value(index) exception " + e);
}
} | [
"public",
"void",
"get1Value",
"(",
"int",
"index",
",",
"float",
"[",
"]",
"valueDestination",
")",
"{",
"try",
"{",
"SFVec2f",
"sfVec2f",
"=",
"value",
".",
"get",
"(",
"index",
")",
";",
"valueDestination",
"[",
"0",
"]",
"=",
"sfVec2f",
".",
"x",
... | Get an individual value from the existing field array.
@param index -
@param valueDestination - where the SFVec2f value is returned | [
"Get",
"an",
"individual",
"value",
"from",
"the",
"existing",
"field",
"array",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L86-L98 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/common/ProjectClassLoader.java | ProjectClassLoader.tryDefineType | public Class<?> tryDefineType(String name, ClassNotFoundException cnfe) throws ClassNotFoundException {
byte[] bytecode = getBytecode(convertClassToResourcePath(name));
if (bytecode == null) {
if (CACHE_NON_EXISTING_CLASSES) {
nonExistingClasses.add(name);
}
throw cnfe != null ? cnfe : new ClassNotFoundException(name);
}
return defineType(name, bytecode);
} | java | public Class<?> tryDefineType(String name, ClassNotFoundException cnfe) throws ClassNotFoundException {
byte[] bytecode = getBytecode(convertClassToResourcePath(name));
if (bytecode == null) {
if (CACHE_NON_EXISTING_CLASSES) {
nonExistingClasses.add(name);
}
throw cnfe != null ? cnfe : new ClassNotFoundException(name);
}
return defineType(name, bytecode);
} | [
"public",
"Class",
"<",
"?",
">",
"tryDefineType",
"(",
"String",
"name",
",",
"ClassNotFoundException",
"cnfe",
")",
"throws",
"ClassNotFoundException",
"{",
"byte",
"[",
"]",
"bytecode",
"=",
"getBytecode",
"(",
"convertClassToResourcePath",
"(",
"name",
")",
... | This method has to be public because is also used by the android ClassLoader | [
"This",
"method",
"has",
"to",
"be",
"public",
"because",
"is",
"also",
"used",
"by",
"the",
"android",
"ClassLoader"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/common/ProjectClassLoader.java#L190-L199 |
facebook/fresco | fbcore/src/main/java/com/facebook/datasource/AbstractDataSource.java | AbstractDataSource.setResult | protected boolean setResult(@Nullable T value, boolean isLast) {
boolean result = setResultInternal(value, isLast);
if (result) {
notifyDataSubscribers();
}
return result;
} | java | protected boolean setResult(@Nullable T value, boolean isLast) {
boolean result = setResultInternal(value, isLast);
if (result) {
notifyDataSubscribers();
}
return result;
} | [
"protected",
"boolean",
"setResult",
"(",
"@",
"Nullable",
"T",
"value",
",",
"boolean",
"isLast",
")",
"{",
"boolean",
"result",
"=",
"setResultInternal",
"(",
"value",
",",
"isLast",
")",
";",
"if",
"(",
"result",
")",
"{",
"notifyDataSubscribers",
"(",
... | Subclasses should invoke this method to set the result to {@code value}.
<p> This method will return {@code true} if the value was successfully set, or
{@code false} if the data source has already been set, failed or closed.
<p> If the value was successfully set and {@code isLast} is {@code true}, state of the
data source will be set to {@link AbstractDataSource.DataSourceStatus#SUCCESS}.
<p> {@link #closeResult} will be called for the previous result if the new value was
successfully set, OR for the new result otherwise.
<p> This will also notify the subscribers if the value was successfully set.
<p> Do NOT call this method from a synchronized block as it invokes external code of the
subscribers.
@param value the value that was the result of the task.
@param isLast whether or not the value is last.
@return true if the value was successfully set. | [
"Subclasses",
"should",
"invoke",
"this",
"method",
"to",
"set",
"the",
"result",
"to",
"{",
"@code",
"value",
"}",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/datasource/AbstractDataSource.java#L207-L213 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/mojo/CheckResultsMojo.java | CheckResultsMojo.doExecute | @Override
public void doExecute() throws MojoExecutionException, MojoFailureException {
if (!ignoreResultFailures && !scanResultsForFailedRequests) {
getLog().warn(String.format(
"current value of scanResultsForFailedRequests(%s) is incompatible with ignoreResultFailures(%s), setting scanResultsForFailedRequests to true",
scanResultsForFailedRequests,
ignoreResultFailures
));
scanResultsForFailedRequests = true;
}
if (scanResultsForSuccessfulRequests || scanResultsForFailedRequests) {
getLog().info(" ");
getLog().info(LINE_SEPARATOR);
getLog().info("S C A N N I N G F O R R E S U L T S");
getLog().info(LINE_SEPARATOR);
getLog().info(" ");
TestConfig testConfig = new TestConfig(new File(testConfigFile));
String resultFormat = testConfig.getResultsOutputIsCSVFormat() ? "CSV" : "JTL";
getLog().info(String.format("Will scan results using format: %s", resultFormat));
ResultScanner resultScanner = new ResultScanner(
scanResultsForSuccessfulRequests,
scanResultsForFailedRequests,
testConfig.getResultsOutputIsCSVFormat()
);
for (String resultFileLocation : testConfig.getResultsFileLocations()) {
resultScanner.parseResultFile(new File(resultFileLocation));
}
getLog().info(" ");
getLog().info(LINE_SEPARATOR);
getLog().info("P E R F O R M A N C E T E S T R E S U L T S");
getLog().info(LINE_SEPARATOR);
getLog().info(" ");
getLog().info(String.format("Result (.%s) files scanned: %s", resultFormat.toLowerCase(), testConfig.getResultsFileLocations().size()));
getLog().info(String.format("Successful requests: %s", resultScanner.getSuccessCount()));
getLog().info(String.format("Failed requests: %s", resultScanner.getFailureCount()));
TestFailureDecider decider = new TestFailureDecider(ignoreResultFailures, errorRateThresholdInPercent, resultScanner);
decider.runChecks();
getLog().info(String.format("Failures: %s%% (%s%% accepted)", decider.getErrorPercentage(), decider.getErrorPercentageThreshold()));
getLog().info(" ");
if (decider.failBuild()) {
throw new MojoFailureException(String.format(
"Failing build because error percentage %s is above accepted threshold %s. JMeter logs are available at: '%s'",
logsDirectory.getAbsolutePath(),
decider.getErrorPercentage(),
decider.getErrorPercentageThreshold()
));
}
} else {
getLog().info(" ");
getLog().info("Results of Performance Test(s) have not been scanned.");
getLog().info(" ");
}
} | java | @Override
public void doExecute() throws MojoExecutionException, MojoFailureException {
if (!ignoreResultFailures && !scanResultsForFailedRequests) {
getLog().warn(String.format(
"current value of scanResultsForFailedRequests(%s) is incompatible with ignoreResultFailures(%s), setting scanResultsForFailedRequests to true",
scanResultsForFailedRequests,
ignoreResultFailures
));
scanResultsForFailedRequests = true;
}
if (scanResultsForSuccessfulRequests || scanResultsForFailedRequests) {
getLog().info(" ");
getLog().info(LINE_SEPARATOR);
getLog().info("S C A N N I N G F O R R E S U L T S");
getLog().info(LINE_SEPARATOR);
getLog().info(" ");
TestConfig testConfig = new TestConfig(new File(testConfigFile));
String resultFormat = testConfig.getResultsOutputIsCSVFormat() ? "CSV" : "JTL";
getLog().info(String.format("Will scan results using format: %s", resultFormat));
ResultScanner resultScanner = new ResultScanner(
scanResultsForSuccessfulRequests,
scanResultsForFailedRequests,
testConfig.getResultsOutputIsCSVFormat()
);
for (String resultFileLocation : testConfig.getResultsFileLocations()) {
resultScanner.parseResultFile(new File(resultFileLocation));
}
getLog().info(" ");
getLog().info(LINE_SEPARATOR);
getLog().info("P E R F O R M A N C E T E S T R E S U L T S");
getLog().info(LINE_SEPARATOR);
getLog().info(" ");
getLog().info(String.format("Result (.%s) files scanned: %s", resultFormat.toLowerCase(), testConfig.getResultsFileLocations().size()));
getLog().info(String.format("Successful requests: %s", resultScanner.getSuccessCount()));
getLog().info(String.format("Failed requests: %s", resultScanner.getFailureCount()));
TestFailureDecider decider = new TestFailureDecider(ignoreResultFailures, errorRateThresholdInPercent, resultScanner);
decider.runChecks();
getLog().info(String.format("Failures: %s%% (%s%% accepted)", decider.getErrorPercentage(), decider.getErrorPercentageThreshold()));
getLog().info(" ");
if (decider.failBuild()) {
throw new MojoFailureException(String.format(
"Failing build because error percentage %s is above accepted threshold %s. JMeter logs are available at: '%s'",
logsDirectory.getAbsolutePath(),
decider.getErrorPercentage(),
decider.getErrorPercentageThreshold()
));
}
} else {
getLog().info(" ");
getLog().info("Results of Performance Test(s) have not been scanned.");
getLog().info(" ");
}
} | [
"@",
"Override",
"public",
"void",
"doExecute",
"(",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"if",
"(",
"!",
"ignoreResultFailures",
"&&",
"!",
"scanResultsForFailedRequests",
")",
"{",
"getLog",
"(",
")",
".",
"warn",
"(",
"St... | Scan JMeter result files for successful, and failed requests/
@throws MojoExecutionException Exception
@throws MojoFailureException Exception | [
"Scan",
"JMeter",
"result",
"files",
"for",
"successful",
"and",
"failed",
"requests",
"/"
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/mojo/CheckResultsMojo.java#L57-L109 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupResourceVaultConfigsInner.java | BackupResourceVaultConfigsInner.updateAsync | public Observable<BackupResourceVaultConfigResourceInner> updateAsync(String vaultName, String resourceGroupName, BackupResourceVaultConfigResourceInner parameters) {
return updateWithServiceResponseAsync(vaultName, resourceGroupName, parameters).map(new Func1<ServiceResponse<BackupResourceVaultConfigResourceInner>, BackupResourceVaultConfigResourceInner>() {
@Override
public BackupResourceVaultConfigResourceInner call(ServiceResponse<BackupResourceVaultConfigResourceInner> response) {
return response.body();
}
});
} | java | public Observable<BackupResourceVaultConfigResourceInner> updateAsync(String vaultName, String resourceGroupName, BackupResourceVaultConfigResourceInner parameters) {
return updateWithServiceResponseAsync(vaultName, resourceGroupName, parameters).map(new Func1<ServiceResponse<BackupResourceVaultConfigResourceInner>, BackupResourceVaultConfigResourceInner>() {
@Override
public BackupResourceVaultConfigResourceInner call(ServiceResponse<BackupResourceVaultConfigResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupResourceVaultConfigResourceInner",
">",
"updateAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"BackupResourceVaultConfigResourceInner",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"... | Updates vault security config.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param parameters resource config request
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupResourceVaultConfigResourceInner object | [
"Updates",
"vault",
"security",
"config",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupResourceVaultConfigsInner.java#L189-L196 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java | BigtableTableAdminClient.create | public static BigtableTableAdminClient create(
@Nonnull String projectId,
@Nonnull String instanceId,
@Nonnull EnhancedBigtableTableAdminStub stub) {
return new BigtableTableAdminClient(projectId, instanceId, stub);
} | java | public static BigtableTableAdminClient create(
@Nonnull String projectId,
@Nonnull String instanceId,
@Nonnull EnhancedBigtableTableAdminStub stub) {
return new BigtableTableAdminClient(projectId, instanceId, stub);
} | [
"public",
"static",
"BigtableTableAdminClient",
"create",
"(",
"@",
"Nonnull",
"String",
"projectId",
",",
"@",
"Nonnull",
"String",
"instanceId",
",",
"@",
"Nonnull",
"EnhancedBigtableTableAdminStub",
"stub",
")",
"{",
"return",
"new",
"BigtableTableAdminClient",
"("... | Constructs an instance of BigtableTableAdminClient with the given instanceName and stub. | [
"Constructs",
"an",
"instance",
"of",
"BigtableTableAdminClient",
"with",
"the",
"given",
"instanceName",
"and",
"stub",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java#L130-L135 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/SchemaUtil.java | SchemaUtil.partitionFieldSchema | public static Schema partitionFieldSchema(FieldPartitioner<?, ?> fp, Schema schema) {
if (fp instanceof IdentityFieldPartitioner) {
// copy the schema directly from the entity to preserve annotations
return fieldSchema(schema, fp.getSourceName());
} else {
Class<?> fieldType = getPartitionType(fp, schema);
if (fieldType == Integer.class) {
return Schema.create(Schema.Type.INT);
} else if (fieldType == Long.class) {
return Schema.create(Schema.Type.LONG);
} else if (fieldType == String.class) {
return Schema.create(Schema.Type.STRING);
} else {
throw new ValidationException(
"Cannot encode partition " + fp.getName() +
" with type " + fp.getSourceType()
);
}
}
} | java | public static Schema partitionFieldSchema(FieldPartitioner<?, ?> fp, Schema schema) {
if (fp instanceof IdentityFieldPartitioner) {
// copy the schema directly from the entity to preserve annotations
return fieldSchema(schema, fp.getSourceName());
} else {
Class<?> fieldType = getPartitionType(fp, schema);
if (fieldType == Integer.class) {
return Schema.create(Schema.Type.INT);
} else if (fieldType == Long.class) {
return Schema.create(Schema.Type.LONG);
} else if (fieldType == String.class) {
return Schema.create(Schema.Type.STRING);
} else {
throw new ValidationException(
"Cannot encode partition " + fp.getName() +
" with type " + fp.getSourceType()
);
}
}
} | [
"public",
"static",
"Schema",
"partitionFieldSchema",
"(",
"FieldPartitioner",
"<",
"?",
",",
"?",
">",
"fp",
",",
"Schema",
"schema",
")",
"{",
"if",
"(",
"fp",
"instanceof",
"IdentityFieldPartitioner",
")",
"{",
"// copy the schema directly from the entity to preser... | Builds a Schema for the FieldPartitioner using the given Schema to
determine types not fixed by the FieldPartitioner.
@param fp a FieldPartitioner
@param schema an entity Schema that will be partitioned
@return a Schema for the field partitioner | [
"Builds",
"a",
"Schema",
"for",
"the",
"FieldPartitioner",
"using",
"the",
"given",
"Schema",
"to",
"determine",
"types",
"not",
"fixed",
"by",
"the",
"FieldPartitioner",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/SchemaUtil.java#L165-L184 |
aws/aws-sdk-java | jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathContainsFunction.java | JmesPathContainsFunction.doesArrayContain | private static BooleanNode doesArrayContain(JsonNode subject, JsonNode search) {
Iterator<JsonNode> elements = subject.elements();
while (elements.hasNext()) {
if (elements.next().equals(search)) {
return BooleanNode.TRUE;
}
}
return BooleanNode.FALSE;
} | java | private static BooleanNode doesArrayContain(JsonNode subject, JsonNode search) {
Iterator<JsonNode> elements = subject.elements();
while (elements.hasNext()) {
if (elements.next().equals(search)) {
return BooleanNode.TRUE;
}
}
return BooleanNode.FALSE;
} | [
"private",
"static",
"BooleanNode",
"doesArrayContain",
"(",
"JsonNode",
"subject",
",",
"JsonNode",
"search",
")",
"{",
"Iterator",
"<",
"JsonNode",
">",
"elements",
"=",
"subject",
".",
"elements",
"(",
")",
";",
"while",
"(",
"elements",
".",
"hasNext",
"... | If subject is an array, this function returns true if
one of the elements in the array is equal to the provided search
value.
@param subject Array
@param search JmesPath expression
@return True array contains search;
False otherwise | [
"If",
"subject",
"is",
"an",
"array",
"this",
"function",
"returns",
"true",
"if",
"one",
"of",
"the",
"elements",
"in",
"the",
"array",
"is",
"equal",
"to",
"the",
"provided",
"search",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathContainsFunction.java#L80-L88 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.answerCall | public void answerCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData answerData = new VoicecallsidanswerData();
answerData.setReasons(Util.toKVList(reasons));
answerData.setExtensions(Util.toKVList(extensions));
AnswerData data = new AnswerData();
data.setData(answerData);
ApiSuccessResponse response = this.voiceApi.answer(connId, data);
throwIfNotOk("answerCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("answerCall failed.", e);
}
} | java | public void answerCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData answerData = new VoicecallsidanswerData();
answerData.setReasons(Util.toKVList(reasons));
answerData.setExtensions(Util.toKVList(extensions));
AnswerData data = new AnswerData();
data.setData(answerData);
ApiSuccessResponse response = this.voiceApi.answer(connId, data);
throwIfNotOk("answerCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("answerCall failed.", e);
}
} | [
"public",
"void",
"answerCall",
"(",
"String",
"connId",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidanswerData",
"answerData",
"=",
"new",
"VoicecallsidanswerData",
... | Answer the specified call.
@param connId The connection ID of the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Answer",
"the",
"specified",
"call",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L533-L551 |
yan74/afplib | org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java | BaseValidator.validateModcaString8_MinLength | public boolean validateModcaString8_MinLength(String modcaString8, DiagnosticChain diagnostics, Map<Object, Object> context) {
int length = modcaString8.length();
boolean result = length >= 8;
if (!result && diagnostics != null)
reportMinLengthViolation(BasePackage.Literals.MODCA_STRING8, modcaString8, length, 8, diagnostics, context);
return result;
} | java | public boolean validateModcaString8_MinLength(String modcaString8, DiagnosticChain diagnostics, Map<Object, Object> context) {
int length = modcaString8.length();
boolean result = length >= 8;
if (!result && diagnostics != null)
reportMinLengthViolation(BasePackage.Literals.MODCA_STRING8, modcaString8, length, 8, diagnostics, context);
return result;
} | [
"public",
"boolean",
"validateModcaString8_MinLength",
"(",
"String",
"modcaString8",
",",
"DiagnosticChain",
"diagnostics",
",",
"Map",
"<",
"Object",
",",
"Object",
">",
"context",
")",
"{",
"int",
"length",
"=",
"modcaString8",
".",
"length",
"(",
")",
";",
... | Validates the MinLength constraint of '<em>Modca String8</em>'.
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"Validates",
"the",
"MinLength",
"constraint",
"of",
"<em",
">",
"Modca",
"String8<",
"/",
"em",
">",
".",
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | train | https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java#L225-L231 |
ykrasik/jaci | jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java | ReflectionUtils.getAnnotation | public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass) {
assertReflectionAccessor();
return accessor.getAnnotation(clazz, annotationClass);
} | java | public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass) {
assertReflectionAccessor();
return accessor.getAnnotation(clazz, annotationClass);
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"return",
"accessor",
".",
"getAnno... | Returns this element's annotation for the specified type if
such an annotation is <em>present</em>, else null.
@param <T> the type of the annotation to query for and return if present
@param clazz Class to get annotation from
@param annotationClass the Class object corresponding to the
annotation type
@return this element's annotation for the specified annotation type if
present on this element, else null
@throws NullPointerException if the given annotation class is null
@since 1.5 | [
"Returns",
"this",
"element",
"s",
"annotation",
"for",
"the",
"specified",
"type",
"if",
"such",
"an",
"annotation",
"is",
"<em",
">",
"present<",
"/",
"em",
">",
"else",
"null",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L161-L164 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleEntries.java | ModuleEntries.fetchAll | public CMAArray<CMAEntry> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | java | public CMAArray<CMAEntry> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | [
"public",
"CMAArray",
"<",
"CMAEntry",
">",
"fetchAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"query",
")",
"{",
"return",
"fetchAll",
"(",
"spaceId",
",",
"environmentId",
",",
"query",
")",
";",
"}"
] | Fetch all entries matching the query from the configured space and environment.
<p>
This fetch uses the default parameter defined in {@link DefaultQueryParameter#FETCH}
@param query the criteria to filter on.
@return {@link CMAArray} result instance
@throws IllegalArgumentException if configured space id is null.
@throws IllegalArgumentException if configured environment id is null.
@see CMAClient.Builder#setSpaceId(String)
@see CMAClient.Builder#setEnvironmentId(String) | [
"Fetch",
"all",
"entries",
"matching",
"the",
"query",
"from",
"the",
"configured",
"space",
"and",
"environment",
".",
"<p",
">",
"This",
"fetch",
"uses",
"the",
"default",
"parameter",
"defined",
"in",
"{",
"@link",
"DefaultQueryParameter#FETCH",
"}"
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEntries.java#L196-L198 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlLogicConceptMatcher.java | SparqlLogicConceptMatcher.listMatchesAtMostOfType | @Override
public Table<URI, URI, MatchResult> listMatchesAtMostOfType(Set<URI> origins, MatchType maxType) {
return obtainMatchResults(origins, this.getMatchTypesSupported().getLowest(), maxType);
} | java | @Override
public Table<URI, URI, MatchResult> listMatchesAtMostOfType(Set<URI> origins, MatchType maxType) {
return obtainMatchResults(origins, this.getMatchTypesSupported().getLowest(), maxType);
} | [
"@",
"Override",
"public",
"Table",
"<",
"URI",
",",
"URI",
",",
"MatchResult",
">",
"listMatchesAtMostOfType",
"(",
"Set",
"<",
"URI",
">",
"origins",
",",
"MatchType",
"maxType",
")",
"{",
"return",
"obtainMatchResults",
"(",
"origins",
",",
"this",
".",
... | Obtain all the matching resources that have a MatchTyoe with the URIs of {@code origin} of the type provided (inclusive) or less.
@param origins URIs to match
@param maxType the maximum MatchType we want to obtain
@return a {@link com.google.common.collect.Table} with the result of the matching indexed by origin URI and then destination URI. | [
"Obtain",
"all",
"the",
"matching",
"resources",
"that",
"have",
"a",
"MatchTyoe",
"with",
"the",
"URIs",
"of",
"{",
"@code",
"origin",
"}",
"of",
"the",
"type",
"provided",
"(",
"inclusive",
")",
"or",
"less",
"."
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlLogicConceptMatcher.java#L316-L319 |
derari/cthul | matchers/src/main/java/org/cthul/matchers/proc/Raises.java | Raises.raises | @Factory
public static Matcher<Proc> raises(Class<? extends Throwable> clazz, String regex) {
return raises(IsThrowable.throwable(clazz, regex));
} | java | @Factory
public static Matcher<Proc> raises(Class<? extends Throwable> clazz, String regex) {
return raises(IsThrowable.throwable(clazz, regex));
} | [
"@",
"Factory",
"public",
"static",
"Matcher",
"<",
"Proc",
">",
"raises",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"clazz",
",",
"String",
"regex",
")",
"{",
"return",
"raises",
"(",
"IsThrowable",
".",
"throwable",
"(",
"clazz",
",",
"regex... | Does the proc raise a throwable that satisfies the condition?
@param clazz
@param regex
@return Proc-Matcher | [
"Does",
"the",
"proc",
"raise",
"a",
"throwable",
"that",
"satisfies",
"the",
"condition?"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/matchers/src/main/java/org/cthul/matchers/proc/Raises.java#L109-L112 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/PurgeMonitor.java | PurgeMonitor.purgeDirectories | private void purgeDirectories(FileSystem fs, Path root) throws IOException {
DirectoryTraversal traversal =
DirectoryTraversal.directoryRetriever(Arrays.asList(root), fs,
directoryTraversalThreads, directoryTraversalShuffle);
String prefix = root.toUri().getPath();
FileStatus dir;
while ((dir = traversal.next()) != DirectoryTraversal.FINISH_TOKEN) {
Path dirPath = dir.getPath();
if (dirPath.toUri().getPath().endsWith(RaidNode.HAR_SUFFIX)) {
continue;
}
String dirStr = dirPath.toUri().getPath();
if (!dirStr.startsWith(prefix)) {
continue;
}
entriesProcessed.incrementAndGet();
String src = dirStr.replaceFirst(prefix, "");
if (src.length() == 0) continue;
Path srcPath = new Path(src);
if (!fs.exists(srcPath)) {
performDelete(fs, dirPath, true);
}
}
} | java | private void purgeDirectories(FileSystem fs, Path root) throws IOException {
DirectoryTraversal traversal =
DirectoryTraversal.directoryRetriever(Arrays.asList(root), fs,
directoryTraversalThreads, directoryTraversalShuffle);
String prefix = root.toUri().getPath();
FileStatus dir;
while ((dir = traversal.next()) != DirectoryTraversal.FINISH_TOKEN) {
Path dirPath = dir.getPath();
if (dirPath.toUri().getPath().endsWith(RaidNode.HAR_SUFFIX)) {
continue;
}
String dirStr = dirPath.toUri().getPath();
if (!dirStr.startsWith(prefix)) {
continue;
}
entriesProcessed.incrementAndGet();
String src = dirStr.replaceFirst(prefix, "");
if (src.length() == 0) continue;
Path srcPath = new Path(src);
if (!fs.exists(srcPath)) {
performDelete(fs, dirPath, true);
}
}
} | [
"private",
"void",
"purgeDirectories",
"(",
"FileSystem",
"fs",
",",
"Path",
"root",
")",
"throws",
"IOException",
"{",
"DirectoryTraversal",
"traversal",
"=",
"DirectoryTraversal",
".",
"directoryRetriever",
"(",
"Arrays",
".",
"asList",
"(",
"root",
")",
",",
... | Traverse the parity destination directory, removing directories that
no longer existing in the source.
@throws IOException | [
"Traverse",
"the",
"parity",
"destination",
"directory",
"removing",
"directories",
"that",
"no",
"longer",
"existing",
"in",
"the",
"source",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/PurgeMonitor.java#L101-L125 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.drainOnReadIfNeeded | void drainOnReadIfNeeded(int bufferIndex, long writeCount) {
final long pending = (writeCount - readBufferDrainAtWriteCount[bufferIndex].get());
final boolean delayable = (pending < READ_BUFFER_THRESHOLD);
final DrainStatus status = drainStatus.get();
if (status.shouldDrainBuffers(delayable)) {
tryToDrainBuffers();
}
} | java | void drainOnReadIfNeeded(int bufferIndex, long writeCount) {
final long pending = (writeCount - readBufferDrainAtWriteCount[bufferIndex].get());
final boolean delayable = (pending < READ_BUFFER_THRESHOLD);
final DrainStatus status = drainStatus.get();
if (status.shouldDrainBuffers(delayable)) {
tryToDrainBuffers();
}
} | [
"void",
"drainOnReadIfNeeded",
"(",
"int",
"bufferIndex",
",",
"long",
"writeCount",
")",
"{",
"final",
"long",
"pending",
"=",
"(",
"writeCount",
"-",
"readBufferDrainAtWriteCount",
"[",
"bufferIndex",
"]",
".",
"get",
"(",
")",
")",
";",
"final",
"boolean",
... | Attempts to drain the buffers if it is determined to be needed when
post-processing a read.
@param bufferIndex the index to the chosen read buffer
@param writeCount the number of writes on the chosen read buffer | [
"Attempts",
"to",
"drain",
"the",
"buffers",
"if",
"it",
"is",
"determined",
"to",
"be",
"needed",
"when",
"post",
"-",
"processing",
"a",
"read",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java#L381-L388 |
banq/jdonframework | src/main/java/com/jdon/util/jdom/DataUnformatFilter.java | DataUnformatFilter.startElement | public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
clearWhitespace();
stateStack.push(SEEN_ELEMENT);
state = SEEN_NOTHING;
super.startElement(uri, localName, qName, atts);
} | java | public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
clearWhitespace();
stateStack.push(SEEN_ELEMENT);
state = SEEN_NOTHING;
super.startElement(uri, localName, qName, atts);
} | [
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"atts",
")",
"throws",
"SAXException",
"{",
"clearWhitespace",
"(",
")",
";",
"stateStack",
".",
"push",
"(",
"SEEN_ELEMENT",
")",
... | Filter a start element event.
@param uri
The element's Namespace URI.
@param localName
The element's local name.
@param qName
The element's qualified (prefixed) name.
@param atts
The element's attribute list.
@exception org.xml.sax.SAXException
If a filter further down the chain raises an exception.
@see org.xml.sax.ContentHandler#startElement | [
"Filter",
"a",
"start",
"element",
"event",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/DataUnformatFilter.java#L157-L162 |
alkacon/opencms-core | src/org/opencms/ui/components/fileselect/CmsResourceTreeContainer.java | CmsResourceTreeContainer.initRoot | public void initRoot(CmsObject cms, CmsResource root) {
addTreeItem(cms, root, null);
readTreeLevel(cms, root.getStructureId());
} | java | public void initRoot(CmsObject cms, CmsResource root) {
addTreeItem(cms, root, null);
readTreeLevel(cms, root.getStructureId());
} | [
"public",
"void",
"initRoot",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"root",
")",
"{",
"addTreeItem",
"(",
"cms",
",",
"root",
",",
"null",
")",
";",
"readTreeLevel",
"(",
"cms",
",",
"root",
".",
"getStructureId",
"(",
")",
")",
";",
"}"
] | Initializes the root level of the tree.<p>
@param cms the CMS context
@param root the root folder | [
"Initializes",
"the",
"root",
"level",
"of",
"the",
"tree",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/fileselect/CmsResourceTreeContainer.java#L146-L150 |
weld/core | impl/src/main/java/org/jboss/weld/resolution/EventTypeAssignabilityRules.java | EventTypeAssignabilityRules.parametersMatch | private boolean parametersMatch(Type observedParameter, Type eventParameter) {
if (Types.isActualType(observedParameter) && Types.isActualType(eventParameter)) {
/*
* the observed event type parameter is an actual type with identical raw type to the event type
* parameter, and, if the type is parameterized, the event type parameter is assignable to the
* observed event type parameter according to these rules, or
*/
return matches(observedParameter, eventParameter);
}
if (observedParameter instanceof WildcardType && eventParameter instanceof WildcardType) {
/*
* both the observed event type parameter and the event type parameter are wildcards, and the event type parameter is assignable to the observed event
* type
*/
return CovariantTypes.isAssignableFrom(observedParameter, eventParameter);
}
if (observedParameter instanceof WildcardType) {
/*
* the observed event type parameter is a wildcard and the event type parameter is assignable
* to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the
* wildcard, or
*/
return parametersMatch((WildcardType) observedParameter, eventParameter);
}
if (observedParameter instanceof TypeVariable<?>) {
/*
* the observed event type parameter is a type variable and the event type parameter is assignable
* to the upper bound, if any, of the type variable.
*/
return parametersMatch((TypeVariable<?>) observedParameter, eventParameter);
}
return false;
} | java | private boolean parametersMatch(Type observedParameter, Type eventParameter) {
if (Types.isActualType(observedParameter) && Types.isActualType(eventParameter)) {
/*
* the observed event type parameter is an actual type with identical raw type to the event type
* parameter, and, if the type is parameterized, the event type parameter is assignable to the
* observed event type parameter according to these rules, or
*/
return matches(observedParameter, eventParameter);
}
if (observedParameter instanceof WildcardType && eventParameter instanceof WildcardType) {
/*
* both the observed event type parameter and the event type parameter are wildcards, and the event type parameter is assignable to the observed event
* type
*/
return CovariantTypes.isAssignableFrom(observedParameter, eventParameter);
}
if (observedParameter instanceof WildcardType) {
/*
* the observed event type parameter is a wildcard and the event type parameter is assignable
* to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the
* wildcard, or
*/
return parametersMatch((WildcardType) observedParameter, eventParameter);
}
if (observedParameter instanceof TypeVariable<?>) {
/*
* the observed event type parameter is a type variable and the event type parameter is assignable
* to the upper bound, if any, of the type variable.
*/
return parametersMatch((TypeVariable<?>) observedParameter, eventParameter);
}
return false;
} | [
"private",
"boolean",
"parametersMatch",
"(",
"Type",
"observedParameter",
",",
"Type",
"eventParameter",
")",
"{",
"if",
"(",
"Types",
".",
"isActualType",
"(",
"observedParameter",
")",
"&&",
"Types",
".",
"isActualType",
"(",
"eventParameter",
")",
")",
"{",
... | A parameterized event type is considered assignable to a parameterized observed event type if
they have identical raw type and for each parameter: | [
"A",
"parameterized",
"event",
"type",
"is",
"considered",
"assignable",
"to",
"a",
"parameterized",
"observed",
"event",
"type",
"if",
"they",
"have",
"identical",
"raw",
"type",
"and",
"for",
"each",
"parameter",
":"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/EventTypeAssignabilityRules.java#L124-L156 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileConfig.java | TileConfig.imports | public static TileRef imports(Xml nodeTile)
{
Check.notNull(nodeTile);
final int sheet = nodeTile.readInteger(ATT_TILE_SHEET);
final int number = nodeTile.readInteger(ATT_TILE_NUMBER);
return new TileRef(sheet, number);
} | java | public static TileRef imports(Xml nodeTile)
{
Check.notNull(nodeTile);
final int sheet = nodeTile.readInteger(ATT_TILE_SHEET);
final int number = nodeTile.readInteger(ATT_TILE_NUMBER);
return new TileRef(sheet, number);
} | [
"public",
"static",
"TileRef",
"imports",
"(",
"Xml",
"nodeTile",
")",
"{",
"Check",
".",
"notNull",
"(",
"nodeTile",
")",
";",
"final",
"int",
"sheet",
"=",
"nodeTile",
".",
"readInteger",
"(",
"ATT_TILE_SHEET",
")",
";",
"final",
"int",
"number",
"=",
... | Create the tile data from node.
@param nodeTile The node reference (must not be <code>null</code>).
@return The tile data.
@throws LionEngineException If <code>null</code> argument or error when reading. | [
"Create",
"the",
"tile",
"data",
"from",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileConfig.java#L49-L57 |
orhanobut/wasp | wasp/src/main/java/com/orhanobut/wasp/utils/MockFactory.java | MockFactory.readMockResponse | public static String readMockResponse(Context context, String filePath) {
String responseString;
try {
responseString = IOUtils.readFileFromAssets(context, filePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (TextUtils.isEmpty(responseString)) {
throw new RuntimeException("Mock file \"" + filePath + "\" is empty");
}
return responseString;
} | java | public static String readMockResponse(Context context, String filePath) {
String responseString;
try {
responseString = IOUtils.readFileFromAssets(context, filePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (TextUtils.isEmpty(responseString)) {
throw new RuntimeException("Mock file \"" + filePath + "\" is empty");
}
return responseString;
} | [
"public",
"static",
"String",
"readMockResponse",
"(",
"Context",
"context",
",",
"String",
"filePath",
")",
"{",
"String",
"responseString",
";",
"try",
"{",
"responseString",
"=",
"IOUtils",
".",
"readFileFromAssets",
"(",
"context",
",",
"filePath",
")",
";",... | Reads mock response string from given path.
@param context Context with file access
@param filePath Path to mock file
@return Response string | [
"Reads",
"mock",
"response",
"string",
"from",
"given",
"path",
"."
] | train | https://github.com/orhanobut/wasp/blob/295d8747aa7e410b185a620a6b87239816a38c11/wasp/src/main/java/com/orhanobut/wasp/utils/MockFactory.java#L37-L50 |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/security/auth/challenge/TokenHttpChallengeFactory.java | TokenHttpChallengeFactory.makeChallengeString | @Override
protected String makeChallengeString(ResourceAddress address, HttpRealmInfo realm, Object... params) {
StringBuilder sb = new StringBuilder();
String challengeScheme = realm.getChallengeScheme();
if (isApplication(challengeScheme)) {
sb.append(AUTH_SCHEME_APPLICATION_PREFIX);
}
sb.append(getAuthenticationScheme());
if (params != null) {
// Don't forget the additional parameters (KG-2191)
for (Object obj : params) {
sb.append(" ").append(obj);
}
}
return sb.toString();
} | java | @Override
protected String makeChallengeString(ResourceAddress address, HttpRealmInfo realm, Object... params) {
StringBuilder sb = new StringBuilder();
String challengeScheme = realm.getChallengeScheme();
if (isApplication(challengeScheme)) {
sb.append(AUTH_SCHEME_APPLICATION_PREFIX);
}
sb.append(getAuthenticationScheme());
if (params != null) {
// Don't forget the additional parameters (KG-2191)
for (Object obj : params) {
sb.append(" ").append(obj);
}
}
return sb.toString();
} | [
"@",
"Override",
"protected",
"String",
"makeChallengeString",
"(",
"ResourceAddress",
"address",
",",
"HttpRealmInfo",
"realm",
",",
"Object",
"...",
"params",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"challengeScheme... | /* Override the HttpChallengeFactoryAdapter makeChallengeString method,
since that method automatically adds the "realm=" challenge parameter,
and for the suis generis "Application Token" authentication scheme --
explicitly designed to be opaque -- we want to stay out of the way
of the custom opaque tokens. | [
"/",
"*",
"Override",
"the",
"HttpChallengeFactoryAdapter",
"makeChallengeString",
"method",
"since",
"that",
"method",
"automatically",
"adds",
"the",
"realm",
"=",
"challenge",
"parameter",
"and",
"for",
"the",
"suis",
"generis",
"Application",
"Token",
"authenticat... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/security/auth/challenge/TokenHttpChallengeFactory.java#L40-L59 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java | RouteFilterRulesInner.updateAsync | public Observable<RouteFilterRuleInner> updateAsync(String resourceGroupName, String routeFilterName, String ruleName, PatchRouteFilterRule routeFilterRuleParameters) {
return updateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).map(new Func1<ServiceResponse<RouteFilterRuleInner>, RouteFilterRuleInner>() {
@Override
public RouteFilterRuleInner call(ServiceResponse<RouteFilterRuleInner> response) {
return response.body();
}
});
} | java | public Observable<RouteFilterRuleInner> updateAsync(String resourceGroupName, String routeFilterName, String ruleName, PatchRouteFilterRule routeFilterRuleParameters) {
return updateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).map(new Func1<ServiceResponse<RouteFilterRuleInner>, RouteFilterRuleInner>() {
@Override
public RouteFilterRuleInner call(ServiceResponse<RouteFilterRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RouteFilterRuleInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeFilterName",
",",
"String",
"ruleName",
",",
"PatchRouteFilterRule",
"routeFilterRuleParameters",
")",
"{",
"return",
"updateWithServiceResponse... | Updates a route in the specified route filter.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@param ruleName The name of the route filter rule.
@param routeFilterRuleParameters Parameters supplied to the update route filter rule operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"route",
"in",
"the",
"specified",
"route",
"filter",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java#L583-L590 |
apache/incubator-druid | core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java | ConcurrentAwaitableCounter.awaitCount | public void awaitCount(long totalCount, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
{
checkTotalCount(totalCount);
long nanos = unit.toNanos(timeout);
long currentCount = sync.getCount();
while (compareCounts(totalCount, currentCount) > 0) {
if (!sync.tryAcquireSharedNanos(currentCount, nanos)) {
throw new TimeoutException();
}
currentCount = sync.getCount();
}
} | java | public void awaitCount(long totalCount, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
{
checkTotalCount(totalCount);
long nanos = unit.toNanos(timeout);
long currentCount = sync.getCount();
while (compareCounts(totalCount, currentCount) > 0) {
if (!sync.tryAcquireSharedNanos(currentCount, nanos)) {
throw new TimeoutException();
}
currentCount = sync.getCount();
}
} | [
"public",
"void",
"awaitCount",
"(",
"long",
"totalCount",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"checkTotalCount",
"(",
"totalCount",
")",
";",
"long",
"nanos",
"=",
"unit",
".",
... | Await until the {@link #increment} is called on this counter object the specified number of times from the creation
of this counter object, for not longer than the specified period of time. If by this time the target increment
count is not reached, {@link TimeoutException} is thrown. | [
"Await",
"until",
"the",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java#L119-L130 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.attachSession | public void attachSession(List<ServiceInstanceToken> instanceTokens, final AttachSessionCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.AttachSession);
String sessionId = connection.getSessionId();
AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
Map<ServiceInstanceToken, ItemResult> items = ((AttachSessionResponse)response).getAttachingResult();
cb.call(result, items, error, ctx);
}
};
connection.submitCallbackRequest(header, protocol, pcb, context);
} | java | public void attachSession(List<ServiceInstanceToken> instanceTokens, final AttachSessionCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.AttachSession);
String sessionId = connection.getSessionId();
AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
Map<ServiceInstanceToken, ItemResult> items = ((AttachSessionResponse)response).getAttachingResult();
cb.call(result, items, error, ctx);
}
};
connection.submitCallbackRequest(header, protocol, pcb, context);
} | [
"public",
"void",
"attachSession",
"(",
"List",
"<",
"ServiceInstanceToken",
">",
"instanceTokens",
",",
"final",
"AttachSessionCallback",
"cb",
",",
"Object",
"context",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
... | Attach ServiceInstance to the Session.
When create a new session, it need to attach the session again.
@param instanceTokens
the instance list.
@param cb
the callback.
@param context
the context object. | [
"Attach",
"ServiceInstance",
"to",
"the",
"Session",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L505-L523 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/util/MonitoredObject.java | MonitoredObject.addConst | @javax.annotation.Nonnull
public com.simiacryptus.util.MonitoredObject addConst(final String key, final Object item) {
items.put(key, item);
return this;
} | java | @javax.annotation.Nonnull
public com.simiacryptus.util.MonitoredObject addConst(final String key, final Object item) {
items.put(key, item);
return this;
} | [
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"public",
"com",
".",
"simiacryptus",
".",
"util",
".",
"MonitoredObject",
"addConst",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"item",
")",
"{",
"items",
".",
"put",
"(",
"key",
",",
"item",... | Add const monitored object.
@param key the key
@param item the item
@return the monitored object | [
"Add",
"const",
"monitored",
"object",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/MonitoredObject.java#L41-L45 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/DataDecoder.java | DataDecoder.decodeShort | public static short decodeShort(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
return (short)(((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)) ^ 0x8000);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static short decodeShort(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
return (short)(((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)) ^ 0x8000);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"short",
"decodeShort",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"return",
"(",
"short",
")",
"(",
"(",
"(",
"src",
"[",
"srcOffset",
"]",
"<<",
"8",
")",
"|"... | Decodes a signed short from exactly 2 bytes.
@param src source of encoded bytes
@param srcOffset offset into source array
@return signed short value | [
"Decodes",
"a",
"signed",
"short",
"from",
"exactly",
"2",
"bytes",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L174-L182 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/history/FsJobArchivist.java | FsJobArchivist.archiveJob | public static Path archiveJob(Path rootPath, JobID jobId, Collection<ArchivedJson> jsonToArchive) throws IOException {
try {
FileSystem fs = rootPath.getFileSystem();
Path path = new Path(rootPath, jobId.toString());
OutputStream out = fs.create(path, FileSystem.WriteMode.NO_OVERWRITE);
try (JsonGenerator gen = jacksonFactory.createGenerator(out, JsonEncoding.UTF8)) {
gen.writeStartObject();
gen.writeArrayFieldStart(ARCHIVE);
for (ArchivedJson archive : jsonToArchive) {
gen.writeStartObject();
gen.writeStringField(PATH, archive.getPath());
gen.writeStringField(JSON, archive.getJson());
gen.writeEndObject();
}
gen.writeEndArray();
gen.writeEndObject();
} catch (Exception e) {
fs.delete(path, false);
throw e;
}
LOG.info("Job {} has been archived at {}.", jobId, path);
return path;
} catch (IOException e) {
LOG.error("Failed to archive job.", e);
throw e;
}
} | java | public static Path archiveJob(Path rootPath, JobID jobId, Collection<ArchivedJson> jsonToArchive) throws IOException {
try {
FileSystem fs = rootPath.getFileSystem();
Path path = new Path(rootPath, jobId.toString());
OutputStream out = fs.create(path, FileSystem.WriteMode.NO_OVERWRITE);
try (JsonGenerator gen = jacksonFactory.createGenerator(out, JsonEncoding.UTF8)) {
gen.writeStartObject();
gen.writeArrayFieldStart(ARCHIVE);
for (ArchivedJson archive : jsonToArchive) {
gen.writeStartObject();
gen.writeStringField(PATH, archive.getPath());
gen.writeStringField(JSON, archive.getJson());
gen.writeEndObject();
}
gen.writeEndArray();
gen.writeEndObject();
} catch (Exception e) {
fs.delete(path, false);
throw e;
}
LOG.info("Job {} has been archived at {}.", jobId, path);
return path;
} catch (IOException e) {
LOG.error("Failed to archive job.", e);
throw e;
}
} | [
"public",
"static",
"Path",
"archiveJob",
"(",
"Path",
"rootPath",
",",
"JobID",
"jobId",
",",
"Collection",
"<",
"ArchivedJson",
">",
"jsonToArchive",
")",
"throws",
"IOException",
"{",
"try",
"{",
"FileSystem",
"fs",
"=",
"rootPath",
".",
"getFileSystem",
"(... | Writes the given {@link AccessExecutionGraph} to the {@link FileSystem} pointed to by
{@link JobManagerOptions#ARCHIVE_DIR}.
@param rootPath directory to which the archive should be written to
@param jobId job id
@param jsonToArchive collection of json-path pairs to that should be archived
@return path to where the archive was written, or null if no archive was created
@throws IOException | [
"Writes",
"the",
"given",
"{",
"@link",
"AccessExecutionGraph",
"}",
"to",
"the",
"{",
"@link",
"FileSystem",
"}",
"pointed",
"to",
"by",
"{",
"@link",
"JobManagerOptions#ARCHIVE_DIR",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/history/FsJobArchivist.java#L71-L98 |
structr/structr | structr-modules/structr-signed-jar-module/src/main/java/org/structr/jar/SignedJarBuilder.java | SignedJarBuilder.writeFile | public void writeFile(File inputFile, String jarPath) throws IOException {
// Get an input stream on the file.
FileInputStream fis = new FileInputStream(inputFile);
try {
// create the zip entry
JarEntry entry = new JarEntry(jarPath);
entry.setTime(inputFile.lastModified());
writeEntry(fis, entry);
} finally {
// close the file stream used to read the file
fis.close();
}
} | java | public void writeFile(File inputFile, String jarPath) throws IOException {
// Get an input stream on the file.
FileInputStream fis = new FileInputStream(inputFile);
try {
// create the zip entry
JarEntry entry = new JarEntry(jarPath);
entry.setTime(inputFile.lastModified());
writeEntry(fis, entry);
} finally {
// close the file stream used to read the file
fis.close();
}
} | [
"public",
"void",
"writeFile",
"(",
"File",
"inputFile",
",",
"String",
"jarPath",
")",
"throws",
"IOException",
"{",
"// Get an input stream on the file.",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"inputFile",
")",
";",
"try",
"{",
"// create t... | Writes a new {@link File} into the archive.
@param inputFile the {@link File} to write.
@param jarPath the filepath inside the archive.
@throws IOException | [
"Writes",
"a",
"new",
"{",
"@link",
"File",
"}",
"into",
"the",
"archive",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-modules/structr-signed-jar-module/src/main/java/org/structr/jar/SignedJarBuilder.java#L100-L114 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java | ReplicationsInner.beginUpdateAsync | public Observable<ReplicationInner> beginUpdateAsync(String resourceGroupName, String registryName, String replicationName) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() {
@Override
public ReplicationInner call(ServiceResponse<ReplicationInner> response) {
return response.body();
}
});
} | java | public Observable<ReplicationInner> beginUpdateAsync(String resourceGroupName, String registryName, String replicationName) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() {
@Override
public ReplicationInner call(ServiceResponse<ReplicationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ReplicationInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"replicationName",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"regist... | Updates a replication for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param replicationName The name of the replication.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ReplicationInner object | [
"Updates",
"a",
"replication",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L752-L759 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java | MediaDescriptorField.createApplicationFormat | private RTPFormat createApplicationFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
token = it.next();
token.trim();
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createApplicationFormat(name)));
} else {
((ApplicationFormat)rtpFormat.getFormat()).setName(name);
}
return rtpFormat;
} | java | private RTPFormat createApplicationFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
token = it.next();
token.trim();
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createApplicationFormat(name)));
} else {
((ApplicationFormat)rtpFormat.getFormat()).setName(name);
}
return rtpFormat;
} | [
"private",
"RTPFormat",
"createApplicationFormat",
"(",
"int",
"payload",
",",
"Text",
"description",
")",
"{",
"Iterator",
"<",
"Text",
">",
"it",
"=",
"description",
".",
"split",
"(",
"'",
"'",
")",
".",
"iterator",
"(",
")",
";",
"//encoding name",
"Te... | Creates or updates application format using payload number and text format description.
@param payload the payload number of the format.
@param description text description of the format
@return format object | [
"Creates",
"or",
"updates",
"application",
"format",
"using",
"payload",
"number",
"and",
"text",
"format",
"description",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java#L496-L515 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDEntitiesAttr.java | DTDEntitiesAttr.validateDefault | @Override
public void validateDefault(InputProblemReporter rep, boolean normalize)
throws XMLStreamException
{
String normStr = validateDefaultNames(rep, true);
if (normalize) {
mDefValue.setValue(normStr);
}
// Ok, but were they declared?
/* Performance really shouldn't be critical here (only called when
* parsing DTDs, which get cached) -- let's just
* tokenize using standard StringTokenizer
*/
StringTokenizer st = new StringTokenizer(normStr);
/* !!! 03-Dec-2004, TSa: This is rather ugly -- need to know we
* actually really get a DTD reader, and DTD reader needs
* to expose a special method... but it gets things done.
*/
MinimalDTDReader dtdr = (MinimalDTDReader) rep;
while (st.hasMoreTokens()) {
String str = st.nextToken();
EntityDecl ent = dtdr.findEntity(str);
// Needs to exists, and be an unparsed entity...
checkEntity(rep, normStr, ent);
}
} | java | @Override
public void validateDefault(InputProblemReporter rep, boolean normalize)
throws XMLStreamException
{
String normStr = validateDefaultNames(rep, true);
if (normalize) {
mDefValue.setValue(normStr);
}
// Ok, but were they declared?
/* Performance really shouldn't be critical here (only called when
* parsing DTDs, which get cached) -- let's just
* tokenize using standard StringTokenizer
*/
StringTokenizer st = new StringTokenizer(normStr);
/* !!! 03-Dec-2004, TSa: This is rather ugly -- need to know we
* actually really get a DTD reader, and DTD reader needs
* to expose a special method... but it gets things done.
*/
MinimalDTDReader dtdr = (MinimalDTDReader) rep;
while (st.hasMoreTokens()) {
String str = st.nextToken();
EntityDecl ent = dtdr.findEntity(str);
// Needs to exists, and be an unparsed entity...
checkEntity(rep, normStr, ent);
}
} | [
"@",
"Override",
"public",
"void",
"validateDefault",
"(",
"InputProblemReporter",
"rep",
",",
"boolean",
"normalize",
")",
"throws",
"XMLStreamException",
"{",
"String",
"normStr",
"=",
"validateDefaultNames",
"(",
"rep",
",",
"true",
")",
";",
"if",
"(",
"norm... | Method called by the validator object
to ask attribute to verify that the default it has (if any) is
valid for such type. | [
"Method",
"called",
"by",
"the",
"validator",
"object",
"to",
"ask",
"attribute",
"to",
"verify",
"that",
"the",
"default",
"it",
"has",
"(",
"if",
"any",
")",
"is",
"valid",
"for",
"such",
"type",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDEntitiesAttr.java#L150-L177 |
playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.getHitLayer | public static Layer getHitLayer (Layer root, Point p) {
root.transform().inverseTransform(p, p);
p.x += root.originX();
p.y += root.originY();
return root.hitTest(p);
} | java | public static Layer getHitLayer (Layer root, Point p) {
root.transform().inverseTransform(p, p);
p.x += root.originX();
p.y += root.originY();
return root.hitTest(p);
} | [
"public",
"static",
"Layer",
"getHitLayer",
"(",
"Layer",
"root",
",",
"Point",
"p",
")",
"{",
"root",
".",
"transform",
"(",
")",
".",
"inverseTransform",
"(",
"p",
",",
"p",
")",
";",
"p",
".",
"x",
"+=",
"root",
".",
"originX",
"(",
")",
";",
... | Returns the layer hit by (screen) position {@code p} (or null) in the scene graph rooted at
{@code root}, using {@link Layer#hitTest}. Note that {@code p} is mutated by this call. | [
"Returns",
"the",
"layer",
"hit",
"by",
"(",
"screen",
")",
"position",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L128-L133 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/Mapcode.java | Mapcode.getCodeWithTerritory | @Nonnull
public String getCodeWithTerritory(final int precision, @Nullable final Alphabet alphabet) throws IllegalArgumentException {
return territory.toString() + ' ' + getCode(precision, alphabet);
} | java | @Nonnull
public String getCodeWithTerritory(final int precision, @Nullable final Alphabet alphabet) throws IllegalArgumentException {
return territory.toString() + ' ' + getCode(precision, alphabet);
} | [
"@",
"Nonnull",
"public",
"String",
"getCodeWithTerritory",
"(",
"final",
"int",
"precision",
",",
"@",
"Nullable",
"final",
"Alphabet",
"alphabet",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"territory",
".",
"toString",
"(",
")",
"+",
"'",
"'",
... | Return the international mapcode as a shorter version using the ISO territory codes where possible.
International codes use a territory code "AAA".
The format of the code is:
short-territory-name mapcode
Example:
NLD 49.4V (regular code)
NLD 49.4V-K2 (high-precision code)
@param precision Precision specifier. Range: [0, 8].
@param alphabet Alphabet.
@return Short-hand international mapcode.
@throws IllegalArgumentException Thrown if precision is out of range (must be in [0, 8]). | [
"Return",
"the",
"international",
"mapcode",
"as",
"a",
"shorter",
"version",
"using",
"the",
"ISO",
"territory",
"codes",
"where",
"possible",
".",
"International",
"codes",
"use",
"a",
"territory",
"code",
"AAA",
".",
"The",
"format",
"of",
"the",
"code",
... | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Mapcode.java#L218-L221 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/IOUtil.java | IOUtil.chooseFile | public static File chooseFile(String title, File currentDir) {
if (currentDir == null) currentDir = new File(".");
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(currentDir);
fileChooser.setDialogTitle(title);
fileChooser.setMultiSelectionEnabled(false);
int result = fileChooser.showOpenDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile();
}
return null;
} | java | public static File chooseFile(String title, File currentDir) {
if (currentDir == null) currentDir = new File(".");
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(currentDir);
fileChooser.setDialogTitle(title);
fileChooser.setMultiSelectionEnabled(false);
int result = fileChooser.showOpenDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile();
}
return null;
} | [
"public",
"static",
"File",
"chooseFile",
"(",
"String",
"title",
",",
"File",
"currentDir",
")",
"{",
"if",
"(",
"currentDir",
"==",
"null",
")",
"currentDir",
"=",
"new",
"File",
"(",
"\".\"",
")",
";",
"JFileChooser",
"fileChooser",
"=",
"new",
"JFileCh... | Open a {@link javax.swing.JFileChooser}, and return the selected file, or null if closed or cancelled.
@param title The title of the file-chooser window.
@param currentDir The root directory. If null, {@code new File(".")} will be used.
@return The chosen file, or null if none was chosen. | [
"Open",
"a",
"{",
"@link",
"javax",
".",
"swing",
".",
"JFileChooser",
"}",
"and",
"return",
"the",
"selected",
"file",
"or",
"null",
"if",
"closed",
"or",
"cancelled",
"."
] | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/IOUtil.java#L73-L84 |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java | AbstractServerBase.attemptToBind | private boolean attemptToBind(final int port) throws Throwable {
log.debug("Attempting to start {} on port {}.", serverName, port);
this.queryExecutor = createQueryExecutor();
this.handler = initializeHandler();
final NettyBufferPool bufferPool = new NettyBufferPool(numEventLoopThreads);
final ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("Flink " + serverName + " EventLoop Thread %d")
.build();
final NioEventLoopGroup nioGroup = new NioEventLoopGroup(numEventLoopThreads, threadFactory);
this.bootstrap = new ServerBootstrap()
.localAddress(bindAddress, port)
.group(nioGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.ALLOCATOR, bufferPool)
.childOption(ChannelOption.ALLOCATOR, bufferPool)
.childHandler(new ServerChannelInitializer<>(handler));
final int defaultHighWaterMark = 64 * 1024; // from DefaultChannelConfig (not exposed)
//noinspection ConstantConditions
// (ignore warning here to make this flexible in case the configuration values change)
if (LOW_WATER_MARK > defaultHighWaterMark) {
bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
} else { // including (newHighWaterMark < defaultLowWaterMark)
bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
}
try {
final ChannelFuture future = bootstrap.bind().sync();
if (future.isSuccess()) {
final InetSocketAddress localAddress = (InetSocketAddress) future.channel().localAddress();
serverAddress = new InetSocketAddress(localAddress.getAddress(), localAddress.getPort());
return true;
}
// the following throw is to bypass Netty's "optimization magic"
// and catch the bind exception.
// the exception is thrown by the sync() call above.
throw future.cause();
} catch (BindException e) {
log.debug("Failed to start {} on port {}: {}.", serverName, port, e.getMessage());
try {
// we shutdown the server but we reset the future every time because in
// case of failure to bind, we will call attemptToBind() here, and not resetting
// the flag will interfere with future shutdown attempts.
shutdownServer()
.whenComplete((ignoredV, ignoredT) -> serverShutdownFuture.getAndSet(null))
.get();
} catch (Exception r) {
// Here we were seeing this problem:
// https://github.com/netty/netty/issues/4357 if we do a get().
// this is why we now simply wait a bit so that everything is shut down.
log.warn("Problem while shutting down {}: {}", serverName, r.getMessage());
}
}
// any other type of exception we let it bubble up.
return false;
} | java | private boolean attemptToBind(final int port) throws Throwable {
log.debug("Attempting to start {} on port {}.", serverName, port);
this.queryExecutor = createQueryExecutor();
this.handler = initializeHandler();
final NettyBufferPool bufferPool = new NettyBufferPool(numEventLoopThreads);
final ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("Flink " + serverName + " EventLoop Thread %d")
.build();
final NioEventLoopGroup nioGroup = new NioEventLoopGroup(numEventLoopThreads, threadFactory);
this.bootstrap = new ServerBootstrap()
.localAddress(bindAddress, port)
.group(nioGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.ALLOCATOR, bufferPool)
.childOption(ChannelOption.ALLOCATOR, bufferPool)
.childHandler(new ServerChannelInitializer<>(handler));
final int defaultHighWaterMark = 64 * 1024; // from DefaultChannelConfig (not exposed)
//noinspection ConstantConditions
// (ignore warning here to make this flexible in case the configuration values change)
if (LOW_WATER_MARK > defaultHighWaterMark) {
bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
} else { // including (newHighWaterMark < defaultLowWaterMark)
bootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
bootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
}
try {
final ChannelFuture future = bootstrap.bind().sync();
if (future.isSuccess()) {
final InetSocketAddress localAddress = (InetSocketAddress) future.channel().localAddress();
serverAddress = new InetSocketAddress(localAddress.getAddress(), localAddress.getPort());
return true;
}
// the following throw is to bypass Netty's "optimization magic"
// and catch the bind exception.
// the exception is thrown by the sync() call above.
throw future.cause();
} catch (BindException e) {
log.debug("Failed to start {} on port {}: {}.", serverName, port, e.getMessage());
try {
// we shutdown the server but we reset the future every time because in
// case of failure to bind, we will call attemptToBind() here, and not resetting
// the flag will interfere with future shutdown attempts.
shutdownServer()
.whenComplete((ignoredV, ignoredT) -> serverShutdownFuture.getAndSet(null))
.get();
} catch (Exception r) {
// Here we were seeing this problem:
// https://github.com/netty/netty/issues/4357 if we do a get().
// this is why we now simply wait a bit so that everything is shut down.
log.warn("Problem while shutting down {}: {}", serverName, r.getMessage());
}
}
// any other type of exception we let it bubble up.
return false;
} | [
"private",
"boolean",
"attemptToBind",
"(",
"final",
"int",
"port",
")",
"throws",
"Throwable",
"{",
"log",
".",
"debug",
"(",
"\"Attempting to start {} on port {}.\"",
",",
"serverName",
",",
"port",
")",
";",
"this",
".",
"queryExecutor",
"=",
"createQueryExecut... | Tries to start the server at the provided port.
<p>This, in conjunction with {@link #start()}, try to start the
server on a free port among the port range provided at the constructor.
@param port the port to try to bind the server to.
@throws Exception If something goes wrong during the bind operation. | [
"Tries",
"to",
"start",
"the",
"server",
"at",
"the",
"provided",
"port",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java#L211-L279 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Project.java | Project.removeRepository | public void removeRepository(Repository repo) throws GreenPepperServerException
{
if(!repositories.contains(repo))
{
throw new GreenPepperServerException( GreenPepperServerErrorKey.REPOSITORY_NOT_FOUND, "Repository not found");
}
repositories.remove(repo);
repo.setProject(null);
} | java | public void removeRepository(Repository repo) throws GreenPepperServerException
{
if(!repositories.contains(repo))
{
throw new GreenPepperServerException( GreenPepperServerErrorKey.REPOSITORY_NOT_FOUND, "Repository not found");
}
repositories.remove(repo);
repo.setProject(null);
} | [
"public",
"void",
"removeRepository",
"(",
"Repository",
"repo",
")",
"throws",
"GreenPepperServerException",
"{",
"if",
"(",
"!",
"repositories",
".",
"contains",
"(",
"repo",
")",
")",
"{",
"throw",
"new",
"GreenPepperServerException",
"(",
"GreenPepperServerError... | <p>removeRepository.</p>
@param repo a {@link com.greenpepper.server.domain.Repository} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"removeRepository",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Project.java#L138-L147 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationImpl_CustomFieldSerializer.java | OWLAnnotationImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLAnnotationImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationImpl_CustomFieldSerializer.java#L93-L96 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/model/ResultDataModel.java | ResultDataModel.getRowData | public SortedMap<String,Object> getRowData() {
if (result == null) {
return (null);
} else if (!isRowAvailable()) {
throw new NoRowAvailableException();
} else {
//noinspection unchecked
return ((SortedMap<String,Object>)rows[index]);
}
} | java | public SortedMap<String,Object> getRowData() {
if (result == null) {
return (null);
} else if (!isRowAvailable()) {
throw new NoRowAvailableException();
} else {
//noinspection unchecked
return ((SortedMap<String,Object>)rows[index]);
}
} | [
"public",
"SortedMap",
"<",
"String",
",",
"Object",
">",
"getRowData",
"(",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"(",
"null",
")",
";",
"}",
"else",
"if",
"(",
"!",
"isRowAvailable",
"(",
")",
")",
"{",
"throw",
"new",
... | <p>If row data is available, return the <code>SortedMap</code> array
element at the index specified by <code>rowIndex</code> of the
array returned by calling <code>getRows()</code> on the underlying
<code>Result</code>. If no wrapped data is available,
return <code>null</code>.</p>
<p>Note that, if a non-<code>null</code> <code>Map</code> is returned
by this method, it will contain the values of the columns for the
current row, keyed by column name. Column name comparisons must be
performed in a case-insensitive manner.</p>
@throws FacesException if an error occurs getting the row data
@throws IllegalArgumentException if now row data is available
at the currently specified row index | [
"<p",
">",
"If",
"row",
"data",
"is",
"available",
"return",
"the",
"<code",
">",
"SortedMap<",
"/",
"code",
">",
"array",
"element",
"at",
"the",
"index",
"specified",
"by",
"<code",
">",
"rowIndex<",
"/",
"code",
">",
"of",
"the",
"array",
"returned",
... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/model/ResultDataModel.java#L160-L171 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java | RSAUtils.verifySignatureWithPublicKey | public static boolean verifySignatureWithPublicKey(byte[] keyData, byte[] message,
byte[] signature, String signAlgo) throws NoSuchAlgorithmException,
InvalidKeySpecException, InvalidKeyException, SignatureException {
RSAPublicKey key = buildPublicKey(keyData);
return verifySignature(key, message, signature, signAlgo);
} | java | public static boolean verifySignatureWithPublicKey(byte[] keyData, byte[] message,
byte[] signature, String signAlgo) throws NoSuchAlgorithmException,
InvalidKeySpecException, InvalidKeyException, SignatureException {
RSAPublicKey key = buildPublicKey(keyData);
return verifySignature(key, message, signature, signAlgo);
} | [
"public",
"static",
"boolean",
"verifySignatureWithPublicKey",
"(",
"byte",
"[",
"]",
"keyData",
",",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"signature",
",",
"String",
"signAlgo",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecExcepti... | Verify a signature with RSA public key.
@param keyData
RSA public key data (value of {@link RSAPublicKey#getEncoded()})
@param message
@param signature
@param signAlgo
signature algorithm to use. If empty, {@link #DEFAULT_SIGNATURE_ALGORITHM} will be
used.
@return
@throws NoSuchAlgorithmException
@throws InvalidKeySpecException
@throws InvalidKeyException
@throws SignatureException | [
"Verify",
"a",
"signature",
"with",
"RSA",
"public",
"key",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java#L330-L335 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Document.java | Document.addTitle | public boolean addTitle(String title) {
try {
return add(new Meta(Element.TITLE, title));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | java | public boolean addTitle(String title) {
try {
return add(new Meta(Element.TITLE, title));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | [
"public",
"boolean",
"addTitle",
"(",
"String",
"title",
")",
"{",
"try",
"{",
"return",
"add",
"(",
"new",
"Meta",
"(",
"Element",
".",
"TITLE",
",",
"title",
")",
")",
";",
"}",
"catch",
"(",
"DocumentException",
"de",
")",
"{",
"throw",
"new",
"Ex... | Adds the title to a Document.
@param title
the title
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise | [
"Adds",
"the",
"title",
"to",
"a",
"Document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L528-L534 |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/options/KarafDistributionOption.java | KarafDistributionOption.editConfigurationFilePut | public static Option[] editConfigurationFilePut(final String configurationFilePath,
File source, String... keysToUseFromSource) {
return createOptionListFromFile(source, new FileOptionFactory() {
@Override
public Option createOption(String key, Object value) {
return new KarafDistributionConfigurationFilePutOption(configurationFilePath, key,
value);
}
}, keysToUseFromSource);
} | java | public static Option[] editConfigurationFilePut(final String configurationFilePath,
File source, String... keysToUseFromSource) {
return createOptionListFromFile(source, new FileOptionFactory() {
@Override
public Option createOption(String key, Object value) {
return new KarafDistributionConfigurationFilePutOption(configurationFilePath, key,
value);
}
}, keysToUseFromSource);
} | [
"public",
"static",
"Option",
"[",
"]",
"editConfigurationFilePut",
"(",
"final",
"String",
"configurationFilePath",
",",
"File",
"source",
",",
"String",
"...",
"keysToUseFromSource",
")",
"{",
"return",
"createOptionListFromFile",
"(",
"source",
",",
"new",
"FileO... | This option allows to configure each configuration file based on the karaf.home location. The
value is "put" which means it is either replaced or added. For simpler configuration you can
add a file source. If you want to put all values from this file do not configure any
keysToUseFromSource; otherwise define them to use only those specific values.
@param configurationFilePath
configuration file path
@param source
configuration source file
@param keysToUseFromSource
configuration keys to be used
@return option array | [
"This",
"option",
"allows",
"to",
"configure",
"each",
"configuration",
"file",
"based",
"on",
"the",
"karaf",
".",
"home",
"location",
".",
"The",
"value",
"is",
"put",
"which",
"means",
"it",
"is",
"either",
"replaced",
"or",
"added",
".",
"For",
"simple... | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/options/KarafDistributionOption.java#L194-L204 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java | AnalyzeSpark.sampleInvalidFromColumn | public static List<Writable> sampleInvalidFromColumn(int numToSample, String columnName, Schema schema,
JavaRDD<List<Writable>> data, boolean ignoreMissing) {
//First: filter out all valid entries, to leave only invalid entries
int colIdx = schema.getIndexOfColumn(columnName);
JavaRDD<Writable> ithColumn = data.map(new SelectColumnFunction(colIdx));
ColumnMetaData meta = schema.getMetaData(columnName);
JavaRDD<Writable> invalid = ithColumn.filter(new FilterWritablesBySchemaFunction(meta, false, ignoreMissing));
return invalid.takeSample(false, numToSample);
} | java | public static List<Writable> sampleInvalidFromColumn(int numToSample, String columnName, Schema schema,
JavaRDD<List<Writable>> data, boolean ignoreMissing) {
//First: filter out all valid entries, to leave only invalid entries
int colIdx = schema.getIndexOfColumn(columnName);
JavaRDD<Writable> ithColumn = data.map(new SelectColumnFunction(colIdx));
ColumnMetaData meta = schema.getMetaData(columnName);
JavaRDD<Writable> invalid = ithColumn.filter(new FilterWritablesBySchemaFunction(meta, false, ignoreMissing));
return invalid.takeSample(false, numToSample);
} | [
"public",
"static",
"List",
"<",
"Writable",
">",
"sampleInvalidFromColumn",
"(",
"int",
"numToSample",
",",
"String",
"columnName",
",",
"Schema",
"schema",
",",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"data",
",",
"boolean",
"ignoreMissing",
")",
... | Randomly sample a set of invalid values from a specified column.
Values are considered invalid according to the Schema / ColumnMetaData
@param numToSample Maximum number of invalid values to sample
@param columnName Same of the column from which to sample invalid values
@param schema Data schema
@param data Data
@param ignoreMissing If true: ignore missing values (NullWritable or empty/null string) when sampling. If false: include missing values in sampling
@return List of invalid examples | [
"Randomly",
"sample",
"a",
"set",
"of",
"invalid",
"values",
"from",
"a",
"specified",
"column",
".",
"Values",
"are",
"considered",
"invalid",
"according",
"to",
"the",
"Schema",
"/",
"ColumnMetaData"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L328-L339 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java | MultipleObjectsBundle.appendColumn | public MultipleObjectsBundle appendColumn(SimpleTypeInformation<?> type, List<?> data) {
meta.add(type);
columns.add(data);
return this;
} | java | public MultipleObjectsBundle appendColumn(SimpleTypeInformation<?> type, List<?> data) {
meta.add(type);
columns.add(data);
return this;
} | [
"public",
"MultipleObjectsBundle",
"appendColumn",
"(",
"SimpleTypeInformation",
"<",
"?",
">",
"type",
",",
"List",
"<",
"?",
">",
"data",
")",
"{",
"meta",
".",
"add",
"(",
"type",
")",
";",
"columns",
".",
"add",
"(",
"data",
")",
";",
"return",
"th... | Helper to add a single column to the bundle.
@param type Type information
@param data Data to add
@return This object, for chaining. | [
"Helper",
"to",
"add",
"a",
"single",
"column",
"to",
"the",
"bundle",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/MultipleObjectsBundle.java#L133-L137 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java | RendererUtils.findUISelectManyConverter | public static Converter findUISelectManyConverter(
FacesContext facesContext, UISelectMany component)
{
return findUISelectManyConverter(facesContext, component, false);
} | java | public static Converter findUISelectManyConverter(
FacesContext facesContext, UISelectMany component)
{
return findUISelectManyConverter(facesContext, component, false);
} | [
"public",
"static",
"Converter",
"findUISelectManyConverter",
"(",
"FacesContext",
"facesContext",
",",
"UISelectMany",
"component",
")",
"{",
"return",
"findUISelectManyConverter",
"(",
"facesContext",
",",
"component",
",",
"false",
")",
";",
"}"
] | Calls findUISelectManyConverter with considerValueType = false.
@param facesContext
@param component
@return | [
"Calls",
"findUISelectManyConverter",
"with",
"considerValueType",
"=",
"false",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/RendererUtils.java#L553-L557 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java | Streams.readAll | @Deprecated
public static String readAll(final InputStream inputStream) throws IOException {
return readAll(inputStream, Charset.defaultCharset());
} | java | @Deprecated
public static String readAll(final InputStream inputStream) throws IOException {
return readAll(inputStream, Charset.defaultCharset());
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"readAll",
"(",
"final",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"return",
"readAll",
"(",
"inputStream",
",",
"Charset",
".",
"defaultCharset",
"(",
")",
")",
";",
"}"
] | Reads all input into memory, close the steam, and return as a String. Reads
the input in the default charset: Charset.defaultCharset().
@param inputStream InputStream to read from.
@return String contents of the stream.
@throws IOException if there is an problem reading from the stream.
@deprecated it is always safer to supply a charset. See
{@link #readAll(InputStream, Charset)}. | [
"Reads",
"all",
"input",
"into",
"memory",
"close",
"the",
"steam",
"and",
"return",
"as",
"a",
"String",
".",
"Reads",
"the",
"input",
"in",
"the",
"default",
"charset",
":",
"Charset",
".",
"defaultCharset",
"()",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java#L71-L74 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java | MavenModelScannerPlugin.addParent | private void addParent(MavenPomDescriptor pomDescriptor, Model model, ScannerContext context) {
Parent parent = model.getParent();
if (null != parent) {
ArtifactResolver resolver = getArtifactResolver(context);
MavenArtifactDescriptor parentDescriptor = resolver.resolve(new ParentCoordinates(parent), context);
pomDescriptor.setParent(parentDescriptor);
}
} | java | private void addParent(MavenPomDescriptor pomDescriptor, Model model, ScannerContext context) {
Parent parent = model.getParent();
if (null != parent) {
ArtifactResolver resolver = getArtifactResolver(context);
MavenArtifactDescriptor parentDescriptor = resolver.resolve(new ParentCoordinates(parent), context);
pomDescriptor.setParent(parentDescriptor);
}
} | [
"private",
"void",
"addParent",
"(",
"MavenPomDescriptor",
"pomDescriptor",
",",
"Model",
"model",
",",
"ScannerContext",
"context",
")",
"{",
"Parent",
"parent",
"=",
"model",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"parent",
")",
"{",
"... | Adds information about parent POM.
@param pomDescriptor
The descriptor for the current POM.
@param model
The Maven Model.
@param context
The scanner context. | [
"Adds",
"information",
"about",
"parent",
"POM",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L481-L488 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/MethodResource.java | MethodResource.getAllObjectMethods | @GET
@Produces({ HTML, XML })
public Response getAllObjectMethods(
@PathParam(RestParam.PID)
String pid,
@QueryParam(RestParam.AS_OF_DATE_TIME)
String dTime,
@QueryParam(RestParam.FORMAT)
@DefaultValue(HTML)
String format,
@QueryParam(RestParam.FLASH)
@DefaultValue("false")
boolean flash) {
return getObjectMethodsForSDefImpl(pid, null, dTime, format, flash);
} | java | @GET
@Produces({ HTML, XML })
public Response getAllObjectMethods(
@PathParam(RestParam.PID)
String pid,
@QueryParam(RestParam.AS_OF_DATE_TIME)
String dTime,
@QueryParam(RestParam.FORMAT)
@DefaultValue(HTML)
String format,
@QueryParam(RestParam.FLASH)
@DefaultValue("false")
boolean flash) {
return getObjectMethodsForSDefImpl(pid, null, dTime, format, flash);
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"HTML",
",",
"XML",
"}",
")",
"public",
"Response",
"getAllObjectMethods",
"(",
"@",
"PathParam",
"(",
"RestParam",
".",
"PID",
")",
"String",
"pid",
",",
"@",
"QueryParam",
"(",
"RestParam",
".",
"AS_OF_DATE_TIME",
... | Lists all Service Definitions methods that can be invoked on a digital
object.
GET /objects/{pid}/methods ? format asOfDateTime | [
"Lists",
"all",
"Service",
"Definitions",
"methods",
"that",
"can",
"be",
"invoked",
"on",
"a",
"digital",
"object",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/MethodResource.java#L51-L65 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java | JsonWriter.propDateTime | public JsonWriter propDateTime(String name, @Nullable Date value) {
return name(name).valueDateTime(value);
} | java | public JsonWriter propDateTime(String name, @Nullable Date value) {
return name(name).valueDateTime(value);
} | [
"public",
"JsonWriter",
"propDateTime",
"(",
"String",
"name",
",",
"@",
"Nullable",
"Date",
"value",
")",
"{",
"return",
"name",
"(",
"name",
")",
".",
"valueDateTime",
"(",
"value",
")",
";",
"}"
] | Encodes the property name and datetime value (ISO format).
Output is for example <code>"theDate":"2013-01-24T13:12:45+01"</code>.
@throws org.sonar.api.utils.text.WriterException on any failure | [
"Encodes",
"the",
"property",
"name",
"and",
"datetime",
"value",
"(",
"ISO",
"format",
")",
".",
"Output",
"is",
"for",
"example",
"<code",
">",
"theDate",
":",
"2013",
"-",
"01",
"-",
"24T13",
":",
"12",
":",
"45",
"+",
"01",
"<",
"/",
"code",
">... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java#L351-L353 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/Asm.java | Asm.tword_ptr_abs | public static final Mem tword_ptr_abs(long target, Register index, int shift, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, index, shift, disp, segmentPrefix, SIZE_TWORD);
} | java | public static final Mem tword_ptr_abs(long target, Register index, int shift, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, index, shift, disp, segmentPrefix, SIZE_TWORD);
} | [
"public",
"static",
"final",
"Mem",
"tword_ptr_abs",
"(",
"long",
"target",
",",
"Register",
"index",
",",
"int",
"shift",
",",
"long",
"disp",
",",
"SEGMENT",
"segmentPrefix",
")",
"{",
"return",
"_ptr_build_abs",
"(",
"target",
",",
"index",
",",
"shift",
... | Create tword (10 Bytes) pointer operand (used for 80 bit floating points). | [
"Create",
"tword",
"(",
"10",
"Bytes",
")",
"pointer",
"operand",
"(",
"used",
"for",
"80",
"bit",
"floating",
"points",
")",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L470-L472 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.isMonitorNotify | public static boolean isMonitorNotify(String methodName, String methodSig) {
return ("notify".equals(methodName) || "notifyAll".equals(methodName)) && "()V".equals(methodSig);
} | java | public static boolean isMonitorNotify(String methodName, String methodSig) {
return ("notify".equals(methodName) || "notifyAll".equals(methodName)) && "()V".equals(methodSig);
} | [
"public",
"static",
"boolean",
"isMonitorNotify",
"(",
"String",
"methodName",
",",
"String",
"methodSig",
")",
"{",
"return",
"(",
"\"notify\"",
".",
"equals",
"(",
"methodName",
")",
"||",
"\"notifyAll\"",
".",
"equals",
"(",
"methodName",
")",
")",
"&&",
... | Determine if method whose name and signature is specified is a monitor
notify operation.
@param methodName
name of the method
@param methodSig
signature of the method
@return true if the method is a monitor notify, false if not | [
"Determine",
"if",
"method",
"whose",
"name",
"and",
"signature",
"is",
"specified",
"is",
"a",
"monitor",
"notify",
"operation",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L190-L192 |
OpenTSDB/opentsdb | src/tsd/QueryRpc.java | QueryRpc.execute | @Override
public void execute(final TSDB tsdb, final HttpQuery query)
throws IOException {
// only accept GET/POST/DELETE
if (query.method() != HttpMethod.GET && query.method() != HttpMethod.POST &&
query.method() != HttpMethod.DELETE) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getName() +
"] is not permitted for this endpoint");
}
if (query.method() == HttpMethod.DELETE &&
!tsdb.getConfig().getBoolean("tsd.http.query.allow_delete")) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Bad request",
"Deleting data is not enabled (tsd.http.query.allow_delete=false)");
}
final String[] uri = query.explodeAPIPath();
final String endpoint = uri.length > 1 ? uri[1] : "";
if (endpoint.toLowerCase().equals("last")) {
handleLastDataPointQuery(tsdb, query);
} else if (endpoint.toLowerCase().equals("gexp")){
handleQuery(tsdb, query, true);
} else if (endpoint.toLowerCase().equals("exp")) {
handleExpressionQuery(tsdb, query);
return;
} else {
handleQuery(tsdb, query, false);
}
} | java | @Override
public void execute(final TSDB tsdb, final HttpQuery query)
throws IOException {
// only accept GET/POST/DELETE
if (query.method() != HttpMethod.GET && query.method() != HttpMethod.POST &&
query.method() != HttpMethod.DELETE) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getName() +
"] is not permitted for this endpoint");
}
if (query.method() == HttpMethod.DELETE &&
!tsdb.getConfig().getBoolean("tsd.http.query.allow_delete")) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Bad request",
"Deleting data is not enabled (tsd.http.query.allow_delete=false)");
}
final String[] uri = query.explodeAPIPath();
final String endpoint = uri.length > 1 ? uri[1] : "";
if (endpoint.toLowerCase().equals("last")) {
handleLastDataPointQuery(tsdb, query);
} else if (endpoint.toLowerCase().equals("gexp")){
handleQuery(tsdb, query, true);
} else if (endpoint.toLowerCase().equals("exp")) {
handleExpressionQuery(tsdb, query);
return;
} else {
handleQuery(tsdb, query, false);
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpQuery",
"query",
")",
"throws",
"IOException",
"{",
"// only accept GET/POST/DELETE",
"if",
"(",
"query",
".",
"method",
"(",
")",
"!=",
"HttpMethod",
".",
"GET",
... | Implements the /api/query endpoint to fetch data from OpenTSDB.
@param tsdb The TSDB to use for fetching data
@param query The HTTP query for parsing and responding | [
"Implements",
"the",
"/",
"api",
"/",
"query",
"endpoint",
"to",
"fetch",
"data",
"from",
"OpenTSDB",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L88-L119 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java | Functionizer.makeAllocatingConstructor | private FunctionDeclaration makeAllocatingConstructor(
MethodDeclaration method, boolean releasing) {
assert method.isConstructor();
ExecutableElement element = method.getExecutableElement();
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
String name = releasing ? nameTable.getReleasingConstructorName(element)
: nameTable.getAllocatingConstructorName(element);
FunctionDeclaration function = new FunctionDeclaration(name, declaringClass.asType());
function.setLineNumber(method.getLineNumber());
function.setModifiers(ElementUtil.isPrivate(element) ? Modifier.PRIVATE : Modifier.PUBLIC);
function.setReturnsRetained(!releasing);
TreeUtil.copyList(method.getParameters(), function.getParameters());
Block body = new Block();
function.setBody(body);
StringBuilder sb = new StringBuilder(releasing ? "J2OBJC_CREATE_IMPL(" : "J2OBJC_NEW_IMPL(");
sb.append(nameTable.getFullName(declaringClass));
sb.append(", ").append(nameTable.getFunctionName(element));
for (SingleVariableDeclaration param : function.getParameters()) {
sb.append(", ").append(nameTable.getVariableQualifiedName(param.getVariableElement()));
}
sb.append(")");
body.addStatement(new NativeStatement(sb.toString()));
return function;
} | java | private FunctionDeclaration makeAllocatingConstructor(
MethodDeclaration method, boolean releasing) {
assert method.isConstructor();
ExecutableElement element = method.getExecutableElement();
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
String name = releasing ? nameTable.getReleasingConstructorName(element)
: nameTable.getAllocatingConstructorName(element);
FunctionDeclaration function = new FunctionDeclaration(name, declaringClass.asType());
function.setLineNumber(method.getLineNumber());
function.setModifiers(ElementUtil.isPrivate(element) ? Modifier.PRIVATE : Modifier.PUBLIC);
function.setReturnsRetained(!releasing);
TreeUtil.copyList(method.getParameters(), function.getParameters());
Block body = new Block();
function.setBody(body);
StringBuilder sb = new StringBuilder(releasing ? "J2OBJC_CREATE_IMPL(" : "J2OBJC_NEW_IMPL(");
sb.append(nameTable.getFullName(declaringClass));
sb.append(", ").append(nameTable.getFunctionName(element));
for (SingleVariableDeclaration param : function.getParameters()) {
sb.append(", ").append(nameTable.getVariableQualifiedName(param.getVariableElement()));
}
sb.append(")");
body.addStatement(new NativeStatement(sb.toString()));
return function;
} | [
"private",
"FunctionDeclaration",
"makeAllocatingConstructor",
"(",
"MethodDeclaration",
"method",
",",
"boolean",
"releasing",
")",
"{",
"assert",
"method",
".",
"isConstructor",
"(",
")",
";",
"ExecutableElement",
"element",
"=",
"method",
".",
"getExecutableElement",... | Create a wrapper for a constructor that does the object allocation. | [
"Create",
"a",
"wrapper",
"for",
"a",
"constructor",
"that",
"does",
"the",
"object",
"allocation",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java#L456-L482 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/EventMessenger.java | EventMessenger.sendToAllExcept | public void sendToAllExcept(String topicURI, Object event,
Set<String> excludeWebSocketSessionIds) {
EventMessage eventMessage = new EventMessage(topicURI, event);
eventMessage.setExcludeWebSocketSessionIds(excludeWebSocketSessionIds);
send(eventMessage);
} | java | public void sendToAllExcept(String topicURI, Object event,
Set<String> excludeWebSocketSessionIds) {
EventMessage eventMessage = new EventMessage(topicURI, event);
eventMessage.setExcludeWebSocketSessionIds(excludeWebSocketSessionIds);
send(eventMessage);
} | [
"public",
"void",
"sendToAllExcept",
"(",
"String",
"topicURI",
",",
"Object",
"event",
",",
"Set",
"<",
"String",
">",
"excludeWebSocketSessionIds",
")",
"{",
"EventMessage",
"eventMessage",
"=",
"new",
"EventMessage",
"(",
"topicURI",
",",
"event",
")",
";",
... | Send an {@link EventMessage} to every client that is currently subscribed to the
provided topicURI except the ones listed in the excludeSessionIds set.
@param topicURI the name of the topic
@param event the payload of the {@link EventMessage}
@param excludeWebSocketSessionIds a set of WebSocket session ids that will be
excluded. If null or empty no client will be excluded. | [
"Send",
"an",
"{",
"@link",
"EventMessage",
"}",
"to",
"every",
"client",
"that",
"is",
"currently",
"subscribed",
"to",
"the",
"provided",
"topicURI",
"except",
"the",
"ones",
"listed",
"in",
"the",
"excludeSessionIds",
"set",
"."
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/EventMessenger.java#L99-L104 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.beginGetEffectiveRouteTableAsync | public Observable<EffectiveRouteListResultInner> beginGetEffectiveRouteTableAsync(String resourceGroupName, String networkInterfaceName) {
return beginGetEffectiveRouteTableWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveRouteListResultInner>, EffectiveRouteListResultInner>() {
@Override
public EffectiveRouteListResultInner call(ServiceResponse<EffectiveRouteListResultInner> response) {
return response.body();
}
});
} | java | public Observable<EffectiveRouteListResultInner> beginGetEffectiveRouteTableAsync(String resourceGroupName, String networkInterfaceName) {
return beginGetEffectiveRouteTableWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveRouteListResultInner>, EffectiveRouteListResultInner>() {
@Override
public EffectiveRouteListResultInner call(ServiceResponse<EffectiveRouteListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EffectiveRouteListResultInner",
">",
"beginGetEffectiveRouteTableAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"beginGetEffectiveRouteTableWithServiceResponseAsync",
"(",
"resourceGroupName",
"... | Gets all route tables applied to a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EffectiveRouteListResultInner object | [
"Gets",
"all",
"route",
"tables",
"applied",
"to",
"a",
"network",
"interface",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1284-L1291 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/UtilIO.java | UtilIO.getSourcePath | public static String getSourcePath(String pkg, String app) {
String path = "";
if(pkg == null || app == null)
return path;
String pathToBase = getPathToBase();
if( pathToBase != null ) {
if(pkg.contains("examples"))
path = new File(pathToBase,"examples/src/main/java/").getAbsolutePath();
else if(pkg.contains("demonstrations"))
path = new File(pathToBase,"demonstrations/src/main/java/").getAbsolutePath();
else {
System.err.println("pkg must be to examples or demonstrations. " + pkg);
return path;
}
String pathToCode = pkg.replace('.','/') + "/" + app + ".java";
return new File(path,pathToCode).getPath();
} else {
// probably running inside a jar
String pathToCode = pkg.replace('.','/') + "/" + app + ".java";
URL url = UtilIO.class.getClassLoader().getResource(pathToCode);
if( url != null )
return url.toString();
else
return pathToCode;
}
} | java | public static String getSourcePath(String pkg, String app) {
String path = "";
if(pkg == null || app == null)
return path;
String pathToBase = getPathToBase();
if( pathToBase != null ) {
if(pkg.contains("examples"))
path = new File(pathToBase,"examples/src/main/java/").getAbsolutePath();
else if(pkg.contains("demonstrations"))
path = new File(pathToBase,"demonstrations/src/main/java/").getAbsolutePath();
else {
System.err.println("pkg must be to examples or demonstrations. " + pkg);
return path;
}
String pathToCode = pkg.replace('.','/') + "/" + app + ".java";
return new File(path,pathToCode).getPath();
} else {
// probably running inside a jar
String pathToCode = pkg.replace('.','/') + "/" + app + ".java";
URL url = UtilIO.class.getClassLoader().getResource(pathToCode);
if( url != null )
return url.toString();
else
return pathToCode;
}
} | [
"public",
"static",
"String",
"getSourcePath",
"(",
"String",
"pkg",
",",
"String",
"app",
")",
"{",
"String",
"path",
"=",
"\"\"",
";",
"if",
"(",
"pkg",
"==",
"null",
"||",
"app",
"==",
"null",
")",
"return",
"path",
";",
"String",
"pathToBase",
"=",... | Constructs the path for a source code file residing in the examples or demonstrations directory
In the case of the file not being in either directory, an empty string is returned
The expected parameters are class.getPackage().getName(), class.getSimpleName()
@param pkg package containing the class
@param app simple class name
@return | [
"Constructs",
"the",
"path",
"for",
"a",
"source",
"code",
"file",
"residing",
"in",
"the",
"examples",
"or",
"demonstrations",
"directory",
"In",
"the",
"case",
"of",
"the",
"file",
"not",
"being",
"in",
"either",
"directory",
"an",
"empty",
"string",
"is",... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/UtilIO.java#L388-L415 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/TransitionUtils.java | TransitionUtils.copyViewImage | @NonNull
public static View copyViewImage(@NonNull ViewGroup sceneRoot, @NonNull View view, @NonNull View parent) {
Matrix matrix = new Matrix();
matrix.setTranslate(-parent.getScrollX(), -parent.getScrollY());
ViewUtils.transformMatrixToGlobal(view, matrix);
ViewUtils.transformMatrixToLocal(sceneRoot, matrix);
RectF bounds = new RectF(0, 0, view.getWidth(), view.getHeight());
matrix.mapRect(bounds);
int left = Math.round(bounds.left);
int top = Math.round(bounds.top);
int right = Math.round(bounds.right);
int bottom = Math.round(bounds.bottom);
ImageView copy = new ImageView(view.getContext());
copy.setScaleType(ImageView.ScaleType.CENTER_CROP);
Bitmap bitmap = createViewBitmap(view, matrix, bounds);
if (bitmap != null) {
copy.setImageBitmap(bitmap);
}
int widthSpec = View.MeasureSpec.makeMeasureSpec(right - left, View.MeasureSpec.EXACTLY);
int heightSpec = View.MeasureSpec.makeMeasureSpec(bottom - top, View.MeasureSpec.EXACTLY);
copy.measure(widthSpec, heightSpec);
copy.layout(left, top, right, bottom);
return copy;
} | java | @NonNull
public static View copyViewImage(@NonNull ViewGroup sceneRoot, @NonNull View view, @NonNull View parent) {
Matrix matrix = new Matrix();
matrix.setTranslate(-parent.getScrollX(), -parent.getScrollY());
ViewUtils.transformMatrixToGlobal(view, matrix);
ViewUtils.transformMatrixToLocal(sceneRoot, matrix);
RectF bounds = new RectF(0, 0, view.getWidth(), view.getHeight());
matrix.mapRect(bounds);
int left = Math.round(bounds.left);
int top = Math.round(bounds.top);
int right = Math.round(bounds.right);
int bottom = Math.round(bounds.bottom);
ImageView copy = new ImageView(view.getContext());
copy.setScaleType(ImageView.ScaleType.CENTER_CROP);
Bitmap bitmap = createViewBitmap(view, matrix, bounds);
if (bitmap != null) {
copy.setImageBitmap(bitmap);
}
int widthSpec = View.MeasureSpec.makeMeasureSpec(right - left, View.MeasureSpec.EXACTLY);
int heightSpec = View.MeasureSpec.makeMeasureSpec(bottom - top, View.MeasureSpec.EXACTLY);
copy.measure(widthSpec, heightSpec);
copy.layout(left, top, right, bottom);
return copy;
} | [
"@",
"NonNull",
"public",
"static",
"View",
"copyViewImage",
"(",
"@",
"NonNull",
"ViewGroup",
"sceneRoot",
",",
"@",
"NonNull",
"View",
"view",
",",
"@",
"NonNull",
"View",
"parent",
")",
"{",
"Matrix",
"matrix",
"=",
"new",
"Matrix",
"(",
")",
";",
"ma... | Creates a View using the bitmap copy of <code>view</code>. If <code>view</code> is large,
the copy will use a scaled bitmap of the given view.
@param sceneRoot The ViewGroup in which the view copy will be displayed.
@param view The view to create a copy of.
@param parent The parent of view | [
"Creates",
"a",
"View",
"using",
"the",
"bitmap",
"copy",
"of",
"<code",
">",
"view<",
"/",
"code",
">",
".",
"If",
"<code",
">",
"view<",
"/",
"code",
">",
"is",
"large",
"the",
"copy",
"will",
"use",
"a",
"scaled",
"bitmap",
"of",
"the",
"given",
... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionUtils.java#L94-L118 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/batch/BatchClient.java | BatchClient.createJob | public CreateJobResponse createJob(CreateJobRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getName(), "The name should not be null or empty string.");
checkStringNotEmpty(request.getVmType(), "The vmType should not be null or empty string.");
checkStringNotEmpty(request.getJobDagJson(), "The jobDagJson should not be null or empty string.");
checkIsTrue(request.getVmCount() > 0, "The vmCount should greater than 0");
StringWriter writer = new StringWriter();
try {
JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("name", request.getName());
jsonGenerator.writeStringField("vmType", request.getVmType());
jsonGenerator.writeNumberField("vmCount", request.getVmCount());
jsonGenerator.writeStringField("jobDagJson", request.getJobDagJson());
if (request.getJobTimeoutInSeconds() != null) {
jsonGenerator.writeNumberField("jobTimeoutInSeconds", request.getJobTimeoutInSeconds());
}
if (request.getMemo() != null) {
jsonGenerator.writeStringField("memo", request.getMemo());
}
jsonGenerator.writeEndObject();
jsonGenerator.close();
} catch (IOException e) {
throw new BceClientException("Fail to generate json", e);
}
byte[] json = null;
try {
json = writer.toString().getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Fail to get UTF-8 bytes", e);
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, JOB);
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
internalRequest.setContent(RestartableInputStream.wrap(json));
internalRequest.addParameter("run", "immediate");
if (request.getClientToken() != null) {
internalRequest.addParameter("clientToken", request.getClientToken());
}
return this.invokeHttpClient(internalRequest, CreateJobResponse.class);
} | java | public CreateJobResponse createJob(CreateJobRequest request) {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getName(), "The name should not be null or empty string.");
checkStringNotEmpty(request.getVmType(), "The vmType should not be null or empty string.");
checkStringNotEmpty(request.getJobDagJson(), "The jobDagJson should not be null or empty string.");
checkIsTrue(request.getVmCount() > 0, "The vmCount should greater than 0");
StringWriter writer = new StringWriter();
try {
JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("name", request.getName());
jsonGenerator.writeStringField("vmType", request.getVmType());
jsonGenerator.writeNumberField("vmCount", request.getVmCount());
jsonGenerator.writeStringField("jobDagJson", request.getJobDagJson());
if (request.getJobTimeoutInSeconds() != null) {
jsonGenerator.writeNumberField("jobTimeoutInSeconds", request.getJobTimeoutInSeconds());
}
if (request.getMemo() != null) {
jsonGenerator.writeStringField("memo", request.getMemo());
}
jsonGenerator.writeEndObject();
jsonGenerator.close();
} catch (IOException e) {
throw new BceClientException("Fail to generate json", e);
}
byte[] json = null;
try {
json = writer.toString().getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Fail to get UTF-8 bytes", e);
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, JOB);
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
internalRequest.setContent(RestartableInputStream.wrap(json));
internalRequest.addParameter("run", "immediate");
if (request.getClientToken() != null) {
internalRequest.addParameter("clientToken", request.getClientToken());
}
return this.invokeHttpClient(internalRequest, CreateJobResponse.class);
} | [
"public",
"CreateJobResponse",
"createJob",
"(",
"CreateJobRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getName",
"(",
")",
",",
"\"The name should not be nu... | Create a Batch-Compute job with the specified options.
@param request The request containing all options for creating a Batch-Compute job.
@return The response containing the ID of the newly created job. | [
"Create",
"a",
"Batch",
"-",
"Compute",
"job",
"with",
"the",
"specified",
"options",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/batch/BatchClient.java#L177-L222 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Tuple1dfx.java | Tuple1dfx.set | void set(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
this.segment = segment;
this.x = x;
this.y = y;
} | java | void set(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
this.segment = segment;
this.x = x;
this.y = y;
} | [
"void",
"set",
"(",
"ObjectProperty",
"<",
"WeakReference",
"<",
"Segment1D",
"<",
"?",
",",
"?",
">",
">",
">",
"segment",
",",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
")",
"{",
"this",
".",
"segment",
"=",
"segment",
";",
"this",
".",
"x",... | Change the x and y properties.
@param segment the new segment property.
@param x the new x property.
@param y the new y property. | [
"Change",
"the",
"x",
"and",
"y",
"properties",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Tuple1dfx.java#L256-L260 |
facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.getRunningTasks | public int getRunningTasks(String poolName, TaskType type) {
Map<String, Integer> runningMap = (type == TaskType.MAP ?
poolRunningMaps : poolRunningReduces);
return (runningMap.containsKey(poolName) ?
runningMap.get(poolName) : 0);
} | java | public int getRunningTasks(String poolName, TaskType type) {
Map<String, Integer> runningMap = (type == TaskType.MAP ?
poolRunningMaps : poolRunningReduces);
return (runningMap.containsKey(poolName) ?
runningMap.get(poolName) : 0);
} | [
"public",
"int",
"getRunningTasks",
"(",
"String",
"poolName",
",",
"TaskType",
"type",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"runningMap",
"=",
"(",
"type",
"==",
"TaskType",
".",
"MAP",
"?",
"poolRunningMaps",
":",
"poolRunningReduces",
")",... | Get the number of running tasks in a pool
@param poolName name of the pool
@param type type of task to be set
@return number of running tasks | [
"Get",
"the",
"number",
"of",
"running",
"tasks",
"in",
"a",
"pool"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L741-L746 |
greese/dasein-persist | src/main/java/org/dasein/persist/PersistentFactory.java | PersistentFactory.addSingleton | public void addSingleton(String field, Class<? extends Execution> cls) {
singletons.put(field, cls);
} | java | public void addSingleton(String field, Class<? extends Execution> cls) {
singletons.put(field, cls);
} | [
"public",
"void",
"addSingleton",
"(",
"String",
"field",
",",
"Class",
"<",
"?",
"extends",
"Execution",
">",
"cls",
")",
"{",
"singletons",
".",
"put",
"(",
"field",
",",
"cls",
")",
";",
"}"
] | Adds a query for searches on a specified field. These searches return unique values.
@param field the field to search on
@param cls the class of the query that performs the search | [
"Adds",
"a",
"query",
"for",
"searches",
"on",
"a",
"specified",
"field",
".",
"These",
"searches",
"return",
"unique",
"values",
"."
] | train | https://github.com/greese/dasein-persist/blob/1104621ad1670a45488b093b984ec1db4c7be781/src/main/java/org/dasein/persist/PersistentFactory.java#L316-L318 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UISelectOne.java | UISelectOne.validateValue | @Override
protected void validateValue(FacesContext context, Object value)
{
super.validateValue(context, value);
if (!isValid() || value == null)
{
return;
}
// selected value must match to one of the available options
// and if required is true it must not match an option with noSelectionOption set to true (since 2.0)
Converter converter = getConverter();
// Since the iterator is used twice, it has sense to traverse it only once.
Collection<SelectItem> items = new ArrayList<SelectItem>();
for (Iterator<SelectItem> iter = new _SelectItemsIterator(this, context); iter.hasNext();)
{
items.add(iter.next());
}
if (_SelectItemsUtil.matchValue(context, this, value, items.iterator(), converter))
{
if (! this.isRequired())
{
return; // Matched & Required false, so return ok.
}
if (! _SelectItemsUtil.isNoSelectionOption(context, this, value,
items.iterator(), converter))
{
return; // Matched & Required true & No-selection did NOT match, so return ok.
}
}
_MessageUtils.addErrorMessage(context, this, INVALID_MESSAGE_ID,
new Object[] {_MessageUtils.getLabel(context, this) });
setValid(false);
} | java | @Override
protected void validateValue(FacesContext context, Object value)
{
super.validateValue(context, value);
if (!isValid() || value == null)
{
return;
}
// selected value must match to one of the available options
// and if required is true it must not match an option with noSelectionOption set to true (since 2.0)
Converter converter = getConverter();
// Since the iterator is used twice, it has sense to traverse it only once.
Collection<SelectItem> items = new ArrayList<SelectItem>();
for (Iterator<SelectItem> iter = new _SelectItemsIterator(this, context); iter.hasNext();)
{
items.add(iter.next());
}
if (_SelectItemsUtil.matchValue(context, this, value, items.iterator(), converter))
{
if (! this.isRequired())
{
return; // Matched & Required false, so return ok.
}
if (! _SelectItemsUtil.isNoSelectionOption(context, this, value,
items.iterator(), converter))
{
return; // Matched & Required true & No-selection did NOT match, so return ok.
}
}
_MessageUtils.addErrorMessage(context, this, INVALID_MESSAGE_ID,
new Object[] {_MessageUtils.getLabel(context, this) });
setValid(false);
} | [
"@",
"Override",
"protected",
"void",
"validateValue",
"(",
"FacesContext",
"context",
",",
"Object",
"value",
")",
"{",
"super",
".",
"validateValue",
"(",
"context",
",",
"value",
")",
";",
"if",
"(",
"!",
"isValid",
"(",
")",
"||",
"value",
"==",
"nul... | Verify that the result of converting the newly submitted value is <i>equal</i> to the value property of one of
the child SelectItem objects. If this is not true, a validation error is reported.
@see javax.faces.component.UIInput#validateValue(javax.faces.context.FacesContext,java.lang.Object) | [
"Verify",
"that",
"the",
"result",
"of",
"converting",
"the",
"newly",
"submitted",
"value",
"is",
"<i",
">",
"equal<",
"/",
"i",
">",
"to",
"the",
"value",
"property",
"of",
"one",
"of",
"the",
"child",
"SelectItem",
"objects",
".",
"If",
"this",
"is",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UISelectOne.java#L68-L104 |
m-m-m/util | io/src/main/java/net/sf/mmm/util/file/base/FileAccessPermissions.java | FileAccessPermissions.createByUmask | public static FileAccessPermissions createByUmask(int umask, boolean isDirectory) {
int fullAccessMask;
if (isDirectory) {
fullAccessMask = MASK_FULL_DIRECTORY_ACCESS;
} else {
fullAccessMask = MASK_FULL_FILE_ACCESS;
}
int mask = fullAccessMask & ~umask;
return new FileAccessPermissions(mask);
} | java | public static FileAccessPermissions createByUmask(int umask, boolean isDirectory) {
int fullAccessMask;
if (isDirectory) {
fullAccessMask = MASK_FULL_DIRECTORY_ACCESS;
} else {
fullAccessMask = MASK_FULL_FILE_ACCESS;
}
int mask = fullAccessMask & ~umask;
return new FileAccessPermissions(mask);
} | [
"public",
"static",
"FileAccessPermissions",
"createByUmask",
"(",
"int",
"umask",
",",
"boolean",
"isDirectory",
")",
"{",
"int",
"fullAccessMask",
";",
"if",
"(",
"isDirectory",
")",
"{",
"fullAccessMask",
"=",
"MASK_FULL_DIRECTORY_ACCESS",
";",
"}",
"else",
"{"... | This method create a new {@link FileAccessPermissions} instance according to the given
<code><a href="http://en.wikipedia.org/wiki/Umask">umask</a></code> (user file creation mode mask).
@param umask is the umask.
@param isDirectory {@code true} if the the {@link FileAccessPermissions} is to be created for a directory,
{@code false} for a regular file.
@return the according {@link FileAccessPermissions}. | [
"This",
"method",
"create",
"a",
"new",
"{",
"@link",
"FileAccessPermissions",
"}",
"instance",
"according",
"to",
"the",
"given",
"<code",
">",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Umask",
">",
"... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/io/src/main/java/net/sf/mmm/util/file/base/FileAccessPermissions.java#L93-L103 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/string.java | string.capitalizeWords | public static String capitalizeWords(String str, char[] delimiters) {
int delimLen = (delimiters == null ? -1 : delimiters.length);
if ((str == null) || (str.length() == 0) || (delimLen == 0)) {
return str;
}
int strLen = str.length();
StringBuffer buffer = new StringBuffer(strLen);
boolean capitalizeNext = true;
for (int i = 0; i < strLen; i++) {
char ch = str.charAt(i);
if (isDelimiter(ch, delimiters)) {
buffer.append(ch);
capitalizeNext = true;
} else if (capitalizeNext) {
buffer.append(Character.toTitleCase(ch));
capitalizeNext = false;
} else {
buffer.append(ch);
}
}
return buffer.toString();
} | java | public static String capitalizeWords(String str, char[] delimiters) {
int delimLen = (delimiters == null ? -1 : delimiters.length);
if ((str == null) || (str.length() == 0) || (delimLen == 0)) {
return str;
}
int strLen = str.length();
StringBuffer buffer = new StringBuffer(strLen);
boolean capitalizeNext = true;
for (int i = 0; i < strLen; i++) {
char ch = str.charAt(i);
if (isDelimiter(ch, delimiters)) {
buffer.append(ch);
capitalizeNext = true;
} else if (capitalizeNext) {
buffer.append(Character.toTitleCase(ch));
capitalizeNext = false;
} else {
buffer.append(ch);
}
}
return buffer.toString();
} | [
"public",
"static",
"String",
"capitalizeWords",
"(",
"String",
"str",
",",
"char",
"[",
"]",
"delimiters",
")",
"{",
"int",
"delimLen",
"=",
"(",
"delimiters",
"==",
"null",
"?",
"-",
"1",
":",
"delimiters",
".",
"length",
")",
";",
"if",
"(",
"(",
... | <p>
Capitalizes all the delimiter separated words in a String. Only the first letter of each word is changed.
</p>
<p/>
<p>
The delimiters represent a set of characters understood to separate words. The first string character and the
first non-delimiter character after a delimiter will be capitalized.
</p>
<p/>
<p>
A <code>null</code> input String returns <code>null</code>. Capitalization uses the unicode title case, normally
equivalent to upper case.
</p>
<p/>
<pre>
WordUtils.capitalize(null, *) = null
WordUtils.capitalize("", *) = ""
WordUtils.capitalize(*, new char[0]) = *
WordUtils.capitalize("i am fine", null) = "I Am Fine"
WordUtils.capitalize("i aM.fine", {'.'}) = "I aM.Fine"
</pre>
@param str the String to capitalize, may be null
@param delimiters set of characters to determine capitalization, null means whitespace
@return capitalized String, <code>null</code> if null String input | [
"<p",
">",
"Capitalizes",
"all",
"the",
"delimiter",
"separated",
"words",
"in",
"a",
"String",
".",
"Only",
"the",
"first",
"letter",
"of",
"each",
"word",
"is",
"changed",
".",
"<",
"/",
"p",
">",
"<p",
"/",
">",
"<p",
">",
"The",
"delimiters",
"re... | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/string.java#L186-L208 |
actframework/actframework | src/main/java/act/util/ClassNode.java | ClassNode.visitSubTree | public ClassNode visitSubTree($.Visitor<ClassNode> visitor, final boolean publicOnly, final boolean noAbstract) {
return visitSubTree($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor));
} | java | public ClassNode visitSubTree($.Visitor<ClassNode> visitor, final boolean publicOnly, final boolean noAbstract) {
return visitSubTree($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor));
} | [
"public",
"ClassNode",
"visitSubTree",
"(",
"$",
".",
"Visitor",
"<",
"ClassNode",
">",
"visitor",
",",
"final",
"boolean",
"publicOnly",
",",
"final",
"boolean",
"noAbstract",
")",
"{",
"return",
"visitSubTree",
"(",
"$",
".",
"guardedVisitor",
"(",
"classNod... | Accept a visitor that visit all descendants of the class represetned by
this `ClassNode` NOT including this `ClassNode` itself.
@param visitor the visitor
@param publicOnly specify if only public class shall be visited
@param noAbstract specify if abstract class can be visited
@return this `ClassNode` instance | [
"Accept",
"a",
"visitor",
"that",
"visit",
"all",
"descendants",
"of",
"the",
"class",
"represetned",
"by",
"this",
"ClassNode",
"NOT",
"including",
"this",
"ClassNode",
"itself",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/ClassNode.java#L241-L243 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java | SeaGlassTextFieldUI.createTextFieldBorder | protected TextFieldBorder createTextFieldBorder(SeaGlassContext context) {
if (textFieldBorder == null) {
textFieldBorder = new TextFieldBorder(this, context.getStyle().getInsets(context, null));
}
return textFieldBorder;
} | java | protected TextFieldBorder createTextFieldBorder(SeaGlassContext context) {
if (textFieldBorder == null) {
textFieldBorder = new TextFieldBorder(this, context.getStyle().getInsets(context, null));
}
return textFieldBorder;
} | [
"protected",
"TextFieldBorder",
"createTextFieldBorder",
"(",
"SeaGlassContext",
"context",
")",
"{",
"if",
"(",
"textFieldBorder",
"==",
"null",
")",
"{",
"textFieldBorder",
"=",
"new",
"TextFieldBorder",
"(",
"this",
",",
"context",
".",
"getStyle",
"(",
")",
... | DOCUMENT ME!
@param context DOCUMENT ME!
@return DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L702-L708 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_vmEncryption_kms_kmsId_GET | public OvhVMEncryptionAccessNetwork serviceName_vmEncryption_kms_kmsId_GET(String serviceName, Long kmsId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/vmEncryption/kms/{kmsId}";
StringBuilder sb = path(qPath, serviceName, kmsId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVMEncryptionAccessNetwork.class);
} | java | public OvhVMEncryptionAccessNetwork serviceName_vmEncryption_kms_kmsId_GET(String serviceName, Long kmsId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/vmEncryption/kms/{kmsId}";
StringBuilder sb = path(qPath, serviceName, kmsId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVMEncryptionAccessNetwork.class);
} | [
"public",
"OvhVMEncryptionAccessNetwork",
"serviceName_vmEncryption_kms_kmsId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"kmsId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/vmEncryption/kms/{kmsId}\"",
";",
"StringBuilder",
... | Get this object properties
REST: GET /dedicatedCloud/{serviceName}/vmEncryption/kms/{kmsId}
@param serviceName [required] Domain of the service
@param kmsId [required] Id of the VM Encryption KMS | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L607-L612 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/schema/constraints/DataColumnConstraints.java | DataColumnConstraints.validateRangeValue | private void validateRangeValue(String column, Object value) {
if (constraintType != null && value != null
&& !getConstraintType().equals(DataColumnConstraintType.RANGE)) {
throw new GeoPackageException("The " + column
+ " must be null for " + DataColumnConstraintType.ENUM
+ " and " + DataColumnConstraintType.GLOB + " constraints");
}
} | java | private void validateRangeValue(String column, Object value) {
if (constraintType != null && value != null
&& !getConstraintType().equals(DataColumnConstraintType.RANGE)) {
throw new GeoPackageException("The " + column
+ " must be null for " + DataColumnConstraintType.ENUM
+ " and " + DataColumnConstraintType.GLOB + " constraints");
}
} | [
"private",
"void",
"validateRangeValue",
"(",
"String",
"column",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"constraintType",
"!=",
"null",
"&&",
"value",
"!=",
"null",
"&&",
"!",
"getConstraintType",
"(",
")",
".",
"equals",
"(",
"DataColumnConstraintType"... | Validate the constraint type when a range value is set
@param column
@param value | [
"Validate",
"the",
"constraint",
"type",
"when",
"a",
"range",
"value",
"is",
"set"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/schema/constraints/DataColumnConstraints.java#L251-L258 |
ironjacamar/ironjacamar | web/src/main/java/org/ironjacamar/web/console/Server.java | Server.getMBeanAttributeResultInfo | public static AttrResultInfo getMBeanAttributeResultInfo(String name, MBeanAttributeInfo attrInfo)
throws JMException
{
ClassLoader loader = SecurityActions.getThreadContextClassLoader();
MBeanServer server = getMBeanServer();
ObjectName objName = new ObjectName(name);
String attrName = attrInfo.getName();
String attrType = attrInfo.getType();
Object value = null;
Throwable throwable = null;
if (attrInfo.isReadable())
{
try
{
value = server.getAttribute(objName, attrName);
}
catch (Throwable t)
{
throwable = t;
}
}
Class typeClass = null;
try
{
typeClass = Classes.getPrimitiveTypeForName(attrType);
if (typeClass == null)
typeClass = loader.loadClass(attrType);
}
catch (ClassNotFoundException cnfe)
{
// Ignore
}
PropertyEditor editor = null;
if (typeClass != null)
editor = PropertyEditorManager.findEditor(typeClass);
return new AttrResultInfo(attrName, editor, value, throwable);
} | java | public static AttrResultInfo getMBeanAttributeResultInfo(String name, MBeanAttributeInfo attrInfo)
throws JMException
{
ClassLoader loader = SecurityActions.getThreadContextClassLoader();
MBeanServer server = getMBeanServer();
ObjectName objName = new ObjectName(name);
String attrName = attrInfo.getName();
String attrType = attrInfo.getType();
Object value = null;
Throwable throwable = null;
if (attrInfo.isReadable())
{
try
{
value = server.getAttribute(objName, attrName);
}
catch (Throwable t)
{
throwable = t;
}
}
Class typeClass = null;
try
{
typeClass = Classes.getPrimitiveTypeForName(attrType);
if (typeClass == null)
typeClass = loader.loadClass(attrType);
}
catch (ClassNotFoundException cnfe)
{
// Ignore
}
PropertyEditor editor = null;
if (typeClass != null)
editor = PropertyEditorManager.findEditor(typeClass);
return new AttrResultInfo(attrName, editor, value, throwable);
} | [
"public",
"static",
"AttrResultInfo",
"getMBeanAttributeResultInfo",
"(",
"String",
"name",
",",
"MBeanAttributeInfo",
"attrInfo",
")",
"throws",
"JMException",
"{",
"ClassLoader",
"loader",
"=",
"SecurityActions",
".",
"getThreadContextClassLoader",
"(",
")",
";",
"MBe... | Get MBean attribute result info
@param name The bean name
@param attrInfo The attribute information
@return The data
@exception JMException Thrown if an error occurs | [
"Get",
"MBean",
"attribute",
"result",
"info"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/Server.java#L209-L249 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionMultiArgs.java | FunctionMultiArgs.fixupVariables | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
if(null != m_args)
{
for (int i = 0; i < m_args.length; i++)
{
m_args[i].fixupVariables(vars, globalsSize);
}
}
} | java | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
if(null != m_args)
{
for (int i = 0; i < m_args.length; i++)
{
m_args[i].fixupVariables(vars, globalsSize);
}
}
} | [
"public",
"void",
"fixupVariables",
"(",
"java",
".",
"util",
".",
"Vector",
"vars",
",",
"int",
"globalsSize",
")",
"{",
"super",
".",
"fixupVariables",
"(",
"vars",
",",
"globalsSize",
")",
";",
"if",
"(",
"null",
"!=",
"m_args",
")",
"{",
"for",
"("... | This function is used to fixup variables from QNames to stack frame
indexes at stylesheet build time.
@param vars List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame). | [
"This",
"function",
"is",
"used",
"to",
"fixup",
"variables",
"from",
"QNames",
"to",
"stack",
"frame",
"indexes",
"at",
"stylesheet",
"build",
"time",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionMultiArgs.java#L100-L110 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/VaadinMessageSource.java | VaadinMessageSource.getMessage | public String getMessage(final String code, final Object... args) {
return getMessage(HawkbitCommonUtil.getCurrentLocale(), code, args);
} | java | public String getMessage(final String code, final Object... args) {
return getMessage(HawkbitCommonUtil.getCurrentLocale(), code, args);
} | [
"public",
"String",
"getMessage",
"(",
"final",
"String",
"code",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"return",
"getMessage",
"(",
"HawkbitCommonUtil",
".",
"getCurrentLocale",
"(",
")",
",",
"code",
",",
"args",
")",
";",
"}"
] | Tries to resolve the message based on
{@link HawkbitCommonUtil#getCurrentLocale()}. Returns message code if fitting
message could not be found.
@param code
the code to lookup up.
@param args
Array of arguments that will be filled in for params within
the message.
@return the resolved message, or the message code if the lookup fails.
@see MessageSource#getMessage(String, Object[], Locale)
@see HawkbitCommonUtil#getCurrentLocale() | [
"Tries",
"to",
"resolve",
"the",
"message",
"based",
"on",
"{",
"@link",
"HawkbitCommonUtil#getCurrentLocale",
"()",
"}",
".",
"Returns",
"message",
"code",
"if",
"fitting",
"message",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/VaadinMessageSource.java#L57-L59 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/map/AbstractLongObjectMap.java | AbstractLongObjectMap.keyOf | public long keyOf(final Object value) {
final long[] foundKey = new long[1];
boolean notFound = forEachPair(
new LongObjectProcedure() {
public boolean apply(long iterKey, Object iterValue) {
boolean found = value == iterValue;
if (found) foundKey[0] = iterKey;
return !found;
}
}
);
if (notFound) return Long.MIN_VALUE;
return foundKey[0];
} | java | public long keyOf(final Object value) {
final long[] foundKey = new long[1];
boolean notFound = forEachPair(
new LongObjectProcedure() {
public boolean apply(long iterKey, Object iterValue) {
boolean found = value == iterValue;
if (found) foundKey[0] = iterKey;
return !found;
}
}
);
if (notFound) return Long.MIN_VALUE;
return foundKey[0];
} | [
"public",
"long",
"keyOf",
"(",
"final",
"Object",
"value",
")",
"{",
"final",
"long",
"[",
"]",
"foundKey",
"=",
"new",
"long",
"[",
"1",
"]",
";",
"boolean",
"notFound",
"=",
"forEachPair",
"(",
"new",
"LongObjectProcedure",
"(",
")",
"{",
"public",
... | Returns the first key the given value is associated with.
It is often a good idea to first check with {@link #containsValue(Object)} whether there exists an association from a key to this value.
Search order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(LongProcedure)}.
@param value the value to search for.
@return the first key for which holds <tt>get(key) == value</tt>;
returns <tt>Long.MIN_VALUE</tt> if no such key exists. | [
"Returns",
"the",
"first",
"key",
"the",
"given",
"value",
"is",
"associated",
"with",
".",
"It",
"is",
"often",
"a",
"good",
"idea",
"to",
"first",
"check",
"with",
"{",
"@link",
"#containsValue",
"(",
"Object",
")",
"}",
"whether",
"there",
"exists",
"... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractLongObjectMap.java#L170-L183 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.translationRotateMul | public Matrix4x3f translationRotateMul(float tx, float ty, float tz, Quaternionfc quat, Matrix4x3fc mat) {
return translationRotateMul(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w(), mat);
} | java | public Matrix4x3f translationRotateMul(float tx, float ty, float tz, Quaternionfc quat, Matrix4x3fc mat) {
return translationRotateMul(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w(), mat);
} | [
"public",
"Matrix4x3f",
"translationRotateMul",
"(",
"float",
"tx",
",",
"float",
"ty",
",",
"float",
"tz",
",",
"Quaternionfc",
"quat",
",",
"Matrix4x3fc",
"mat",
")",
"{",
"return",
"translationRotateMul",
"(",
"tx",
",",
"ty",
",",
"tz",
",",
"quat",
".... | Set <code>this</code> matrix to <code>T * R * M</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code>,
<code>R</code> is a rotation - and possibly scaling - transformation specified by the given quaternion and <code>M</code> is the given matrix <code>mat</code>.
<p>
When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and
at last the translation.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method is equivalent to calling: <code>translation(tx, ty, tz).rotate(quat).mul(mat)</code>
@see #translation(float, float, float)
@see #rotate(Quaternionfc)
@see #mul(Matrix4x3fc)
@param tx
the number of units by which to translate the x-component
@param ty
the number of units by which to translate the y-component
@param tz
the number of units by which to translate the z-component
@param quat
the quaternion representing a rotation
@param mat
the matrix to multiply with
@return this | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"T",
"*",
"R",
"*",
"M<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"a",
"translation",
"by",
"the",
"given",
"<code",
">",
"(",
"tx",
"t... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L2958-L2960 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/tree/model/TreeModelUtils.java | TreeModelUtils.renderModelAsJson | public static String renderModelAsJson(Node rootNode, boolean renderRoot) {
if (renderRoot) {
return renderSubnodes(rootNode == null ? new ArrayList<Node>() : new ArrayList<Node>(Arrays.asList(rootNode)));
} else if (rootNode != null && rootNode.hasChild()) {
return renderSubnodes(rootNode.getChilds());
}
return "";
} | java | public static String renderModelAsJson(Node rootNode, boolean renderRoot) {
if (renderRoot) {
return renderSubnodes(rootNode == null ? new ArrayList<Node>() : new ArrayList<Node>(Arrays.asList(rootNode)));
} else if (rootNode != null && rootNode.hasChild()) {
return renderSubnodes(rootNode.getChilds());
}
return "";
} | [
"public",
"static",
"String",
"renderModelAsJson",
"(",
"Node",
"rootNode",
",",
"boolean",
"renderRoot",
")",
"{",
"if",
"(",
"renderRoot",
")",
"{",
"return",
"renderSubnodes",
"(",
"rootNode",
"==",
"null",
"?",
"new",
"ArrayList",
"<",
"Node",
">",
"(",
... | Render the node model as JSON
@param rootNode
@param renderRoot
@return | [
"Render",
"the",
"node",
"model",
"as",
"JSON"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/tree/model/TreeModelUtils.java#L78-L86 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/MathUtils.java | MathUtils.divideRoundUp | public static <T extends Number> long divideRoundUp(final T dividend, final T divisor) {
double average = divide(dividend, divisor);
return RoundUp(average);
} | java | public static <T extends Number> long divideRoundUp(final T dividend, final T divisor) {
double average = divide(dividend, divisor);
return RoundUp(average);
} | [
"public",
"static",
"<",
"T",
"extends",
"Number",
">",
"long",
"divideRoundUp",
"(",
"final",
"T",
"dividend",
",",
"final",
"T",
"divisor",
")",
"{",
"double",
"average",
"=",
"divide",
"(",
"dividend",
",",
"divisor",
")",
";",
"return",
"RoundUp",
"(... | Returns a long average number by round up with specify dividend and
divisor.<br>
Returns 0 if dividend == null or divisor == null.<br>
Returns 1 if dividend == divisor or divisor == 0.<br>
e.g: average is 3.5, then return 4.
@param dividend
number to be handled.
@param divisor
number to be handled.
@return a long average number by given dividend and divisor. | [
"Returns",
"a",
"long",
"average",
"number",
"by",
"round",
"up",
"with",
"specify",
"dividend",
"and",
"divisor",
".",
"<br",
">",
"Returns",
"0",
"if",
"dividend",
"==",
"null",
"or",
"divisor",
"==",
"null",
".",
"<br",
">",
"Returns",
"1",
"if",
"d... | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/MathUtils.java#L187-L191 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.translateLocal | public Matrix4d translateLocal(double x, double y, double z, Matrix4d dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.translation(x, y, z);
return translateLocalGeneric(x, y, z, dest);
} | java | public Matrix4d translateLocal(double x, double y, double z, Matrix4d dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.translation(x, y, z);
return translateLocalGeneric(x, y, z, dest);
} | [
"public",
"Matrix4d",
"translateLocal",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
",",
"Matrix4d",
"dest",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_IDENTITY",
")",
"!=",
"0",
")",
"return",
"dest",
".",
"translation",
"(",... | Pre-multiply a translation to this matrix by translating by the given number of
units in x, y and z and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation
matrix, then the new matrix will be <code>T * M</code>. So when
transforming a vector <code>v</code> with the new matrix by using
<code>T * M * v</code>, the translation will be applied last!
<p>
In order to set the matrix to a translation transformation without pre-multiplying
it, use {@link #translation(double, double, double)}.
@see #translation(double, double, double)
@param x
the offset to translate in x
@param y
the offset to translate in y
@param z
the offset to translate in z
@param dest
will hold the result
@return dest | [
"Pre",
"-",
"multiply",
"a",
"translation",
"to",
"this",
"matrix",
"by",
"translating",
"by",
"the",
"given",
"number",
"of",
"units",
"in",
"x",
"y",
"and",
"z",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5664-L5668 |
dkpro/dkpro-argumentation | dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java | JCasUtil2.doOverlap | public static <T extends Annotation> boolean doOverlap(final T anno1, final T anno2)
{
return anno1.getEnd() > anno2.getBegin() && anno1.getBegin() < anno2.getEnd();
} | java | public static <T extends Annotation> boolean doOverlap(final T anno1, final T anno2)
{
return anno1.getEnd() > anno2.getBegin() && anno1.getBegin() < anno2.getEnd();
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"boolean",
"doOverlap",
"(",
"final",
"T",
"anno1",
",",
"final",
"T",
"anno2",
")",
"{",
"return",
"anno1",
".",
"getEnd",
"(",
")",
">",
"anno2",
".",
"getBegin",
"(",
")",
"&&",
"anno1",
... | Returns whether the given annotations have a non-empty overlap.
<p>
Note that this method is symmetric. Two annotations overlap
if they have at least one character position in common.
Annotations that merely touch at the begin or end are not
overlapping.
</p>
<ul>
<li>anno1[0,1], anno2[1,2] => no overlap</li>
<li>anno1[0,2], anno2[1,2] => overlap</li>
<li>anno1[0,2], anno2[0,2] => overlap (same span)</li>
</ul>
@param anno1 first annotation
@param anno2 second annotation
@return whether the annotations overlap | [
"Returns",
"whether",
"the",
"given",
"annotations",
"have",
"a",
"non",
"-",
"empty",
"overlap",
"."
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L182-L185 |
Jasig/uPortal | uPortal-spring/src/main/java/org/apereo/portal/spring/security/preauth/PortalPreAuthenticatedProcessingFilter.java | PortalPreAuthenticatedProcessingFilter.getPropertyFromRequest | private HashMap<String, String> getPropertyFromRequest(
HashMap<String, String> tokens, HttpServletRequest request) {
// Iterate through all of the other property keys looking for the first property
// named like propname that has a value in the request
HashMap<String, String> retHash = new HashMap<>();
for (Map.Entry<String, String> entry : tokens.entrySet()) {
String contextName = entry.getKey();
String parmName = entry.getValue();
String parmValue;
if (request.getAttribute(parmName) != null) {
// Upstream components (like servlet filters) may supply information
// for the authentication process using request attributes.
try {
parmValue = (String) request.getAttribute(parmName);
} catch (ClassCastException cce) {
String msg = "The request attribute '" + parmName + "' must be a String.";
throw new RuntimeException(msg, cce);
}
} else {
// If a configured parameter isn't provided by a request attribute,
// check request parameters (i.e. querystring, form fields).
parmValue = request.getParameter(parmName);
}
// null value causes exception in context.authentication
// alternately we could just not set parm if value is null
if ("password".equals(parmName)) {
// make sure we don't trim passwords, since they might have
// leading or trailing spaces
parmValue = (parmValue == null ? "" : parmValue);
} else {
parmValue = (parmValue == null ? "" : parmValue).trim();
}
// The relationship between the way the properties are stored and the way
// the subcontexts are named has to be closely looked at to make this work.
// The keys are either "root" or the subcontext name that follows "root.". As
// as example, the contexts ["root", "root.simple", "root.cas"] are represented
// as ["root", "simple", "cas"].
String key = (contextName.startsWith("root.") ? contextName.substring(5) : contextName);
retHash.put(key, parmValue);
}
return (retHash);
} | java | private HashMap<String, String> getPropertyFromRequest(
HashMap<String, String> tokens, HttpServletRequest request) {
// Iterate through all of the other property keys looking for the first property
// named like propname that has a value in the request
HashMap<String, String> retHash = new HashMap<>();
for (Map.Entry<String, String> entry : tokens.entrySet()) {
String contextName = entry.getKey();
String parmName = entry.getValue();
String parmValue;
if (request.getAttribute(parmName) != null) {
// Upstream components (like servlet filters) may supply information
// for the authentication process using request attributes.
try {
parmValue = (String) request.getAttribute(parmName);
} catch (ClassCastException cce) {
String msg = "The request attribute '" + parmName + "' must be a String.";
throw new RuntimeException(msg, cce);
}
} else {
// If a configured parameter isn't provided by a request attribute,
// check request parameters (i.e. querystring, form fields).
parmValue = request.getParameter(parmName);
}
// null value causes exception in context.authentication
// alternately we could just not set parm if value is null
if ("password".equals(parmName)) {
// make sure we don't trim passwords, since they might have
// leading or trailing spaces
parmValue = (parmValue == null ? "" : parmValue);
} else {
parmValue = (parmValue == null ? "" : parmValue).trim();
}
// The relationship between the way the properties are stored and the way
// the subcontexts are named has to be closely looked at to make this work.
// The keys are either "root" or the subcontext name that follows "root.". As
// as example, the contexts ["root", "root.simple", "root.cas"] are represented
// as ["root", "simple", "cas"].
String key = (contextName.startsWith("root.") ? contextName.substring(5) : contextName);
retHash.put(key, parmValue);
}
return (retHash);
} | [
"private",
"HashMap",
"<",
"String",
",",
"String",
">",
"getPropertyFromRequest",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"tokens",
",",
"HttpServletRequest",
"request",
")",
"{",
"// Iterate through all of the other property keys looking for the first property"... | Get the values represented by each token from the request and load them into a HashMap that
is returned.
@param tokens
@param request
@return HashMap of properties | [
"Get",
"the",
"values",
"represented",
"by",
"each",
"token",
"from",
"the",
"request",
"and",
"load",
"them",
"into",
"a",
"HashMap",
"that",
"is",
"returned",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-spring/src/main/java/org/apereo/portal/spring/security/preauth/PortalPreAuthenticatedProcessingFilter.java#L525-L568 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/style/ColorUtils.java | ColorUtils.toColorWithAlpha | public static String toColorWithAlpha(String red, String green, String blue) {
String defaultAlpha = "FF";
if (red != null && !red.isEmpty()
&& Character.isLowerCase(red.charAt(0))) {
defaultAlpha = defaultAlpha.toLowerCase();
}
return toColorWithAlpha(red, green, blue, defaultAlpha);
} | java | public static String toColorWithAlpha(String red, String green, String blue) {
String defaultAlpha = "FF";
if (red != null && !red.isEmpty()
&& Character.isLowerCase(red.charAt(0))) {
defaultAlpha = defaultAlpha.toLowerCase();
}
return toColorWithAlpha(red, green, blue, defaultAlpha);
} | [
"public",
"static",
"String",
"toColorWithAlpha",
"(",
"String",
"red",
",",
"String",
"green",
",",
"String",
"blue",
")",
"{",
"String",
"defaultAlpha",
"=",
"\"FF\"",
";",
"if",
"(",
"red",
"!=",
"null",
"&&",
"!",
"red",
".",
"isEmpty",
"(",
")",
"... | Convert the hex color values to a hex color including an opaque alpha
value of FF
@param red
red hex color in format RR or R
@param green
green hex color in format GG or G
@param blue
blue hex color in format BB or B
@return hex color in format #AARRGGBB | [
"Convert",
"the",
"hex",
"color",
"values",
"to",
"a",
"hex",
"color",
"including",
"an",
"opaque",
"alpha",
"value",
"of",
"FF"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/style/ColorUtils.java#L73-L80 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/CriteriaReader.java | CriteriaReader.getConstantValue | private Object getConstantValue(FieldType type, byte[] block)
{
Object value;
DataType dataType = type.getDataType();
if (dataType == null)
{
value = null;
}
else
{
switch (dataType)
{
case DURATION:
{
value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(block, getValueOffset()), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(block, getTimeUnitsOffset())));
break;
}
case NUMERIC:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()));
break;
}
case PERCENTAGE:
{
value = Double.valueOf(MPPUtility.getShort(block, getValueOffset()));
break;
}
case CURRENCY:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()) / 100);
break;
}
case STRING:
{
int textOffset = getTextOffset(block);
value = MPPUtility.getUnicodeString(m_criteriaData, m_dataOffset + m_criteriaTextStart + textOffset);
break;
}
case BOOLEAN:
{
int intValue = MPPUtility.getShort(block, getValueOffset());
value = (intValue == 1 ? Boolean.TRUE : Boolean.FALSE);
break;
}
case DATE:
{
value = MPPUtility.getTimestamp(block, getValueOffset());
break;
}
default:
{
value = null;
break;
}
}
}
return value;
} | java | private Object getConstantValue(FieldType type, byte[] block)
{
Object value;
DataType dataType = type.getDataType();
if (dataType == null)
{
value = null;
}
else
{
switch (dataType)
{
case DURATION:
{
value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(block, getValueOffset()), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(block, getTimeUnitsOffset())));
break;
}
case NUMERIC:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()));
break;
}
case PERCENTAGE:
{
value = Double.valueOf(MPPUtility.getShort(block, getValueOffset()));
break;
}
case CURRENCY:
{
value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()) / 100);
break;
}
case STRING:
{
int textOffset = getTextOffset(block);
value = MPPUtility.getUnicodeString(m_criteriaData, m_dataOffset + m_criteriaTextStart + textOffset);
break;
}
case BOOLEAN:
{
int intValue = MPPUtility.getShort(block, getValueOffset());
value = (intValue == 1 ? Boolean.TRUE : Boolean.FALSE);
break;
}
case DATE:
{
value = MPPUtility.getTimestamp(block, getValueOffset());
break;
}
default:
{
value = null;
break;
}
}
}
return value;
} | [
"private",
"Object",
"getConstantValue",
"(",
"FieldType",
"type",
",",
"byte",
"[",
"]",
"block",
")",
"{",
"Object",
"value",
";",
"DataType",
"dataType",
"=",
"type",
".",
"getDataType",
"(",
")",
";",
"if",
"(",
"dataType",
"==",
"null",
")",
"{",
... | Retrieves a constant value.
@param type field type
@param block criteria data block
@return constant value | [
"Retrieves",
"a",
"constant",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L340-L406 |
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.beginReimageAsync | public Observable<OperationStatusResponseInner> beginReimageAsync(String resourceGroupName, String vmScaleSetName) {
return beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> beginReimageAsync(String resourceGroupName, String vmScaleSetName) {
return beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"beginReimageAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"beginReimageWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",... | Reimages (upgrade the operating system) one or more virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object | [
"Reimages",
"(",
"upgrade",
"the",
"operating",
"system",
")",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | 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#L3064-L3071 |
apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v7/Selector.java | Selector.getMetaClassImpl | private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) {
Class mcc = mc.getClass();
boolean valid = mcc == MetaClassImpl.class ||
mcc == AdaptingMetaClass.class ||
mcc == ClosureMetaClass.class ||
(includeEMC && mcc == ExpandoMetaClass.class);
if (!valid) {
if (LOG_ENABLED) LOG.info("meta class is neither MetaClassImpl, nor AdoptingMetaClass, nor ClosureMetaClass, normal method selection path disabled.");
return null;
}
if (LOG_ENABLED) LOG.info("meta class is a recognized MetaClassImpl");
return (MetaClassImpl) mc;
} | java | private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) {
Class mcc = mc.getClass();
boolean valid = mcc == MetaClassImpl.class ||
mcc == AdaptingMetaClass.class ||
mcc == ClosureMetaClass.class ||
(includeEMC && mcc == ExpandoMetaClass.class);
if (!valid) {
if (LOG_ENABLED) LOG.info("meta class is neither MetaClassImpl, nor AdoptingMetaClass, nor ClosureMetaClass, normal method selection path disabled.");
return null;
}
if (LOG_ENABLED) LOG.info("meta class is a recognized MetaClassImpl");
return (MetaClassImpl) mc;
} | [
"private",
"static",
"MetaClassImpl",
"getMetaClassImpl",
"(",
"MetaClass",
"mc",
",",
"boolean",
"includeEMC",
")",
"{",
"Class",
"mcc",
"=",
"mc",
".",
"getClass",
"(",
")",
";",
"boolean",
"valid",
"=",
"mcc",
"==",
"MetaClassImpl",
".",
"class",
"||",
... | Returns the MetaClassImpl if the given MetaClass is one of
MetaClassImpl, AdaptingMetaClass or ClosureMetaClass. If
none of these cases matches, this method returns null. | [
"Returns",
"the",
"MetaClassImpl",
"if",
"the",
"given",
"MetaClass",
"is",
"one",
"of",
"MetaClassImpl",
"AdaptingMetaClass",
"or",
"ClosureMetaClass",
".",
"If",
"none",
"of",
"these",
"cases",
"matches",
"this",
"method",
"returns",
"null",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/Selector.java#L1045-L1057 |
apereo/cas | support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/authentication/SamlResponseBuilder.java | SamlResponseBuilder.encodeSamlResponse | public void encodeSamlResponse(final Response samlResponse, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
this.samlObjectBuilder.encodeSamlResponse(response, request, samlResponse);
} | java | public void encodeSamlResponse(final Response samlResponse, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
this.samlObjectBuilder.encodeSamlResponse(response, request, samlResponse);
} | [
"public",
"void",
"encodeSamlResponse",
"(",
"final",
"Response",
"samlResponse",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"Exception",
"{",
"this",
".",
"samlObjectBuilder",
".",
"encodeSamlResponse"... | Encode saml response.
@param samlResponse the saml response
@param request the request
@param response the response
@throws Exception the exception | [
"Encode",
"saml",
"response",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/authentication/SamlResponseBuilder.java#L145-L147 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/TextArea.java | TextArea.setAttribute | public void setAttribute(String name, String value, String facet)
throws JspException
{
if (name != null) {
if (name.equals(DISABLED)) {
setDisabled(Boolean.parseBoolean(value));
return;
}
else if (name.equals(READONLY)) {
_state.readonly = new Boolean(value).booleanValue();
return;
}
else if (name.equals(COLS)) {
_state.cols = Integer.parseInt(value);
return;
}
else if (name.equals(ROWS)) {
_state.rows = Integer.parseInt(value);
return;
}
}
super.setAttribute(name, value, facet);
} | java | public void setAttribute(String name, String value, String facet)
throws JspException
{
if (name != null) {
if (name.equals(DISABLED)) {
setDisabled(Boolean.parseBoolean(value));
return;
}
else if (name.equals(READONLY)) {
_state.readonly = new Boolean(value).booleanValue();
return;
}
else if (name.equals(COLS)) {
_state.cols = Integer.parseInt(value);
return;
}
else if (name.equals(ROWS)) {
_state.rows = Integer.parseInt(value);
return;
}
}
super.setAttribute(name, value, facet);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"DISABLED",
")",
")",
"{",
... | Base support for the attribute tag.
@param name The name of the attribute. This value may not be null or the empty string.
@param value The value of the attribute. This may contain an expression.
@param facet The name of a facet to which the attribute will be applied. This is optional.
@throws JspException A JspException may be thrown if there is an error setting the attribute. | [
"Base",
"support",
"for",
"the",
"attribute",
"tag",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/TextArea.java#L79-L102 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/ocr/AipOcr.java | AipOcr.enhancedGeneralUrl | public JSONObject enhancedGeneralUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(OcrConsts.GENERAL_ENHANCED);
postOperation(request);
return requestServer(request);
} | java | public JSONObject enhancedGeneralUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(OcrConsts.GENERAL_ENHANCED);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"enhancedGeneralUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",... | 通用文字识别(含生僻字版)接口
某些场景中,图片中的中文不光有常用字,还包含了生僻字,这时用户需要对该图进行文字识别,应使用通用文字识别(含生僻字版)。
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
probability 是否返回识别结果中每一行的置信度
@return JSONObject | [
"通用文字识别(含生僻字版)接口",
"某些场景中,图片中的中文不光有常用字,还包含了生僻字,这时用户需要对该图进行文字识别,应使用通用文字识别(含生僻字版)。"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/ocr/AipOcr.java#L350-L361 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/Ordering.java | Ordering.appendOrdering | public Ordering appendOrdering(Integer index, Class<? extends Key<?>> type, Order order) {
if (index.intValue() < 0) {
throw new IllegalArgumentException("The key index must not be negative.");
}
if (order == null) {
throw new NullPointerException();
}
if (order == Order.NONE) {
throw new IllegalArgumentException("An ordering must not be created with a NONE order.");
}
this.indexes.add(index);
this.types.add(type);
this.orders.add(order);
return this;
} | java | public Ordering appendOrdering(Integer index, Class<? extends Key<?>> type, Order order) {
if (index.intValue() < 0) {
throw new IllegalArgumentException("The key index must not be negative.");
}
if (order == null) {
throw new NullPointerException();
}
if (order == Order.NONE) {
throw new IllegalArgumentException("An ordering must not be created with a NONE order.");
}
this.indexes.add(index);
this.types.add(type);
this.orders.add(order);
return this;
} | [
"public",
"Ordering",
"appendOrdering",
"(",
"Integer",
"index",
",",
"Class",
"<",
"?",
"extends",
"Key",
"<",
"?",
">",
">",
"type",
",",
"Order",
"order",
")",
"{",
"if",
"(",
"index",
".",
"intValue",
"(",
")",
"<",
"0",
")",
"{",
"throw",
"new... | Extends this ordering by appending an additional order requirement.
@param index Field index of the appended order requirement.
@param type Type of the appended order requirement.
@param order Order of the appended order requirement.
@return This ordering with an additional appended order requirement. | [
"Extends",
"this",
"ordering",
"by",
"appending",
"an",
"additional",
"order",
"requirement",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/Ordering.java#L58-L73 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java | ContainerGroupsInner.beginRestartAsync | public Observable<Void> beginRestartAsync(String resourceGroupName, String containerGroupName) {
return beginRestartWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginRestartAsync(String resourceGroupName, String containerGroupName) {
return beginRestartWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginRestartAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
")",
"{",
"return",
"beginRestartWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",
")",
".",
"map",
"(",... | Restarts all containers in a container group.
Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
".",
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
"in",
"place",
".",
"If",
"container",
"image",
"has",
"updates",
"new",
"image",
"will",
"be",
"downloaded",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java#L920-L927 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageContentHelper.java | PageContentHelper.addHeadlines | public static void addHeadlines(final PrintWriter writer, final List headlines) {
if (headlines == null || headlines.isEmpty()) {
return;
}
writer.write("\n<!-- Start general headlines -->");
Iterator iter = headlines.iterator();
while (iter.hasNext()) {
String line = (String) iter.next();
writer.write("\n" + line);
}
writer.println("\n<!-- End general headlines -->");
} | java | public static void addHeadlines(final PrintWriter writer, final List headlines) {
if (headlines == null || headlines.isEmpty()) {
return;
}
writer.write("\n<!-- Start general headlines -->");
Iterator iter = headlines.iterator();
while (iter.hasNext()) {
String line = (String) iter.next();
writer.write("\n" + line);
}
writer.println("\n<!-- End general headlines -->");
} | [
"public",
"static",
"void",
"addHeadlines",
"(",
"final",
"PrintWriter",
"writer",
",",
"final",
"List",
"headlines",
")",
"{",
"if",
"(",
"headlines",
"==",
"null",
"||",
"headlines",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"writer",
"."... | Add a list of html headline entries intended to be added only once to the page.
@param writer the writer to write to.
@param headlines a list of html entries to be added to the page as a whole. | [
"Add",
"a",
"list",
"of",
"html",
"headline",
"entries",
"intended",
"to",
"be",
"added",
"only",
"once",
"to",
"the",
"page",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/PageContentHelper.java#L45-L59 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java | DomainsInner.listSharedAccessKeys | public DomainSharedAccessKeysInner listSharedAccessKeys(String resourceGroupName, String domainName) {
return listSharedAccessKeysWithServiceResponseAsync(resourceGroupName, domainName).toBlocking().single().body();
} | java | public DomainSharedAccessKeysInner listSharedAccessKeys(String resourceGroupName, String domainName) {
return listSharedAccessKeysWithServiceResponseAsync(resourceGroupName, domainName).toBlocking().single().body();
} | [
"public",
"DomainSharedAccessKeysInner",
"listSharedAccessKeys",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
")",
"{",
"return",
"listSharedAccessKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"domainName",
")",
".",
"toBlocking",
"(",
")... | List keys for a domain.
List the two keys used to publish to a domain.
@param resourceGroupName The name of the resource group within the user's subscription.
@param domainName Name of the domain
@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 DomainSharedAccessKeysInner object if successful. | [
"List",
"keys",
"for",
"a",
"domain",
".",
"List",
"the",
"two",
"keys",
"used",
"to",
"publish",
"to",
"a",
"domain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L1072-L1074 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.