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 |
|---|---|---|---|---|---|---|---|---|---|---|
netty/netty | codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspVersions.java | RtspVersions.valueOf | public static HttpVersion valueOf(String text) {
if (text == null) {
throw new NullPointerException("text");
}
text = text.trim().toUpperCase();
if ("RTSP/1.0".equals(text)) {
return RTSP_1_0;
}
return new HttpVersion(text, true);
} | java | public static HttpVersion valueOf(String text) {
if (text == null) {
throw new NullPointerException("text");
}
text = text.trim().toUpperCase();
if ("RTSP/1.0".equals(text)) {
return RTSP_1_0;
}
return new HttpVersion(text, true);
} | [
"public",
"static",
"HttpVersion",
"valueOf",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"text\"",
")",
";",
"}",
"text",
"=",
"text",
".",
"trim",
"(",
")",
".",
"toUpperC... | Returns an existing or new {@link HttpVersion} instance which matches to
the specified RTSP version string. If the specified {@code text} is
equal to {@code "RTSP/1.0"}, {@link #RTSP_1_0} will be returned.
Otherwise, a new {@link HttpVersion} instance will be returned. | [
"Returns",
"an",
"existing",
"or",
"new",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspVersions.java#L36-L47 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/message/analytics/GenericAnalyticsRequest.java | GenericAnalyticsRequest.simpleStatement | public static GenericAnalyticsRequest simpleStatement(String statement, String bucket, String password) {
return new GenericAnalyticsRequest(statement, false, bucket, bucket, password, null, NO_PRIORITY);
} | java | public static GenericAnalyticsRequest simpleStatement(String statement, String bucket, String password) {
return new GenericAnalyticsRequest(statement, false, bucket, bucket, password, null, NO_PRIORITY);
} | [
"public",
"static",
"GenericAnalyticsRequest",
"simpleStatement",
"(",
"String",
"statement",
",",
"String",
"bucket",
",",
"String",
"password",
")",
"{",
"return",
"new",
"GenericAnalyticsRequest",
"(",
"statement",
",",
"false",
",",
"bucket",
",",
"bucket",
",... | Creates a {@link GenericAnalyticsRequest} and mark it as containing a single simple statement
(e.g. "SELECT * FROM default").
@param statement the Analytics query statement to perform.
@param bucket the bucket on which to search.
@param password the password for the target bucket.
@return a {@link GenericAnalyticsRequest} for this simple statement. | [
"Creates",
"a",
"{",
"@link",
"GenericAnalyticsRequest",
"}",
"and",
"mark",
"it",
"as",
"containing",
"a",
"single",
"simple",
"statement",
"(",
"e",
".",
"g",
".",
"SELECT",
"*",
"FROM",
"default",
")",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/analytics/GenericAnalyticsRequest.java#L86-L88 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java | CollectionExtensions.addAll | @SafeVarargs
public static <T> boolean addAll(Collection<? super T> collection, T... elements) {
return collection.addAll(Arrays.asList(elements));
} | java | @SafeVarargs
public static <T> boolean addAll(Collection<? super T> collection, T... elements) {
return collection.addAll(Arrays.asList(elements));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"boolean",
"addAll",
"(",
"Collection",
"<",
"?",
"super",
"T",
">",
"collection",
",",
"T",
"...",
"elements",
")",
"{",
"return",
"collection",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"... | Adds all of the specified elements to the specified collection.
@param collection
the collection into which the {@code elements} are to be inserted. May not be <code>null</code>.
@param elements
the elements to insert into the {@code collection}. May not be <code>null</code> but may contain
<code>null</code> entries if the {@code collection} allows that.
@return <code>true</code> if the collection changed as a result of the call | [
"Adds",
"all",
"of",
"the",
"specified",
"elements",
"to",
"the",
"specified",
"collection",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L253-L256 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.typesIn | public static List<TypeElement>
typesIn(Iterable<? extends Element> elements) {
return listFilter(elements, TYPE_KINDS, TypeElement.class);
} | java | public static List<TypeElement>
typesIn(Iterable<? extends Element> elements) {
return listFilter(elements, TYPE_KINDS, TypeElement.class);
} | [
"public",
"static",
"List",
"<",
"TypeElement",
">",
"typesIn",
"(",
"Iterable",
"<",
"?",
"extends",
"Element",
">",
"elements",
")",
"{",
"return",
"listFilter",
"(",
"elements",
",",
"TYPE_KINDS",
",",
"TypeElement",
".",
"class",
")",
";",
"}"
] | Returns a list of types in {@code elements}.
@return a list of types in {@code elements}
@param elements the elements to filter | [
"Returns",
"a",
"list",
"of",
"types",
"in",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L152-L155 |
kohsuke/com4j | runtime/src/main/java/com4j/COM4J.java | COM4J.createInstance | public static<T extends Com4jObject>
T createInstance( Class<T> primaryInterface, GUID clsid ) throws ComException {
return createInstance(primaryInterface,clsid.toString());
} | java | public static<T extends Com4jObject>
T createInstance( Class<T> primaryInterface, GUID clsid ) throws ComException {
return createInstance(primaryInterface,clsid.toString());
} | [
"public",
"static",
"<",
"T",
"extends",
"Com4jObject",
">",
"T",
"createInstance",
"(",
"Class",
"<",
"T",
">",
"primaryInterface",
",",
"GUID",
"clsid",
")",
"throws",
"ComException",
"{",
"return",
"createInstance",
"(",
"primaryInterface",
",",
"clsid",
".... | Creates a new COM object of the given CLSID and returns
it in a wrapped interface.
@param primaryInterface The created COM object is returned as this interface.
Must be non-null. Passing in {@link Com4jObject} allows
the caller to create a new instance without knowing
its primary interface.
@param clsid The CLSID of the COM object to be created. Must be non-null.
@param <T> the type of the return value and the type parameter of the class object of primaryInterface
@return non-null valid object.
@throws ComException if the instantiation fails. | [
"Creates",
"a",
"new",
"COM",
"object",
"of",
"the",
"given",
"CLSID",
"and",
"returns",
"it",
"in",
"a",
"wrapped",
"interface",
"."
] | train | https://github.com/kohsuke/com4j/blob/1e690b805fb0e4e9ef61560e20a56335aecb0b24/runtime/src/main/java/com4j/COM4J.java#L47-L50 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/ModeUsage.java | ModeUsage.addContext | boolean addContext(boolean isRoot, Vector names, Mode mode) {
if (modeMap == null)
modeMap = new ContextMap();
return modeMap.put(isRoot, names, mode);
} | java | boolean addContext(boolean isRoot, Vector names, Mode mode) {
if (modeMap == null)
modeMap = new ContextMap();
return modeMap.put(isRoot, names, mode);
} | [
"boolean",
"addContext",
"(",
"boolean",
"isRoot",
",",
"Vector",
"names",
",",
"Mode",
"mode",
")",
"{",
"if",
"(",
"modeMap",
"==",
"null",
")",
"modeMap",
"=",
"new",
"ContextMap",
"(",
")",
";",
"return",
"modeMap",
".",
"put",
"(",
"isRoot",
",",
... | Adds a new context (isRoot, path --> mode).
@param isRoot Flag indicating that the path starts or not with /
@param names The local names that form the path.
@param mode The mode for this path.
@return true if we do not have a duplicate path. | [
"Adds",
"a",
"new",
"context",
"(",
"isRoot",
"path",
"--",
">",
"mode",
")",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/ModeUsage.java#L154-L158 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.BitArray | public JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final String sizeExpression) {
final Item item = new Item(BinType.BIT_ARRAY, name, this.byteOrder);
item.bitLenExpression = assertExpressionChars(bitLenExpression);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder BitArray(final String name, final String bitLenExpression, final String sizeExpression) {
final Item item = new Item(BinType.BIT_ARRAY, name, this.byteOrder);
item.bitLenExpression = assertExpressionChars(bitLenExpression);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"BitArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"bitLenExpression",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BIT_ARRAY",
",",
"name",
... | Add named bit array where each bit length is calculated through expression.
@param name name of the array, if null then anonymous one
@param bitLenExpression expression to calculate length of the bit field, must not be null
@param sizeExpression expression to be used to calculate array size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"bit",
"array",
"where",
"each",
"bit",
"length",
"is",
"calculated",
"through",
"expression",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L738-L744 |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java | SimpleControl.updateStyle | @Override
protected void updateStyle(PseudoClass pseudo, boolean newValue) {
if (node != null) {
node.pseudoClassStateChanged(pseudo, newValue);
}
if (fieldLabel != null) {
fieldLabel.pseudoClassStateChanged(pseudo, newValue);
}
} | java | @Override
protected void updateStyle(PseudoClass pseudo, boolean newValue) {
if (node != null) {
node.pseudoClassStateChanged(pseudo, newValue);
}
if (fieldLabel != null) {
fieldLabel.pseudoClassStateChanged(pseudo, newValue);
}
} | [
"@",
"Override",
"protected",
"void",
"updateStyle",
"(",
"PseudoClass",
"pseudo",
",",
"boolean",
"newValue",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"node",
".",
"pseudoClassStateChanged",
"(",
"pseudo",
",",
"newValue",
")",
";",
"}",
"if",... | Sets the css style for the defined properties.
@param pseudo The CSS pseudo class to toggle.
@param newValue Determines whether the CSS class should be applied. | [
"Sets",
"the",
"css",
"style",
"for",
"the",
"defined",
"properties",
"."
] | train | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleControl.java#L193-L201 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/OCSPResponseBuilder.java | OCSPResponseBuilder.getKeyStore | public static KeyStore getKeyStore(File keyStoreFile, String keyStorePassword, String tlsStoreType)
throws IOException {
KeyStore keyStore = null;
if (keyStoreFile != null && keyStorePassword != null) {
try (InputStream inputStream = new FileInputStream(keyStoreFile)) {
keyStore = KeyStore.getInstance(tlsStoreType);
keyStore.load(inputStream, keyStorePassword.toCharArray());
} catch (CertificateException | NoSuchAlgorithmException | KeyStoreException e) {
throw new IOException(e);
}
}
return keyStore;
} | java | public static KeyStore getKeyStore(File keyStoreFile, String keyStorePassword, String tlsStoreType)
throws IOException {
KeyStore keyStore = null;
if (keyStoreFile != null && keyStorePassword != null) {
try (InputStream inputStream = new FileInputStream(keyStoreFile)) {
keyStore = KeyStore.getInstance(tlsStoreType);
keyStore.load(inputStream, keyStorePassword.toCharArray());
} catch (CertificateException | NoSuchAlgorithmException | KeyStoreException e) {
throw new IOException(e);
}
}
return keyStore;
} | [
"public",
"static",
"KeyStore",
"getKeyStore",
"(",
"File",
"keyStoreFile",
",",
"String",
"keyStorePassword",
",",
"String",
"tlsStoreType",
")",
"throws",
"IOException",
"{",
"KeyStore",
"keyStore",
"=",
"null",
";",
"if",
"(",
"keyStoreFile",
"!=",
"null",
"&... | Method to create a keystore and return.
@param keyStoreFile keyStore file
@param keyStorePassword keyStore password
@param tlsStoreType PKCS12
@return keystore
@throws IOException Occurs if it fails to create the keystore. | [
"Method",
"to",
"create",
"a",
"keystore",
"and",
"return",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/OCSPResponseBuilder.java#L141-L153 |
seam/faces | impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java | SecurityPhaseListener.redirectToLoginPage | private void redirectToLoginPage(FacesContext context, UIViewRoot viewRoot) {
Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
preLoginEvent.fire(new PreLoginEvent(context, sessionMap));
LoginView loginView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), LoginView.class);
if (loginView == null || loginView.value() == null || loginView.value().isEmpty()) {
log.debug("Returning 401 response (login required)");
context.getExternalContext().setResponseStatus(401);
context.responseComplete();
return;
}
String loginViewId = loginView.value();
log.debugf("Redirecting to configured LoginView %s", loginViewId);
NavigationHandler navHandler = context.getApplication().getNavigationHandler();
navHandler.handleNavigation(context, "", loginViewId);
context.renderResponse();
} | java | private void redirectToLoginPage(FacesContext context, UIViewRoot viewRoot) {
Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
preLoginEvent.fire(new PreLoginEvent(context, sessionMap));
LoginView loginView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), LoginView.class);
if (loginView == null || loginView.value() == null || loginView.value().isEmpty()) {
log.debug("Returning 401 response (login required)");
context.getExternalContext().setResponseStatus(401);
context.responseComplete();
return;
}
String loginViewId = loginView.value();
log.debugf("Redirecting to configured LoginView %s", loginViewId);
NavigationHandler navHandler = context.getApplication().getNavigationHandler();
navHandler.handleNavigation(context, "", loginViewId);
context.renderResponse();
} | [
"private",
"void",
"redirectToLoginPage",
"(",
"FacesContext",
"context",
",",
"UIViewRoot",
"viewRoot",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"sessionMap",
"=",
"context",
".",
"getExternalContext",
"(",
")",
".",
"getSessionMap",
"(",
")",
";",... | Perform the navigation to the @LoginView. If not @LoginView is defined, return a 401 response.
The original view id requested by the user is stored in the session map, for use after a successful login.
@param context
@param viewRoot | [
"Perform",
"the",
"navigation",
"to",
"the",
"@LoginView",
".",
"If",
"not",
"@LoginView",
"is",
"defined",
"return",
"a",
"401",
"response",
".",
"The",
"original",
"view",
"id",
"requested",
"by",
"the",
"user",
"is",
"stored",
"in",
"the",
"session",
"m... | train | https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java#L307-L322 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java | WDataTable.getRowIds | private List<Integer> getRowIds(final int startIndex, final int endIndex) {
// If the table is sorted, we may require a mapping for table row index <--> data model index.
int[] rowIndexMapping = getComponentModel().rowIndexMapping;
// Check if sort mapping needs updating
if (isSorted() && rowIndexMapping != null && rowIndexMapping.length != getDataModel().
getRowCount()) {
rowIndexMapping = getDataModel().sort(getSortColumnIndex(), isSortAscending());
getOrCreateComponentModel().rowIndexMapping = rowIndexMapping;
}
if (rowIndexMapping == null) {
// No mapping, return from startIndex to endIndex
return new RowIdList(startIndex, endIndex);
} else {
List<Integer> rowIds = new ArrayList<>(endIndex - startIndex + 1);
for (int i = startIndex; i <= endIndex; i++) {
rowIds.add(rowIndexMapping[i]);
}
return rowIds;
}
} | java | private List<Integer> getRowIds(final int startIndex, final int endIndex) {
// If the table is sorted, we may require a mapping for table row index <--> data model index.
int[] rowIndexMapping = getComponentModel().rowIndexMapping;
// Check if sort mapping needs updating
if (isSorted() && rowIndexMapping != null && rowIndexMapping.length != getDataModel().
getRowCount()) {
rowIndexMapping = getDataModel().sort(getSortColumnIndex(), isSortAscending());
getOrCreateComponentModel().rowIndexMapping = rowIndexMapping;
}
if (rowIndexMapping == null) {
// No mapping, return from startIndex to endIndex
return new RowIdList(startIndex, endIndex);
} else {
List<Integer> rowIds = new ArrayList<>(endIndex - startIndex + 1);
for (int i = startIndex; i <= endIndex; i++) {
rowIds.add(rowIndexMapping[i]);
}
return rowIds;
}
} | [
"private",
"List",
"<",
"Integer",
">",
"getRowIds",
"(",
"final",
"int",
"startIndex",
",",
"final",
"int",
"endIndex",
")",
"{",
"// If the table is sorted, we may require a mapping for table row index <--> data model index.",
"int",
"[",
"]",
"rowIndexMapping",
"=",
"g... | Determine the row ids for the provided index range.
@param startIndex the startIndex
@param endIndex the endIndex
@return the list of rowIds for the provided index range | [
"Determine",
"the",
"row",
"ids",
"for",
"the",
"provided",
"index",
"range",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java#L1536-L1560 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java | FastaWriterHelper.writeSequence | public static void writeSequence(File file, Sequence<?> sequence) throws Exception {
FileOutputStream outputStream = new FileOutputStream(file);
BufferedOutputStream bo = new BufferedOutputStream(outputStream);
writeSequences(bo, singleSeqToCollection(sequence));
bo.close();
outputStream.close();
} | java | public static void writeSequence(File file, Sequence<?> sequence) throws Exception {
FileOutputStream outputStream = new FileOutputStream(file);
BufferedOutputStream bo = new BufferedOutputStream(outputStream);
writeSequences(bo, singleSeqToCollection(sequence));
bo.close();
outputStream.close();
} | [
"public",
"static",
"void",
"writeSequence",
"(",
"File",
"file",
",",
"Sequence",
"<",
"?",
">",
"sequence",
")",
"throws",
"Exception",
"{",
"FileOutputStream",
"outputStream",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"BufferedOutputStream",
"bo"... | Write a sequence to a file
@param file
@param sequence
@throws Exception | [
"Write",
"a",
"sequence",
"to",
"a",
"file"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java#L148-L154 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/daemon/supervisor/SyncSupervisorEvent.java | SyncSupervisorEvent.getLocalAssign | private Map<Integer, LocalAssignment> getLocalAssign(StormClusterState stormClusterState, String supervisorId,
Map<String, Assignment> assignments) throws Exception {
Map<Integer, LocalAssignment> portToAssignment = new HashMap<>();
for (Entry<String, Assignment> assignEntry : assignments.entrySet()) {
String topologyId = assignEntry.getKey();
Assignment assignment = assignEntry.getValue();
Map<Integer, LocalAssignment> portTasks = readMyTasks(stormClusterState, topologyId, supervisorId, assignment);
if (portTasks == null) {
continue;
}
// a port must be assigned to one assignment
for (Entry<Integer, LocalAssignment> entry : portTasks.entrySet()) {
Integer port = entry.getKey();
LocalAssignment la = entry.getValue();
if (!portToAssignment.containsKey(port)) {
portToAssignment.put(port, la);
} else {
throw new RuntimeException("Should not have multiple topologies assigned to one port");
}
}
}
return portToAssignment;
} | java | private Map<Integer, LocalAssignment> getLocalAssign(StormClusterState stormClusterState, String supervisorId,
Map<String, Assignment> assignments) throws Exception {
Map<Integer, LocalAssignment> portToAssignment = new HashMap<>();
for (Entry<String, Assignment> assignEntry : assignments.entrySet()) {
String topologyId = assignEntry.getKey();
Assignment assignment = assignEntry.getValue();
Map<Integer, LocalAssignment> portTasks = readMyTasks(stormClusterState, topologyId, supervisorId, assignment);
if (portTasks == null) {
continue;
}
// a port must be assigned to one assignment
for (Entry<Integer, LocalAssignment> entry : portTasks.entrySet()) {
Integer port = entry.getKey();
LocalAssignment la = entry.getValue();
if (!portToAssignment.containsKey(port)) {
portToAssignment.put(port, la);
} else {
throw new RuntimeException("Should not have multiple topologies assigned to one port");
}
}
}
return portToAssignment;
} | [
"private",
"Map",
"<",
"Integer",
",",
"LocalAssignment",
">",
"getLocalAssign",
"(",
"StormClusterState",
"stormClusterState",
",",
"String",
"supervisorId",
",",
"Map",
"<",
"String",
",",
"Assignment",
">",
"assignments",
")",
"throws",
"Exception",
"{",
"Map",... | a port must be assigned to a topology
@return map: [port,LocalAssignment] | [
"a",
"port",
"must",
"be",
"assigned",
"to",
"a",
"topology"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/supervisor/SyncSupervisorEvent.java#L223-L248 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/ApptentiveInternal.java | ApptentiveInternal.createInstance | static void createInstance(@NonNull Application application, @NonNull ApptentiveConfiguration configuration) {
final String apptentiveKey = configuration.getApptentiveKey();
final String apptentiveSignature = configuration.getApptentiveSignature();
final String baseURL = configuration.getBaseURL();
final boolean shouldEncryptStorage = configuration.shouldEncryptStorage();
// set log message sanitizing
ApptentiveLog.setShouldSanitizeLogMessages(configuration.shouldSanitizeLogMessages());
// set log level before we initialize log monitor since log monitor can override it as well
ApptentiveLog.overrideLogLevel(configuration.getLogLevel());
// troubleshooting mode
if (configuration.isTroubleshootingModeEnabled()) {
// initialize log writer
ApptentiveLog.initializeLogWriter(application.getApplicationContext(), LOG_HISTORY_SIZE);
// try initializing log monitor
LogMonitor.startSession(application.getApplicationContext(), apptentiveKey, apptentiveSignature);
} else {
ApptentiveLog.i(TROUBLESHOOT, "Troubleshooting is disabled in the app configuration");
}
synchronized (ApptentiveInternal.class) {
if (sApptentiveInternal == null) {
try {
ApptentiveLog.i("Registering Apptentive Android SDK %s", Constants.getApptentiveSdkVersion());
ApptentiveLog.v("ApptentiveKey=%s ApptentiveSignature=%s", apptentiveKey, apptentiveSignature);
sApptentiveInternal = new ApptentiveInternal(application, apptentiveKey, apptentiveSignature, baseURL, shouldEncryptStorage);
dispatchOnConversationQueue(new DispatchTask() {
@Override
protected void execute() {
sApptentiveInternal.start();
}
});
ApptentiveActivityLifecycleCallbacks.register(application);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while initializing ApptentiveInternal instance");
logException(e);
}
} else {
ApptentiveLog.w("Apptentive instance is already initialized");
}
}
} | java | static void createInstance(@NonNull Application application, @NonNull ApptentiveConfiguration configuration) {
final String apptentiveKey = configuration.getApptentiveKey();
final String apptentiveSignature = configuration.getApptentiveSignature();
final String baseURL = configuration.getBaseURL();
final boolean shouldEncryptStorage = configuration.shouldEncryptStorage();
// set log message sanitizing
ApptentiveLog.setShouldSanitizeLogMessages(configuration.shouldSanitizeLogMessages());
// set log level before we initialize log monitor since log monitor can override it as well
ApptentiveLog.overrideLogLevel(configuration.getLogLevel());
// troubleshooting mode
if (configuration.isTroubleshootingModeEnabled()) {
// initialize log writer
ApptentiveLog.initializeLogWriter(application.getApplicationContext(), LOG_HISTORY_SIZE);
// try initializing log monitor
LogMonitor.startSession(application.getApplicationContext(), apptentiveKey, apptentiveSignature);
} else {
ApptentiveLog.i(TROUBLESHOOT, "Troubleshooting is disabled in the app configuration");
}
synchronized (ApptentiveInternal.class) {
if (sApptentiveInternal == null) {
try {
ApptentiveLog.i("Registering Apptentive Android SDK %s", Constants.getApptentiveSdkVersion());
ApptentiveLog.v("ApptentiveKey=%s ApptentiveSignature=%s", apptentiveKey, apptentiveSignature);
sApptentiveInternal = new ApptentiveInternal(application, apptentiveKey, apptentiveSignature, baseURL, shouldEncryptStorage);
dispatchOnConversationQueue(new DispatchTask() {
@Override
protected void execute() {
sApptentiveInternal.start();
}
});
ApptentiveActivityLifecycleCallbacks.register(application);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while initializing ApptentiveInternal instance");
logException(e);
}
} else {
ApptentiveLog.w("Apptentive instance is already initialized");
}
}
} | [
"static",
"void",
"createInstance",
"(",
"@",
"NonNull",
"Application",
"application",
",",
"@",
"NonNull",
"ApptentiveConfiguration",
"configuration",
")",
"{",
"final",
"String",
"apptentiveKey",
"=",
"configuration",
".",
"getApptentiveKey",
"(",
")",
";",
"final... | Create a new or return a existing thread-safe instance of the Apptentive SDK. If this
or any other {@link #getInstance()} has already been called in the application's lifecycle, the
App key will be ignored and the current instance will be returned.
<p/>
This will be called from the application's onCreate(), before any other application objects have been
created. Since the time spent in this function directly impacts the performance of starting the first activity,
service, or receiver in the hosting app's process, the initialization of Apptentive is deferred to the first time
{@link #getInstance()} is called.
@param application the context of the app that is creating the instance | [
"Create",
"a",
"new",
"or",
"return",
"a",
"existing",
"thread",
"-",
"safe",
"instance",
"of",
"the",
"Apptentive",
"SDK",
".",
"If",
"this",
"or",
"any",
"other",
"{",
"@link",
"#getInstance",
"()",
"}",
"has",
"already",
"been",
"called",
"in",
"the",... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/ApptentiveInternal.java#L211-L257 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/CannyEdge.java | CannyEdge.process | public void process(T input , float threshLow, float threshHigh , GrayU8 output ) {
if( threshLow < 0 || threshHigh < 0 )
throw new IllegalArgumentException("Threshold must be >= zero!");
if( hysteresisMark != null ) {
if( output == null )
throw new IllegalArgumentException("An output image must be specified when configured to mark edge points");
}
// setup internal data structures
blurred.reshape(input.width,input.height);
derivX.reshape(input.width,input.height);
derivY.reshape(input.width,input.height);
intensity.reshape(input.width,input.height);
suppressed.reshape(input.width,input.height);
angle.reshape(input.width,input.height);
direction.reshape(input.width,input.height);
work.reshape(input.width,input.height);
// run canny edge detector
blur.process(input,blurred);
gradient.process(blurred, derivX, derivY);
GGradientToEdgeFeatures.intensityAbs(derivX, derivY, intensity);
GGradientToEdgeFeatures.direction(derivX, derivY, angle);
GradientToEdgeFeatures.discretizeDirection4(angle, direction);
GradientToEdgeFeatures.nonMaxSuppression4(intensity, direction, suppressed);
performThresholding(threshLow, threshHigh, output);
} | java | public void process(T input , float threshLow, float threshHigh , GrayU8 output ) {
if( threshLow < 0 || threshHigh < 0 )
throw new IllegalArgumentException("Threshold must be >= zero!");
if( hysteresisMark != null ) {
if( output == null )
throw new IllegalArgumentException("An output image must be specified when configured to mark edge points");
}
// setup internal data structures
blurred.reshape(input.width,input.height);
derivX.reshape(input.width,input.height);
derivY.reshape(input.width,input.height);
intensity.reshape(input.width,input.height);
suppressed.reshape(input.width,input.height);
angle.reshape(input.width,input.height);
direction.reshape(input.width,input.height);
work.reshape(input.width,input.height);
// run canny edge detector
blur.process(input,blurred);
gradient.process(blurred, derivX, derivY);
GGradientToEdgeFeatures.intensityAbs(derivX, derivY, intensity);
GGradientToEdgeFeatures.direction(derivX, derivY, angle);
GradientToEdgeFeatures.discretizeDirection4(angle, direction);
GradientToEdgeFeatures.nonMaxSuppression4(intensity, direction, suppressed);
performThresholding(threshLow, threshHigh, output);
} | [
"public",
"void",
"process",
"(",
"T",
"input",
",",
"float",
"threshLow",
",",
"float",
"threshHigh",
",",
"GrayU8",
"output",
")",
"{",
"if",
"(",
"threshLow",
"<",
"0",
"||",
"threshHigh",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
... | <p>
Runs a canny edge detector on the input image given the provided thresholds. If configured to save
a list of trace points then the output image is optional.
</p>
<p>
NOTE: Input and output can be the same instance, if the image type allows it.
</p>
@param input Input image. Not modified.
@param threshLow Lower threshold. ≥ 0.
@param threshHigh Upper threshold. ≥ 0.
@param output (Might be option) Output binary image. Edge pixels are marked with 1 and everything else 0. | [
"<p",
">",
"Runs",
"a",
"canny",
"edge",
"detector",
"on",
"the",
"input",
"image",
"given",
"the",
"provided",
"thresholds",
".",
"If",
"configured",
"to",
"save",
"a",
"list",
"of",
"trace",
"points",
"then",
"the",
"output",
"image",
"is",
"optional",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/CannyEdge.java#L111-L140 |
alkacon/opencms-core | src/org/opencms/main/OpenCms.java | OpenCms.initCmsObject | public static CmsObject initCmsObject(CmsObject adminCms, CmsContextInfo contextInfo) throws CmsException {
return OpenCmsCore.getInstance().initCmsObject(adminCms, contextInfo);
} | java | public static CmsObject initCmsObject(CmsObject adminCms, CmsContextInfo contextInfo) throws CmsException {
return OpenCmsCore.getInstance().initCmsObject(adminCms, contextInfo);
} | [
"public",
"static",
"CmsObject",
"initCmsObject",
"(",
"CmsObject",
"adminCms",
",",
"CmsContextInfo",
"contextInfo",
")",
"throws",
"CmsException",
"{",
"return",
"OpenCmsCore",
".",
"getInstance",
"(",
")",
".",
"initCmsObject",
"(",
"adminCms",
",",
"contextInfo"... | Returns an initialized CmsObject with the user and context initialized as provided.<p>
Note: Only if the provided <code>adminCms</code> CmsObject has admin permissions,
this method allows the creation a CmsObject for any existing user. Otherwise
only the default users 'Guest' and 'Export' can initialized with
this method, all other user names will throw an Exception.<p>
@param adminCms must either be initialized with "Admin" permissions, or null
@param contextInfo the context info to create a CmsObject for
@return an initialized CmsObject with the given users permissions
@throws CmsException if an invalid user name was provided, or if something else goes wrong
@see org.opencms.db.CmsDefaultUsers#getUserGuest()
@see org.opencms.db.CmsDefaultUsers#getUserExport()
@see OpenCms#initCmsObject(CmsObject)
@see OpenCms#initCmsObject(CmsObject, CmsContextInfo)
@see OpenCms#initCmsObject(String) | [
"Returns",
"an",
"initialized",
"CmsObject",
"with",
"the",
"user",
"and",
"context",
"initialized",
"as",
"provided",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCms.java#L698-L701 |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.replaceProperties | private String replaceProperties(String message, Map<String, String> map) {
if (map != null) {
for (Entry<String, String> entr : map.entrySet()) {
message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue());
}
}
return message;
} | java | private String replaceProperties(String message, Map<String, String> map) {
if (map != null) {
for (Entry<String, String> entr : map.entrySet()) {
message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue());
}
}
return message;
} | [
"private",
"String",
"replaceProperties",
"(",
"String",
"message",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entr",
":",
"map",
... | Replaces properties in message.
@param message
@param map
Key is a string to replace wrapped in <code>@{...}</code>. Value
is a string to replace with.
@return | [
"Replaces",
"properties",
"in",
"message",
"."
] | train | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L604-L611 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java | FeatureOverlayQuery.buildMapClickTableData | public FeatureTableData buildMapClickTableData(LatLng latLng, View view, GoogleMap map) {
return buildMapClickTableData(latLng, view, map, null);
} | java | public FeatureTableData buildMapClickTableData(LatLng latLng, View view, GoogleMap map) {
return buildMapClickTableData(latLng, view, map, null);
} | [
"public",
"FeatureTableData",
"buildMapClickTableData",
"(",
"LatLng",
"latLng",
",",
"View",
"view",
",",
"GoogleMap",
"map",
")",
"{",
"return",
"buildMapClickTableData",
"(",
"latLng",
",",
"view",
",",
"map",
",",
"null",
")",
";",
"}"
] | Perform a query based upon the map click location and build feature table data
@param latLng location
@param view view
@param map Google Map
@return table data on what was clicked, or null
@since 1.2.7 | [
"Perform",
"a",
"query",
"based",
"upon",
"the",
"map",
"click",
"location",
"and",
"build",
"feature",
"table",
"data"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L461-L463 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.getStorageAccountAsync | public Observable<StorageAccountInfoInner> getStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName) {
return getStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).map(new Func1<ServiceResponse<StorageAccountInfoInner>, StorageAccountInfoInner>() {
@Override
public StorageAccountInfoInner call(ServiceResponse<StorageAccountInfoInner> response) {
return response.body();
}
});
} | java | public Observable<StorageAccountInfoInner> getStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName) {
return getStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).map(new Func1<ServiceResponse<StorageAccountInfoInner>, StorageAccountInfoInner>() {
@Override
public StorageAccountInfoInner call(ServiceResponse<StorageAccountInfoInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageAccountInfoInner",
">",
"getStorageAccountAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
")",
"{",
"return",
"getStorageAccountWithServiceResponseAsync",
"(",
"resourceGroupNa... | Gets the specified Azure Storage account linked to the given Data Lake Analytics account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account from which to retrieve Azure storage account details.
@param storageAccountName The name of the Azure Storage account for which to retrieve the details.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageAccountInfoInner object | [
"Gets",
"the",
"specified",
"Azure",
"Storage",
"account",
"linked",
"to",
"the",
"given",
"Data",
"Lake",
"Analytics",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L219-L226 |
jmeetsma/Iglu-Common | src/main/java/org/ijsberg/iglu/util/xml/ElementList.java | ElementList.renameNodesWithAttributeValue | public void renameNodesWithAttributeValue(String oldName, String newName, String attributeName, String attributeValue) {
List<Node> nodes = getNodesFromTreeByName(oldName);
Iterator i = nodes.iterator();
while (i.hasNext()) {
Node n = (Node) i.next();
n.setName(newName);
}
} | java | public void renameNodesWithAttributeValue(String oldName, String newName, String attributeName, String attributeValue) {
List<Node> nodes = getNodesFromTreeByName(oldName);
Iterator i = nodes.iterator();
while (i.hasNext()) {
Node n = (Node) i.next();
n.setName(newName);
}
} | [
"public",
"void",
"renameNodesWithAttributeValue",
"(",
"String",
"oldName",
",",
"String",
"newName",
",",
"String",
"attributeName",
",",
"String",
"attributeValue",
")",
"{",
"List",
"<",
"Node",
">",
"nodes",
"=",
"getNodesFromTreeByName",
"(",
"oldName",
")",... | Rename all nodes with a certain name and a certain attribute name-value pair
@param oldName
@param newName
@param attributeName
@param attributeValue | [
"Rename",
"all",
"nodes",
"with",
"a",
"certain",
"name",
"and",
"a",
"certain",
"attribute",
"name",
"-",
"value",
"pair"
] | train | https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/util/xml/ElementList.java#L372-L379 |
facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorEngine.java | SimulatorEngine.startTaskTrackers | void startTaskTrackers(ClusterStory clusterStory, long now) {
/** port assigned to TTs, incremented by 1 for each TT */
int port = 10000;
long ms = now + 100;
for (MachineNode node : clusterStory.getMachines()) {
String hostname = node.getName();
RackNode rackNode = node.getRackNode();
StaticMapping.addNodeToRack(hostname, rackNode.getName());
String taskTrackerName = "tracker_" + hostname + ":localhost/127.0.0.1:"
+ port;
port++;
SimulatorTaskTracker tt = new SimulatorTaskTracker(jt, taskTrackerName,
hostname, node.getMapSlots(), node.getReduceSlots());
queue.addAll(tt.init(ms++));
}
} | java | void startTaskTrackers(ClusterStory clusterStory, long now) {
/** port assigned to TTs, incremented by 1 for each TT */
int port = 10000;
long ms = now + 100;
for (MachineNode node : clusterStory.getMachines()) {
String hostname = node.getName();
RackNode rackNode = node.getRackNode();
StaticMapping.addNodeToRack(hostname, rackNode.getName());
String taskTrackerName = "tracker_" + hostname + ":localhost/127.0.0.1:"
+ port;
port++;
SimulatorTaskTracker tt = new SimulatorTaskTracker(jt, taskTrackerName,
hostname, node.getMapSlots(), node.getReduceSlots());
queue.addAll(tt.init(ms++));
}
} | [
"void",
"startTaskTrackers",
"(",
"ClusterStory",
"clusterStory",
",",
"long",
"now",
")",
"{",
"/** port assigned to TTs, incremented by 1 for each TT */",
"int",
"port",
"=",
"10000",
";",
"long",
"ms",
"=",
"now",
"+",
"100",
";",
"for",
"(",
"MachineNode",
"no... | Start simulated task trackers based on topology.
@param clusterStory The cluster topology.
@param now
time stamp when the simulator is started, {@link SimulatorTaskTracker}s
are started shortly after this time stamp | [
"Start",
"simulated",
"task",
"trackers",
"based",
"on",
"topology",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorEngine.java#L74-L90 |
apache/incubator-gobblin | gobblin-modules/gobblin-metadata/src/main/java/org/apache/gobblin/type/ContentTypeUtils.java | ContentTypeUtils.registerCharsetMapping | public void registerCharsetMapping(String contentType, String charSet) {
if (knownCharsets.contains(contentType)) {
log.warn("{} is already registered; re-registering");
}
knownCharsets.put(contentType, charSet);
} | java | public void registerCharsetMapping(String contentType, String charSet) {
if (knownCharsets.contains(contentType)) {
log.warn("{} is already registered; re-registering");
}
knownCharsets.put(contentType, charSet);
} | [
"public",
"void",
"registerCharsetMapping",
"(",
"String",
"contentType",
",",
"String",
"charSet",
")",
"{",
"if",
"(",
"knownCharsets",
".",
"contains",
"(",
"contentType",
")",
")",
"{",
"log",
".",
"warn",
"(",
"\"{} is already registered; re-registering\"",
"... | Register a new contentType to charSet mapping.
@param contentType Content-type to register
@param charSet charSet associated with the content-type | [
"Register",
"a",
"new",
"contentType",
"to",
"charSet",
"mapping",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-metadata/src/main/java/org/apache/gobblin/type/ContentTypeUtils.java#L80-L86 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java | AlertResources.addTrigger | @POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{alertId}/triggers")
@Description("Creates new triggers for the given alert ID.")
public List<TriggerDto> addTrigger(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId, TriggerDto triggerDto) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (triggerDto == null) {
throw new WebApplicationException("Null trigger object cannot be created.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert != null) {
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
Trigger trigger = new Trigger(alert, triggerDto.getType(), triggerDto.getName(), triggerDto.getThreshold(),
triggerDto.getSecondaryThreshold(), triggerDto.getInertia());
List<Trigger> triggers = new ArrayList<Trigger>(alert.getTriggers());
triggers.add(trigger);
alert.setTriggers(triggers);
alert.setModifiedBy(getRemoteUser(req));
return TriggerDto.transformToDto(alertService.updateAlert(alert).getTriggers());
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | java | @POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{alertId}/triggers")
@Description("Creates new triggers for the given alert ID.")
public List<TriggerDto> addTrigger(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId, TriggerDto triggerDto) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (triggerDto == null) {
throw new WebApplicationException("Null trigger object cannot be created.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert != null) {
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
Trigger trigger = new Trigger(alert, triggerDto.getType(), triggerDto.getName(), triggerDto.getThreshold(),
triggerDto.getSecondaryThreshold(), triggerDto.getInertia());
List<Trigger> triggers = new ArrayList<Trigger>(alert.getTriggers());
triggers.add(trigger);
alert.setTriggers(triggers);
alert.setModifiedBy(getRemoteUser(req));
return TriggerDto.transformToDto(alertService.updateAlert(alert).getTriggers());
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | [
"@",
"POST",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{alertId}/triggers\"",
")",
"@",
"Description",
"(",
"\"Creates new triggers for the given alert ID.\""... | Creates a new Trigger for a given alert.
@param req The HttpServlet request object. Cannot be null.
@param alertId The alert Id. Cannot be null and must be a positive non-zero number.
@param triggerDto The trigger object. Cannot be null.
@return The alert object for which the trigger was added.
@throws WebApplicationException The exception with 404 status will be thrown if an alert does not exist. | [
"Creates",
"a",
"new",
"Trigger",
"for",
"a",
"given",
"alert",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java#L854-L883 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/util/Types.java | Types.toArray | public static Object toArray(Collection<?> collection, Class<?> componentType) {
if (componentType.isPrimitive()) {
Object array = Array.newInstance(componentType, collection.size());
int index = 0;
for (Object value : collection) {
Array.set(array, index++, value);
}
return array;
}
return collection.toArray((Object[]) Array.newInstance(componentType, collection.size()));
} | java | public static Object toArray(Collection<?> collection, Class<?> componentType) {
if (componentType.isPrimitive()) {
Object array = Array.newInstance(componentType, collection.size());
int index = 0;
for (Object value : collection) {
Array.set(array, index++, value);
}
return array;
}
return collection.toArray((Object[]) Array.newInstance(componentType, collection.size()));
} | [
"public",
"static",
"Object",
"toArray",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"Class",
"<",
"?",
">",
"componentType",
")",
"{",
"if",
"(",
"componentType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"Object",
"array",
"=",
"Array",
".",
"... | Returns a new array of the given component type (possibly a Java primitive) that is a copy of
the content of the given collection.
@param collection collection
@param componentType component type (possibly a Java primitive)
@return new array | [
"Returns",
"a",
"new",
"array",
"of",
"the",
"given",
"component",
"type",
"(",
"possibly",
"a",
"Java",
"primitive",
")",
"that",
"is",
"a",
"copy",
"of",
"the",
"content",
"of",
"the",
"given",
"collection",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/Types.java#L388-L398 |
groupon/monsoon | intf/src/main/java/com/groupon/lex/metrics/Histogram.java | Histogram.modifyEventCounters | public Histogram modifyEventCounters(BiFunction<Range, Double, Double> fn) {
return new Histogram(stream()
.map(entry -> {
entry.setCount(fn.apply(entry.getRange(), entry.getCount()));
return entry;
}));
} | java | public Histogram modifyEventCounters(BiFunction<Range, Double, Double> fn) {
return new Histogram(stream()
.map(entry -> {
entry.setCount(fn.apply(entry.getRange(), entry.getCount()));
return entry;
}));
} | [
"public",
"Histogram",
"modifyEventCounters",
"(",
"BiFunction",
"<",
"Range",
",",
"Double",
",",
"Double",
">",
"fn",
")",
"{",
"return",
"new",
"Histogram",
"(",
"stream",
"(",
")",
".",
"map",
"(",
"entry",
"->",
"{",
"entry",
".",
"setCount",
"(",
... | Create a new histogram, after applying the function on each of the event
counters. | [
"Create",
"a",
"new",
"histogram",
"after",
"applying",
"the",
"function",
"on",
"each",
"of",
"the",
"event",
"counters",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/Histogram.java#L184-L190 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java | AutomationAccountsInner.getByResourceGroupAsync | public Observable<AutomationAccountInner> getByResourceGroupAsync(String resourceGroupName, String automationAccountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, automationAccountName).map(new Func1<ServiceResponse<AutomationAccountInner>, AutomationAccountInner>() {
@Override
public AutomationAccountInner call(ServiceResponse<AutomationAccountInner> response) {
return response.body();
}
});
} | java | public Observable<AutomationAccountInner> getByResourceGroupAsync(String resourceGroupName, String automationAccountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, automationAccountName).map(new Func1<ServiceResponse<AutomationAccountInner>, AutomationAccountInner>() {
@Override
public AutomationAccountInner call(ServiceResponse<AutomationAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AutomationAccountInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccount... | Get information about an Automation Account.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AutomationAccountInner object | [
"Get",
"information",
"about",
"an",
"Automation",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java#L408-L415 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/conversion/provider/SimpleConversionService.java | SimpleConversionService.setDefaultValue | public <T> void setDefaultValue(Class<T> type, Supplier<T> defaultValueSupplier) {
Assert.notNull(type, "Class type is required");
this.defaultValues.put(type, defaultValueSupplier);
} | java | public <T> void setDefaultValue(Class<T> type, Supplier<T> defaultValueSupplier) {
Assert.notNull(type, "Class type is required");
this.defaultValues.put(type, defaultValueSupplier);
} | [
"public",
"<",
"T",
">",
"void",
"setDefaultValue",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Supplier",
"<",
"T",
">",
"defaultValueSupplier",
")",
"{",
"Assert",
".",
"notNull",
"(",
"type",
",",
"\"Class type is required\"",
")",
";",
"this",
".",
"d... | Sets the {@link Supplier} used to supply a {@link Object default value} for the specified {@link Class type}.
This overloaded method is useful for dynamically generating new {@link Object values} at runtime,
such as date/time values
@param <T> {@link Class classification/type} of objects which may have {@link Object default values}.
@param type {@link Class} type to define the {@link Object default value} for.
@param defaultValueSupplier {@link Supplier} used to supply a {@link Object default value}
for the specified {@link Class} type.
@throws IllegalArgumentException if {@link Class type} is {@literal null}.
@see #setDefaultValue(Class, Object)
@see java.util.function.Supplier
@see java.lang.Class | [
"Sets",
"the",
"{",
"@link",
"Supplier",
"}",
"used",
"to",
"supply",
"a",
"{",
"@link",
"Object",
"default",
"value",
"}",
"for",
"the",
"specified",
"{",
"@link",
"Class",
"type",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/provider/SimpleConversionService.java#L320-L323 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java | FileSystemView.lookUpRegularFile | @Nullable
private RegularFile lookUpRegularFile(JimfsPath path, Set<OpenOption> options)
throws IOException {
store.readLock().lock();
try {
DirectoryEntry entry = lookUp(path, options);
if (entry.exists()) {
File file = entry.file();
if (!file.isRegularFile()) {
throw new FileSystemException(path.toString(), null, "not a regular file");
}
return open((RegularFile) file, options);
} else {
return null;
}
} finally {
store.readLock().unlock();
}
} | java | @Nullable
private RegularFile lookUpRegularFile(JimfsPath path, Set<OpenOption> options)
throws IOException {
store.readLock().lock();
try {
DirectoryEntry entry = lookUp(path, options);
if (entry.exists()) {
File file = entry.file();
if (!file.isRegularFile()) {
throw new FileSystemException(path.toString(), null, "not a regular file");
}
return open((RegularFile) file, options);
} else {
return null;
}
} finally {
store.readLock().unlock();
}
} | [
"@",
"Nullable",
"private",
"RegularFile",
"lookUpRegularFile",
"(",
"JimfsPath",
"path",
",",
"Set",
"<",
"OpenOption",
">",
"options",
")",
"throws",
"IOException",
"{",
"store",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Directo... | Looks up the regular file at the given path, throwing an exception if the file isn't a regular
file. Returns null if the file did not exist. | [
"Looks",
"up",
"the",
"regular",
"file",
"at",
"the",
"given",
"path",
"throwing",
"an",
"exception",
"if",
"the",
"file",
"isn",
"t",
"a",
"regular",
"file",
".",
"Returns",
"null",
"if",
"the",
"file",
"did",
"not",
"exist",
"."
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L308-L326 |
intellimate/Izou | src/main/java/org/intellimate/izou/security/SecurityBreachHandler.java | SecurityBreachHandler.createBreachHandler | static SecurityBreachHandler createBreachHandler(Main main, SystemMail systemMail, String toAddress)
throws IllegalAccessException {
if (!exists) {
SecurityBreachHandler breachHandler = new SecurityBreachHandler(main, systemMail, toAddress);
exists = true;
return breachHandler;
}
throw new IllegalAccessException("Cannot create more than one instance of SecurityBreachHandler");
} | java | static SecurityBreachHandler createBreachHandler(Main main, SystemMail systemMail, String toAddress)
throws IllegalAccessException {
if (!exists) {
SecurityBreachHandler breachHandler = new SecurityBreachHandler(main, systemMail, toAddress);
exists = true;
return breachHandler;
}
throw new IllegalAccessException("Cannot create more than one instance of SecurityBreachHandler");
} | [
"static",
"SecurityBreachHandler",
"createBreachHandler",
"(",
"Main",
"main",
",",
"SystemMail",
"systemMail",
",",
"String",
"toAddress",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"!",
"exists",
")",
"{",
"SecurityBreachHandler",
"breachHandler",
"=",... | Creates a SecurityBreachHandler. There can only be one single SecurityBreachHandler, so calling this method twice
will cause an illegal access exception.
@param main the main instance of izou
@param systemMail the system mail object in order to send e-mails to owner in case of emergency
@param toAddress the email address to send error reports to
@return an SecurityBreachHandler
@throws IllegalAccessException thrown if this method is called more than once | [
"Creates",
"a",
"SecurityBreachHandler",
".",
"There",
"can",
"only",
"be",
"one",
"single",
"SecurityBreachHandler",
"so",
"calling",
"this",
"method",
"twice",
"will",
"cause",
"an",
"illegal",
"access",
"exception",
"."
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/SecurityBreachHandler.java#L31-L40 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java | AbstractSoapAttachmentValidator.validateAttachmentContentType | protected void validateAttachmentContentType(SoapAttachment receivedAttachment, SoapAttachment controlAttachment) {
//in case contentType was not set in test case, skip validation
if (!StringUtils.hasText(controlAttachment.getContentType())) { return; }
if (receivedAttachment.getContentType() != null) {
Assert.isTrue(controlAttachment.getContentType() != null,
buildValidationErrorMessage("Values not equal for attachment contentType",
null, receivedAttachment.getContentType()));
Assert.isTrue(receivedAttachment.getContentType().equals(controlAttachment.getContentType()),
buildValidationErrorMessage("Values not equal for attachment contentType",
controlAttachment.getContentType(), receivedAttachment.getContentType()));
} else {
Assert.isTrue(controlAttachment.getContentType() == null || controlAttachment.getContentType().length() == 0,
buildValidationErrorMessage("Values not equal for attachment contentType",
controlAttachment.getContentType(), null));
}
if (log.isDebugEnabled()) {
log.debug("Validating attachment contentType: " + receivedAttachment.getContentType() +
"='" + controlAttachment.getContentType() + "': OK.");
}
} | java | protected void validateAttachmentContentType(SoapAttachment receivedAttachment, SoapAttachment controlAttachment) {
//in case contentType was not set in test case, skip validation
if (!StringUtils.hasText(controlAttachment.getContentType())) { return; }
if (receivedAttachment.getContentType() != null) {
Assert.isTrue(controlAttachment.getContentType() != null,
buildValidationErrorMessage("Values not equal for attachment contentType",
null, receivedAttachment.getContentType()));
Assert.isTrue(receivedAttachment.getContentType().equals(controlAttachment.getContentType()),
buildValidationErrorMessage("Values not equal for attachment contentType",
controlAttachment.getContentType(), receivedAttachment.getContentType()));
} else {
Assert.isTrue(controlAttachment.getContentType() == null || controlAttachment.getContentType().length() == 0,
buildValidationErrorMessage("Values not equal for attachment contentType",
controlAttachment.getContentType(), null));
}
if (log.isDebugEnabled()) {
log.debug("Validating attachment contentType: " + receivedAttachment.getContentType() +
"='" + controlAttachment.getContentType() + "': OK.");
}
} | [
"protected",
"void",
"validateAttachmentContentType",
"(",
"SoapAttachment",
"receivedAttachment",
",",
"SoapAttachment",
"controlAttachment",
")",
"{",
"//in case contentType was not set in test case, skip validation",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"contr... | Validating SOAP attachment content type.
@param receivedAttachment
@param controlAttachment | [
"Validating",
"SOAP",
"attachment",
"content",
"type",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java#L134-L156 |
peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.createCrawlDelayMechanism | @SuppressWarnings("checkstyle:MissingSwitchDefault")
private CrawlDelayMechanism createCrawlDelayMechanism() {
switch (config.getCrawlDelayStrategy()) {
case FIXED:
return new FixedCrawlDelayMechanism(config);
case RANDOM:
return new RandomCrawlDelayMechanism(config);
case ADAPTIVE:
return new AdaptiveCrawlDelayMechanism(config, (JavascriptExecutor) webDriver);
}
throw new IllegalArgumentException("Unsupported crawl delay strategy.");
} | java | @SuppressWarnings("checkstyle:MissingSwitchDefault")
private CrawlDelayMechanism createCrawlDelayMechanism() {
switch (config.getCrawlDelayStrategy()) {
case FIXED:
return new FixedCrawlDelayMechanism(config);
case RANDOM:
return new RandomCrawlDelayMechanism(config);
case ADAPTIVE:
return new AdaptiveCrawlDelayMechanism(config, (JavascriptExecutor) webDriver);
}
throw new IllegalArgumentException("Unsupported crawl delay strategy.");
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:MissingSwitchDefault\"",
")",
"private",
"CrawlDelayMechanism",
"createCrawlDelayMechanism",
"(",
")",
"{",
"switch",
"(",
"config",
".",
"getCrawlDelayStrategy",
"(",
")",
")",
"{",
"case",
"FIXED",
":",
"return",
"new",
... | Creates the crawl delay mechanism according to the configuration.
@return the created crawl delay mechanism | [
"Creates",
"the",
"crawl",
"delay",
"mechanism",
"according",
"to",
"the",
"configuration",
"."
] | train | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L376-L388 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/OCSPResponseBuilder.java | OCSPResponseBuilder.getAIALocations | public static List<String> getAIALocations(X509Certificate userCertificate)
throws CertificateVerificationException {
List<String> locations;
//List the AIA locations from the certificate. Those are the URL's of CA s.
try {
locations = OCSPVerifier.getAIALocations(userCertificate);
} catch (CertificateVerificationException e) {
throw new CertificateVerificationException("Failed to find AIA locations in the cetificate", e);
}
return locations;
} | java | public static List<String> getAIALocations(X509Certificate userCertificate)
throws CertificateVerificationException {
List<String> locations;
//List the AIA locations from the certificate. Those are the URL's of CA s.
try {
locations = OCSPVerifier.getAIALocations(userCertificate);
} catch (CertificateVerificationException e) {
throw new CertificateVerificationException("Failed to find AIA locations in the cetificate", e);
}
return locations;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getAIALocations",
"(",
"X509Certificate",
"userCertificate",
")",
"throws",
"CertificateVerificationException",
"{",
"List",
"<",
"String",
">",
"locations",
";",
"//List the AIA locations from the certificate. Those are the UR... | List Certificate authority url information.
@param userCertificate User's own certificate.
@return AIA Locations
@throws CertificateVerificationException If an error occurs while getting the AIA locations from the certificate. | [
"List",
"Certificate",
"authority",
"url",
"information",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/OCSPResponseBuilder.java#L162-L172 |
berkesa/datatree-promise | src/main/java/io/datatree/Promise.java | Promise.toTree | @SuppressWarnings("unchecked")
protected static final Tree toTree(Object object) {
if (object == null) {
return new Tree((Tree) null, null, null);
}
if (object instanceof Tree) {
return (Tree) object;
}
if (object instanceof Map) {
return new Tree((Map<String, Object>) object);
}
return new Tree((Tree) null, null, object);
} | java | @SuppressWarnings("unchecked")
protected static final Tree toTree(Object object) {
if (object == null) {
return new Tree((Tree) null, null, null);
}
if (object instanceof Tree) {
return (Tree) object;
}
if (object instanceof Map) {
return new Tree((Map<String, Object>) object);
}
return new Tree((Tree) null, null, object);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"static",
"final",
"Tree",
"toTree",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"new",
"Tree",
"(",
"(",
"Tree",
")",
"null",
",",
"null",
"... | Converts an Object to a Tree.
@param object
input Object
@return object converted to Tree | [
"Converts",
"an",
"Object",
"to",
"a",
"Tree",
"."
] | train | https://github.com/berkesa/datatree-promise/blob/d9093bdb549f69b83b3eff5e29cd511f2014f177/src/main/java/io/datatree/Promise.java#L959-L971 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java | AbstractMappedClassFieldObserver.readFieldValue | private static Object readFieldValue(final Object obj, final Field field) {
try {
return field.get(obj);
} catch (Exception ex) {
throw new JBBPException("Can't get value from field [" + field + ']', ex);
}
} | java | private static Object readFieldValue(final Object obj, final Field field) {
try {
return field.get(obj);
} catch (Exception ex) {
throw new JBBPException("Can't get value from field [" + field + ']', ex);
}
} | [
"private",
"static",
"Object",
"readFieldValue",
"(",
"final",
"Object",
"obj",
",",
"final",
"Field",
"field",
")",
"{",
"try",
"{",
"return",
"field",
".",
"get",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
... | Inside auxiliary method to read object field value.
@param obj an object which field is read
@param field a field to be read
@return a value from the field of the object
@throws JBBPException if the field can't be read
@since 1.1 | [
"Inside",
"auxiliary",
"method",
"to",
"read",
"object",
"field",
"value",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/AbstractMappedClassFieldObserver.java#L61-L67 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_GET | public OvhRestorePoint serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_GET(String serviceName, Long datacenterId, Long vmId, Long restorePointId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/restorePoints/{restorePointId}";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId, restorePointId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRestorePoint.class);
} | java | public OvhRestorePoint serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_GET(String serviceName, Long datacenterId, Long vmId, Long restorePointId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/restorePoints/{restorePointId}";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId, restorePointId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRestorePoint.class);
} | [
"public",
"OvhRestorePoint",
"serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"Long",
"vmId",
",",
"Long",
"restorePointId",
")",
"throws",
"IOException",
"{",
"String",
"... | Get this object properties
REST: GET /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/restorePoints/{restorePointId}
@param serviceName [required] Domain of the service
@param datacenterId [required]
@param vmId [required] Id of the virtual machine.
@param restorePointId [required] Id of the restore point.
@deprecated | [
"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#L2074-L2079 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ReflectionUtils.java | ReflectionUtils.getterOrFieldHasAnnotation | static <T extends Annotation> boolean getterOrFieldHasAnnotation(
Method getter, Class<T> annotationClass) {
return getAnnotationFromGetterOrField(getter, annotationClass) != null;
} | java | static <T extends Annotation> boolean getterOrFieldHasAnnotation(
Method getter, Class<T> annotationClass) {
return getAnnotationFromGetterOrField(getter, annotationClass) != null;
} | [
"static",
"<",
"T",
"extends",
"Annotation",
">",
"boolean",
"getterOrFieldHasAnnotation",
"(",
"Method",
"getter",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"return",
"getAnnotationFromGetterOrField",
"(",
"getter",
",",
"annotationClass",
")",
"!... | Returns true if an annotation for the specified type is found on the
getter method or its corresponding class field. | [
"Returns",
"true",
"if",
"an",
"annotation",
"for",
"the",
"specified",
"type",
"is",
"found",
"on",
"the",
"getter",
"method",
"or",
"its",
"corresponding",
"class",
"field",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ReflectionUtils.java#L114-L117 |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java | CheckBase.visitField | @Override
public final void visitField(@Nullable JavaFieldElement oldField, @Nullable JavaFieldElement newField) {
depth++;
doVisitField(oldField, newField);
} | java | @Override
public final void visitField(@Nullable JavaFieldElement oldField, @Nullable JavaFieldElement newField) {
depth++;
doVisitField(oldField, newField);
} | [
"@",
"Override",
"public",
"final",
"void",
"visitField",
"(",
"@",
"Nullable",
"JavaFieldElement",
"oldField",
",",
"@",
"Nullable",
"JavaFieldElement",
"newField",
")",
"{",
"depth",
"++",
";",
"doVisitField",
"(",
"oldField",
",",
"newField",
")",
";",
"}"
... | Please override the
{@link #doVisitField(JavaFieldElement, JavaFieldElement)}
instead.
@see Check#visitField(JavaFieldElement, JavaFieldElement) | [
"Please",
"override",
"the",
"{",
"@link",
"#doVisitField",
"(",
"JavaFieldElement",
"JavaFieldElement",
")",
"}",
"instead",
"."
] | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java#L298-L302 |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.copyUTF8String | private UTF8String copyUTF8String(int start, int end) {
int len = end - start + 1;
byte[] newBytes = new byte[len];
copyMemory(base, offset + start, newBytes, BYTE_ARRAY_OFFSET, len);
return UTF8String.fromBytes(newBytes);
} | java | private UTF8String copyUTF8String(int start, int end) {
int len = end - start + 1;
byte[] newBytes = new byte[len];
copyMemory(base, offset + start, newBytes, BYTE_ARRAY_OFFSET, len);
return UTF8String.fromBytes(newBytes);
} | [
"private",
"UTF8String",
"copyUTF8String",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"len",
"=",
"end",
"-",
"start",
"+",
"1",
";",
"byte",
"[",
"]",
"newBytes",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"copyMemory",
"(",
"base",
"... | Copy the bytes from the current UTF8String, and make a new UTF8String.
@param start the start position of the current UTF8String in bytes.
@param end the end position of the current UTF8String in bytes.
@return a new UTF8String in the position of [start, end] of current UTF8String bytes. | [
"Copy",
"the",
"bytes",
"from",
"the",
"current",
"UTF8String",
"and",
"make",
"a",
"new",
"UTF8String",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L525-L530 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate2NonNegative | public static int[] validate2NonNegative(int[] data, boolean allowSz1, String paramName) {
validateNonNegative(data, paramName);
return validate2(data, allowSz1, paramName);
} | java | public static int[] validate2NonNegative(int[] data, boolean allowSz1, String paramName) {
validateNonNegative(data, paramName);
return validate2(data, allowSz1, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate2NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"boolean",
"allowSz1",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate2",
"(",
"data",
... | Reformats the input array to a length 2 array and checks that all values are >= 0.
If the array is length 1, returns [a, a]
If the array is length 2, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 2 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"2",
"array",
"and",
"checks",
"that",
"all",
"values",
"are",
">",
"=",
"0",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L124-L127 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java | AuthenticationApi.retrieveToken | public DefaultOAuth2AccessToken retrieveToken(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username) throws ApiException {
ApiResponse<DefaultOAuth2AccessToken> resp = retrieveTokenWithHttpInfo(grantType, accept, authorization, clientId, password, refreshToken, scope, username);
return resp.getData();
} | java | public DefaultOAuth2AccessToken retrieveToken(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username) throws ApiException {
ApiResponse<DefaultOAuth2AccessToken> resp = retrieveTokenWithHttpInfo(grantType, accept, authorization, clientId, password, refreshToken, scope, username);
return resp.getData();
} | [
"public",
"DefaultOAuth2AccessToken",
"retrieveToken",
"(",
"String",
"grantType",
",",
"String",
"accept",
",",
"String",
"authorization",
",",
"String",
"clientId",
",",
"String",
"password",
",",
"String",
"refreshToken",
",",
"String",
"scope",
",",
"String",
... | Retrieve access token
Retrieve an access token based on the grant type &mdash; Authorization Code Grant, Resource Owner Password Credentials Grant or Client Credentials Grant. For more information, see [Token Endpoint](https://tools.ietf.org/html/rfc6749). **Note:** For the optional **scope** parameter, the Authentication API supports only the `*` value.
@param grantType The grant type you use to implement authentication. (required)
@param accept The media type the Authentication API should should use for the response. For example: 'Accept: application/x-www-form-urlencoded' (optional)
@param authorization Basic authorization. For example: 'Authorization: Basic Y3...MQ==' (optional)
@param clientId The ID of the application or service that is registered as the client. You'll need to get this value from your PureEngage Cloud representative. (optional)
@param password The agent's password. (optional)
@param refreshToken See [Refresh Token](https://tools.ietf.org/html/rfc6749#section-1.5) for details. (optional)
@param scope The scope of the access request. The Authentication API supports only the `*` value. (optional)
@param username The agent's username. (optional)
@return DefaultOAuth2AccessToken
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Retrieve",
"access",
"token",
"Retrieve",
"an",
"access",
"token",
"based",
"on",
"the",
"grant",
"type",
"&",
";",
"mdash",
";",
"Authorization",
"Code",
"Grant",
"Resource",
"Owner",
"Password",
"Credentials",
"Grant",
"or",
"Client",
"Credentials",
"Grant... | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1049-L1052 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.fetchByC_ERC | @Override
public CPInstance fetchByC_ERC(long companyId, String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CPInstance fetchByC_ERC(long companyId, String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CPInstance",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the cp instance where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp instance, or <code>null</code> if a matching cp instance could not be found | [
"Returns",
"the",
"cp",
"instance",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L6861-L6864 |
jglobus/JGlobus | gram/src/main/java/org/globus/rsl/RslAttributes.java | RslAttributes.removeVariable | public boolean removeVariable(String attribute, String varName) {
Bindings binds = rslTree.getBindings(attribute);
if (binds == null) return false;
return binds.removeVariable(varName);
} | java | public boolean removeVariable(String attribute, String varName) {
Bindings binds = rslTree.getBindings(attribute);
if (binds == null) return false;
return binds.removeVariable(varName);
} | [
"public",
"boolean",
"removeVariable",
"(",
"String",
"attribute",
",",
"String",
"varName",
")",
"{",
"Bindings",
"binds",
"=",
"rslTree",
".",
"getBindings",
"(",
"attribute",
")",
";",
"if",
"(",
"binds",
"==",
"null",
")",
"return",
"false",
";",
"retu... | Removes a specific variable definition given a variable name.
@param attribute the attribute that defines variable definitions.
@param varName the name of the variable to remove.
@return true if the variable was successfully removed. Otherwise,
returns false, | [
"Removes",
"a",
"specific",
"variable",
"definition",
"given",
"a",
"variable",
"name",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gram/src/main/java/org/globus/rsl/RslAttributes.java#L206-L210 |
atomix/atomix | core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java | AbstractAtomicMapService.putValue | protected void putValue(K key, MapEntryValue value) {
MapEntryValue oldValue = entries().put(key, value);
cancelTtl(oldValue);
scheduleTtl(key, value);
} | java | protected void putValue(K key, MapEntryValue value) {
MapEntryValue oldValue = entries().put(key, value);
cancelTtl(oldValue);
scheduleTtl(key, value);
} | [
"protected",
"void",
"putValue",
"(",
"K",
"key",
",",
"MapEntryValue",
"value",
")",
"{",
"MapEntryValue",
"oldValue",
"=",
"entries",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"cancelTtl",
"(",
"oldValue",
")",
";",
"scheduleTtl",
"(",
... | Updates the given value.
@param key the key to update
@param value the value to update | [
"Updates",
"the",
"given",
"value",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java#L255-L259 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java | PebbleKit.registerReceivedNackHandler | public static BroadcastReceiver registerReceivedNackHandler(final Context context,
final PebbleNackReceiver receiver) {
return registerBroadcastReceiverInternal(context, INTENT_APP_RECEIVE_NACK, receiver);
} | java | public static BroadcastReceiver registerReceivedNackHandler(final Context context,
final PebbleNackReceiver receiver) {
return registerBroadcastReceiverInternal(context, INTENT_APP_RECEIVE_NACK, receiver);
} | [
"public",
"static",
"BroadcastReceiver",
"registerReceivedNackHandler",
"(",
"final",
"Context",
"context",
",",
"final",
"PebbleNackReceiver",
"receiver",
")",
"{",
"return",
"registerBroadcastReceiverInternal",
"(",
"context",
",",
"INTENT_APP_RECEIVE_NACK",
",",
"receive... | A convenience function to assist in programatically registering a broadcast receiver for the 'RECEIVE_NACK'
intent.
To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the
Activity's {@link android.app.Activity#onPause()} method.
@param context
The context in which to register the BroadcastReceiver.
@param receiver
The receiver to be registered.
@return The registered receiver.
@see Constants#INTENT_APP_RECEIVE_NACK | [
"A",
"convenience",
"function",
"to",
"assist",
"in",
"programatically",
"registering",
"a",
"broadcast",
"receiver",
"for",
"the",
"RECEIVE_NACK",
"intent",
"."
] | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L469-L472 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java | ZooKeeper.getChildren | public void getChildren(final String path, Watcher watcher,
ChildrenCallback cb, Object ctx) {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
// the watch contains the un-chroot path
WatchRegistration wcb = null;
if (watcher != null) {
wcb = new ChildWatchRegistration(watcher, clientPath);
}
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.getChildren);
GetChildrenRequest request = new GetChildrenRequest();
request.setPath(serverPath);
request.setWatch(watcher != null);
GetChildrenResponse response = new GetChildrenResponse();
cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
clientPath, serverPath, ctx, wcb);
} | java | public void getChildren(final String path, Watcher watcher,
ChildrenCallback cb, Object ctx) {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
// the watch contains the un-chroot path
WatchRegistration wcb = null;
if (watcher != null) {
wcb = new ChildWatchRegistration(watcher, clientPath);
}
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.getChildren);
GetChildrenRequest request = new GetChildrenRequest();
request.setPath(serverPath);
request.setWatch(watcher != null);
GetChildrenResponse response = new GetChildrenResponse();
cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
clientPath, serverPath, ctx, wcb);
} | [
"public",
"void",
"getChildren",
"(",
"final",
"String",
"path",
",",
"Watcher",
"watcher",
",",
"ChildrenCallback",
"cb",
",",
"Object",
"ctx",
")",
"{",
"verbotenThreadCheck",
"(",
")",
";",
"final",
"String",
"clientPath",
"=",
"path",
";",
"PathUtils",
"... | The Asynchronous version of getChildren. The request doesn't actually
until the asynchronous callback is called.
@see #getChildren(String, Watcher) | [
"The",
"Asynchronous",
"version",
"of",
"getChildren",
".",
"The",
"request",
"doesn",
"t",
"actually",
"until",
"the",
"asynchronous",
"callback",
"is",
"called",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L1345-L1367 |
rhuss/jolokia | agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/OptionsAndArgs.java | OptionsAndArgs.lookupJarFile | public static File lookupJarFile() {
try {
return new File(OptionsAndArgs.class
.getProtectionDomain()
.getCodeSource()
.getLocation()
.toURI());
} catch (URISyntaxException e) {
throw new IllegalStateException("Error: Cannot lookup jar for this class: " + e,e);
}
} | java | public static File lookupJarFile() {
try {
return new File(OptionsAndArgs.class
.getProtectionDomain()
.getCodeSource()
.getLocation()
.toURI());
} catch (URISyntaxException e) {
throw new IllegalStateException("Error: Cannot lookup jar for this class: " + e,e);
}
} | [
"public",
"static",
"File",
"lookupJarFile",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"File",
"(",
"OptionsAndArgs",
".",
"class",
".",
"getProtectionDomain",
"(",
")",
".",
"getCodeSource",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"toURI",
"(",
"... | Lookup the JAR File from where this class is loaded
@return File pointing to the JAR-File from where this class was loaded. | [
"Lookup",
"the",
"JAR",
"File",
"from",
"where",
"this",
"class",
"is",
"loaded"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/OptionsAndArgs.java#L257-L267 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java | URBridgeEntity.getUsersForGroup | public void getUsersForGroup(List<String> grpMbrAttrs, int countLimit) throws Exception {
throw new WIMApplicationException(WIMMessageKey.METHOD_NOT_IMPLEMENTED, Tr.formatMessage(tc, WIMMessageKey.METHOD_NOT_IMPLEMENTED));
} | java | public void getUsersForGroup(List<String> grpMbrAttrs, int countLimit) throws Exception {
throw new WIMApplicationException(WIMMessageKey.METHOD_NOT_IMPLEMENTED, Tr.formatMessage(tc, WIMMessageKey.METHOD_NOT_IMPLEMENTED));
} | [
"public",
"void",
"getUsersForGroup",
"(",
"List",
"<",
"String",
">",
"grpMbrAttrs",
",",
"int",
"countLimit",
")",
"throws",
"Exception",
"{",
"throw",
"new",
"WIMApplicationException",
"(",
"WIMMessageKey",
".",
"METHOD_NOT_IMPLEMENTED",
",",
"Tr",
".",
"format... | Ensure that an exception will be thrown if this function is called
but not implemented by the child class.
@param grpMbrshipAttrs
@throws Exception on all calls. | [
"Ensure",
"that",
"an",
"exception",
"will",
"be",
"thrown",
"if",
"this",
"function",
"is",
"called",
"but",
"not",
"implemented",
"by",
"the",
"child",
"class",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java#L275-L277 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/network/Interface_stats.java | Interface_stats.get | public static Interface_stats get(nitro_service service, String id) throws Exception{
Interface_stats obj = new Interface_stats();
obj.set_id(id);
Interface_stats response = (Interface_stats) obj.stat_resource(service);
return response;
} | java | public static Interface_stats get(nitro_service service, String id) throws Exception{
Interface_stats obj = new Interface_stats();
obj.set_id(id);
Interface_stats response = (Interface_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"Interface_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"id",
")",
"throws",
"Exception",
"{",
"Interface_stats",
"obj",
"=",
"new",
"Interface_stats",
"(",
")",
";",
"obj",
".",
"set_id",
"(",
"id",
")",
";",
"Interface... | Use this API to fetch statistics of Interface_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"Interface_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/Interface_stats.java#L594-L599 |
hawkular/hawkular-apm | examples/polyglot-zipkin/java-dropwizard/src/main/java/org/hawkular/apm/example/dropwizard/rest/URLUtils.java | URLUtils.getInServiceURL | public static String getInServiceURL(HttpServletRequest request, String path) {
String contextPath = ((Request) request).getContext().getContextPath();
int port = request.getServerPort();
return getInServiceURL(port, contextPath, path);
} | java | public static String getInServiceURL(HttpServletRequest request, String path) {
String contextPath = ((Request) request).getContext().getContextPath();
int port = request.getServerPort();
return getInServiceURL(port, contextPath, path);
} | [
"public",
"static",
"String",
"getInServiceURL",
"(",
"HttpServletRequest",
"request",
",",
"String",
"path",
")",
"{",
"String",
"contextPath",
"=",
"(",
"(",
"Request",
")",
"request",
")",
".",
"getContext",
"(",
")",
".",
"getContextPath",
"(",
")",
";",... | Constructs URL for in service requests (e.g. calls for endpoint of this application) | [
"Constructs",
"URL",
"for",
"in",
"service",
"requests",
"(",
"e",
".",
"g",
".",
"calls",
"for",
"endpoint",
"of",
"this",
"application",
")"
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/examples/polyglot-zipkin/java-dropwizard/src/main/java/org/hawkular/apm/example/dropwizard/rest/URLUtils.java#L36-L41 |
ZieIony/Carbon | carbon/src/main/java/carbon/drawable/ripple/TypedArrayCompat.java | TypedArrayCompat.getResourceId | public static int getResourceId(Resources.Theme theme, TypedArray a, TypedValue[] values, int index, int def) {
if (values != null && theme != null) {
TypedValue v = values[index];
if (v.type == TypedValue.TYPE_ATTRIBUTE) {
TEMP_ARRAY[0] = v.data;
TypedArray tmp = theme.obtainStyledAttributes(null, TEMP_ARRAY, 0, 0);
try {
return tmp.getResourceId(0, def);
} finally {
tmp.recycle();
}
}
}
if (a != null) {
return a.getResourceId(index, def);
}
return def;
} | java | public static int getResourceId(Resources.Theme theme, TypedArray a, TypedValue[] values, int index, int def) {
if (values != null && theme != null) {
TypedValue v = values[index];
if (v.type == TypedValue.TYPE_ATTRIBUTE) {
TEMP_ARRAY[0] = v.data;
TypedArray tmp = theme.obtainStyledAttributes(null, TEMP_ARRAY, 0, 0);
try {
return tmp.getResourceId(0, def);
} finally {
tmp.recycle();
}
}
}
if (a != null) {
return a.getResourceId(index, def);
}
return def;
} | [
"public",
"static",
"int",
"getResourceId",
"(",
"Resources",
".",
"Theme",
"theme",
",",
"TypedArray",
"a",
",",
"TypedValue",
"[",
"]",
"values",
",",
"int",
"index",
",",
"int",
"def",
")",
"{",
"if",
"(",
"values",
"!=",
"null",
"&&",
"theme",
"!="... | Retrieve the resource identifier for the attribute at
<var>index</var>. Note that attribute resource as resolved when
the overall {@link TypedArray} object is retrieved. As a result, this function will return
the resource identifier of the final resource value that was found, <em>not</em> necessarily
the original resource that was specified by the attribute.
@param index Index of attribute to retrieve.
@param def Value to return if the attribute is not defined or not a resource.
@return Attribute resource identifier, or defValue if not defined. | [
"Retrieve",
"the",
"resource",
"identifier",
"for",
"the",
"attribute",
"at",
"<var",
">",
"index<",
"/",
"var",
">",
".",
"Note",
"that",
"attribute",
"resource",
"as",
"resolved",
"when",
"the",
"overall",
"{",
"@link",
"TypedArray",
"}",
"object",
"is",
... | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/TypedArrayCompat.java#L111-L130 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java | WorkflowServiceImpl.terminateWorkflow | @Service
public void terminateWorkflow(String workflowId, String reason) {
workflowExecutor.terminateWorkflow(workflowId, reason);
} | java | @Service
public void terminateWorkflow(String workflowId, String reason) {
workflowExecutor.terminateWorkflow(workflowId, reason);
} | [
"@",
"Service",
"public",
"void",
"terminateWorkflow",
"(",
"String",
"workflowId",
",",
"String",
"reason",
")",
"{",
"workflowExecutor",
".",
"terminateWorkflow",
"(",
"workflowId",
",",
"reason",
")",
";",
"}"
] | Terminate workflow execution.
@param workflowId WorkflowId of the workflow.
@param reason Reason for terminating the workflow. | [
"Terminate",
"workflow",
"execution",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java#L322-L325 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getValue | public Double getValue(double latitude, double longitude) {
CoverageDataRequest request = new CoverageDataRequest(latitude,
longitude);
CoverageDataResults values = getValues(request, 1, 1);
Double value = null;
if (values != null) {
value = values.getValues()[0][0];
}
return value;
} | java | public Double getValue(double latitude, double longitude) {
CoverageDataRequest request = new CoverageDataRequest(latitude,
longitude);
CoverageDataResults values = getValues(request, 1, 1);
Double value = null;
if (values != null) {
value = values.getValues()[0][0];
}
return value;
} | [
"public",
"Double",
"getValue",
"(",
"double",
"latitude",
",",
"double",
"longitude",
")",
"{",
"CoverageDataRequest",
"request",
"=",
"new",
"CoverageDataRequest",
"(",
"latitude",
",",
"longitude",
")",
";",
"CoverageDataResults",
"values",
"=",
"getValues",
"(... | Get the coverage data value at the coordinate
@param latitude
latitude
@param longitude
longitude
@return coverage data value | [
"Get",
"the",
"coverage",
"data",
"value",
"at",
"the",
"coordinate"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1691-L1700 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibLink.java | ClientlibLink.withHash | public ClientlibLink withHash(String newHash) {
return new ClientlibLink(type, kind, path, properties, newHash);
} | java | public ClientlibLink withHash(String newHash) {
return new ClientlibLink(type, kind, path, properties, newHash);
} | [
"public",
"ClientlibLink",
"withHash",
"(",
"String",
"newHash",
")",
"{",
"return",
"new",
"ClientlibLink",
"(",
"type",
",",
"kind",
",",
"path",
",",
"properties",
",",
"newHash",
")",
";",
"}"
] | Creates a new link with parameters as this except hash.
@param newHash new nullable hash for the resource to be encoded in the URL for clientlibs / - categories. | [
"Creates",
"a",
"new",
"link",
"with",
"parameters",
"as",
"this",
"except",
"hash",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/handle/ClientlibLink.java#L103-L105 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getSubjectX500Principal | public static X500Principal getSubjectX500Principal(X509Certificate cert) {
try {
return getX500Principal(cert, false);
} catch (Exception e) {
throw new RuntimeException("Could not parse subject", e);
}
} | java | public static X500Principal getSubjectX500Principal(X509Certificate cert) {
try {
return getX500Principal(cert, false);
} catch (Exception e) {
throw new RuntimeException("Could not parse subject", e);
}
} | [
"public",
"static",
"X500Principal",
"getSubjectX500Principal",
"(",
"X509Certificate",
"cert",
")",
"{",
"try",
"{",
"return",
"getX500Principal",
"(",
"cert",
",",
"false",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeExce... | Extract the subject X500Principal from an X509Certificate.
Called from java.security.cert.X509Certificate.getSubjectX500Principal(). | [
"Extract",
"the",
"subject",
"X500Principal",
"from",
"an",
"X509Certificate",
".",
"Called",
"from",
"java",
".",
"security",
".",
"cert",
".",
"X509Certificate",
".",
"getSubjectX500Principal",
"()",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1889-L1895 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccessprofile.java | vpnclientlessaccessprofile.get | public static vpnclientlessaccessprofile get(nitro_service service, String profilename) throws Exception{
vpnclientlessaccessprofile obj = new vpnclientlessaccessprofile();
obj.set_profilename(profilename);
vpnclientlessaccessprofile response = (vpnclientlessaccessprofile) obj.get_resource(service);
return response;
} | java | public static vpnclientlessaccessprofile get(nitro_service service, String profilename) throws Exception{
vpnclientlessaccessprofile obj = new vpnclientlessaccessprofile();
obj.set_profilename(profilename);
vpnclientlessaccessprofile response = (vpnclientlessaccessprofile) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpnclientlessaccessprofile",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"profilename",
")",
"throws",
"Exception",
"{",
"vpnclientlessaccessprofile",
"obj",
"=",
"new",
"vpnclientlessaccessprofile",
"(",
")",
";",
"obj",
".",
"set_prof... | Use this API to fetch vpnclientlessaccessprofile resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnclientlessaccessprofile",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccessprofile.java#L553-L558 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusStop | @Pure
public BusStop getBusStop(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusStop busStop : this.validBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
return null;
} | java | @Pure
public BusStop getBusStop(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusStop busStop : this.validBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusStop",
"getBusStop",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
... | Replies the bus stop with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return BusStop or <code>null</code> | [
"Replies",
"the",
"bus",
"stop",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L945-L962 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java | SensitiveWordClient.getSensitiveWordList | public SensitiveWordListResult getSensitiveWordList(int start, int count)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(start >= 0, "start should not less than 0");
Preconditions.checkArgument(count <= 2000, "count should not bigger than 2000");
ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + sensitiveWordPath + "?start=" + start + "&count=" + count);
return _gson.fromJson(responseWrapper.responseContent, SensitiveWordListResult.class);
} | java | public SensitiveWordListResult getSensitiveWordList(int start, int count)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(start >= 0, "start should not less than 0");
Preconditions.checkArgument(count <= 2000, "count should not bigger than 2000");
ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + sensitiveWordPath + "?start=" + start + "&count=" + count);
return _gson.fromJson(responseWrapper.responseContent, SensitiveWordListResult.class);
} | [
"public",
"SensitiveWordListResult",
"getSensitiveWordList",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"start",
">=",
"0",
",",
"\"start should not less... | Get sensitive word list
@param start the begin of the list
@param count the count of the list
@return SensitiveWordListResult
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"sensitive",
"word",
"list"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java#L109-L115 |
OpenBEL/openbel-framework | org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java | PhaseThreeApplication.failIndex | private void failIndex(PhaseThreeOptions phasecfg, String errorMessage) {
stageError(errorMessage);
final StringBuilder bldr = new StringBuilder();
bldr.append("Could not find resource index file.");
bldr.append("Expansion of protein families, named complexes, ");
bldr.append("gene scaffolding, and orthology will not occur.");
stageError(bldr.toString());
ResourceIndex.INSTANCE.loadIndex();
phasecfg.setInjectProteinFamilies(false);
phasecfg.setInjectNamedComplexes(false);
phasecfg.setInjectGeneScaffolding(false);
phasecfg.setInjectOrthology(false);
} | java | private void failIndex(PhaseThreeOptions phasecfg, String errorMessage) {
stageError(errorMessage);
final StringBuilder bldr = new StringBuilder();
bldr.append("Could not find resource index file.");
bldr.append("Expansion of protein families, named complexes, ");
bldr.append("gene scaffolding, and orthology will not occur.");
stageError(bldr.toString());
ResourceIndex.INSTANCE.loadIndex();
phasecfg.setInjectProteinFamilies(false);
phasecfg.setInjectNamedComplexes(false);
phasecfg.setInjectGeneScaffolding(false);
phasecfg.setInjectOrthology(false);
} | [
"private",
"void",
"failIndex",
"(",
"PhaseThreeOptions",
"phasecfg",
",",
"String",
"errorMessage",
")",
"{",
"stageError",
"(",
"errorMessage",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bldr",
".",
"append",
"("... | Logic to recover from a missing resource index.
@param phasecfg
@param errorMessage | [
"Logic",
"to",
"recover",
"from",
"a",
"missing",
"resource",
"index",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L295-L307 |
chrisjenx/Calligraphy | calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java | CalligraphyLayoutInflater.onCreateView | @Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected View onCreateView(View parent, String name, AttributeSet attrs) throws ClassNotFoundException {
return mCalligraphyFactory.onViewCreated(super.onCreateView(parent, name, attrs),
getContext(), attrs);
} | java | @Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected View onCreateView(View parent, String name, AttributeSet attrs) throws ClassNotFoundException {
return mCalligraphyFactory.onViewCreated(super.onCreateView(parent, name, attrs),
getContext(), attrs);
} | [
"@",
"Override",
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"protected",
"View",
"onCreateView",
"(",
"View",
"parent",
",",
"String",
"name",
",",
"AttributeSet",
"attrs",
")",
"throws",
"ClassNotFoundException",
"{",
"return",... | The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.
BUT only for none CustomViews. | [
"The",
"LayoutInflater",
"onCreateView",
"is",
"the",
"fourth",
"port",
"of",
"call",
"for",
"LayoutInflation",
".",
"BUT",
"only",
"for",
"none",
"CustomViews",
"."
] | train | https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyLayoutInflater.java#L145-L150 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.listFromTaskNextAsync | public ServiceFuture<List<NodeFile>> listFromTaskNextAsync(final String nextPageLink, final ServiceFuture<List<NodeFile>> serviceFuture, final ListOperationCallback<NodeFile> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listFromTaskNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(String nextPageLink) {
return listFromTaskNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
} | java | public ServiceFuture<List<NodeFile>> listFromTaskNextAsync(final String nextPageLink, final ServiceFuture<List<NodeFile>> serviceFuture, final ListOperationCallback<NodeFile> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listFromTaskNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(String nextPageLink) {
return listFromTaskNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"NodeFile",
">",
">",
"listFromTaskNextAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"ServiceFuture",
"<",
"List",
"<",
"NodeFile",
">",
">",
"serviceFuture",
",",
"final",
"ListOperationCallback",
"<",
... | Lists the files in a task's directory on its compute node.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param serviceFuture the ServiceFuture object tracking the Retrofit calls
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"the",
"files",
"in",
"a",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2249-L2259 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/info/XGlobalAttributeNameMap.java | XGlobalAttributeNameMap.registerMapping | public void registerMapping(String mappingName, String attributeKey, String alias) {
XAttributeNameMapImpl mapping = (XAttributeNameMapImpl)getMapping(mappingName);
mapping.registerMapping(attributeKey, alias);
} | java | public void registerMapping(String mappingName, String attributeKey, String alias) {
XAttributeNameMapImpl mapping = (XAttributeNameMapImpl)getMapping(mappingName);
mapping.registerMapping(attributeKey, alias);
} | [
"public",
"void",
"registerMapping",
"(",
"String",
"mappingName",
",",
"String",
"attributeKey",
",",
"String",
"alias",
")",
"{",
"XAttributeNameMapImpl",
"mapping",
"=",
"(",
"XAttributeNameMapImpl",
")",
"getMapping",
"(",
"mappingName",
")",
";",
"mapping",
"... | Registers a known attribute for mapping in a given attribute name
map. <b>IMPORTANT:</b> This method should only be called when one
intends to create, or add to, the global attribute name mapping.
@param mappingName Name of the mapping to register with.
@param attributeKey Attribute key to be mapped.
@param alias Alias to map the given attribute to. | [
"Registers",
"a",
"known",
"attribute",
"for",
"mapping",
"in",
"a",
"given",
"attribute",
"name",
"map",
".",
"<b",
">",
"IMPORTANT",
":",
"<",
"/",
"b",
">",
"This",
"method",
"should",
"only",
"be",
"called",
"when",
"one",
"intends",
"to",
"create",
... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/info/XGlobalAttributeNameMap.java#L272-L275 |
knowm/XChange | xchange-core/src/main/java/org/knowm/xchange/utils/Assert.java | Assert.hasSize | public static void hasSize(Collection<?> input, int length, String message) {
notNull(input, message);
if (input.size() != length) {
throw new IllegalArgumentException(message);
}
} | java | public static void hasSize(Collection<?> input, int length, String message) {
notNull(input, message);
if (input.size() != length) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"hasSize",
"(",
"Collection",
"<",
"?",
">",
"input",
",",
"int",
"length",
",",
"String",
"message",
")",
"{",
"notNull",
"(",
"input",
",",
"message",
")",
";",
"if",
"(",
"input",
".",
"size",
"(",
")",
"!=",
"length",
... | Asserts that a Collection is not null and of a certain size
@param input The input under test
@param message The message for any exception | [
"Asserts",
"that",
"a",
"Collection",
"is",
"not",
"null",
"and",
"of",
"a",
"certain",
"size"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/Assert.java#L60-L66 |
mongodb/stitch-android-sdk | server/services/fcm/src/main/java/com/mongodb/stitch/server/services/fcm/internal/FcmServiceClientImpl.java | FcmServiceClientImpl.sendMessageTo | @Override
public FcmSendMessageResult sendMessageTo(final String to, final FcmSendMessageRequest request) {
return proxy.sendMessageTo(to, request);
} | java | @Override
public FcmSendMessageResult sendMessageTo(final String to, final FcmSendMessageRequest request) {
return proxy.sendMessageTo(to, request);
} | [
"@",
"Override",
"public",
"FcmSendMessageResult",
"sendMessageTo",
"(",
"final",
"String",
"to",
",",
"final",
"FcmSendMessageRequest",
"request",
")",
"{",
"return",
"proxy",
".",
"sendMessageTo",
"(",
"to",
",",
"request",
")",
";",
"}"
] | Sends an FCM message to the given target with the given request payload.
@param to the target to send a message to.
@param request the details of the message.
@return the result of sending the message. | [
"Sends",
"an",
"FCM",
"message",
"to",
"the",
"given",
"target",
"with",
"the",
"given",
"request",
"payload",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/services/fcm/src/main/java/com/mongodb/stitch/server/services/fcm/internal/FcmServiceClientImpl.java#L40-L43 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/ConnectionPool.java | ConnectionPool.free | public void free(Connection connection) {
try {
if (!connection.isClosed()){
// ensure connections returned to pool as read-only
setConnectionReadOnly(connection, true);
connection.close();
} else {
logger.debug("Ignoring attempt to close a previously closed connection");
}
} catch (SQLException sqle) {
logger.warn("Unable to close connection", sqle);
} finally {
if (logger.isDebugEnabled()) {
logger.debug("Returned connection to pool (" + toString() + ")");
}
}
} | java | public void free(Connection connection) {
try {
if (!connection.isClosed()){
// ensure connections returned to pool as read-only
setConnectionReadOnly(connection, true);
connection.close();
} else {
logger.debug("Ignoring attempt to close a previously closed connection");
}
} catch (SQLException sqle) {
logger.warn("Unable to close connection", sqle);
} finally {
if (logger.isDebugEnabled()) {
logger.debug("Returned connection to pool (" + toString() + ")");
}
}
} | [
"public",
"void",
"free",
"(",
"Connection",
"connection",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"connection",
".",
"isClosed",
"(",
")",
")",
"{",
"// ensure connections returned to pool as read-only",
"setConnectionReadOnly",
"(",
"connection",
",",
"true",
")",... | <p>
Releases the specified connection and returns it to the pool.
</p>
@param connection
A JDBC connection. | [
"<p",
">",
"Releases",
"the",
"specified",
"connection",
"and",
"returns",
"it",
"to",
"the",
"pool",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/ConnectionPool.java#L332-L348 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.writeHashIndex | private void writeHashIndex(int index, long value, int tableid)
throws IOException {
long diskloc = header.calcOffset(index, tableid);
filemgr.seek(diskloc);
filemgr.writeLong(value);
updateHtindex(index, value, tableid);
} | java | private void writeHashIndex(int index, long value, int tableid)
throws IOException {
long diskloc = header.calcOffset(index, tableid);
filemgr.seek(diskloc);
filemgr.writeLong(value);
updateHtindex(index, value, tableid);
} | [
"private",
"void",
"writeHashIndex",
"(",
"int",
"index",
",",
"long",
"value",
",",
"int",
"tableid",
")",
"throws",
"IOException",
"{",
"long",
"diskloc",
"=",
"header",
".",
"calcOffset",
"(",
"index",
",",
"tableid",
")",
";",
"filemgr",
".",
"seek",
... | ************************************************************************
Given an index into the hash table and a value to store there, find it
on disk and write the value.
*********************************************************************** | [
"************************************************************************",
"Given",
"an",
"index",
"into",
"the",
"hash",
"table",
"and",
"a",
"value",
"to",
"store",
"there",
"find",
"it",
"on",
"disk",
"and",
"write",
"the",
"value",
".",
"***************************... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1419-L1426 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/Assert.java | Assert.assertToken | public static void assertToken(String message, int expectedType, String expectedText, Token token)
{
assertToken(message, BaseRecognizer.DEFAULT_TOKEN_CHANNEL, expectedType, expectedText, token);
} | java | public static void assertToken(String message, int expectedType, String expectedText, Token token)
{
assertToken(message, BaseRecognizer.DEFAULT_TOKEN_CHANNEL, expectedType, expectedText, token);
} | [
"public",
"static",
"void",
"assertToken",
"(",
"String",
"message",
",",
"int",
"expectedType",
",",
"String",
"expectedText",
",",
"Token",
"token",
")",
"{",
"assertToken",
"(",
"message",
",",
"BaseRecognizer",
".",
"DEFAULT_TOKEN_CHANNEL",
",",
"expectedType"... | Asserts properties of a token.
@param message the message to display on failure.
@param expectedType the expected type of the token.
@param expectedText the expected text of the token.
@param token the token to assert. | [
"Asserts",
"properties",
"of",
"a",
"token",
"."
] | train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L101-L104 |
Netflix/Nicobar | nicobar-cassandra/src/main/java/com/netflix/nicobar/cassandra/internal/AbstractCassandraHystrixCommand.java | AbstractCassandraHystrixCommand.getColumnFamilyViaColumnName | @SuppressWarnings({"unchecked", "rawtypes"})
protected ColumnFamily getColumnFamilyViaColumnName(String columnFamilyName, Class rowKeyClass) {
if (rowKeyClass == String.class) {
return new ColumnFamily(columnFamilyName, StringSerializer.get(), StringSerializer.get());
} else if (rowKeyClass == Integer.class) {
return new ColumnFamily(columnFamilyName, IntegerSerializer.get(), StringSerializer.get());
} else if (rowKeyClass == Long.class) {
return new ColumnFamily(columnFamilyName, LongSerializer.get(), StringSerializer.get());
} else {
throw new IllegalArgumentException("RowKeyType is not supported: " + rowKeyClass.getSimpleName() + ". String/Integer/Long are supported, or you can define the ColumnFamily yourself and use the other constructor.");
}
} | java | @SuppressWarnings({"unchecked", "rawtypes"})
protected ColumnFamily getColumnFamilyViaColumnName(String columnFamilyName, Class rowKeyClass) {
if (rowKeyClass == String.class) {
return new ColumnFamily(columnFamilyName, StringSerializer.get(), StringSerializer.get());
} else if (rowKeyClass == Integer.class) {
return new ColumnFamily(columnFamilyName, IntegerSerializer.get(), StringSerializer.get());
} else if (rowKeyClass == Long.class) {
return new ColumnFamily(columnFamilyName, LongSerializer.get(), StringSerializer.get());
} else {
throw new IllegalArgumentException("RowKeyType is not supported: " + rowKeyClass.getSimpleName() + ". String/Integer/Long are supported, or you can define the ColumnFamily yourself and use the other constructor.");
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"protected",
"ColumnFamily",
"getColumnFamilyViaColumnName",
"(",
"String",
"columnFamilyName",
",",
"Class",
"rowKeyClass",
")",
"{",
"if",
"(",
"rowKeyClass",
"==",
"String",
".",
... | returns a ColumnFamily given a columnFamilyName
@param columnFamilyName
@param rowKeyClass
@return a constructed ColumnFamily | [
"returns",
"a",
"ColumnFamily",
"given",
"a",
"columnFamilyName"
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-cassandra/src/main/java/com/netflix/nicobar/cassandra/internal/AbstractCassandraHystrixCommand.java#L52-L63 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.deleteFileFromComputeNode | public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName, Boolean recursive, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
FileDeleteFromComputeNodeOptions options = new FileDeleteFromComputeNodeOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().files().deleteFromComputeNode(poolId, nodeId, fileName, recursive, options);
} | java | public void deleteFileFromComputeNode(String poolId, String nodeId, String fileName, Boolean recursive, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
FileDeleteFromComputeNodeOptions options = new FileDeleteFromComputeNodeOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().files().deleteFromComputeNode(poolId, nodeId, fileName, recursive, options);
} | [
"public",
"void",
"deleteFileFromComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"fileName",
",",
"Boolean",
"recursive",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",... | Deletes the specified file from the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node.
@param fileName The name of the file to delete.
@param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Deletes",
"the",
"specified",
"file",
"from",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L246-L252 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/FeatureTokens.java | FeatureTokens.setEndings | public void setEndings(int i, int v) {
if (FeatureTokens_Type.featOkTst && ((FeatureTokens_Type)jcasType).casFeat_endings == null)
jcasType.jcas.throwFeatMissing("endings", "ch.epfl.bbp.uima.types.FeatureTokens");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_endings), i);
jcasType.ll_cas.ll_setIntArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_endings), i, v);} | java | public void setEndings(int i, int v) {
if (FeatureTokens_Type.featOkTst && ((FeatureTokens_Type)jcasType).casFeat_endings == null)
jcasType.jcas.throwFeatMissing("endings", "ch.epfl.bbp.uima.types.FeatureTokens");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_endings), i);
jcasType.ll_cas.ll_setIntArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FeatureTokens_Type)jcasType).casFeatCode_endings), i, v);} | [
"public",
"void",
"setEndings",
"(",
"int",
"i",
",",
"int",
"v",
")",
"{",
"if",
"(",
"FeatureTokens_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"FeatureTokens_Type",
")",
"jcasType",
")",
".",
"casFeat_endings",
"==",
"null",
")",
"jcasType",
".",
"jcas",
... | indexed setter for endings - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"endings",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/types/FeatureTokens.java#L206-L210 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.updateIterationAsync | public Observable<Iteration> updateIterationAsync(UUID projectId, UUID iterationId, Iteration updatedIteration) {
return updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration).map(new Func1<ServiceResponse<Iteration>, Iteration>() {
@Override
public Iteration call(ServiceResponse<Iteration> response) {
return response.body();
}
});
} | java | public Observable<Iteration> updateIterationAsync(UUID projectId, UUID iterationId, Iteration updatedIteration) {
return updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration).map(new Func1<ServiceResponse<Iteration>, Iteration>() {
@Override
public Iteration call(ServiceResponse<Iteration> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Iteration",
">",
"updateIterationAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"iterationId",
",",
"Iteration",
"updatedIteration",
")",
"{",
"return",
"updateIterationWithServiceResponseAsync",
"(",
"projectId",
",",
"iterationId",
",",
... | Update a specific iteration.
@param projectId Project id
@param iterationId Iteration id
@param updatedIteration The updated iteration model
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Iteration object | [
"Update",
"a",
"specific",
"iteration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1819-L1826 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.callStaticMethod | public static Object callStaticMethod(Class clazz, String methodName, Object[] args) throws PageException {
try {
return getMethodInstance(null, clazz, methodName, args).invoke(null);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | public static Object callStaticMethod(Class clazz, String methodName, Object[] args) throws PageException {
try {
return getMethodInstance(null, clazz, methodName, args).invoke(null);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | [
"public",
"static",
"Object",
"callStaticMethod",
"(",
"Class",
"clazz",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"PageException",
"{",
"try",
"{",
"return",
"getMethodInstance",
"(",
"null",
",",
"clazz",
",",
"methodName",... | calls a Static Method on the given CLass
@param clazz Class to call Method on it
@param methodName Name of the Method to get
@param args Arguments of the Method to get
@return return return value of the called Method
@throws PageException | [
"calls",
"a",
"Static",
"Method",
"on",
"the",
"given",
"CLass"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L923-L935 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.calculateHMAC_SHA256 | public void calculateHMAC_SHA256(byte[] message, int messageOffset, int messageLen, byte[] key, int keyLen, byte[] digest, int digestOffset) {
if (log.isTraceEnabled()) {
log.trace("calculateHMAC_SHA256 - messageOffset: {} messageLen: {}", messageOffset, messageLen);
log.trace("calculateHMAC_SHA256 - message: {}", Hex.encodeHexString(Arrays.copyOfRange(message, messageOffset, messageOffset + messageLen)));
log.trace("calculateHMAC_SHA256 - keyLen: {} key: {}", keyLen, Hex.encodeHexString(Arrays.copyOf(key, keyLen)));
//log.trace("calculateHMAC_SHA256 - digestOffset: {} digest: {}", digestOffset, Hex.encodeHexString(Arrays.copyOfRange(digest, digestOffset, digestOffset + DIGEST_LENGTH)));
}
byte[] calcDigest;
try {
Mac hmac = Mac.getInstance("Hmac-SHA256", BouncyCastleProvider.PROVIDER_NAME);
hmac.init(new SecretKeySpec(Arrays.copyOf(key, keyLen), "HmacSHA256"));
byte[] actualMessage = Arrays.copyOfRange(message, messageOffset, messageOffset + messageLen);
calcDigest = hmac.doFinal(actualMessage);
//if (log.isTraceEnabled()) {
// log.trace("Calculated digest: {}", Hex.encodeHexString(calcDigest));
//}
System.arraycopy(calcDigest, 0, digest, digestOffset, DIGEST_LENGTH);
} catch (InvalidKeyException e) {
log.error("Invalid key", e);
} catch (Exception e) {
log.error("Hash calculation failed", e);
}
} | java | public void calculateHMAC_SHA256(byte[] message, int messageOffset, int messageLen, byte[] key, int keyLen, byte[] digest, int digestOffset) {
if (log.isTraceEnabled()) {
log.trace("calculateHMAC_SHA256 - messageOffset: {} messageLen: {}", messageOffset, messageLen);
log.trace("calculateHMAC_SHA256 - message: {}", Hex.encodeHexString(Arrays.copyOfRange(message, messageOffset, messageOffset + messageLen)));
log.trace("calculateHMAC_SHA256 - keyLen: {} key: {}", keyLen, Hex.encodeHexString(Arrays.copyOf(key, keyLen)));
//log.trace("calculateHMAC_SHA256 - digestOffset: {} digest: {}", digestOffset, Hex.encodeHexString(Arrays.copyOfRange(digest, digestOffset, digestOffset + DIGEST_LENGTH)));
}
byte[] calcDigest;
try {
Mac hmac = Mac.getInstance("Hmac-SHA256", BouncyCastleProvider.PROVIDER_NAME);
hmac.init(new SecretKeySpec(Arrays.copyOf(key, keyLen), "HmacSHA256"));
byte[] actualMessage = Arrays.copyOfRange(message, messageOffset, messageOffset + messageLen);
calcDigest = hmac.doFinal(actualMessage);
//if (log.isTraceEnabled()) {
// log.trace("Calculated digest: {}", Hex.encodeHexString(calcDigest));
//}
System.arraycopy(calcDigest, 0, digest, digestOffset, DIGEST_LENGTH);
} catch (InvalidKeyException e) {
log.error("Invalid key", e);
} catch (Exception e) {
log.error("Hash calculation failed", e);
}
} | [
"public",
"void",
"calculateHMAC_SHA256",
"(",
"byte",
"[",
"]",
"message",
",",
"int",
"messageOffset",
",",
"int",
"messageLen",
",",
"byte",
"[",
"]",
"key",
",",
"int",
"keyLen",
",",
"byte",
"[",
"]",
"digest",
",",
"int",
"digestOffset",
")",
"{",
... | Calculates an HMAC SHA256 hash into the digest at the given offset.
@param message incoming bytes
@param messageOffset message offset
@param messageLen message length
@param key incoming key bytes
@param keyLen the length of the key
@param digest contains the calculated digest
@param digestOffset digest offset | [
"Calculates",
"an",
"HMAC",
"SHA256",
"hash",
"into",
"the",
"digest",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L369-L391 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java | SoundStore.playAsSound | int playAsSound(int buffer,float pitch,float gain,boolean loop) {
return playAsSoundAt(buffer, pitch, gain, loop, 0, 0, 0);
} | java | int playAsSound(int buffer,float pitch,float gain,boolean loop) {
return playAsSoundAt(buffer, pitch, gain, loop, 0, 0, 0);
} | [
"int",
"playAsSound",
"(",
"int",
"buffer",
",",
"float",
"pitch",
",",
"float",
"gain",
",",
"boolean",
"loop",
")",
"{",
"return",
"playAsSoundAt",
"(",
"buffer",
",",
"pitch",
",",
"gain",
",",
"loop",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"}"... | Play the specified buffer as a sound effect with the specified
pitch and gain.
@param buffer The ID of the buffer to play
@param pitch The pitch to play at
@param gain The gain to play at
@param loop True if the sound should loop
@return source The source that will be used | [
"Play",
"the",
"specified",
"buffer",
"as",
"a",
"sound",
"effect",
"with",
"the",
"specified",
"pitch",
"and",
"gain",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java#L377-L379 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.getDynamicGroups | public Map<String, LdapEntry> getDynamicGroups(String bases[], List<String> propNames, boolean getMbrshipAttr) throws WIMException {
Map<String, LdapEntry> dynaGrps = new HashMap<String, LdapEntry>();
String[] attrIds = iLdapConfigMgr.getAttributeNames(iLdapConfigMgr.getGroupTypes(), propNames, getMbrshipAttr, false);
String[] dynaMbrAttrNames = iLdapConfigMgr.getDynamicMemberAttributes();
String[] temp = attrIds;
attrIds = new String[temp.length + dynaMbrAttrNames.length];
System.arraycopy(temp, 0, attrIds, 0, temp.length);
System.arraycopy(dynaMbrAttrNames, 0, attrIds, temp.length, dynaMbrAttrNames.length);
String dynaGrpFitler = iLdapConfigMgr.getDynamicGroupFilter();
for (int i = 0, n = bases.length; i < n; i++) {
String base = bases[i];
for (NamingEnumeration<SearchResult> urls = search(base, dynaGrpFitler, SearchControls.SUBTREE_SCOPE, attrIds); urls.hasMoreElements();) {
javax.naming.directory.SearchResult thisEntry = urls.nextElement();
if (thisEntry == null) {
continue;
}
String entryName = thisEntry.getName();
if (entryName == null || entryName.trim().length() == 0) {
continue;
}
String dn = LdapHelper.prepareDN(entryName, base);
javax.naming.directory.Attributes attrs = thisEntry.getAttributes();
String extId = iLdapConfigMgr.getExtIdFromAttributes(dn, SchemaConstants.DO_GROUP, attrs);
String uniqueName = getUniqueName(dn, SchemaConstants.DO_GROUP, attrs);
LdapEntry ldapEntry = new LdapEntry(dn, extId, uniqueName, SchemaConstants.DO_GROUP, attrs);
dynaGrps.put(ldapEntry.getDN(), ldapEntry);
}
}
return dynaGrps;
} | java | public Map<String, LdapEntry> getDynamicGroups(String bases[], List<String> propNames, boolean getMbrshipAttr) throws WIMException {
Map<String, LdapEntry> dynaGrps = new HashMap<String, LdapEntry>();
String[] attrIds = iLdapConfigMgr.getAttributeNames(iLdapConfigMgr.getGroupTypes(), propNames, getMbrshipAttr, false);
String[] dynaMbrAttrNames = iLdapConfigMgr.getDynamicMemberAttributes();
String[] temp = attrIds;
attrIds = new String[temp.length + dynaMbrAttrNames.length];
System.arraycopy(temp, 0, attrIds, 0, temp.length);
System.arraycopy(dynaMbrAttrNames, 0, attrIds, temp.length, dynaMbrAttrNames.length);
String dynaGrpFitler = iLdapConfigMgr.getDynamicGroupFilter();
for (int i = 0, n = bases.length; i < n; i++) {
String base = bases[i];
for (NamingEnumeration<SearchResult> urls = search(base, dynaGrpFitler, SearchControls.SUBTREE_SCOPE, attrIds); urls.hasMoreElements();) {
javax.naming.directory.SearchResult thisEntry = urls.nextElement();
if (thisEntry == null) {
continue;
}
String entryName = thisEntry.getName();
if (entryName == null || entryName.trim().length() == 0) {
continue;
}
String dn = LdapHelper.prepareDN(entryName, base);
javax.naming.directory.Attributes attrs = thisEntry.getAttributes();
String extId = iLdapConfigMgr.getExtIdFromAttributes(dn, SchemaConstants.DO_GROUP, attrs);
String uniqueName = getUniqueName(dn, SchemaConstants.DO_GROUP, attrs);
LdapEntry ldapEntry = new LdapEntry(dn, extId, uniqueName, SchemaConstants.DO_GROUP, attrs);
dynaGrps.put(ldapEntry.getDN(), ldapEntry);
}
}
return dynaGrps;
} | [
"public",
"Map",
"<",
"String",
",",
"LdapEntry",
">",
"getDynamicGroups",
"(",
"String",
"bases",
"[",
"]",
",",
"List",
"<",
"String",
">",
"propNames",
",",
"boolean",
"getMbrshipAttr",
")",
"throws",
"WIMException",
"{",
"Map",
"<",
"String",
",",
"Lda... | Get dynamic groups.
@param bases Search bases.
@param propNames Properties to return.
@param getMbrshipAttr Whether to request the membership attribute.
@return Map of group distinguished names to {@link LdapEntry}.
@throws WIMException If there was an error resolving the dynamic groups from the LDAP server. | [
"Get",
"dynamic",
"groups",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1647-L1676 |
virgo47/javasimon | examples/src/main/java/org/javasimon/examples/MultithreadedContention.java | MultithreadedContention.main | public static void main(String[] args) throws InterruptedException {
final ExecutorService executorService = Executors.newFixedThreadPool(1000);
BenchmarkUtils.run(1, 2,
// low contention - single thread
new BenchmarkUtils.Task("1") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute();
}
},
// medium contention
new BenchmarkUtils.Task("CPU") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, AVAILABLE_PROCESSORS, executorService).execute();
}
},
// High contention
new BenchmarkUtils.Task("400") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 400, executorService).execute();
}
}
);
executorService.shutdown();
// we're not using Benchmark results here this time, so we have to extract them on our own
StopwatchSample sampleLo = SimonManager.getStopwatch("MT-1").sample();
StopwatchSample sampleCpu = SimonManager.getStopwatch("MT-" + AVAILABLE_PROCESSORS).sample();
StopwatchSample sampleHi = SimonManager.getStopwatch("MT-400").sample();
System.out.println("\nsampleLo = " + sampleLo);
System.out.println("sampleCpu = " + sampleCpu);
System.out.println("sampleHi = " + sampleHi);
System.out.println("\nGoogle Chart avg:\n" +
GoogleChartImageGenerator.barChart("MultithreadedContention", SimonUnit.NANOSECOND,
sampleLo,
sampleCpu,
sampleHi));
System.out.println("\nGoogle Chart avg/min/max:\n" +
GoogleChartImageGenerator.barChart("MultithreadedContention", SimonUnit.NANOSECOND, true,
sampleLo,
sampleCpu,
sampleHi));
} | java | public static void main(String[] args) throws InterruptedException {
final ExecutorService executorService = Executors.newFixedThreadPool(1000);
BenchmarkUtils.run(1, 2,
// low contention - single thread
new BenchmarkUtils.Task("1") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute();
}
},
// medium contention
new BenchmarkUtils.Task("CPU") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, AVAILABLE_PROCESSORS, executorService).execute();
}
},
// High contention
new BenchmarkUtils.Task("400") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 400, executorService).execute();
}
}
);
executorService.shutdown();
// we're not using Benchmark results here this time, so we have to extract them on our own
StopwatchSample sampleLo = SimonManager.getStopwatch("MT-1").sample();
StopwatchSample sampleCpu = SimonManager.getStopwatch("MT-" + AVAILABLE_PROCESSORS).sample();
StopwatchSample sampleHi = SimonManager.getStopwatch("MT-400").sample();
System.out.println("\nsampleLo = " + sampleLo);
System.out.println("sampleCpu = " + sampleCpu);
System.out.println("sampleHi = " + sampleHi);
System.out.println("\nGoogle Chart avg:\n" +
GoogleChartImageGenerator.barChart("MultithreadedContention", SimonUnit.NANOSECOND,
sampleLo,
sampleCpu,
sampleHi));
System.out.println("\nGoogle Chart avg/min/max:\n" +
GoogleChartImageGenerator.barChart("MultithreadedContention", SimonUnit.NANOSECOND, true,
sampleLo,
sampleCpu,
sampleHi));
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"InterruptedException",
"{",
"final",
"ExecutorService",
"executorService",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"1000",
")",
";",
"BenchmarkUtils",
".",
"run",
"(",... | Entry point of the demo application.
@param args command line arguments
@throws InterruptedException when sleep is interrupted | [
"Entry",
"point",
"of",
"the",
"demo",
"application",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/MultithreadedContention.java#L34-L80 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java | SelectOneMenuRenderer.addLabel | protected void addLabel(ResponseWriter rw, String clientId, SelectOneMenu menu, String outerClientId)
throws IOException {
String label = menu.getLabel();
{
if (!menu.isRenderLabel()) {
label = null;
}
}
if (label != null) {
rw.startElement("label", menu);
rw.writeAttribute("for", clientId, "for");
generateErrorAndRequiredClass(menu, rw, outerClientId, menu.getLabelStyleClass(),
Responsive.getResponsiveLabelClass(menu), "control-label");
writeAttribute(rw, "style", menu.getLabelStyle());
rw.writeText(label, null);
rw.endElement("label");
}
} | java | protected void addLabel(ResponseWriter rw, String clientId, SelectOneMenu menu, String outerClientId)
throws IOException {
String label = menu.getLabel();
{
if (!menu.isRenderLabel()) {
label = null;
}
}
if (label != null) {
rw.startElement("label", menu);
rw.writeAttribute("for", clientId, "for");
generateErrorAndRequiredClass(menu, rw, outerClientId, menu.getLabelStyleClass(),
Responsive.getResponsiveLabelClass(menu), "control-label");
writeAttribute(rw, "style", menu.getLabelStyle());
rw.writeText(label, null);
rw.endElement("label");
}
} | [
"protected",
"void",
"addLabel",
"(",
"ResponseWriter",
"rw",
",",
"String",
"clientId",
",",
"SelectOneMenu",
"menu",
",",
"String",
"outerClientId",
")",
"throws",
"IOException",
"{",
"String",
"label",
"=",
"menu",
".",
"getLabel",
"(",
")",
";",
"{",
"if... | Renders the optional label. This method is protected in order to allow
third-party frameworks to derive from it.
@param rw
the response writer
@param clientId
the id used by the label to refernce the input field
@throws IOException
may be thrown by the response writer | [
"Renders",
"the",
"optional",
"label",
".",
"This",
"method",
"is",
"protected",
"in",
"order",
"to",
"allow",
"third",
"-",
"party",
"frameworks",
"to",
"derive",
"from",
"it",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java#L199-L216 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/common/NumberGenerator.java | NumberGenerator.getNextValAsLong | public Long getNextValAsLong()
throws EFapsException
{
long ret = 0;
try {
ret = Context.getDbType().nextSequence(Context.getThreadContext().getConnectionResource(),
getDBName());
} catch (final SQLException e) {
throw new EFapsException(NumberGenerator.class, " getNextValAsLong()", e);
}
return ret;
} | java | public Long getNextValAsLong()
throws EFapsException
{
long ret = 0;
try {
ret = Context.getDbType().nextSequence(Context.getThreadContext().getConnectionResource(),
getDBName());
} catch (final SQLException e) {
throw new EFapsException(NumberGenerator.class, " getNextValAsLong()", e);
}
return ret;
} | [
"public",
"Long",
"getNextValAsLong",
"(",
")",
"throws",
"EFapsException",
"{",
"long",
"ret",
"=",
"0",
";",
"try",
"{",
"ret",
"=",
"Context",
".",
"getDbType",
"(",
")",
".",
"nextSequence",
"(",
"Context",
".",
"getThreadContext",
"(",
")",
".",
"ge... | Method to get the next long value for this sequence. To get the formated
value use {@link #getNextVal()}
@return next value for this sequence
@throws EFapsException on error | [
"Method",
"to",
"get",
"the",
"next",
"long",
"value",
"for",
"this",
"sequence",
".",
"To",
"get",
"the",
"formated",
"value",
"use",
"{",
"@link",
"#getNextVal",
"()",
"}"
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/NumberGenerator.java#L223-L234 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java | ValidatingStreamReader.createValidatingStreamReader | public static ValidatingStreamReader createValidatingStreamReader
(BranchingReaderSource input, ReaderCreator owner,
ReaderConfig cfg, InputBootstrapper bs, boolean forER)
throws XMLStreamException
{
ValidatingStreamReader sr = new ValidatingStreamReader
(bs, input, owner, cfg, createElementStack(cfg), forER);
return sr;
} | java | public static ValidatingStreamReader createValidatingStreamReader
(BranchingReaderSource input, ReaderCreator owner,
ReaderConfig cfg, InputBootstrapper bs, boolean forER)
throws XMLStreamException
{
ValidatingStreamReader sr = new ValidatingStreamReader
(bs, input, owner, cfg, createElementStack(cfg), forER);
return sr;
} | [
"public",
"static",
"ValidatingStreamReader",
"createValidatingStreamReader",
"(",
"BranchingReaderSource",
"input",
",",
"ReaderCreator",
"owner",
",",
"ReaderConfig",
"cfg",
",",
"InputBootstrapper",
"bs",
",",
"boolean",
"forER",
")",
"throws",
"XMLStreamException",
"{... | Factory method for constructing readers.
@param owner "Owner" of this reader, factory that created the reader;
needed for returning updated symbol table information after parsing.
@param input Input source used to read the XML document.
@param cfg Object that contains reader configuration info.
@param bs Bootstrapper to use, for reading xml declaration etc.
@param forER True if this reader is to be (configured to be) used by
an event reader. Will cause some changes to default settings, as
required by contracts Woodstox XMLEventReader implementation has
(with respect to lazy parsing, short text segments etc) | [
"Factory",
"method",
"for",
"constructing",
"readers",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java#L124-L132 |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/JDBCUtil.java | JDBCUtil.changeColumn | public static void changeColumn (Connection conn, String table, String cname, String cdef)
throws SQLException
{
String update = "ALTER TABLE " + table + " CHANGE " + cname + " " + cdef;
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(update);
stmt.executeUpdate();
} finally {
close(stmt);
}
log.info("Database column '" + cname + "' of table '" + table +
"' modified to have this def '" + cdef + "'.");
} | java | public static void changeColumn (Connection conn, String table, String cname, String cdef)
throws SQLException
{
String update = "ALTER TABLE " + table + " CHANGE " + cname + " " + cdef;
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(update);
stmt.executeUpdate();
} finally {
close(stmt);
}
log.info("Database column '" + cname + "' of table '" + table +
"' modified to have this def '" + cdef + "'.");
} | [
"public",
"static",
"void",
"changeColumn",
"(",
"Connection",
"conn",
",",
"String",
"table",
",",
"String",
"cname",
",",
"String",
"cdef",
")",
"throws",
"SQLException",
"{",
"String",
"update",
"=",
"\"ALTER TABLE \"",
"+",
"table",
"+",
"\" CHANGE \"",
"+... | Changes a column's definition. Takes a full column definition 'cdef' (including the name of
the column) with which to replace the specified column 'cname'.
NOTE: A handy thing you can do with this is to rename a column by providing a column
definition that has a different name, but the same column type. | [
"Changes",
"a",
"column",
"s",
"definition",
".",
"Takes",
"a",
"full",
"column",
"definition",
"cdef",
"(",
"including",
"the",
"name",
"of",
"the",
"column",
")",
"with",
"which",
"to",
"replace",
"the",
"specified",
"column",
"cname",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JDBCUtil.java#L515-L528 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.replaceFromVariableStatementInternal | private String replaceFromVariableStatementInternal(JQLContext context, String jql, final List<Triple<Token, Token, String>> replace, JqlBaseListener rewriterListener) {
Pair<ParserRuleContext, CommonTokenStream> parser = prepareVariableStatement(context, jql);
walker.walk(rewriterListener, parser.value0);
TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1);
for (Triple<Token, Token, String> item : replace) {
rewriter.replace(item.value0, item.value1, item.value2);
}
return rewriter.getText();
} | java | private String replaceFromVariableStatementInternal(JQLContext context, String jql, final List<Triple<Token, Token, String>> replace, JqlBaseListener rewriterListener) {
Pair<ParserRuleContext, CommonTokenStream> parser = prepareVariableStatement(context, jql);
walker.walk(rewriterListener, parser.value0);
TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1);
for (Triple<Token, Token, String> item : replace) {
rewriter.replace(item.value0, item.value1, item.value2);
}
return rewriter.getText();
} | [
"private",
"String",
"replaceFromVariableStatementInternal",
"(",
"JQLContext",
"context",
",",
"String",
"jql",
",",
"final",
"List",
"<",
"Triple",
"<",
"Token",
",",
"Token",
",",
"String",
">",
">",
"replace",
",",
"JqlBaseListener",
"rewriterListener",
")",
... | Replace from variable statement internal.
@param context
the context
@param jql
the jql
@param replace
the replace
@param rewriterListener
the rewriter listener
@return the string | [
"Replace",
"from",
"variable",
"statement",
"internal",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L723-L734 |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BytesUtils.java | BytesUtils.matchBitByBitIndex | public static boolean matchBitByBitIndex(final int pVal, final int pBitIndex) {
if (pBitIndex < 0 || pBitIndex > MAX_BIT_INTEGER) {
throw new IllegalArgumentException(
"parameter 'pBitIndex' must be between 0 and 31. pBitIndex=" + pBitIndex);
}
return (pVal & 1 << pBitIndex) != 0;
} | java | public static boolean matchBitByBitIndex(final int pVal, final int pBitIndex) {
if (pBitIndex < 0 || pBitIndex > MAX_BIT_INTEGER) {
throw new IllegalArgumentException(
"parameter 'pBitIndex' must be between 0 and 31. pBitIndex=" + pBitIndex);
}
return (pVal & 1 << pBitIndex) != 0;
} | [
"public",
"static",
"boolean",
"matchBitByBitIndex",
"(",
"final",
"int",
"pVal",
",",
"final",
"int",
"pBitIndex",
")",
"{",
"if",
"(",
"pBitIndex",
"<",
"0",
"||",
"pBitIndex",
">",
"MAX_BIT_INTEGER",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Test if bit at given index of given value is = 1.
@param pVal
value to test
@param pBitIndex
bit index between 0 and 31
@return true bit at given index of give value is = 1 | [
"Test",
"if",
"bit",
"at",
"given",
"index",
"of",
"given",
"value",
"is",
"=",
"1",
"."
] | train | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BytesUtils.java#L246-L252 |
lessthanoptimal/BoofCV | integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java | GradientActivity.configureCamera | @Override
protected void configureCamera(CameraDevice device, CameraCharacteristics characteristics, CaptureRequest.Builder captureRequestBuilder) {
captureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO);
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
} | java | @Override
protected void configureCamera(CameraDevice device, CameraCharacteristics characteristics, CaptureRequest.Builder captureRequestBuilder) {
captureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO);
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
} | [
"@",
"Override",
"protected",
"void",
"configureCamera",
"(",
"CameraDevice",
"device",
",",
"CameraCharacteristics",
"characteristics",
",",
"CaptureRequest",
".",
"Builder",
"captureRequestBuilder",
")",
"{",
"captureRequestBuilder",
".",
"set",
"(",
"CaptureRequest",
... | This is where you specify custom camera settings. See {@link boofcv.android.camera2.SimpleCamera2Activity}'s
JavaDoc for more funcitons which you can override.
@param captureRequestBuilder Used to configure the camera. | [
"This",
"is",
"where",
"you",
"specify",
"custom",
"camera",
"settings",
".",
"See",
"{",
"@link",
"boofcv",
".",
"android",
".",
"camera2",
".",
"SimpleCamera2Activity",
"}",
"s",
"JavaDoc",
"for",
"more",
"funcitons",
"which",
"you",
"can",
"override",
"."... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java#L110-L114 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/streamlet/impl/StreamletImpl.java | StreamletImpl.applyOperator | @Override
public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {
checkNotNull(operator, "operator cannot be null");
// By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded
// from parent component to a ramdon one of all the instances of the child component,
// which is the same logic as shuffle grouping.
return applyOperator(operator, new NoneStreamGrouping());
} | java | @Override
public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {
checkNotNull(operator, "operator cannot be null");
// By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded
// from parent component to a ramdon one of all the instances of the child component,
// which is the same logic as shuffle grouping.
return applyOperator(operator, new NoneStreamGrouping());
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"Streamlet",
"<",
"T",
">",
"applyOperator",
"(",
"IStreamletOperator",
"<",
"R",
",",
"T",
">",
"operator",
")",
"{",
"checkNotNull",
"(",
"operator",
",",
"\"operator cannot be null\"",
")",
";",
"// By default, None... | Returns a new Streamlet by applying the operator on each element of this streamlet.
@param operator The operator to be applied
@param <T> The return type of the transform
@return Streamlet containing the output of the operation | [
"Returns",
"a",
"new",
"Streamlet",
"by",
"applying",
"the",
"operator",
"on",
"each",
"element",
"of",
"this",
"streamlet",
"."
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/streamlet/impl/StreamletImpl.java#L628-L636 |
MenoData/Time4J | base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java | GregorianTimezoneRule.ofLastWeekday | public static GregorianTimezoneRule ofLastWeekday(
Month month,
Weekday dayOfWeek,
int timeOfDay,
OffsetIndicator indicator,
int savings
) {
return new LastWeekdayPattern(month, dayOfWeek, timeOfDay, indicator, savings);
} | java | public static GregorianTimezoneRule ofLastWeekday(
Month month,
Weekday dayOfWeek,
int timeOfDay,
OffsetIndicator indicator,
int savings
) {
return new LastWeekdayPattern(month, dayOfWeek, timeOfDay, indicator, savings);
} | [
"public",
"static",
"GregorianTimezoneRule",
"ofLastWeekday",
"(",
"Month",
"month",
",",
"Weekday",
"dayOfWeek",
",",
"int",
"timeOfDay",
",",
"OffsetIndicator",
"indicator",
",",
"int",
"savings",
")",
"{",
"return",
"new",
"LastWeekdayPattern",
"(",
"month",
",... | /*[deutsch]
<p>Konstruiert ein Muster für den letzten Wochentag im angegebenen
Monat. </p>
@param month calendar month
@param dayOfWeek last day of week
@param timeOfDay clock time in seconds after midnight when time switch happens
@param indicator offset indicator
@param savings fixed DST-offset in seconds
@return new daylight saving rule
@throws IllegalArgumentException if the last argument is out of range
@since 5.0 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Konstruiert",
"ein",
"Muster",
"fü",
";",
"r",
"den",
"letzten",
"Wochentag",
"im",
"angegebenen",
"Monat",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java#L240-L250 |
sdl/Testy | src/main/java/com/sdl/selenium/web/WebLocatorAbstractBuilder.java | WebLocatorAbstractBuilder.setLabel | @SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setLabel(String label, final SearchType... searchTypes) {
pathBuilder.setLabel(label, searchTypes);
return (T) this;
} | java | @SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setLabel(String label, final SearchType... searchTypes) {
pathBuilder.setLabel(label, searchTypes);
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"WebLocatorAbstractBuilder",
">",
"T",
"setLabel",
"(",
"String",
"label",
",",
"final",
"SearchType",
"...",
"searchTypes",
")",
"{",
"pathBuilder",
".",
"setLabel",
"(",
"label"... | <p><b>Used for finding element process (to generate xpath address)</b></p>
@param label text label element
@param searchTypes type search text element: see more details see {@link SearchType}
@param <T> the element which calls this method
@return this element | [
"<p",
">",
"<b",
">",
"Used",
"for",
"finding",
"element",
"process",
"(",
"to",
"generate",
"xpath",
"address",
")",
"<",
"/",
"b",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/WebLocatorAbstractBuilder.java#L403-L407 |
samskivert/samskivert | src/main/java/com/samskivert/util/Lifecycle.java | Lifecycle.addInitConstraint | public void addInitConstraint (InitComponent lhs, Constraint constraint, InitComponent rhs)
{
if (lhs == null || rhs == null) {
throw new IllegalArgumentException("Cannot add constraint about null component.");
}
InitComponent before = (constraint == Constraint.RUNS_BEFORE) ? lhs : rhs;
InitComponent after = (constraint == Constraint.RUNS_BEFORE) ? rhs : lhs;
_initers.addDependency(after, before);
} | java | public void addInitConstraint (InitComponent lhs, Constraint constraint, InitComponent rhs)
{
if (lhs == null || rhs == null) {
throw new IllegalArgumentException("Cannot add constraint about null component.");
}
InitComponent before = (constraint == Constraint.RUNS_BEFORE) ? lhs : rhs;
InitComponent after = (constraint == Constraint.RUNS_BEFORE) ? rhs : lhs;
_initers.addDependency(after, before);
} | [
"public",
"void",
"addInitConstraint",
"(",
"InitComponent",
"lhs",
",",
"Constraint",
"constraint",
",",
"InitComponent",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
"||",
"rhs",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Adds a constraint that a certain component must be initialized before another. | [
"Adds",
"a",
"constraint",
"that",
"a",
"certain",
"component",
"must",
"be",
"initialized",
"before",
"another",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Lifecycle.java#L78-L86 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/DescribeSimulationJobResult.java | DescribeSimulationJobResult.withTags | public DescribeSimulationJobResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public DescribeSimulationJobResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"DescribeSimulationJobResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The list of all tags added to the specified simulation job.
</p>
@param tags
The list of all tags added to the specified simulation job.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"list",
"of",
"all",
"tags",
"added",
"to",
"the",
"specified",
"simulation",
"job",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/DescribeSimulationJobResult.java#L1619-L1622 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/SpiUtil.java | SpiUtil.formatTemplate | public static String formatTemplate(String template,FaxJob faxJob,TemplateParameterEncoder encoder,boolean getFileContent,boolean fullFilePath)
{
//get logger
LoggerManager loggerManager=LoggerManager.getInstance();
Logger logger=loggerManager.getLogger();
//log
logger.logDebug(new Object[]{"Formatting template:",Logger.SYSTEM_EOL,template},null);
String text=template;
if(text!=null)
{
String value=null;
if(text.indexOf(SpiUtil.FILE_TEMPLATE_PARAMETER_STRING)!=-1)
{
if(getFileContent)
{
value=SpiUtil.getFileParameterValue(faxJob);
}
else if(fullFilePath)
{
value=faxJob.getFilePath();
}
else
{
File file=faxJob.getFile();
value=file.getName();
}
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.FILE_TEMPLATE_PARAMETER_STRING,value,encoder);
}
value=faxJob.getTargetAddress();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.TARGET_ADDRESS_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getTargetName();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.TARGET_NAME_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getSenderName();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.SENDER_NAME_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getSenderFaxNumber();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.SENDER_FAX_NUMBER_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getSenderEmail();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.SENDER_EMAIL_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getID();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.FAX_JOB_ID_TEMPLATE_PARAMETER_STRING,value,encoder);
}
//log
logger.logDebug(new Object[]{"Formated template:",Logger.SYSTEM_EOL,text},null);
return text;
} | java | public static String formatTemplate(String template,FaxJob faxJob,TemplateParameterEncoder encoder,boolean getFileContent,boolean fullFilePath)
{
//get logger
LoggerManager loggerManager=LoggerManager.getInstance();
Logger logger=loggerManager.getLogger();
//log
logger.logDebug(new Object[]{"Formatting template:",Logger.SYSTEM_EOL,template},null);
String text=template;
if(text!=null)
{
String value=null;
if(text.indexOf(SpiUtil.FILE_TEMPLATE_PARAMETER_STRING)!=-1)
{
if(getFileContent)
{
value=SpiUtil.getFileParameterValue(faxJob);
}
else if(fullFilePath)
{
value=faxJob.getFilePath();
}
else
{
File file=faxJob.getFile();
value=file.getName();
}
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.FILE_TEMPLATE_PARAMETER_STRING,value,encoder);
}
value=faxJob.getTargetAddress();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.TARGET_ADDRESS_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getTargetName();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.TARGET_NAME_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getSenderName();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.SENDER_NAME_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getSenderFaxNumber();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.SENDER_FAX_NUMBER_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getSenderEmail();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.SENDER_EMAIL_TEMPLATE_PARAMETER_STRING,value,encoder);
value=faxJob.getID();
text=SpiUtil.replaceTemplateParameter(text,SpiUtil.FAX_JOB_ID_TEMPLATE_PARAMETER_STRING,value,encoder);
}
//log
logger.logDebug(new Object[]{"Formated template:",Logger.SYSTEM_EOL,text},null);
return text;
} | [
"public",
"static",
"String",
"formatTemplate",
"(",
"String",
"template",
",",
"FaxJob",
"faxJob",
",",
"TemplateParameterEncoder",
"encoder",
",",
"boolean",
"getFileContent",
",",
"boolean",
"fullFilePath",
")",
"{",
"//get logger",
"LoggerManager",
"loggerManager",
... | This function formats the provided template.
@param template
The template
@param faxJob
The fax job object
@param encoder
The encoder that encodes the template values (may be null)
@param getFileContent
True to get the file content, false to get the file path for the file template parameter
@param fullFilePath
If getFileContent=false, the param will be replaced to the file name (full path in case this is true, or just the name in case of false)
@return The formatted template | [
"This",
"function",
"formats",
"the",
"provided",
"template",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/SpiUtil.java#L120-L168 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Punycode.java | Punycode.digitToBasic | private static char digitToBasic(int digit, boolean uppercase) {
/* 0..25 map to ASCII a..z or A..Z */
/* 26..35 map to ASCII 0..9 */
if(digit<26) {
if(uppercase) {
return (char)(CAPITAL_A+digit);
} else {
return (char)(SMALL_A+digit);
}
} else {
return (char)((ZERO-26)+digit);
}
} | java | private static char digitToBasic(int digit, boolean uppercase) {
/* 0..25 map to ASCII a..z or A..Z */
/* 26..35 map to ASCII 0..9 */
if(digit<26) {
if(uppercase) {
return (char)(CAPITAL_A+digit);
} else {
return (char)(SMALL_A+digit);
}
} else {
return (char)((ZERO-26)+digit);
}
} | [
"private",
"static",
"char",
"digitToBasic",
"(",
"int",
"digit",
",",
"boolean",
"uppercase",
")",
"{",
"/* 0..25 map to ASCII a..z or A..Z */",
"/* 26..35 map to ASCII 0..9 */",
"if",
"(",
"digit",
"<",
"26",
")",
"{",
"if",
"(",
"uppercase",
")",
"{",
... | digitToBasic() returns the basic code point whose value
(when used for representing integers) is d, which must be in the
range 0 to BASE-1. The lowercase form is used unless the uppercase flag is
nonzero, in which case the uppercase form is used. | [
"digitToBasic",
"()",
"returns",
"the",
"basic",
"code",
"point",
"whose",
"value",
"(",
"when",
"used",
"for",
"representing",
"integers",
")",
"is",
"d",
"which",
"must",
"be",
"in",
"the",
"range",
"0",
"to",
"BASE",
"-",
"1",
".",
"The",
"lowercase",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Punycode.java#L112-L124 |
mozilla/rhino | src/org/mozilla/javascript/NativeGlobal.java | NativeGlobal.oneUcs4ToUtf8Char | private static int oneUcs4ToUtf8Char(byte[] utf8Buffer, int ucs4Char) {
int utf8Length = 1;
//JS_ASSERT(ucs4Char <= 0x7FFFFFFF);
if ((ucs4Char & ~0x7F) == 0)
utf8Buffer[0] = (byte)ucs4Char;
else {
int i;
int a = ucs4Char >>> 11;
utf8Length = 2;
while (a != 0) {
a >>>= 5;
utf8Length++;
}
i = utf8Length;
while (--i > 0) {
utf8Buffer[i] = (byte)((ucs4Char & 0x3F) | 0x80);
ucs4Char >>>= 6;
}
utf8Buffer[0] = (byte)(0x100 - (1 << (8-utf8Length)) + ucs4Char);
}
return utf8Length;
} | java | private static int oneUcs4ToUtf8Char(byte[] utf8Buffer, int ucs4Char) {
int utf8Length = 1;
//JS_ASSERT(ucs4Char <= 0x7FFFFFFF);
if ((ucs4Char & ~0x7F) == 0)
utf8Buffer[0] = (byte)ucs4Char;
else {
int i;
int a = ucs4Char >>> 11;
utf8Length = 2;
while (a != 0) {
a >>>= 5;
utf8Length++;
}
i = utf8Length;
while (--i > 0) {
utf8Buffer[i] = (byte)((ucs4Char & 0x3F) | 0x80);
ucs4Char >>>= 6;
}
utf8Buffer[0] = (byte)(0x100 - (1 << (8-utf8Length)) + ucs4Char);
}
return utf8Length;
} | [
"private",
"static",
"int",
"oneUcs4ToUtf8Char",
"(",
"byte",
"[",
"]",
"utf8Buffer",
",",
"int",
"ucs4Char",
")",
"{",
"int",
"utf8Length",
"=",
"1",
";",
"//JS_ASSERT(ucs4Char <= 0x7FFFFFFF);",
"if",
"(",
"(",
"ucs4Char",
"&",
"~",
"0x7F",
")",
"==",
"0",
... | /* Convert one UCS-4 char and write it into a UTF-8 buffer, which must be
at least 6 bytes long. Return the number of UTF-8 bytes of data written. | [
"/",
"*",
"Convert",
"one",
"UCS",
"-",
"4",
"char",
"and",
"write",
"it",
"into",
"a",
"UTF",
"-",
"8",
"buffer",
"which",
"must",
"be",
"at",
"least",
"6",
"bytes",
"long",
".",
"Return",
"the",
"number",
"of",
"UTF",
"-",
"8",
"bytes",
"of",
"... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeGlobal.java#L731-L753 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java | HiveDataset.getFileSetIterator | @Override
public Iterator<FileSet<CopyEntity>> getFileSetIterator(FileSystem targetFs, CopyConfiguration configuration,
Comparator<FileSet<CopyEntity>> prioritizer, PushDownRequestor<FileSet<CopyEntity>> requestor)
throws IOException {
if (!canCopyTable()) {
return Iterators.emptyIterator();
}
try {
List<FileSet<CopyEntity>> fileSetList = Lists.newArrayList(new HiveCopyEntityHelper(this, configuration, targetFs)
.getCopyEntities(configuration, prioritizer, requestor));
Collections.sort(fileSetList, prioritizer);
return fileSetList.iterator();
} catch (IOException ioe) {
log.error("Failed to copy table " + this.table, ioe);
return Iterators.emptyIterator();
}
} | java | @Override
public Iterator<FileSet<CopyEntity>> getFileSetIterator(FileSystem targetFs, CopyConfiguration configuration,
Comparator<FileSet<CopyEntity>> prioritizer, PushDownRequestor<FileSet<CopyEntity>> requestor)
throws IOException {
if (!canCopyTable()) {
return Iterators.emptyIterator();
}
try {
List<FileSet<CopyEntity>> fileSetList = Lists.newArrayList(new HiveCopyEntityHelper(this, configuration, targetFs)
.getCopyEntities(configuration, prioritizer, requestor));
Collections.sort(fileSetList, prioritizer);
return fileSetList.iterator();
} catch (IOException ioe) {
log.error("Failed to copy table " + this.table, ioe);
return Iterators.emptyIterator();
}
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"FileSet",
"<",
"CopyEntity",
">",
">",
"getFileSetIterator",
"(",
"FileSystem",
"targetFs",
",",
"CopyConfiguration",
"configuration",
",",
"Comparator",
"<",
"FileSet",
"<",
"CopyEntity",
">",
">",
"prioritizer",
",",
... | Finds all files read by the table and generates CopyableFiles.
For the specific semantics see {@link HiveCopyEntityHelper#getCopyEntities}. | [
"Finds",
"all",
"files",
"read",
"by",
"the",
"table",
"and",
"generates",
"CopyableFiles",
".",
"For",
"the",
"specific",
"semantics",
"see",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java#L158-L174 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/AbstractKMeans.java | AbstractKMeans.incrementalUpdateMean | protected static void incrementalUpdateMean(double[] mean, NumberVector vec, int newsize, double op) {
if(newsize == 0) {
return; // Keep old mean
}
// Note: numerically stabilized version:
VMath.plusTimesEquals(mean, VMath.minusEquals(vec.toArray(), mean), op / newsize);
} | java | protected static void incrementalUpdateMean(double[] mean, NumberVector vec, int newsize, double op) {
if(newsize == 0) {
return; // Keep old mean
}
// Note: numerically stabilized version:
VMath.plusTimesEquals(mean, VMath.minusEquals(vec.toArray(), mean), op / newsize);
} | [
"protected",
"static",
"void",
"incrementalUpdateMean",
"(",
"double",
"[",
"]",
"mean",
",",
"NumberVector",
"vec",
",",
"int",
"newsize",
",",
"double",
"op",
")",
"{",
"if",
"(",
"newsize",
"==",
"0",
")",
"{",
"return",
";",
"// Keep old mean",
"}",
... | Compute an incremental update for the mean.
@param mean Mean to update
@param vec Object vector
@param newsize (New) size of cluster
@param op Cluster size change / Weight change | [
"Compute",
"an",
"incremental",
"update",
"for",
"the",
"mean",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/AbstractKMeans.java#L278-L284 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java | Value.boolArray | public static Value boolArray(@Nullable boolean[] v, int pos, int length) {
return boolArrayFactory.create(v, pos, length);
} | java | public static Value boolArray(@Nullable boolean[] v, int pos, int length) {
return boolArrayFactory.create(v, pos, length);
} | [
"public",
"static",
"Value",
"boolArray",
"(",
"@",
"Nullable",
"boolean",
"[",
"]",
"v",
",",
"int",
"pos",
",",
"int",
"length",
")",
"{",
"return",
"boolArrayFactory",
".",
"create",
"(",
"v",
",",
"pos",
",",
"length",
")",
";",
"}"
] | Returns an {@code ARRAY<BOOL>} value that takes its elements from a region of an array.
@param v the source of element values, which may be null to produce a value for which {@code
isNull()} is {@code true}
@param pos the start position of {@code v} to copy values from. Ignored if {@code v} is {@code
null}.
@param length the number of values to copy from {@code v}. Ignored if {@code v} is {@code
null}. | [
"Returns",
"an",
"{",
"@code",
"ARRAY<BOOL",
">",
"}",
"value",
"that",
"takes",
"its",
"elements",
"from",
"a",
"region",
"of",
"an",
"array",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java#L203-L205 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java | AnnotationUtils.getAnnotation | public static <A extends Annotation> A getAnnotation(Object objectOrClass, Class<A> annotationClass) {
Class<?> initialClass = objectOrClass instanceof Class<?> ? (Class<?>) objectOrClass : objectOrClass.getClass();
for (Class<?> aClass = initialClass; aClass != null; aClass = aClass.getSuperclass()) {
A result = aClass.getAnnotation(annotationClass);
if (result != null) {
return result;
}
}
for (Class<?> anInterface : (List<Class<?>>) ClassUtils.getAllInterfaces(initialClass)) {
A result = anInterface.getAnnotation(annotationClass);
if (result != null) {
return result;
}
}
return null;
} | java | public static <A extends Annotation> A getAnnotation(Object objectOrClass, Class<A> annotationClass) {
Class<?> initialClass = objectOrClass instanceof Class<?> ? (Class<?>) objectOrClass : objectOrClass.getClass();
for (Class<?> aClass = initialClass; aClass != null; aClass = aClass.getSuperclass()) {
A result = aClass.getAnnotation(annotationClass);
if (result != null) {
return result;
}
}
for (Class<?> anInterface : (List<Class<?>>) ClassUtils.getAllInterfaces(initialClass)) {
A result = anInterface.getAnnotation(annotationClass);
if (result != null) {
return result;
}
}
return null;
} | [
"public",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"Object",
"objectOrClass",
",",
"Class",
"<",
"A",
">",
"annotationClass",
")",
"{",
"Class",
"<",
"?",
">",
"initialClass",
"=",
"objectOrClass",
"instanceof",
"Class",
"... | Searches for a class annotation. All inheritance tree is analysed.
@since 3.1 | [
"Searches",
"for",
"a",
"class",
"annotation",
".",
"All",
"inheritance",
"tree",
"is",
"analysed",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java#L42-L60 |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/clusterers/LocalClustererProcessor.java | LocalClustererProcessor.process | @Override
public boolean process(ContentEvent event) {
if (event.isLastEvent() ||
(instancesCount > 0 && instancesCount% this.sampleFrequency == 0)) {
if (model.implementsMicroClusterer()) {
Clustering clustering = model.getMicroClusteringResult();
ClusteringResultContentEvent resultEvent = new ClusteringResultContentEvent(clustering, event.isLastEvent());
this.outputStream.put(resultEvent);
}
}
updateStats(event);
return false;
} | java | @Override
public boolean process(ContentEvent event) {
if (event.isLastEvent() ||
(instancesCount > 0 && instancesCount% this.sampleFrequency == 0)) {
if (model.implementsMicroClusterer()) {
Clustering clustering = model.getMicroClusteringResult();
ClusteringResultContentEvent resultEvent = new ClusteringResultContentEvent(clustering, event.isLastEvent());
this.outputStream.put(resultEvent);
}
}
updateStats(event);
return false;
} | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"ContentEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"isLastEvent",
"(",
")",
"||",
"(",
"instancesCount",
">",
"0",
"&&",
"instancesCount",
"%",
"this",
".",
"sampleFrequency",
"==",
"0",
")",
... | On event.
@param event the event
@return true, if successful | [
"On",
"event",
"."
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/clusterers/LocalClustererProcessor.java#L150-L167 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java | CmsDataViewClientWidget.createWidget | Widget createWidget() {
if (isTrue(m_jsonConfig, CmsDataViewConstants.CONFIG_PREVIEW)) {
return new CmsDataViewPreviewWidget(
m_config,
m_valueAccessor,
new CmsDataViewPreviewWidget.ContentImageLoader());
} else {
I_ImageProvider provider = null;
CmsDataViewValue val = m_valueAccessor.getValue();
JSONValue iconVal = m_jsonConfig.get(CmsDataViewConstants.CONFIG_ICON);
if ((iconVal != null) && (iconVal.isString() != null)) {
provider = new CmsDataViewPreviewWidget.SimpleImageLoader(iconVal.isString().stringValue());
}
return new CmsDataViewPreviewWidget(m_config, m_valueAccessor, provider);
}
} | java | Widget createWidget() {
if (isTrue(m_jsonConfig, CmsDataViewConstants.CONFIG_PREVIEW)) {
return new CmsDataViewPreviewWidget(
m_config,
m_valueAccessor,
new CmsDataViewPreviewWidget.ContentImageLoader());
} else {
I_ImageProvider provider = null;
CmsDataViewValue val = m_valueAccessor.getValue();
JSONValue iconVal = m_jsonConfig.get(CmsDataViewConstants.CONFIG_ICON);
if ((iconVal != null) && (iconVal.isString() != null)) {
provider = new CmsDataViewPreviewWidget.SimpleImageLoader(iconVal.isString().stringValue());
}
return new CmsDataViewPreviewWidget(m_config, m_valueAccessor, provider);
}
} | [
"Widget",
"createWidget",
"(",
")",
"{",
"if",
"(",
"isTrue",
"(",
"m_jsonConfig",
",",
"CmsDataViewConstants",
".",
"CONFIG_PREVIEW",
")",
")",
"{",
"return",
"new",
"CmsDataViewPreviewWidget",
"(",
"m_config",
",",
"m_valueAccessor",
",",
"new",
"CmsDataViewPrev... | Creates the correct widget based on the configuration.<p>
@return the new widget | [
"Creates",
"the",
"correct",
"widget",
"based",
"on",
"the",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java#L172-L189 |
sachin-handiekar/jMusixMatch | src/main/java/org/jmusixmatch/MusixMatch.java | MusixMatch.getMatchingTrack | public Track getMatchingTrack(String q_track, String q_artist)
throws MusixMatchException {
Track track = new Track();
Map<String, Object> params = new HashMap<String, Object>();
params.put(Constants.API_KEY, apiKey);
params.put(Constants.QUERY_TRACK, q_track);
params.put(Constants.QUERY_ARTIST, q_artist);
track = getTrackResponse(Methods.MATCHER_TRACK_GET, params);
return track;
} | java | public Track getMatchingTrack(String q_track, String q_artist)
throws MusixMatchException {
Track track = new Track();
Map<String, Object> params = new HashMap<String, Object>();
params.put(Constants.API_KEY, apiKey);
params.put(Constants.QUERY_TRACK, q_track);
params.put(Constants.QUERY_ARTIST, q_artist);
track = getTrackResponse(Methods.MATCHER_TRACK_GET, params);
return track;
} | [
"public",
"Track",
"getMatchingTrack",
"(",
"String",
"q_track",
",",
"String",
"q_artist",
")",
"throws",
"MusixMatchException",
"{",
"Track",
"track",
"=",
"new",
"Track",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"Ha... | Get the most matching track which was retrieved using the search.
@param q_track
search for text string among track names
@param q_artist
search for text string among artist names
@return the track
@throws MusixMatchException | [
"Get",
"the",
"most",
"matching",
"track",
"which",
"was",
"retrieved",
"using",
"the",
"search",
"."
] | train | https://github.com/sachin-handiekar/jMusixMatch/blob/da909f7732053a801ea7282fe9a8bce385fa3763/src/main/java/org/jmusixmatch/MusixMatch.java#L238-L250 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/FastPathResolver.java | FastPathResolver.normalizePath | public static String normalizePath(final String path, final boolean isFileOrJarURL) {
final boolean hasPercent = path.indexOf('%') >= 0;
if (!hasPercent && path.indexOf('\\') < 0 && !path.endsWith("/")) {
return path;
} else {
final int len = path.length();
final StringBuilder buf = new StringBuilder();
// Only "file:" and "jar:" URLs are %-decoded (issue 255)
if (hasPercent && isFileOrJarURL) {
// Perform '%'-decoding of path segment
int prevEndMatchIdx = 0;
final Matcher matcher = percentMatcher.matcher(path);
while (matcher.find()) {
final int startMatchIdx = matcher.start();
final int endMatchIdx = matcher.end();
translateSeparator(path, prevEndMatchIdx, startMatchIdx, /* stripFinalSeparator = */ false,
buf);
unescapePercentEncoding(path, startMatchIdx, endMatchIdx, buf);
prevEndMatchIdx = endMatchIdx;
}
translateSeparator(path, prevEndMatchIdx, len, /* stripFinalSeparator = */ true, buf);
} else {
// Fast path -- no '%', or "http(s)://" or "jrt:" URL, or non-"file:" or non-"jar:" URL
translateSeparator(path, 0, len, /* stripFinalSeparator = */ true, buf);
return buf.toString();
}
return buf.toString();
}
} | java | public static String normalizePath(final String path, final boolean isFileOrJarURL) {
final boolean hasPercent = path.indexOf('%') >= 0;
if (!hasPercent && path.indexOf('\\') < 0 && !path.endsWith("/")) {
return path;
} else {
final int len = path.length();
final StringBuilder buf = new StringBuilder();
// Only "file:" and "jar:" URLs are %-decoded (issue 255)
if (hasPercent && isFileOrJarURL) {
// Perform '%'-decoding of path segment
int prevEndMatchIdx = 0;
final Matcher matcher = percentMatcher.matcher(path);
while (matcher.find()) {
final int startMatchIdx = matcher.start();
final int endMatchIdx = matcher.end();
translateSeparator(path, prevEndMatchIdx, startMatchIdx, /* stripFinalSeparator = */ false,
buf);
unescapePercentEncoding(path, startMatchIdx, endMatchIdx, buf);
prevEndMatchIdx = endMatchIdx;
}
translateSeparator(path, prevEndMatchIdx, len, /* stripFinalSeparator = */ true, buf);
} else {
// Fast path -- no '%', or "http(s)://" or "jrt:" URL, or non-"file:" or non-"jar:" URL
translateSeparator(path, 0, len, /* stripFinalSeparator = */ true, buf);
return buf.toString();
}
return buf.toString();
}
} | [
"public",
"static",
"String",
"normalizePath",
"(",
"final",
"String",
"path",
",",
"final",
"boolean",
"isFileOrJarURL",
")",
"{",
"final",
"boolean",
"hasPercent",
"=",
"path",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
";",
"if",
"(",
"!",
"hasPer... | Parse percent encoding, e.g. "%20" -> " "; convert '/' or '\\' to SEP; remove trailing separator char if
present.
@param path
The path to normalize.
@param isFileOrJarURL
True if this is a "file:" or "jar:" URL.
@return The normalized path. | [
"Parse",
"percent",
"encoding",
"e",
".",
"g",
".",
"%20",
"-",
">",
";",
";",
"convert",
"/",
"or",
"\\\\",
"to",
"SEP",
";",
"remove",
"trailing",
"separator",
"char",
"if",
"present",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/FastPathResolver.java#L145-L173 |
beanshell/beanshell | src/main/java/bsh/classpath/ClassManagerImpl.java | ClassManagerImpl.doSuperImport | @Override
public void doSuperImport()
throws UtilEvalError
{
// Should we prevent it from happening twice?
try {
getClassPath().insureInitialized();
// prime the lookup table
getClassNameByUnqName( "" ) ;
// always true now
//getClassPath().setNameCompletionIncludeUnqNames(true);
} catch ( ClassPathException e ) {
throw new UtilEvalError("Error importing classpath "+ e, e);
}
superImport = true;
} | java | @Override
public void doSuperImport()
throws UtilEvalError
{
// Should we prevent it from happening twice?
try {
getClassPath().insureInitialized();
// prime the lookup table
getClassNameByUnqName( "" ) ;
// always true now
//getClassPath().setNameCompletionIncludeUnqNames(true);
} catch ( ClassPathException e ) {
throw new UtilEvalError("Error importing classpath "+ e, e);
}
superImport = true;
} | [
"@",
"Override",
"public",
"void",
"doSuperImport",
"(",
")",
"throws",
"UtilEvalError",
"{",
"// Should we prevent it from happening twice?",
"try",
"{",
"getClassPath",
"(",
")",
".",
"insureInitialized",
"(",
")",
";",
"// prime the lookup table",
"getClassNameByUnqNam... | Support for "import *;"
Hide details in here as opposed to NameSpace. | [
"Support",
"for",
"import",
"*",
";",
"Hide",
"details",
"in",
"here",
"as",
"opposed",
"to",
"NameSpace",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/classpath/ClassManagerImpl.java#L483-L502 |
JetBrains/xodus | environment/src/main/java/jetbrains/exodus/env/ReentrantTransactionDispatcher.java | ReentrantTransactionDispatcher.tryAcquireExclusiveTransaction | private int tryAcquireExclusiveTransaction(@NotNull final Thread thread, final int timeout) {
long nanos = TimeUnit.MILLISECONDS.toNanos(timeout);
try (CriticalSection ignored = criticalSection.enter()) {
if (getThreadPermits(thread) > 0) {
throw new ExodusException("Exclusive transaction can't be nested");
}
final Condition condition = criticalSection.newCondition();
final long currentOrder = acquireOrder++;
regularQueue.put(currentOrder, condition);
while (acquiredPermits > 0 || regularQueue.firstKey() != currentOrder) {
try {
nanos = condition.awaitNanos(nanos);
if (nanos < 0) {
break;
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
if (acquiredPermits == 0 && regularQueue.firstKey() == currentOrder) {
regularQueue.pollFirstEntry();
acquiredPermits = availablePermits;
threadPermits.put(thread, availablePermits);
return availablePermits;
}
regularQueue.remove(currentOrder);
notifyNextWaiters();
}
return 0;
} | java | private int tryAcquireExclusiveTransaction(@NotNull final Thread thread, final int timeout) {
long nanos = TimeUnit.MILLISECONDS.toNanos(timeout);
try (CriticalSection ignored = criticalSection.enter()) {
if (getThreadPermits(thread) > 0) {
throw new ExodusException("Exclusive transaction can't be nested");
}
final Condition condition = criticalSection.newCondition();
final long currentOrder = acquireOrder++;
regularQueue.put(currentOrder, condition);
while (acquiredPermits > 0 || regularQueue.firstKey() != currentOrder) {
try {
nanos = condition.awaitNanos(nanos);
if (nanos < 0) {
break;
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
if (acquiredPermits == 0 && regularQueue.firstKey() == currentOrder) {
regularQueue.pollFirstEntry();
acquiredPermits = availablePermits;
threadPermits.put(thread, availablePermits);
return availablePermits;
}
regularQueue.remove(currentOrder);
notifyNextWaiters();
}
return 0;
} | [
"private",
"int",
"tryAcquireExclusiveTransaction",
"(",
"@",
"NotNull",
"final",
"Thread",
"thread",
",",
"final",
"int",
"timeout",
")",
"{",
"long",
"nanos",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"toNanos",
"(",
"timeout",
")",
";",
"try",
"(",
"Crit... | Wait for exclusive permit during a timeout in milliseconds.
@return number of acquired permits if > 0 | [
"Wait",
"for",
"exclusive",
"permit",
"during",
"a",
"timeout",
"in",
"milliseconds",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/env/ReentrantTransactionDispatcher.java#L193-L223 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.