repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
opoo/opoopress | core/src/main/java/org/opoo/util/PathUtils.java | PathUtils.listFiles | public static List<File> listFiles(File dir, FileFilter filter, boolean recursive){
List<File> list = new ArrayList<File>();
listFilesInternal(list, dir, filter, recursive);
return list;
} | java | public static List<File> listFiles(File dir, FileFilter filter, boolean recursive){
List<File> list = new ArrayList<File>();
listFilesInternal(list, dir, filter, recursive);
return list;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"listFiles",
"(",
"File",
"dir",
",",
"FileFilter",
"filter",
",",
"boolean",
"recursive",
")",
"{",
"List",
"<",
"File",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"listFilesInt... | List files ONLY, not include directories. | [
"List",
"files",
"ONLY",
"not",
"include",
"directories",
"."
] | 4ed0265d294c8b748be48cf097949aa905ff1df2 | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/util/PathUtils.java#L115-L119 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WampSession.java | WampSession.getAttribute | @SuppressWarnings("unchecked")
public <T> T getAttribute(String name) {
return (T) this.webSocketSession.getAttributes().get(name);
} | java | @SuppressWarnings("unchecked")
public <T> T getAttribute(String name) {
return (T) this.webSocketSession.getAttributes().get(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getAttribute",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"T",
")",
"this",
".",
"webSocketSession",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
"... | Return the value for the attribute of the given name, if any.
@param name the name of the attribute
@return the current attribute value, or {@code null} if not found | [
"Return",
"the",
"value",
"for",
"the",
"attribute",
"of",
"the",
"given",
"name",
"if",
"any",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WampSession.java#L62-L65 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WampSession.java | WampSession.registerDestructionCallback | public void registerDestructionCallback(String name, Runnable callback) {
synchronized (getSessionMutex()) {
if (isSessionCompleted()) {
throw new IllegalStateException(
"Session id=" + getWebSocketSessionId() + " already completed");
}
setAttribute(DESTRUCTION_CALLBACK_NAME_PREFIX + name, callback... | java | public void registerDestructionCallback(String name, Runnable callback) {
synchronized (getSessionMutex()) {
if (isSessionCompleted()) {
throw new IllegalStateException(
"Session id=" + getWebSocketSessionId() + " already completed");
}
setAttribute(DESTRUCTION_CALLBACK_NAME_PREFIX + name, callback... | [
"public",
"void",
"registerDestructionCallback",
"(",
"String",
"name",
",",
"Runnable",
"callback",
")",
"{",
"synchronized",
"(",
"getSessionMutex",
"(",
")",
")",
"{",
"if",
"(",
"isSessionCompleted",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException... | Register a callback to execute on destruction of the specified attribute. The
callback is executed when the session is closed.
@param name the name of the attribute to register the callback for
@param callback the destruction callback to be executed | [
"Register",
"a",
"callback",
"to",
"execute",
"on",
"destruction",
"of",
"the",
"specified",
"attribute",
".",
"The",
"callback",
"is",
"executed",
"when",
"the",
"session",
"is",
"closed",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WampSession.java#L108-L116 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WampSession.java | WampSession.getSessionMutex | public Object getSessionMutex() {
Object mutex = getAttribute(SESSION_MUTEX_NAME);
if (mutex == null) {
mutex = this.webSocketSession.getAttributes();
}
return mutex;
} | java | public Object getSessionMutex() {
Object mutex = getAttribute(SESSION_MUTEX_NAME);
if (mutex == null) {
mutex = this.webSocketSession.getAttributes();
}
return mutex;
} | [
"public",
"Object",
"getSessionMutex",
"(",
")",
"{",
"Object",
"mutex",
"=",
"getAttribute",
"(",
"SESSION_MUTEX_NAME",
")",
";",
"if",
"(",
"mutex",
"==",
"null",
")",
"{",
"mutex",
"=",
"this",
".",
"webSocketSession",
".",
"getAttributes",
"(",
")",
";... | Expose the object to synchronize on for the underlying session.
@return the session mutex to use (never {@code null}) | [
"Expose",
"the",
"object",
"to",
"synchronize",
"on",
"for",
"the",
"underlying",
"session",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WampSession.java#L137-L143 | train |
RobAustin/low-latency-primitive-concurrent-queues | src/main/java/uk/co/boundedbuffer/ConcurrentBlockingIntQueue.java | ConcurrentBlockingIntQueue.peek | public int peek(long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
// non volatile read ( which is quicker )
final int readLocation = this.consumerReadLocation;
blockForReadSpace(timeout, unit, readLocation);
// purposely not volatile as the read... | java | public int peek(long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
// non volatile read ( which is quicker )
final int readLocation = this.consumerReadLocation;
blockForReadSpace(timeout, unit, readLocation);
// purposely not volatile as the read... | [
"public",
"int",
"peek",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"// non volatile read ( which is quicker )",
"final",
"int",
"readLocation",
"=",
"this",
".",
"consumerReadLocation",
";",
... | Retrieves, but does not remove, the head of this queue.
@param timeout how long to wait before giving up, in units of <tt>unit</tt>
@param unit a <tt>TimeUnit</tt> determining how to interpret the <tt>timeout</tt> parameter
@return the head of this queue
@throws java.util.concurrent.TimeoutException if timeout time... | [
"Retrieves",
"but",
"does",
"not",
"remove",
"the",
"head",
"of",
"this",
"queue",
"."
] | ffcf95a8135750c0b23cd486346a1f68a4724b1c | https://github.com/RobAustin/low-latency-primitive-concurrent-queues/blob/ffcf95a8135750c0b23cd486346a1f68a4724b1c/src/main/java/uk/co/boundedbuffer/ConcurrentBlockingIntQueue.java#L161-L172 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java | InvocableWampHandlerMethod.invoke | public Object invoke(WampMessage message, Object... providedArgs) throws Exception {
Object[] args = getMethodArgumentValues(message, providedArgs);
if (this.logger.isTraceEnabled()) {
this.logger.trace("Resolved arguments: " + Arrays.asList(args));
}
Object returnValue = doInvoke(args);
if (this.logger.is... | java | public Object invoke(WampMessage message, Object... providedArgs) throws Exception {
Object[] args = getMethodArgumentValues(message, providedArgs);
if (this.logger.isTraceEnabled()) {
this.logger.trace("Resolved arguments: " + Arrays.asList(args));
}
Object returnValue = doInvoke(args);
if (this.logger.is... | [
"public",
"Object",
"invoke",
"(",
"WampMessage",
"message",
",",
"Object",
"...",
"providedArgs",
")",
"throws",
"Exception",
"{",
"Object",
"[",
"]",
"args",
"=",
"getMethodArgumentValues",
"(",
"message",
",",
"providedArgs",
")",
";",
"if",
"(",
"this",
... | Invoke the method with the given message.
@throws Exception raised if no suitable argument resolver can be found, or the
method raised an exception | [
"Invoke",
"the",
"method",
"with",
"the",
"given",
"message",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java#L84-L94 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java | InvocableWampHandlerMethod.getMethodArgumentValues | private Object[] getMethodArgumentValues(WampMessage message, Object... providedArgs)
throws Exception {
MethodParameter[] parameters = getMethodParameters();
Object[] args = new Object[parameters.length];
int argIndex = 0;
for (int i = 0; i < parameters.length; i++) {
MethodParameter parameter = paramet... | java | private Object[] getMethodArgumentValues(WampMessage message, Object... providedArgs)
throws Exception {
MethodParameter[] parameters = getMethodParameters();
Object[] args = new Object[parameters.length];
int argIndex = 0;
for (int i = 0; i < parameters.length; i++) {
MethodParameter parameter = paramet... | [
"private",
"Object",
"[",
"]",
"getMethodArgumentValues",
"(",
"WampMessage",
"message",
",",
"Object",
"...",
"providedArgs",
")",
"throws",
"Exception",
"{",
"MethodParameter",
"[",
"]",
"parameters",
"=",
"getMethodParameters",
"(",
")",
";",
"Object",
"[",
"... | Get the method argument values for the current request. | [
"Get",
"the",
"method",
"argument",
"values",
"for",
"the",
"current",
"request",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java#L99-L140 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java | InvocableWampHandlerMethod.getDetailedErrorMessage | protected String getDetailedErrorMessage(String message) {
StringBuilder sb = new StringBuilder(message).append("\n");
sb.append("HandlerMethod details: \n");
sb.append("Bean [").append(getBeanType().getName()).append("]\n");
sb.append("Method [").append(getBridgedMethod().toGenericString()).append("]\n");
re... | java | protected String getDetailedErrorMessage(String message) {
StringBuilder sb = new StringBuilder(message).append("\n");
sb.append("HandlerMethod details: \n");
sb.append("Bean [").append(getBeanType().getName()).append("]\n");
sb.append("Method [").append(getBridgedMethod().toGenericString()).append("]\n");
re... | [
"protected",
"String",
"getDetailedErrorMessage",
"(",
"String",
"message",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"message",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"sb",
".",
"append",
"(",
"\"HandlerMethod details: \\n\"",
")... | Adds HandlerMethod details such as the controller type and method signature to the
given error message.
@param message error message to append the HandlerMethod details to | [
"Adds",
"HandlerMethod",
"details",
"such",
"as",
"the",
"controller",
"type",
"and",
"method",
"signature",
"to",
"the",
"given",
"error",
"message",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java#L154-L160 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java | InvocableWampHandlerMethod.doInvoke | protected Object doInvoke(Object... args) throws Exception {
ReflectionUtils.makeAccessible(getBridgedMethod());
try {
return getBridgedMethod().invoke(getBean(), args);
}
catch (IllegalArgumentException ex) {
assertTargetBean(getBridgedMethod(), getBean(), args);
throw new IllegalStateException(
... | java | protected Object doInvoke(Object... args) throws Exception {
ReflectionUtils.makeAccessible(getBridgedMethod());
try {
return getBridgedMethod().invoke(getBean(), args);
}
catch (IllegalArgumentException ex) {
assertTargetBean(getBridgedMethod(), getBean(), args);
throw new IllegalStateException(
... | [
"protected",
"Object",
"doInvoke",
"(",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"ReflectionUtils",
".",
"makeAccessible",
"(",
"getBridgedMethod",
"(",
")",
")",
";",
"try",
"{",
"return",
"getBridgedMethod",
"(",
")",
".",
"invoke",
"(",
"... | Invoke the handler method with the given argument values. | [
"Invoke",
"the",
"handler",
"method",
"with",
"the",
"given",
"argument",
"values",
"."
] | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/method/InvocableWampHandlerMethod.java#L165-L193 | train |
opoo/opoopress | core/src/main/java/org/opoo/press/impl/SiteConfigImpl.java | SiteConfigImpl.resolveConfigFiles | private File[] resolveConfigFiles(File base, Map<String, Object> override) {
//system properties
//-Dconfig=config.json -> override
//Override
if (override != null) {
String configFilesString = (String) override.remove("config");
if (StringUtils.isNotBlank(configF... | java | private File[] resolveConfigFiles(File base, Map<String, Object> override) {
//system properties
//-Dconfig=config.json -> override
//Override
if (override != null) {
String configFilesString = (String) override.remove("config");
if (StringUtils.isNotBlank(configF... | [
"private",
"File",
"[",
"]",
"resolveConfigFiles",
"(",
"File",
"base",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"override",
")",
"{",
"//system properties",
"//-Dconfig=config.json -> override",
"//Override",
"if",
"(",
"override",
"!=",
"null",
")",
"{",... | Find all config files.
@param base site base site
@param override command options, system properties, etc.
@return | [
"Find",
"all",
"config",
"files",
"."
] | 4ed0265d294c8b748be48cf097949aa905ff1df2 | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/impl/SiteConfigImpl.java#L173-L194 | train |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WebSocketTransportRegistration.java | WebSocketTransportRegistration.setDecoratorFactories | public WebSocketTransportRegistration setDecoratorFactories(
WebSocketHandlerDecoratorFactory... factories) {
if (factories != null) {
this.decoratorFactories.addAll(Arrays.asList(factories));
}
return this;
} | java | public WebSocketTransportRegistration setDecoratorFactories(
WebSocketHandlerDecoratorFactory... factories) {
if (factories != null) {
this.decoratorFactories.addAll(Arrays.asList(factories));
}
return this;
} | [
"public",
"WebSocketTransportRegistration",
"setDecoratorFactories",
"(",
"WebSocketHandlerDecoratorFactory",
"...",
"factories",
")",
"{",
"if",
"(",
"factories",
"!=",
"null",
")",
"{",
"this",
".",
"decoratorFactories",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
... | Configure one or more factories to decorate the handler used to process WebSocket
messages. This may be useful in some advanced use cases, for example to allow
Spring Security to forcibly close the WebSocket session when the corresponding HTTP
session expires. | [
"Configure",
"one",
"or",
"more",
"factories",
"to",
"decorate",
"the",
"handler",
"used",
"to",
"process",
"WebSocket",
"messages",
".",
"This",
"may",
"be",
"useful",
"in",
"some",
"advanced",
"use",
"cases",
"for",
"example",
"to",
"allow",
"Spring",
"Sec... | 7571bb6773b848c580b29890587eb35397bfe5b5 | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WebSocketTransportRegistration.java#L134-L140 | train |
RobAustin/low-latency-primitive-concurrent-queues | src/main/java/uk/co/boundedbuffer/ConcurrentBlockingFloatQueue.java | ConcurrentBlockingFloatQueue.offer | public boolean offer(float value, long timeout, TimeUnit unit)
throws InterruptedException {
// non volatile read ( which is quicker )
final int writeLocation = this.producerWriteLocation;
// sets the nextWriteLocation my moving it on by 1, this may cause it it wrap back to the st... | java | public boolean offer(float value, long timeout, TimeUnit unit)
throws InterruptedException {
// non volatile read ( which is quicker )
final int writeLocation = this.producerWriteLocation;
// sets the nextWriteLocation my moving it on by 1, this may cause it it wrap back to the st... | [
"public",
"boolean",
"offer",
"(",
"float",
"value",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"// non volatile read ( which is quicker )",
"final",
"int",
"writeLocation",
"=",
"this",
".",
"producerWriteLocation",
... | Inserts the specified element into this queue, waiting up to the specified wait time if necessary for
space to become available.
@param value the element to add
@param timeout how long to wait before giving up, in units of <tt>unit</tt>
@param unit a <tt>TimeUnit</tt> determining how to interpret the <tt>timeout<... | [
"Inserts",
"the",
"specified",
"element",
"into",
"this",
"queue",
"waiting",
"up",
"to",
"the",
"specified",
"wait",
"time",
"if",
"necessary",
"for",
"space",
"to",
"become",
"available",
"."
] | ffcf95a8135750c0b23cd486346a1f68a4724b1c | https://github.com/RobAustin/low-latency-primitive-concurrent-queues/blob/ffcf95a8135750c0b23cd486346a1f68a4724b1c/src/main/java/uk/co/boundedbuffer/ConcurrentBlockingFloatQueue.java#L240-L283 | train |
RobAustin/low-latency-primitive-concurrent-queues | src/main/java/uk/co/boundedbuffer/AbstractBlockingQueue.java | AbstractBlockingQueue.size | public int size() {
int read = readLocation;
int write = writeLocation;
if (write < read)
write += capacity;
return write - read;
} | java | public int size() {
int read = readLocation;
int write = writeLocation;
if (write < read)
write += capacity;
return write - read;
} | [
"public",
"int",
"size",
"(",
")",
"{",
"int",
"read",
"=",
"readLocation",
";",
"int",
"write",
"=",
"writeLocation",
";",
"if",
"(",
"write",
"<",
"read",
")",
"write",
"+=",
"capacity",
";",
"return",
"write",
"-",
"read",
";",
"}"
] | This method is not thread safe it therefore only provides and approximation of the size,
the size will be corrected if nothing was added or removed from the queue at the time it was called
@return an approximation of the size | [
"This",
"method",
"is",
"not",
"thread",
"safe",
"it",
"therefore",
"only",
"provides",
"and",
"approximation",
"of",
"the",
"size",
"the",
"size",
"will",
"be",
"corrected",
"if",
"nothing",
"was",
"added",
"or",
"removed",
"from",
"the",
"queue",
"at",
"... | ffcf95a8135750c0b23cd486346a1f68a4724b1c | https://github.com/RobAustin/low-latency-primitive-concurrent-queues/blob/ffcf95a8135750c0b23cd486346a1f68a4724b1c/src/main/java/uk/co/boundedbuffer/AbstractBlockingQueue.java#L138-L147 | train |
opoo/opoopress | wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java | GitHub.removeEmpties | public static String[] removeEmpties(final String... values) {
if (values == null || values.length == 0){
return new String[0];
}
List<String> validValues = new ArrayList<String>();
for (String value : values){
if (value != null && value.length() > 0){
validValues.add(value);
}
}
return validVa... | java | public static String[] removeEmpties(final String... values) {
if (values == null || values.length == 0){
return new String[0];
}
List<String> validValues = new ArrayList<String>();
for (String value : values){
if (value != null && value.length() > 0){
validValues.add(value);
}
}
return validVa... | [
"public",
"static",
"String",
"[",
"]",
"removeEmpties",
"(",
"final",
"String",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"String",
"[",
"0",
"]",
";",
"}",
"... | Create an array with only the non-null and non-empty values
@param values
@return non-null but possibly empty array of non-null/non-empty strings | [
"Create",
"an",
"array",
"with",
"only",
"the",
"non",
"-",
"null",
"and",
"non",
"-",
"empty",
"values"
] | 4ed0265d294c8b748be48cf097949aa905ff1df2 | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java#L567-L578 | train |
opoo/opoopress | wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java | GitHub.getMatchingPaths | public static String[] getMatchingPaths(final String[] includes,
final String[] excludes, final String baseDir) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(baseDir);
if (includes != null && includes.length > 0){
scanner.setIncludes(includes);
}
if (excludes != null && exclude... | java | public static String[] getMatchingPaths(final String[] includes,
final String[] excludes, final String baseDir) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(baseDir);
if (includes != null && includes.length > 0){
scanner.setIncludes(includes);
}
if (excludes != null && exclude... | [
"public",
"static",
"String",
"[",
"]",
"getMatchingPaths",
"(",
"final",
"String",
"[",
"]",
"includes",
",",
"final",
"String",
"[",
"]",
"excludes",
",",
"final",
"String",
"baseDir",
")",
"{",
"DirectoryScanner",
"scanner",
"=",
"new",
"DirectoryScanner",
... | Get matching paths found in given base directory
@param includes
@param excludes
@param baseDir
@return non-null but possibly empty array of string paths relative to the
base directory | [
"Get",
"matching",
"paths",
"found",
"in",
"given",
"base",
"directory"
] | 4ed0265d294c8b748be48cf097949aa905ff1df2 | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java#L590-L602 | train |
opoo/opoopress | core/src/main/java/org/opoo/press/impl/SiteObserver.java | SiteObserver.createConfigFilesFilter | private FileFilter createConfigFilesFilter() {
SiteConfig config = site.getConfig();
boolean useDefaultConfigFiles = config.useDefaultConfigFiles();
if (useDefaultConfigFiles) {
log.debug("Using default config files.");
return SiteConfigImpl.DEFAULT_CONFIG_FILES_FILTER;
... | java | private FileFilter createConfigFilesFilter() {
SiteConfig config = site.getConfig();
boolean useDefaultConfigFiles = config.useDefaultConfigFiles();
if (useDefaultConfigFiles) {
log.debug("Using default config files.");
return SiteConfigImpl.DEFAULT_CONFIG_FILES_FILTER;
... | [
"private",
"FileFilter",
"createConfigFilesFilter",
"(",
")",
"{",
"SiteConfig",
"config",
"=",
"site",
".",
"getConfig",
"(",
")",
";",
"boolean",
"useDefaultConfigFiles",
"=",
"config",
".",
"useDefaultConfigFiles",
"(",
")",
";",
"if",
"(",
"useDefaultConfigFil... | Create config files FileFilter.
@return file filter | [
"Create",
"config",
"files",
"FileFilter",
"."
] | 4ed0265d294c8b748be48cf097949aa905ff1df2 | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/impl/SiteObserver.java#L80-L100 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Vectors.java | Vectors.inverseTransform | public static Vector inverseTransform (double x, double y, double sx, double sy, double rotation,
Vector result) {
double sinnega = Math.sin(-rotation), cosnega = Math.cos(-rotation);
double nx = (x * cosnega - y * sinnega); // unrotate
double ny = (x *... | java | public static Vector inverseTransform (double x, double y, double sx, double sy, double rotation,
Vector result) {
double sinnega = Math.sin(-rotation), cosnega = Math.cos(-rotation);
double nx = (x * cosnega - y * sinnega); // unrotate
double ny = (x *... | [
"public",
"static",
"Vector",
"inverseTransform",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"sx",
",",
"double",
"sy",
",",
"double",
"rotation",
",",
"Vector",
"result",
")",
"{",
"double",
"sinnega",
"=",
"Math",
".",
"sin",
"(",
"-",
"r... | Inverse transforms a vector as specified, storing the result in the vector provided.
@return a reference to the result vector, for chaining. | [
"Inverse",
"transforms",
"a",
"vector",
"as",
"specified",
"storing",
"the",
"result",
"in",
"the",
"vector",
"provided",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Vectors.java#L134-L140 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CommandLineApplication.java | CommandLineApplication.start | public void start() {
setDefaultLogLevel();
/*
* JLine doesn't run in Eclipse. To get around this, we allow
* a property "jlineDisable" to be specified via VM arguments.
* This causes it to use standard scanning of System.in and disables
* auto complete functionality.
*/
if (Boolean.get... | java | public void start() {
setDefaultLogLevel();
/*
* JLine doesn't run in Eclipse. To get around this, we allow
* a property "jlineDisable" to be specified via VM arguments.
* This causes it to use standard scanning of System.in and disables
* auto complete functionality.
*/
if (Boolean.get... | [
"public",
"void",
"start",
"(",
")",
"{",
"setDefaultLogLevel",
"(",
")",
";",
"/*\r\n\t\t * JLine doesn't run in Eclipse. To get around this, we allow\r\n\t\t * a property \"jlineDisable\" to be specified via VM arguments.\r\n\t\t * This causes it to use standard scanning of System.in and disab... | Start the application. This will continuously loop until
the user exits the application. | [
"Start",
"the",
"application",
".",
"This",
"will",
"continuously",
"loop",
"until",
"the",
"user",
"exits",
"the",
"application",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CommandLineApplication.java#L70-L106 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CommandLineApplication.java | CommandLineApplication.findAndCreateCommand | protected FindCommandResult findAndCreateCommand(String[] args) throws CommandInitException {
String commandName = args[0];
String[] remainingArguments = StringUtils.stripArgs(args, 1);
// Check top level commands for app
Class<? extends Command<? extends CLIContext>> commandClass = _commands.get(co... | java | protected FindCommandResult findAndCreateCommand(String[] args) throws CommandInitException {
String commandName = args[0];
String[] remainingArguments = StringUtils.stripArgs(args, 1);
// Check top level commands for app
Class<? extends Command<? extends CLIContext>> commandClass = _commands.get(co... | [
"protected",
"FindCommandResult",
"findAndCreateCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"CommandInitException",
"{",
"String",
"commandName",
"=",
"args",
"[",
"0",
"]",
";",
"String",
"[",
"]",
"remainingArguments",
"=",
"StringUtils",
".",
"s... | Find and create the command instance.
@param args the actual residual command line.
@return The command, or null if the command name is not recognized.
@throws CommandInitException Thrown when the command is recognized but failed to load. | [
"Find",
"and",
"create",
"the",
"command",
"instance",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CommandLineApplication.java#L189-L208 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CommandLineApplication.java | CommandLineApplication.loadCommands | private Map<String, Class<? extends Command<? extends CLIContext>>> loadCommands() throws CLIInitException{
Map<String, Class<? extends Command<? extends CLIContext>>> commands =
new HashMap<String, Class<? extends Command<? extends CLIContext>>>();
Discoverer discoverer = new ClasspathDiscoverer();
CL... | java | private Map<String, Class<? extends Command<? extends CLIContext>>> loadCommands() throws CLIInitException{
Map<String, Class<? extends Command<? extends CLIContext>>> commands =
new HashMap<String, Class<? extends Command<? extends CLIContext>>>();
Discoverer discoverer = new ClasspathDiscoverer();
CL... | [
"private",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"Command",
"<",
"?",
"extends",
"CLIContext",
">",
">",
">",
"loadCommands",
"(",
")",
"throws",
"CLIInitException",
"{",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"Comman... | Load the necessary commands for this application.
@return The map of commands.
@throws CLIInitException Thrown when commands fail to properly load. | [
"Load",
"the",
"necessary",
"commands",
"for",
"this",
"application",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CommandLineApplication.java#L231-L247 | train |
samskivert/pythagoras | src/main/java/pythagoras/i/Rectangle.java | Rectangle.setBounds | public void setBounds (IRectangle r) {
setBounds(r.x(), r.y(), r.width(), r.height());
} | java | public void setBounds (IRectangle r) {
setBounds(r.x(), r.y(), r.width(), r.height());
} | [
"public",
"void",
"setBounds",
"(",
"IRectangle",
"r",
")",
"{",
"setBounds",
"(",
"r",
".",
"x",
"(",
")",
",",
"r",
".",
"y",
"(",
")",
",",
"r",
".",
"width",
"(",
")",
",",
"r",
".",
"height",
"(",
")",
")",
";",
"}"
] | Sets the bounds of this rectangle to those of the supplied rectangle. | [
"Sets",
"the",
"bounds",
"of",
"this",
"rectangle",
"to",
"those",
"of",
"the",
"supplied",
"rectangle",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Rectangle.java#L113-L115 | train |
samskivert/pythagoras | src/main/java/pythagoras/i/Rectangle.java | Rectangle.add | public void add (int px, int py) {
int x1 = Math.min(x, px);
int x2 = Math.max(x + width, px);
int y1 = Math.min(y, py);
int y2 = Math.max(y + height, py);
setBounds(x1, y1, x2 - x1, y2 - y1);
} | java | public void add (int px, int py) {
int x1 = Math.min(x, px);
int x2 = Math.max(x + width, px);
int y1 = Math.min(y, py);
int y2 = Math.max(y + height, py);
setBounds(x1, y1, x2 - x1, y2 - y1);
} | [
"public",
"void",
"add",
"(",
"int",
"px",
",",
"int",
"py",
")",
"{",
"int",
"x1",
"=",
"Math",
".",
"min",
"(",
"x",
",",
"px",
")",
";",
"int",
"x2",
"=",
"Math",
".",
"max",
"(",
"x",
"+",
"width",
",",
"px",
")",
";",
"int",
"y1",
"=... | Expands the bounds of this rectangle to contain the specified point. | [
"Expands",
"the",
"bounds",
"of",
"this",
"rectangle",
"to",
"contain",
"the",
"specified",
"point",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Rectangle.java#L140-L146 | train |
samskivert/pythagoras | src/main/java/pythagoras/i/Rectangle.java | Rectangle.add | public void add (IRectangle r) {
int x1 = Math.min(x, r.x());
int x2 = Math.max(x + width, r.x() + r.width());
int y1 = Math.min(y, r.y());
int y2 = Math.max(y + height, r.y() + r.height());
setBounds(x1, y1, x2 - x1, y2 - y1);
} | java | public void add (IRectangle r) {
int x1 = Math.min(x, r.x());
int x2 = Math.max(x + width, r.x() + r.width());
int y1 = Math.min(y, r.y());
int y2 = Math.max(y + height, r.y() + r.height());
setBounds(x1, y1, x2 - x1, y2 - y1);
} | [
"public",
"void",
"add",
"(",
"IRectangle",
"r",
")",
"{",
"int",
"x1",
"=",
"Math",
".",
"min",
"(",
"x",
",",
"r",
".",
"x",
"(",
")",
")",
";",
"int",
"x2",
"=",
"Math",
".",
"max",
"(",
"x",
"+",
"width",
",",
"r",
".",
"x",
"(",
")",... | Expands the bounds of this rectangle to contain the supplied rectangle. | [
"Expands",
"the",
"bounds",
"of",
"this",
"rectangle",
"to",
"contain",
"the",
"supplied",
"rectangle",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Rectangle.java#L158-L164 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Vector.java | Vector.setAngle | public Vector setAngle (double angle) {
double l = length();
return set(l * Math.cos(angle), l * Math.sin(angle));
} | java | public Vector setAngle (double angle) {
double l = length();
return set(l * Math.cos(angle), l * Math.sin(angle));
} | [
"public",
"Vector",
"setAngle",
"(",
"double",
"angle",
")",
"{",
"double",
"l",
"=",
"length",
"(",
")",
";",
"return",
"set",
"(",
"l",
"*",
"Math",
".",
"cos",
"(",
"angle",
")",
",",
"l",
"*",
"Math",
".",
"sin",
"(",
"angle",
")",
")",
";"... | Sets this vector's angle, preserving its magnitude.
@return a reference to this vector, for chaining. | [
"Sets",
"this",
"vector",
"s",
"angle",
"preserving",
"its",
"magnitude",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Vector.java#L130-L133 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/config/ClientConfiguration.java | ClientConfiguration.setListenerURL | public boolean setListenerURL(String listenerURL) {
String newURL = _substitutor.replace(listenerURL);
boolean changed = false;
if (!_urlValidator.isValid(newURL)) {
error("The Response Listener URL specified is invalid. Continuing with previous value.");
} else {
if (!newURL.equalsIgnoreCas... | java | public boolean setListenerURL(String listenerURL) {
String newURL = _substitutor.replace(listenerURL);
boolean changed = false;
if (!_urlValidator.isValid(newURL)) {
error("The Response Listener URL specified is invalid. Continuing with previous value.");
} else {
if (!newURL.equalsIgnoreCas... | [
"public",
"boolean",
"setListenerURL",
"(",
"String",
"listenerURL",
")",
"{",
"String",
"newURL",
"=",
"_substitutor",
".",
"replace",
"(",
"listenerURL",
")",
";",
"boolean",
"changed",
"=",
"false",
";",
"if",
"(",
"!",
"_urlValidator",
".",
"isValid",
"(... | Sets the Listener URL. Checks to see if the URL is valid, or it does
nothing.
@param listenerURL new URL for the client listener
@return if this actually changed the listener URL | [
"Sets",
"the",
"Listener",
"URL",
".",
"Checks",
"to",
"see",
"if",
"the",
"URL",
"is",
"valid",
"or",
"it",
"does",
"nothing",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/config/ClientConfiguration.java#L100-L113 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/config/ClientConfiguration.java | ClientConfiguration.setResponseURL | public void setResponseURL(String responseURL) {
String newURL = _substitutor.replace(responseURL);
if (!_urlValidator.isValid(newURL)) {
error("The RespondTo URL specified is invalid. Continuing with previous value.");
} else {
this._responseURL = newURL;
}
} | java | public void setResponseURL(String responseURL) {
String newURL = _substitutor.replace(responseURL);
if (!_urlValidator.isValid(newURL)) {
error("The RespondTo URL specified is invalid. Continuing with previous value.");
} else {
this._responseURL = newURL;
}
} | [
"public",
"void",
"setResponseURL",
"(",
"String",
"responseURL",
")",
"{",
"String",
"newURL",
"=",
"_substitutor",
".",
"replace",
"(",
"responseURL",
")",
";",
"if",
"(",
"!",
"_urlValidator",
".",
"isValid",
"(",
"newURL",
")",
")",
"{",
"error",
"(",
... | Sets the respondTo URL for the client probes to use. If the URL is invalid
it does nothing.
@param responseURL URL for the client probes to use | [
"Sets",
"the",
"respondTo",
"URL",
"for",
"the",
"client",
"probes",
"to",
"use",
".",
"If",
"the",
"URL",
"is",
"invalid",
"it",
"does",
"nothing",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/config/ClientConfiguration.java#L125-L132 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Box.java | Box.set | public Box set (IVector3 minExtent, IVector3 maxExtent) {
_minExtent.set(minExtent);
_maxExtent.set(maxExtent);
return this;
} | java | public Box set (IVector3 minExtent, IVector3 maxExtent) {
_minExtent.set(minExtent);
_maxExtent.set(maxExtent);
return this;
} | [
"public",
"Box",
"set",
"(",
"IVector3",
"minExtent",
",",
"IVector3",
"maxExtent",
")",
"{",
"_minExtent",
".",
"set",
"(",
"minExtent",
")",
";",
"_maxExtent",
".",
"set",
"(",
"maxExtent",
")",
";",
"return",
"this",
";",
"}"
] | Sets the box parameters to the values contained in the supplied vectors.
@return a reference to this box, for chaining. | [
"Sets",
"the",
"box",
"parameters",
"to",
"the",
"values",
"contained",
"in",
"the",
"supplied",
"vectors",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Box.java#L73-L77 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Box.java | Box.fromPoints | public Box fromPoints (IVector3... points) {
setToEmpty();
for (IVector3 point : points) {
addLocal(point);
}
return this;
} | java | public Box fromPoints (IVector3... points) {
setToEmpty();
for (IVector3 point : points) {
addLocal(point);
}
return this;
} | [
"public",
"Box",
"fromPoints",
"(",
"IVector3",
"...",
"points",
")",
"{",
"setToEmpty",
"(",
")",
";",
"for",
"(",
"IVector3",
"point",
":",
"points",
")",
"{",
"addLocal",
"(",
"point",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Initializes this box with the extents of an array of points.
@return a reference to this box, for chaining. | [
"Initializes",
"this",
"box",
"with",
"the",
"extents",
"of",
"an",
"array",
"of",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Box.java#L84-L90 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Crossing.java | Crossing.solveQuad | public static int solveQuad (double[] eqn, double[] res) {
double a = eqn[2];
double b = eqn[1];
double c = eqn[0];
int rc = 0;
if (a == 0f) {
if (b == 0f) {
return -1;
}
res[rc++] = -c / b;
} else {
double d... | java | public static int solveQuad (double[] eqn, double[] res) {
double a = eqn[2];
double b = eqn[1];
double c = eqn[0];
int rc = 0;
if (a == 0f) {
if (b == 0f) {
return -1;
}
res[rc++] = -c / b;
} else {
double d... | [
"public",
"static",
"int",
"solveQuad",
"(",
"double",
"[",
"]",
"eqn",
",",
"double",
"[",
"]",
"res",
")",
"{",
"double",
"a",
"=",
"eqn",
"[",
"2",
"]",
";",
"double",
"b",
"=",
"eqn",
"[",
"1",
"]",
";",
"double",
"c",
"=",
"eqn",
"[",
"0... | Solves quadratic equation
@param eqn the coefficients of the equation
@param res the roots of the equation
@return a number of roots | [
"Solves",
"quadratic",
"equation"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Crossing.java#L25-L49 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Crossing.java | Crossing.solveCubic | public static int solveCubic (double[] eqn, double[] res) {
double d = eqn[3];
if (d == 0) {
return solveQuad(eqn, res);
}
double a = eqn[2] / d;
double b = eqn[1] / d;
double c = eqn[0] / d;
int rc = 0;
double Q = (a * a - 3f * b) / 9f;
... | java | public static int solveCubic (double[] eqn, double[] res) {
double d = eqn[3];
if (d == 0) {
return solveQuad(eqn, res);
}
double a = eqn[2] / d;
double b = eqn[1] / d;
double c = eqn[0] / d;
int rc = 0;
double Q = (a * a - 3f * b) / 9f;
... | [
"public",
"static",
"int",
"solveCubic",
"(",
"double",
"[",
"]",
"eqn",
",",
"double",
"[",
"]",
"res",
")",
"{",
"double",
"d",
"=",
"eqn",
"[",
"3",
"]",
";",
"if",
"(",
"d",
"==",
"0",
")",
"{",
"return",
"solveQuad",
"(",
"eqn",
",",
"res"... | Solves cubic equation
@param eqn the coefficients of the equation
@param res the roots of the equation
@return a number of roots | [
"Solves",
"cubic",
"equation"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Crossing.java#L58-L102 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Crossing.java | Crossing.intersectLine | public static int intersectLine (double x1, double y1, double x2, double y2, double rx1,
double ry1, double rx2, double ry2) {
// LEFT/RIGHT/UP
if ((rx2 < x1 && rx2 < x2) || (rx1 > x1 && rx1 > x2) || (ry1 > y1 && ry1 > y2)) {
return 0;
}
... | java | public static int intersectLine (double x1, double y1, double x2, double y2, double rx1,
double ry1, double rx2, double ry2) {
// LEFT/RIGHT/UP
if ((rx2 < x1 && rx2 < x2) || (rx1 > x1 && rx1 > x2) || (ry1 > y1 && ry1 > y2)) {
return 0;
}
... | [
"public",
"static",
"int",
"intersectLine",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"rx1",
",",
"double",
"ry1",
",",
"double",
"rx2",
",",
"double",
"ry2",
")",
"{",
"// LEFT/RIGHT/UP",
"if",
... | Returns how many times rectangle stripe cross line or the are intersect | [
"Returns",
"how",
"many",
"times",
"rectangle",
"stripe",
"cross",
"line",
"or",
"the",
"are",
"intersect"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Crossing.java#L491-L551 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Crossing.java | Crossing.sortBound | protected static void sortBound (double[] bound, int bc) {
for (int i = 0; i < bc - 4; i += 4) {
int k = i;
for (int j = i + 4; j < bc; j += 4) {
if (bound[k] > bound[j]) {
k = j;
}
}
if (k != i) {
... | java | protected static void sortBound (double[] bound, int bc) {
for (int i = 0; i < bc - 4; i += 4) {
int k = i;
for (int j = i + 4; j < bc; j += 4) {
if (bound[k] > bound[j]) {
k = j;
}
}
if (k != i) {
... | [
"protected",
"static",
"void",
"sortBound",
"(",
"double",
"[",
"]",
"bound",
",",
"int",
"bc",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bc",
"-",
"4",
";",
"i",
"+=",
"4",
")",
"{",
"int",
"k",
"=",
"i",
";",
"for",
"(",... | Sorts a bound array. | [
"Sorts",
"a",
"bound",
"array",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Crossing.java#L787-L810 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Crossing.java | Crossing.crossBound | protected static int crossBound (double[] bound, int bc, double py1, double py2) {
// LEFT/RIGHT
if (bc == 0) {
return 0;
}
// Check Y coordinate
int up = 0;
int down = 0;
for (int i = 2; i < bc; i += 4) {
if (bound[i] < py1) {
... | java | protected static int crossBound (double[] bound, int bc, double py1, double py2) {
// LEFT/RIGHT
if (bc == 0) {
return 0;
}
// Check Y coordinate
int up = 0;
int down = 0;
for (int i = 2; i < bc; i += 4) {
if (bound[i] < py1) {
... | [
"protected",
"static",
"int",
"crossBound",
"(",
"double",
"[",
"]",
"bound",
",",
"int",
"bc",
",",
"double",
"py1",
",",
"double",
"py2",
")",
"{",
"// LEFT/RIGHT",
"if",
"(",
"bc",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"// Check Y coordinate... | Returns whether bounds intersect a rectangle or not. | [
"Returns",
"whether",
"bounds",
"intersect",
"a",
"rectangle",
"or",
"not",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Crossing.java#L815-L854 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Matrix3.java | Matrix3.setElement | public void setElement (int row, int col, float value) {
switch (col) {
case 0:
switch (row) {
case 0: m00 = value; return;
case 1: m01 = value; return;
case 2: m02 = value; return;
}
break;
case 1:
switch (row) ... | java | public void setElement (int row, int col, float value) {
switch (col) {
case 0:
switch (row) {
case 0: m00 = value; return;
case 1: m01 = value; return;
case 2: m02 = value; return;
}
break;
case 1:
switch (row) ... | [
"public",
"void",
"setElement",
"(",
"int",
"row",
",",
"int",
"col",
",",
"float",
"value",
")",
"{",
"switch",
"(",
"col",
")",
"{",
"case",
"0",
":",
"switch",
"(",
"row",
")",
"{",
"case",
"0",
":",
"m00",
"=",
"value",
";",
"return",
";",
... | Sets the matrix element at the specified row and column. | [
"Sets",
"the",
"matrix",
"element",
"at",
"the",
"specified",
"row",
"and",
"column",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix3.java#L63-L88 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Plane.java | Plane.fromPoints | public Plane fromPoints (IVector3 p1, IVector3 p2, IVector3 p3) {
// compute the normal by taking the cross product of the two vectors formed
p2.subtract(p1, _v1);
p3.subtract(p1, _v2);
_v1.cross(_v2, _normal).normalizeLocal();
// use the first point to determine the constant
... | java | public Plane fromPoints (IVector3 p1, IVector3 p2, IVector3 p3) {
// compute the normal by taking the cross product of the two vectors formed
p2.subtract(p1, _v1);
p3.subtract(p1, _v2);
_v1.cross(_v2, _normal).normalizeLocal();
// use the first point to determine the constant
... | [
"public",
"Plane",
"fromPoints",
"(",
"IVector3",
"p1",
",",
"IVector3",
"p2",
",",
"IVector3",
"p3",
")",
"{",
"// compute the normal by taking the cross product of the two vectors formed",
"p2",
".",
"subtract",
"(",
"p1",
",",
"_v1",
")",
";",
"p3",
".",
"subtr... | Sets this plane based on the three points provided.
@return a reference to the plane (for chaining). | [
"Sets",
"this",
"plane",
"based",
"on",
"the",
"three",
"points",
"provided",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Plane.java#L109-L118 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Plane.java | Plane.fromPointNormal | public Plane fromPointNormal (IVector3 pt, IVector3 normal) {
return set(normal, -normal.dot(pt));
} | java | public Plane fromPointNormal (IVector3 pt, IVector3 normal) {
return set(normal, -normal.dot(pt));
} | [
"public",
"Plane",
"fromPointNormal",
"(",
"IVector3",
"pt",
",",
"IVector3",
"normal",
")",
"{",
"return",
"set",
"(",
"normal",
",",
"-",
"normal",
".",
"dot",
"(",
"pt",
")",
")",
";",
"}"
] | Sets this plane based on a point on the plane and the plane normal.
@return a reference to the plane (for chaining). | [
"Sets",
"this",
"plane",
"based",
"on",
"a",
"point",
"on",
"the",
"plane",
"and",
"the",
"plane",
"normal",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Plane.java#L125-L127 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/StringUtils.java | StringUtils.stripArgs | public static String[] stripArgs(String[] originalArgs, int stripCount) {
if (originalArgs.length <= stripCount) {
return new String[0];
}
String[] stripped = new String[originalArgs.length - stripCount];
for (int i = 0; i < stripped.length; i++) {
stripped[i] = originalArgs[i+stripCount];
}
r... | java | public static String[] stripArgs(String[] originalArgs, int stripCount) {
if (originalArgs.length <= stripCount) {
return new String[0];
}
String[] stripped = new String[originalArgs.length - stripCount];
for (int i = 0; i < stripped.length; i++) {
stripped[i] = originalArgs[i+stripCount];
}
r... | [
"public",
"static",
"String",
"[",
"]",
"stripArgs",
"(",
"String",
"[",
"]",
"originalArgs",
",",
"int",
"stripCount",
")",
"{",
"if",
"(",
"originalArgs",
".",
"length",
"<=",
"stripCount",
")",
"{",
"return",
"new",
"String",
"[",
"0",
"]",
";",
"}"... | Strip the first N items from the array.
@param originalArgs The original array.
@param stripCount How many items to strip.
@return A copy of the original array with the first N items stripped off. | [
"Strip",
"the",
"first",
"N",
"items",
"from",
"the",
"array",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/StringUtils.java#L16-L25 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java | FluentMatchingC.when | public <U extends T> OngoingMatchingC0<T, U> when(MatchesExact<U> o) {
List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(o.t));
return new OngoingMatchingC0<>(
this, new DecomposableMatchBuilder0<>(matchers, new IdentityFieldExtractor<U>()).build());
} | java | public <U extends T> OngoingMatchingC0<T, U> when(MatchesExact<U> o) {
List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(o.t));
return new OngoingMatchingC0<>(
this, new DecomposableMatchBuilder0<>(matchers, new IdentityFieldExtractor<U>()).build());
} | [
"public",
"<",
"U",
"extends",
"T",
">",
"OngoingMatchingC0",
"<",
"T",
",",
"U",
">",
"when",
"(",
"MatchesExact",
"<",
"U",
">",
"o",
")",
"{",
"List",
"<",
"Matcher",
"<",
"Object",
">>",
"matchers",
"=",
"Lists",
".",
"of",
"(",
"ArgumentMatchers... | Specifies an exact match and then returns a fluent interface for specifying the action to take
if the value matches this case. | [
"Specifies",
"an",
"exact",
"match",
"and",
"then",
"returns",
"a",
"fluent",
"interface",
"for",
"specifying",
"the",
"action",
"to",
"take",
"if",
"the",
"value",
"matches",
"this",
"case",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java#L56-L60 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java | FluentMatchingC.when | public <U extends T> OngoingMatchingC1<T, U, U> when(MatchesAny<U> o) {
List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.any());
return new OngoingMatchingC1<>(
this,
new DecomposableMatchBuilder1<U, U>(matchers, 0, new IdentityFieldExtractor<>()).build());
} | java | public <U extends T> OngoingMatchingC1<T, U, U> when(MatchesAny<U> o) {
List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.any());
return new OngoingMatchingC1<>(
this,
new DecomposableMatchBuilder1<U, U>(matchers, 0, new IdentityFieldExtractor<>()).build());
} | [
"public",
"<",
"U",
"extends",
"T",
">",
"OngoingMatchingC1",
"<",
"T",
",",
"U",
",",
"U",
">",
"when",
"(",
"MatchesAny",
"<",
"U",
">",
"o",
")",
"{",
"List",
"<",
"Matcher",
"<",
"Object",
">>",
"matchers",
"=",
"Lists",
".",
"of",
"(",
"Argu... | Specifies a wildcard match and then returns a fluent interface for specifying the action to
take if the value matches this case. | [
"Specifies",
"a",
"wildcard",
"match",
"and",
"then",
"returns",
"a",
"fluent",
"interface",
"for",
"specifying",
"the",
"action",
"to",
"take",
"if",
"the",
"value",
"matches",
"this",
"case",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java#L66-L71 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java | FluentMatchingC.doMatch | public void doMatch() {
boolean matchFound = false;
for (ConsumablePattern<T> pattern : patterns) {
if (pattern.matches(value)) {
pattern.consume(value);
matchFound = true;
break;
}
}
if (!matchFound) {
throw new MatchException("No match found for " + value);
... | java | public void doMatch() {
boolean matchFound = false;
for (ConsumablePattern<T> pattern : patterns) {
if (pattern.matches(value)) {
pattern.consume(value);
matchFound = true;
break;
}
}
if (!matchFound) {
throw new MatchException("No match found for " + value);
... | [
"public",
"void",
"doMatch",
"(",
")",
"{",
"boolean",
"matchFound",
"=",
"false",
";",
"for",
"(",
"ConsumablePattern",
"<",
"T",
">",
"pattern",
":",
"patterns",
")",
"{",
"if",
"(",
"pattern",
".",
"matches",
"(",
"value",
")",
")",
"{",
"pattern",
... | Runs through the possible matches and executes the specified consumer of the first match.
@throws MatchException if no match is found. | [
"Runs",
"through",
"the",
"possible",
"matches",
"and",
"executes",
"the",
"specified",
"consumer",
"of",
"the",
"first",
"match",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java#L114-L127 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java | FluentMatchingC.orElse | public FluentMatchingC<T> orElse() {
patterns.add(ConsumablePattern.of(t -> true, t -> doNothing()));
return this;
} | java | public FluentMatchingC<T> orElse() {
patterns.add(ConsumablePattern.of(t -> true, t -> doNothing()));
return this;
} | [
"public",
"FluentMatchingC",
"<",
"T",
">",
"orElse",
"(",
")",
"{",
"patterns",
".",
"add",
"(",
"ConsumablePattern",
".",
"of",
"(",
"t",
"->",
"true",
",",
"t",
"->",
"doNothing",
"(",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] | Sets a no-op to be run if no match is found.
<p>This can be used if you don't care if a match occurs and want to avoid the
{@link MatchException}. | [
"Sets",
"a",
"no",
"-",
"op",
"to",
"be",
"run",
"if",
"no",
"match",
"is",
"found",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/matching/FluentMatchingC.java#L151-L154 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/AmazonSNSTransport.java | AmazonSNSTransport.subscribe | public void subscribe() throws URISyntaxException, TransportConfigException {
/*
* if this instance of the transport (as there could be several - each with
* a different topic) is in shutdown mode then don't subscribe. This is a
* side effect of when you shutdown a sns transport and the listener get... | java | public void subscribe() throws URISyntaxException, TransportConfigException {
/*
* if this instance of the transport (as there could be several - each with
* a different topic) is in shutdown mode then don't subscribe. This is a
* side effect of when you shutdown a sns transport and the listener get... | [
"public",
"void",
"subscribe",
"(",
")",
"throws",
"URISyntaxException",
",",
"TransportConfigException",
"{",
"/*\n * if this instance of the transport (as there could be several - each with\n * a different topic) is in shutdown mode then don't subscribe. This is a\n * side effect o... | Attempt to subscript to the Argo SNS topic.
@throws URISyntaxException if the subscription HTTP URL is messed up
@throws TransportConfigException if there was some Amazon specific issue
while subscribing | [
"Attempt",
"to",
"subscript",
"to",
"the",
"Argo",
"SNS",
"topic",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/AmazonSNSTransport.java#L162-L189 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/extract/matchers/ArgumentMatchers.java | ArgumentMatchers.eq | @SuppressWarnings("unchecked")
public static <T> Matcher<T> eq(T value) {
return (Matcher<T>) new Equals(value);
} | java | @SuppressWarnings("unchecked")
public static <T> Matcher<T> eq(T value) {
return (Matcher<T>) new Equals(value);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Matcher",
"<",
"T",
">",
"eq",
"(",
"T",
"value",
")",
"{",
"return",
"(",
"Matcher",
"<",
"T",
">",
")",
"new",
"Equals",
"(",
"value",
")",
";",
"}"
] | Returns an equals matcher for the given value. | [
"Returns",
"an",
"equals",
"matcher",
"for",
"the",
"given",
"value",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/extract/matchers/ArgumentMatchers.java#L42-L45 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/sns/SNSListener.java | SNSListener.getLocalBaseURI | public static URI getLocalBaseURI() {
InetAddress localAddr;
String addr;
try {
localAddr = InetAddress.getLocalHost();
addr = localAddr.getHostAddress();
} catch (UnknownHostException e) {
LOGGER.warn("Issues finding ip address of locahost. Using string 'localhost' for listener addre... | java | public static URI getLocalBaseURI() {
InetAddress localAddr;
String addr;
try {
localAddr = InetAddress.getLocalHost();
addr = localAddr.getHostAddress();
} catch (UnknownHostException e) {
LOGGER.warn("Issues finding ip address of locahost. Using string 'localhost' for listener addre... | [
"public",
"static",
"URI",
"getLocalBaseURI",
"(",
")",
"{",
"InetAddress",
"localAddr",
";",
"String",
"addr",
";",
"try",
"{",
"localAddr",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
";",
"addr",
"=",
"localAddr",
".",
"getHostAddress",
"(",
")",
... | Return the local base URI based on the localhost address.
@return the default URI | [
"Return",
"the",
"local",
"base",
"URI",
"based",
"on",
"the",
"localhost",
"address",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/sns/SNSListener.java#L52-L63 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.calculateSHA256Hash | private String calculateSHA256Hash(byte[] msg, int offset, int len) {
// Calculate the SHA256 digest of the Hello message
Digest digest = platform.getCrypto().createDigestSHA256();
digest.update(msg, offset, len);
int digestLen = digest.getDigestLength();
// prepare space for hexadecimal representation, store... | java | private String calculateSHA256Hash(byte[] msg, int offset, int len) {
// Calculate the SHA256 digest of the Hello message
Digest digest = platform.getCrypto().createDigestSHA256();
digest.update(msg, offset, len);
int digestLen = digest.getDigestLength();
// prepare space for hexadecimal representation, store... | [
"private",
"String",
"calculateSHA256Hash",
"(",
"byte",
"[",
"]",
"msg",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"// Calculate the SHA256 digest of the Hello message",
"Digest",
"digest",
"=",
"platform",
".",
"getCrypto",
"(",
")",
".",
"createDigestS... | Calculate the hash digest of part of a message using the SHA256 algorithm
@param msg
Contents of the message
@param offset
Offset of the data for the hash
@param len
Length of msg to be considered for calculating the hash
@return String of the hash in base 16 | [
"Calculate",
"the",
"hash",
"digest",
"of",
"part",
"of",
"a",
"message",
"using",
"the",
"SHA256",
"algorithm"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L464-L486 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.handleIncomingMessage | public void handleIncomingMessage(byte[] data, int offset, int len) {
synchronized(messageQueue) {
messageQueue.add(new IncomingMessage(data, offset, len));
}
synchronized(lock) {
lock.notifyAll();
}
} | java | public void handleIncomingMessage(byte[] data, int offset, int len) {
synchronized(messageQueue) {
messageQueue.add(new IncomingMessage(data, offset, len));
}
synchronized(lock) {
lock.notifyAll();
}
} | [
"public",
"void",
"handleIncomingMessage",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"synchronized",
"(",
"messageQueue",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"IncomingMessage",
"(",
"data",
",",
"offset... | Handle an incoming ZRTP message. Assumes RTP headers and trailing CRC
have been stripped by caller
@param aMsg
byte array containing the ZRTP message | [
"Handle",
"an",
"incoming",
"ZRTP",
"message",
".",
"Assumes",
"RTP",
"headers",
"and",
"trailing",
"CRC",
"have",
"been",
"stripped",
"by",
"caller"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L1902-L1909 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.isTrusted | public boolean isTrusted() {
if (delayedCacheUpdate || farEndZID == null) {
return false;
}
cache.selectEntry(farEndZID);
return cache.getTrust();
} | java | public boolean isTrusted() {
if (delayedCacheUpdate || farEndZID == null) {
return false;
}
cache.selectEntry(farEndZID);
return cache.getTrust();
} | [
"public",
"boolean",
"isTrusted",
"(",
")",
"{",
"if",
"(",
"delayedCacheUpdate",
"||",
"farEndZID",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"cache",
".",
"selectEntry",
"(",
"farEndZID",
")",
";",
"return",
"cache",
".",
"getTrust",
"(",
")... | Retrieves the current trust status of the connection.
@return true iff the connection is trusted. | [
"Retrieves",
"the",
"current",
"trust",
"status",
"of",
"the",
"connection",
"."
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L2031-L2037 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.runSession | private void runSession() {
if (!started) {
logString("Thread Starting");
completed = false;
seqNum = getStartSeqNum();
rtpStack.setNextZrtpSequenceNumber(getStartSeqNum());
state = ZRTP_STATE_INACTIVE;
initiator = false;
hashMode = HashType.UNDEFINED;
dhMode = KeyAgreementType.DH3K;
sasMod... | java | private void runSession() {
if (!started) {
logString("Thread Starting");
completed = false;
seqNum = getStartSeqNum();
rtpStack.setNextZrtpSequenceNumber(getStartSeqNum());
state = ZRTP_STATE_INACTIVE;
initiator = false;
hashMode = HashType.UNDEFINED;
dhMode = KeyAgreementType.DH3K;
sasMod... | [
"private",
"void",
"runSession",
"(",
")",
"{",
"if",
"(",
"!",
"started",
")",
"{",
"logString",
"(",
"\"Thread Starting\"",
")",
";",
"completed",
"=",
"false",
";",
"seqNum",
"=",
"getStartSeqNum",
"(",
")",
";",
"rtpStack",
".",
"setNextZrtpSequenceNumbe... | Thread run method | [
"Thread",
"run",
"method"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L2211-L2263 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.setSdpHelloHash | public void setSdpHelloHash(String version, String helloHash) {
if (!version.startsWith(VERSION_PREFIX)) {
logWarning("Different version number: '" + version + "' Ours: '"
+ VERSION_PREFIX + "' (" + VERSION + ")");
}
sdpHelloHashReceived = helloHash;
} | java | public void setSdpHelloHash(String version, String helloHash) {
if (!version.startsWith(VERSION_PREFIX)) {
logWarning("Different version number: '" + version + "' Ours: '"
+ VERSION_PREFIX + "' (" + VERSION + ")");
}
sdpHelloHashReceived = helloHash;
} | [
"public",
"void",
"setSdpHelloHash",
"(",
"String",
"version",
",",
"String",
"helloHash",
")",
"{",
"if",
"(",
"!",
"version",
".",
"startsWith",
"(",
"VERSION_PREFIX",
")",
")",
"{",
"logWarning",
"(",
"\"Different version number: '\"",
"+",
"version",
"+",
... | Hash of the Hello message to be received. This hash is sent by the other
end as part of the SDP for further verification.
@param version
ZRTP version of the hash
@param helloHash
Hello hash received as part of SDP in SIP | [
"Hash",
"of",
"the",
"Hello",
"message",
"to",
"be",
"received",
".",
"This",
"hash",
"is",
"sent",
"by",
"the",
"other",
"end",
"as",
"part",
"of",
"the",
"SDP",
"for",
"further",
"verification",
"."
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L2554-L2560 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.untrust | public void untrust() {
cache.updateEntry(cacheExpiryTime(), false, newRS, keepRS2, null);
delayedCacheUpdate = true;
} | java | public void untrust() {
cache.updateEntry(cacheExpiryTime(), false, newRS, keepRS2, null);
delayedCacheUpdate = true;
} | [
"public",
"void",
"untrust",
"(",
")",
"{",
"cache",
".",
"updateEntry",
"(",
"cacheExpiryTime",
"(",
")",
",",
"false",
",",
"newRS",
",",
"keepRS2",
",",
"null",
")",
";",
"delayedCacheUpdate",
"=",
"true",
";",
"}"
] | Notifies the ZRTP protocol that the user has revoked their trust in the
connection. SAS verified flags is set to false and shared secrets with
the remote end are removed from the cache. | [
"Notifies",
"the",
"ZRTP",
"protocol",
"that",
"the",
"user",
"has",
"revoked",
"their",
"trust",
"in",
"the",
"connection",
".",
"SAS",
"verified",
"flags",
"is",
"set",
"to",
"false",
"and",
"shared",
"secrets",
"with",
"the",
"remote",
"end",
"are",
"re... | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L2602-L2605 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.verifyHelloMessage | private boolean verifyHelloMessage(byte[] helloMsg) {
if (sdpHelloHashReceived != null) {
String hash = calculateSHA256Hash(helloMsg, 0, helloMsg.length);
boolean hashesMatched = hash.toUpperCase().equals(
sdpHelloHashReceived.toUpperCase());
if (platform.getLogger().isEnabled()) {
if (hashesMatched... | java | private boolean verifyHelloMessage(byte[] helloMsg) {
if (sdpHelloHashReceived != null) {
String hash = calculateSHA256Hash(helloMsg, 0, helloMsg.length);
boolean hashesMatched = hash.toUpperCase().equals(
sdpHelloHashReceived.toUpperCase());
if (platform.getLogger().isEnabled()) {
if (hashesMatched... | [
"private",
"boolean",
"verifyHelloMessage",
"(",
"byte",
"[",
"]",
"helloMsg",
")",
"{",
"if",
"(",
"sdpHelloHashReceived",
"!=",
"null",
")",
"{",
"String",
"hash",
"=",
"calculateSHA256Hash",
"(",
"helloMsg",
",",
"0",
",",
"helloMsg",
".",
"length",
")",
... | Verify whether the contents of the Hello message received has not been
altered, by matching with the SHA256 hash received in SDP exchange.
@param helloMsg
Contents of the Hello message received
@return True if the Hello message is verified, false if not. | [
"Verify",
"whether",
"the",
"contents",
"of",
"the",
"Hello",
"message",
"received",
"has",
"not",
"been",
"altered",
"by",
"matching",
"with",
"the",
"SHA256",
"hash",
"received",
"in",
"SDP",
"exchange",
"."
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L2671-L2690 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Frustum.java | Frustum.intersectionType | public IntersectionType intersectionType (Box box) {
// exit quickly in cases where the bounding boxes don't overlap (equivalent to a separating
// axis test using the axes of the box)
if (!_bounds.intersects(box)) {
return IntersectionType.NONE;
}
// consider each s... | java | public IntersectionType intersectionType (Box box) {
// exit quickly in cases where the bounding boxes don't overlap (equivalent to a separating
// axis test using the axes of the box)
if (!_bounds.intersects(box)) {
return IntersectionType.NONE;
}
// consider each s... | [
"public",
"IntersectionType",
"intersectionType",
"(",
"Box",
"box",
")",
"{",
"// exit quickly in cases where the bounding boxes don't overlap (equivalent to a separating",
"// axis test using the axes of the box)",
"if",
"(",
"!",
"_bounds",
".",
"intersects",
"(",
"box",
")",
... | Checks whether the frustum intersects the specified box. | [
"Checks",
"whether",
"the",
"frustum",
"intersects",
"the",
"specified",
"box",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Frustum.java#L186-L211 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Frustum.java | Frustum.boundsUnderRotation | public Box boundsUnderRotation (Matrix3 matrix, Box result) {
result.setToEmpty();
for (Vector3 vertex : _vertices) {
result.addLocal(matrix.transform(vertex, _vertex));
}
return result;
} | java | public Box boundsUnderRotation (Matrix3 matrix, Box result) {
result.setToEmpty();
for (Vector3 vertex : _vertices) {
result.addLocal(matrix.transform(vertex, _vertex));
}
return result;
} | [
"public",
"Box",
"boundsUnderRotation",
"(",
"Matrix3",
"matrix",
",",
"Box",
"result",
")",
"{",
"result",
".",
"setToEmpty",
"(",
")",
";",
"for",
"(",
"Vector3",
"vertex",
":",
"_vertices",
")",
"{",
"result",
".",
"addLocal",
"(",
"matrix",
".",
"tra... | Computes the bounds of the frustum under the supplied rotation and places the results in
the box provided.
@return a reference to the result box, for chaining. | [
"Computes",
"the",
"bounds",
"of",
"the",
"frustum",
"under",
"the",
"supplied",
"rotation",
"and",
"places",
"the",
"results",
"in",
"the",
"box",
"provided",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Frustum.java#L219-L225 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Frustum.java | Frustum.updateDerivedState | protected void updateDerivedState () {
_planes[0].fromPoints(_vertices[0], _vertices[1], _vertices[2]); // near
_planes[1].fromPoints(_vertices[5], _vertices[4], _vertices[7]); // far
_planes[2].fromPoints(_vertices[1], _vertices[5], _vertices[6]); // left
_planes[3].fromPoints(_vertices... | java | protected void updateDerivedState () {
_planes[0].fromPoints(_vertices[0], _vertices[1], _vertices[2]); // near
_planes[1].fromPoints(_vertices[5], _vertices[4], _vertices[7]); // far
_planes[2].fromPoints(_vertices[1], _vertices[5], _vertices[6]); // left
_planes[3].fromPoints(_vertices... | [
"protected",
"void",
"updateDerivedState",
"(",
")",
"{",
"_planes",
"[",
"0",
"]",
".",
"fromPoints",
"(",
"_vertices",
"[",
"0",
"]",
",",
"_vertices",
"[",
"1",
"]",
",",
"_vertices",
"[",
"2",
"]",
")",
";",
"// near",
"_planes",
"[",
"1",
"]",
... | Sets the planes and bounding box of the frustum based on its vertices. | [
"Sets",
"the",
"planes",
"and",
"bounding",
"box",
"of",
"the",
"frustum",
"based",
"on",
"its",
"vertices",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Frustum.java#L230-L238 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Arc.java | Arc.setArcType | public void setArcType (int type) {
if (type != OPEN && type != CHORD && type != PIE) {
throw new IllegalArgumentException("Invalid Arc type: " + type);
}
this.type = type;
} | java | public void setArcType (int type) {
if (type != OPEN && type != CHORD && type != PIE) {
throw new IllegalArgumentException("Invalid Arc type: " + type);
}
this.type = type;
} | [
"public",
"void",
"setArcType",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"type",
"!=",
"OPEN",
"&&",
"type",
"!=",
"CHORD",
"&&",
"type",
"!=",
"PIE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid Arc type: \"",
"+",
"type",
")",
... | Sets the type of this arc to the specified value. | [
"Sets",
"the",
"type",
"of",
"this",
"arc",
"to",
"the",
"specified",
"value",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Arc.java#L103-L108 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Arc.java | Arc.setArc | public void setArc (IArc arc) {
setArc(arc.x(), arc.y(), arc.width(), arc.height(), arc.angleStart(),
arc.angleExtent(), arc.arcType());
} | java | public void setArc (IArc arc) {
setArc(arc.x(), arc.y(), arc.width(), arc.height(), arc.angleStart(),
arc.angleExtent(), arc.arcType());
} | [
"public",
"void",
"setArc",
"(",
"IArc",
"arc",
")",
"{",
"setArc",
"(",
"arc",
".",
"x",
"(",
")",
",",
"arc",
".",
"y",
"(",
")",
",",
"arc",
".",
"width",
"(",
")",
",",
"arc",
".",
"height",
"(",
")",
",",
"arc",
".",
"angleStart",
"(",
... | Sets the location, size, angular extents, and closure type of this arc to the same values as
the supplied arc. | [
"Sets",
"the",
"location",
"size",
"angular",
"extents",
"and",
"closure",
"type",
"of",
"this",
"arc",
"to",
"the",
"same",
"values",
"as",
"the",
"supplied",
"arc",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Arc.java#L159-L162 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Arc.java | Arc.setAngleStart | public void setAngleStart (XY point) {
double angle = Math.atan2(point.y() - centerY(), point.x() - centerX());
setAngleStart(normAngle(-Math.toDegrees(angle)));
} | java | public void setAngleStart (XY point) {
double angle = Math.atan2(point.y() - centerY(), point.x() - centerX());
setAngleStart(normAngle(-Math.toDegrees(angle)));
} | [
"public",
"void",
"setAngleStart",
"(",
"XY",
"point",
")",
"{",
"double",
"angle",
"=",
"Math",
".",
"atan2",
"(",
"point",
".",
"y",
"(",
")",
"-",
"centerY",
"(",
")",
",",
"point",
".",
"x",
"(",
")",
"-",
"centerX",
"(",
")",
")",
";",
"se... | Sets the starting angle of this arc to the angle defined by the supplied point relative to
the center of this arc. | [
"Sets",
"the",
"starting",
"angle",
"of",
"this",
"arc",
"to",
"the",
"angle",
"defined",
"by",
"the",
"supplied",
"point",
"relative",
"to",
"the",
"center",
"of",
"this",
"arc",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Arc.java#L200-L203 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Points.java | Points.distance | public static float distance (float x1, float y1, float x2, float y2) {
return FloatMath.sqrt(distanceSq(x1, y1, x2, y2));
} | java | public static float distance (float x1, float y1, float x2, float y2) {
return FloatMath.sqrt(distanceSq(x1, y1, x2, y2));
} | [
"public",
"static",
"float",
"distance",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"return",
"FloatMath",
".",
"sqrt",
"(",
"distanceSq",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
")",
";",
"... | Returns the Euclidean distance between the specified two points. | [
"Returns",
"the",
"Euclidean",
"distance",
"between",
"the",
"specified",
"two",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Points.java#L27-L29 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/RoundRectangle.java | RoundRectangle.setRoundRect | public void setRoundRect (float x, float y, float width, float height,
float arcwidth, float archeight) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.arcwidth = arcwidth;
this.archeight = archeight;
} | java | public void setRoundRect (float x, float y, float width, float height,
float arcwidth, float archeight) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.arcwidth = arcwidth;
this.archeight = archeight;
} | [
"public",
"void",
"setRoundRect",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
",",
"float",
"arcwidth",
",",
"float",
"archeight",
")",
"{",
"this",
".",
"x",
"=",
"x",
";",
"this",
".",
"y",
"=",
"y",
";",
... | Sets the frame and corner dimensions of this rectangle to the specified values. | [
"Sets",
"the",
"frame",
"and",
"corner",
"dimensions",
"of",
"this",
"rectangle",
"to",
"the",
"specified",
"values",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/RoundRectangle.java#L51-L59 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/RoundRectangle.java | RoundRectangle.setRoundRect | public void setRoundRect (IRoundRectangle rr) {
setRoundRect(rr.x(), rr.y(), rr.width(), rr.height(),
rr.arcWidth(), rr.arcHeight());
} | java | public void setRoundRect (IRoundRectangle rr) {
setRoundRect(rr.x(), rr.y(), rr.width(), rr.height(),
rr.arcWidth(), rr.arcHeight());
} | [
"public",
"void",
"setRoundRect",
"(",
"IRoundRectangle",
"rr",
")",
"{",
"setRoundRect",
"(",
"rr",
".",
"x",
"(",
")",
",",
"rr",
".",
"y",
"(",
")",
",",
"rr",
".",
"width",
"(",
")",
",",
"rr",
".",
"height",
"(",
")",
",",
"rr",
".",
"arcW... | Sets the frame and corner dimensions of this rectangle to be equal to those of the supplied
rectangle. | [
"Sets",
"the",
"frame",
"and",
"corner",
"dimensions",
"of",
"this",
"rectangle",
"to",
"be",
"equal",
"to",
"those",
"of",
"the",
"supplied",
"rectangle",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/RoundRectangle.java#L65-L68 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Lines.java | Lines.pointLineDistSq | public static float pointLineDistSq (float px, float py,
float x1, float y1, float x2, float y2) {
x2 -= x1;
y2 -= y1;
px -= x1;
py -= y1;
float s = px * y2 - py * x2;
return (s * s) / (x2 * x2 + y2 * y2);
} | java | public static float pointLineDistSq (float px, float py,
float x1, float y1, float x2, float y2) {
x2 -= x1;
y2 -= y1;
px -= x1;
py -= y1;
float s = px * y2 - py * x2;
return (s * s) / (x2 * x2 + y2 * y2);
} | [
"public",
"static",
"float",
"pointLineDistSq",
"(",
"float",
"px",
",",
"float",
"py",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"x2",
"-=",
"x1",
";",
"y2",
"-=",
"y1",
";",
"px",
"-=",
"x1",
";",... | Returns the square of the distance from the specified point to the specified line. | [
"Returns",
"the",
"square",
"of",
"the",
"distance",
"from",
"the",
"specified",
"point",
"to",
"the",
"specified",
"line",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Lines.java#L70-L78 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Lines.java | Lines.pointLineDist | public static float pointLineDist (float px, float py, float x1, float y1, float x2, float y2) {
return FloatMath.sqrt(pointLineDistSq(px, py, x1, y1, x2, y2));
} | java | public static float pointLineDist (float px, float py, float x1, float y1, float x2, float y2) {
return FloatMath.sqrt(pointLineDistSq(px, py, x1, y1, x2, y2));
} | [
"public",
"static",
"float",
"pointLineDist",
"(",
"float",
"px",
",",
"float",
"py",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"return",
"FloatMath",
".",
"sqrt",
"(",
"pointLineDistSq",
"(",
"px",
",",
... | Returns the distance from the specified point to the specified line. | [
"Returns",
"the",
"distance",
"from",
"the",
"specified",
"point",
"to",
"the",
"specified",
"line",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Lines.java#L83-L85 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Lines.java | Lines.pointSegDistSq | public static float pointSegDistSq (float px, float py,
float x1, float y1, float x2, float y2) {
// A = (x2 - x1, y2 - y1)
// P = (px - x1, py - y1)
x2 -= x1; // A = (x2, y2)
y2 -= y1;
px -= x1; // P = (px, py)
py -= y1;
fl... | java | public static float pointSegDistSq (float px, float py,
float x1, float y1, float x2, float y2) {
// A = (x2 - x1, y2 - y1)
// P = (px - x1, py - y1)
x2 -= x1; // A = (x2, y2)
y2 -= y1;
px -= x1; // P = (px, py)
py -= y1;
fl... | [
"public",
"static",
"float",
"pointSegDistSq",
"(",
"float",
"px",
",",
"float",
"py",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"// A = (x2 - x1, y2 - y1)",
"// P = (px - x1, py - y1)",
"x2",
"-=",
"x1",
";",
... | Returns the square of the distance between the specified point and the specified line
segment. | [
"Returns",
"the",
"square",
"of",
"the",
"distance",
"between",
"the",
"specified",
"point",
"and",
"the",
"specified",
"line",
"segment",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Lines.java#L91-L116 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Lines.java | Lines.pointSegDist | public static float pointSegDist (float px, float py, float x1, float y1, float x2, float y2) {
return FloatMath.sqrt(pointSegDistSq(px, py, x1, y1, x2, y2));
} | java | public static float pointSegDist (float px, float py, float x1, float y1, float x2, float y2) {
return FloatMath.sqrt(pointSegDistSq(px, py, x1, y1, x2, y2));
} | [
"public",
"static",
"float",
"pointSegDist",
"(",
"float",
"px",
",",
"float",
"py",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"return",
"FloatMath",
".",
"sqrt",
"(",
"pointSegDistSq",
"(",
"px",
",",
... | Returns the distance between the specified point and the specified line segment. | [
"Returns",
"the",
"distance",
"between",
"the",
"specified",
"point",
"and",
"the",
"specified",
"line",
"segment",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Lines.java#L121-L123 | train |
opentelecoms-org/zrtp-java | src/zorg/platform/android/AndroidCacheEntry.java | AndroidCacheEntry.fromString | public static ZrtpCacheEntry fromString(String key, String value) {
String data = null;
String number = null;
int sep = value.indexOf(',');
if (sep > 0) {
data = value.substring(0, sep);
number = value.substring(sep + 1);
} else {
data = value;
number = "";
}
byte[] buffer = new byt... | java | public static ZrtpCacheEntry fromString(String key, String value) {
String data = null;
String number = null;
int sep = value.indexOf(',');
if (sep > 0) {
data = value.substring(0, sep);
number = value.substring(sep + 1);
} else {
data = value;
number = "";
}
byte[] buffer = new byt... | [
"public",
"static",
"ZrtpCacheEntry",
"fromString",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"String",
"data",
"=",
"null",
";",
"String",
"number",
"=",
"null",
";",
"int",
"sep",
"=",
"value",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
... | Create a Cache Entry, from the Zid string and the CSV representation of HEX RAW data and phone number
@param key ZID string
@param value CSV of HEX raw data and phone number, for example "E84FE07E054660FFF5CF90B4,+3943332233323"
@return a new ZRTP cache entry | [
"Create",
"a",
"Cache",
"Entry",
"from",
"the",
"Zid",
"string",
"and",
"the",
"CSV",
"representation",
"of",
"HEX",
"RAW",
"data",
"and",
"phone",
"number"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/android/AndroidCacheEntry.java#L108-L126 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Line.java | Line.setLine | public void setLine (XY p1, XY p2) {
setLine(p1.x(), p1.y(), p2.x(), p2.y());
} | java | public void setLine (XY p1, XY p2) {
setLine(p1.x(), p1.y(), p2.x(), p2.y());
} | [
"public",
"void",
"setLine",
"(",
"XY",
"p1",
",",
"XY",
"p2",
")",
"{",
"setLine",
"(",
"p1",
".",
"x",
"(",
")",
",",
"p1",
".",
"y",
"(",
")",
",",
"p2",
".",
"x",
"(",
")",
",",
"p2",
".",
"y",
"(",
")",
")",
";",
"}"
] | Sets the start and end of this line to the specified points. | [
"Sets",
"the",
"start",
"and",
"end",
"of",
"this",
"line",
"to",
"the",
"specified",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Line.java#L61-L63 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Line.java | Line.setLine | public void setLine (float x1, float y1, float x2, float y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
} | java | public void setLine (float x1, float y1, float x2, float y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
} | [
"public",
"void",
"setLine",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"this",
".",
"x1",
"=",
"x1",
";",
"this",
".",
"y1",
"=",
"y1",
";",
"this",
".",
"x2",
"=",
"x2",
";",
"this",
".",
"y2",... | Sets the start and end point of this line to the specified values. | [
"Sets",
"the",
"start",
"and",
"end",
"point",
"of",
"this",
"line",
"to",
"the",
"specified",
"values",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Line.java#L51-L56 | train |
di2e/Argo | ArgoWirelineFormat/src/main/java/ws/argo/wireline/response/ServiceWrapper.java | ServiceWrapper.addAccessPoint | public void addAccessPoint(String label, String ip, String port, String url, String dataType, String data) {
AccessPoint ap = new AccessPoint();
ap.label = label;
ap.ipAddress = ip;
ap.port = port;
ap.url = url;
ap.dataType = dataType;
ap.data = data;
accessPoints.add(ap);
} | java | public void addAccessPoint(String label, String ip, String port, String url, String dataType, String data) {
AccessPoint ap = new AccessPoint();
ap.label = label;
ap.ipAddress = ip;
ap.port = port;
ap.url = url;
ap.dataType = dataType;
ap.data = data;
accessPoints.add(ap);
} | [
"public",
"void",
"addAccessPoint",
"(",
"String",
"label",
",",
"String",
"ip",
",",
"String",
"port",
",",
"String",
"url",
",",
"String",
"dataType",
",",
"String",
"data",
")",
"{",
"AccessPoint",
"ap",
"=",
"new",
"AccessPoint",
"(",
")",
";",
"ap",... | Add a new access point for the service record. This structure exists to
help deal with network access issues and not multiple contracts. For
example, a service could have an access point that is different because of
multiple NICs that host is accessible on. It's not to have a service
accessible by HTTP and HTTPS - thos... | [
"Add",
"a",
"new",
"access",
"point",
"for",
"the",
"service",
"record",
".",
"This",
"structure",
"exists",
"to",
"help",
"deal",
"with",
"network",
"access",
"issues",
"and",
"not",
"multiple",
"contracts",
".",
"For",
"example",
"a",
"service",
"could",
... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ArgoWirelineFormat/src/main/java/ws/argo/wireline/response/ServiceWrapper.java#L225-L237 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix3.java | Matrix3.set | public Matrix3 set (double[] values) {
return set(values[0], values[1], values[2],
values[3], values[4], values[5],
values[6], values[7], values[8]);
} | java | public Matrix3 set (double[] values) {
return set(values[0], values[1], values[2],
values[3], values[4], values[5],
values[6], values[7], values[8]);
} | [
"public",
"Matrix3",
"set",
"(",
"double",
"[",
"]",
"values",
")",
"{",
"return",
"set",
"(",
"values",
"[",
"0",
"]",
",",
"values",
"[",
"1",
"]",
",",
"values",
"[",
"2",
"]",
",",
"values",
"[",
"3",
"]",
",",
"values",
"[",
"4",
"]",
",... | Copies the elements of an array.
@return a reference to this matrix, for chaining. | [
"Copies",
"the",
"elements",
"of",
"an",
"array",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix3.java#L425-L429 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix3.java | Matrix3.set | public Matrix3 set (
double m00, double m10, double m20,
double m01, double m11, double m21,
double m02, double m12, double m22) {
this.m00 = m00; this.m01 = m01; this.m02 = m02;
this.m10 = m10; this.m11 = m11; this.m12 = m12;
this.m20 = m20; this.m21 = m21; this.m22 = m2... | java | public Matrix3 set (
double m00, double m10, double m20,
double m01, double m11, double m21,
double m02, double m12, double m22) {
this.m00 = m00; this.m01 = m01; this.m02 = m02;
this.m10 = m10; this.m11 = m11; this.m12 = m12;
this.m20 = m20; this.m21 = m21; this.m22 = m2... | [
"public",
"Matrix3",
"set",
"(",
"double",
"m00",
",",
"double",
"m10",
",",
"double",
"m20",
",",
"double",
"m01",
",",
"double",
"m11",
",",
"double",
"m21",
",",
"double",
"m02",
",",
"double",
"m12",
",",
"double",
"m22",
")",
"{",
"this",
".",
... | Sets all of the matrix's components at once.
@return a reference to this matrix, for chaining. | [
"Sets",
"all",
"of",
"the",
"matrix",
"s",
"components",
"at",
"once",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix3.java#L436-L444 | train |
di2e/Argo | CommonUtils/src/main/java/ws/argo/common/config/ResolvingXMLConfiguration.java | ResolvingXMLConfiguration.ipAddressFromURL | private String ipAddressFromURL(String url, String name) {
String ipAddr = null;
if (_urlValidator.isValid(url)) {
WebTarget resolver = ClientBuilder.newClient().target(url);
try {
ipAddr = resolver.request().get(String.class);
} catch (Exception e) {
warn("URL Cannot Resolve ... | java | private String ipAddressFromURL(String url, String name) {
String ipAddr = null;
if (_urlValidator.isValid(url)) {
WebTarget resolver = ClientBuilder.newClient().target(url);
try {
ipAddr = resolver.request().get(String.class);
} catch (Exception e) {
warn("URL Cannot Resolve ... | [
"private",
"String",
"ipAddressFromURL",
"(",
"String",
"url",
",",
"String",
"name",
")",
"{",
"String",
"ipAddr",
"=",
"null",
";",
"if",
"(",
"_urlValidator",
".",
"isValid",
"(",
"url",
")",
")",
"{",
"WebTarget",
"resolver",
"=",
"ClientBuilder",
".",... | Resolve the IP address from a URL.
@param url and URL that will return an IP address
@param name the name of the variable
@return the result from the HTTP GET operations or null of an error | [
"Resolve",
"the",
"IP",
"address",
"from",
"a",
"URL",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CommonUtils/src/main/java/ws/argo/common/config/ResolvingXMLConfiguration.java#L145-L159 | train |
opentelecoms-org/zrtp-java | src/zorg/SRTP.java | SRTP.protect | public RtpPacket protect(RtpPacket packet) {
if (txSessEncKey == null) {
log("protect() called out of session");
return null;
}
if (packet == null) {
log("protect() called with null RTP packet");
return null;
}
int seqNum = packet.getSequenceNumber();
if (seqNum == 0) {
// wrapped round
r... | java | public RtpPacket protect(RtpPacket packet) {
if (txSessEncKey == null) {
log("protect() called out of session");
return null;
}
if (packet == null) {
log("protect() called with null RTP packet");
return null;
}
int seqNum = packet.getSequenceNumber();
if (seqNum == 0) {
// wrapped round
r... | [
"public",
"RtpPacket",
"protect",
"(",
"RtpPacket",
"packet",
")",
"{",
"if",
"(",
"txSessEncKey",
"==",
"null",
")",
"{",
"log",
"(",
"\"protect() called out of session\"",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"packet",
"==",
"null",
")",
"{",... | Protects an RTP Packet by encrypting payload and adds any additional SRTP
trailer information
@param packet
RTP Packet to be protected
@return New RTP Packet with encrypted payload, or null if an error
occurred If encryption is disabled, returned packet is identical
to supplied packet | [
"Protects",
"an",
"RTP",
"Packet",
"by",
"encrypting",
"payload",
"and",
"adds",
"any",
"additional",
"SRTP",
"trailer",
"information"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/SRTP.java#L491-L542 | train |
opentelecoms-org/zrtp-java | src/zorg/SRTP.java | SRTP.startNewSession | public int startNewSession() {
if (txSessEncKey != null)
return SESSION_ERROR_ALREADY_ACTIVE;
if ((txMasterSalt == null) || (rxMasterSalt == null))
return SESSION_ERROR_MASTER_SALT_UDNEFINED;
if ((txMasterKey == null) || (rxMasterKey == null))
return SESSION_ERROR_MASTER_SALT_UDNEFINED;
if (!txSessionK... | java | public int startNewSession() {
if (txSessEncKey != null)
return SESSION_ERROR_ALREADY_ACTIVE;
if ((txMasterSalt == null) || (rxMasterSalt == null))
return SESSION_ERROR_MASTER_SALT_UDNEFINED;
if ((txMasterKey == null) || (rxMasterKey == null))
return SESSION_ERROR_MASTER_SALT_UDNEFINED;
if (!txSessionK... | [
"public",
"int",
"startNewSession",
"(",
")",
"{",
"if",
"(",
"txSessEncKey",
"!=",
"null",
")",
"return",
"SESSION_ERROR_ALREADY_ACTIVE",
";",
"if",
"(",
"(",
"txMasterSalt",
"==",
"null",
")",
"||",
"(",
"rxMasterSalt",
"==",
"null",
")",
")",
"return",
... | Starts a new SRTP Session, using the preset master key and salt to
generate the session keys
@return error code | [
"Starts",
"a",
"new",
"SRTP",
"Session",
"using",
"the",
"preset",
"master",
"key",
"and",
"salt",
"to",
"generate",
"the",
"session",
"keys"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/SRTP.java#L772-L802 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Lines.java | Lines.linesIntersect | public static boolean linesIntersect (double x1, double y1, double x2, double y2,
double x3, double y3, double x4, double y4) {
// A = (x2-x1, y2-y1)
// B = (x3-x1, y3-y1)
// C = (x4-x1, y4-y1)
// D = (x4-x3, y4-y3) = C-B
// E = (x1-x3, y... | java | public static boolean linesIntersect (double x1, double y1, double x2, double y2,
double x3, double y3, double x4, double y4) {
// A = (x2-x1, y2-y1)
// B = (x3-x1, y3-y1)
// C = (x4-x1, y4-y1)
// D = (x4-x3, y4-y3) = C-B
// E = (x1-x3, y... | [
"public",
"static",
"boolean",
"linesIntersect",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"x3",
",",
"double",
"y3",
",",
"double",
"x4",
",",
"double",
"y4",
")",
"{",
"// A = (x2-x1, y2-y1)",
"/... | Returns true if the specified two line segments intersect. | [
"Returns",
"true",
"if",
"the",
"specified",
"two",
"line",
"segments",
"intersect",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Lines.java#L15-L53 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Lines.java | Lines.lineIntersectsRect | public static boolean lineIntersectsRect (double x1, double y1, double x2, double y2,
double rx, double ry, double rw, double rh) {
double rr = rx + rw, rb = ry + rh;
return (rx <= x1 && x1 <= rr && ry <= y1 && y1 <= rb)
|| (rx <= x2 && x2 <= rr ... | java | public static boolean lineIntersectsRect (double x1, double y1, double x2, double y2,
double rx, double ry, double rw, double rh) {
double rr = rx + rw, rb = ry + rh;
return (rx <= x1 && x1 <= rr && ry <= y1 && y1 <= rb)
|| (rx <= x2 && x2 <= rr ... | [
"public",
"static",
"boolean",
"lineIntersectsRect",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"rx",
",",
"double",
"ry",
",",
"double",
"rw",
",",
"double",
"rh",
")",
"{",
"double",
"rr",
"=",
... | Returns true if the specified line segment intersects the specified rectangle. | [
"Returns",
"true",
"if",
"the",
"specified",
"line",
"segment",
"intersects",
"the",
"specified",
"rectangle",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Lines.java#L58-L65 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.set | public Quaternion set (IQuaternion other) {
return set(other.x(), other.y(), other.z(), other.w());
} | java | public Quaternion set (IQuaternion other) {
return set(other.x(), other.y(), other.z(), other.w());
} | [
"public",
"Quaternion",
"set",
"(",
"IQuaternion",
"other",
")",
"{",
"return",
"set",
"(",
"other",
".",
"x",
"(",
")",
",",
"other",
".",
"y",
"(",
")",
",",
"other",
".",
"z",
"(",
")",
",",
"other",
".",
"w",
"(",
")",
")",
";",
"}"
] | Copies the elements of another quaternion.
@return a reference to this quaternion, for chaining. | [
"Copies",
"the",
"elements",
"of",
"another",
"quaternion",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L59-L61 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.fromVectors | public Quaternion fromVectors (IVector3 from, IVector3 to) {
float angle = from.angle(to);
if (angle < MathUtil.EPSILON) {
return set(IDENTITY);
}
if (angle <= FloatMath.PI - MathUtil.EPSILON) {
return fromAngleAxis(angle, from.cross(to).normalizeLocal());
... | java | public Quaternion fromVectors (IVector3 from, IVector3 to) {
float angle = from.angle(to);
if (angle < MathUtil.EPSILON) {
return set(IDENTITY);
}
if (angle <= FloatMath.PI - MathUtil.EPSILON) {
return fromAngleAxis(angle, from.cross(to).normalizeLocal());
... | [
"public",
"Quaternion",
"fromVectors",
"(",
"IVector3",
"from",
",",
"IVector3",
"to",
")",
"{",
"float",
"angle",
"=",
"from",
".",
"angle",
"(",
"to",
")",
";",
"if",
"(",
"angle",
"<",
"MathUtil",
".",
"EPSILON",
")",
"{",
"return",
"set",
"(",
"I... | Sets this quaternion to the rotation of the first normalized vector onto the second.
@return a reference to this quaternion, for chaining. | [
"Sets",
"this",
"quaternion",
"to",
"the",
"rotation",
"of",
"the",
"first",
"normalized",
"vector",
"onto",
"the",
"second",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L90-L104 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.fromAnglesXZ | public Quaternion fromAnglesXZ (float x, float z) {
float hx = x * 0.5f, hz = z * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sz = FloatMath.sin(hz), cz = FloatMath.cos(hz);
return set(cz*sx, sz*sx, sz*cx, cz*cx);
} | java | public Quaternion fromAnglesXZ (float x, float z) {
float hx = x * 0.5f, hz = z * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sz = FloatMath.sin(hz), cz = FloatMath.cos(hz);
return set(cz*sx, sz*sx, sz*cx, cz*cx);
} | [
"public",
"Quaternion",
"fromAnglesXZ",
"(",
"float",
"x",
",",
"float",
"z",
")",
"{",
"float",
"hx",
"=",
"x",
"*",
"0.5f",
",",
"hz",
"=",
"z",
"*",
"0.5f",
";",
"float",
"sx",
"=",
"FloatMath",
".",
"sin",
"(",
"hx",
")",
",",
"cx",
"=",
"F... | Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about z by the specified number of radians. | [
"Sets",
"this",
"quaternion",
"to",
"one",
"that",
"first",
"rotates",
"about",
"x",
"by",
"the",
"specified",
"number",
"of",
"radians",
"then",
"rotates",
"about",
"z",
"by",
"the",
"specified",
"number",
"of",
"radians",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L184-L189 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.fromAnglesXY | public Quaternion fromAnglesXY (float x, float y) {
float hx = x * 0.5f, hy = y * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy);
return set(cy*sx, sy*cx, -sy*sx, cy*cx);
} | java | public Quaternion fromAnglesXY (float x, float y) {
float hx = x * 0.5f, hy = y * 0.5f;
float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy);
return set(cy*sx, sy*cx, -sy*sx, cy*cx);
} | [
"public",
"Quaternion",
"fromAnglesXY",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"float",
"hx",
"=",
"x",
"*",
"0.5f",
",",
"hy",
"=",
"y",
"*",
"0.5f",
";",
"float",
"sx",
"=",
"FloatMath",
".",
"sin",
"(",
"hx",
")",
",",
"cx",
"=",
"F... | Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about y by the specified number of radians. | [
"Sets",
"this",
"quaternion",
"to",
"one",
"that",
"first",
"rotates",
"about",
"x",
"by",
"the",
"specified",
"number",
"of",
"radians",
"then",
"rotates",
"about",
"y",
"by",
"the",
"specified",
"number",
"of",
"radians",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L195-L200 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/MathUtil.java | MathUtil.normalizeAnglePositive | public static float normalizeAnglePositive (float a) {
while (a < 0f) {
a += TWO_PI;
}
while (a >= TWO_PI) {
a -= TWO_PI;
}
return a;
} | java | public static float normalizeAnglePositive (float a) {
while (a < 0f) {
a += TWO_PI;
}
while (a >= TWO_PI) {
a -= TWO_PI;
}
return a;
} | [
"public",
"static",
"float",
"normalizeAnglePositive",
"(",
"float",
"a",
")",
"{",
"while",
"(",
"a",
"<",
"0f",
")",
"{",
"a",
"+=",
"TWO_PI",
";",
"}",
"while",
"(",
"a",
">=",
"TWO_PI",
")",
"{",
"a",
"-=",
"TWO_PI",
";",
"}",
"return",
"a",
... | Returns an angle in the range [0, 2pi). | [
"Returns",
"an",
"angle",
"in",
"the",
"range",
"[",
"0",
"2pi",
")",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/MathUtil.java#L158-L166 | train |
di2e/Argo | ArgoWirelineFormat/src/main/java/ws/argo/wireline/probe/XMLSerializer.java | XMLSerializer.unmarshal | public ProbeWrapper unmarshal(String payload) throws ProbeParseException {
Probe xmlProbe = parseProbePayload(payload);
ProbeWrapper probe = new ProbeWrapper(xmlProbe.getId());
probe.setClientId(xmlProbe.getClient());
probe.setDESVersion(xmlProbe.getDESVersion());
probe.setRespondToPayloadType(xmlP... | java | public ProbeWrapper unmarshal(String payload) throws ProbeParseException {
Probe xmlProbe = parseProbePayload(payload);
ProbeWrapper probe = new ProbeWrapper(xmlProbe.getId());
probe.setClientId(xmlProbe.getClient());
probe.setDESVersion(xmlProbe.getDESVersion());
probe.setRespondToPayloadType(xmlP... | [
"public",
"ProbeWrapper",
"unmarshal",
"(",
"String",
"payload",
")",
"throws",
"ProbeParseException",
"{",
"Probe",
"xmlProbe",
"=",
"parseProbePayload",
"(",
"payload",
")",
";",
"ProbeWrapper",
"probe",
"=",
"new",
"ProbeWrapper",
"(",
"xmlProbe",
".",
"getId",... | Create a new ProbeWrapper from the wireline payload.
@param payload - the string serialized probe that came directly off the
wire. This should only be in XML
@return the ProbeWrapper instance
@throws ProbeParseException if there was an issue parsing the payload | [
"Create",
"a",
"new",
"ProbeWrapper",
"from",
"the",
"wireline",
"payload",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ArgoWirelineFormat/src/main/java/ws/argo/wireline/probe/XMLSerializer.java#L147-L174 | train |
johnlcox/motif | benchmarks/src/main/java/com/leacox/motif/benchmarks/FizzBuzzBenchmark.java | FizzBuzzBenchmark.fizzbuzzConditional | @Benchmark
public void fizzbuzzConditional() {
IntStream.range(0, 101).forEach(
n -> {
if (n % (3 * 5) == 0) {
System.out.println("FizzBuzz");
} else if (n % 3 == 0) {
System.out.println("Fizz");
} else if (n % 5 == 0) {
System.out.println... | java | @Benchmark
public void fizzbuzzConditional() {
IntStream.range(0, 101).forEach(
n -> {
if (n % (3 * 5) == 0) {
System.out.println("FizzBuzz");
} else if (n % 3 == 0) {
System.out.println("Fizz");
} else if (n % 5 == 0) {
System.out.println... | [
"@",
"Benchmark",
"public",
"void",
"fizzbuzzConditional",
"(",
")",
"{",
"IntStream",
".",
"range",
"(",
"0",
",",
"101",
")",
".",
"forEach",
"(",
"n",
"->",
"{",
"if",
"(",
"n",
"%",
"(",
"3",
"*",
"5",
")",
"==",
"0",
")",
"{",
"System",
".... | Fizzbuzz benchmark using a conditional. | [
"Fizzbuzz",
"benchmark",
"using",
"a",
"conditional",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/benchmarks/src/main/java/com/leacox/motif/benchmarks/FizzBuzzBenchmark.java#L48-L64 | train |
johnlcox/motif | benchmarks/src/main/java/com/leacox/motif/benchmarks/FizzBuzzBenchmark.java | FizzBuzzBenchmark.fizzBuzzPatternMatching | @Benchmark
public void fizzBuzzPatternMatching() {
IntStream.range(0, 101).forEach(
n -> System.out.println(
match(Tuple2.of(n % 3, n % 5))
.when(tuple2(eq(0), eq(0))).get(() -> "FizzBuzz")
.when(tuple2(eq(0), any())).get(y -> "Fizz")
.when(tuple... | java | @Benchmark
public void fizzBuzzPatternMatching() {
IntStream.range(0, 101).forEach(
n -> System.out.println(
match(Tuple2.of(n % 3, n % 5))
.when(tuple2(eq(0), eq(0))).get(() -> "FizzBuzz")
.when(tuple2(eq(0), any())).get(y -> "Fizz")
.when(tuple... | [
"@",
"Benchmark",
"public",
"void",
"fizzBuzzPatternMatching",
"(",
")",
"{",
"IntStream",
".",
"range",
"(",
"0",
",",
"101",
")",
".",
"forEach",
"(",
"n",
"->",
"System",
".",
"out",
".",
"println",
"(",
"match",
"(",
"Tuple2",
".",
"of",
"(",
"n"... | Fizzbuzz benchmark using motif pattern matching. | [
"Fizzbuzz",
"benchmark",
"using",
"motif",
"pattern",
"matching",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/benchmarks/src/main/java/com/leacox/motif/benchmarks/FizzBuzzBenchmark.java#L69-L81 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Quaternion.java | Quaternion.set | public Quaternion set (double x, double y, double z, double w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
return this;
} | java | public Quaternion set (double x, double y, double z, double w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
return this;
} | [
"public",
"Quaternion",
"set",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
",",
"double",
"w",
")",
"{",
"this",
".",
"x",
"=",
"x",
";",
"this",
".",
"y",
"=",
"y",
";",
"this",
".",
"z",
"=",
"z",
";",
"this",
".",
"w",
"=... | Sets all of the elements of the quaternion.
@return a reference to this quaternion, for chaining. | [
"Sets",
"all",
"of",
"the",
"elements",
"of",
"the",
"quaternion",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Quaternion.java#L77-L83 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Quaternion.java | Quaternion.fromAxes | public Quaternion fromAxes (IVector3 nx, IVector3 ny, IVector3 nz) {
double nxx = nx.x(), nyy = ny.y(), nzz = nz.z();
double x2 = (1f + nxx - nyy - nzz)/4f;
double y2 = (1f - nxx + nyy - nzz)/4f;
double z2 = (1f - nxx - nyy + nzz)/4f;
double w2 = (1f - x2 - y2 - z2);
retu... | java | public Quaternion fromAxes (IVector3 nx, IVector3 ny, IVector3 nz) {
double nxx = nx.x(), nyy = ny.y(), nzz = nz.z();
double x2 = (1f + nxx - nyy - nzz)/4f;
double y2 = (1f - nxx + nyy - nzz)/4f;
double z2 = (1f - nxx - nyy + nzz)/4f;
double w2 = (1f - x2 - y2 - z2);
retu... | [
"public",
"Quaternion",
"fromAxes",
"(",
"IVector3",
"nx",
",",
"IVector3",
"ny",
",",
"IVector3",
"nz",
")",
"{",
"double",
"nxx",
"=",
"nx",
".",
"x",
"(",
")",
",",
"nyy",
"=",
"ny",
".",
"y",
"(",
")",
",",
"nzz",
"=",
"nz",
".",
"z",
"(",
... | Sets this quaternion to one that rotates onto the given unit axes.
@return a reference to this quaternion, for chaining. | [
"Sets",
"this",
"quaternion",
"to",
"one",
"that",
"rotates",
"onto",
"the",
"given",
"unit",
"axes",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Quaternion.java#L137-L147 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Rectangles.java | Rectangles.closestInteriorPoint | public static Point closestInteriorPoint (IRectangle r, IPoint p) {
return closestInteriorPoint(r, p, new Point());
} | java | public static Point closestInteriorPoint (IRectangle r, IPoint p) {
return closestInteriorPoint(r, p, new Point());
} | [
"public",
"static",
"Point",
"closestInteriorPoint",
"(",
"IRectangle",
"r",
",",
"IPoint",
"p",
")",
"{",
"return",
"closestInteriorPoint",
"(",
"r",
",",
"p",
",",
"new",
"Point",
"(",
")",
")",
";",
"}"
] | Computes and returns the point inside the bounds of the rectangle that's closest to the
given point. | [
"Computes",
"and",
"returns",
"the",
"point",
"inside",
"the",
"bounds",
"of",
"the",
"rectangle",
"that",
"s",
"closest",
"to",
"the",
"given",
"point",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Rectangles.java#L49-L51 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Area.java | Area.isRectangular | public boolean isRectangular () {
return (_isPolygonal) && (_rulesSize <= 5) && (_coordsSize <= 8) &&
(_coords[1] == _coords[3]) && (_coords[7] == _coords[5]) &&
(_coords[0] == _coords[6]) && (_coords[2] == _coords[4]);
} | java | public boolean isRectangular () {
return (_isPolygonal) && (_rulesSize <= 5) && (_coordsSize <= 8) &&
(_coords[1] == _coords[3]) && (_coords[7] == _coords[5]) &&
(_coords[0] == _coords[6]) && (_coords[2] == _coords[4]);
} | [
"public",
"boolean",
"isRectangular",
"(",
")",
"{",
"return",
"(",
"_isPolygonal",
")",
"&&",
"(",
"_rulesSize",
"<=",
"5",
")",
"&&",
"(",
"_coordsSize",
"<=",
"8",
")",
"&&",
"(",
"_coords",
"[",
"1",
"]",
"==",
"_coords",
"[",
"3",
"]",
")",
"&... | Returns true if this area is rectangular. | [
"Returns",
"true",
"if",
"this",
"area",
"is",
"rectangular",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Area.java#L94-L98 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Area.java | Area.add | public void add (Area area) {
if (area == null || area.isEmpty()) {
return;
} else if (isEmpty()) {
copy(area, this);
return;
}
if (isPolygonal() && area.isPolygonal()) {
addPolygon(area);
} else {
addCurvePolygon(area)... | java | public void add (Area area) {
if (area == null || area.isEmpty()) {
return;
} else if (isEmpty()) {
copy(area, this);
return;
}
if (isPolygonal() && area.isPolygonal()) {
addPolygon(area);
} else {
addCurvePolygon(area)... | [
"public",
"void",
"add",
"(",
"Area",
"area",
")",
"{",
"if",
"(",
"area",
"==",
"null",
"||",
"area",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"copy",
"(",
"area",
",",
"this",
... | Adds the supplied area to this area. | [
"Adds",
"the",
"supplied",
"area",
"to",
"this",
"area",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Area.java#L132-L149 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Area.java | Area.intersect | public void intersect (Area area) {
if (area == null) {
return;
} else if (isEmpty() || area.isEmpty()) {
reset();
return;
}
if (isPolygonal() && area.isPolygonal()) {
intersectPolygon(area);
} else {
intersectCurvePoly... | java | public void intersect (Area area) {
if (area == null) {
return;
} else if (isEmpty() || area.isEmpty()) {
reset();
return;
}
if (isPolygonal() && area.isPolygonal()) {
intersectPolygon(area);
} else {
intersectCurvePoly... | [
"public",
"void",
"intersect",
"(",
"Area",
"area",
")",
"{",
"if",
"(",
"area",
"==",
"null",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(",
"isEmpty",
"(",
")",
"||",
"area",
".",
"isEmpty",
"(",
")",
")",
"{",
"reset",
"(",
")",
";",
"retu... | Intersects the supplied area with this area. | [
"Intersects",
"the",
"supplied",
"area",
"with",
"this",
"area",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Area.java#L154-L171 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Area.java | Area.subtract | public void subtract (Area area) {
if (area == null || isEmpty() || area.isEmpty()) {
return;
}
if (isPolygonal() && area.isPolygonal()) {
subtractPolygon(area);
} else {
subtractCurvePolygon(area);
}
if (areaBoundsSquare() < Geometry... | java | public void subtract (Area area) {
if (area == null || isEmpty() || area.isEmpty()) {
return;
}
if (isPolygonal() && area.isPolygonal()) {
subtractPolygon(area);
} else {
subtractCurvePolygon(area);
}
if (areaBoundsSquare() < Geometry... | [
"public",
"void",
"subtract",
"(",
"Area",
"area",
")",
"{",
"if",
"(",
"area",
"==",
"null",
"||",
"isEmpty",
"(",
")",
"||",
"area",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isPolygonal",
"(",
")",
"&&",
"area",
".",
... | Subtracts the supplied area from this area. | [
"Subtracts",
"the",
"supplied",
"area",
"from",
"this",
"area",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Area.java#L176-L190 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Area.java | Area.exclusiveOr | public void exclusiveOr (Area area) {
Area a = clone();
a.intersect(area);
add(area);
subtract(a);
} | java | public void exclusiveOr (Area area) {
Area a = clone();
a.intersect(area);
add(area);
subtract(a);
} | [
"public",
"void",
"exclusiveOr",
"(",
"Area",
"area",
")",
"{",
"Area",
"a",
"=",
"clone",
"(",
")",
";",
"a",
".",
"intersect",
"(",
"area",
")",
";",
"add",
"(",
"area",
")",
";",
"subtract",
"(",
"a",
")",
";",
"}"
] | Computes the exclusive or of this area and the supplied area and sets this area to the
result. | [
"Computes",
"the",
"exclusive",
"or",
"of",
"this",
"area",
"and",
"the",
"supplied",
"area",
"and",
"sets",
"this",
"area",
"to",
"the",
"result",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Area.java#L196-L201 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Area.java | Area.adjustSize | private static double[] adjustSize (double[] array, int newSize) {
if (newSize <= array.length) {
return array;
}
double[] newArray = new double[2 * newSize];
System.arraycopy(array, 0, newArray, 0, array.length);
return newArray;
} | java | private static double[] adjustSize (double[] array, int newSize) {
if (newSize <= array.length) {
return array;
}
double[] newArray = new double[2 * newSize];
System.arraycopy(array, 0, newArray, 0, array.length);
return newArray;
} | [
"private",
"static",
"double",
"[",
"]",
"adjustSize",
"(",
"double",
"[",
"]",
"array",
",",
"int",
"newSize",
")",
"{",
"if",
"(",
"newSize",
"<=",
"array",
".",
"length",
")",
"{",
"return",
"array",
";",
"}",
"double",
"[",
"]",
"newArray",
"=",
... | the method check up the array size and necessarily increases it. | [
"the",
"method",
"check",
"up",
"the",
"array",
"size",
"and",
"necessarily",
"increases",
"it",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Area.java#L1150-L1157 | train |
di2e/Argo | DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java | BrowserController.getIPAddrInfo | @GET
@Path("/ipAddrInfo")
public String getIPAddrInfo() throws UnknownHostException {
Properties clientProps = getPropeSenderProps();
StringBuffer buf = new StringBuffer();
InetAddress localhost = null;
NetworkInterface ni = null;
try {
localhost = InetAddress.getLocalHost();
LOGG... | java | @GET
@Path("/ipAddrInfo")
public String getIPAddrInfo() throws UnknownHostException {
Properties clientProps = getPropeSenderProps();
StringBuffer buf = new StringBuffer();
InetAddress localhost = null;
NetworkInterface ni = null;
try {
localhost = InetAddress.getLocalHost();
LOGG... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/ipAddrInfo\"",
")",
"public",
"String",
"getIPAddrInfo",
"(",
")",
"throws",
"UnknownHostException",
"{",
"Properties",
"clientProps",
"=",
"getPropeSenderProps",
"(",
")",
";",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
... | Return the ip info of where the web host lives that supports the browser
app.
@return the ip addr info
@throws UnknownHostException if something goes wrong | [
"Return",
"the",
"ip",
"info",
"of",
"where",
"the",
"web",
"host",
"lives",
"that",
"supports",
"the",
"browser",
"app",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java#L94-L128 | train |
di2e/Argo | DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java | BrowserController.launchProbe | @GET
@Path("/launchProbe")
@Produces("application/txt")
public String launchProbe() throws IOException, UnsupportedPayloadType, ProbeSenderException, TransportException {
Properties clientProps = getPropeSenderProps();
String multicastGroupAddr = clientProps.getProperty("multicastGroupAddr", DEFAULT_MUL... | java | @GET
@Path("/launchProbe")
@Produces("application/txt")
public String launchProbe() throws IOException, UnsupportedPayloadType, ProbeSenderException, TransportException {
Properties clientProps = getPropeSenderProps();
String multicastGroupAddr = clientProps.getProperty("multicastGroupAddr", DEFAULT_MUL... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/launchProbe\"",
")",
"@",
"Produces",
"(",
"\"application/txt\"",
")",
"public",
"String",
"launchProbe",
"(",
")",
"throws",
"IOException",
",",
"UnsupportedPayloadType",
",",
"ProbeSenderException",
",",
"TransportException",
"{",... | Actually launch a probe.
@return some confirmation string back to the client
@throws IOException if there is some transport issues
@throws UnsupportedPayloadType shouldn't happen as we always ask for JSON
here
@throws ProbeSenderException if something else goes wrong
@throws TransportException if something else goes w... | [
"Actually",
"launch",
"a",
"probe",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java#L140-L188 | train |
di2e/Argo | DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java | BrowserController.getResponses | @GET
@Path("/responses")
@Produces("application/json")
public String getResponses() throws UnknownHostException {
Properties clientProps = getPropeSenderProps();
String listenerIPAddress = clientProps.getProperty("listenerIPAddress");
String listenerPort = clientProps.getProperty("listenerPort");
... | java | @GET
@Path("/responses")
@Produces("application/json")
public String getResponses() throws UnknownHostException {
Properties clientProps = getPropeSenderProps();
String listenerIPAddress = clientProps.getProperty("listenerIPAddress");
String listenerPort = clientProps.getProperty("listenerPort");
... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/responses\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"String",
"getResponses",
"(",
")",
"throws",
"UnknownHostException",
"{",
"Properties",
"clientProps",
"=",
"getPropeSenderProps",
"(",
")",
";",
"... | Returns a list of the responses collected in the listener.
@return list of the responses collected in the listener
@throws UnknownHostException if the ProbeSender props throws it | [
"Returns",
"a",
"list",
"of",
"the",
"responses",
"collected",
"in",
"the",
"listener",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java#L196-L209 | train |
di2e/Argo | DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java | BrowserController.clearCache | @GET
@Path("/clearCache")
@Produces("application/json")
public String clearCache() throws UnknownHostException {
Properties clientProps = getPropeSenderProps();
String listenerIPAddress = clientProps.getProperty("listenerIPAddress");
String listenerPort = clientProps.getProperty("listenerPort");
... | java | @GET
@Path("/clearCache")
@Produces("application/json")
public String clearCache() throws UnknownHostException {
Properties clientProps = getPropeSenderProps();
String listenerIPAddress = clientProps.getProperty("listenerIPAddress");
String listenerPort = clientProps.getProperty("listenerPort");
... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/clearCache\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"String",
"clearCache",
"(",
")",
"throws",
"UnknownHostException",
"{",
"Properties",
"clientProps",
"=",
"getPropeSenderProps",
"(",
")",
";",
"S... | Clears the active response cache.
@return the response from the listener service
@throws UnknownHostException if there is an issue with the listener address | [
"Clears",
"the",
"active",
"response",
"cache",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/DemoWebClient/ArgoWebClient/src/main/java/ws/argo/DemoWebClient/Browser/BrowserController.java#L217-L230 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Frustum.java | Frustum.distance | public double distance (Vector3 point) {
double distance = -Float.MAX_VALUE;
for (Plane plane : _planes) {
distance = Math.max(distance, plane.distance(point));
}
return distance;
} | java | public double distance (Vector3 point) {
double distance = -Float.MAX_VALUE;
for (Plane plane : _planes) {
distance = Math.max(distance, plane.distance(point));
}
return distance;
} | [
"public",
"double",
"distance",
"(",
"Vector3",
"point",
")",
"{",
"double",
"distance",
"=",
"-",
"Float",
".",
"MAX_VALUE",
";",
"for",
"(",
"Plane",
"plane",
":",
"_planes",
")",
"{",
"distance",
"=",
"Math",
".",
"max",
"(",
"distance",
",",
"plane... | Determines the maximum signed distance of the point from the planes of the frustum. If
the distance is less than or equal to zero, the point lies inside the frustum. | [
"Determines",
"the",
"maximum",
"signed",
"distance",
"of",
"the",
"point",
"from",
"the",
"planes",
"of",
"the",
"frustum",
".",
"If",
"the",
"distance",
"is",
"less",
"than",
"or",
"equal",
"to",
"zero",
"the",
"point",
"lies",
"inside",
"the",
"frustum"... | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Frustum.java#L175-L181 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/utils/CommandUtils.java | CommandUtils.getCommandClass | public static Class<? extends Command<? extends CLIContext>> getCommandClass(
CLIContext context, String commandName) {
return context.getHostApplication().getCommands().get(commandName.toLowerCase());
} | java | public static Class<? extends Command<? extends CLIContext>> getCommandClass(
CLIContext context, String commandName) {
return context.getHostApplication().getCommands().get(commandName.toLowerCase());
} | [
"public",
"static",
"Class",
"<",
"?",
"extends",
"Command",
"<",
"?",
"extends",
"CLIContext",
">",
">",
"getCommandClass",
"(",
"CLIContext",
"context",
",",
"String",
"commandName",
")",
"{",
"return",
"context",
".",
"getHostApplication",
"(",
")",
".",
... | Get a command by name.
@param context The CLIContext
@param commandName The name of the command.
@return The command, or null if not found. | [
"Get",
"a",
"command",
"by",
"name",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/utils/CommandUtils.java#L20-L23 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/cases/ListConsCases.java | ListConsCases.nil | public static <T> DecomposableMatchBuilder0<List<T>> nil() {
List<Matcher<Object>> matchers = Lists.of();
return new DecomposableMatchBuilder0<List<T>>(matchers, new ListConsNilFieldExtractor<>());
} | java | public static <T> DecomposableMatchBuilder0<List<T>> nil() {
List<Matcher<Object>> matchers = Lists.of();
return new DecomposableMatchBuilder0<List<T>>(matchers, new ListConsNilFieldExtractor<>());
} | [
"public",
"static",
"<",
"T",
">",
"DecomposableMatchBuilder0",
"<",
"List",
"<",
"T",
">",
">",
"nil",
"(",
")",
"{",
"List",
"<",
"Matcher",
"<",
"Object",
">>",
"matchers",
"=",
"Lists",
".",
"of",
"(",
")",
";",
"return",
"new",
"DecomposableMatchB... | Matches an empty list. | [
"Matches",
"an",
"empty",
"list",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/cases/ListConsCases.java#L45-L48 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/console/Console.java | Console.print | public static void print(ConsoleLevel level, String message) {
if (level.compareTo(_level) <= 0) {
if (_printLogLevel) {
level.getStream().println(level.name() + ": " + message);
}
else {
level.getStream().println(message);
}
level.getStream().flush();
}
} | java | public static void print(ConsoleLevel level, String message) {
if (level.compareTo(_level) <= 0) {
if (_printLogLevel) {
level.getStream().println(level.name() + ": " + message);
}
else {
level.getStream().println(message);
}
level.getStream().flush();
}
} | [
"public",
"static",
"void",
"print",
"(",
"ConsoleLevel",
"level",
",",
"String",
"message",
")",
"{",
"if",
"(",
"level",
".",
"compareTo",
"(",
"_level",
")",
"<=",
"0",
")",
"{",
"if",
"(",
"_printLogLevel",
")",
"{",
"level",
".",
"getStream",
"(",... | Print the given message at the given level.
@param level The level associated with the message.
@param message The message. | [
"Print",
"the",
"given",
"message",
"at",
"the",
"given",
"level",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/console/Console.java#L41-L51 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.