repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.stopRecording | public StopRecordingResponse stopRecording(String sessionId) {
checkStringNotEmpty(sessionId, "The parameter sessionId should NOT be null or empty string.");
StopRecordingRequest request = new StopRecordingRequest().withSessionId(sessionId);
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION, sessionId);
internalRequest.addParameter(RECORDING, null);
return invokeHttpClient(internalRequest, StopRecordingResponse.class);
} | java | public StopRecordingResponse stopRecording(String sessionId) {
checkStringNotEmpty(sessionId, "The parameter sessionId should NOT be null or empty string.");
StopRecordingRequest request = new StopRecordingRequest().withSessionId(sessionId);
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION, sessionId);
internalRequest.addParameter(RECORDING, null);
return invokeHttpClient(internalRequest, StopRecordingResponse.class);
} | [
"public",
"StopRecordingResponse",
"stopRecording",
"(",
"String",
"sessionId",
")",
"{",
"checkStringNotEmpty",
"(",
"sessionId",
",",
"\"The parameter sessionId should NOT be null or empty string.\"",
")",
";",
"StopRecordingRequest",
"request",
"=",
"new",
"StopRecordingRequ... | Stop live session recording.
@param sessionId Live session id.
@return the response | [
"Stop",
"live",
"session",
"recording",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1062-L1068 |
martinwithaar/Encryptor4j | src/main/java/org/encryptor4j/OneTimePad.java | OneTimePad.createPadFile | public void createPadFile(File padFile, long size) {
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(padFile), ioBufferSize);
long totalSize = 0;
long bytesLeft;
byte[] randomBytes = new byte[workBufferSize];
while (totalSize < size) {
random.nextBytes(randomBytes);
bytesLeft = size - totalSize;
if(bytesLeft < workBufferSize) {
os.write(randomBytes, 0, (int) bytesLeft);
totalSize += bytesLeft;
} else {
os.write(randomBytes);
totalSize += workBufferSize;
}
}
os.flush();
} catch(IOException e) {
throw new RuntimeException(e);
} finally {
if(os != null) {
try {
os.close();
} catch(IOException e) {
e.printStackTrace();
}
}
}
} | java | public void createPadFile(File padFile, long size) {
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(padFile), ioBufferSize);
long totalSize = 0;
long bytesLeft;
byte[] randomBytes = new byte[workBufferSize];
while (totalSize < size) {
random.nextBytes(randomBytes);
bytesLeft = size - totalSize;
if(bytesLeft < workBufferSize) {
os.write(randomBytes, 0, (int) bytesLeft);
totalSize += bytesLeft;
} else {
os.write(randomBytes);
totalSize += workBufferSize;
}
}
os.flush();
} catch(IOException e) {
throw new RuntimeException(e);
} finally {
if(os != null) {
try {
os.close();
} catch(IOException e) {
e.printStackTrace();
}
}
}
} | [
"public",
"void",
"createPadFile",
"(",
"File",
"padFile",
",",
"long",
"size",
")",
"{",
"OutputStream",
"os",
"=",
"null",
";",
"try",
"{",
"os",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"padFile",
")",
",",
"ioBufferSize",
... | <p>Creates a padfile containing random bytes.</p>
@param padFile
@param size | [
"<p",
">",
"Creates",
"a",
"padfile",
"containing",
"random",
"bytes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/martinwithaar/Encryptor4j/blob/8c31d84d9136309f59d810323ed68d902b9bac55/src/main/java/org/encryptor4j/OneTimePad.java#L82-L112 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java | Http2ServerUpgradeCodec.createSettingsFrame | private static ByteBuf createSettingsFrame(ChannelHandlerContext ctx, ByteBuf payload) {
ByteBuf frame = ctx.alloc().buffer(FRAME_HEADER_LENGTH + payload.readableBytes());
writeFrameHeader(frame, payload.readableBytes(), SETTINGS, new Http2Flags(), 0);
frame.writeBytes(payload);
payload.release();
return frame;
} | java | private static ByteBuf createSettingsFrame(ChannelHandlerContext ctx, ByteBuf payload) {
ByteBuf frame = ctx.alloc().buffer(FRAME_HEADER_LENGTH + payload.readableBytes());
writeFrameHeader(frame, payload.readableBytes(), SETTINGS, new Http2Flags(), 0);
frame.writeBytes(payload);
payload.release();
return frame;
} | [
"private",
"static",
"ByteBuf",
"createSettingsFrame",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ByteBuf",
"payload",
")",
"{",
"ByteBuf",
"frame",
"=",
"ctx",
".",
"alloc",
"(",
")",
".",
"buffer",
"(",
"FRAME_HEADER_LENGTH",
"+",
"payload",
".",
"readableByte... | Creates an HTTP2-Settings header with the given payload. The payload buffer is released. | [
"Creates",
"an",
"HTTP2",
"-",
"Settings",
"header",
"with",
"the",
"given",
"payload",
".",
"The",
"payload",
"buffer",
"is",
"released",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java#L208-L214 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateYXZ | public Matrix4f rotateYXZ(float angleY, float angleX, float angleZ) {
return rotateYXZ(angleY, angleX, angleZ, thisOrNew());
} | java | public Matrix4f rotateYXZ(float angleY, float angleX, float angleZ) {
return rotateYXZ(angleY, angleX, angleZ, thisOrNew());
} | [
"public",
"Matrix4f",
"rotateYXZ",
"(",
"float",
"angleY",
",",
"float",
"angleX",
",",
"float",
"angleZ",
")",
"{",
"return",
"rotateYXZ",
"(",
"angleY",
",",
"angleX",
",",
"angleZ",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Apply rotation of <code>angleY</code> radians about the Y axis, followed by a rotation of <code>angleX</code> radians about the X axis and
followed by a rotation of <code>angleZ</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateY(angleY).rotateX(angleX).rotateZ(angleZ)</code>
@param angleY
the angle to rotate about Y
@param angleX
the angle to rotate about X
@param angleZ
the angle to rotate about Z
@return a matrix holding the result | [
"Apply",
"rotation",
"of",
"<code",
">",
"angleY<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleX<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"and",
"followed",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5676-L5678 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java | TorqueDBHandling.writeCompressedText | private void writeCompressedText(File file, byte[] compressedContent) throws IOException
{
ByteArrayInputStream bais = new ByteArrayInputStream(compressedContent);
GZIPInputStream gis = new GZIPInputStream(bais);
BufferedReader input = new BufferedReader(new InputStreamReader(gis));
BufferedWriter output = new BufferedWriter(new FileWriter(file));
String line;
while ((line = input.readLine()) != null)
{
output.write(line);
output.write('\n');
}
input.close();
gis.close();
bais.close();
output.close();
} | java | private void writeCompressedText(File file, byte[] compressedContent) throws IOException
{
ByteArrayInputStream bais = new ByteArrayInputStream(compressedContent);
GZIPInputStream gis = new GZIPInputStream(bais);
BufferedReader input = new BufferedReader(new InputStreamReader(gis));
BufferedWriter output = new BufferedWriter(new FileWriter(file));
String line;
while ((line = input.readLine()) != null)
{
output.write(line);
output.write('\n');
}
input.close();
gis.close();
bais.close();
output.close();
} | [
"private",
"void",
"writeCompressedText",
"(",
"File",
"file",
",",
"byte",
"[",
"]",
"compressedContent",
")",
"throws",
"IOException",
"{",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"compressedContent",
")",
";",
"GZIPInputStream",
"... | Uncompresses the given textual content and writes it to the given file.
@param file The file to write to
@param compressedContent The content
@throws IOException If an error occurred | [
"Uncompresses",
"the",
"given",
"textual",
"content",
"and",
"writes",
"it",
"to",
"the",
"given",
"file",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java#L596-L613 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java | InnerMetricContext.addChildContext | public synchronized void addChildContext(String childContextName, final MetricContext childContext)
throws NameConflictException, ExecutionException {
if (this.children.get(childContextName, new Callable<MetricContext>() {
@Override
public MetricContext call() throws Exception {
return childContext;
}
}) != childContext) {
throw new NameConflictException("A child context with that name already exists.");
}
} | java | public synchronized void addChildContext(String childContextName, final MetricContext childContext)
throws NameConflictException, ExecutionException {
if (this.children.get(childContextName, new Callable<MetricContext>() {
@Override
public MetricContext call() throws Exception {
return childContext;
}
}) != childContext) {
throw new NameConflictException("A child context with that name already exists.");
}
} | [
"public",
"synchronized",
"void",
"addChildContext",
"(",
"String",
"childContextName",
",",
"final",
"MetricContext",
"childContext",
")",
"throws",
"NameConflictException",
",",
"ExecutionException",
"{",
"if",
"(",
"this",
".",
"children",
".",
"get",
"(",
"child... | Add a {@link MetricContext} as a child of this {@link MetricContext} if it is not currently a child.
@param childContextName the name of the child {@link MetricContext}
@param childContext the child {@link MetricContext} to add | [
"Add",
"a",
"{",
"@link",
"MetricContext",
"}",
"as",
"a",
"child",
"of",
"this",
"{",
"@link",
"MetricContext",
"}",
"if",
"it",
"is",
"not",
"currently",
"a",
"child",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java#L134-L144 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Config.java | Config.copyConfiguration | public static Configuration copyConfiguration(final Configuration original) {
Configuration copy = new MapConfiguration(new HashMap<String, Object>());
for (Iterator<?> i = original.getKeys(); i.hasNext();) {
String key = (String) i.next();
Object value = original.getProperty(key);
if (value instanceof List) {
value = new ArrayList((List) value);
}
copy.setProperty(key, value);
}
return copy;
} | java | public static Configuration copyConfiguration(final Configuration original) {
Configuration copy = new MapConfiguration(new HashMap<String, Object>());
for (Iterator<?> i = original.getKeys(); i.hasNext();) {
String key = (String) i.next();
Object value = original.getProperty(key);
if (value instanceof List) {
value = new ArrayList((List) value);
}
copy.setProperty(key, value);
}
return copy;
} | [
"public",
"static",
"Configuration",
"copyConfiguration",
"(",
"final",
"Configuration",
"original",
")",
"{",
"Configuration",
"copy",
"=",
"new",
"MapConfiguration",
"(",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
")",
";",
"for",
"(",
... | Creates a deep-copy of the given configuration. This is useful for unit-testing.
@param original the configuration to copy.
@return a copy of the given configuration. | [
"Creates",
"a",
"deep",
"-",
"copy",
"of",
"the",
"given",
"configuration",
".",
"This",
"is",
"useful",
"for",
"unit",
"-",
"testing",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Config.java#L98-L113 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java | LogRepositoryBaseImpl.createLockFile | protected void createLockFile(String pid, String label) throws IOException {
if (!AccessHelper.isDirectory(repositoryLocation)) {
AccessHelper.makeDirectories(repositoryLocation);
}
// Remove stale lock files if any.
for (File lock : listFiles(LOCKFILE_FILTER)) {
AccessHelper.deleteFile(lock);
}
// Create a new lock file.
StringBuilder sb = new StringBuilder();
sb.append(getLogDirectoryName(System.currentTimeMillis(), pid, label)).append(LOCK_EXT);
AccessHelper.createFileOutputStream(new File(repositoryLocation, sb.toString()), false).close();
} | java | protected void createLockFile(String pid, String label) throws IOException {
if (!AccessHelper.isDirectory(repositoryLocation)) {
AccessHelper.makeDirectories(repositoryLocation);
}
// Remove stale lock files if any.
for (File lock : listFiles(LOCKFILE_FILTER)) {
AccessHelper.deleteFile(lock);
}
// Create a new lock file.
StringBuilder sb = new StringBuilder();
sb.append(getLogDirectoryName(System.currentTimeMillis(), pid, label)).append(LOCK_EXT);
AccessHelper.createFileOutputStream(new File(repositoryLocation, sb.toString()), false).close();
} | [
"protected",
"void",
"createLockFile",
"(",
"String",
"pid",
",",
"String",
"label",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"AccessHelper",
".",
"isDirectory",
"(",
"repositoryLocation",
")",
")",
"{",
"AccessHelper",
".",
"makeDirectories",
"(",
"... | Creates lock file to be used as a pattern for instance repository.
Should be called only by parent's manager on start up.
@param pid process ID of the parent.
@param label label of the parent.
@throws IOException if there's a problem to create lock file. | [
"Creates",
"lock",
"file",
"to",
"be",
"used",
"as",
"a",
"pattern",
"for",
"instance",
"repository",
".",
"Should",
"be",
"called",
"only",
"by",
"parent",
"s",
"manager",
"on",
"start",
"up",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryBaseImpl.java#L143-L157 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.fireCharEvent | protected void fireCharEvent(char[] chars, int start, int length)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CHARACTERS, chars, start,length);
}
} | java | protected void fireCharEvent(char[] chars, int start, int length)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CHARACTERS, chars, start,length);
}
} | [
"protected",
"void",
"fireCharEvent",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"flushMyWriter",
"("... | Report the characters trace event
@param chars content of characters
@param start starting index of characters to output
@param length number of characters to output | [
"Report",
"the",
"characters",
"trace",
"event"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L111-L119 |
opentable/otj-jaxrs | client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java | JaxRsClientFactory.newBuilder | public synchronized ClientBuilder newBuilder(String clientName, JaxRsFeatureGroup feature, JaxRsFeatureGroup... moreFeatures) {
return newBuilder(clientName, ImmutableList.<JaxRsFeatureGroup>builder()
.add(feature)
.addAll(Arrays.asList(moreFeatures))
.build());
} | java | public synchronized ClientBuilder newBuilder(String clientName, JaxRsFeatureGroup feature, JaxRsFeatureGroup... moreFeatures) {
return newBuilder(clientName, ImmutableList.<JaxRsFeatureGroup>builder()
.add(feature)
.addAll(Arrays.asList(moreFeatures))
.build());
} | [
"public",
"synchronized",
"ClientBuilder",
"newBuilder",
"(",
"String",
"clientName",
",",
"JaxRsFeatureGroup",
"feature",
",",
"JaxRsFeatureGroup",
"...",
"moreFeatures",
")",
"{",
"return",
"newBuilder",
"(",
"clientName",
",",
"ImmutableList",
".",
"<",
"JaxRsFeatu... | Create a new {@link ClientBuilder} instance with the given name and groups.
You own the returned client and are responsible for managing its cleanup. | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java#L217-L222 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java | ClipboardUtils.setClipboardText | public static void setClipboardText(final Context context, final String text) {
if(text != null) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
final ClipData clipData = ClipData.newPlainText(text, text);
clipboard.setPrimaryClip(clipData);
}
} | java | public static void setClipboardText(final Context context, final String text) {
if(text != null) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
final ClipData clipData = ClipData.newPlainText(text, text);
clipboard.setPrimaryClip(clipData);
}
} | [
"public",
"static",
"void",
"setClipboardText",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"final",
"ClipboardManager",
"clipboard",
"=",
"(",
"ClipboardManager",
")",
"context",
"... | Set the clipboard text.
@param text Text to put in the clipboard. | [
"Set",
"the",
"clipboard",
"text",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java#L34-L40 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java | LifeCycleController.registerLifeCycleObserver | public static void registerLifeCycleObserver(@NonNull Application application, @NonNull LifecycleListener listener) {
application.registerActivityLifecycleCallbacks(new LifeCycleController(listener).createLifecycleCallback());
} | java | public static void registerLifeCycleObserver(@NonNull Application application, @NonNull LifecycleListener listener) {
application.registerActivityLifecycleCallbacks(new LifeCycleController(listener).createLifecycleCallback());
} | [
"public",
"static",
"void",
"registerLifeCycleObserver",
"(",
"@",
"NonNull",
"Application",
"application",
",",
"@",
"NonNull",
"LifecycleListener",
"listener",
")",
"{",
"application",
".",
"registerActivityLifecycleCallbacks",
"(",
"new",
"LifeCycleController",
"(",
... | Creates and registers application lifecycle listener.
@param application {@link Application} instance. | [
"Creates",
"and",
"registers",
"application",
"lifecycle",
"listener",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java#L86-L88 |
sniffy/sniffy | sniffy-core/src/main/java/io/sniffy/LegacySpy.java | LegacySpy.expectBetween | @Deprecated
public C expectBetween(int minAllowedStatements, int maxAllowedStatements, Query query) {
return expect(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).type(adapter(query)));
} | java | @Deprecated
public C expectBetween(int minAllowedStatements, int maxAllowedStatements, Query query) {
return expect(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).type(adapter(query)));
} | [
"@",
"Deprecated",
"public",
"C",
"expectBetween",
"(",
"int",
"minAllowedStatements",
",",
"int",
"maxAllowedStatements",
",",
"Query",
"query",
")",
"{",
"return",
"expect",
"(",
"SqlQueries",
".",
"queriesBetween",
"(",
"minAllowedStatements",
",",
"maxAllowedSta... | Adds an expectation to the current instance that at least {@code minAllowedStatements} and at most
{@code maxAllowedStatements} were called between the creation of the current instance
and a call to {@link #verify()} method
@since 2.2 | [
"Adds",
"an",
"expectation",
"to",
"the",
"current",
"instance",
"that",
"at",
"least",
"{"
] | train | https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L608-L611 |
jenkinsci/mask-passwords-plugin | src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsBuildWrapper.java | MaskPasswordsBuildWrapper.makeBuildVariables | @Override
public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) {
// global var/password pairs
MaskPasswordsConfig config = MaskPasswordsConfig.getInstance();
List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs();
// we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs
for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) {
variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword());
}
// job's var/password pairs
if(varPasswordPairs != null) {
// cf. comment above
for(VarPasswordPair varPasswordPair: varPasswordPairs) {
if(StringUtils.isNotBlank(varPasswordPair.getVar())) {
variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword());
}
}
}
} | java | @Override
public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) {
// global var/password pairs
MaskPasswordsConfig config = MaskPasswordsConfig.getInstance();
List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs();
// we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs
for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) {
variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword());
}
// job's var/password pairs
if(varPasswordPairs != null) {
// cf. comment above
for(VarPasswordPair varPasswordPair: varPasswordPairs) {
if(StringUtils.isNotBlank(varPasswordPair.getVar())) {
variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword());
}
}
}
} | [
"@",
"Override",
"public",
"void",
"makeBuildVariables",
"(",
"AbstractBuild",
"build",
",",
"Map",
"<",
"String",
",",
"String",
">",
"variables",
")",
"{",
"// global var/password pairs\r",
"MaskPasswordsConfig",
"config",
"=",
"MaskPasswordsConfig",
".",
"getInstan... | Contributes the passwords defined by the user as variables that can be reused
from build steps (and other places). | [
"Contributes",
"the",
"passwords",
"defined",
"by",
"the",
"user",
"as",
"variables",
"that",
"can",
"be",
"reused",
"from",
"build",
"steps",
"(",
"and",
"other",
"places",
")",
"."
] | train | https://github.com/jenkinsci/mask-passwords-plugin/blob/3440b0aa5d2553889245327a9d37a006b4b17c3f/src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsBuildWrapper.java#L184-L203 |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.addAuthToken | public void addAuthToken(ClientRequest request, String token) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
// other cases of Bearer
token = "Bearer " + token.substring(7);
} else {
token = "Bearer " + token;
}
}
request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
} | java | public void addAuthToken(ClientRequest request, String token) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
// other cases of Bearer
token = "Bearer " + token.substring(7);
} else {
token = "Bearer " + token;
}
}
request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
} | [
"public",
"void",
"addAuthToken",
"(",
"ClientRequest",
"request",
",",
"String",
"token",
")",
"{",
"if",
"(",
"token",
"!=",
"null",
"&&",
"!",
"token",
".",
"startsWith",
"(",
"\"Bearer \"",
")",
")",
"{",
"if",
"(",
"token",
".",
"toUpperCase",
"(",
... | Add Authorization Code grant token the caller app gets from OAuth2 server.
This is the method called from client like web server
@param request the http request
@param token the bearer token | [
"Add",
"Authorization",
"Code",
"grant",
"token",
"the",
"caller",
"app",
"gets",
"from",
"OAuth2",
"server",
"."
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L273-L283 |
kevinherron/opc-ua-stack | stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/DataValue.java | DataValue.derivedNonValue | public static DataValue derivedNonValue(DataValue from, TimestampsToReturn timestamps) {
boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both;
return new DataValue(
from.value,
from.status,
null,
includeServer ? from.serverTime : null
);
} | java | public static DataValue derivedNonValue(DataValue from, TimestampsToReturn timestamps) {
boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both;
return new DataValue(
from.value,
from.status,
null,
includeServer ? from.serverTime : null
);
} | [
"public",
"static",
"DataValue",
"derivedNonValue",
"(",
"DataValue",
"from",
",",
"TimestampsToReturn",
"timestamps",
")",
"{",
"boolean",
"includeServer",
"=",
"timestamps",
"==",
"TimestampsToReturn",
".",
"Server",
"||",
"timestamps",
"==",
"TimestampsToReturn",
"... | Derive a new {@link DataValue} from a given {@link DataValue}.
<p>
The value is assumed to be for a non-value Node attribute, and therefore the source timestamp is not returned.
@param from the {@link DataValue} to derive from.
@param timestamps the timestamps to return in the derived value.
@return a derived {@link DataValue}. | [
"Derive",
"a",
"new",
"{",
"@link",
"DataValue",
"}",
"from",
"a",
"given",
"{",
"@link",
"DataValue",
"}",
".",
"<p",
">",
"The",
"value",
"is",
"assumed",
"to",
"be",
"for",
"a",
"non",
"-",
"value",
"Node",
"attribute",
"and",
"therefore",
"the",
... | train | https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/DataValue.java#L157-L166 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java | WaveformFinder.getWaveformDetail | WaveformDetail getWaveformDetail(int rekordboxId, SlotReference slot, Client client)
throws IOException {
final NumberField idField = new NumberField(rekordboxId);
// First try to get the NXS2-style color waveform if we are supposed to.
if (preferColor.get()) {
try {
Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG,
client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField,
new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL), new NumberField(Message.ALNZ_FILE_TYPE_EXT));
return new WaveformDetail(new DataReference(slot, rekordboxId), response);
} catch (Exception e) {
logger.info("No color waveform available for slot " + slot + ", id " + rekordboxId + "; requesting blue version.", e);
}
}
Message response = client.simpleRequest(Message.KnownType.WAVE_DETAIL_REQ, Message.KnownType.WAVE_DETAIL,
client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, NumberField.WORD_0);
return new WaveformDetail(new DataReference(slot, rekordboxId), response);
} | java | WaveformDetail getWaveformDetail(int rekordboxId, SlotReference slot, Client client)
throws IOException {
final NumberField idField = new NumberField(rekordboxId);
// First try to get the NXS2-style color waveform if we are supposed to.
if (preferColor.get()) {
try {
Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG,
client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField,
new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL), new NumberField(Message.ALNZ_FILE_TYPE_EXT));
return new WaveformDetail(new DataReference(slot, rekordboxId), response);
} catch (Exception e) {
logger.info("No color waveform available for slot " + slot + ", id " + rekordboxId + "; requesting blue version.", e);
}
}
Message response = client.simpleRequest(Message.KnownType.WAVE_DETAIL_REQ, Message.KnownType.WAVE_DETAIL,
client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, NumberField.WORD_0);
return new WaveformDetail(new DataReference(slot, rekordboxId), response);
} | [
"WaveformDetail",
"getWaveformDetail",
"(",
"int",
"rekordboxId",
",",
"SlotReference",
"slot",
",",
"Client",
"client",
")",
"throws",
"IOException",
"{",
"final",
"NumberField",
"idField",
"=",
"new",
"NumberField",
"(",
"rekordboxId",
")",
";",
"// First try to g... | Requests the waveform detail for a specific track ID, given a connection to a player that has already been
set up.
@param rekordboxId the track whose waveform detail is desired
@param slot identifies the media slot we are querying
@param client the dbserver client that is communicating with the appropriate player
@return the retrieved waveform detail, or {@code null} if none was available
@throws IOException if there is a communication problem | [
"Requests",
"the",
"waveform",
"detail",
"for",
"a",
"specific",
"track",
"ID",
"given",
"a",
"connection",
"to",
"a",
"player",
"that",
"has",
"already",
"been",
"set",
"up",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java#L584-L603 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java | SolutionUtils.distanceBetweenObjectives | public static <S extends Solution<?>> double distanceBetweenObjectives(S firstSolution, S secondSolution) {
double diff;
double distance = 0.0;
//euclidean distance
for (int nObj = 0; nObj < firstSolution.getNumberOfObjectives(); nObj++) {
diff = firstSolution.getObjective(nObj) - secondSolution.getObjective(nObj);
distance += Math.pow(diff, 2.0);
}
return Math.sqrt(distance);
} | java | public static <S extends Solution<?>> double distanceBetweenObjectives(S firstSolution, S secondSolution) {
double diff;
double distance = 0.0;
//euclidean distance
for (int nObj = 0; nObj < firstSolution.getNumberOfObjectives(); nObj++) {
diff = firstSolution.getObjective(nObj) - secondSolution.getObjective(nObj);
distance += Math.pow(diff, 2.0);
}
return Math.sqrt(distance);
} | [
"public",
"static",
"<",
"S",
"extends",
"Solution",
"<",
"?",
">",
">",
"double",
"distanceBetweenObjectives",
"(",
"S",
"firstSolution",
",",
"S",
"secondSolution",
")",
"{",
"double",
"diff",
";",
"double",
"distance",
"=",
"0.0",
";",
"//euclidean distance... | Returns the euclidean distance between a pair of solutions in the objective space | [
"Returns",
"the",
"euclidean",
"distance",
"between",
"a",
"pair",
"of",
"solutions",
"in",
"the",
"objective",
"space"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java#L61-L73 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java | RecommendationsInner.getRuleDetailsByWebApp | public RecommendationRuleInner getRuleDetailsByWebApp(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId) {
return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen, recommendationId).toBlocking().single().body();
} | java | public RecommendationRuleInner getRuleDetailsByWebApp(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId) {
return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen, recommendationId).toBlocking().single().body();
} | [
"public",
"RecommendationRuleInner",
"getRuleDetailsByWebApp",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"name",
",",
"Boolean",
"updateSeen",
",",
"String",
"recommendationId",
")",
"{",
"return",
"getRuleDetailsByWebAppWithServiceRespon... | Get a recommendation rule for an app.
Get a recommendation rule for an app.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Name of the app.
@param name Name of the recommendation.
@param updateSeen Specify <code>true</code> to update the last-seen timestamp of the recommendation object.
@param recommendationId The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RecommendationRuleInner object if successful. | [
"Get",
"a",
"recommendation",
"rule",
"for",
"an",
"app",
".",
"Get",
"a",
"recommendation",
"rule",
"for",
"an",
"app",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1304-L1306 |
finmath/finmath-lib | src/main/java6/net/finmath/functions/AnalyticFormulas.java | AnalyticFormulas.margrabeExchangeOptionValue | public static double margrabeExchangeOptionValue(
double spot1,
double spot2,
double volatility1,
double volatility2,
double correlation,
double optionMaturity)
{
double volatility = Math.sqrt(volatility1*volatility1 + volatility2*volatility2 - 2.0 * volatility1*volatility2*correlation);
return blackScholesGeneralizedOptionValue(spot1, volatility, optionMaturity, spot2, 1.0);
} | java | public static double margrabeExchangeOptionValue(
double spot1,
double spot2,
double volatility1,
double volatility2,
double correlation,
double optionMaturity)
{
double volatility = Math.sqrt(volatility1*volatility1 + volatility2*volatility2 - 2.0 * volatility1*volatility2*correlation);
return blackScholesGeneralizedOptionValue(spot1, volatility, optionMaturity, spot2, 1.0);
} | [
"public",
"static",
"double",
"margrabeExchangeOptionValue",
"(",
"double",
"spot1",
",",
"double",
"spot2",
",",
"double",
"volatility1",
",",
"double",
"volatility2",
",",
"double",
"correlation",
",",
"double",
"optionMaturity",
")",
"{",
"double",
"volatility",
... | Calculates the value of an Exchange option under a generalized Black-Scholes model, i.e., the payoff \( max(S_{1}(T)-S_{2}(T),0) \),
where \( S_{1} \) and \( S_{2} \) follow a log-normal process with constant log-volatility and constant instantaneous correlation.
The method also handles cases where the forward and/or option strike is negative
and some limit cases where the forward and/or the option strike is zero.
@param spot1 Value of \( S_{1}(0) \)
@param spot2 Value of \( S_{2}(0) \)
@param volatility1 Volatility of \( \log(S_{1}(t)) \)
@param volatility2 Volatility of \( \log(S_{2}(t)) \)
@param correlation Instantaneous correlation of \( \log(S_{1}(t)) \) and \( \log(S_{2}(t)) \)
@param optionMaturity The option maturity \( T \).
@return Returns the value of a European exchange option under the Black-Scholes model. | [
"Calculates",
"the",
"value",
"of",
"an",
"Exchange",
"option",
"under",
"a",
"generalized",
"Black",
"-",
"Scholes",
"model",
"i",
".",
"e",
".",
"the",
"payoff",
"\\",
"(",
"max",
"(",
"S_",
"{",
"1",
"}",
"(",
"T",
")",
"-",
"S_",
"{",
"2",
"}... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L756-L766 |
BioPAX/Paxtools | paxtools-core/src/main/java/org/biopax/paxtools/io/SimpleIOHandler.java | SimpleIOHandler.convertToOWL | public void convertToOWL(Model model, OutputStream outputStream)
{
initializeExporter(model);
try
{
Writer out = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
writeObjects(out, model);
out.close();
}
catch (IOException e)
{
throw new BioPaxIOException("Cannot convert to OWL!", e);
}
} | java | public void convertToOWL(Model model, OutputStream outputStream)
{
initializeExporter(model);
try
{
Writer out = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
writeObjects(out, model);
out.close();
}
catch (IOException e)
{
throw new BioPaxIOException("Cannot convert to OWL!", e);
}
} | [
"public",
"void",
"convertToOWL",
"(",
"Model",
"model",
",",
"OutputStream",
"outputStream",
")",
"{",
"initializeExporter",
"(",
"model",
")",
";",
"try",
"{",
"Writer",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"outputStream"... | Converts a model into BioPAX (OWL) format, and writes it into
the outputStream. Saved data can be then read via {@link BioPAXIOHandler}
interface (e.g., {@link SimpleIOHandler}).
Note: When the model is incomplete (i.e., contains elements that refer externals,
dangling BioPAX elements) and is exported by this method, it works; however one
will find corresponding object properties set to NULL later,
after converting such data back to Model.
Note: if the model is very very large, and the output stream is a byte array stream,
then you can eventually get OutOfMemoryError "Requested array size exceeds VM limit"
(max. array size is 2Gb)
@param model model to be converted into OWL format
@param outputStream output stream into which the output will be written
@throws BioPaxIOException in case of I/O problems | [
"Converts",
"a",
"model",
"into",
"BioPAX",
"(",
"OWL",
")",
"format",
"and",
"writes",
"it",
"into",
"the",
"outputStream",
".",
"Saved",
"data",
"can",
"be",
"then",
"read",
"via",
"{",
"@link",
"BioPAXIOHandler",
"}",
"interface",
"(",
"e",
".",
"g",
... | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/SimpleIOHandler.java#L561-L575 |
google/closure-compiler | src/com/google/javascript/jscomp/PeepholeFoldConstants.java | PeepholeFoldConstants.tryFoldInstanceof | private Node tryFoldInstanceof(Node n, Node left, Node right) {
checkArgument(n.isInstanceOf());
// TODO(johnlenz) Use type information if available to fold
// instanceof.
if (NodeUtil.isLiteralValue(left, true)
&& !mayHaveSideEffects(right)) {
Node replacementNode = null;
if (NodeUtil.isImmutableValue(left)) {
// Non-object types are never instances.
replacementNode = IR.falseNode();
} else if (right.isName()
&& "Object".equals(right.getString())) {
replacementNode = IR.trueNode();
}
if (replacementNode != null) {
n.replaceWith(replacementNode);
reportChangeToEnclosingScope(replacementNode);
markFunctionsDeleted(n);
return replacementNode;
}
}
return n;
} | java | private Node tryFoldInstanceof(Node n, Node left, Node right) {
checkArgument(n.isInstanceOf());
// TODO(johnlenz) Use type information if available to fold
// instanceof.
if (NodeUtil.isLiteralValue(left, true)
&& !mayHaveSideEffects(right)) {
Node replacementNode = null;
if (NodeUtil.isImmutableValue(left)) {
// Non-object types are never instances.
replacementNode = IR.falseNode();
} else if (right.isName()
&& "Object".equals(right.getString())) {
replacementNode = IR.trueNode();
}
if (replacementNode != null) {
n.replaceWith(replacementNode);
reportChangeToEnclosingScope(replacementNode);
markFunctionsDeleted(n);
return replacementNode;
}
}
return n;
} | [
"private",
"Node",
"tryFoldInstanceof",
"(",
"Node",
"n",
",",
"Node",
"left",
",",
"Node",
"right",
")",
"{",
"checkArgument",
"(",
"n",
".",
"isInstanceOf",
"(",
")",
")",
";",
"// TODO(johnlenz) Use type information if available to fold",
"// instanceof.",
"if",
... | Try to fold {@code left instanceof right} into {@code true}
or {@code false}. | [
"Try",
"to",
"fold",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeFoldConstants.java#L447-L474 |
lastaflute/lasta-di | src/main/java/org/lastaflute/di/util/LdiSrl.java | LdiSrl.substringFirstFront | public static String substringFirstFront(final String str, final String... delimiters) {
assertStringNotNull(str);
return doSubstringFirstRear(false, false, false, str, delimiters);
} | java | public static String substringFirstFront(final String str, final String... delimiters) {
assertStringNotNull(str);
return doSubstringFirstRear(false, false, false, str, delimiters);
} | [
"public",
"static",
"String",
"substringFirstFront",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"...",
"delimiters",
")",
"{",
"assertStringNotNull",
"(",
"str",
")",
";",
"return",
"doSubstringFirstRear",
"(",
"false",
",",
"false",
",",
"false",
... | Extract front sub-string from first-found delimiter.
<pre>
substringFirstFront("foo.bar/baz.qux", ".", "/")
returns "foo"
</pre>
@param str The target string. (NotNull)
@param delimiters The array of delimiters. (NotNull)
@return The part of string. (NotNull: if delimiter not found, returns argument-plain string) | [
"Extract",
"front",
"sub",
"-",
"string",
"from",
"first",
"-",
"found",
"delimiter",
".",
"<pre",
">",
"substringFirstFront",
"(",
"foo",
".",
"bar",
"/",
"baz",
".",
"qux",
".",
"/",
")",
"returns",
"foo",
"<",
"/",
"pre",
">"
] | train | https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L627-L630 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/parsers/XmlErrorHandler.java | XmlErrorHandler.printError | void printError(String type, SAXParseException e) {
PrintWriter logger = new PrintWriter(System.out);
logger.print(type);
if (e.getLineNumber() >= 0) {
logger.print(" at line " + e.getLineNumber());
if (e.getColumnNumber() >= 0) {
logger.print(", column " + e.getColumnNumber());
}
if (e.getSystemId() != null) {
logger.print(" of " + e.getSystemId());
}
} else {
if (e.getSystemId() != null) {
logger.print(" in " + e.getSystemId());
}
}
logger.println(":");
logger.println(" " + e.getMessage());
logger.flush();
} | java | void printError(String type, SAXParseException e) {
PrintWriter logger = new PrintWriter(System.out);
logger.print(type);
if (e.getLineNumber() >= 0) {
logger.print(" at line " + e.getLineNumber());
if (e.getColumnNumber() >= 0) {
logger.print(", column " + e.getColumnNumber());
}
if (e.getSystemId() != null) {
logger.print(" of " + e.getSystemId());
}
} else {
if (e.getSystemId() != null) {
logger.print(" in " + e.getSystemId());
}
}
logger.println(":");
logger.println(" " + e.getMessage());
logger.flush();
} | [
"void",
"printError",
"(",
"String",
"type",
",",
"SAXParseException",
"e",
")",
"{",
"PrintWriter",
"logger",
"=",
"new",
"PrintWriter",
"(",
"System",
".",
"out",
")",
";",
"logger",
".",
"print",
"(",
"type",
")",
";",
"if",
"(",
"e",
".",
"getLineN... | Prints the error to STDOUT, used to be consistent with TEAM Engine error
handler. | [
"Prints",
"the",
"error",
"to",
"STDOUT",
"used",
"to",
"be",
"consistent",
"with",
"TEAM",
"Engine",
"error",
"handler",
"."
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/XmlErrorHandler.java#L83-L102 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.accessBase | Symbol accessBase(Symbol sym,
DiagnosticPosition pos,
Symbol location,
Type site,
Name name,
boolean qualified) {
return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper);
} | java | Symbol accessBase(Symbol sym,
DiagnosticPosition pos,
Symbol location,
Type site,
Name name,
boolean qualified) {
return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper);
} | [
"Symbol",
"accessBase",
"(",
"Symbol",
"sym",
",",
"DiagnosticPosition",
"pos",
",",
"Symbol",
"location",
",",
"Type",
"site",
",",
"Name",
"name",
",",
"boolean",
"qualified",
")",
"{",
"return",
"accessInternal",
"(",
"sym",
",",
"pos",
",",
"location",
... | Variant of the generalized access routine, to be used for generating variable,
type resolution diagnostics | [
"Variant",
"of",
"the",
"generalized",
"access",
"routine",
"to",
"be",
"used",
"for",
"generating",
"variable",
"type",
"resolution",
"diagnostics"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2485-L2492 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java | JobSchedulesImpl.listNextWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) {
return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudJobSchedule",
">",
",",
"JobScheduleListHeaders",
">",
">",
"listNextWithServiceResponseAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"JobScheduleListNextOptions",
"jobSchedul... | Lists all of the job schedules in the specified account.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param jobScheduleListNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CloudJobSchedule> object | [
"Lists",
"all",
"of",
"the",
"job",
"schedules",
"in",
"the",
"specified",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L2639-L2651 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetLearnedRoutes | public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | java | public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | [
"public",
"GatewayRouteListResultInner",
"beginGetLearnedRoutes",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetLearnedRoutesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
... | This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the GatewayRouteListResultInner object if successful. | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"has",
"learned",
"including",
"routes",
"learned",
"from",
"BGP",
"peers",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2407-L2409 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.isTrue | public void isTrue(final boolean expression, final String message, final Object... values) {
if (!expression) {
fail(String.format(message, values));
}
} | java | public void isTrue(final boolean expression, final String message, final Object... values) {
if (!expression) {
fail(String.format(message, values));
}
} | [
"public",
"void",
"isTrue",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"fail",
"(",
"String",
".",
"format",
"(",
"message",
",",
... | <p>Validate that the argument condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
<pre>
Validate.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);
Validate.isTrue(myObject.isOk(), "The object is not okay");
</pre>
@param expression
the boolean expression to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@throws IllegalArgumentValidationException
if expression is {@code false}
@see #isTrue(boolean)
@see #isTrue(boolean, String, long)
@see #isTrue(boolean, String, double) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L352-L356 |
dlew/joda-time-android | library/src/main/java/net/danlew/android/joda/DateUtils.java | DateUtils.getRelativeTimeSpanString | public static CharSequence getRelativeTimeSpanString(Context context, ReadableInstant time) {
int flags = FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_ABBREV_MONTH;
return getRelativeTimeSpanString(context, time, flags);
} | java | public static CharSequence getRelativeTimeSpanString(Context context, ReadableInstant time) {
int flags = FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_ABBREV_MONTH;
return getRelativeTimeSpanString(context, time, flags);
} | [
"public",
"static",
"CharSequence",
"getRelativeTimeSpanString",
"(",
"Context",
"context",
",",
"ReadableInstant",
"time",
")",
"{",
"int",
"flags",
"=",
"FORMAT_SHOW_DATE",
"|",
"FORMAT_SHOW_YEAR",
"|",
"FORMAT_ABBREV_MONTH",
";",
"return",
"getRelativeTimeSpanString",
... | Returns a string describing 'time' as a time relative to the current time.
@see #getRelativeTimeSpanString(Context, ReadableInstant, int) | [
"Returns",
"a",
"string",
"describing",
"time",
"as",
"a",
"time",
"relative",
"to",
"the",
"current",
"time",
"."
] | train | https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L222-L225 |
opoo/opoopress | core/src/main/java/org/opoo/press/util/ClassUtils.java | ClassUtils.newInstance | public static <T> T newInstance(String className, SiteConfig config) {
return newInstance(className, null, null, config);
} | java | public static <T> T newInstance(String className, SiteConfig config) {
return newInstance(className, null, null, config);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"String",
"className",
",",
"SiteConfig",
"config",
")",
"{",
"return",
"newInstance",
"(",
"className",
",",
"null",
",",
"null",
",",
"config",
")",
";",
"}"
] | Create a new instance for the specified class name.
@param className class name
@param config site config
@return new instance | [
"Create",
"a",
"new",
"instance",
"for",
"the",
"specified",
"class",
"name",
"."
] | train | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/util/ClassUtils.java#L55-L57 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java | SIBMBeanResultFactory.createSIBSubscription | public static MessagingSubscription createSIBSubscription(SIMPLocalSubscriptionControllable ls) {
long depth = 0;
String id = null;
int maxMsgs = 0;
String name = null;
String selector = null;
String subscriberId = null;
String[] topics = null;
depth = ls.getNumberOfQueuedMessages();
id = ls.getId();
name = ls.getName();
selector = ls.getSelector();
subscriberId = ls.getSubscriberID();
topics = ls.getTopics();
return new MessagingSubscription(depth, id, maxMsgs, name, selector, subscriberId, topics);
} | java | public static MessagingSubscription createSIBSubscription(SIMPLocalSubscriptionControllable ls) {
long depth = 0;
String id = null;
int maxMsgs = 0;
String name = null;
String selector = null;
String subscriberId = null;
String[] topics = null;
depth = ls.getNumberOfQueuedMessages();
id = ls.getId();
name = ls.getName();
selector = ls.getSelector();
subscriberId = ls.getSubscriberID();
topics = ls.getTopics();
return new MessagingSubscription(depth, id, maxMsgs, name, selector, subscriberId, topics);
} | [
"public",
"static",
"MessagingSubscription",
"createSIBSubscription",
"(",
"SIMPLocalSubscriptionControllable",
"ls",
")",
"{",
"long",
"depth",
"=",
"0",
";",
"String",
"id",
"=",
"null",
";",
"int",
"maxMsgs",
"=",
"0",
";",
"String",
"name",
"=",
"null",
";... | Create a MessagingSubscription instance from the supplied
SIMPLocalSubscriptionControllable.
@param ls
@return | [
"Create",
"a",
"MessagingSubscription",
"instance",
"from",
"the",
"supplied",
"SIMPLocalSubscriptionControllable",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java#L296-L314 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java | AbstractSearchStructure.indexVector | public synchronized boolean indexVector(String id, double[] vector) throws Exception {
long startIndexing = System.currentTimeMillis();
// check if we can index more vectors
if (loadCounter >= maxNumVectors) {
System.out.println("Maximum index capacity reached, no more vectors can be indexed!");
return false;
}
// check if name is already indexed
if (isIndexed(id)) {
System.out.println("Vector '" + id + "' already indexed!");
return false;
}
// do the indexing
// persist id to name and the reverse mapping
long startMapping = System.currentTimeMillis();
createMapping(id);
totalIdMappingTime += System.currentTimeMillis() - startMapping;
// method specific indexing
long startInternalIndexing = System.currentTimeMillis();
indexVectorInternal(vector);
totalInternalVectorIndexingTime += System.currentTimeMillis() - startInternalIndexing;
loadCounter++; // increase the loadCounter
if (loadCounter % 100 == 0) { // debug message
System.out.println(new Date() + " # indexed vectors: " + loadCounter);
}
totalVectorIndexingTime += System.currentTimeMillis() - startIndexing;
return true;
} | java | public synchronized boolean indexVector(String id, double[] vector) throws Exception {
long startIndexing = System.currentTimeMillis();
// check if we can index more vectors
if (loadCounter >= maxNumVectors) {
System.out.println("Maximum index capacity reached, no more vectors can be indexed!");
return false;
}
// check if name is already indexed
if (isIndexed(id)) {
System.out.println("Vector '" + id + "' already indexed!");
return false;
}
// do the indexing
// persist id to name and the reverse mapping
long startMapping = System.currentTimeMillis();
createMapping(id);
totalIdMappingTime += System.currentTimeMillis() - startMapping;
// method specific indexing
long startInternalIndexing = System.currentTimeMillis();
indexVectorInternal(vector);
totalInternalVectorIndexingTime += System.currentTimeMillis() - startInternalIndexing;
loadCounter++; // increase the loadCounter
if (loadCounter % 100 == 0) { // debug message
System.out.println(new Date() + " # indexed vectors: " + loadCounter);
}
totalVectorIndexingTime += System.currentTimeMillis() - startIndexing;
return true;
} | [
"public",
"synchronized",
"boolean",
"indexVector",
"(",
"String",
"id",
",",
"double",
"[",
"]",
"vector",
")",
"throws",
"Exception",
"{",
"long",
"startIndexing",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"// check if we can index more vectors\r",
... | Updates the index with the given vector. This is a synchronized method, i.e. when a thread calls this
method, all other threads wait for the first thread to complete before executing the method. This
ensures that the persistent BDB store will remain consistent when multiple threads call the indexVector
method.
@param id
The id of the vector
@param vector
The vector
@return True if the vector is successfully indexed, false otherwise.
@throws Exception | [
"Updates",
"the",
"index",
"with",
"the",
"given",
"vector",
".",
"This",
"is",
"a",
"synchronized",
"method",
"i",
".",
"e",
".",
"when",
"a",
"thread",
"calls",
"this",
"method",
"all",
"other",
"threads",
"wait",
"for",
"the",
"first",
"thread",
"to",... | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java#L229-L257 |
teatrove/teatrove | build-tools/teacompiler/teacompiler-maven-plugin/src/main/java/org/teatrove/maven/plugins/teacompiler/contextclassbuilder/DefaultContextClassBuilderHelper.java | DefaultContextClassBuilderHelper.getComponent | public Object getComponent(String role, String roleHint) throws ComponentLookupException {
return container.lookup(role, roleHint);
} | java | public Object getComponent(String role, String roleHint) throws ComponentLookupException {
return container.lookup(role, roleHint);
} | [
"public",
"Object",
"getComponent",
"(",
"String",
"role",
",",
"String",
"roleHint",
")",
"throws",
"ComponentLookupException",
"{",
"return",
"container",
".",
"lookup",
"(",
"role",
",",
"roleHint",
")",
";",
"}"
] | Gets the component.
@param role the role
@param roleHint the role hint
@return the component
@throws org.codehaus.plexus.component.repository.exception.ComponentLookupException
the component lookup exception | [
"Gets",
"the",
"component",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/teacompiler/teacompiler-maven-plugin/src/main/java/org/teatrove/maven/plugins/teacompiler/contextclassbuilder/DefaultContextClassBuilderHelper.java#L157-L159 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java | AbstractNewSarlElementWizardPage.isSarlFile | protected boolean isSarlFile(IPackageFragment packageFragment, String filename) {
if (isFileExists(packageFragment, filename, this.sarlFileExtension)) {
return true;
}
final IJavaProject project = getPackageFragmentRoot().getJavaProject();
if (project != null) {
try {
final String packageName = packageFragment.getElementName();
for (final IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
final IPackageFragment fragment = root.getPackageFragment(packageName);
if (isFileExists(fragment, filename, JAVA_FILE_EXTENSION)) {
return true;
}
}
} catch (JavaModelException exception) {
// silent error
}
}
return false;
} | java | protected boolean isSarlFile(IPackageFragment packageFragment, String filename) {
if (isFileExists(packageFragment, filename, this.sarlFileExtension)) {
return true;
}
final IJavaProject project = getPackageFragmentRoot().getJavaProject();
if (project != null) {
try {
final String packageName = packageFragment.getElementName();
for (final IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
final IPackageFragment fragment = root.getPackageFragment(packageName);
if (isFileExists(fragment, filename, JAVA_FILE_EXTENSION)) {
return true;
}
}
} catch (JavaModelException exception) {
// silent error
}
}
return false;
} | [
"protected",
"boolean",
"isSarlFile",
"(",
"IPackageFragment",
"packageFragment",
",",
"String",
"filename",
")",
"{",
"if",
"(",
"isFileExists",
"(",
"packageFragment",
",",
"filename",
",",
"this",
".",
"sarlFileExtension",
")",
")",
"{",
"return",
"true",
";"... | Replies if the given filename is a SARL script or a generated Java file.
@param packageFragment the package in which the file should be search for.
@param filename the filename to test.
@return <code>true</code> if a file (SALR or Java) with the given name exists. | [
"Replies",
"if",
"the",
"given",
"filename",
"is",
"a",
"SARL",
"script",
"or",
"a",
"generated",
"Java",
"file",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L347-L366 |
FudanNLP/fnlp | fnlp-app/src/main/java/org/fnlp/app/num/CNExpression.java | CNExpression.checkSuffix | private boolean checkSuffix(String str,Loc loc){
int len=str.length();
while(loc.v<len && this.strSuff.indexOf(str.charAt(loc.v))>=0)
loc.v++;
while(loc.v<len && this.strPunctuation.indexOf(str.charAt(loc.v))>=0)
loc.v++;
if(loc.v<len)
return false;
else
return true;
} | java | private boolean checkSuffix(String str,Loc loc){
int len=str.length();
while(loc.v<len && this.strSuff.indexOf(str.charAt(loc.v))>=0)
loc.v++;
while(loc.v<len && this.strPunctuation.indexOf(str.charAt(loc.v))>=0)
loc.v++;
if(loc.v<len)
return false;
else
return true;
} | [
"private",
"boolean",
"checkSuffix",
"(",
"String",
"str",
",",
"Loc",
"loc",
")",
"{",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"while",
"(",
"loc",
".",
"v",
"<",
"len",
"&&",
"this",
".",
"strSuff",
".",
"indexOf",
"(",
"str",
"... | 检查一个字符串从指定位置开始的中文标示是否符号一个算术表达式的后缀询问部分
@param str 字符串
@param loc 指定位置
@return 符合则返回true 不符合返回false | [
"检查一个字符串从指定位置开始的中文标示是否符号一个算术表达式的后缀询问部分"
] | train | https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-app/src/main/java/org/fnlp/app/num/CNExpression.java#L250-L260 |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/RoundRobinDnsAddressResolverGroup.java | RoundRobinDnsAddressResolverGroup.newAddressResolver | @Override
protected final AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop,
NameResolver<InetAddress> resolver)
throws Exception {
return new RoundRobinInetAddressResolver(eventLoop, resolver).asAddressResolver();
} | java | @Override
protected final AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop,
NameResolver<InetAddress> resolver)
throws Exception {
return new RoundRobinInetAddressResolver(eventLoop, resolver).asAddressResolver();
} | [
"@",
"Override",
"protected",
"final",
"AddressResolver",
"<",
"InetSocketAddress",
">",
"newAddressResolver",
"(",
"EventLoop",
"eventLoop",
",",
"NameResolver",
"<",
"InetAddress",
">",
"resolver",
")",
"throws",
"Exception",
"{",
"return",
"new",
"RoundRobinInetAdd... | We need to override this method, not
{@link #newNameResolver(EventLoop, ChannelFactory, DnsServerAddressStreamProvider)},
because we need to eliminate possible caching of {@link io.netty.resolver.NameResolver#resolve}
by {@link InflightNameResolver} created in
{@link #newResolver(EventLoop, ChannelFactory, DnsServerAddressStreamProvider)}. | [
"We",
"need",
"to",
"override",
"this",
"method",
"not",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/RoundRobinDnsAddressResolverGroup.java#L62-L67 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java | AbstractRadial.create_FOREGROUND_Image | protected BufferedImage create_FOREGROUND_Image(final int WIDTH, final boolean WITH_CENTER_KNOB, final ForegroundType TYPE) {
return create_FOREGROUND_Image(WIDTH, WITH_CENTER_KNOB, TYPE, null);
} | java | protected BufferedImage create_FOREGROUND_Image(final int WIDTH, final boolean WITH_CENTER_KNOB, final ForegroundType TYPE) {
return create_FOREGROUND_Image(WIDTH, WITH_CENTER_KNOB, TYPE, null);
} | [
"protected",
"BufferedImage",
"create_FOREGROUND_Image",
"(",
"final",
"int",
"WIDTH",
",",
"final",
"boolean",
"WITH_CENTER_KNOB",
",",
"final",
"ForegroundType",
"TYPE",
")",
"{",
"return",
"create_FOREGROUND_Image",
"(",
"WIDTH",
",",
"WITH_CENTER_KNOB",
",",
"TYPE... | Returns the image of the selected (FG_TYPE1, FG_TYPE2, FG_TYPE3) glasseffect, the centered knob (if wanted)
@param WIDTH
@param WITH_CENTER_KNOB
@param TYPE
@return the foreground image that will be used | [
"Returns",
"the",
"image",
"of",
"the",
"selected",
"(",
"FG_TYPE1",
"FG_TYPE2",
"FG_TYPE3",
")",
"glasseffect",
"the",
"centered",
"knob",
"(",
"if",
"wanted",
")"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L3058-L3060 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/HandlablesImpl.java | HandlablesImpl.addSuperClass | private void addSuperClass(Object object, Class<?> type)
{
for (final Class<?> types : type.getInterfaces())
{
addType(types, object);
}
final Class<?> parent = type.getSuperclass();
if (parent != null)
{
addSuperClass(object, parent);
}
} | java | private void addSuperClass(Object object, Class<?> type)
{
for (final Class<?> types : type.getInterfaces())
{
addType(types, object);
}
final Class<?> parent = type.getSuperclass();
if (parent != null)
{
addSuperClass(object, parent);
}
} | [
"private",
"void",
"addSuperClass",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"for",
"(",
"final",
"Class",
"<",
"?",
">",
"types",
":",
"type",
".",
"getInterfaces",
"(",
")",
")",
"{",
"addType",
"(",
"types",
",",
"... | Add object parent super type.
@param object The current object to check.
@param type The current class level to check. | [
"Add",
"object",
"parent",
"super",
"type",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/HandlablesImpl.java#L139-L150 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java | HttpFileServiceBuilder.forClassPath | public static HttpFileServiceBuilder forClassPath(ClassLoader classLoader, String rootDir) {
return forVfs(HttpVfs.ofClassPath(classLoader, rootDir));
} | java | public static HttpFileServiceBuilder forClassPath(ClassLoader classLoader, String rootDir) {
return forVfs(HttpVfs.ofClassPath(classLoader, rootDir));
} | [
"public",
"static",
"HttpFileServiceBuilder",
"forClassPath",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"rootDir",
")",
"{",
"return",
"forVfs",
"(",
"HttpVfs",
".",
"ofClassPath",
"(",
"classLoader",
",",
"rootDir",
")",
")",
";",
"}"
] | Creates a new {@link HttpFileServiceBuilder} with the specified {@code rootDir} in the current class
path. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java#L69-L71 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/reflection/DynamicClassFactory.java | DynamicClassFactory.createInstance | public final static <T> T createInstance(String className, Class<T> expectedType, boolean useCache) throws CompilationException, ClassLoadException {
try {
Object o = createInstance(getCompiledClass(className, useCache)); // a check to see if the class exists
T instance = expectedType.cast(o); // a check to see if the class is actually a correct subclass
return instance ;
} catch (CompilationException | ClassLoadException e) {
throw e;
} catch (ClassCastException e) {
//from cast()
throw new ClassLoadException("Class: " + className + " is not the expected type, are you sure it extends " + expectedType.getName() + "?");
} catch (Exception e) {
throw new ClassLoadException(e);
}
} | java | public final static <T> T createInstance(String className, Class<T> expectedType, boolean useCache) throws CompilationException, ClassLoadException {
try {
Object o = createInstance(getCompiledClass(className, useCache)); // a check to see if the class exists
T instance = expectedType.cast(o); // a check to see if the class is actually a correct subclass
return instance ;
} catch (CompilationException | ClassLoadException e) {
throw e;
} catch (ClassCastException e) {
//from cast()
throw new ClassLoadException("Class: " + className + " is not the expected type, are you sure it extends " + expectedType.getName() + "?");
} catch (Exception e) {
throw new ClassLoadException(e);
}
} | [
"public",
"final",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"String",
"className",
",",
"Class",
"<",
"T",
">",
"expectedType",
",",
"boolean",
"useCache",
")",
"throws",
"CompilationException",
",",
"ClassLoadException",
"{",
"try",
"{",
"Object",... | Loads and instantiates the class into the stated <code>expectedType</code>.
@param className Full name of the class including package name
@param expectedType The type to convert the class into
@param useCache flag to specify whether to cache the class or not
@return The newly instantiated class
@throws CompilationException If the class could not be successfully compiled
@throws ClassLoadException | [
"Loads",
"and",
"instantiates",
"the",
"class",
"into",
"the",
"stated",
"<code",
">",
"expectedType<",
"/",
"code",
">",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/reflection/DynamicClassFactory.java#L40-L53 |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java | ExternalShuffleBlockHandler.reregisterExecutor | public void reregisterExecutor(AppExecId appExecId, ExecutorShuffleInfo executorInfo) {
blockManager.registerExecutor(appExecId.appId, appExecId.execId, executorInfo);
} | java | public void reregisterExecutor(AppExecId appExecId, ExecutorShuffleInfo executorInfo) {
blockManager.registerExecutor(appExecId.appId, appExecId.execId, executorInfo);
} | [
"public",
"void",
"reregisterExecutor",
"(",
"AppExecId",
"appExecId",
",",
"ExecutorShuffleInfo",
"executorInfo",
")",
"{",
"blockManager",
".",
"registerExecutor",
"(",
"appExecId",
".",
"appId",
",",
"appExecId",
".",
"execId",
",",
"executorInfo",
")",
";",
"}... | Register an (application, executor) with the given shuffle info.
The "re-" is meant to highlight the intended use of this method -- when this service is
restarted, this is used to restore the state of executors from before the restart. Normal
registration will happen via a message handled in receive()
@param appExecId
@param executorInfo | [
"Register",
"an",
"(",
"application",
"executor",
")",
"with",
"the",
"given",
"shuffle",
"info",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java#L164-L166 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysqlQuery.java | CheckMysqlQuery.gatherMetrics | public final Collection<Metric> gatherMetrics(final ICommandLine cl) throws MetricGatheringException {
LOG.debug(getContext(), "check_mysql_query gather metrics");
List<Metric> metrics = new ArrayList<Metric>();
Mysql mysql = new Mysql(cl);
Connection conn = null;
try {
conn = mysql.getConnection();
} catch (ClassNotFoundException e) {
LOG.error(getContext(), "Mysql driver library not found into the classpath" + ": download and put it in the same directory " + "of this plugin");
throw new MetricGatheringException("CHECK_MYSQL_QUERY - CRITICAL: Error accessing the " + "MySQL server - JDBC driver not installed",
Status.CRITICAL, e);
} catch (Exception e) {
LOG.error(getContext(), "Error accessing the MySQL server", e);
throw new MetricGatheringException("CHECK_MYSQL_QUERY - CRITICAL: Error accessing " + "the MySQL server - " + e.getMessage(),
Status.CRITICAL, e);
}
String query = cl.getOptionValue("query");
Statement st = null;
ResultSet set = null;
try {
st = conn.createStatement();
st.execute(query);
set = st.getResultSet();
BigDecimal value = null;
if (set.first()) {
value = set.getBigDecimal(1);
}
metrics.add(new Metric("rows", "CHECK_MYSQL_QUERY - Returned value is " + (value != null ? value.longValue() : null), value, null, null));
} catch (SQLException e) {
String message = e.getMessage();
LOG.warn(getContext(), "Error executing plugin CheckMysqlQuery : " + message, e);
throw new MetricGatheringException("CHECK_MYSQL_QUERY - CRITICAL: " + message, Status.CRITICAL, e);
} finally {
DBUtils.closeQuietly(set);
DBUtils.closeQuietly(st);
DBUtils.closeQuietly(conn);
}
return metrics;
} | java | public final Collection<Metric> gatherMetrics(final ICommandLine cl) throws MetricGatheringException {
LOG.debug(getContext(), "check_mysql_query gather metrics");
List<Metric> metrics = new ArrayList<Metric>();
Mysql mysql = new Mysql(cl);
Connection conn = null;
try {
conn = mysql.getConnection();
} catch (ClassNotFoundException e) {
LOG.error(getContext(), "Mysql driver library not found into the classpath" + ": download and put it in the same directory " + "of this plugin");
throw new MetricGatheringException("CHECK_MYSQL_QUERY - CRITICAL: Error accessing the " + "MySQL server - JDBC driver not installed",
Status.CRITICAL, e);
} catch (Exception e) {
LOG.error(getContext(), "Error accessing the MySQL server", e);
throw new MetricGatheringException("CHECK_MYSQL_QUERY - CRITICAL: Error accessing " + "the MySQL server - " + e.getMessage(),
Status.CRITICAL, e);
}
String query = cl.getOptionValue("query");
Statement st = null;
ResultSet set = null;
try {
st = conn.createStatement();
st.execute(query);
set = st.getResultSet();
BigDecimal value = null;
if (set.first()) {
value = set.getBigDecimal(1);
}
metrics.add(new Metric("rows", "CHECK_MYSQL_QUERY - Returned value is " + (value != null ? value.longValue() : null), value, null, null));
} catch (SQLException e) {
String message = e.getMessage();
LOG.warn(getContext(), "Error executing plugin CheckMysqlQuery : " + message, e);
throw new MetricGatheringException("CHECK_MYSQL_QUERY - CRITICAL: " + message, Status.CRITICAL, e);
} finally {
DBUtils.closeQuietly(set);
DBUtils.closeQuietly(st);
DBUtils.closeQuietly(conn);
}
return metrics;
} | [
"public",
"final",
"Collection",
"<",
"Metric",
">",
"gatherMetrics",
"(",
"final",
"ICommandLine",
"cl",
")",
"throws",
"MetricGatheringException",
"{",
"LOG",
".",
"debug",
"(",
"getContext",
"(",
")",
",",
"\"check_mysql_query gather metrics\"",
")",
";",
"List... | Execute and gather metrics.
@param cl
the command line
@throws MetricGatheringException
on any error gathering metrics
@return the metrics | [
"Execute",
"and",
"gather",
"metrics",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysqlQuery.java#L63-L106 |
milaboratory/milib | src/main/java/com/milaboratory/core/sequence/SequenceQuality.java | SequenceQuality.getRange | @Override
public SequenceQuality getRange(Range range) {
byte[] rdata = Arrays.copyOfRange(data, range.getLower(), range.getUpper());
if (range.isReverse())
ArraysUtils.reverse(rdata);
return new SequenceQuality(rdata, true);
} | java | @Override
public SequenceQuality getRange(Range range) {
byte[] rdata = Arrays.copyOfRange(data, range.getLower(), range.getUpper());
if (range.isReverse())
ArraysUtils.reverse(rdata);
return new SequenceQuality(rdata, true);
} | [
"@",
"Override",
"public",
"SequenceQuality",
"getRange",
"(",
"Range",
"range",
")",
"{",
"byte",
"[",
"]",
"rdata",
"=",
"Arrays",
".",
"copyOfRange",
"(",
"data",
",",
"range",
".",
"getLower",
"(",
")",
",",
"range",
".",
"getUpper",
"(",
")",
")",... | Returns substring of current quality scores line.
@param range range
@return substring of current quality scores line | [
"Returns",
"substring",
"of",
"current",
"quality",
"scores",
"line",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequenceQuality.java#L202-L208 |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.getBinaryContent | private Response getBinaryContent(final String rangeValue, final FedoraResource resource)
throws IOException {
final FedoraBinary binary = (FedoraBinary)resource;
final CacheControl cc = new CacheControl();
cc.setMaxAge(0);
cc.setMustRevalidate(true);
final Response.ResponseBuilder builder;
if (rangeValue != null && rangeValue.startsWith("bytes")) {
final Range range = Range.convert(rangeValue);
final long contentSize = binary.getContentSize();
final String endAsString;
if (range.end() == -1) {
endAsString = Long.toString(contentSize - 1);
} else {
endAsString = Long.toString(range.end());
}
final String contentRangeValue =
String.format("bytes %s-%s/%s", range.start(),
endAsString, contentSize);
if (range.end() > contentSize ||
(range.end() == -1 && range.start() > contentSize)) {
builder = status(REQUESTED_RANGE_NOT_SATISFIABLE)
.header("Content-Range", contentRangeValue);
} else {
@SuppressWarnings("resource")
final RangeRequestInputStream rangeInputStream =
new RangeRequestInputStream(binary.getContent(), range.start(), range.size());
builder = status(PARTIAL_CONTENT).entity(rangeInputStream)
.header("Content-Range", contentRangeValue)
.header(CONTENT_LENGTH, range.size());
}
} else {
@SuppressWarnings("resource")
final InputStream content = binary.getContent();
builder = ok(content);
}
// we set the content-type explicitly to avoid content-negotiation from getting in the way
// getBinaryResourceMediaType will try to use the mime type on the resource, falling back on
// 'application/octet-stream' if the mime type is syntactically invalid
return builder.type(getBinaryResourceMediaType(resource).toString())
.cacheControl(cc)
.build();
} | java | private Response getBinaryContent(final String rangeValue, final FedoraResource resource)
throws IOException {
final FedoraBinary binary = (FedoraBinary)resource;
final CacheControl cc = new CacheControl();
cc.setMaxAge(0);
cc.setMustRevalidate(true);
final Response.ResponseBuilder builder;
if (rangeValue != null && rangeValue.startsWith("bytes")) {
final Range range = Range.convert(rangeValue);
final long contentSize = binary.getContentSize();
final String endAsString;
if (range.end() == -1) {
endAsString = Long.toString(contentSize - 1);
} else {
endAsString = Long.toString(range.end());
}
final String contentRangeValue =
String.format("bytes %s-%s/%s", range.start(),
endAsString, contentSize);
if (range.end() > contentSize ||
(range.end() == -1 && range.start() > contentSize)) {
builder = status(REQUESTED_RANGE_NOT_SATISFIABLE)
.header("Content-Range", contentRangeValue);
} else {
@SuppressWarnings("resource")
final RangeRequestInputStream rangeInputStream =
new RangeRequestInputStream(binary.getContent(), range.start(), range.size());
builder = status(PARTIAL_CONTENT).entity(rangeInputStream)
.header("Content-Range", contentRangeValue)
.header(CONTENT_LENGTH, range.size());
}
} else {
@SuppressWarnings("resource")
final InputStream content = binary.getContent();
builder = ok(content);
}
// we set the content-type explicitly to avoid content-negotiation from getting in the way
// getBinaryResourceMediaType will try to use the mime type on the resource, falling back on
// 'application/octet-stream' if the mime type is syntactically invalid
return builder.type(getBinaryResourceMediaType(resource).toString())
.cacheControl(cc)
.build();
} | [
"private",
"Response",
"getBinaryContent",
"(",
"final",
"String",
"rangeValue",
",",
"final",
"FedoraResource",
"resource",
")",
"throws",
"IOException",
"{",
"final",
"FedoraBinary",
"binary",
"=",
"(",
"FedoraBinary",
")",
"resource",
";",
"final",
"CacheControl"... | Get the binary content of a datastream
@param rangeValue the range value
@param resource the fedora resource
@return Binary blob
@throws IOException if io exception occurred | [
"Get",
"the",
"binary",
"content",
"of",
"a",
"datastream"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L395-L450 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagScaleImage.java | CmsJspTagScaleImage.imageTagAction | public static CmsJspImageBean imageTagAction(
CmsObject cms,
String imageUri,
CmsImageScaler targetScaler,
List<String> hiDpiVariantList)
throws CmsException {
CmsJspImageBean image = new CmsJspImageBean(cms, imageUri, targetScaler);
// now handle (preset) hi-DPI variants
if ((hiDpiVariantList != null) && (hiDpiVariantList.size() > 0)) {
for (String hiDpiVariant : hiDpiVariantList) {
CmsJspImageBean hiDpiVersion = image.createHiDpiVariation(hiDpiVariant);
if (hiDpiVersion != null) {
image.addHiDpiImage(hiDpiVariant, hiDpiVersion);
}
}
}
return image;
} | java | public static CmsJspImageBean imageTagAction(
CmsObject cms,
String imageUri,
CmsImageScaler targetScaler,
List<String> hiDpiVariantList)
throws CmsException {
CmsJspImageBean image = new CmsJspImageBean(cms, imageUri, targetScaler);
// now handle (preset) hi-DPI variants
if ((hiDpiVariantList != null) && (hiDpiVariantList.size() > 0)) {
for (String hiDpiVariant : hiDpiVariantList) {
CmsJspImageBean hiDpiVersion = image.createHiDpiVariation(hiDpiVariant);
if (hiDpiVersion != null) {
image.addHiDpiImage(hiDpiVariant, hiDpiVersion);
}
}
}
return image;
} | [
"public",
"static",
"CmsJspImageBean",
"imageTagAction",
"(",
"CmsObject",
"cms",
",",
"String",
"imageUri",
",",
"CmsImageScaler",
"targetScaler",
",",
"List",
"<",
"String",
">",
"hiDpiVariantList",
")",
"throws",
"CmsException",
"{",
"CmsJspImageBean",
"image",
"... | Internal action method to create the scaled image bean.<p>
@param cms the cms context
@param imageUri the image URI
@param targetScaler the target image scaler
@param hiDpiVariantList optional list of hi-DPI variant sizes to produce, e.g. 1.3x, 1.5x, 2x, 3x
@return the created ScaledImageBean bean
@throws CmsException in case something goes wrong | [
"Internal",
"action",
"method",
"to",
"create",
"the",
"scaled",
"image",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagScaleImage.java#L101-L122 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJAreaChartBuilder.java | DJAreaChartBuilder.addSerie | public DJAreaChartBuilder addSerie(AbstractColumn column, String label) {
getDataset().addSerie(column, label);
return this;
} | java | public DJAreaChartBuilder addSerie(AbstractColumn column, String label) {
getDataset().addSerie(column, label);
return this;
} | [
"public",
"DJAreaChartBuilder",
"addSerie",
"(",
"AbstractColumn",
"column",
",",
"String",
"label",
")",
"{",
"getDataset",
"(",
")",
".",
"addSerie",
"(",
"column",
",",
"label",
")",
";",
"return",
"this",
";",
"}"
] | Adds the specified serie column to the dataset with custom label.
@param column the serie column
@param label column the custom label | [
"Adds",
"the",
"specified",
"serie",
"column",
"to",
"the",
"dataset",
"with",
"custom",
"label",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJAreaChartBuilder.java#L366-L369 |
facebookarchive/hadoop-20 | src/contrib/streaming/src/java/org/apache/hadoop/streaming/StreamUtil.java | StreamUtil.goodClassOrNull | public static Class goodClassOrNull(Configuration conf, String className, String defaultPackage) {
if (className.indexOf('.') == -1 && defaultPackage != null) {
className = defaultPackage + "." + className;
}
Class clazz = null;
try {
clazz = conf.getClassByName(className);
} catch (ClassNotFoundException cnf) {
}
return clazz;
} | java | public static Class goodClassOrNull(Configuration conf, String className, String defaultPackage) {
if (className.indexOf('.') == -1 && defaultPackage != null) {
className = defaultPackage + "." + className;
}
Class clazz = null;
try {
clazz = conf.getClassByName(className);
} catch (ClassNotFoundException cnf) {
}
return clazz;
} | [
"public",
"static",
"Class",
"goodClassOrNull",
"(",
"Configuration",
"conf",
",",
"String",
"className",
",",
"String",
"defaultPackage",
")",
"{",
"if",
"(",
"className",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
"&&",
"defaultPackage",
"!=",
"... | It may seem strange to silently switch behaviour when a String
is not a classname; the reason is simplified Usage:<pre>
-mapper [classname | program ]
instead of the explicit Usage:
[-mapper program | -javamapper classname], -mapper and -javamapper are mutually exclusive.
(repeat for -reducer, -combiner) </pre> | [
"It",
"may",
"seem",
"strange",
"to",
"silently",
"switch",
"behaviour",
"when",
"a",
"String",
"is",
"not",
"a",
"classname",
";",
"the",
"reason",
"is",
"simplified",
"Usage",
":",
"<pre",
">",
"-",
"mapper",
"[",
"classname",
"|",
"program",
"]",
"ins... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/streaming/src/java/org/apache/hadoop/streaming/StreamUtil.java#L55-L65 |
neo4j/neo4j-java-driver | driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java | CertificateTool.saveX509Cert | public static void saveX509Cert( String certStr, File certFile ) throws IOException
{
try ( BufferedWriter writer = new BufferedWriter( new FileWriter( certFile ) ) )
{
writer.write( BEGIN_CERT );
writer.newLine();
writer.write( certStr );
writer.newLine();
writer.write( END_CERT );
writer.newLine();
}
} | java | public static void saveX509Cert( String certStr, File certFile ) throws IOException
{
try ( BufferedWriter writer = new BufferedWriter( new FileWriter( certFile ) ) )
{
writer.write( BEGIN_CERT );
writer.newLine();
writer.write( certStr );
writer.newLine();
writer.write( END_CERT );
writer.newLine();
}
} | [
"public",
"static",
"void",
"saveX509Cert",
"(",
"String",
"certStr",
",",
"File",
"certFile",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"certFile",
")",
")",
")",
... | Save a certificate to a file in base 64 binary format with BEGIN and END strings
@param certStr
@param certFile
@throws IOException | [
"Save",
"a",
"certificate",
"to",
"a",
"file",
"in",
"base",
"64",
"binary",
"format",
"with",
"BEGIN",
"and",
"END",
"strings"
] | train | https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java#L49-L62 |
jhalterman/lyra | src/main/java/net/jodah/lyra/internal/ChannelHandler.java | ChannelHandler.recoverRelatedExchanges | private void recoverRelatedExchanges(Set<String> recoveredExchanges, List<Binding> queueBindings)
throws Exception {
if (config.isExchangeRecoveryEnabled() && queueBindings != null)
synchronized (queueBindings) {
for (Binding queueBinding : queueBindings) {
String exchangeName = queueBinding.source;
if (recoveredExchanges.add(exchangeName)) {
ResourceDeclaration exchangeDeclaration = connectionHandler.exchangeDeclarations.get(exchangeName);
if (exchangeDeclaration != null)
recoverExchange(exchangeName, exchangeDeclaration);
recoverExchangeBindings(connectionHandler.exchangeBindings.get(exchangeName));
}
}
}
} | java | private void recoverRelatedExchanges(Set<String> recoveredExchanges, List<Binding> queueBindings)
throws Exception {
if (config.isExchangeRecoveryEnabled() && queueBindings != null)
synchronized (queueBindings) {
for (Binding queueBinding : queueBindings) {
String exchangeName = queueBinding.source;
if (recoveredExchanges.add(exchangeName)) {
ResourceDeclaration exchangeDeclaration = connectionHandler.exchangeDeclarations.get(exchangeName);
if (exchangeDeclaration != null)
recoverExchange(exchangeName, exchangeDeclaration);
recoverExchangeBindings(connectionHandler.exchangeBindings.get(exchangeName));
}
}
}
} | [
"private",
"void",
"recoverRelatedExchanges",
"(",
"Set",
"<",
"String",
">",
"recoveredExchanges",
",",
"List",
"<",
"Binding",
">",
"queueBindings",
")",
"throws",
"Exception",
"{",
"if",
"(",
"config",
".",
"isExchangeRecoveryEnabled",
"(",
")",
"&&",
"queueB... | Recovers exchanges and bindings related to the {@code queueBindings} that are not present in
{@code recoveredExchanges}, adding recovered exchanges to the {@code recoveredExchanges}. | [
"Recovers",
"exchanges",
"and",
"bindings",
"related",
"to",
"the",
"{"
] | train | https://github.com/jhalterman/lyra/blob/ce347a69357fef1b34e92d92a4f9e68792d81255/src/main/java/net/jodah/lyra/internal/ChannelHandler.java#L454-L468 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/registry/ClientRegistry.java | ClientRegistry.getBlockRendererOverride | private IBlockRenderer getBlockRendererOverride(IBlockAccess world, BlockPos pos, IBlockState state)
{
for (BlockRendererOverride overrides : blockRendererOverrides)
{
IBlockRenderer renderer = overrides.get(world, pos, state);
if (renderer != null)
return renderer;
}
return null;
} | java | private IBlockRenderer getBlockRendererOverride(IBlockAccess world, BlockPos pos, IBlockState state)
{
for (BlockRendererOverride overrides : blockRendererOverrides)
{
IBlockRenderer renderer = overrides.get(world, pos, state);
if (renderer != null)
return renderer;
}
return null;
} | [
"private",
"IBlockRenderer",
"getBlockRendererOverride",
"(",
"IBlockAccess",
"world",
",",
"BlockPos",
"pos",
",",
"IBlockState",
"state",
")",
"{",
"for",
"(",
"BlockRendererOverride",
"overrides",
":",
"blockRendererOverrides",
")",
"{",
"IBlockRenderer",
"renderer",... | Gets the {@link BlockRendererOverride} for the {@link IBlockState} at the {@link BlockPos}.
@param world the world
@param pos the pos
@param state the state
@return the block renderer override | [
"Gets",
"the",
"{",
"@link",
"BlockRendererOverride",
"}",
"for",
"the",
"{",
"@link",
"IBlockState",
"}",
"at",
"the",
"{",
"@link",
"BlockPos",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/ClientRegistry.java#L260-L270 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.allOf | @SafeVarargs
public static <T extends Tree> Matcher<T> allOf(final Matcher<? super T>... matchers) {
return new Matcher<T>() {
@Override
public boolean matches(T t, VisitorState state) {
for (Matcher<? super T> matcher : matchers) {
if (!matcher.matches(t, state)) {
return false;
}
}
return true;
}
};
} | java | @SafeVarargs
public static <T extends Tree> Matcher<T> allOf(final Matcher<? super T>... matchers) {
return new Matcher<T>() {
@Override
public boolean matches(T t, VisitorState state) {
for (Matcher<? super T> matcher : matchers) {
if (!matcher.matches(t, state)) {
return false;
}
}
return true;
}
};
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
"extends",
"Tree",
">",
"Matcher",
"<",
"T",
">",
"allOf",
"(",
"final",
"Matcher",
"<",
"?",
"super",
"T",
">",
"...",
"matchers",
")",
"{",
"return",
"new",
"Matcher",
"<",
"T",
">",
"(",
")",
"{"... | Compose several matchers together, such that the composite matches an AST node iff all the
given matchers do. | [
"Compose",
"several",
"matchers",
"together",
"such",
"that",
"the",
"composite",
"matches",
"an",
"AST",
"node",
"iff",
"all",
"the",
"given",
"matchers",
"do",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L131-L144 |
Wikidata/Wikidata-Toolkit | wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java | TermStatementUpdate.processDescriptions | protected void processDescriptions(List<MonolingualTextValue> descriptions) {
for(MonolingualTextValue description : descriptions) {
NameWithUpdate currentValue = newDescriptions.get(description.getLanguageCode());
// only mark the description as added if the value we are writing is different from the current one
if (currentValue == null || !currentValue.value.equals(description)) {
newDescriptions.put(description.getLanguageCode(),
new NameWithUpdate(description, true));
}
}
} | java | protected void processDescriptions(List<MonolingualTextValue> descriptions) {
for(MonolingualTextValue description : descriptions) {
NameWithUpdate currentValue = newDescriptions.get(description.getLanguageCode());
// only mark the description as added if the value we are writing is different from the current one
if (currentValue == null || !currentValue.value.equals(description)) {
newDescriptions.put(description.getLanguageCode(),
new NameWithUpdate(description, true));
}
}
} | [
"protected",
"void",
"processDescriptions",
"(",
"List",
"<",
"MonolingualTextValue",
">",
"descriptions",
")",
"{",
"for",
"(",
"MonolingualTextValue",
"description",
":",
"descriptions",
")",
"{",
"NameWithUpdate",
"currentValue",
"=",
"newDescriptions",
".",
"get",... | Adds descriptions to the item.
@param descriptions
the descriptions to add | [
"Adds",
"descriptions",
"to",
"the",
"item",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/TermStatementUpdate.java#L232-L241 |
orhanobut/wasp | wasp/src/main/java/com/orhanobut/wasp/NetworkHandler.java | NetworkHandler.getMethodsRecursive | private static void getMethodsRecursive(Class<?> service, List<Method> methods) {
Collections.addAll(methods, service.getDeclaredMethods());
} | java | private static void getMethodsRecursive(Class<?> service, List<Method> methods) {
Collections.addAll(methods, service.getDeclaredMethods());
} | [
"private",
"static",
"void",
"getMethodsRecursive",
"(",
"Class",
"<",
"?",
">",
"service",
",",
"List",
"<",
"Method",
">",
"methods",
")",
"{",
"Collections",
".",
"addAll",
"(",
"methods",
",",
"service",
".",
"getDeclaredMethods",
"(",
")",
")",
";",
... | Fills {@code proxiedMethods} with the methods of {@code interfaces} and
the interfaces they extend. May contain duplicates. | [
"Fills",
"{"
] | train | https://github.com/orhanobut/wasp/blob/295d8747aa7e410b185a620a6b87239816a38c11/wasp/src/main/java/com/orhanobut/wasp/NetworkHandler.java#L65-L67 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleGetRequest | private static BinaryMemcacheRequest handleGetRequest(final ChannelHandlerContext ctx, final GetRequest msg) {
byte opcode;
ByteBuf extras;
if (msg.lock()) {
opcode = OP_GET_AND_LOCK;
extras = ctx.alloc().buffer().writeInt(msg.expiry());
} else if (msg.touch()) {
opcode = OP_GET_AND_TOUCH;
extras = ctx.alloc().buffer().writeInt(msg.expiry());
} else {
opcode = OP_GET;
extras = Unpooled.EMPTY_BUFFER;
}
byte[] key = msg.keyBytes();
short keyLength = (short) key.length;
byte extrasLength = (byte) extras.readableBytes();
BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key);
request
.setOpcode(opcode)
.setKeyLength(keyLength)
.setExtras(extras)
.setExtrasLength(extrasLength)
.setTotalBodyLength(keyLength + extrasLength);
return request;
} | java | private static BinaryMemcacheRequest handleGetRequest(final ChannelHandlerContext ctx, final GetRequest msg) {
byte opcode;
ByteBuf extras;
if (msg.lock()) {
opcode = OP_GET_AND_LOCK;
extras = ctx.alloc().buffer().writeInt(msg.expiry());
} else if (msg.touch()) {
opcode = OP_GET_AND_TOUCH;
extras = ctx.alloc().buffer().writeInt(msg.expiry());
} else {
opcode = OP_GET;
extras = Unpooled.EMPTY_BUFFER;
}
byte[] key = msg.keyBytes();
short keyLength = (short) key.length;
byte extrasLength = (byte) extras.readableBytes();
BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key);
request
.setOpcode(opcode)
.setKeyLength(keyLength)
.setExtras(extras)
.setExtrasLength(extrasLength)
.setTotalBodyLength(keyLength + extrasLength);
return request;
} | [
"private",
"static",
"BinaryMemcacheRequest",
"handleGetRequest",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"GetRequest",
"msg",
")",
"{",
"byte",
"opcode",
";",
"ByteBuf",
"extras",
";",
"if",
"(",
"msg",
".",
"lock",
"(",
")",
")",
"{",
"... | Encodes a {@link GetRequest} into its lower level representation.
Depending on the flags set on the {@link GetRequest}, the appropriate opcode gets chosen. Currently, a regular
get, as well as "get and touch" and "get and lock" are supported. Latter variants have server-side side-effects
but do not differ in response behavior.
@param ctx the {@link ChannelHandlerContext} to use for allocation and others.
@param msg the incoming message.
@return a ready {@link BinaryMemcacheRequest}. | [
"Encodes",
"a",
"{",
"@link",
"GetRequest",
"}",
"into",
"its",
"lower",
"level",
"representation",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L488-L513 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/AbstractSelectCodeGenerator.java | AbstractSelectCodeGenerator.generateSubQueries | protected void generateSubQueries(Builder methodBuilder, SQLiteModelMethod method) {
SQLiteEntity entity = method.getEntity();
for (Triple<String, String, SQLiteModelMethod> item : method.childrenSelects) {
TypeName entityTypeName = TypeUtility.typeName(entity.getElement());
String setter;
if (entity.isImmutablePojo()) {
String idGetter = ImmutableUtility.IMMUTABLE_PREFIX + entity.getPrimaryKey().getName();
setter = ImmutableUtility.IMMUTABLE_PREFIX + entity.findRelationByParentProperty(item.value0).value0.getName() + "="
+ String.format("this.daoFactory.get%s().%s(%s)", item.value2.getParent().getName(), item.value2.getName(), idGetter);
} else {
String idGetter = PropertyUtility.getter("resultBean", entityTypeName, entity.getPrimaryKey());
setter = PropertyUtility.setter(entityTypeName, "resultBean", entity.findRelationByParentProperty(item.value0).value0,
String.format("this.daoFactory.get%s().%s(%s)", item.value2.getParent().getName(), item.value2.getName(), idGetter));
}
methodBuilder.addComment("sub query: $L", setter);
methodBuilder.addStatement("$L", setter);
}
} | java | protected void generateSubQueries(Builder methodBuilder, SQLiteModelMethod method) {
SQLiteEntity entity = method.getEntity();
for (Triple<String, String, SQLiteModelMethod> item : method.childrenSelects) {
TypeName entityTypeName = TypeUtility.typeName(entity.getElement());
String setter;
if (entity.isImmutablePojo()) {
String idGetter = ImmutableUtility.IMMUTABLE_PREFIX + entity.getPrimaryKey().getName();
setter = ImmutableUtility.IMMUTABLE_PREFIX + entity.findRelationByParentProperty(item.value0).value0.getName() + "="
+ String.format("this.daoFactory.get%s().%s(%s)", item.value2.getParent().getName(), item.value2.getName(), idGetter);
} else {
String idGetter = PropertyUtility.getter("resultBean", entityTypeName, entity.getPrimaryKey());
setter = PropertyUtility.setter(entityTypeName, "resultBean", entity.findRelationByParentProperty(item.value0).value0,
String.format("this.daoFactory.get%s().%s(%s)", item.value2.getParent().getName(), item.value2.getName(), idGetter));
}
methodBuilder.addComment("sub query: $L", setter);
methodBuilder.addStatement("$L", setter);
}
} | [
"protected",
"void",
"generateSubQueries",
"(",
"Builder",
"methodBuilder",
",",
"SQLiteModelMethod",
"method",
")",
"{",
"SQLiteEntity",
"entity",
"=",
"method",
".",
"getEntity",
"(",
")",
";",
"for",
"(",
"Triple",
"<",
"String",
",",
"String",
",",
"SQLite... | generate code for sub queries
@param methodBuilder
@param method | [
"generate",
"code",
"for",
"sub",
"queries"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/AbstractSelectCodeGenerator.java#L89-L110 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/EntityHelper.java | EntityHelper.getEntity | public static <T> T getEntity(InputStream in, Class<T> clazz) {
if (clazz == InputStream.class) {
//noinspection unchecked
return (T) clazz;
}
try {
return JsonHelper.readJson(in, clazz);
} catch (IOException e) {
throw Throwables.propagate(e);
}
} | java | public static <T> T getEntity(InputStream in, Class<T> clazz) {
if (clazz == InputStream.class) {
//noinspection unchecked
return (T) clazz;
}
try {
return JsonHelper.readJson(in, clazz);
} catch (IOException e) {
throw Throwables.propagate(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getEntity",
"(",
"InputStream",
"in",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
"==",
"InputStream",
".",
"class",
")",
"{",
"//noinspection unchecked",
"return",
"(",
"T",
")",
"clazz"... | Reads the entity input stream and deserializes the JSON content to the given class. | [
"Reads",
"the",
"entity",
"input",
"stream",
"and",
"deserializes",
"the",
"JSON",
"content",
"to",
"the",
"given",
"class",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/EntityHelper.java#L23-L34 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/EnumBindTransform.java | EnumBindTransform.generateSerializeOnJackson | @Override
public void generateSerializeOnJackson(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) {
if (property.isNullable()) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
}
if (property.isProperty()) {
methodBuilder.addStatement("fieldCount++");
}
if (property.isInCollection()) {
methodBuilder.addStatement("$L.writeString($L.$L())", serializerName, getter(beanName, beanClass, property), METHOD_TO_CONVERT);
} else {
methodBuilder.addStatement("$L.writeStringField($S, $L.$L())", serializerName, property.label, getter(beanName, beanClass, property), METHOD_TO_CONVERT);
}
if (property.isNullable()) {
methodBuilder.endControlFlow();
}
} | java | @Override
public void generateSerializeOnJackson(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) {
if (property.isNullable()) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
}
if (property.isProperty()) {
methodBuilder.addStatement("fieldCount++");
}
if (property.isInCollection()) {
methodBuilder.addStatement("$L.writeString($L.$L())", serializerName, getter(beanName, beanClass, property), METHOD_TO_CONVERT);
} else {
methodBuilder.addStatement("$L.writeStringField($S, $L.$L())", serializerName, property.label, getter(beanName, beanClass, property), METHOD_TO_CONVERT);
}
if (property.isNullable()) {
methodBuilder.endControlFlow();
}
} | [
"@",
"Override",
"public",
"void",
"generateSerializeOnJackson",
"(",
"BindTypeContext",
"context",
",",
"MethodSpec",
".",
"Builder",
"methodBuilder",
",",
"String",
"serializerName",
",",
"TypeName",
"beanClass",
",",
"String",
"beanName",
",",
"BindProperty",
"prop... | /* (non-Javadoc)
@see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnJackson(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/EnumBindTransform.java#L100-L119 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java | RolesInner.beginCreateOrUpdate | public RoleInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, RoleInner role) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, role).toBlocking().single().body();
} | java | public RoleInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, RoleInner role) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, role).toBlocking().single().body();
} | [
"public",
"RoleInner",
"beginCreateOrUpdate",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"RoleInner",
"role",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"res... | Create or update a role.
@param deviceName The device name.
@param name The role name.
@param resourceGroupName The resource group name.
@param role The role properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RoleInner object if successful. | [
"Create",
"or",
"update",
"a",
"role",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java#L406-L408 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java | ParsedAddressGrouping.getNetworkSegmentIndex | public static int getNetworkSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) {
if(bytesPerSegment > 1) {
if(bytesPerSegment == 2) {
return (networkPrefixLength - 1) >> 4;//note this is intentionally a signed shift and not >>> so that networkPrefixLength of 0 returns -1
}
return (networkPrefixLength - 1) / bitsPerSegment;
}
return (networkPrefixLength - 1) >> 3;
} | java | public static int getNetworkSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) {
if(bytesPerSegment > 1) {
if(bytesPerSegment == 2) {
return (networkPrefixLength - 1) >> 4;//note this is intentionally a signed shift and not >>> so that networkPrefixLength of 0 returns -1
}
return (networkPrefixLength - 1) / bitsPerSegment;
}
return (networkPrefixLength - 1) >> 3;
} | [
"public",
"static",
"int",
"getNetworkSegmentIndex",
"(",
"int",
"networkPrefixLength",
",",
"int",
"bytesPerSegment",
",",
"int",
"bitsPerSegment",
")",
"{",
"if",
"(",
"bytesPerSegment",
">",
"1",
")",
"{",
"if",
"(",
"bytesPerSegment",
"==",
"2",
")",
"{",
... | Returns the index of the segment containing the last byte within the network prefix
When networkPrefixLength is zero (so there are no segments containing bytes within the network prefix), returns -1
@param networkPrefixLength
@param byteLength
@return | [
"Returns",
"the",
"index",
"of",
"the",
"segment",
"containing",
"the",
"last",
"byte",
"within",
"the",
"network",
"prefix",
"When",
"networkPrefixLength",
"is",
"zero",
"(",
"so",
"there",
"are",
"no",
"segments",
"containing",
"bytes",
"within",
"the",
"net... | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java#L34-L42 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java | AtomContainerManipulator.countExplicitHydrogens | public static int countExplicitHydrogens(IAtomContainer atomContainer, IAtom atom) {
if (atomContainer == null || atom == null)
throw new IllegalArgumentException("null container or atom provided");
int hCount = 0;
for (IAtom connected : atomContainer.getConnectedAtomsList(atom)) {
if (Elements.HYDROGEN.getSymbol().equals(connected.getSymbol())) {
hCount++;
}
}
return hCount;
} | java | public static int countExplicitHydrogens(IAtomContainer atomContainer, IAtom atom) {
if (atomContainer == null || atom == null)
throw new IllegalArgumentException("null container or atom provided");
int hCount = 0;
for (IAtom connected : atomContainer.getConnectedAtomsList(atom)) {
if (Elements.HYDROGEN.getSymbol().equals(connected.getSymbol())) {
hCount++;
}
}
return hCount;
} | [
"public",
"static",
"int",
"countExplicitHydrogens",
"(",
"IAtomContainer",
"atomContainer",
",",
"IAtom",
"atom",
")",
"{",
"if",
"(",
"atomContainer",
"==",
"null",
"||",
"atom",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null contain... | Count explicit hydrogens.
@param atomContainer the atom container to consider
@return The number of explicit hydrogens on the given IAtom.
@throws IllegalArgumentException if either the container or atom were null | [
"Count",
"explicit",
"hydrogens",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L587-L597 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/Utils.java | Utils.joinURIQuery | public static String joinURIQuery(Map<String, String> uriParams) {
StringBuilder buffer = new StringBuilder();
for (String name : uriParams.keySet()) {
String value = uriParams.get(name);
if (buffer.length() > 0) {
buffer.append("&");
}
buffer.append(Utils.urlEncode(name));
if (!Utils.isEmpty(value)) {
buffer.append("=");
buffer.append(Utils.urlEncode(value));
}
}
return buffer.toString();
} | java | public static String joinURIQuery(Map<String, String> uriParams) {
StringBuilder buffer = new StringBuilder();
for (String name : uriParams.keySet()) {
String value = uriParams.get(name);
if (buffer.length() > 0) {
buffer.append("&");
}
buffer.append(Utils.urlEncode(name));
if (!Utils.isEmpty(value)) {
buffer.append("=");
buffer.append(Utils.urlEncode(value));
}
}
return buffer.toString();
} | [
"public",
"static",
"String",
"joinURIQuery",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"uriParams",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"name",
":",
"uriParams",
".",
"keySet",
"(",
... | Concatenate and encode the given name/value pairs into a valid URI query string.
This method is the complement of {@link #parseURIQuery(String)}.
@param uriParams Unencoded name/value pairs.
@return URI query in the form {name 1}={value 1}{@literal &}...{@literal &}{name}={value n}. | [
"Concatenate",
"and",
"encode",
"the",
"given",
"name",
"/",
"value",
"pairs",
"into",
"a",
"valid",
"URI",
"query",
"string",
".",
"This",
"method",
"is",
"the",
"complement",
"of",
"{",
"@link",
"#parseURIQuery",
"(",
"String",
")",
"}",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L1733-L1747 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/vbs/VBSFaxClientSpi.java | VBSFaxClientSpi.invokeScript | protected ProcessOutput invokeScript(String script)
{
File file=null;
try
{
//create temporary file
file=File.createTempFile("fax4j_",".vbs");
}
catch(IOException exception)
{
throw new FaxException("Unable to create temporary vbscript file.",exception);
}
file.deleteOnExit();
//generate command string
StringBuilder buffer=new StringBuilder();
buffer.append(this.getVBSExePath());
buffer.append(" \"");
buffer.append(file.getAbsolutePath());
buffer.append("\"");
String command=buffer.toString();
try
{
//write script to file
IOHelper.writeTextFile(script,file);
}
catch(IOException exception)
{
throw new FaxException("Unable to write vbscript to temporary file.",exception);
}
//get logger
Logger logger=this.getLogger();
logger.logDebug(new Object[]{"Invoking command: ",command," script:",Logger.SYSTEM_EOL,script},null);
//execute command
ProcessOutput vbsOutput=ProcessExecutorHelper.executeProcess(this,command);
//get exit code
int exitCode=vbsOutput.getExitCode();
//delete temp file
boolean fileDeleted=file.delete();
logger.logDebug(new Object[]{"Temp script file deleted: ",String.valueOf(fileDeleted)},null);
if(exitCode!=0)
{
throw new FaxException("Error while invoking script, exit code: "+exitCode+" script output:\n"+vbsOutput.getOutputText()+"\nScript error:\n"+vbsOutput.getErrorText());
}
return vbsOutput;
} | java | protected ProcessOutput invokeScript(String script)
{
File file=null;
try
{
//create temporary file
file=File.createTempFile("fax4j_",".vbs");
}
catch(IOException exception)
{
throw new FaxException("Unable to create temporary vbscript file.",exception);
}
file.deleteOnExit();
//generate command string
StringBuilder buffer=new StringBuilder();
buffer.append(this.getVBSExePath());
buffer.append(" \"");
buffer.append(file.getAbsolutePath());
buffer.append("\"");
String command=buffer.toString();
try
{
//write script to file
IOHelper.writeTextFile(script,file);
}
catch(IOException exception)
{
throw new FaxException("Unable to write vbscript to temporary file.",exception);
}
//get logger
Logger logger=this.getLogger();
logger.logDebug(new Object[]{"Invoking command: ",command," script:",Logger.SYSTEM_EOL,script},null);
//execute command
ProcessOutput vbsOutput=ProcessExecutorHelper.executeProcess(this,command);
//get exit code
int exitCode=vbsOutput.getExitCode();
//delete temp file
boolean fileDeleted=file.delete();
logger.logDebug(new Object[]{"Temp script file deleted: ",String.valueOf(fileDeleted)},null);
if(exitCode!=0)
{
throw new FaxException("Error while invoking script, exit code: "+exitCode+" script output:\n"+vbsOutput.getOutputText()+"\nScript error:\n"+vbsOutput.getErrorText());
}
return vbsOutput;
} | [
"protected",
"ProcessOutput",
"invokeScript",
"(",
"String",
"script",
")",
"{",
"File",
"file",
"=",
"null",
";",
"try",
"{",
"//create temporary file",
"file",
"=",
"File",
".",
"createTempFile",
"(",
"\"fax4j_\"",
",",
"\".vbs\"",
")",
";",
"}",
"catch",
... | Invokes the VB script and returns the output.
@param script
The script to invoke
@return The script output | [
"Invokes",
"the",
"VB",
"script",
"and",
"returns",
"the",
"output",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/vbs/VBSFaxClientSpi.java#L656-L708 |
upwork/java-upwork | src/com/Upwork/api/Routers/Activities/Team.java | Team.updateActivity | public JSONObject updateActivity(String company, String team, String code, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks/" + code, params);
} | java | public JSONObject updateActivity(String company, String team, String code, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks/" + code, params);
} | [
"public",
"JSONObject",
"updateActivity",
"(",
"String",
"company",
",",
"String",
"team",
",",
"String",
"code",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
"\"/otas... | Update specific oTask/Activity record within a team
@param company Company ID
@param team Team ID
@param code Specific code
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Update",
"specific",
"oTask",
"/",
"Activity",
"record",
"within",
"a",
"team"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Activities/Team.java#L111-L113 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java | Prism.getVertices | @Override
public Point3d[] getVertices() {
Point3d[] polygon = new Point3d[2*n];
Matrix3d m = new Matrix3d();
Point3d center = new Point3d(0, 0, height/2);
for (int i = 0; i < n; i++) {
polygon[i] = new Point3d(0, circumscribedRadius, 0);
m.rotZ(i*2*Math.PI/n);
m.transform(polygon[i]);
polygon[n+i] = new Point3d(polygon[i]);
polygon[i].sub(center);
polygon[n+i].add(center);
}
return polygon;
} | java | @Override
public Point3d[] getVertices() {
Point3d[] polygon = new Point3d[2*n];
Matrix3d m = new Matrix3d();
Point3d center = new Point3d(0, 0, height/2);
for (int i = 0; i < n; i++) {
polygon[i] = new Point3d(0, circumscribedRadius, 0);
m.rotZ(i*2*Math.PI/n);
m.transform(polygon[i]);
polygon[n+i] = new Point3d(polygon[i]);
polygon[i].sub(center);
polygon[n+i].add(center);
}
return polygon;
} | [
"@",
"Override",
"public",
"Point3d",
"[",
"]",
"getVertices",
"(",
")",
"{",
"Point3d",
"[",
"]",
"polygon",
"=",
"new",
"Point3d",
"[",
"2",
"*",
"n",
"]",
";",
"Matrix3d",
"m",
"=",
"new",
"Matrix3d",
"(",
")",
";",
"Point3d",
"center",
"=",
"ne... | Returns the vertices of an n-fold polygon of given radius and center
@return | [
"Returns",
"the",
"vertices",
"of",
"an",
"n",
"-",
"fold",
"polygon",
"of",
"given",
"radius",
"and",
"center"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java#L101-L118 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.anyOf | public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Method... value) {
return definedMethod(anyOf(new MethodList.ForLoadedMethods(new Constructor<?>[0], value)));
} | java | public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Method... value) {
return definedMethod(anyOf(new MethodList.ForLoadedMethods(new Constructor<?>[0], value)));
} | [
"public",
"static",
"<",
"T",
"extends",
"MethodDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"anyOf",
"(",
"Method",
"...",
"value",
")",
"{",
"return",
"definedMethod",
"(",
"anyOf",
"(",
"new",
"MethodList",
".",
"ForLoadedMethods",
... | Creates a matcher that matches any of the given methods as {@link MethodDescription}s
by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}.
@param value The input values to be compared against.
@param <T> The type of the matched object.
@return A matcher that checks for the equality with any of the given objects. | [
"Creates",
"a",
"matcher",
"that",
"matches",
"any",
"of",
"the",
"given",
"methods",
"as",
"{",
"@link",
"MethodDescription",
"}",
"s",
"by",
"the",
"{",
"@link",
"java",
".",
"lang",
".",
"Object#equals",
"(",
"Object",
")",
"}",
"method",
".",
"None",... | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L392-L394 |
vdmeer/skb-java-base | src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java | Message5WH_Builder.setWhere | public Message5WH_Builder setWhere(Object where, RecognitionException lineAndColumn){
if(where!=null && lineAndColumn!=null){
IsAntlrRuntimeObject iaro = IsAntlrRuntimeObject.create(lineAndColumn);
this.setWhere(where, iaro.getLine(), iaro.getColumn());
}
return this;
} | java | public Message5WH_Builder setWhere(Object where, RecognitionException lineAndColumn){
if(where!=null && lineAndColumn!=null){
IsAntlrRuntimeObject iaro = IsAntlrRuntimeObject.create(lineAndColumn);
this.setWhere(where, iaro.getLine(), iaro.getColumn());
}
return this;
} | [
"public",
"Message5WH_Builder",
"setWhere",
"(",
"Object",
"where",
",",
"RecognitionException",
"lineAndColumn",
")",
"{",
"if",
"(",
"where",
"!=",
"null",
"&&",
"lineAndColumn",
"!=",
"null",
")",
"{",
"IsAntlrRuntimeObject",
"iaro",
"=",
"IsAntlrRuntimeObject",
... | Sets the Where? part of the message.
Line and column information are taken from the recognition exception, if they are larger than 0.
Nothing will be set if the two parameters are null.
@param where location for Where?
@param lineAndColumn source for the Where? part
@return self to allow chaining | [
"Sets",
"the",
"Where?",
"part",
"of",
"the",
"message",
".",
"Line",
"and",
"column",
"information",
"are",
"taken",
"from",
"the",
"recognition",
"exception",
"if",
"they",
"are",
"larger",
"than",
"0",
".",
"Nothing",
"will",
"be",
"set",
"if",
"the",
... | train | https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java#L175-L181 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.read03BySax | public static Excel03SaxReader read03BySax(File file, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel03SaxReader(rowHandler).read(file, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static Excel03SaxReader read03BySax(File file, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel03SaxReader(rowHandler).read(file, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"Excel03SaxReader",
"read03BySax",
"(",
"File",
"file",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"try",
"{",
"return",
"new",
"Excel03SaxReader",
"(",
"rowHandler",
")",
".",
"read",
"(",
"file",
",",
"sheetIndex... | Sax方式读取Excel03
@param file 文件
@param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet
@param rowHandler 行处理器
@return {@link Excel03SaxReader}
@since 3.2.0 | [
"Sax方式读取Excel03"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L157-L163 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java | Checksum.getSHA256Checksum | public static String getSHA256Checksum(String text) {
final byte[] data = stringToBytes(text);
return getChecksum(SHA256, data);
} | java | public static String getSHA256Checksum(String text) {
final byte[] data = stringToBytes(text);
return getChecksum(SHA256, data);
} | [
"public",
"static",
"String",
"getSHA256Checksum",
"(",
"String",
"text",
")",
"{",
"final",
"byte",
"[",
"]",
"data",
"=",
"stringToBytes",
"(",
"text",
")",
";",
"return",
"getChecksum",
"(",
"SHA256",
",",
"data",
")",
";",
"}"
] | Calculates the SHA1 checksum of the specified text.
@param text the text to generate the SHA1 checksum
@return the hex representation of the SHA1 | [
"Calculates",
"the",
"SHA1",
"checksum",
"of",
"the",
"specified",
"text",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java#L180-L183 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java | Collectors.groupingBy | public static <T, K> Collector<T, ?, Map<K, List<T>>>
groupingBy(Function<? super T, ? extends K> classifier) {
return groupingBy(classifier, toList());
} | java | public static <T, K> Collector<T, ?, Map<K, List<T>>>
groupingBy(Function<? super T, ? extends K> classifier) {
return groupingBy(classifier, toList());
} | [
"public",
"static",
"<",
"T",
",",
"K",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Map",
"<",
"K",
",",
"List",
"<",
"T",
">",
">",
">",
"groupingBy",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"classifier",
")",
... | Returns a {@code Collector} implementing a "group by" operation on
input elements of type {@code T}, grouping elements according to a
classification function, and returning the results in a {@code Map}.
<p>The classification function maps elements to some key type {@code K}.
The collector produces a {@code Map<K, List<T>>} whose keys are the
values resulting from applying the classification function to the input
elements, and whose corresponding values are {@code List}s containing the
input elements which map to the associated key under the classification
function.
<p>There are no guarantees on the type, mutability, serializability, or
thread-safety of the {@code Map} or {@code List} objects returned.
@implSpec
This produces a result similar to:
<pre>{@code
groupingBy(classifier, toList());
}</pre>
@implNote
The returned {@code Collector} is not concurrent. For parallel stream
pipelines, the {@code combiner} function operates by merging the keys
from one map into another, which can be an expensive operation. If
preservation of the order in which elements appear in the resulting {@code Map}
collector is not required, using {@link #groupingByConcurrent(Function)}
may offer better parallel performance.
@param <T> the type of the input elements
@param <K> the type of the keys
@param classifier the classifier function mapping input elements to keys
@return a {@code Collector} implementing the group-by operation
@see #groupingBy(Function, Collector)
@see #groupingBy(Function, Supplier, Collector)
@see #groupingByConcurrent(Function) | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"implementing",
"a",
"group",
"by",
"operation",
"on",
"input",
"elements",
"of",
"type",
"{",
"@code",
"T",
"}",
"grouping",
"elements",
"according",
"to",
"a",
"classification",
"function",
"and",
"returning",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java#L803-L806 |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/GenericRecommenderBuilder.java | GenericRecommenderBuilder.buildRecommender | public Recommender buildRecommender(final DataModel dataModel, final String recType, final String facType, final int iterations, final int factors)
throws RecommenderException {
return buildRecommender(dataModel, recType, null, NO_N, factors, iterations, facType);
} | java | public Recommender buildRecommender(final DataModel dataModel, final String recType, final String facType, final int iterations, final int factors)
throws RecommenderException {
return buildRecommender(dataModel, recType, null, NO_N, factors, iterations, facType);
} | [
"public",
"Recommender",
"buildRecommender",
"(",
"final",
"DataModel",
"dataModel",
",",
"final",
"String",
"recType",
",",
"final",
"String",
"facType",
",",
"final",
"int",
"iterations",
",",
"final",
"int",
"factors",
")",
"throws",
"RecommenderException",
"{"... | SVD.
@param dataModel the data model
@param recType the recommender type (as Mahout class)
@param facType the factorizer (as Mahout class)
@param iterations number of iterations
@param factors number of factors
@return the recommender
@throws RecommenderException see
{@link #buildRecommender(org.apache.mahout.cf.taste.model.DataModel, java.lang.String, java.lang.String, int, int, int, java.lang.String)} | [
"SVD",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/GenericRecommenderBuilder.java#L123-L126 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Vector3ifx.java | Vector3ifx.lengthSquaredProperty | public DoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() ->
Vector3ifx.this.x.doubleValue() * Vector3ifx.this.x.doubleValue()
+ Vector3ifx.this.y.doubleValue() * Vector3ifx.this.y.doubleValue()
+ Vector3ifx.this.z.doubleValue() * Vector3ifx.this.z.doubleValue(), this.x, this.y, this.z));
}
return this.lengthSquareProperty;
} | java | public DoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() ->
Vector3ifx.this.x.doubleValue() * Vector3ifx.this.x.doubleValue()
+ Vector3ifx.this.y.doubleValue() * Vector3ifx.this.y.doubleValue()
+ Vector3ifx.this.z.doubleValue() * Vector3ifx.this.z.doubleValue(), this.x, this.y, this.z));
}
return this.lengthSquareProperty;
} | [
"public",
"DoubleProperty",
"lengthSquaredProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"lengthSquareProperty",
"==",
"null",
")",
"{",
"this",
".",
"lengthSquareProperty",
"=",
"new",
"ReadOnlyDoubleWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"LE... | Replies the property that represents the length of the vector.
@return the length property | [
"Replies",
"the",
"property",
"that",
"represents",
"the",
"length",
"of",
"the",
"vector",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Vector3ifx.java#L179-L188 |
ebourgeois/common-java | src/main/java/ca/jeb/common/infra/JReflectionUtils.java | JReflectionUtils.runMethod | public static Object runMethod(Object object, String method, Object... args) throws JException
{
try
{
final Method m = object.getClass().getMethod(method);
return m.invoke(object, args);
}
catch (Exception e)
{
throw new JException(e);
}
} | java | public static Object runMethod(Object object, String method, Object... args) throws JException
{
try
{
final Method m = object.getClass().getMethod(method);
return m.invoke(object, args);
}
catch (Exception e)
{
throw new JException(e);
}
} | [
"public",
"static",
"Object",
"runMethod",
"(",
"Object",
"object",
",",
"String",
"method",
",",
"Object",
"...",
"args",
")",
"throws",
"JException",
"{",
"try",
"{",
"final",
"Method",
"m",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getMethod",
"... | Use reflection to run/execute the method represented by "method",
on the object {@code object}, given the list of {@code args}.
@param object - The object to execute the method against
@param method - The method name
@param args - All the arguments for this method
@return Object - The value of executing this method, if any
@throws JException | [
"Use",
"reflection",
"to",
"run",
"/",
"execute",
"the",
"method",
"represented",
"by",
"method",
"on",
"the",
"object",
"{",
"@code",
"object",
"}",
"given",
"the",
"list",
"of",
"{",
"@code",
"args",
"}",
"."
] | train | https://github.com/ebourgeois/common-java/blob/8ba7e05b1228aad1ec2949b5707ac4b5e8889f92/src/main/java/ca/jeb/common/infra/JReflectionUtils.java#L128-L140 |
BradleyWood/Software-Quality-Test-Framework | sqtf-core/src/main/java/org/sqtf/assertions/Assert.java | Assert.assertNotEqual | public static void assertNotEqual(Object a, Object b) {
assertNotEqual(a, b, a + " should not equal to " + b);
} | java | public static void assertNotEqual(Object a, Object b) {
assertNotEqual(a, b, a + " should not equal to " + b);
} | [
"public",
"static",
"void",
"assertNotEqual",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"assertNotEqual",
"(",
"a",
",",
"b",
",",
"a",
"+",
"\" should not equal to \"",
"+",
"b",
")",
";",
"}"
] | Asserts that the two objects are equal. If they are not
the test will fail
@param a The first object
@param b The second object | [
"Asserts",
"that",
"the",
"two",
"objects",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"the",
"test",
"will",
"fail"
] | train | https://github.com/BradleyWood/Software-Quality-Test-Framework/blob/010dea3bfc8e025a4304ab9ef4a213c1adcb1aa0/sqtf-core/src/main/java/org/sqtf/assertions/Assert.java#L178-L180 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java | ApiOvhCdndedicated.serviceName_domains_domain_backends_POST | public OvhBackend serviceName_domains_domain_backends_POST(String serviceName, String domain, String ip) throws IOException {
String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/backends";
StringBuilder sb = path(qPath, serviceName, domain);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackend.class);
} | java | public OvhBackend serviceName_domains_domain_backends_POST(String serviceName, String domain, String ip) throws IOException {
String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/backends";
StringBuilder sb = path(qPath, serviceName, domain);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackend.class);
} | [
"public",
"OvhBackend",
"serviceName_domains_domain_backends_POST",
"(",
"String",
"serviceName",
",",
"String",
"domain",
",",
"String",
"ip",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cdn/dedicated/{serviceName}/domains/{domain}/backends\"",
";",
"Str... | Add a backend IP
REST: POST /cdn/dedicated/{serviceName}/domains/{domain}/backends
@param ip [required] IP to add to backends list
@param serviceName [required] The internal name of your CDN offer
@param domain [required] Domain of this object | [
"Add",
"a",
"backend",
"IP"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java#L127-L134 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toLongValue | public static long toLongValue(String str) throws PageException {
BigInteger bi = null;
try {
bi = new BigInteger(str);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
if (bi != null) {
if (bi.bitLength() < 64) return bi.longValue();
throw new ApplicationException("number [" + str + "] cannot be casted to a long value, number is to long (" + (bi.bitLength() + 1) + " bit)");
}
return (long) toDoubleValue(str);
} | java | public static long toLongValue(String str) throws PageException {
BigInteger bi = null;
try {
bi = new BigInteger(str);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
if (bi != null) {
if (bi.bitLength() < 64) return bi.longValue();
throw new ApplicationException("number [" + str + "] cannot be casted to a long value, number is to long (" + (bi.bitLength() + 1) + " bit)");
}
return (long) toDoubleValue(str);
} | [
"public",
"static",
"long",
"toLongValue",
"(",
"String",
"str",
")",
"throws",
"PageException",
"{",
"BigInteger",
"bi",
"=",
"null",
";",
"try",
"{",
"bi",
"=",
"new",
"BigInteger",
"(",
"str",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",... | cast a Object to a long value (primitive value type)
@param str Object to cast
@return casted long value
@throws PageException | [
"cast",
"a",
"Object",
"to",
"a",
"long",
"value",
"(",
"primitive",
"value",
"type",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1409-L1423 |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/JORARepository.java | JORARepository.updateFields | protected <T> int updateFields (
final Table<T> table, final T object, String[] fields)
throws PersistenceException
{
final FieldMask mask = table.getFieldMask();
for (int ii = 0; ii < fields.length; ii++) {
mask.setModified(fields[ii]);
}
return executeUpdate(new Operation<Integer>() {
public Integer invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
return table.update(conn, object, mask);
}
});
} | java | protected <T> int updateFields (
final Table<T> table, final T object, String[] fields)
throws PersistenceException
{
final FieldMask mask = table.getFieldMask();
for (int ii = 0; ii < fields.length; ii++) {
mask.setModified(fields[ii]);
}
return executeUpdate(new Operation<Integer>() {
public Integer invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
return table.update(conn, object, mask);
}
});
} | [
"protected",
"<",
"T",
">",
"int",
"updateFields",
"(",
"final",
"Table",
"<",
"T",
">",
"table",
",",
"final",
"T",
"object",
",",
"String",
"[",
"]",
"fields",
")",
"throws",
"PersistenceException",
"{",
"final",
"FieldMask",
"mask",
"=",
"table",
".",... | Updates the specified fields in the supplied object (which must
correspond to the supplied table).
@return the number of rows modified by the update. | [
"Updates",
"the",
"specified",
"fields",
"in",
"the",
"supplied",
"object",
"(",
"which",
"must",
"correspond",
"to",
"the",
"supplied",
"table",
")",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JORARepository.java#L287-L302 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java | QuickSelectSketch.merge | @SuppressWarnings("unchecked")
void merge(final long key, final S summary, final SummarySetOperations<S> summarySetOps) {
isEmpty_ = false;
if (key < theta_) {
final int index = findOrInsert(key);
if (index < 0) {
insertSummary(~index, (S)summary.copy());
} else {
insertSummary(index, summarySetOps.union(summaries_[index], summary));
}
rebuildIfNeeded();
}
} | java | @SuppressWarnings("unchecked")
void merge(final long key, final S summary, final SummarySetOperations<S> summarySetOps) {
isEmpty_ = false;
if (key < theta_) {
final int index = findOrInsert(key);
if (index < 0) {
insertSummary(~index, (S)summary.copy());
} else {
insertSummary(index, summarySetOps.union(summaries_[index], summary));
}
rebuildIfNeeded();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"merge",
"(",
"final",
"long",
"key",
",",
"final",
"S",
"summary",
",",
"final",
"SummarySetOperations",
"<",
"S",
">",
"summarySetOps",
")",
"{",
"isEmpty_",
"=",
"false",
";",
"if",
"(",
"key",... | not sufficient by itself without keeping track of theta of another sketch | [
"not",
"sufficient",
"by",
"itself",
"without",
"keeping",
"track",
"of",
"theta",
"of",
"another",
"sketch"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/QuickSelectSketch.java#L363-L375 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagLink.java | CmsJspTagLink.linkTagAction | public static String linkTagAction(String target, ServletRequest req, String baseUri, Locale locale) {
return linkTagAction(target, req, baseUri, null, locale);
} | java | public static String linkTagAction(String target, ServletRequest req, String baseUri, Locale locale) {
return linkTagAction(target, req, baseUri, null, locale);
} | [
"public",
"static",
"String",
"linkTagAction",
"(",
"String",
"target",
",",
"ServletRequest",
"req",
",",
"String",
"baseUri",
",",
"Locale",
"locale",
")",
"{",
"return",
"linkTagAction",
"(",
"target",
",",
"req",
",",
"baseUri",
",",
"null",
",",
"locale... | Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.<p>
<p>If the <code>baseUri</code> parameter is provided, this will be treated as the source of the link,
if this is <code>null</code> then the current OpenCms user context URI will be used as source.</p>
<p>If the <code>locale</code> parameter is provided, the locale in the request context will be switched
to the provided locale. This influences only the behavior of the
{@link org.opencms.staticexport.CmsLocalePrefixLinkSubstitutionHandler}.</p>
Relative links are converted to absolute links, using the current element URI as base.<p>
@param target the link that should be calculated, can be relative or absolute
@param req the current request
@param baseUri the base URI for the link source
@param locale the locale for which the link should be created (see {@link org.opencms.staticexport.CmsLocalePrefixLinkSubstitutionHandler}
@return the target link adjusted according to the web application path and the OpenCms static export rules
@see #linkTagAction(String, ServletRequest)
@since 8.0.3 | [
"Returns",
"a",
"link",
"to",
"a",
"file",
"in",
"the",
"OpenCms",
"VFS",
"that",
"has",
"been",
"adjusted",
"according",
"to",
"the",
"web",
"application",
"path",
"and",
"the",
"OpenCms",
"static",
"export",
"rules",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagLink.java#L149-L152 |
qiujuer/Genius-Android | caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java | Ui.isHaveAttribute | public static boolean isHaveAttribute(AttributeSet attrs, String attribute) {
return attrs.getAttributeValue(Ui.androidStyleNameSpace, attribute) != null;
} | java | public static boolean isHaveAttribute(AttributeSet attrs, String attribute) {
return attrs.getAttributeValue(Ui.androidStyleNameSpace, attribute) != null;
} | [
"public",
"static",
"boolean",
"isHaveAttribute",
"(",
"AttributeSet",
"attrs",
",",
"String",
"attribute",
")",
"{",
"return",
"attrs",
".",
"getAttributeValue",
"(",
"Ui",
".",
"androidStyleNameSpace",
",",
"attribute",
")",
"!=",
"null",
";",
"}"
] | Check the AttributeSet values have a attribute String, on user set the attribute resource.
Form android styles namespace
@param attrs AttributeSet
@param attribute The attribute to retrieve
@return If have the attribute return True | [
"Check",
"the",
"AttributeSet",
"values",
"have",
"a",
"attribute",
"String",
"on",
"user",
"set",
"the",
"attribute",
"resource",
".",
"Form",
"android",
"styles",
"namespace"
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/Ui.java#L241-L243 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Functions.java | Functions.flatMapDoubles | public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> flatMapDoubles(DoubleFunction<? extends DoubleStream> b){
return a->a.doubles(i->i,s->s.flatMap(b));
} | java | public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> flatMapDoubles(DoubleFunction<? extends DoubleStream> b){
return a->a.doubles(i->i,s->s.flatMap(b));
} | [
"public",
"static",
"Function",
"<",
"?",
"super",
"ReactiveSeq",
"<",
"Double",
">",
",",
"?",
"extends",
"ReactiveSeq",
"<",
"Double",
">",
">",
"flatMapDoubles",
"(",
"DoubleFunction",
"<",
"?",
"extends",
"DoubleStream",
">",
"b",
")",
"{",
"return",
"... | /*
Fluent flatMap operation using primitive types
e.g.
<pre>
{@code
import static cyclops.ReactiveSeq.flatMapDoubles;
ReactiveSeq.ofDoubles(1d,2d,3d)
.to(flatMapDoubles(i->DoubleStream.of(i*2)));
//[2d,4d,6d]
}
</pre> | [
"/",
"*",
"Fluent",
"flatMap",
"operation",
"using",
"primitive",
"types",
"e",
".",
"g",
".",
"<pre",
">",
"{",
"@code",
"import",
"static",
"cyclops",
".",
"ReactiveSeq",
".",
"flatMapDoubles",
";"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L537-L540 |
alkacon/opencms-core | src/org/opencms/util/CmsDateUtil.java | CmsDateUtil.getDateTime | public static String getDateTime(Date date, int format, Locale locale) {
DateFormat df = DateFormat.getDateInstance(format, locale);
DateFormat tf = DateFormat.getTimeInstance(format, locale);
StringBuffer buf = new StringBuffer();
buf.append(df.format(date));
buf.append(" ");
buf.append(tf.format(date));
return buf.toString();
} | java | public static String getDateTime(Date date, int format, Locale locale) {
DateFormat df = DateFormat.getDateInstance(format, locale);
DateFormat tf = DateFormat.getTimeInstance(format, locale);
StringBuffer buf = new StringBuffer();
buf.append(df.format(date));
buf.append(" ");
buf.append(tf.format(date));
return buf.toString();
} | [
"public",
"static",
"String",
"getDateTime",
"(",
"Date",
"date",
",",
"int",
"format",
",",
"Locale",
"locale",
")",
"{",
"DateFormat",
"df",
"=",
"DateFormat",
".",
"getDateInstance",
"(",
"format",
",",
"locale",
")",
";",
"DateFormat",
"tf",
"=",
"Date... | Returns a formated date and time String from a Date value,
the formatting based on the provided options.<p>
@param date the Date object to format as String
@param format the format to use, see {@link DateFormat} for possible values
@param locale the locale to use
@return the formatted date | [
"Returns",
"a",
"formated",
"date",
"and",
"time",
"String",
"from",
"a",
"Date",
"value",
"the",
"formatting",
"based",
"on",
"the",
"provided",
"options",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsDateUtil.java#L103-L112 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleLocales.java | ModuleLocales.fetchOne | public CMALocale fetchOne(String spaceId, String environmentId, String localeId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(localeId, "localeId");
return service.fetchOne(spaceId, environmentId, localeId).blockingFirst();
} | java | public CMALocale fetchOne(String spaceId, String environmentId, String localeId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(localeId, "localeId");
return service.fetchOne(spaceId, environmentId, localeId).blockingFirst();
} | [
"public",
"CMALocale",
"fetchOne",
"(",
"String",
"spaceId",
",",
"String",
"environmentId",
",",
"String",
"localeId",
")",
"{",
"assertNotNull",
"(",
"spaceId",
",",
"\"spaceId\"",
")",
";",
"assertNotNull",
"(",
"environmentId",
",",
"\"environmentId\"",
")",
... | Fetches one locale by its id from the given space and environment.
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId the space this environment is hosted in.
@param environmentId the environment this locale is hosted in.
@param localeId the id of the locale to be found.
@return null if no locale was found, otherwise the found locale.
@throws IllegalArgumentException if space id is null.
@throws IllegalArgumentException if environment id is null.
@throws IllegalArgumentException if locale id is null. | [
"Fetches",
"one",
"locale",
"by",
"its",
"id",
"from",
"the",
"given",
"space",
"and",
"environment",
".",
"<p",
">",
"This",
"method",
"will",
"override",
"the",
"configuration",
"specified",
"through",
"{",
"@link",
"CMAClient",
".",
"Builder#setSpaceId",
"(... | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleLocales.java#L119-L125 |
alkacon/opencms-core | src/org/opencms/file/CmsProperty.java | CmsProperty.setStructureValueMap | public void setStructureValueMap(Map<String, String> valueMap) {
checkFrozen();
if (valueMap != null) {
m_structureValueMap = new HashMap<String, String>(valueMap);
m_structureValueMap = Collections.unmodifiableMap(m_structureValueMap);
m_structureValue = createValueFromMap(m_structureValueMap);
} else {
m_structureValueMap = null;
m_structureValue = null;
}
} | java | public void setStructureValueMap(Map<String, String> valueMap) {
checkFrozen();
if (valueMap != null) {
m_structureValueMap = new HashMap<String, String>(valueMap);
m_structureValueMap = Collections.unmodifiableMap(m_structureValueMap);
m_structureValue = createValueFromMap(m_structureValueMap);
} else {
m_structureValueMap = null;
m_structureValue = null;
}
} | [
"public",
"void",
"setStructureValueMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"valueMap",
")",
"{",
"checkFrozen",
"(",
")",
";",
"if",
"(",
"valueMap",
"!=",
"null",
")",
"{",
"m_structureValueMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
... | Sets the value of this property attached to the structure record from the given map of Strings.<p>
The value will be created from the individual values of the given map, which are appended
using the <code>|</code> char as delimiter, the map keys and values are separated by a <code>=</code>.<p>
@param valueMap the map of key/value (Strings) to attach to the structure record | [
"Sets",
"the",
"value",
"of",
"this",
"property",
"attached",
"to",
"the",
"structure",
"record",
"from",
"the",
"given",
"map",
"of",
"Strings",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsProperty.java#L1134-L1145 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java | CollectionExtensions.operator_add | @Inline(value="$1.add($2)")
public static <E> boolean operator_add(Collection<? super E> collection, E value) {
return collection.add(value);
} | java | @Inline(value="$1.add($2)")
public static <E> boolean operator_add(Collection<? super E> collection, E value) {
return collection.add(value);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$1.add($2)\"",
")",
"public",
"static",
"<",
"E",
">",
"boolean",
"operator_add",
"(",
"Collection",
"<",
"?",
"super",
"E",
">",
"collection",
",",
"E",
"value",
")",
"{",
"return",
"collection",
".",
"add",
"(",
"... | The operator mapping from {@code +=} to {@link Collection#add(Object)}. Returns <code>true</code> if the
collection changed due to this operation.
@param collection
the to-be-changed collection. May not be <code>null</code>.
@param value
the value that should be added to the collection.
@return <code>true</code> if the collection changed due to this operation.
@see Collection#add(Object) | [
"The",
"operator",
"mapping",
"from",
"{",
"@code",
"+",
"=",
"}",
"to",
"{",
"@link",
"Collection#add",
"(",
"Object",
")",
"}",
".",
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"collection",
"changed",
"due",
"to",
"this",
"opera... | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L48-L51 |
pushtorefresh/storio | storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/put/PutResult.java | PutResult.newUpdateResult | @NonNull
public static PutResult newUpdateResult(
int numberOfRowsUpdated,
@NonNull String affectedTable,
@Nullable String... affectedTags
) {
return newUpdateResult(numberOfRowsUpdated, affectedTable, nonNullSet(affectedTags));
} | java | @NonNull
public static PutResult newUpdateResult(
int numberOfRowsUpdated,
@NonNull String affectedTable,
@Nullable String... affectedTags
) {
return newUpdateResult(numberOfRowsUpdated, affectedTable, nonNullSet(affectedTags));
} | [
"@",
"NonNull",
"public",
"static",
"PutResult",
"newUpdateResult",
"(",
"int",
"numberOfRowsUpdated",
",",
"@",
"NonNull",
"String",
"affectedTable",
",",
"@",
"Nullable",
"String",
"...",
"affectedTags",
")",
"{",
"return",
"newUpdateResult",
"(",
"numberOfRowsUpd... | Creates {@link PutResult} of update.
@param numberOfRowsUpdated number of rows that were updated, must be {@code >= 0}.
@param affectedTable table that was affected.
@param affectedTags notification tags that were affected.
@return new {@link PutResult} instance. | [
"Creates",
"{",
"@link",
"PutResult",
"}",
"of",
"update",
"."
] | train | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/put/PutResult.java#L194-L201 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/FieldUtils.java | FieldUtils.safeMultiply | public static int safeMultiply(int val1, int val2) {
long total = (long) val1 * (long) val2;
if (total < Integer.MIN_VALUE || total > Integer.MAX_VALUE) {
throw new ArithmeticException("Multiplication overflows an int: " + val1 + " * " + val2);
}
return (int) total;
} | java | public static int safeMultiply(int val1, int val2) {
long total = (long) val1 * (long) val2;
if (total < Integer.MIN_VALUE || total > Integer.MAX_VALUE) {
throw new ArithmeticException("Multiplication overflows an int: " + val1 + " * " + val2);
}
return (int) total;
} | [
"public",
"static",
"int",
"safeMultiply",
"(",
"int",
"val1",
",",
"int",
"val2",
")",
"{",
"long",
"total",
"=",
"(",
"long",
")",
"val1",
"*",
"(",
"long",
")",
"val2",
";",
"if",
"(",
"total",
"<",
"Integer",
".",
"MIN_VALUE",
"||",
"total",
">... | Multiply two values throwing an exception if overflow occurs.
@param val1 the first value
@param val2 the second value
@return the new total
@throws ArithmeticException if the value is too big or too small
@since 1.2 | [
"Multiply",
"two",
"values",
"throwing",
"an",
"exception",
"if",
"overflow",
"occurs",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/FieldUtils.java#L121-L127 |
VoltDB/voltdb | src/frontend/org/voltdb/NonVoltDBBackend.java | NonVoltDBBackend.protectSpecialChars | protected String protectSpecialChars(String str, boolean debugPrint) {
String result = str.replace("\\", "\\\\").replace("$", "\\$");
if (debugPrint) {
System.out.println(" In NonVoltDBBackend.protectSpecialChars:");
System.out.println(" str : " + str);
System.out.println(" result: " + result);
}
return result;
} | java | protected String protectSpecialChars(String str, boolean debugPrint) {
String result = str.replace("\\", "\\\\").replace("$", "\\$");
if (debugPrint) {
System.out.println(" In NonVoltDBBackend.protectSpecialChars:");
System.out.println(" str : " + str);
System.out.println(" result: " + result);
}
return result;
} | [
"protected",
"String",
"protectSpecialChars",
"(",
"String",
"str",
",",
"boolean",
"debugPrint",
")",
"{",
"String",
"result",
"=",
"str",
".",
"replace",
"(",
"\"\\\\\"",
",",
"\"\\\\\\\\\"",
")",
".",
"replace",
"(",
"\"$\"",
",",
"\"\\\\$\"",
")",
";",
... | Convenience method: certain methods (e.g. String.replace(...),
String.replaceFirst(...), Matcher.appendReplacement(...)) will remove
certain special characters (e.g., '\', '$'); this method adds additional
backslash characters (\) so that the special characters will be retained
in the end result, as they originally appeared. | [
"Convenience",
"method",
":",
"certain",
"methods",
"(",
"e",
".",
"g",
".",
"String",
".",
"replace",
"(",
"...",
")",
"String",
".",
"replaceFirst",
"(",
"...",
")",
"Matcher",
".",
"appendReplacement",
"(",
"...",
"))",
"will",
"remove",
"certain",
"s... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L725-L733 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java | JsonRpcClient.invokeAndReadResponse | public Object invokeAndReadResponse(String methodName, Object argument, Type returnType, OutputStream output, InputStream input) throws Throwable {
return invokeAndReadResponse(methodName, argument, returnType, output, input, this.requestIDGenerator.generateID());
} | java | public Object invokeAndReadResponse(String methodName, Object argument, Type returnType, OutputStream output, InputStream input) throws Throwable {
return invokeAndReadResponse(methodName, argument, returnType, output, input, this.requestIDGenerator.generateID());
} | [
"public",
"Object",
"invokeAndReadResponse",
"(",
"String",
"methodName",
",",
"Object",
"argument",
",",
"Type",
"returnType",
",",
"OutputStream",
"output",
",",
"InputStream",
"input",
")",
"throws",
"Throwable",
"{",
"return",
"invokeAndReadResponse",
"(",
"meth... | Invokes the given method on the remote service
passing the given arguments, a generated id and reads
a response.
@param methodName the method to invoke
@param argument the argument to pass to the method
@param returnType the expected return type
@param output the {@link OutputStream} to write to
@param input the {@link InputStream} to read from
@return the returned Object
@throws Throwable on error
@see #writeRequest(String, Object, OutputStream, String) | [
"Invokes",
"the",
"given",
"method",
"on",
"the",
"remote",
"service",
"passing",
"the",
"given",
"arguments",
"a",
"generated",
"id",
"and",
"reads",
"a",
"response",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L138-L140 |
mailin-api/sendinblue-java-mvn | src/main/java/com/sendinblue/Sendinblue.java | Sendinblue.delete_attribute | public String delete_attribute(Map<String, Object> data) {
String type = data.get("type").toString();
Gson gson = new Gson();
String json = gson.toJson(data);
return post("attribute/" + type, json);
} | java | public String delete_attribute(Map<String, Object> data) {
String type = data.get("type").toString();
Gson gson = new Gson();
String json = gson.toJson(data);
return post("attribute/" + type, json);
} | [
"public",
"String",
"delete_attribute",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"String",
"type",
"=",
"data",
".",
"get",
"(",
"\"type\"",
")",
".",
"toString",
"(",
")",
";",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
... | /*
Delete a specific type of attribute information.
@param {Object} data contains json objects as a key value pair from HashMap.
@options data {Integer} type: Type of attribute to be deleted [Mandatory] | [
"/",
"*",
"Delete",
"a",
"specific",
"type",
"of",
"attribute",
"information",
"."
] | train | https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L876-L881 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java | HystrixMetricsPublisherFactory.createOrRetrievePublisherForCollapser | public static HystrixMetricsPublisherCollapser createOrRetrievePublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
return SINGLETON.getPublisherForCollapser(collapserKey, metrics, properties);
} | java | public static HystrixMetricsPublisherCollapser createOrRetrievePublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
return SINGLETON.getPublisherForCollapser(collapserKey, metrics, properties);
} | [
"public",
"static",
"HystrixMetricsPublisherCollapser",
"createOrRetrievePublisherForCollapser",
"(",
"HystrixCollapserKey",
"collapserKey",
",",
"HystrixCollapserMetrics",
"metrics",
",",
"HystrixCollapserProperties",
"properties",
")",
"{",
"return",
"SINGLETON",
".",
"getPubli... | Get an instance of {@link HystrixMetricsPublisherCollapser} with the given factory {@link HystrixMetricsPublisher} implementation for each {@link HystrixCollapser} instance.
@param collapserKey
Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCollapser} implementation
@param metrics
Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCollapser} implementation
@param properties
Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCollapser} implementation
@return {@link HystrixMetricsPublisherCollapser} instance | [
"Get",
"an",
"instance",
"of",
"{",
"@link",
"HystrixMetricsPublisherCollapser",
"}",
"with",
"the",
"given",
"factory",
"{",
"@link",
"HystrixMetricsPublisher",
"}",
"implementation",
"for",
"each",
"{",
"@link",
"HystrixCollapser",
"}",
"instance",
"."
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java#L159-L161 |
JOML-CI/JOML | src/org/joml/Vector3i.java | Vector3i.set | public Vector3i set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector3i set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector3i",
"set",
"(",
"int",
"index",
",",
"ByteBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link ByteBuffer} starting at the
specified absolute buffer position/index.
<p>
This method will not increment the position of the given ByteBuffer.
@param index
the absolute position into the ByteBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"ByteBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3i.java#L326-L329 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.getVarNameForFieldAndFunction | public String getVarNameForFieldAndFunction(DifferentialFunction function, String fieldName) {
return fieldVariableResolutionMapping.get(function.getOwnName(), fieldName);
} | java | public String getVarNameForFieldAndFunction(DifferentialFunction function, String fieldName) {
return fieldVariableResolutionMapping.get(function.getOwnName(), fieldName);
} | [
"public",
"String",
"getVarNameForFieldAndFunction",
"(",
"DifferentialFunction",
"function",
",",
"String",
"fieldName",
")",
"{",
"return",
"fieldVariableResolutionMapping",
".",
"get",
"(",
"function",
".",
"getOwnName",
"(",
")",
",",
"fieldName",
")",
";",
"}"
... | Get the variable name to use
for resolving a given field
for a given function during import time.
This method is u sed during {@link DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution()}
@param function the function to get the variable name for
@param fieldName the field name to resolve for
@return the resolve variable name if any | [
"Get",
"the",
"variable",
"name",
"to",
"use",
"for",
"resolving",
"a",
"given",
"field",
"for",
"a",
"given",
"function",
"during",
"import",
"time",
".",
"This",
"method",
"is",
"u",
"sed",
"during",
"{",
"@link",
"DifferentialFunction#resolvePropertiesFromSam... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1047-L1049 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/database/CursorUtils.java | CursorUtils.getInt | public static int getInt(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getInt(cursor.getColumnIndex(columnName));
} | java | public static int getInt(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getInt(cursor.getColumnIndex(columnName));
} | [
"public",
"static",
"int",
"getInt",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"cursor",
".",
"getInt",
"(",
"cursor",
".",
"getColumnIndex",
"("... | Read the int data for the column.
@see android.database.Cursor#getInt(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the int value. | [
"Read",
"the",
"int",
"data",
"for",
"the",
"column",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L64-L70 |
jmchilton/galaxy-bootstrap | src/main/java/com/github/jmchilton/galaxybootstrap/GalaxyProperties.java | GalaxyProperties.isPre20141006Release | public boolean isPre20141006Release(File galaxyRoot) {
if (galaxyRoot == null) {
throw new IllegalArgumentException("galaxyRoot is null");
} else if (!galaxyRoot.exists()) {
throw new IllegalArgumentException("galaxyRoot=" + galaxyRoot.getAbsolutePath() + " does not exist");
}
File configDirectory = new File(galaxyRoot, CONFIG_DIR_NAME);
return !(new File(configDirectory, "galaxy.ini.sample")).exists();
} | java | public boolean isPre20141006Release(File galaxyRoot) {
if (galaxyRoot == null) {
throw new IllegalArgumentException("galaxyRoot is null");
} else if (!galaxyRoot.exists()) {
throw new IllegalArgumentException("galaxyRoot=" + galaxyRoot.getAbsolutePath() + " does not exist");
}
File configDirectory = new File(galaxyRoot, CONFIG_DIR_NAME);
return !(new File(configDirectory, "galaxy.ini.sample")).exists();
} | [
"public",
"boolean",
"isPre20141006Release",
"(",
"File",
"galaxyRoot",
")",
"{",
"if",
"(",
"galaxyRoot",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"galaxyRoot is null\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"galaxyRoot",
"... | Determines if this is a pre-2014.10.06 release of Galaxy.
@param galaxyRoot The root directory of Galaxy.
@return True if this is a pre-2014.10.06 release of Galaxy, false otherwise. | [
"Determines",
"if",
"this",
"is",
"a",
"pre",
"-",
"2014",
".",
"10",
".",
"06",
"release",
"of",
"Galaxy",
"."
] | train | https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/GalaxyProperties.java#L126-L135 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/PeerGroup.java | PeerGroup.addBlocksDownloadedEventListener | public void addBlocksDownloadedEventListener(Executor executor, BlocksDownloadedEventListener listener) {
peersBlocksDownloadedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor));
for (Peer peer : getConnectedPeers())
peer.addBlocksDownloadedEventListener(executor, listener);
for (Peer peer : getPendingPeers())
peer.addBlocksDownloadedEventListener(executor, listener);
} | java | public void addBlocksDownloadedEventListener(Executor executor, BlocksDownloadedEventListener listener) {
peersBlocksDownloadedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor));
for (Peer peer : getConnectedPeers())
peer.addBlocksDownloadedEventListener(executor, listener);
for (Peer peer : getPendingPeers())
peer.addBlocksDownloadedEventListener(executor, listener);
} | [
"public",
"void",
"addBlocksDownloadedEventListener",
"(",
"Executor",
"executor",
",",
"BlocksDownloadedEventListener",
"listener",
")",
"{",
"peersBlocksDownloadedEventListeners",
".",
"add",
"(",
"new",
"ListenerRegistration",
"<>",
"(",
"checkNotNull",
"(",
"listener",
... | <p>Adds a listener that will be notified on the given executor when
blocks are downloaded by the download peer.</p>
@see Peer#addBlocksDownloadedEventListener(Executor, BlocksDownloadedEventListener) | [
"<p",
">",
"Adds",
"a",
"listener",
"that",
"will",
"be",
"notified",
"on",
"the",
"given",
"executor",
"when",
"blocks",
"are",
"downloaded",
"by",
"the",
"download",
"peer",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L639-L645 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.createToken | public CompletableFuture<Revision> createToken(Author author, String appId, String secret) {
return createToken(author, appId, secret, false);
} | java | public CompletableFuture<Revision> createToken(Author author, String appId, String secret) {
return createToken(author, appId, secret, false);
} | [
"public",
"CompletableFuture",
"<",
"Revision",
">",
"createToken",
"(",
"Author",
"author",
",",
"String",
"appId",
",",
"String",
"secret",
")",
"{",
"return",
"createToken",
"(",
"author",
",",
"appId",
",",
"secret",
",",
"false",
")",
";",
"}"
] | Creates a new user-level {@link Token} with the specified {@code appId} and {@code secret}. | [
"Creates",
"a",
"new",
"user",
"-",
"level",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L711-L713 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java | ReplicationLinksInner.beginFailoverAllowDataLossAsync | public Observable<Void> beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) {
return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) {
return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginFailoverAllowDataLossAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"linkId",
")",
"{",
"return",
"beginFailoverAllowDataLossWithServiceResponseAsync",
... | Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database that has the replication link to be failed over.
@param linkId The ID of the replication link to be failed over.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Sets",
"which",
"replica",
"database",
"is",
"primary",
"by",
"failing",
"over",
"from",
"the",
"current",
"primary",
"replica",
"database",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L591-L598 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java | JsonSerializationContext.traceError | public RuntimeException traceError( Object value, RuntimeException cause ) {
getLogger().log( Level.SEVERE, "Error during serialization", cause );
if ( wrapExceptions ) {
return new JsonSerializationException( cause );
} else {
return cause;
}
} | java | public RuntimeException traceError( Object value, RuntimeException cause ) {
getLogger().log( Level.SEVERE, "Error during serialization", cause );
if ( wrapExceptions ) {
return new JsonSerializationException( cause );
} else {
return cause;
}
} | [
"public",
"RuntimeException",
"traceError",
"(",
"Object",
"value",
",",
"RuntimeException",
"cause",
")",
"{",
"getLogger",
"(",
")",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Error during serialization\"",
",",
"cause",
")",
";",
"if",
"(",
"wrapExcep... | Trace an error and returns a corresponding exception.
@param value current value
@param cause cause of the error
@return a {@link JsonSerializationException} if we wrap the exceptions, the cause otherwise | [
"Trace",
"an",
"error",
"and",
"returns",
"a",
"corresponding",
"exception",
"."
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java#L533-L540 |
ben-manes/caffeine | caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java | BoundedLocalCache.evictionOrder | @SuppressWarnings("GuardedByChecker")
Map<K, V> evictionOrder(int limit, Function<V, V> transformer, boolean hottest) {
Supplier<Iterator<Node<K, V>>> iteratorSupplier = () -> {
Comparator<Node<K, V>> comparator = Comparator.comparingInt(node -> {
K key = node.getKey();
return (key == null) ? 0 : frequencySketch().frequency(key);
});
if (hottest) {
PeekingIterator<Node<K, V>> secondary = PeekingIterator.comparing(
accessOrderProbationDeque().descendingIterator(),
accessOrderWindowDeque().descendingIterator(), comparator);
return PeekingIterator.concat(accessOrderProtectedDeque().descendingIterator(), secondary);
} else {
PeekingIterator<Node<K, V>> primary = PeekingIterator.comparing(
accessOrderWindowDeque().iterator(), accessOrderProbationDeque().iterator(),
comparator.reversed());
return PeekingIterator.concat(primary, accessOrderProtectedDeque().iterator());
}
};
return fixedSnapshot(iteratorSupplier, limit, transformer);
} | java | @SuppressWarnings("GuardedByChecker")
Map<K, V> evictionOrder(int limit, Function<V, V> transformer, boolean hottest) {
Supplier<Iterator<Node<K, V>>> iteratorSupplier = () -> {
Comparator<Node<K, V>> comparator = Comparator.comparingInt(node -> {
K key = node.getKey();
return (key == null) ? 0 : frequencySketch().frequency(key);
});
if (hottest) {
PeekingIterator<Node<K, V>> secondary = PeekingIterator.comparing(
accessOrderProbationDeque().descendingIterator(),
accessOrderWindowDeque().descendingIterator(), comparator);
return PeekingIterator.concat(accessOrderProtectedDeque().descendingIterator(), secondary);
} else {
PeekingIterator<Node<K, V>> primary = PeekingIterator.comparing(
accessOrderWindowDeque().iterator(), accessOrderProbationDeque().iterator(),
comparator.reversed());
return PeekingIterator.concat(primary, accessOrderProtectedDeque().iterator());
}
};
return fixedSnapshot(iteratorSupplier, limit, transformer);
} | [
"@",
"SuppressWarnings",
"(",
"\"GuardedByChecker\"",
")",
"Map",
"<",
"K",
",",
"V",
">",
"evictionOrder",
"(",
"int",
"limit",
",",
"Function",
"<",
"V",
",",
"V",
">",
"transformer",
",",
"boolean",
"hottest",
")",
"{",
"Supplier",
"<",
"Iterator",
"<... | Returns an unmodifiable snapshot map ordered in eviction order, either ascending or descending.
Beware that obtaining the mappings is <em>NOT</em> a constant-time operation.
@param limit the maximum number of entries
@param transformer a function that unwraps the value
@param hottest the iteration order
@return an unmodifiable snapshot in a specified order | [
"Returns",
"an",
"unmodifiable",
"snapshot",
"map",
"ordered",
"in",
"eviction",
"order",
"either",
"ascending",
"or",
"descending",
".",
"Beware",
"that",
"obtaining",
"the",
"mappings",
"is",
"<em",
">",
"NOT<",
"/",
"em",
">",
"a",
"constant",
"-",
"time"... | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L2619-L2639 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java | ClientDecorationBuilder.addRpc | public <I extends RpcRequest, O extends RpcResponse>
ClientDecorationBuilder addRpc(DecoratingClientFunction<I, O> decorator) {
@SuppressWarnings("unchecked")
final DecoratingClientFunction<RpcRequest, RpcResponse> cast =
(DecoratingClientFunction<RpcRequest, RpcResponse>) decorator;
return add0(RpcRequest.class, RpcResponse.class, cast);
} | java | public <I extends RpcRequest, O extends RpcResponse>
ClientDecorationBuilder addRpc(DecoratingClientFunction<I, O> decorator) {
@SuppressWarnings("unchecked")
final DecoratingClientFunction<RpcRequest, RpcResponse> cast =
(DecoratingClientFunction<RpcRequest, RpcResponse>) decorator;
return add0(RpcRequest.class, RpcResponse.class, cast);
} | [
"public",
"<",
"I",
"extends",
"RpcRequest",
",",
"O",
"extends",
"RpcResponse",
">",
"ClientDecorationBuilder",
"addRpc",
"(",
"DecoratingClientFunction",
"<",
"I",
",",
"O",
">",
"decorator",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final... | Adds the specified RPC-level {@code decorator}.
@param decorator the {@link DecoratingClientFunction} that intercepts an invocation
@param <I> the {@link Request} type of the {@link Client} being decorated
@param <O> the {@link Response} type of the {@link Client} being decorated | [
"Adds",
"the",
"specified",
"RPC",
"-",
"level",
"{",
"@code",
"decorator",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java#L132-L138 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.