id
int32 0
165k
| 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
154,400
|
kazocsaba/matrix
|
src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java
|
MatrixFactory.createVector
|
public static Vector2 createVector(double x, double y) {
Vector2 v=new Vector2Impl();
v.setX(x);
v.setY(y);
return v;
}
|
java
|
public static Vector2 createVector(double x, double y) {
Vector2 v=new Vector2Impl();
v.setX(x);
v.setY(y);
return v;
}
|
[
"public",
"static",
"Vector2",
"createVector",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"Vector2",
"v",
"=",
"new",
"Vector2Impl",
"(",
")",
";",
"v",
".",
"setX",
"(",
"x",
")",
";",
"v",
".",
"setY",
"(",
"y",
")",
";",
"return",
"v",
";",
"}"
] |
Creates and initializes a new 2D column vector.
@param x the x coordinate of the new vector
@param y the y coordinate of the new vector
@return the new vector
|
[
"Creates",
"and",
"initializes",
"a",
"new",
"2D",
"column",
"vector",
"."
] |
018570db945fe616b25606fe605fa6e0c180ab5b
|
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L20-L25
|
154,401
|
kazocsaba/matrix
|
src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java
|
MatrixFactory.createVector
|
public static Vector3 createVector(double x, double y, double z) {
Vector3 v=new Vector3Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
return v;
}
|
java
|
public static Vector3 createVector(double x, double y, double z) {
Vector3 v=new Vector3Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
return v;
}
|
[
"public",
"static",
"Vector3",
"createVector",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"Vector3",
"v",
"=",
"new",
"Vector3Impl",
"(",
")",
";",
"v",
".",
"setX",
"(",
"x",
")",
";",
"v",
".",
"setY",
"(",
"y",
")",
";",
"v",
".",
"setZ",
"(",
"z",
")",
";",
"return",
"v",
";",
"}"
] |
Creates and initializes a new 3D column vector.
@param x the x coordinate of the new vector
@param y the y coordinate of the new vector
@param z the z coordinate of the new vector
@return the new vector
|
[
"Creates",
"and",
"initializes",
"a",
"new",
"3D",
"column",
"vector",
"."
] |
018570db945fe616b25606fe605fa6e0c180ab5b
|
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L38-L44
|
154,402
|
kazocsaba/matrix
|
src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java
|
MatrixFactory.createVector
|
public static Vector4 createVector(double x, double y, double z, double h) {
Vector4 v=new Vector4Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
v.setH(h);
return v;
}
|
java
|
public static Vector4 createVector(double x, double y, double z, double h) {
Vector4 v=new Vector4Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
v.setH(h);
return v;
}
|
[
"public",
"static",
"Vector4",
"createVector",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
",",
"double",
"h",
")",
"{",
"Vector4",
"v",
"=",
"new",
"Vector4Impl",
"(",
")",
";",
"v",
".",
"setX",
"(",
"x",
")",
";",
"v",
".",
"setY",
"(",
"y",
")",
";",
"v",
".",
"setZ",
"(",
"z",
")",
";",
"v",
".",
"setH",
"(",
"h",
")",
";",
"return",
"v",
";",
"}"
] |
Creates and initializes a new 4D column vector.
@param x the x coordinate of the new vector
@param y the y coordinate of the new vector
@param z the z coordinate of the new vector
@param h the h coordinate of the new vector
@return the new vector
|
[
"Creates",
"and",
"initializes",
"a",
"new",
"4D",
"column",
"vector",
"."
] |
018570db945fe616b25606fe605fa6e0c180ab5b
|
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L58-L65
|
154,403
|
kazocsaba/matrix
|
src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java
|
MatrixFactory.createVector
|
public static Vector createVector(int dimension) {
if (dimension<=0) throw new IllegalArgumentException();
switch (dimension) {
case 2: return createVector2();
case 3: return createVector3();
case 4: return createVector4();
default: return new VectorImpl(dimension);
}
}
|
java
|
public static Vector createVector(int dimension) {
if (dimension<=0) throw new IllegalArgumentException();
switch (dimension) {
case 2: return createVector2();
case 3: return createVector3();
case 4: return createVector4();
default: return new VectorImpl(dimension);
}
}
|
[
"public",
"static",
"Vector",
"createVector",
"(",
"int",
"dimension",
")",
"{",
"if",
"(",
"dimension",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"switch",
"(",
"dimension",
")",
"{",
"case",
"2",
":",
"return",
"createVector2",
"(",
")",
";",
"case",
"3",
":",
"return",
"createVector3",
"(",
")",
";",
"case",
"4",
":",
"return",
"createVector4",
"(",
")",
";",
"default",
":",
"return",
"new",
"VectorImpl",
"(",
"dimension",
")",
";",
"}",
"}"
] |
Creates a new column vector with all elements initialized to 0.
@param dimension the dimension of the vector.
@return the new vector
@throws IllegalArgumentException if the argument is not positive
|
[
"Creates",
"a",
"new",
"column",
"vector",
"with",
"all",
"elements",
"initialized",
"to",
"0",
"."
] |
018570db945fe616b25606fe605fa6e0c180ab5b
|
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L72-L80
|
154,404
|
kazocsaba/matrix
|
src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java
|
MatrixFactory.createMatrix
|
public static Matrix createMatrix(int rowCount, int colCount) {
if (rowCount<=0 || colCount<=0) throw new IllegalArgumentException();
if (colCount==1)
return createVector(rowCount);
else if (rowCount==2 && colCount==2)
return createMatrix2();
else if (rowCount==3 && colCount==3)
return createMatrix3();
else
return new MatrixImpl(rowCount, colCount);
}
|
java
|
public static Matrix createMatrix(int rowCount, int colCount) {
if (rowCount<=0 || colCount<=0) throw new IllegalArgumentException();
if (colCount==1)
return createVector(rowCount);
else if (rowCount==2 && colCount==2)
return createMatrix2();
else if (rowCount==3 && colCount==3)
return createMatrix3();
else
return new MatrixImpl(rowCount, colCount);
}
|
[
"public",
"static",
"Matrix",
"createMatrix",
"(",
"int",
"rowCount",
",",
"int",
"colCount",
")",
"{",
"if",
"(",
"rowCount",
"<=",
"0",
"||",
"colCount",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"colCount",
"==",
"1",
")",
"return",
"createVector",
"(",
"rowCount",
")",
";",
"else",
"if",
"(",
"rowCount",
"==",
"2",
"&&",
"colCount",
"==",
"2",
")",
"return",
"createMatrix2",
"(",
")",
";",
"else",
"if",
"(",
"rowCount",
"==",
"3",
"&&",
"colCount",
"==",
"3",
")",
"return",
"createMatrix3",
"(",
")",
";",
"else",
"return",
"new",
"MatrixImpl",
"(",
"rowCount",
",",
"colCount",
")",
";",
"}"
] |
Creates a new matrix with all elements initialized to 0.
@param rowCount the number of rows
@param colCount the number of columns
@return a new matrix of the specified size
@throws IllegalArgumentException if either argument is non-positive
|
[
"Creates",
"a",
"new",
"matrix",
"with",
"all",
"elements",
"initialized",
"to",
"0",
"."
] |
018570db945fe616b25606fe605fa6e0c180ab5b
|
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L89-L99
|
154,405
|
wigforss/Ka-Web
|
servlet/src/main/java/org/kasource/web/servlet/filter/ExpireCacheFilter.java
|
ExpireCacheFilter.setHeaders
|
private void setHeaders(HttpServletResponse response) {
setHeader(response, "Expires", Long.valueOf(System.currentTimeMillis() + cacheTimeoutMs).toString());
setHeader(response, "Cache-Control", "public, must-revalidate, max-age=" + cacheTimeout); // HTTP 1.1.
setHeader(response, "Pragma", "public");
}
|
java
|
private void setHeaders(HttpServletResponse response) {
setHeader(response, "Expires", Long.valueOf(System.currentTimeMillis() + cacheTimeoutMs).toString());
setHeader(response, "Cache-Control", "public, must-revalidate, max-age=" + cacheTimeout); // HTTP 1.1.
setHeader(response, "Pragma", "public");
}
|
[
"private",
"void",
"setHeaders",
"(",
"HttpServletResponse",
"response",
")",
"{",
"setHeader",
"(",
"response",
",",
"\"Expires\"",
",",
"Long",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"cacheTimeoutMs",
")",
".",
"toString",
"(",
")",
")",
";",
"setHeader",
"(",
"response",
",",
"\"Cache-Control\"",
",",
"\"public, must-revalidate, max-age=\"",
"+",
"cacheTimeout",
")",
";",
"// HTTP 1.1.",
"setHeader",
"(",
"response",
",",
"\"Pragma\"",
",",
"\"public\"",
")",
";",
"}"
] |
Set Cache headers.
@param response The HttpResponse to set headers on
|
[
"Set",
"Cache",
"headers",
"."
] |
bb6d8eacbefdeb7c8c6bb6135e55939d968fa433
|
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/filter/ExpireCacheFilter.java#L50-L54
|
154,406
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/JAXBCommandLine.java
|
JAXBCommandLine.command
|
@Override
public void command(String... args)
{
addArgument(File.class, "xml-config-file-path");
super.command(args);
configFile = getArgument("xml-config-file-path");
readConfig();
if (watch)
{
Thread thread = new Thread(this, configFile+" watcher");
thread.start();
}
}
|
java
|
@Override
public void command(String... args)
{
addArgument(File.class, "xml-config-file-path");
super.command(args);
configFile = getArgument("xml-config-file-path");
readConfig();
if (watch)
{
Thread thread = new Thread(this, configFile+" watcher");
thread.start();
}
}
|
[
"@",
"Override",
"public",
"void",
"command",
"(",
"String",
"...",
"args",
")",
"{",
"addArgument",
"(",
"File",
".",
"class",
",",
"\"xml-config-file-path\"",
")",
";",
"super",
".",
"command",
"(",
"args",
")",
";",
"configFile",
"=",
"getArgument",
"(",
"\"xml-config-file-path\"",
")",
";",
"readConfig",
"(",
")",
";",
"if",
"(",
"watch",
")",
"{",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"this",
",",
"configFile",
"+",
"\" watcher\"",
")",
";",
"thread",
".",
"start",
"(",
")",
";",
"}",
"}"
] |
Resolves command line arguments and starts watch thread if watch was true
in constructor.
@param args
|
[
"Resolves",
"command",
"line",
"arguments",
"and",
"starts",
"watch",
"thread",
"if",
"watch",
"was",
"true",
"in",
"constructor",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/JAXBCommandLine.java#L76-L88
|
154,407
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/JAXBCommandLine.java
|
JAXBCommandLine.getValue
|
@Override
public Object getValue(String name)
{
Object value = super.getValue(name);
if (value != null)
{
return value;
}
else
{
return configMap.get(name);
}
}
|
java
|
@Override
public Object getValue(String name)
{
Object value = super.getValue(name);
if (value != null)
{
return value;
}
else
{
return configMap.get(name);
}
}
|
[
"@",
"Override",
"public",
"Object",
"getValue",
"(",
"String",
"name",
")",
"{",
"Object",
"value",
"=",
"super",
".",
"getValue",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"else",
"{",
"return",
"configMap",
".",
"get",
"(",
"name",
")",
";",
"}",
"}"
] |
Overrides getValue so that also config file values are returned.
@param name
@return
|
[
"Overrides",
"getValue",
"so",
"that",
"also",
"config",
"file",
"values",
"are",
"returned",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/JAXBCommandLine.java#L114-L126
|
154,408
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMRestfulResource.java
|
JMRestfulResource.getStringWithRestOrClasspathOrFilePath
|
public static String getStringWithRestOrClasspathOrFilePath(
String resourceWithRestOrClasspathOrFilePath, String charsetName) {
return resourceWithRestOrClasspathOrFilePath.startsWith(HTTP)
? HttpGetRequester.getResponseAsString(
resourceWithRestOrClasspathOrFilePath, charsetName)
: JMResources.getStringWithClasspathOrFilePath(
resourceWithRestOrClasspathOrFilePath, charsetName);
}
|
java
|
public static String getStringWithRestOrClasspathOrFilePath(
String resourceWithRestOrClasspathOrFilePath, String charsetName) {
return resourceWithRestOrClasspathOrFilePath.startsWith(HTTP)
? HttpGetRequester.getResponseAsString(
resourceWithRestOrClasspathOrFilePath, charsetName)
: JMResources.getStringWithClasspathOrFilePath(
resourceWithRestOrClasspathOrFilePath, charsetName);
}
|
[
"public",
"static",
"String",
"getStringWithRestOrClasspathOrFilePath",
"(",
"String",
"resourceWithRestOrClasspathOrFilePath",
",",
"String",
"charsetName",
")",
"{",
"return",
"resourceWithRestOrClasspathOrFilePath",
".",
"startsWith",
"(",
"HTTP",
")",
"?",
"HttpGetRequester",
".",
"getResponseAsString",
"(",
"resourceWithRestOrClasspathOrFilePath",
",",
"charsetName",
")",
":",
"JMResources",
".",
"getStringWithClasspathOrFilePath",
"(",
"resourceWithRestOrClasspathOrFilePath",
",",
"charsetName",
")",
";",
"}"
] |
Gets string with rest or classpath or file path.
@param resourceWithRestOrClasspathOrFilePath the resource with rest or classpath or file path
@param charsetName the charset name
@return the string with rest or classpath or file path
|
[
"Gets",
"string",
"with",
"rest",
"or",
"classpath",
"or",
"file",
"path",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMRestfulResource.java#L21-L28
|
154,409
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMRestfulResource.java
|
JMRestfulResource.readLinesWithRestOrClasspathOrFilePath
|
public static List<String> readLinesWithRestOrClasspathOrFilePath(
String resourceWithRestOrClasspathOrFilePath, String charsetName) {
return JMCollections
.buildListByLine(getStringWithRestOrClasspathOrFilePath(
resourceWithRestOrClasspathOrFilePath, charsetName));
}
|
java
|
public static List<String> readLinesWithRestOrClasspathOrFilePath(
String resourceWithRestOrClasspathOrFilePath, String charsetName) {
return JMCollections
.buildListByLine(getStringWithRestOrClasspathOrFilePath(
resourceWithRestOrClasspathOrFilePath, charsetName));
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"readLinesWithRestOrClasspathOrFilePath",
"(",
"String",
"resourceWithRestOrClasspathOrFilePath",
",",
"String",
"charsetName",
")",
"{",
"return",
"JMCollections",
".",
"buildListByLine",
"(",
"getStringWithRestOrClasspathOrFilePath",
"(",
"resourceWithRestOrClasspathOrFilePath",
",",
"charsetName",
")",
")",
";",
"}"
] |
Read lines with rest or classpath or file path list.
@param resourceWithRestOrClasspathOrFilePath the resource with rest or classpath or file path
@param charsetName the charset name
@return the list
|
[
"Read",
"lines",
"with",
"rest",
"or",
"classpath",
"or",
"file",
"path",
"list",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMRestfulResource.java#L50-L55
|
154,410
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMRestfulResource.java
|
JMRestfulResource.getStringWithRestOrFilePathOrClasspath
|
public static String getStringWithRestOrFilePathOrClasspath(
String resourceWithRestOrFilePathOrClasspath, String charsetName) {
return resourceWithRestOrFilePathOrClasspath.startsWith(HTTP)
? HttpGetRequester.getResponseAsString(
resourceWithRestOrFilePathOrClasspath, charsetName)
: JMResources.getStringWithFilePathOrClasspath(
resourceWithRestOrFilePathOrClasspath, charsetName);
}
|
java
|
public static String getStringWithRestOrFilePathOrClasspath(
String resourceWithRestOrFilePathOrClasspath, String charsetName) {
return resourceWithRestOrFilePathOrClasspath.startsWith(HTTP)
? HttpGetRequester.getResponseAsString(
resourceWithRestOrFilePathOrClasspath, charsetName)
: JMResources.getStringWithFilePathOrClasspath(
resourceWithRestOrFilePathOrClasspath, charsetName);
}
|
[
"public",
"static",
"String",
"getStringWithRestOrFilePathOrClasspath",
"(",
"String",
"resourceWithRestOrFilePathOrClasspath",
",",
"String",
"charsetName",
")",
"{",
"return",
"resourceWithRestOrFilePathOrClasspath",
".",
"startsWith",
"(",
"HTTP",
")",
"?",
"HttpGetRequester",
".",
"getResponseAsString",
"(",
"resourceWithRestOrFilePathOrClasspath",
",",
"charsetName",
")",
":",
"JMResources",
".",
"getStringWithFilePathOrClasspath",
"(",
"resourceWithRestOrFilePathOrClasspath",
",",
"charsetName",
")",
";",
"}"
] |
Gets string with rest or file path or classpath.
@param resourceWithRestOrFilePathOrClasspath the resource with rest or file path or classpath
@param charsetName the charset name
@return the string with rest or file path or classpath
|
[
"Gets",
"string",
"with",
"rest",
"or",
"file",
"path",
"or",
"classpath",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMRestfulResource.java#L77-L84
|
154,411
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/helper/JMRestfulResource.java
|
JMRestfulResource.readLinesWithRestOrFilePathOrClasspath
|
public static List<String> readLinesWithRestOrFilePathOrClasspath(
String resourceWithRestOrFilePathOrClasspath, String charsetName) {
return JMCollections
.buildListByLine(getStringWithRestOrClasspathOrFilePath(
resourceWithRestOrFilePathOrClasspath, charsetName));
}
|
java
|
public static List<String> readLinesWithRestOrFilePathOrClasspath(
String resourceWithRestOrFilePathOrClasspath, String charsetName) {
return JMCollections
.buildListByLine(getStringWithRestOrClasspathOrFilePath(
resourceWithRestOrFilePathOrClasspath, charsetName));
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"readLinesWithRestOrFilePathOrClasspath",
"(",
"String",
"resourceWithRestOrFilePathOrClasspath",
",",
"String",
"charsetName",
")",
"{",
"return",
"JMCollections",
".",
"buildListByLine",
"(",
"getStringWithRestOrClasspathOrFilePath",
"(",
"resourceWithRestOrFilePathOrClasspath",
",",
"charsetName",
")",
")",
";",
"}"
] |
Read lines with rest or file path or classpath list.
@param resourceWithRestOrFilePathOrClasspath the resource with rest or file path or classpath
@param charsetName the charset name
@return the list
|
[
"Read",
"lines",
"with",
"rest",
"or",
"file",
"path",
"or",
"classpath",
"list",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMRestfulResource.java#L106-L111
|
154,412
|
avaje-common/avaje-jetty-runner
|
src/main/java/org/avaje/jettyrunner/JettyRun.java
|
JettyRun.setupForExpandedWar
|
protected void setupForExpandedWar() {
webapp.setServerClasses(getServerClasses());
webapp.setDescriptor(webapp + "/WEB-INF/web.xml");
webapp.setResourceBase(resourceBase);
webapp.setParentLoaderPriority(false);
}
|
java
|
protected void setupForExpandedWar() {
webapp.setServerClasses(getServerClasses());
webapp.setDescriptor(webapp + "/WEB-INF/web.xml");
webapp.setResourceBase(resourceBase);
webapp.setParentLoaderPriority(false);
}
|
[
"protected",
"void",
"setupForExpandedWar",
"(",
")",
"{",
"webapp",
".",
"setServerClasses",
"(",
"getServerClasses",
"(",
")",
")",
";",
"webapp",
".",
"setDescriptor",
"(",
"webapp",
"+",
"\"/WEB-INF/web.xml\"",
")",
";",
"webapp",
".",
"setResourceBase",
"(",
"resourceBase",
")",
";",
"webapp",
".",
"setParentLoaderPriority",
"(",
"false",
")",
";",
"}"
] |
Setup for an expanded webapp with resource base as a relative path.
|
[
"Setup",
"for",
"an",
"expanded",
"webapp",
"with",
"resource",
"base",
"as",
"a",
"relative",
"path",
"."
] |
acddc23754facc339233fa0b9736e94abc8ae842
|
https://github.com/avaje-common/avaje-jetty-runner/blob/acddc23754facc339233fa0b9736e94abc8ae842/src/main/java/org/avaje/jettyrunner/JettyRun.java#L40-L46
|
154,413
|
OwlPlatform/java-owl-solver
|
src/main/java/com/owlplatform/solver/protocol/messages/Transmitter.java
|
Transmitter.setBaseId
|
public void setBaseId(byte[] baseId) {
if (baseId == null) {
throw new IllegalArgumentException("Transmitter base ID cannot be null.");
}
if (baseId.length != TRANSMITTER_ID_SIZE) {
throw new IllegalArgumentException(String.format(
"Transmitter base ID must be %d bytes long.",
Integer.valueOf(TRANSMITTER_ID_SIZE)));
}
this.baseId = baseId;
}
|
java
|
public void setBaseId(byte[] baseId) {
if (baseId == null) {
throw new IllegalArgumentException("Transmitter base ID cannot be null.");
}
if (baseId.length != TRANSMITTER_ID_SIZE) {
throw new IllegalArgumentException(String.format(
"Transmitter base ID must be %d bytes long.",
Integer.valueOf(TRANSMITTER_ID_SIZE)));
}
this.baseId = baseId;
}
|
[
"public",
"void",
"setBaseId",
"(",
"byte",
"[",
"]",
"baseId",
")",
"{",
"if",
"(",
"baseId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Transmitter base ID cannot be null.\"",
")",
";",
"}",
"if",
"(",
"baseId",
".",
"length",
"!=",
"TRANSMITTER_ID_SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Transmitter base ID must be %d bytes long.\"",
",",
"Integer",
".",
"valueOf",
"(",
"TRANSMITTER_ID_SIZE",
")",
")",
")",
";",
"}",
"this",
".",
"baseId",
"=",
"baseId",
";",
"}"
] |
Sets the base address for this transmitter.
@param baseId
the base address for this transmitter.
|
[
"Sets",
"the",
"base",
"address",
"for",
"this",
"transmitter",
"."
] |
53a1faabd63613c716203922cd52f871e5fedb9b
|
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/protocol/messages/Transmitter.java#L149-L159
|
154,414
|
OwlPlatform/java-owl-solver
|
src/main/java/com/owlplatform/solver/protocol/messages/Transmitter.java
|
Transmitter.setMask
|
public void setMask(byte[] mask) {
if (mask == null) {
throw new IllegalArgumentException("Transmitter mask cannot be null.");
}
if (mask.length != TRANSMITTER_ID_SIZE) {
throw new IllegalArgumentException(String.format(
"Transmitter mask must be %d bytes long.",
Integer.valueOf(TRANSMITTER_ID_SIZE)));
}
this.mask = mask;
}
|
java
|
public void setMask(byte[] mask) {
if (mask == null) {
throw new IllegalArgumentException("Transmitter mask cannot be null.");
}
if (mask.length != TRANSMITTER_ID_SIZE) {
throw new IllegalArgumentException(String.format(
"Transmitter mask must be %d bytes long.",
Integer.valueOf(TRANSMITTER_ID_SIZE)));
}
this.mask = mask;
}
|
[
"public",
"void",
"setMask",
"(",
"byte",
"[",
"]",
"mask",
")",
"{",
"if",
"(",
"mask",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Transmitter mask cannot be null.\"",
")",
";",
"}",
"if",
"(",
"mask",
".",
"length",
"!=",
"TRANSMITTER_ID_SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Transmitter mask must be %d bytes long.\"",
",",
"Integer",
".",
"valueOf",
"(",
"TRANSMITTER_ID_SIZE",
")",
")",
")",
";",
"}",
"this",
".",
"mask",
"=",
"mask",
";",
"}"
] |
Sets the bit mask for this transmitter.
@param mask
the bit mask for this transmitter.
|
[
"Sets",
"the",
"bit",
"mask",
"for",
"this",
"transmitter",
"."
] |
53a1faabd63613c716203922cd52f871e5fedb9b
|
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/protocol/messages/Transmitter.java#L176-L186
|
154,415
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JTiledImage.java
|
JTiledImage.init
|
public void init(ImageIcon imageBackground, Color colorBackground, Container compAnchor)
{
m_imageBackground = imageBackground;
m_compAnchor = compAnchor;
if (colorBackground != null)
this.setBackground(colorBackground);
}
|
java
|
public void init(ImageIcon imageBackground, Color colorBackground, Container compAnchor)
{
m_imageBackground = imageBackground;
m_compAnchor = compAnchor;
if (colorBackground != null)
this.setBackground(colorBackground);
}
|
[
"public",
"void",
"init",
"(",
"ImageIcon",
"imageBackground",
",",
"Color",
"colorBackground",
",",
"Container",
"compAnchor",
")",
"{",
"m_imageBackground",
"=",
"imageBackground",
";",
"m_compAnchor",
"=",
"compAnchor",
";",
"if",
"(",
"colorBackground",
"!=",
"null",
")",
"this",
".",
"setBackground",
"(",
"colorBackground",
")",
";",
"}"
] |
Constructor - Initialize this background.
@param imageBackground The image to tile as the background.
@param colorBackground The color to paint to background (If you don't want a background, set this to non-opaque).
|
[
"Constructor",
"-",
"Initialize",
"this",
"background",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JTiledImage.java#L86-L92
|
154,416
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JTiledImage.java
|
JTiledImage.calcOffset
|
public void calcOffset(Container compAnchor, Point offset)
{
offset.x = 0;
offset.y = 0;
Container parent = this;
while (parent != null)
{
offset.x -= parent.getLocation().x;
offset.y -= parent.getLocation().y;
parent = parent.getParent();
if (parent == compAnchor)
return; // Success
}
// Failure - comp not found.
offset.x = 0;
offset.y = 0;
}
|
java
|
public void calcOffset(Container compAnchor, Point offset)
{
offset.x = 0;
offset.y = 0;
Container parent = this;
while (parent != null)
{
offset.x -= parent.getLocation().x;
offset.y -= parent.getLocation().y;
parent = parent.getParent();
if (parent == compAnchor)
return; // Success
}
// Failure - comp not found.
offset.x = 0;
offset.y = 0;
}
|
[
"public",
"void",
"calcOffset",
"(",
"Container",
"compAnchor",
",",
"Point",
"offset",
")",
"{",
"offset",
".",
"x",
"=",
"0",
";",
"offset",
".",
"y",
"=",
"0",
";",
"Container",
"parent",
"=",
"this",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"offset",
".",
"x",
"-=",
"parent",
".",
"getLocation",
"(",
")",
".",
"x",
";",
"offset",
".",
"y",
"-=",
"parent",
".",
"getLocation",
"(",
")",
".",
"y",
";",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"compAnchor",
")",
"return",
";",
"// Success",
"}",
"// Failure - comp not found.",
"offset",
".",
"x",
"=",
"0",
";",
"offset",
".",
"y",
"=",
"0",
";",
"}"
] |
Calculate the offset from the component to this component.
@param compAnchor The component that would be the upper left hand of this screen.
@param offset The offset to set for return.
|
[
"Calculate",
"the",
"offset",
"from",
"the",
"component",
"to",
"this",
"component",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JTiledImage.java#L122-L138
|
154,417
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultNumber.java
|
JDefaultNumber.number
|
public static String number(int numberOfDigits) {
if (numberOfDigits < 1) {
return "";
}
StringBuffer sb = new StringBuffer(randomIntBetweenTwoNumbers(1, 9) + "");
if (numberOfDigits == 1) {
return sb.toString();
}
char[] chars = "123456789".toCharArray();
String secondHalf = RandomStringUtils.random(numberOfDigits - 1, 0, 8, false, false, chars);
return sb.append(secondHalf).toString();
}
|
java
|
public static String number(int numberOfDigits) {
if (numberOfDigits < 1) {
return "";
}
StringBuffer sb = new StringBuffer(randomIntBetweenTwoNumbers(1, 9) + "");
if (numberOfDigits == 1) {
return sb.toString();
}
char[] chars = "123456789".toCharArray();
String secondHalf = RandomStringUtils.random(numberOfDigits - 1, 0, 8, false, false, chars);
return sb.append(secondHalf).toString();
}
|
[
"public",
"static",
"String",
"number",
"(",
"int",
"numberOfDigits",
")",
"{",
"if",
"(",
"numberOfDigits",
"<",
"1",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"randomIntBetweenTwoNumbers",
"(",
"1",
",",
"9",
")",
"+",
"\"\"",
")",
";",
"if",
"(",
"numberOfDigits",
"==",
"1",
")",
"{",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"char",
"[",
"]",
"chars",
"=",
"\"123456789\"",
".",
"toCharArray",
"(",
")",
";",
"String",
"secondHalf",
"=",
"RandomStringUtils",
".",
"random",
"(",
"numberOfDigits",
"-",
"1",
",",
"0",
",",
"8",
",",
"false",
",",
"false",
",",
"chars",
")",
";",
"return",
"sb",
".",
"append",
"(",
"secondHalf",
")",
".",
"toString",
"(",
")",
";",
"}"
] |
random number string without 0 being possible as the first digit
@param numberOfDigits length of string
@return number string
|
[
"random",
"number",
"string",
"without",
"0",
"being",
"possible",
"as",
"the",
"first",
"digit"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultNumber.java#L46-L62
|
154,418
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultNumber.java
|
JDefaultNumber.randomNumberString
|
public static String randomNumberString(int length) {
char[] chars = "0123456789".toCharArray();
return RandomStringUtils.random(length, 0, 9, false, false, chars);
}
|
java
|
public static String randomNumberString(int length) {
char[] chars = "0123456789".toCharArray();
return RandomStringUtils.random(length, 0, 9, false, false, chars);
}
|
[
"public",
"static",
"String",
"randomNumberString",
"(",
"int",
"length",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"\"0123456789\"",
".",
"toCharArray",
"(",
")",
";",
"return",
"RandomStringUtils",
".",
"random",
"(",
"length",
",",
"0",
",",
"9",
",",
"false",
",",
"false",
",",
"chars",
")",
";",
"}"
] |
random number string with zero possible in any position
@param length of number string
@return number string
|
[
"random",
"number",
"string",
"with",
"zero",
"possible",
"in",
"any",
"position"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultNumber.java#L71-L74
|
154,419
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultNumber.java
|
JDefaultNumber.randomIntBetweenTwoNumbers
|
public static int randomIntBetweenTwoNumbers(int min, int max) {
int number = RandomUtils.nextInt(max - min);
return number + min;
}
|
java
|
public static int randomIntBetweenTwoNumbers(int min, int max) {
int number = RandomUtils.nextInt(max - min);
return number + min;
}
|
[
"public",
"static",
"int",
"randomIntBetweenTwoNumbers",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"int",
"number",
"=",
"RandomUtils",
".",
"nextInt",
"(",
"max",
"-",
"min",
")",
";",
"return",
"number",
"+",
"min",
";",
"}"
] |
generate a random number between 2 numbers - inclusive
@param min lowest number to generate
@param max max number to generate
@return random number string
|
[
"generate",
"a",
"random",
"number",
"between",
"2",
"numbers",
"-",
"inclusive"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultNumber.java#L83-L86
|
154,420
|
BeholderTAF/beholder-selenium
|
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/listener/ScreenshotListener.java
|
ScreenshotListener.getDateSuffix
|
private String getDateSuffix() {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH); // 0 to 11
int day = cal.get(Calendar.DAY_OF_MONTH);
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
int second = cal.get(Calendar.SECOND);
return String.format("-%4d-%02d-%02d_%02dh%02dm%02ds", year,
(month + 1), day, hour, minute, second);
}
|
java
|
private String getDateSuffix() {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH); // 0 to 11
int day = cal.get(Calendar.DAY_OF_MONTH);
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
int second = cal.get(Calendar.SECOND);
return String.format("-%4d-%02d-%02d_%02dh%02dm%02ds", year,
(month + 1), day, hour, minute, second);
}
|
[
"private",
"String",
"getDateSuffix",
"(",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"int",
"year",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
";",
"int",
"month",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
";",
"// 0 to 11",
"int",
"day",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
")",
";",
"int",
"hour",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
";",
"int",
"minute",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
";",
"int",
"second",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
";",
"return",
"String",
".",
"format",
"(",
"\"-%4d-%02d-%02d_%02dh%02dm%02ds\"",
",",
"year",
",",
"(",
"month",
"+",
"1",
")",
",",
"day",
",",
"hour",
",",
"minute",
",",
"second",
")",
";",
"}"
] |
Returns a date suffix string
@return String
|
[
"Returns",
"a",
"date",
"suffix",
"string"
] |
8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee
|
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/listener/ScreenshotListener.java#L86-L98
|
154,421
|
BeholderTAF/beholder-selenium
|
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/listener/ScreenshotListener.java
|
ScreenshotListener.createFolder
|
private File createFolder(ITestResult tr) throws IOException{
String path = ListenerGateway.getParameter(SCREENSHOT_FOLDER);
if (path == null || path.isEmpty()) {
path = "." + File.separatorChar + "screenshots";
}
if(tr != null) {
path += File.separatorChar + tr.getMethod().getTestClass().getName();
}
File screenshotFolder = new File(path);
if (!screenshotFolder.exists() && !screenshotFolder.mkdirs()){
throw new IOException(ErrorMessages.ERROR_FOLDER_CANNOT_BE_CREATED);
}
return screenshotFolder;
}
|
java
|
private File createFolder(ITestResult tr) throws IOException{
String path = ListenerGateway.getParameter(SCREENSHOT_FOLDER);
if (path == null || path.isEmpty()) {
path = "." + File.separatorChar + "screenshots";
}
if(tr != null) {
path += File.separatorChar + tr.getMethod().getTestClass().getName();
}
File screenshotFolder = new File(path);
if (!screenshotFolder.exists() && !screenshotFolder.mkdirs()){
throw new IOException(ErrorMessages.ERROR_FOLDER_CANNOT_BE_CREATED);
}
return screenshotFolder;
}
|
[
"private",
"File",
"createFolder",
"(",
"ITestResult",
"tr",
")",
"throws",
"IOException",
"{",
"String",
"path",
"=",
"ListenerGateway",
".",
"getParameter",
"(",
"SCREENSHOT_FOLDER",
")",
";",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"path",
"=",
"\".\"",
"+",
"File",
".",
"separatorChar",
"+",
"\"screenshots\"",
";",
"}",
"if",
"(",
"tr",
"!=",
"null",
")",
"{",
"path",
"+=",
"File",
".",
"separatorChar",
"+",
"tr",
".",
"getMethod",
"(",
")",
".",
"getTestClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"File",
"screenshotFolder",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"!",
"screenshotFolder",
".",
"exists",
"(",
")",
"&&",
"!",
"screenshotFolder",
".",
"mkdirs",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"ErrorMessages",
".",
"ERROR_FOLDER_CANNOT_BE_CREATED",
")",
";",
"}",
"return",
"screenshotFolder",
";",
"}"
] |
Generate, if it doesn't exist, the folder for screenshots taken. The user can pass this information by parameter in the
testng.xml. If it's not passed this information, the folder is created in the current location with the name 'screenshots'.
@param tr Test Result
@return Screenshot Folder
@throws IOException
|
[
"Generate",
"if",
"it",
"doesn",
"t",
"exist",
"the",
"folder",
"for",
"screenshots",
"taken",
".",
"The",
"user",
"can",
"pass",
"this",
"information",
"by",
"parameter",
"in",
"the",
"testng",
".",
"xml",
".",
"If",
"it",
"s",
"not",
"passed",
"this",
"information",
"the",
"folder",
"is",
"created",
"in",
"the",
"current",
"location",
"with",
"the",
"name",
"screenshots",
"."
] |
8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee
|
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/listener/ScreenshotListener.java#L107-L125
|
154,422
|
BeholderTAF/beholder-selenium
|
src/main/java/br/ufmg/dcc/saotome/beholder/selenium/listener/ScreenshotListener.java
|
ScreenshotListener.createFile
|
private File createFile(ITestResult tr, File parentFolder) {
String path;
if (tr != null) { // tr is null only on tests purpose
path = String.format("%s%c%s.png", parentFolder.getAbsolutePath(), File.separatorChar, tr.getName(), getDateSuffix());
} else {
path = String.format("%s%ctest_%d.png", parentFolder.getAbsolutePath(), File.separatorChar, System.currentTimeMillis());
}
return new File(path);
}
|
java
|
private File createFile(ITestResult tr, File parentFolder) {
String path;
if (tr != null) { // tr is null only on tests purpose
path = String.format("%s%c%s.png", parentFolder.getAbsolutePath(), File.separatorChar, tr.getName(), getDateSuffix());
} else {
path = String.format("%s%ctest_%d.png", parentFolder.getAbsolutePath(), File.separatorChar, System.currentTimeMillis());
}
return new File(path);
}
|
[
"private",
"File",
"createFile",
"(",
"ITestResult",
"tr",
",",
"File",
"parentFolder",
")",
"{",
"String",
"path",
";",
"if",
"(",
"tr",
"!=",
"null",
")",
"{",
"// tr is null only on tests purpose",
"path",
"=",
"String",
".",
"format",
"(",
"\"%s%c%s.png\"",
",",
"parentFolder",
".",
"getAbsolutePath",
"(",
")",
",",
"File",
".",
"separatorChar",
",",
"tr",
".",
"getName",
"(",
")",
",",
"getDateSuffix",
"(",
")",
")",
";",
"}",
"else",
"{",
"path",
"=",
"String",
".",
"format",
"(",
"\"%s%ctest_%d.png\"",
",",
"parentFolder",
".",
"getAbsolutePath",
"(",
")",
",",
"File",
".",
"separatorChar",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}",
"return",
"new",
"File",
"(",
"path",
")",
";",
"}"
] |
Generate the file to save the screenshot taken.
@param tr Test Result
@param parentFolder Screenshot Folder
@return Screenshot Folder
|
[
"Generate",
"the",
"file",
"to",
"save",
"the",
"screenshot",
"taken",
"."
] |
8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee
|
https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/listener/ScreenshotListener.java#L133-L144
|
154,423
|
OwlPlatform/java-owl-worldmodel
|
src/main/java/com/owlplatform/worldmodel/client/protocol/messages/AttributeAliasMessage.java
|
AttributeAliasMessage.getMessageLength
|
public int getMessageLength() {
// Message type
int messageLength = 1;
// Number of aliases
messageLength += 4;
if (this.aliases != null) {
for (AttributeAlias alias : this.aliases) {
// Alias number, name length
messageLength += 8;
try {
messageLength += alias.attributeName.getBytes("UTF-16BE").length;
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode strings into UTF-16.");
e.printStackTrace();
}
}
}
return messageLength;
}
|
java
|
public int getMessageLength() {
// Message type
int messageLength = 1;
// Number of aliases
messageLength += 4;
if (this.aliases != null) {
for (AttributeAlias alias : this.aliases) {
// Alias number, name length
messageLength += 8;
try {
messageLength += alias.attributeName.getBytes("UTF-16BE").length;
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode strings into UTF-16.");
e.printStackTrace();
}
}
}
return messageLength;
}
|
[
"public",
"int",
"getMessageLength",
"(",
")",
"{",
"// Message type",
"int",
"messageLength",
"=",
"1",
";",
"// Number of aliases",
"messageLength",
"+=",
"4",
";",
"if",
"(",
"this",
".",
"aliases",
"!=",
"null",
")",
"{",
"for",
"(",
"AttributeAlias",
"alias",
":",
"this",
".",
"aliases",
")",
"{",
"// Alias number, name length",
"messageLength",
"+=",
"8",
";",
"try",
"{",
"messageLength",
"+=",
"alias",
".",
"attributeName",
".",
"getBytes",
"(",
"\"UTF-16BE\"",
")",
".",
"length",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Unable to encode strings into UTF-16.\"",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"return",
"messageLength",
";",
"}"
] |
Returns the length of this message as encoded according to the
Client-World Model protocol.
@return the length of the encoded form of this message, in bytes.
|
[
"Returns",
"the",
"length",
"of",
"this",
"message",
"as",
"encoded",
"according",
"to",
"the",
"Client",
"-",
"World",
"Model",
"protocol",
"."
] |
a850e8b930c6e9787c7cad30c0de887858ca563d
|
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/protocol/messages/AttributeAliasMessage.java#L59-L80
|
154,424
|
eostermueller/headlessInTraceClient
|
src/main/java/org/headlessintrace/client/connection/NetworkDataReceiverThread2.java
|
NetworkDataReceiverThread2.removeTraceWriter
|
public void removeTraceWriter(String nameCriteria) {
for(ITraceWriter tw : getTraceWriters()) {
if (LOG.isDebugEnabled()) LOG.debug("Trying to remove a trace writer. Looking for [" + nameCriteria + "] found [" + tw.getName() + "]");
if (tw.getName().equals(nameCriteria))
getTraceWriters().remove(tw);
}
}
|
java
|
public void removeTraceWriter(String nameCriteria) {
for(ITraceWriter tw : getTraceWriters()) {
if (LOG.isDebugEnabled()) LOG.debug("Trying to remove a trace writer. Looking for [" + nameCriteria + "] found [" + tw.getName() + "]");
if (tw.getName().equals(nameCriteria))
getTraceWriters().remove(tw);
}
}
|
[
"public",
"void",
"removeTraceWriter",
"(",
"String",
"nameCriteria",
")",
"{",
"for",
"(",
"ITraceWriter",
"tw",
":",
"getTraceWriters",
"(",
")",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"LOG",
".",
"debug",
"(",
"\"Trying to remove a trace writer. Looking for [\"",
"+",
"nameCriteria",
"+",
"\"] found [\"",
"+",
"tw",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"if",
"(",
"tw",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"nameCriteria",
")",
")",
"getTraceWriters",
"(",
")",
".",
"remove",
"(",
"tw",
")",
";",
"}",
"}"
] |
Remove any trace writers that are writing to the given window name.
@param nameCriteria
|
[
"Remove",
"any",
"trace",
"writers",
"that",
"are",
"writing",
"to",
"the",
"given",
"window",
"name",
"."
] |
50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604
|
https://github.com/eostermueller/headlessInTraceClient/blob/50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604/src/main/java/org/headlessintrace/client/connection/NetworkDataReceiverThread2.java#L60-L66
|
154,425
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.read
|
public static final String read(ReadableByteChannel ch, int length, Charset charset) throws IOException
{
return new String(read(ch, length), charset);
}
|
java
|
public static final String read(ReadableByteChannel ch, int length, Charset charset) throws IOException
{
return new String(read(ch, length), charset);
}
|
[
"public",
"static",
"final",
"String",
"read",
"(",
"ReadableByteChannel",
"ch",
",",
"int",
"length",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"new",
"String",
"(",
"read",
"(",
"ch",
",",
"length",
")",
",",
"charset",
")",
";",
"}"
] |
Read length bytes from channel and constructs a String using given charset.
Throws EOFException if couldn't read length bytes because of eof.
@param ch
@param length
@param charset
@return
@throws IOException
|
[
"Read",
"length",
"bytes",
"from",
"channel",
"and",
"constructs",
"a",
"String",
"using",
"given",
"charset",
".",
"Throws",
"EOFException",
"if",
"couldn",
"t",
"read",
"length",
"bytes",
"because",
"of",
"eof",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L53-L56
|
154,426
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.read
|
public static final byte[] read(ReadableByteChannel ch, int length) throws IOException
{
ByteBuffer bb = ByteBuffer.allocate(length);
readAll(ch, bb);
if (bb.hasRemaining())
{
throw new EOFException("couldn't read "+length+" bytes");
}
return bb.array();
}
|
java
|
public static final byte[] read(ReadableByteChannel ch, int length) throws IOException
{
ByteBuffer bb = ByteBuffer.allocate(length);
readAll(ch, bb);
if (bb.hasRemaining())
{
throw new EOFException("couldn't read "+length+" bytes");
}
return bb.array();
}
|
[
"public",
"static",
"final",
"byte",
"[",
"]",
"read",
"(",
"ReadableByteChannel",
"ch",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"length",
")",
";",
"readAll",
"(",
"ch",
",",
"bb",
")",
";",
"if",
"(",
"bb",
".",
"hasRemaining",
"(",
")",
")",
"{",
"throw",
"new",
"EOFException",
"(",
"\"couldn't read \"",
"+",
"length",
"+",
"\" bytes\"",
")",
";",
"}",
"return",
"bb",
".",
"array",
"(",
")",
";",
"}"
] |
Read length bytes from channel.
Throws EOFException if couldn't read length bytes because of eof.
@param ch
@param length
@return
@throws IOException
|
[
"Read",
"length",
"bytes",
"from",
"channel",
".",
"Throws",
"EOFException",
"if",
"couldn",
"t",
"read",
"length",
"bytes",
"because",
"of",
"eof",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L65-L74
|
154,427
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.write
|
public static final void write(WritableByteChannel ch, String text, Charset charset) throws IOException
{
write(ch, text.getBytes(charset));
}
|
java
|
public static final void write(WritableByteChannel ch, String text, Charset charset) throws IOException
{
write(ch, text.getBytes(charset));
}
|
[
"public",
"static",
"final",
"void",
"write",
"(",
"WritableByteChannel",
"ch",
",",
"String",
"text",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"write",
"(",
"ch",
",",
"text",
".",
"getBytes",
"(",
"charset",
")",
")",
";",
"}"
] |
Writes string bytes to channel using charset.
@param ch
@param text
@param charset
@throws IOException
|
[
"Writes",
"string",
"bytes",
"to",
"channel",
"using",
"charset",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L82-L85
|
154,428
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.write
|
public static final void write(WritableByteChannel ch, byte[] bytes) throws IOException
{
write(ch, bytes, 0, bytes.length);
}
|
java
|
public static final void write(WritableByteChannel ch, byte[] bytes) throws IOException
{
write(ch, bytes, 0, bytes.length);
}
|
[
"public",
"static",
"final",
"void",
"write",
"(",
"WritableByteChannel",
"ch",
",",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"write",
"(",
"ch",
",",
"bytes",
",",
"0",
",",
"bytes",
".",
"length",
")",
";",
"}"
] |
Writes bytes to channel
@param ch
@param bytes
@throws IOException
|
[
"Writes",
"bytes",
"to",
"channel"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L92-L95
|
154,429
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.write
|
public static final void write(WritableByteChannel ch, byte[] bytes, int offset, int length) throws IOException
{
ByteBuffer bb = ByteBuffer.allocate(length);
bb.put(bytes, offset, length);
bb.flip();
writeAll(ch, bb);
}
|
java
|
public static final void write(WritableByteChannel ch, byte[] bytes, int offset, int length) throws IOException
{
ByteBuffer bb = ByteBuffer.allocate(length);
bb.put(bytes, offset, length);
bb.flip();
writeAll(ch, bb);
}
|
[
"public",
"static",
"final",
"void",
"write",
"(",
"WritableByteChannel",
"ch",
",",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"length",
")",
";",
"bb",
".",
"put",
"(",
"bytes",
",",
"offset",
",",
"length",
")",
";",
"bb",
".",
"flip",
"(",
")",
";",
"writeAll",
"(",
"ch",
",",
"bb",
")",
";",
"}"
] |
Writes length bytes to channel starting at offset
@param ch
@param bytes
@param offset
@param length
@throws IOException
|
[
"Writes",
"length",
"bytes",
"to",
"channel",
"starting",
"at",
"offset"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L104-L110
|
154,430
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.readAll
|
public static final int readAll(ReadableByteChannel ch, ByteBuffer dst) throws IOException
{
int count = 0;
while (dst.hasRemaining())
{
int rc = ch.read(dst);
if (rc == -1)
{
if (count > 0)
{
return count;
}
return -1;
}
count += rc;
}
return count;
}
|
java
|
public static final int readAll(ReadableByteChannel ch, ByteBuffer dst) throws IOException
{
int count = 0;
while (dst.hasRemaining())
{
int rc = ch.read(dst);
if (rc == -1)
{
if (count > 0)
{
return count;
}
return -1;
}
count += rc;
}
return count;
}
|
[
"public",
"static",
"final",
"int",
"readAll",
"(",
"ReadableByteChannel",
"ch",
",",
"ByteBuffer",
"dst",
")",
"throws",
"IOException",
"{",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"dst",
".",
"hasRemaining",
"(",
")",
")",
"{",
"int",
"rc",
"=",
"ch",
".",
"read",
"(",
"dst",
")",
";",
"if",
"(",
"rc",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"count",
">",
"0",
")",
"{",
"return",
"count",
";",
"}",
"return",
"-",
"1",
";",
"}",
"count",
"+=",
"rc",
";",
"}",
"return",
"count",
";",
"}"
] |
Read channel until dst has remaining or eof.
@param ch
@param dst
@return Returns number of bytes or -1 if no bytes were read and eof reached.
@throws IOException
|
[
"Read",
"channel",
"until",
"dst",
"has",
"remaining",
"or",
"eof",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L118-L135
|
154,431
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.align
|
public static final void align(SeekableByteChannel ch, long align) throws IOException
{
ch.position(alignedPosition(ch, align));
}
|
java
|
public static final void align(SeekableByteChannel ch, long align) throws IOException
{
ch.position(alignedPosition(ch, align));
}
|
[
"public",
"static",
"final",
"void",
"align",
"(",
"SeekableByteChannel",
"ch",
",",
"long",
"align",
")",
"throws",
"IOException",
"{",
"ch",
".",
"position",
"(",
"alignedPosition",
"(",
"ch",
",",
"align",
")",
")",
";",
"}"
] |
Increments position so that position mod align == 0
@param ch
@param align
@throws IOException
|
[
"Increments",
"position",
"so",
"that",
"position",
"mod",
"align",
"==",
"0"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L142-L145
|
154,432
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.alignedPosition
|
public static final long alignedPosition(SeekableByteChannel ch, long align) throws IOException
{
long position = ch.position();
long mod = position % align;
if (mod > 0)
{
return position + align - mod;
}
else
{
return position;
}
}
|
java
|
public static final long alignedPosition(SeekableByteChannel ch, long align) throws IOException
{
long position = ch.position();
long mod = position % align;
if (mod > 0)
{
return position + align - mod;
}
else
{
return position;
}
}
|
[
"public",
"static",
"final",
"long",
"alignedPosition",
"(",
"SeekableByteChannel",
"ch",
",",
"long",
"align",
")",
"throws",
"IOException",
"{",
"long",
"position",
"=",
"ch",
".",
"position",
"(",
")",
";",
"long",
"mod",
"=",
"position",
"%",
"align",
";",
"if",
"(",
"mod",
">",
"0",
")",
"{",
"return",
"position",
"+",
"align",
"-",
"mod",
";",
"}",
"else",
"{",
"return",
"position",
";",
"}",
"}"
] |
Returns Incremented position so that position mod align == 0, but doesn't
change channels position.
@param ch
@param align
@return
@throws IOException
|
[
"Returns",
"Incremented",
"position",
"so",
"that",
"position",
"mod",
"align",
"==",
"0",
"but",
"doesn",
"t",
"change",
"channels",
"position",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L154-L166
|
154,433
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.skip
|
public static final void skip(SeekableByteChannel ch, long skip) throws IOException
{
ch.position(ch.position() + skip);
}
|
java
|
public static final void skip(SeekableByteChannel ch, long skip) throws IOException
{
ch.position(ch.position() + skip);
}
|
[
"public",
"static",
"final",
"void",
"skip",
"(",
"SeekableByteChannel",
"ch",
",",
"long",
"skip",
")",
"throws",
"IOException",
"{",
"ch",
".",
"position",
"(",
"ch",
".",
"position",
"(",
")",
"+",
"skip",
")",
";",
"}"
] |
Adds skip to position.
@param ch
@param skip
@throws IOException
|
[
"Adds",
"skip",
"to",
"position",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L173-L176
|
154,434
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.writeAll
|
public static void writeAll(GatheringByteChannel ch, ByteBuffer[] bbs, int offset, int length) throws IOException
{
long all = 0;
for (int ii=0;ii<length;ii++)
{
all += bbs[offset+ii].remaining();
}
int count = 0;
while (all > 0)
{
long rc = ch.write(bbs, offset, length);
if (rc == 0)
{
count++;
}
else
{
all -= rc;
}
if (count > 100)
{
throw new IOException("Couldn't write all.");
}
}
}
|
java
|
public static void writeAll(GatheringByteChannel ch, ByteBuffer[] bbs, int offset, int length) throws IOException
{
long all = 0;
for (int ii=0;ii<length;ii++)
{
all += bbs[offset+ii].remaining();
}
int count = 0;
while (all > 0)
{
long rc = ch.write(bbs, offset, length);
if (rc == 0)
{
count++;
}
else
{
all -= rc;
}
if (count > 100)
{
throw new IOException("Couldn't write all.");
}
}
}
|
[
"public",
"static",
"void",
"writeAll",
"(",
"GatheringByteChannel",
"ch",
",",
"ByteBuffer",
"[",
"]",
"bbs",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"long",
"all",
"=",
"0",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"length",
";",
"ii",
"++",
")",
"{",
"all",
"+=",
"bbs",
"[",
"offset",
"+",
"ii",
"]",
".",
"remaining",
"(",
")",
";",
"}",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"all",
">",
"0",
")",
"{",
"long",
"rc",
"=",
"ch",
".",
"write",
"(",
"bbs",
",",
"offset",
",",
"length",
")",
";",
"if",
"(",
"rc",
"==",
"0",
")",
"{",
"count",
"++",
";",
"}",
"else",
"{",
"all",
"-=",
"rc",
";",
"}",
"if",
"(",
"count",
">",
"100",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Couldn't write all.\"",
")",
";",
"}",
"}",
"}"
] |
Attempts to write all remaining data in bbs.
@param ch Target
@param bbs
@param offset
@param length
@throws IOException If couldn't write all.
|
[
"Attempts",
"to",
"write",
"all",
"remaining",
"data",
"in",
"bbs",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L277-L301
|
154,435
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
|
ChannelHelper.writeAll
|
public static void writeAll(WritableByteChannel ch, ByteBuffer bb) throws IOException
{
int count = 0;
while (bb.hasRemaining())
{
int rc = ch.write(bb);
if (rc == 0)
{
count++;
}
if (count > 100)
{
throw new IOException("Couldn't write all.");
}
}
}
|
java
|
public static void writeAll(WritableByteChannel ch, ByteBuffer bb) throws IOException
{
int count = 0;
while (bb.hasRemaining())
{
int rc = ch.write(bb);
if (rc == 0)
{
count++;
}
if (count > 100)
{
throw new IOException("Couldn't write all.");
}
}
}
|
[
"public",
"static",
"void",
"writeAll",
"(",
"WritableByteChannel",
"ch",
",",
"ByteBuffer",
"bb",
")",
"throws",
"IOException",
"{",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"bb",
".",
"hasRemaining",
"(",
")",
")",
"{",
"int",
"rc",
"=",
"ch",
".",
"write",
"(",
"bb",
")",
";",
"if",
"(",
"rc",
"==",
"0",
")",
"{",
"count",
"++",
";",
"}",
"if",
"(",
"count",
">",
"100",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Couldn't write all.\"",
")",
";",
"}",
"}",
"}"
] |
Writes to ch until no remaining left or throws IOException
@param ch
@param bb
@throws IOException
|
[
"Writes",
"to",
"ch",
"until",
"no",
"remaining",
"left",
"or",
"throws",
"IOException"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L308-L323
|
154,436
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java
|
JGridScreen.isFocusTarget
|
public boolean isFocusTarget(int col)
{
if (this.getGridModel() != null)
if (this.getGridModel().getColumnClass(col) == String.class)
return true;
return false;
}
|
java
|
public boolean isFocusTarget(int col)
{
if (this.getGridModel() != null)
if (this.getGridModel().getColumnClass(col) == String.class)
return true;
return false;
}
|
[
"public",
"boolean",
"isFocusTarget",
"(",
"int",
"col",
")",
"{",
"if",
"(",
"this",
".",
"getGridModel",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getGridModel",
"(",
")",
".",
"getColumnClass",
"(",
"col",
")",
"==",
"String",
".",
"class",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
Is this control a focus target?
|
[
"Is",
"this",
"control",
"a",
"focus",
"target?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java#L124-L130
|
154,437
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java
|
JGridScreen.repaintCurrentRow
|
public void repaintCurrentRow()
{
m_jTableScreen.removeEditor(); // This is needed to make sure editors for the delete button are removed.
int iRow = m_jTableScreen.getSelectedRow();
int iColumn = m_jTableScreen.getColumnCount() - 1;
Rectangle rect = m_jTableScreen.getCellRect(iRow, iColumn, false);
rect.width = rect.width + rect.x;
rect.x = 0;
m_jTableScreen.repaint(rect);
}
|
java
|
public void repaintCurrentRow()
{
m_jTableScreen.removeEditor(); // This is needed to make sure editors for the delete button are removed.
int iRow = m_jTableScreen.getSelectedRow();
int iColumn = m_jTableScreen.getColumnCount() - 1;
Rectangle rect = m_jTableScreen.getCellRect(iRow, iColumn, false);
rect.width = rect.width + rect.x;
rect.x = 0;
m_jTableScreen.repaint(rect);
}
|
[
"public",
"void",
"repaintCurrentRow",
"(",
")",
"{",
"m_jTableScreen",
".",
"removeEditor",
"(",
")",
";",
"// This is needed to make sure editors for the delete button are removed.",
"int",
"iRow",
"=",
"m_jTableScreen",
".",
"getSelectedRow",
"(",
")",
";",
"int",
"iColumn",
"=",
"m_jTableScreen",
".",
"getColumnCount",
"(",
")",
"-",
"1",
";",
"Rectangle",
"rect",
"=",
"m_jTableScreen",
".",
"getCellRect",
"(",
"iRow",
",",
"iColumn",
",",
"false",
")",
";",
"rect",
".",
"width",
"=",
"rect",
".",
"width",
"+",
"rect",
".",
"x",
";",
"rect",
".",
"x",
"=",
"0",
";",
"m_jTableScreen",
".",
"repaint",
"(",
"rect",
")",
";",
"}"
] |
Repaint the current row.
|
[
"Repaint",
"the",
"current",
"row",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java#L251-L260
|
154,438
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java
|
JGridScreen.makeSelectedRowCurrent
|
public FieldList makeSelectedRowCurrent()
{
FieldList record = null;
int iRow = m_jTableScreen.getSelectedRow();
if (iRow != -1)
record = m_thinTableModel.makeRowCurrent(iRow, false);
if (record == null)
{
record = this.getFieldList();
try {
record.getTable().addNew();
} catch (DBException ex) {
ex.printStackTrace(); // Never.
}
}
return record;
}
|
java
|
public FieldList makeSelectedRowCurrent()
{
FieldList record = null;
int iRow = m_jTableScreen.getSelectedRow();
if (iRow != -1)
record = m_thinTableModel.makeRowCurrent(iRow, false);
if (record == null)
{
record = this.getFieldList();
try {
record.getTable().addNew();
} catch (DBException ex) {
ex.printStackTrace(); // Never.
}
}
return record;
}
|
[
"public",
"FieldList",
"makeSelectedRowCurrent",
"(",
")",
"{",
"FieldList",
"record",
"=",
"null",
";",
"int",
"iRow",
"=",
"m_jTableScreen",
".",
"getSelectedRow",
"(",
")",
";",
"if",
"(",
"iRow",
"!=",
"-",
"1",
")",
"record",
"=",
"m_thinTableModel",
".",
"makeRowCurrent",
"(",
"iRow",
",",
"false",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"{",
"record",
"=",
"this",
".",
"getFieldList",
"(",
")",
";",
"try",
"{",
"record",
".",
"getTable",
"(",
")",
".",
"addNew",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"// Never.",
"}",
"}",
"return",
"record",
";",
"}"
] |
Make the currently selected row current, or create a newrecord is no current selection.
@return The fieldlist with the currently selected record or a new record.
|
[
"Make",
"the",
"currently",
"selected",
"row",
"current",
"or",
"create",
"a",
"newrecord",
"is",
"no",
"current",
"selection",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java#L265-L281
|
154,439
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java
|
JGridScreen.columnSelectionChanged
|
public void columnSelectionChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
int iColumn = m_jTableScreen.getSelectedColumn();
if (iColumn != -1)
if (m_thinTableModel != null) // In case this was freed before I got the message
{
Convert converter = m_thinTableModel.getFieldInfo(iColumn);
BaseApplet baseApplet = this.getBaseApplet();
if (baseApplet != null)
{
if (converter instanceof FieldInfo)
baseApplet.setStatusText(((FieldInfo)converter).getFieldTip());
else
{
TableColumnModel columnModel = m_jTableScreen.getTableHeader().getColumnModel();
TableColumn tableColumn = columnModel.getColumn(iColumn);
TableCellEditor editor = tableColumn.getCellEditor();
String strTip = null;
if (editor instanceof JComponent)
{
String strName = ((JComponent)editor).getName();
if (strName != null)
{
strName += Constants.TIP;
strTip = baseApplet.getString(strName);
if (strTip == strName)
strTip = baseApplet.getString(((JComponent)editor).getName());
}
}
baseApplet.setStatusText(strTip);
}
String strLastError = baseApplet.getLastError(0);
if ((strLastError != null) && (strLastError.length() > 0))
baseApplet.setStatusText(strLastError);
}
}
}
}
|
java
|
public void columnSelectionChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
int iColumn = m_jTableScreen.getSelectedColumn();
if (iColumn != -1)
if (m_thinTableModel != null) // In case this was freed before I got the message
{
Convert converter = m_thinTableModel.getFieldInfo(iColumn);
BaseApplet baseApplet = this.getBaseApplet();
if (baseApplet != null)
{
if (converter instanceof FieldInfo)
baseApplet.setStatusText(((FieldInfo)converter).getFieldTip());
else
{
TableColumnModel columnModel = m_jTableScreen.getTableHeader().getColumnModel();
TableColumn tableColumn = columnModel.getColumn(iColumn);
TableCellEditor editor = tableColumn.getCellEditor();
String strTip = null;
if (editor instanceof JComponent)
{
String strName = ((JComponent)editor).getName();
if (strName != null)
{
strName += Constants.TIP;
strTip = baseApplet.getString(strName);
if (strTip == strName)
strTip = baseApplet.getString(((JComponent)editor).getName());
}
}
baseApplet.setStatusText(strTip);
}
String strLastError = baseApplet.getLastError(0);
if ((strLastError != null) && (strLastError.length() > 0))
baseApplet.setStatusText(strLastError);
}
}
}
}
|
[
"public",
"void",
"columnSelectionChanged",
"(",
"ListSelectionEvent",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"getValueIsAdjusting",
"(",
")",
")",
"{",
"int",
"iColumn",
"=",
"m_jTableScreen",
".",
"getSelectedColumn",
"(",
")",
";",
"if",
"(",
"iColumn",
"!=",
"-",
"1",
")",
"if",
"(",
"m_thinTableModel",
"!=",
"null",
")",
"// In case this was freed before I got the message",
"{",
"Convert",
"converter",
"=",
"m_thinTableModel",
".",
"getFieldInfo",
"(",
"iColumn",
")",
";",
"BaseApplet",
"baseApplet",
"=",
"this",
".",
"getBaseApplet",
"(",
")",
";",
"if",
"(",
"baseApplet",
"!=",
"null",
")",
"{",
"if",
"(",
"converter",
"instanceof",
"FieldInfo",
")",
"baseApplet",
".",
"setStatusText",
"(",
"(",
"(",
"FieldInfo",
")",
"converter",
")",
".",
"getFieldTip",
"(",
")",
")",
";",
"else",
"{",
"TableColumnModel",
"columnModel",
"=",
"m_jTableScreen",
".",
"getTableHeader",
"(",
")",
".",
"getColumnModel",
"(",
")",
";",
"TableColumn",
"tableColumn",
"=",
"columnModel",
".",
"getColumn",
"(",
"iColumn",
")",
";",
"TableCellEditor",
"editor",
"=",
"tableColumn",
".",
"getCellEditor",
"(",
")",
";",
"String",
"strTip",
"=",
"null",
";",
"if",
"(",
"editor",
"instanceof",
"JComponent",
")",
"{",
"String",
"strName",
"=",
"(",
"(",
"JComponent",
")",
"editor",
")",
".",
"getName",
"(",
")",
";",
"if",
"(",
"strName",
"!=",
"null",
")",
"{",
"strName",
"+=",
"Constants",
".",
"TIP",
";",
"strTip",
"=",
"baseApplet",
".",
"getString",
"(",
"strName",
")",
";",
"if",
"(",
"strTip",
"==",
"strName",
")",
"strTip",
"=",
"baseApplet",
".",
"getString",
"(",
"(",
"(",
"JComponent",
")",
"editor",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"baseApplet",
".",
"setStatusText",
"(",
"strTip",
")",
";",
"}",
"String",
"strLastError",
"=",
"baseApplet",
".",
"getLastError",
"(",
"0",
")",
";",
"if",
"(",
"(",
"strLastError",
"!=",
"null",
")",
"&&",
"(",
"strLastError",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"baseApplet",
".",
"setStatusText",
"(",
"strLastError",
")",
";",
"}",
"}",
"}",
"}"
] |
The column selection changed - display the correct tooltip.
@param e The listselection event.
|
[
"The",
"column",
"selection",
"changed",
"-",
"display",
"the",
"correct",
"tooltip",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JGridScreen.java#L335-L374
|
154,440
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java
|
XslImportScanListener.scanTemplates
|
public void scanTemplates(LineNumberReader reader)
{
try {
String string;
boolean bTemplate = false;
while ((string = reader.readLine()) != null)
{
if (string.indexOf("<xsl:template ") != -1)
bTemplate = true;
if (bTemplate)
{
int iStart = string.indexOf("match=\"") + 7;
int iEnd = string.indexOf('\"', iStart);
if (iStart != 6)
if (iEnd != -1)
{
String strMatch = string.substring(iStart, iEnd);
this.addMatch(strMatch, false);
}
iStart = string.indexOf("name=\"") + 6;
iEnd = string.indexOf('\"', iStart);
if (iStart != 5)
if (iEnd != -1)
{
String strName = string.substring(iStart, iEnd);
this.addName(strName, false);
}
}
if (string.indexOf(">") != -1)
bTemplate = false;
}
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
|
java
|
public void scanTemplates(LineNumberReader reader)
{
try {
String string;
boolean bTemplate = false;
while ((string = reader.readLine()) != null)
{
if (string.indexOf("<xsl:template ") != -1)
bTemplate = true;
if (bTemplate)
{
int iStart = string.indexOf("match=\"") + 7;
int iEnd = string.indexOf('\"', iStart);
if (iStart != 6)
if (iEnd != -1)
{
String strMatch = string.substring(iStart, iEnd);
this.addMatch(strMatch, false);
}
iStart = string.indexOf("name=\"") + 6;
iEnd = string.indexOf('\"', iStart);
if (iStart != 5)
if (iEnd != -1)
{
String strName = string.substring(iStart, iEnd);
this.addName(strName, false);
}
}
if (string.indexOf(">") != -1)
bTemplate = false;
}
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
|
[
"public",
"void",
"scanTemplates",
"(",
"LineNumberReader",
"reader",
")",
"{",
"try",
"{",
"String",
"string",
";",
"boolean",
"bTemplate",
"=",
"false",
";",
"while",
"(",
"(",
"string",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"string",
".",
"indexOf",
"(",
"\"<xsl:template \"",
")",
"!=",
"-",
"1",
")",
"bTemplate",
"=",
"true",
";",
"if",
"(",
"bTemplate",
")",
"{",
"int",
"iStart",
"=",
"string",
".",
"indexOf",
"(",
"\"match=\\\"\"",
")",
"+",
"7",
";",
"int",
"iEnd",
"=",
"string",
".",
"indexOf",
"(",
"'",
"'",
",",
"iStart",
")",
";",
"if",
"(",
"iStart",
"!=",
"6",
")",
"if",
"(",
"iEnd",
"!=",
"-",
"1",
")",
"{",
"String",
"strMatch",
"=",
"string",
".",
"substring",
"(",
"iStart",
",",
"iEnd",
")",
";",
"this",
".",
"addMatch",
"(",
"strMatch",
",",
"false",
")",
";",
"}",
"iStart",
"=",
"string",
".",
"indexOf",
"(",
"\"name=\\\"\"",
")",
"+",
"6",
";",
"iEnd",
"=",
"string",
".",
"indexOf",
"(",
"'",
"'",
",",
"iStart",
")",
";",
"if",
"(",
"iStart",
"!=",
"5",
")",
"if",
"(",
"iEnd",
"!=",
"-",
"1",
")",
"{",
"String",
"strName",
"=",
"string",
".",
"substring",
"(",
"iStart",
",",
"iEnd",
")",
";",
"this",
".",
"addName",
"(",
"strName",
",",
"false",
")",
";",
"}",
"}",
"if",
"(",
"string",
".",
"indexOf",
"(",
"\">\"",
")",
"!=",
"-",
"1",
")",
"bTemplate",
"=",
"false",
";",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
ScanTemplates Method.
|
[
"ScanTemplates",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java#L84-L120
|
154,441
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java
|
XslImportScanListener.addMatch
|
public void addMatch(String strMatch, boolean bAddAll)
{
m_setMatches.add(strMatch);
if (bAddAll)
if (m_parent instanceof XslImportScanListener)
((XslImportScanListener)m_parent).addMatch(strMatch, bAddAll); // Make sure no one else adds it
System.out.println("match " + strMatch);
}
|
java
|
public void addMatch(String strMatch, boolean bAddAll)
{
m_setMatches.add(strMatch);
if (bAddAll)
if (m_parent instanceof XslImportScanListener)
((XslImportScanListener)m_parent).addMatch(strMatch, bAddAll); // Make sure no one else adds it
System.out.println("match " + strMatch);
}
|
[
"public",
"void",
"addMatch",
"(",
"String",
"strMatch",
",",
"boolean",
"bAddAll",
")",
"{",
"m_setMatches",
".",
"add",
"(",
"strMatch",
")",
";",
"if",
"(",
"bAddAll",
")",
"if",
"(",
"m_parent",
"instanceof",
"XslImportScanListener",
")",
"(",
"(",
"XslImportScanListener",
")",
"m_parent",
")",
".",
"addMatch",
"(",
"strMatch",
",",
"bAddAll",
")",
";",
"// Make sure no one else adds it",
"System",
".",
"out",
".",
"println",
"(",
"\"match \"",
"+",
"strMatch",
")",
";",
"}"
] |
AddMatch Method.
|
[
"AddMatch",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java#L124-L131
|
154,442
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java
|
XslImportScanListener.addName
|
public void addName(String strName, boolean bAddAll)
{
m_setNames.add(strName);
if (bAddAll)
if (m_parent instanceof XslImportScanListener)
((XslImportScanListener)m_parent).addName(strName, bAddAll); // Make sure no one else adds it
System.out.println("name " + strName);
}
|
java
|
public void addName(String strName, boolean bAddAll)
{
m_setNames.add(strName);
if (bAddAll)
if (m_parent instanceof XslImportScanListener)
((XslImportScanListener)m_parent).addName(strName, bAddAll); // Make sure no one else adds it
System.out.println("name " + strName);
}
|
[
"public",
"void",
"addName",
"(",
"String",
"strName",
",",
"boolean",
"bAddAll",
")",
"{",
"m_setNames",
".",
"add",
"(",
"strName",
")",
";",
"if",
"(",
"bAddAll",
")",
"if",
"(",
"m_parent",
"instanceof",
"XslImportScanListener",
")",
"(",
"(",
"XslImportScanListener",
")",
"m_parent",
")",
".",
"addName",
"(",
"strName",
",",
"bAddAll",
")",
";",
"// Make sure no one else adds it",
"System",
".",
"out",
".",
"println",
"(",
"\"name \"",
"+",
"strName",
")",
";",
"}"
] |
AddName Method.
|
[
"AddName",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java#L135-L142
|
154,443
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java
|
XslImportScanListener.isMatch
|
public boolean isMatch(String strMatch)
{
if (m_setMatches.contains(strMatch))
return true;
if (m_parent instanceof XslImportScanListener)
return ((XslImportScanListener)m_parent).isMatch(strMatch);
return false;
}
|
java
|
public boolean isMatch(String strMatch)
{
if (m_setMatches.contains(strMatch))
return true;
if (m_parent instanceof XslImportScanListener)
return ((XslImportScanListener)m_parent).isMatch(strMatch);
return false;
}
|
[
"public",
"boolean",
"isMatch",
"(",
"String",
"strMatch",
")",
"{",
"if",
"(",
"m_setMatches",
".",
"contains",
"(",
"strMatch",
")",
")",
"return",
"true",
";",
"if",
"(",
"m_parent",
"instanceof",
"XslImportScanListener",
")",
"return",
"(",
"(",
"XslImportScanListener",
")",
"m_parent",
")",
".",
"isMatch",
"(",
"strMatch",
")",
";",
"return",
"false",
";",
"}"
] |
IsMatch Method.
|
[
"IsMatch",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java#L146-L153
|
154,444
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java
|
XslImportScanListener.isName
|
public boolean isName(String strName)
{
if (m_setNames.contains(strName))
return true;
if (m_parent instanceof XslImportScanListener)
return ((XslImportScanListener)m_parent).isName(strName);
return false;
}
|
java
|
public boolean isName(String strName)
{
if (m_setNames.contains(strName))
return true;
if (m_parent instanceof XslImportScanListener)
return ((XslImportScanListener)m_parent).isName(strName);
return false;
}
|
[
"public",
"boolean",
"isName",
"(",
"String",
"strName",
")",
"{",
"if",
"(",
"m_setNames",
".",
"contains",
"(",
"strName",
")",
")",
"return",
"true",
";",
"if",
"(",
"m_parent",
"instanceof",
"XslImportScanListener",
")",
"return",
"(",
"(",
"XslImportScanListener",
")",
"m_parent",
")",
".",
"isName",
"(",
"strName",
")",
";",
"return",
"false",
";",
"}"
] |
IsName Method.
|
[
"IsName",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java#L157-L164
|
154,445
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java
|
XslImportScanListener.writeImport
|
public void writeImport(String strFilename)
{
strFilename = this.getProperty(org.jbundle.app.program.manual.convert.ConvertCode.DIR_PREFIX) + this.getProperty(org.jbundle.app.program.manual.convert.ConvertCode.SOURCE_DIR) + '/' + strFilename;
System.out.println(strFilename);
try {
File fileSource = new File(strFilename);
FileInputStream fileIn = new FileInputStream(fileSource);
InputStreamReader inStream = new InputStreamReader(fileIn);
LineNumberReader reader = new LineNumberReader(inStream);
PrintWriter dataOut = m_writer;
XslImportScanListener listener = new XslImportScanListener(this, m_strSourcePrefix);
listener.setPrintWriter(dataOut);
listener.setSourceFile(fileSource);
Map<String,Object> oldProperties = m_parent.getProperties();
Map<String,Object> newProperties = new HashMap<String,Object>(oldProperties);
m_parent.setProperties(newProperties);
m_parent.setProperty(ROOT_FILE, Boolean.FALSE.toString());
listener.moveSourceToDest(reader, dataOut);
listener.free();
m_parent.setProperties(oldProperties);
reader.close();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
|
java
|
public void writeImport(String strFilename)
{
strFilename = this.getProperty(org.jbundle.app.program.manual.convert.ConvertCode.DIR_PREFIX) + this.getProperty(org.jbundle.app.program.manual.convert.ConvertCode.SOURCE_DIR) + '/' + strFilename;
System.out.println(strFilename);
try {
File fileSource = new File(strFilename);
FileInputStream fileIn = new FileInputStream(fileSource);
InputStreamReader inStream = new InputStreamReader(fileIn);
LineNumberReader reader = new LineNumberReader(inStream);
PrintWriter dataOut = m_writer;
XslImportScanListener listener = new XslImportScanListener(this, m_strSourcePrefix);
listener.setPrintWriter(dataOut);
listener.setSourceFile(fileSource);
Map<String,Object> oldProperties = m_parent.getProperties();
Map<String,Object> newProperties = new HashMap<String,Object>(oldProperties);
m_parent.setProperties(newProperties);
m_parent.setProperty(ROOT_FILE, Boolean.FALSE.toString());
listener.moveSourceToDest(reader, dataOut);
listener.free();
m_parent.setProperties(oldProperties);
reader.close();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
|
[
"public",
"void",
"writeImport",
"(",
"String",
"strFilename",
")",
"{",
"strFilename",
"=",
"this",
".",
"getProperty",
"(",
"org",
".",
"jbundle",
".",
"app",
".",
"program",
".",
"manual",
".",
"convert",
".",
"ConvertCode",
".",
"DIR_PREFIX",
")",
"+",
"this",
".",
"getProperty",
"(",
"org",
".",
"jbundle",
".",
"app",
".",
"program",
".",
"manual",
".",
"convert",
".",
"ConvertCode",
".",
"SOURCE_DIR",
")",
"+",
"'",
"'",
"+",
"strFilename",
";",
"System",
".",
"out",
".",
"println",
"(",
"strFilename",
")",
";",
"try",
"{",
"File",
"fileSource",
"=",
"new",
"File",
"(",
"strFilename",
")",
";",
"FileInputStream",
"fileIn",
"=",
"new",
"FileInputStream",
"(",
"fileSource",
")",
";",
"InputStreamReader",
"inStream",
"=",
"new",
"InputStreamReader",
"(",
"fileIn",
")",
";",
"LineNumberReader",
"reader",
"=",
"new",
"LineNumberReader",
"(",
"inStream",
")",
";",
"PrintWriter",
"dataOut",
"=",
"m_writer",
";",
"XslImportScanListener",
"listener",
"=",
"new",
"XslImportScanListener",
"(",
"this",
",",
"m_strSourcePrefix",
")",
";",
"listener",
".",
"setPrintWriter",
"(",
"dataOut",
")",
";",
"listener",
".",
"setSourceFile",
"(",
"fileSource",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"oldProperties",
"=",
"m_parent",
".",
"getProperties",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"newProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
"oldProperties",
")",
";",
"m_parent",
".",
"setProperties",
"(",
"newProperties",
")",
";",
"m_parent",
".",
"setProperty",
"(",
"ROOT_FILE",
",",
"Boolean",
".",
"FALSE",
".",
"toString",
"(",
")",
")",
";",
"listener",
".",
"moveSourceToDest",
"(",
"reader",
",",
"dataOut",
")",
";",
"listener",
".",
"free",
"(",
")",
";",
"m_parent",
".",
"setProperties",
"(",
"oldProperties",
")",
";",
"reader",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
WriteImport Method.
|
[
"WriteImport",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslImportScanListener.java#L244-L274
|
154,446
|
nofacepress/csv4180
|
src/main/java/com/nofacepress/csv4180/CSVWriter.java
|
CSVWriter.writeField
|
public void writeField(String field) throws IOException {
if (this.newLine) {
this.newLine = false;
} else {
this.write(',');
}
// case 0: empty string, simple :)
if ((field == null) || (field.length() == 0)) {
return;
}
// case 1: field has quotes in it, if so convert to, quote field and
// double all quotes
Matcher matcher = escapePattern.matcher(field);
if (matcher.find()) {
this.write('"');
this.tmpBuffer.setLength(0);
do {
matcher.appendReplacement(this.tmpBuffer, "\"\"");
} while (matcher.find());
matcher.appendTail(this.tmpBuffer);
this.write(this.tmpBuffer.toString());
this.write('"');
return;
}
// case 2: field has a comma, carriage return or new line in it, if so
// quote field and double all quotes
matcher = specialCharsPattern.matcher(field);
if (matcher.find()) {
this.write('"');
this.write(field);
this.write('"');
return;
}
// case 3: safe string to just add
this.append(field);
}
|
java
|
public void writeField(String field) throws IOException {
if (this.newLine) {
this.newLine = false;
} else {
this.write(',');
}
// case 0: empty string, simple :)
if ((field == null) || (field.length() == 0)) {
return;
}
// case 1: field has quotes in it, if so convert to, quote field and
// double all quotes
Matcher matcher = escapePattern.matcher(field);
if (matcher.find()) {
this.write('"');
this.tmpBuffer.setLength(0);
do {
matcher.appendReplacement(this.tmpBuffer, "\"\"");
} while (matcher.find());
matcher.appendTail(this.tmpBuffer);
this.write(this.tmpBuffer.toString());
this.write('"');
return;
}
// case 2: field has a comma, carriage return or new line in it, if so
// quote field and double all quotes
matcher = specialCharsPattern.matcher(field);
if (matcher.find()) {
this.write('"');
this.write(field);
this.write('"');
return;
}
// case 3: safe string to just add
this.append(field);
}
|
[
"public",
"void",
"writeField",
"(",
"String",
"field",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"newLine",
")",
"{",
"this",
".",
"newLine",
"=",
"false",
";",
"}",
"else",
"{",
"this",
".",
"write",
"(",
"'",
"'",
")",
";",
"}",
"// case 0: empty string, simple :)",
"if",
"(",
"(",
"field",
"==",
"null",
")",
"||",
"(",
"field",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
";",
"}",
"// case 1: field has quotes in it, if so convert to, quote field and",
"// double all quotes",
"Matcher",
"matcher",
"=",
"escapePattern",
".",
"matcher",
"(",
"field",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"this",
".",
"write",
"(",
"'",
"'",
")",
";",
"this",
".",
"tmpBuffer",
".",
"setLength",
"(",
"0",
")",
";",
"do",
"{",
"matcher",
".",
"appendReplacement",
"(",
"this",
".",
"tmpBuffer",
",",
"\"\\\"\\\"\"",
")",
";",
"}",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
";",
"matcher",
".",
"appendTail",
"(",
"this",
".",
"tmpBuffer",
")",
";",
"this",
".",
"write",
"(",
"this",
".",
"tmpBuffer",
".",
"toString",
"(",
")",
")",
";",
"this",
".",
"write",
"(",
"'",
"'",
")",
";",
"return",
";",
"}",
"// case 2: field has a comma, carriage return or new line in it, if so",
"// quote field and double all quotes",
"matcher",
"=",
"specialCharsPattern",
".",
"matcher",
"(",
"field",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"this",
".",
"write",
"(",
"'",
"'",
")",
";",
"this",
".",
"write",
"(",
"field",
")",
";",
"this",
".",
"write",
"(",
"'",
"'",
")",
";",
"return",
";",
"}",
"// case 3: safe string to just add",
"this",
".",
"append",
"(",
"field",
")",
";",
"}"
] |
Write a field to the output quoting as necessary and adding comma separators
between fields.
@param field String to write
@throws IOException If an I/O error occurs
|
[
"Write",
"a",
"field",
"to",
"the",
"output",
"quoting",
"as",
"necessary",
"and",
"adding",
"comma",
"separators",
"between",
"fields",
"."
] |
c107ff66b0dcbd7fb56773dcc9eebb1756f172e8
|
https://github.com/nofacepress/csv4180/blob/c107ff66b0dcbd7fb56773dcc9eebb1756f172e8/src/main/java/com/nofacepress/csv4180/CSVWriter.java#L113-L153
|
154,447
|
caspervg/SC4D-LEX4J
|
lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java
|
LotRoute.putLotDownloadList
|
public void putLotDownloadList(int id) {
ClientResource resource = new ClientResource(Route.DOWNLOADLIST_LOT.url(id));
resource.setChallengeResponse(this.auth.toChallenge());
resource.get();
}
|
java
|
public void putLotDownloadList(int id) {
ClientResource resource = new ClientResource(Route.DOWNLOADLIST_LOT.url(id));
resource.setChallengeResponse(this.auth.toChallenge());
resource.get();
}
|
[
"public",
"void",
"putLotDownloadList",
"(",
"int",
"id",
")",
"{",
"ClientResource",
"resource",
"=",
"new",
"ClientResource",
"(",
"Route",
".",
"DOWNLOADLIST_LOT",
".",
"url",
"(",
"id",
")",
")",
";",
"resource",
".",
"setChallengeResponse",
"(",
"this",
".",
"auth",
".",
"toChallenge",
"(",
")",
")",
";",
"resource",
".",
"get",
"(",
")",
";",
"}"
] |
Adds a file to the user's download list
@param id : ID of the lot/file
@custom.require Authentication
|
[
"Adds",
"a",
"file",
"to",
"the",
"user",
"s",
"download",
"list"
] |
3d086ec70c817119a88573c2e23af27276cdb1d6
|
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java#L133-L138
|
154,448
|
caspervg/SC4D-LEX4J
|
lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java
|
LotRoute.deleteLotDownloadList
|
public void deleteLotDownloadList(int id) {
ClientResource resource = new ClientResource(Route.DOWNLOADLIST_LOT.url(id));
resource.setChallengeResponse(this.auth.toChallenge());
resource.delete();
}
|
java
|
public void deleteLotDownloadList(int id) {
ClientResource resource = new ClientResource(Route.DOWNLOADLIST_LOT.url(id));
resource.setChallengeResponse(this.auth.toChallenge());
resource.delete();
}
|
[
"public",
"void",
"deleteLotDownloadList",
"(",
"int",
"id",
")",
"{",
"ClientResource",
"resource",
"=",
"new",
"ClientResource",
"(",
"Route",
".",
"DOWNLOADLIST_LOT",
".",
"url",
"(",
"id",
")",
")",
";",
"resource",
".",
"setChallengeResponse",
"(",
"this",
".",
"auth",
".",
"toChallenge",
"(",
")",
")",
";",
"resource",
".",
"delete",
"(",
")",
";",
"}"
] |
Removes a file from the user's download list
@param id : ID of the lot/file
@custom.require Authentication
|
[
"Removes",
"a",
"file",
"from",
"the",
"user",
"s",
"download",
"list"
] |
3d086ec70c817119a88573c2e23af27276cdb1d6
|
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java#L145-L150
|
154,449
|
mbenson/therian
|
core/src/main/java/therian/operator/copy/Copier.java
|
Copier.supports
|
@Override
public boolean supports(TherianContext context, Copy<? extends SOURCE, ? extends TARGET> copy) {
if (context.eval(ImmutableCheck.of(copy.getTargetPosition())).booleanValue() && isRejectImmutable()) {
return false;
}
return TypeUtils.isAssignable(copy.getSourceType().getType(), getSourceBound())
&& TypeUtils.isAssignable(copy.getTargetType().getType(), getTargetBound());
}
|
java
|
@Override
public boolean supports(TherianContext context, Copy<? extends SOURCE, ? extends TARGET> copy) {
if (context.eval(ImmutableCheck.of(copy.getTargetPosition())).booleanValue() && isRejectImmutable()) {
return false;
}
return TypeUtils.isAssignable(copy.getSourceType().getType(), getSourceBound())
&& TypeUtils.isAssignable(copy.getTargetType().getType(), getTargetBound());
}
|
[
"@",
"Override",
"public",
"boolean",
"supports",
"(",
"TherianContext",
"context",
",",
"Copy",
"<",
"?",
"extends",
"SOURCE",
",",
"?",
"extends",
"TARGET",
">",
"copy",
")",
"{",
"if",
"(",
"context",
".",
"eval",
"(",
"ImmutableCheck",
".",
"of",
"(",
"copy",
".",
"getTargetPosition",
"(",
")",
")",
")",
".",
"booleanValue",
"(",
")",
"&&",
"isRejectImmutable",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"TypeUtils",
".",
"isAssignable",
"(",
"copy",
".",
"getSourceType",
"(",
")",
".",
"getType",
"(",
")",
",",
"getSourceBound",
"(",
")",
")",
"&&",
"TypeUtils",
".",
"isAssignable",
"(",
"copy",
".",
"getTargetType",
"(",
")",
".",
"getType",
"(",
")",
",",
"getTargetBound",
"(",
")",
")",
";",
"}"
] |
By default, rejects immutable target positions, and ensures that type parameters are compatible.
@param copy operation
@see ImmutableCheck
|
[
"By",
"default",
"rejects",
"immutable",
"target",
"positions",
"and",
"ensures",
"that",
"type",
"parameters",
"are",
"compatible",
"."
] |
0653505f73e2a6f5b0abc394ea6d83af03408254
|
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/copy/Copier.java#L69-L76
|
154,450
|
fuwjax/ev-oss
|
funco/src/main/java/org/fuwjax/oss/util/io/Files2.java
|
Files2.copy
|
public static void copy(final Path source, final Path dest) throws IOException {
if(Files.exists(source)) {
Files.walkFileTree(source, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
Files.copy(file, resolve(dest, relativize(source, file)));
return super.visitFile(file, attrs);
}
@Override
public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException {
Files.createDirectories(resolve(dest, relativize(source, dir)));
return super.preVisitDirectory(dir, attrs);
}
});
}
}
|
java
|
public static void copy(final Path source, final Path dest) throws IOException {
if(Files.exists(source)) {
Files.walkFileTree(source, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
Files.copy(file, resolve(dest, relativize(source, file)));
return super.visitFile(file, attrs);
}
@Override
public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException {
Files.createDirectories(resolve(dest, relativize(source, dir)));
return super.preVisitDirectory(dir, attrs);
}
});
}
}
|
[
"public",
"static",
"void",
"copy",
"(",
"final",
"Path",
"source",
",",
"final",
"Path",
"dest",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"source",
")",
")",
"{",
"Files",
".",
"walkFileTree",
"(",
"source",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"final",
"Path",
"file",
",",
"final",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"copy",
"(",
"file",
",",
"resolve",
"(",
"dest",
",",
"relativize",
"(",
"source",
",",
"file",
")",
")",
")",
";",
"return",
"super",
".",
"visitFile",
"(",
"file",
",",
"attrs",
")",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"preVisitDirectory",
"(",
"final",
"Path",
"dir",
",",
"final",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"createDirectories",
"(",
"resolve",
"(",
"dest",
",",
"relativize",
"(",
"source",
",",
"dir",
")",
")",
")",
";",
"return",
"super",
".",
"preVisitDirectory",
"(",
"dir",
",",
"attrs",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Copies a source to a destination, works recursively on directories.
@param source the source path
@param dest the destination path
@throws IOException if the source cannot be copied to the destination
|
[
"Copies",
"a",
"source",
"to",
"a",
"destination",
"works",
"recursively",
"on",
"directories",
"."
] |
cbd88592e9b2fa9547c3bdd41e52e790061a2253
|
https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/funco/src/main/java/org/fuwjax/oss/util/io/Files2.java#L36-L52
|
154,451
|
fuwjax/ev-oss
|
funco/src/main/java/org/fuwjax/oss/util/io/Files2.java
|
Files2.delete
|
public static void delete(final Path target) throws IOException {
if(target != null && Files.exists(target)) {
Files.walkFileTree(target, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return super.visitFile(file, attrs);
}
@Override
public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException {
Files.delete(dir);
return super.postVisitDirectory(dir, exc);
}
});
}
}
|
java
|
public static void delete(final Path target) throws IOException {
if(target != null && Files.exists(target)) {
Files.walkFileTree(target, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return super.visitFile(file, attrs);
}
@Override
public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException {
Files.delete(dir);
return super.postVisitDirectory(dir, exc);
}
});
}
}
|
[
"public",
"static",
"void",
"delete",
"(",
"final",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"target",
"!=",
"null",
"&&",
"Files",
".",
"exists",
"(",
"target",
")",
")",
"{",
"Files",
".",
"walkFileTree",
"(",
"target",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"final",
"Path",
"file",
",",
"final",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"file",
")",
";",
"return",
"super",
".",
"visitFile",
"(",
"file",
",",
"attrs",
")",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"final",
"Path",
"dir",
",",
"final",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"dir",
")",
";",
"return",
"super",
".",
"postVisitDirectory",
"(",
"dir",
",",
"exc",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Deletes a path, including directories.
@param target the path to delete
@throws IOException if the path cannot be deleted
|
[
"Deletes",
"a",
"path",
"including",
"directories",
"."
] |
cbd88592e9b2fa9547c3bdd41e52e790061a2253
|
https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/funco/src/main/java/org/fuwjax/oss/util/io/Files2.java#L88-L104
|
154,452
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/RingbufferSupport.java
|
RingbufferSupport.getBuffers
|
public ByteBuffer[] getBuffers(int start, int len)
{
if (len == 0)
{
return ar0;
}
if (len > capacity)
{
throw new IllegalArgumentException("len="+len+" > capacity="+capacity);
}
int s = start % capacity;
int e = (start+len) % capacity;
return getBuffersForSpan(s, e);
}
|
java
|
public ByteBuffer[] getBuffers(int start, int len)
{
if (len == 0)
{
return ar0;
}
if (len > capacity)
{
throw new IllegalArgumentException("len="+len+" > capacity="+capacity);
}
int s = start % capacity;
int e = (start+len) % capacity;
return getBuffersForSpan(s, e);
}
|
[
"public",
"ByteBuffer",
"[",
"]",
"getBuffers",
"(",
"int",
"start",
",",
"int",
"len",
")",
"{",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"ar0",
";",
"}",
"if",
"(",
"len",
">",
"capacity",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"len=\"",
"+",
"len",
"+",
"\" > capacity=\"",
"+",
"capacity",
")",
";",
"}",
"int",
"s",
"=",
"start",
"%",
"capacity",
";",
"int",
"e",
"=",
"(",
"start",
"+",
"len",
")",
"%",
"capacity",
";",
"return",
"getBuffersForSpan",
"(",
"s",
",",
"e",
")",
";",
"}"
] |
Returns array of buffers that contains ringbuffers content in array of
ByteBuffers ready for scattering read of gathering write
@param start
@param len
@return
@see java.nio.channels.ScatteringByteChannel
@see java.nio.channels.GatheringByteChannel
|
[
"Returns",
"array",
"of",
"buffers",
"that",
"contains",
"ringbuffers",
"content",
"in",
"array",
"of",
"ByteBuffers",
"ready",
"for",
"scattering",
"read",
"of",
"gathering",
"write"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/RingbufferSupport.java#L59-L72
|
154,453
|
FitLayout/classify
|
src/main/java/org/fit/layout/classify/taggers/DateTagger.java
|
DateTagger.containsDate
|
private boolean containsDate(String[] strs, int tolerance)
{
dfirst = -1;
dlast = -1;
int lastdw = -999;
int lastnum = -999;
int lastyear = -999;
for (int i = 0; i < strs.length; i++)
{
if (isMonthName(strs[i]))
{
lastdw = i;
if (lastdw - lastnum <= tolerance)
return true;
}
else if (isYear(strs[i]))
{
lastyear = i;
if (lastyear - lastnum <= tolerance)
return true;
}
else if (isNum(strs[i]))
{
lastnum = i;
if (lastnum - lastdw <= tolerance)
return true;
}
}
return false;
}
|
java
|
private boolean containsDate(String[] strs, int tolerance)
{
dfirst = -1;
dlast = -1;
int lastdw = -999;
int lastnum = -999;
int lastyear = -999;
for (int i = 0; i < strs.length; i++)
{
if (isMonthName(strs[i]))
{
lastdw = i;
if (lastdw - lastnum <= tolerance)
return true;
}
else if (isYear(strs[i]))
{
lastyear = i;
if (lastyear - lastnum <= tolerance)
return true;
}
else if (isNum(strs[i]))
{
lastnum = i;
if (lastnum - lastdw <= tolerance)
return true;
}
}
return false;
}
|
[
"private",
"boolean",
"containsDate",
"(",
"String",
"[",
"]",
"strs",
",",
"int",
"tolerance",
")",
"{",
"dfirst",
"=",
"-",
"1",
";",
"dlast",
"=",
"-",
"1",
";",
"int",
"lastdw",
"=",
"-",
"999",
";",
"int",
"lastnum",
"=",
"-",
"999",
";",
"int",
"lastyear",
"=",
"-",
"999",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isMonthName",
"(",
"strs",
"[",
"i",
"]",
")",
")",
"{",
"lastdw",
"=",
"i",
";",
"if",
"(",
"lastdw",
"-",
"lastnum",
"<=",
"tolerance",
")",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"isYear",
"(",
"strs",
"[",
"i",
"]",
")",
")",
"{",
"lastyear",
"=",
"i",
";",
"if",
"(",
"lastyear",
"-",
"lastnum",
"<=",
"tolerance",
")",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"isNum",
"(",
"strs",
"[",
"i",
"]",
")",
")",
"{",
"lastnum",
"=",
"i",
";",
"if",
"(",
"lastnum",
"-",
"lastdw",
"<=",
"tolerance",
")",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Searches for sequences like num,month or month,num or num,year in the string.
@param strs list of words to be examined
@param tolerance maximal distance of the terms
@return <code>true</code> if the words form a date of some kind
|
[
"Searches",
"for",
"sequences",
"like",
"num",
"month",
"or",
"month",
"num",
"or",
"num",
"year",
"in",
"the",
"string",
"."
] |
0b43ceb2f0be4e6d26263491893884d811f0d605
|
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/taggers/DateTagger.java#L315-L344
|
154,454
|
FitLayout/classify
|
src/main/java/org/fit/layout/classify/taggers/DateTagger.java
|
DateTagger.findDate
|
private boolean findDate(String[] strs, int tolerance)
{
dfirst = -1;
dlast = -1;
int curend = -1;
int intpos = -1; //interesting position found (not a simple number)
for (int i = 0; i < strs.length; i++)
{
if (isMonthName(strs[i]) || isYear(strs[i]))
intpos = i;
if (intpos == i || isNum(strs[i]))
{
if (isYear(strs[i]))
intpos = i;
if (curend == -1)
curend = i;
else
{
if (i - curend <= tolerance) //extending the group
curend = i;
else //cannot extend the group
{
if (dlast - dfirst >= 1 && intpos >= dfirst && intpos <= dlast) //suitable group found
return true;
else //no suitable group, try the next one
{
curend = i;
dfirst = i;
dlast = i;
}
}
}
if (dfirst == -1) dfirst = curend;
dlast = curend;
}
}
return (dlast - dfirst >= 1);
}
|
java
|
private boolean findDate(String[] strs, int tolerance)
{
dfirst = -1;
dlast = -1;
int curend = -1;
int intpos = -1; //interesting position found (not a simple number)
for (int i = 0; i < strs.length; i++)
{
if (isMonthName(strs[i]) || isYear(strs[i]))
intpos = i;
if (intpos == i || isNum(strs[i]))
{
if (isYear(strs[i]))
intpos = i;
if (curend == -1)
curend = i;
else
{
if (i - curend <= tolerance) //extending the group
curend = i;
else //cannot extend the group
{
if (dlast - dfirst >= 1 && intpos >= dfirst && intpos <= dlast) //suitable group found
return true;
else //no suitable group, try the next one
{
curend = i;
dfirst = i;
dlast = i;
}
}
}
if (dfirst == -1) dfirst = curend;
dlast = curend;
}
}
return (dlast - dfirst >= 1);
}
|
[
"private",
"boolean",
"findDate",
"(",
"String",
"[",
"]",
"strs",
",",
"int",
"tolerance",
")",
"{",
"dfirst",
"=",
"-",
"1",
";",
"dlast",
"=",
"-",
"1",
";",
"int",
"curend",
"=",
"-",
"1",
";",
"int",
"intpos",
"=",
"-",
"1",
";",
"//interesting position found (not a simple number)",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isMonthName",
"(",
"strs",
"[",
"i",
"]",
")",
"||",
"isYear",
"(",
"strs",
"[",
"i",
"]",
")",
")",
"intpos",
"=",
"i",
";",
"if",
"(",
"intpos",
"==",
"i",
"||",
"isNum",
"(",
"strs",
"[",
"i",
"]",
")",
")",
"{",
"if",
"(",
"isYear",
"(",
"strs",
"[",
"i",
"]",
")",
")",
"intpos",
"=",
"i",
";",
"if",
"(",
"curend",
"==",
"-",
"1",
")",
"curend",
"=",
"i",
";",
"else",
"{",
"if",
"(",
"i",
"-",
"curend",
"<=",
"tolerance",
")",
"//extending the group",
"curend",
"=",
"i",
";",
"else",
"//cannot extend the group",
"{",
"if",
"(",
"dlast",
"-",
"dfirst",
">=",
"1",
"&&",
"intpos",
">=",
"dfirst",
"&&",
"intpos",
"<=",
"dlast",
")",
"//suitable group found",
"return",
"true",
";",
"else",
"//no suitable group, try the next one",
"{",
"curend",
"=",
"i",
";",
"dfirst",
"=",
"i",
";",
"dlast",
"=",
"i",
";",
"}",
"}",
"}",
"if",
"(",
"dfirst",
"==",
"-",
"1",
")",
"dfirst",
"=",
"curend",
";",
"dlast",
"=",
"curend",
";",
"}",
"}",
"return",
"(",
"dlast",
"-",
"dfirst",
">=",
"1",
")",
";",
"}"
] |
Searches for sequences like num,month or month,num or num,year in the string.
If the date is found, the dfirst and dlast properties are set to the indices of the first and last
index of the corresponding words.
@param strs list of words to be examined
@param tolerance maximal distance of the terms
@return <code>true</code> if the words form a date of some kind
|
[
"Searches",
"for",
"sequences",
"like",
"num",
"month",
"or",
"month",
"num",
"or",
"num",
"year",
"in",
"the",
"string",
".",
"If",
"the",
"date",
"is",
"found",
"the",
"dfirst",
"and",
"dlast",
"properties",
"are",
"set",
"to",
"the",
"indices",
"of",
"the",
"first",
"and",
"last",
"index",
"of",
"the",
"corresponding",
"words",
"."
] |
0b43ceb2f0be4e6d26263491893884d811f0d605
|
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/taggers/DateTagger.java#L354-L394
|
154,455
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellButton.java
|
JCellButton.init
|
public void init(Icon icon, String text)
{
this.setText(text);
this.setIcon(icon);
this.setMargin(JScreenConstants.NO_INSETS);
}
|
java
|
public void init(Icon icon, String text)
{
this.setText(text);
this.setIcon(icon);
this.setMargin(JScreenConstants.NO_INSETS);
}
|
[
"public",
"void",
"init",
"(",
"Icon",
"icon",
",",
"String",
"text",
")",
"{",
"this",
".",
"setText",
"(",
"text",
")",
";",
"this",
".",
"setIcon",
"(",
"icon",
")",
";",
"this",
".",
"setMargin",
"(",
"JScreenConstants",
".",
"NO_INSETS",
")",
";",
"}"
] |
Creates new JCellButton. The icon and text are reversed, because of a conflicting method in JButton.
@param text the button text.
@param icon The button icon.
|
[
"Creates",
"new",
"JCellButton",
".",
"The",
"icon",
"and",
"text",
"are",
"reversed",
"because",
"of",
"a",
"conflicting",
"method",
"in",
"JButton",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellButton.java#L82-L87
|
154,456
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellButton.java
|
JCellButton.getTableCellRendererComponent
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
if (value == null)
this.setEnabled(false);
else
this.setEnabled(true);
if (hasFocus)
{
this.setOpaque(false);
this.setBorder(JScreen.m_borderLine);
}
else
{
this.setOpaque(isSelected);
if (isSelected)
this.setBackground(table.getSelectionBackground());
this.setBorder(null);
}
return this;
}
|
java
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
if (value == null)
this.setEnabled(false);
else
this.setEnabled(true);
if (hasFocus)
{
this.setOpaque(false);
this.setBorder(JScreen.m_borderLine);
}
else
{
this.setOpaque(isSelected);
if (isSelected)
this.setBackground(table.getSelectionBackground());
this.setBorder(null);
}
return this;
}
|
[
"public",
"Component",
"getTableCellRendererComponent",
"(",
"JTable",
"table",
",",
"Object",
"value",
",",
"boolean",
"isSelected",
",",
"boolean",
"hasFocus",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"this",
".",
"setEnabled",
"(",
"false",
")",
";",
"else",
"this",
".",
"setEnabled",
"(",
"true",
")",
";",
"if",
"(",
"hasFocus",
")",
"{",
"this",
".",
"setOpaque",
"(",
"false",
")",
";",
"this",
".",
"setBorder",
"(",
"JScreen",
".",
"m_borderLine",
")",
";",
"}",
"else",
"{",
"this",
".",
"setOpaque",
"(",
"isSelected",
")",
";",
"if",
"(",
"isSelected",
")",
"this",
".",
"setBackground",
"(",
"table",
".",
"getSelectionBackground",
"(",
")",
")",
";",
"this",
".",
"setBorder",
"(",
"null",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Get the renderer for this location in the table.
From the TableCellRenderer interface.
@return this.
|
[
"Get",
"the",
"renderer",
"for",
"this",
"location",
"in",
"the",
"table",
".",
"From",
"the",
"TableCellRenderer",
"interface",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellButton.java#L93-L112
|
154,457
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java
|
DynamicByteBuffer.alloc
|
private byte[] alloc() {
position = 0;
chunk++;
if (chunk >= pool.size()) {
byte[] bytes = new byte[chunk == 0 ? initialSize : incrementalSize];
pool.add(bytes);
}
return chunk();
}
|
java
|
private byte[] alloc() {
position = 0;
chunk++;
if (chunk >= pool.size()) {
byte[] bytes = new byte[chunk == 0 ? initialSize : incrementalSize];
pool.add(bytes);
}
return chunk();
}
|
[
"private",
"byte",
"[",
"]",
"alloc",
"(",
")",
"{",
"position",
"=",
"0",
";",
"chunk",
"++",
";",
"if",
"(",
"chunk",
">=",
"pool",
".",
"size",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"chunk",
"==",
"0",
"?",
"initialSize",
":",
"incrementalSize",
"]",
";",
"pool",
".",
"add",
"(",
"bytes",
")",
";",
"}",
"return",
"chunk",
"(",
")",
";",
"}"
] |
Activates the next chunk from the pool, allocating it if necessary.
@return The active chunk.
|
[
"Activates",
"the",
"next",
"chunk",
"from",
"the",
"pool",
"allocating",
"it",
"if",
"necessary",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java#L84-L94
|
154,458
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java
|
DynamicByteBuffer.getByte
|
private byte getByte(int index) {
if (index < initialSize) {
return pool.get(0)[index];
}
index -= initialSize;
return pool.get(index / incrementalSize + 1)[index % incrementalSize];
}
|
java
|
private byte getByte(int index) {
if (index < initialSize) {
return pool.get(0)[index];
}
index -= initialSize;
return pool.get(index / incrementalSize + 1)[index % incrementalSize];
}
|
[
"private",
"byte",
"getByte",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"initialSize",
")",
"{",
"return",
"pool",
".",
"get",
"(",
"0",
")",
"[",
"index",
"]",
";",
"}",
"index",
"-=",
"initialSize",
";",
"return",
"pool",
".",
"get",
"(",
"index",
"/",
"incrementalSize",
"+",
"1",
")",
"[",
"index",
"%",
"incrementalSize",
"]",
";",
"}"
] |
Returns the byte at the specified index. No index validation is performed.
@param index The index.
@return The byte at the specified index.
|
[
"Returns",
"the",
"byte",
"at",
"the",
"specified",
"index",
".",
"No",
"index",
"validation",
"is",
"performed",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java#L136-L143
|
154,459
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java
|
DynamicByteBuffer.put
|
public void put(byte[] bytes, int start, int end) {
byte[] buffer = chunk();
for (int i = start; i < end; i++) {
if (position == buffer.length) {
buffer = alloc();
}
buffer[position++] = bytes[i];
size++;
}
}
|
java
|
public void put(byte[] bytes, int start, int end) {
byte[] buffer = chunk();
for (int i = start; i < end; i++) {
if (position == buffer.length) {
buffer = alloc();
}
buffer[position++] = bytes[i];
size++;
}
}
|
[
"public",
"void",
"put",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"chunk",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"if",
"(",
"position",
"==",
"buffer",
".",
"length",
")",
"{",
"buffer",
"=",
"alloc",
"(",
")",
";",
"}",
"buffer",
"[",
"position",
"++",
"]",
"=",
"bytes",
"[",
"i",
"]",
";",
"size",
"++",
";",
"}",
"}"
] |
Writes a range of bytes from the specified array.
@param bytes Array containing the bytes to be written.
@param start Start of the range (inclusive).
@param end End of the range (exclusive).
|
[
"Writes",
"a",
"range",
"of",
"bytes",
"from",
"the",
"specified",
"array",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java#L172-L183
|
154,460
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java
|
DynamicByteBuffer.toArray
|
public byte[] toArray() {
byte[] result = new byte[size];
int pos = 0;
for (byte[] buffer : pool) {
for (int i = 0; i < buffer.length && pos < size; i++) {
result[pos++] = buffer[i];
}
}
return result;
}
|
java
|
public byte[] toArray() {
byte[] result = new byte[size];
int pos = 0;
for (byte[] buffer : pool) {
for (int i = 0; i < buffer.length && pos < size; i++) {
result[pos++] = buffer[i];
}
}
return result;
}
|
[
"public",
"byte",
"[",
"]",
"toArray",
"(",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"int",
"pos",
"=",
"0",
";",
"for",
"(",
"byte",
"[",
"]",
"buffer",
":",
"pool",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buffer",
".",
"length",
"&&",
"pos",
"<",
"size",
";",
"i",
"++",
")",
"{",
"result",
"[",
"pos",
"++",
"]",
"=",
"buffer",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Returns the current contents of the buffer as a byte array.
@return Buffer contents as a byte array.
|
[
"Returns",
"the",
"current",
"contents",
"of",
"the",
"buffer",
"as",
"a",
"byte",
"array",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java#L190-L201
|
154,461
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java
|
DynamicByteBuffer.toArray
|
public byte[] toArray(int start, int end) {
checkIndex(start);
checkIndex(end);
byte[] result = new byte[start > end ? 0 : end - start];
for (int i = start; i < end; i++) {
result[i] = getByte(i);
}
return result;
}
|
java
|
public byte[] toArray(int start, int end) {
checkIndex(start);
checkIndex(end);
byte[] result = new byte[start > end ? 0 : end - start];
for (int i = start; i < end; i++) {
result[i] = getByte(i);
}
return result;
}
|
[
"public",
"byte",
"[",
"]",
"toArray",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"checkIndex",
"(",
"start",
")",
";",
"checkIndex",
"(",
"end",
")",
";",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"start",
">",
"end",
"?",
"0",
":",
"end",
"-",
"start",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"getByte",
"(",
"i",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns the range of bytes beginning at the start position and exclusive of the end position.
If the start position is greater than or equal to the end position, an empty array is
returned.
@param start Starting position.
@param end Ending position.
@return Byte array.
@exception IndexOutOfBoundsException If an index is out of bounds.
|
[
"Returns",
"the",
"range",
"of",
"bytes",
"beginning",
"at",
"the",
"start",
"position",
"and",
"exclusive",
"of",
"the",
"end",
"position",
".",
"If",
"the",
"start",
"position",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"end",
"position",
"an",
"empty",
"array",
"is",
"returned",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java#L213-L223
|
154,462
|
marssa/footprint
|
src/main/java/org/marssa/footprint/datatypes/decimal/temperature/ATemperature.java
|
ATemperature.getKelvin
|
public MDecimal getKelvin() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(KELVIN)
.convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to Fahrenheit : {}",
currentUnit, result);
return result;
}
|
java
|
public MDecimal getKelvin() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(KELVIN)
.convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to Fahrenheit : {}",
currentUnit, result);
return result;
}
|
[
"public",
"MDecimal",
"getKelvin",
"(",
")",
"{",
"MDecimal",
"result",
"=",
"new",
"MDecimal",
"(",
"currentUnit",
".",
"getConverterTo",
"(",
"KELVIN",
")",
".",
"convert",
"(",
"doubleValue",
"(",
")",
")",
")",
";",
"logger",
".",
"trace",
"(",
"MMarker",
".",
"GETTER",
",",
"\"Converting from {} to Fahrenheit : {}\"",
",",
"currentUnit",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Kelvin is the SI Unit
|
[
"Kelvin",
"is",
"the",
"SI",
"Unit"
] |
2ca953c14f46adc320927c87c5ce1c36eb6c82de
|
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/temperature/ATemperature.java#L84-L90
|
154,463
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/QueryConverter.java
|
QueryConverter.convertFieldToIndex
|
public int convertFieldToIndex()
{
int index = -1;
FieldInfo field = this.getField();
if (field != null)
{
if (!field.isNull())
{
boolean bFound = false;
Object bookmark = null;
try {
if (field instanceof ReferenceField) // Always
if (((ReferenceField)field).getReferenceRecord() == m_record)
bookmark = ((ReferenceField)field).getReference().getHandle(DBConstants.BOOKMARK_HANDLE);
} catch (DBException ex) {
bookmark = null;
}
if (bookmark == null)
if (field instanceof IntegerField)
bookmark = field.getData();
Object bookmarkRecord = null;
try {
bookmarkRecord = m_record.getTable().getHandle(m_iHandleType);
} catch (DBException ex) {
}
if ((m_record.getEditMode() == Constants.EDIT_IN_PROGRESS) ||
(m_record.getEditMode() == Constants.EDIT_CURRENT))
if (bookmarkRecord != null)
if (bookmarkRecord.equals(bookmark))
bFound = true; // Don't re-read the record... It is current!
if (bFound == false)
if (bookmark != null)
{ // First, try to look up the field (a bookmark) in the grid table.
index = m_gridTable.bookmarkToIndex(bookmark, DBConstants.BOOKMARK_HANDLE); // Find the index of this record in the list
if (index != -1)
{
if (m_bIncludeBlankOption)
index++;
return index;
}
try {
bFound = (m_record.getTable().setHandle(bookmark, m_iHandleType) != null);
} catch (DBException e) {
bFound = false;
}
}
if (bFound)
{
index = m_gridTable.bookmarkToIndex(bookmark, DBConstants.BOOKMARK_HANDLE); // Find the index of this record in the list
if (index != -1)
{
try {
m_gridTable.get(index); // Make sure I'm actually pointing to this record (fast - should be cached)
} catch (DBException e) {
e.printStackTrace(); // Never
}
}
if (m_bIncludeBlankOption)
index++;
if (index != -1)
return index;
}
}
}
this.moveToIndex(-1); // Move off any valid record
if (m_bIncludeBlankOption)
if (field != null)
if (field.isNull())
return 0; // Null = Select the "Blank" line
return -1;
}
|
java
|
public int convertFieldToIndex()
{
int index = -1;
FieldInfo field = this.getField();
if (field != null)
{
if (!field.isNull())
{
boolean bFound = false;
Object bookmark = null;
try {
if (field instanceof ReferenceField) // Always
if (((ReferenceField)field).getReferenceRecord() == m_record)
bookmark = ((ReferenceField)field).getReference().getHandle(DBConstants.BOOKMARK_HANDLE);
} catch (DBException ex) {
bookmark = null;
}
if (bookmark == null)
if (field instanceof IntegerField)
bookmark = field.getData();
Object bookmarkRecord = null;
try {
bookmarkRecord = m_record.getTable().getHandle(m_iHandleType);
} catch (DBException ex) {
}
if ((m_record.getEditMode() == Constants.EDIT_IN_PROGRESS) ||
(m_record.getEditMode() == Constants.EDIT_CURRENT))
if (bookmarkRecord != null)
if (bookmarkRecord.equals(bookmark))
bFound = true; // Don't re-read the record... It is current!
if (bFound == false)
if (bookmark != null)
{ // First, try to look up the field (a bookmark) in the grid table.
index = m_gridTable.bookmarkToIndex(bookmark, DBConstants.BOOKMARK_HANDLE); // Find the index of this record in the list
if (index != -1)
{
if (m_bIncludeBlankOption)
index++;
return index;
}
try {
bFound = (m_record.getTable().setHandle(bookmark, m_iHandleType) != null);
} catch (DBException e) {
bFound = false;
}
}
if (bFound)
{
index = m_gridTable.bookmarkToIndex(bookmark, DBConstants.BOOKMARK_HANDLE); // Find the index of this record in the list
if (index != -1)
{
try {
m_gridTable.get(index); // Make sure I'm actually pointing to this record (fast - should be cached)
} catch (DBException e) {
e.printStackTrace(); // Never
}
}
if (m_bIncludeBlankOption)
index++;
if (index != -1)
return index;
}
}
}
this.moveToIndex(-1); // Move off any valid record
if (m_bIncludeBlankOption)
if (field != null)
if (field.isNull())
return 0; // Null = Select the "Blank" line
return -1;
}
|
[
"public",
"int",
"convertFieldToIndex",
"(",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"FieldInfo",
"field",
"=",
"this",
".",
"getField",
"(",
")",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"field",
".",
"isNull",
"(",
")",
")",
"{",
"boolean",
"bFound",
"=",
"false",
";",
"Object",
"bookmark",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"field",
"instanceof",
"ReferenceField",
")",
"// Always",
"if",
"(",
"(",
"(",
"ReferenceField",
")",
"field",
")",
".",
"getReferenceRecord",
"(",
")",
"==",
"m_record",
")",
"bookmark",
"=",
"(",
"(",
"ReferenceField",
")",
"field",
")",
".",
"getReference",
"(",
")",
".",
"getHandle",
"(",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"bookmark",
"=",
"null",
";",
"}",
"if",
"(",
"bookmark",
"==",
"null",
")",
"if",
"(",
"field",
"instanceof",
"IntegerField",
")",
"bookmark",
"=",
"field",
".",
"getData",
"(",
")",
";",
"Object",
"bookmarkRecord",
"=",
"null",
";",
"try",
"{",
"bookmarkRecord",
"=",
"m_record",
".",
"getTable",
"(",
")",
".",
"getHandle",
"(",
"m_iHandleType",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"}",
"if",
"(",
"(",
"m_record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"||",
"(",
"m_record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_CURRENT",
")",
")",
"if",
"(",
"bookmarkRecord",
"!=",
"null",
")",
"if",
"(",
"bookmarkRecord",
".",
"equals",
"(",
"bookmark",
")",
")",
"bFound",
"=",
"true",
";",
"// Don't re-read the record... It is current!",
"if",
"(",
"bFound",
"==",
"false",
")",
"if",
"(",
"bookmark",
"!=",
"null",
")",
"{",
"// First, try to look up the field (a bookmark) in the grid table.",
"index",
"=",
"m_gridTable",
".",
"bookmarkToIndex",
"(",
"bookmark",
",",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
";",
"// Find the index of this record in the list",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"m_bIncludeBlankOption",
")",
"index",
"++",
";",
"return",
"index",
";",
"}",
"try",
"{",
"bFound",
"=",
"(",
"m_record",
".",
"getTable",
"(",
")",
".",
"setHandle",
"(",
"bookmark",
",",
"m_iHandleType",
")",
"!=",
"null",
")",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"bFound",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"bFound",
")",
"{",
"index",
"=",
"m_gridTable",
".",
"bookmarkToIndex",
"(",
"bookmark",
",",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
";",
"// Find the index of this record in the list",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"m_gridTable",
".",
"get",
"(",
"index",
")",
";",
"// Make sure I'm actually pointing to this record (fast - should be cached)",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"// Never",
"}",
"}",
"if",
"(",
"m_bIncludeBlankOption",
")",
"index",
"++",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"return",
"index",
";",
"}",
"}",
"}",
"this",
".",
"moveToIndex",
"(",
"-",
"1",
")",
";",
"// Move off any valid record",
"if",
"(",
"m_bIncludeBlankOption",
")",
"if",
"(",
"field",
"!=",
"null",
")",
"if",
"(",
"field",
".",
"isNull",
"(",
")",
")",
"return",
"0",
";",
"// Null = Select the \"Blank\" line",
"return",
"-",
"1",
";",
"}"
] |
Convert the current field value to an index.
@return The zero-based index of the location of this field (-1 = none).
|
[
"Convert",
"the",
"current",
"field",
"value",
"to",
"an",
"index",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/QueryConverter.java#L135-L207
|
154,464
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/QueryConverter.java
|
QueryConverter.convertIndexToDisStr
|
public String convertIndexToDisStr(int index)
{
int iErrorCode = this.moveToIndex(index);
if (iErrorCode == DBConstants.NORMAL_RETURN)
{
if (displayFieldName != null)
return m_record.getField(displayFieldName).getString();
else
return m_record.getField(m_iFieldSeq).getString();
}
else
return Constants.BLANK;
}
|
java
|
public String convertIndexToDisStr(int index)
{
int iErrorCode = this.moveToIndex(index);
if (iErrorCode == DBConstants.NORMAL_RETURN)
{
if (displayFieldName != null)
return m_record.getField(displayFieldName).getString();
else
return m_record.getField(m_iFieldSeq).getString();
}
else
return Constants.BLANK;
}
|
[
"public",
"String",
"convertIndexToDisStr",
"(",
"int",
"index",
")",
"{",
"int",
"iErrorCode",
"=",
"this",
".",
"moveToIndex",
"(",
"index",
")",
";",
"if",
"(",
"iErrorCode",
"==",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"{",
"if",
"(",
"displayFieldName",
"!=",
"null",
")",
"return",
"m_record",
".",
"getField",
"(",
"displayFieldName",
")",
".",
"getString",
"(",
")",
";",
"else",
"return",
"m_record",
".",
"getField",
"(",
"m_iFieldSeq",
")",
".",
"getString",
"(",
")",
";",
"}",
"else",
"return",
"Constants",
".",
"BLANK",
";",
"}"
] |
Convert this index value to a display string.
@param index The index of the display string to retrieve.
@return The display string.
|
[
"Convert",
"this",
"index",
"value",
"to",
"a",
"display",
"string",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/QueryConverter.java#L213-L225
|
154,465
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/app/MessageInitialProcess.java
|
MessageInitialProcess.registerInitialProcesses
|
public void registerInitialProcesses()
{
MessageProcessInfo recMessageProcessInfo = new MessageProcessInfo(this);
try {
// Always register this generic processing queue.
this.registerProcessForMessage(new BaseMessageFilter(MessageConstants.TRX_SEND_QUEUE, MessageConstants.INTERNET_QUEUE, null, null), null, null);
recMessageProcessInfo.close();
while (recMessageProcessInfo.hasNext())
{
recMessageProcessInfo.next();
String strQueueName = recMessageProcessInfo.getQueueName(true);
String strQueueType = recMessageProcessInfo.getQueueType(true);
String strProcessClass = recMessageProcessInfo.getField(MessageProcessInfo.PROCESSOR_CLASS).toString();
Map<String,Object> properties = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperties();
Record recMessageType = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference();
if (recMessageType != null)
{ // Start all processes that handle INcoming REQUESTs.
String strMessageType = recMessageType.getField(MessageType.CODE).toString();
Record recMessageInfo = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference();
if (recMessageInfo != null)
{
Record recMessageInfoType = ((ReferenceField)recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID)).getReference();
if (recMessageInfoType != null)
{
String strMessageInfoType = recMessageInfoType.getField(MessageInfoType.CODE).toString();
if (MessageInfoType.REQUEST.equals(strMessageInfoType))
if (MessageType.MESSAGE_IN.equals(strMessageType))
if ((strQueueName != null) && (strQueueName.length() > 0))
this.registerProcessForMessage(new BaseMessageFilter(strQueueName, strQueueType, null, null), strProcessClass, properties);
}
}
}
}
recMessageProcessInfo.close();
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recMessageProcessInfo.free();
}
}
|
java
|
public void registerInitialProcesses()
{
MessageProcessInfo recMessageProcessInfo = new MessageProcessInfo(this);
try {
// Always register this generic processing queue.
this.registerProcessForMessage(new BaseMessageFilter(MessageConstants.TRX_SEND_QUEUE, MessageConstants.INTERNET_QUEUE, null, null), null, null);
recMessageProcessInfo.close();
while (recMessageProcessInfo.hasNext())
{
recMessageProcessInfo.next();
String strQueueName = recMessageProcessInfo.getQueueName(true);
String strQueueType = recMessageProcessInfo.getQueueType(true);
String strProcessClass = recMessageProcessInfo.getField(MessageProcessInfo.PROCESSOR_CLASS).toString();
Map<String,Object> properties = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperties();
Record recMessageType = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference();
if (recMessageType != null)
{ // Start all processes that handle INcoming REQUESTs.
String strMessageType = recMessageType.getField(MessageType.CODE).toString();
Record recMessageInfo = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference();
if (recMessageInfo != null)
{
Record recMessageInfoType = ((ReferenceField)recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID)).getReference();
if (recMessageInfoType != null)
{
String strMessageInfoType = recMessageInfoType.getField(MessageInfoType.CODE).toString();
if (MessageInfoType.REQUEST.equals(strMessageInfoType))
if (MessageType.MESSAGE_IN.equals(strMessageType))
if ((strQueueName != null) && (strQueueName.length() > 0))
this.registerProcessForMessage(new BaseMessageFilter(strQueueName, strQueueType, null, null), strProcessClass, properties);
}
}
}
}
recMessageProcessInfo.close();
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recMessageProcessInfo.free();
}
}
|
[
"public",
"void",
"registerInitialProcesses",
"(",
")",
"{",
"MessageProcessInfo",
"recMessageProcessInfo",
"=",
"new",
"MessageProcessInfo",
"(",
"this",
")",
";",
"try",
"{",
"// Always register this generic processing queue.",
"this",
".",
"registerProcessForMessage",
"(",
"new",
"BaseMessageFilter",
"(",
"MessageConstants",
".",
"TRX_SEND_QUEUE",
",",
"MessageConstants",
".",
"INTERNET_QUEUE",
",",
"null",
",",
"null",
")",
",",
"null",
",",
"null",
")",
";",
"recMessageProcessInfo",
".",
"close",
"(",
")",
";",
"while",
"(",
"recMessageProcessInfo",
".",
"hasNext",
"(",
")",
")",
"{",
"recMessageProcessInfo",
".",
"next",
"(",
")",
";",
"String",
"strQueueName",
"=",
"recMessageProcessInfo",
".",
"getQueueName",
"(",
"true",
")",
";",
"String",
"strQueueType",
"=",
"recMessageProcessInfo",
".",
"getQueueType",
"(",
"true",
")",
";",
"String",
"strProcessClass",
"=",
"recMessageProcessInfo",
".",
"getField",
"(",
"MessageProcessInfo",
".",
"PROCESSOR_CLASS",
")",
".",
"toString",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"(",
"(",
"PropertiesField",
")",
"recMessageProcessInfo",
".",
"getField",
"(",
"MessageProcessInfo",
".",
"PROPERTIES",
")",
")",
".",
"getProperties",
"(",
")",
";",
"Record",
"recMessageType",
"=",
"(",
"(",
"ReferenceField",
")",
"recMessageProcessInfo",
".",
"getField",
"(",
"MessageProcessInfo",
".",
"MESSAGE_TYPE_ID",
")",
")",
".",
"getReference",
"(",
")",
";",
"if",
"(",
"recMessageType",
"!=",
"null",
")",
"{",
"// Start all processes that handle INcoming REQUESTs.",
"String",
"strMessageType",
"=",
"recMessageType",
".",
"getField",
"(",
"MessageType",
".",
"CODE",
")",
".",
"toString",
"(",
")",
";",
"Record",
"recMessageInfo",
"=",
"(",
"(",
"ReferenceField",
")",
"recMessageProcessInfo",
".",
"getField",
"(",
"MessageProcessInfo",
".",
"MESSAGE_INFO_ID",
")",
")",
".",
"getReference",
"(",
")",
";",
"if",
"(",
"recMessageInfo",
"!=",
"null",
")",
"{",
"Record",
"recMessageInfoType",
"=",
"(",
"(",
"ReferenceField",
")",
"recMessageInfo",
".",
"getField",
"(",
"MessageInfo",
".",
"MESSAGE_INFO_TYPE_ID",
")",
")",
".",
"getReference",
"(",
")",
";",
"if",
"(",
"recMessageInfoType",
"!=",
"null",
")",
"{",
"String",
"strMessageInfoType",
"=",
"recMessageInfoType",
".",
"getField",
"(",
"MessageInfoType",
".",
"CODE",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"MessageInfoType",
".",
"REQUEST",
".",
"equals",
"(",
"strMessageInfoType",
")",
")",
"if",
"(",
"MessageType",
".",
"MESSAGE_IN",
".",
"equals",
"(",
"strMessageType",
")",
")",
"if",
"(",
"(",
"strQueueName",
"!=",
"null",
")",
"&&",
"(",
"strQueueName",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"this",
".",
"registerProcessForMessage",
"(",
"new",
"BaseMessageFilter",
"(",
"strQueueName",
",",
"strQueueType",
",",
"null",
",",
"null",
")",
",",
"strProcessClass",
",",
"properties",
")",
";",
"}",
"}",
"}",
"}",
"recMessageProcessInfo",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"recMessageProcessInfo",
".",
"free",
"(",
")",
";",
"}",
"}"
] |
RegisterInitialProcesses Method.
|
[
"RegisterInitialProcesses",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/app/MessageInitialProcess.java#L72-L111
|
154,466
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/app/MessageInitialProcess.java
|
MessageInitialProcess.registerProcessForMessage
|
public void registerProcessForMessage(BaseMessageFilter messageFilter, String strProcessClass, Map<String,Object> properties)
{
new TrxMessageListener(messageFilter, (Application)this.getTask().getApplication(), strProcessClass, properties); // This listener was added to the filter
((MessageInfoApplication)this.getTask().getApplication()).getThickMessageManager().addMessageFilter(messageFilter);
// Note: No need to worry about cleanup... Freeing the message manager will free all these listeners.
if (properties != null)
if (properties.get(MessageInfoApplication.AUTOSTART) != null)
((MessageInfoApplication)this.getTask().getApplication()).getThickMessageManager().sendMessage(new MapMessage(new BaseMessageHeader(messageFilter.getQueueName(), messageFilter.getQueueType(), this, null), properties));
}
|
java
|
public void registerProcessForMessage(BaseMessageFilter messageFilter, String strProcessClass, Map<String,Object> properties)
{
new TrxMessageListener(messageFilter, (Application)this.getTask().getApplication(), strProcessClass, properties); // This listener was added to the filter
((MessageInfoApplication)this.getTask().getApplication()).getThickMessageManager().addMessageFilter(messageFilter);
// Note: No need to worry about cleanup... Freeing the message manager will free all these listeners.
if (properties != null)
if (properties.get(MessageInfoApplication.AUTOSTART) != null)
((MessageInfoApplication)this.getTask().getApplication()).getThickMessageManager().sendMessage(new MapMessage(new BaseMessageHeader(messageFilter.getQueueName(), messageFilter.getQueueType(), this, null), properties));
}
|
[
"public",
"void",
"registerProcessForMessage",
"(",
"BaseMessageFilter",
"messageFilter",
",",
"String",
"strProcessClass",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"new",
"TrxMessageListener",
"(",
"messageFilter",
",",
"(",
"Application",
")",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
",",
"strProcessClass",
",",
"properties",
")",
";",
"// This listener was added to the filter",
"(",
"(",
"MessageInfoApplication",
")",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
")",
".",
"getThickMessageManager",
"(",
")",
".",
"addMessageFilter",
"(",
"messageFilter",
")",
";",
"// Note: No need to worry about cleanup... Freeing the message manager will free all these listeners.",
"if",
"(",
"properties",
"!=",
"null",
")",
"if",
"(",
"properties",
".",
"get",
"(",
"MessageInfoApplication",
".",
"AUTOSTART",
")",
"!=",
"null",
")",
"(",
"(",
"MessageInfoApplication",
")",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
")",
".",
"getThickMessageManager",
"(",
")",
".",
"sendMessage",
"(",
"new",
"MapMessage",
"(",
"new",
"BaseMessageHeader",
"(",
"messageFilter",
".",
"getQueueName",
"(",
")",
",",
"messageFilter",
".",
"getQueueType",
"(",
")",
",",
"this",
",",
"null",
")",
",",
"properties",
")",
")",
";",
"}"
] |
RegisterProcessForMessage Method.
|
[
"RegisterProcessForMessage",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/app/MessageInitialProcess.java#L115-L123
|
154,467
|
PuyallupFoursquare/ccb-api-client-java
|
src/main/java/com/p4square/ccbapi/model/Country.java
|
Country.setCountryCode
|
public void setCountryCode(final String code) {
if (code.length() != 2) {
throw new IllegalArgumentException("Argument must be a two letter country code.");
}
this.code = code.toUpperCase();
this.name = null;
}
|
java
|
public void setCountryCode(final String code) {
if (code.length() != 2) {
throw new IllegalArgumentException("Argument must be a two letter country code.");
}
this.code = code.toUpperCase();
this.name = null;
}
|
[
"public",
"void",
"setCountryCode",
"(",
"final",
"String",
"code",
")",
"{",
"if",
"(",
"code",
".",
"length",
"(",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument must be a two letter country code.\"",
")",
";",
"}",
"this",
".",
"code",
"=",
"code",
".",
"toUpperCase",
"(",
")",
";",
"this",
".",
"name",
"=",
"null",
";",
"}"
] |
Set the two letter country code.
This class does not attempt to resolve the country name from the country code.
When the country code is set the name will become null.
@param code A two letter countey code.
@throws IllegalArgumentException if the country code is not valid.
|
[
"Set",
"the",
"two",
"letter",
"country",
"code",
"."
] |
54a7a3184dc565fe513aa520e1344b2303ea6834
|
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/model/Country.java#L58-L64
|
154,468
|
wigforss/Ka-Commons-Collection
|
src/main/java/org/kasource/commons/collection/builder/ListBuilder.java
|
ListBuilder.add
|
public ListBuilder<T> add(T... items) {
list.addAll(Arrays.asList(items));
return this;
}
|
java
|
public ListBuilder<T> add(T... items) {
list.addAll(Arrays.asList(items));
return this;
}
|
[
"public",
"ListBuilder",
"<",
"T",
">",
"add",
"(",
"T",
"...",
"items",
")",
"{",
"list",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"items",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Adds items to the list.
@param items Items to add.
@return This builder
|
[
"Adds",
"items",
"to",
"the",
"list",
"."
] |
bee25f16ec4a65af0005bf0a9151a891cfe23e8e
|
https://github.com/wigforss/Ka-Commons-Collection/blob/bee25f16ec4a65af0005bf0a9151a891cfe23e8e/src/main/java/org/kasource/commons/collection/builder/ListBuilder.java#L58-L61
|
154,469
|
wigforss/Ka-Commons-Collection
|
src/main/java/org/kasource/commons/collection/builder/ListBuilder.java
|
ListBuilder.addAll
|
public ListBuilder<T> addAll(int index, Collection<? extends T> items) {
list.addAll(index, items);
return this;
}
|
java
|
public ListBuilder<T> addAll(int index, Collection<? extends T> items) {
list.addAll(index, items);
return this;
}
|
[
"public",
"ListBuilder",
"<",
"T",
">",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"T",
">",
"items",
")",
"{",
"list",
".",
"addAll",
"(",
"index",
",",
"items",
")",
";",
"return",
"this",
";",
"}"
] |
Adds all items in the items Collection to the list.
@param index Index to insert items at in the list.
@param items Items to add.
@return This builder
|
[
"Adds",
"all",
"items",
"in",
"the",
"items",
"Collection",
"to",
"the",
"list",
"."
] |
bee25f16ec4a65af0005bf0a9151a891cfe23e8e
|
https://github.com/wigforss/Ka-Commons-Collection/blob/bee25f16ec4a65af0005bf0a9151a891cfe23e8e/src/main/java/org/kasource/commons/collection/builder/ListBuilder.java#L84-L87
|
154,470
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultAddress.java
|
JDefaultAddress.stateAbbr
|
public static String stateAbbr(boolean allStates) {
String state = fetchString("address.state_abbr");
if (allStates == true) {
return state;
} else {
while (state.equalsIgnoreCase("FM") || state.equalsIgnoreCase("FL") || state.equalsIgnoreCase("GU")
|| state.equalsIgnoreCase("PW") || state.equalsIgnoreCase("PA") || state.equalsIgnoreCase("PR")
|| state.equalsIgnoreCase("AE") || state.equalsIgnoreCase("AA") || state.equalsIgnoreCase("AP")
|| state.equalsIgnoreCase("MP") || state.equalsIgnoreCase("VI") || state.equalsIgnoreCase("AS")
|| state.equalsIgnoreCase("MH")) {
state = stateAbbr(true);
}
}
return state;
}
|
java
|
public static String stateAbbr(boolean allStates) {
String state = fetchString("address.state_abbr");
if (allStates == true) {
return state;
} else {
while (state.equalsIgnoreCase("FM") || state.equalsIgnoreCase("FL") || state.equalsIgnoreCase("GU")
|| state.equalsIgnoreCase("PW") || state.equalsIgnoreCase("PA") || state.equalsIgnoreCase("PR")
|| state.equalsIgnoreCase("AE") || state.equalsIgnoreCase("AA") || state.equalsIgnoreCase("AP")
|| state.equalsIgnoreCase("MP") || state.equalsIgnoreCase("VI") || state.equalsIgnoreCase("AS")
|| state.equalsIgnoreCase("MH")) {
state = stateAbbr(true);
}
}
return state;
}
|
[
"public",
"static",
"String",
"stateAbbr",
"(",
"boolean",
"allStates",
")",
"{",
"String",
"state",
"=",
"fetchString",
"(",
"\"address.state_abbr\"",
")",
";",
"if",
"(",
"allStates",
"==",
"true",
")",
"{",
"return",
"state",
";",
"}",
"else",
"{",
"while",
"(",
"state",
".",
"equalsIgnoreCase",
"(",
"\"FM\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"FL\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"GU\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"PW\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"PA\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"PR\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"AE\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"AA\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"AP\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"MP\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"VI\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"AS\"",
")",
"||",
"state",
".",
"equalsIgnoreCase",
"(",
"\"MH\"",
")",
")",
"{",
"state",
"=",
"stateAbbr",
"(",
"true",
")",
";",
"}",
"}",
"return",
"state",
";",
"}"
] |
random 2 letter state
@param allStates include all states
@return state code string
|
[
"random",
"2",
"letter",
"state"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultAddress.java#L128-L143
|
154,471
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertID.java
|
ConvertID.isChangeToNewID
|
public boolean isChangeToNewID(Record record)
{
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
recClassInfo.getField(ClassInfo.CLASS_NAME).moveFieldToThis(record.getField(ScreenIn.SCREEN_IN_PROG_NAME));
try {
if (!recClassInfo.seek(DBConstants.EQUALS))
return false;
} catch (DBException e) {
e.printStackTrace();
}
return (recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).getValue() == 1);
}
|
java
|
public boolean isChangeToNewID(Record record)
{
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
recClassInfo.getField(ClassInfo.CLASS_NAME).moveFieldToThis(record.getField(ScreenIn.SCREEN_IN_PROG_NAME));
try {
if (!recClassInfo.seek(DBConstants.EQUALS))
return false;
} catch (DBException e) {
e.printStackTrace();
}
return (recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).getValue() == 1);
}
|
[
"public",
"boolean",
"isChangeToNewID",
"(",
"Record",
"record",
")",
"{",
"Record",
"recClassInfo",
"=",
"this",
".",
"getRecord",
"(",
"ClassInfo",
".",
"CLASS_INFO_FILE",
")",
";",
"recClassInfo",
".",
"setKeyArea",
"(",
"ClassInfo",
".",
"CLASS_NAME_KEY",
")",
";",
"recClassInfo",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"moveFieldToThis",
"(",
"record",
".",
"getField",
"(",
"ScreenIn",
".",
"SCREEN_IN_PROG_NAME",
")",
")",
";",
"try",
"{",
"if",
"(",
"!",
"recClassInfo",
".",
"seek",
"(",
"DBConstants",
".",
"EQUALS",
")",
")",
"return",
"false",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"(",
"recClassInfo",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PROJECT_ID",
")",
".",
"getValue",
"(",
")",
"==",
"1",
")",
";",
"}"
] |
Change this to the new ID?
@param record
@return
|
[
"Change",
"this",
"to",
"the",
"new",
"ID?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertID.java#L130-L142
|
154,472
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/ui/Scaler.java
|
Scaler.getLevelFor
|
public ScaleLevel getLevelFor(Font font, boolean horizontal, double xy)
{
return getLevelFor(font, DEFAULT_FONTRENDERCONTEXT, horizontal, xy);
}
|
java
|
public ScaleLevel getLevelFor(Font font, boolean horizontal, double xy)
{
return getLevelFor(font, DEFAULT_FONTRENDERCONTEXT, horizontal, xy);
}
|
[
"public",
"ScaleLevel",
"getLevelFor",
"(",
"Font",
"font",
",",
"boolean",
"horizontal",
",",
"double",
"xy",
")",
"{",
"return",
"getLevelFor",
"(",
"font",
",",
"DEFAULT_FONTRENDERCONTEXT",
",",
"horizontal",
",",
"xy",
")",
";",
"}"
] |
Returns highest level where drawn labels don't overlap using identity
transformer and FontRenderContext with identity AffineTransform, no
anti-aliasing and fractional metrics
@param font
@param horizontal
@param xy Lines constant value
@return
|
[
"Returns",
"highest",
"level",
"where",
"drawn",
"labels",
"don",
"t",
"overlap",
"using",
"identity",
"transformer",
"and",
"FontRenderContext",
"with",
"identity",
"AffineTransform",
"no",
"anti",
"-",
"aliasing",
"and",
"fractional",
"metrics"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Scaler.java#L110-L113
|
154,473
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/ui/Scaler.java
|
Scaler.getLabels
|
public List<String> getLabels(Locale locale, ScaleLevel level)
{
return level.stream(min, max).mapToObj((d)->level.label(locale, d)).collect(Collectors.toList());
}
|
java
|
public List<String> getLabels(Locale locale, ScaleLevel level)
{
return level.stream(min, max).mapToObj((d)->level.label(locale, d)).collect(Collectors.toList());
}
|
[
"public",
"List",
"<",
"String",
">",
"getLabels",
"(",
"Locale",
"locale",
",",
"ScaleLevel",
"level",
")",
"{",
"return",
"level",
".",
"stream",
"(",
"min",
",",
"max",
")",
".",
"mapToObj",
"(",
"(",
"d",
")",
"-",
">",
"level",
".",
"label",
"(",
"locale",
",",
"d",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] |
Returns labels for level
@param locale
@param level
@return
|
[
"Returns",
"labels",
"for",
"level"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Scaler.java#L257-L260
|
154,474
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/ui/Scaler.java
|
Scaler.level
|
public ScaleLevel level(int minMarkers, int maxMarkers)
{
Iterator<ScaleLevel> iterator = scale.iterator(min, max);
ScaleLevel level = iterator.next();
ScaleLevel prev = null;
while (iterator.hasNext() && minMarkers > level.count(min, max))
{
prev = level;
level = iterator.next();
}
if (maxMarkers < level.count(min, max))
{
return prev;
}
else
{
return level;
}
}
|
java
|
public ScaleLevel level(int minMarkers, int maxMarkers)
{
Iterator<ScaleLevel> iterator = scale.iterator(min, max);
ScaleLevel level = iterator.next();
ScaleLevel prev = null;
while (iterator.hasNext() && minMarkers > level.count(min, max))
{
prev = level;
level = iterator.next();
}
if (maxMarkers < level.count(min, max))
{
return prev;
}
else
{
return level;
}
}
|
[
"public",
"ScaleLevel",
"level",
"(",
"int",
"minMarkers",
",",
"int",
"maxMarkers",
")",
"{",
"Iterator",
"<",
"ScaleLevel",
">",
"iterator",
"=",
"scale",
".",
"iterator",
"(",
"min",
",",
"max",
")",
";",
"ScaleLevel",
"level",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"ScaleLevel",
"prev",
"=",
"null",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
"&&",
"minMarkers",
">",
"level",
".",
"count",
"(",
"min",
",",
"max",
")",
")",
"{",
"prev",
"=",
"level",
";",
"level",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"}",
"if",
"(",
"maxMarkers",
"<",
"level",
".",
"count",
"(",
"min",
",",
"max",
")",
")",
"{",
"return",
"prev",
";",
"}",
"else",
"{",
"return",
"level",
";",
"}",
"}"
] |
Returns minimum level where number of markers is not less that minMarkers
and less than maxMarkers. If both cannot be met, maxMarkers is stronger.
@param minMarkers
@param maxMarkers
@return
|
[
"Returns",
"minimum",
"level",
"where",
"number",
"of",
"markers",
"is",
"not",
"less",
"that",
"minMarkers",
"and",
"less",
"than",
"maxMarkers",
".",
"If",
"both",
"cannot",
"be",
"met",
"maxMarkers",
"is",
"stronger",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Scaler.java#L289-L307
|
154,475
|
jbundle/jbundle
|
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/report/HReportScreen.java
|
HReportScreen.getHtmlControl
|
public String getHtmlControl()
{
StringWriter sw = new StringWriter();
PrintWriter rw = new PrintWriter(sw);
this.getScreenField().printData(rw, HtmlConstants.HTML_DISPLAY); // DO print screen
String string = sw.toString();
return string;
}
|
java
|
public String getHtmlControl()
{
StringWriter sw = new StringWriter();
PrintWriter rw = new PrintWriter(sw);
this.getScreenField().printData(rw, HtmlConstants.HTML_DISPLAY); // DO print screen
String string = sw.toString();
return string;
}
|
[
"public",
"String",
"getHtmlControl",
"(",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"rw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",
"this",
".",
"getScreenField",
"(",
")",
".",
"printData",
"(",
"rw",
",",
"HtmlConstants",
".",
"HTML_DISPLAY",
")",
";",
"// DO print screen",
"String",
"string",
"=",
"sw",
".",
"toString",
"(",
")",
";",
"return",
"string",
";",
"}"
] |
Get this report's output as an HTML string.
@return The html for this control.
|
[
"Get",
"this",
"report",
"s",
"output",
"as",
"an",
"HTML",
"string",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/report/HReportScreen.java#L73-L80
|
154,476
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseFrameAdapter.java
|
JBaseFrameAdapter.windowClosing
|
public void windowClosing(WindowEvent e)
{
if (m_dialog.getContentPane().getComponentCount() > 0)
if (m_dialog.getContentPane().getComponent(0) instanceof BaseApplet)
((BaseApplet)m_dialog.getContentPane().getComponent(0)).free();
m_dialog.dispose(); // Remove dialog.
}
|
java
|
public void windowClosing(WindowEvent e)
{
if (m_dialog.getContentPane().getComponentCount() > 0)
if (m_dialog.getContentPane().getComponent(0) instanceof BaseApplet)
((BaseApplet)m_dialog.getContentPane().getComponent(0)).free();
m_dialog.dispose(); // Remove dialog.
}
|
[
"public",
"void",
"windowClosing",
"(",
"WindowEvent",
"e",
")",
"{",
"if",
"(",
"m_dialog",
".",
"getContentPane",
"(",
")",
".",
"getComponentCount",
"(",
")",
">",
"0",
")",
"if",
"(",
"m_dialog",
".",
"getContentPane",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
"instanceof",
"BaseApplet",
")",
"(",
"(",
"BaseApplet",
")",
"m_dialog",
".",
"getContentPane",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
")",
".",
"free",
"(",
")",
";",
"m_dialog",
".",
"dispose",
"(",
")",
";",
"// Remove dialog.",
"}"
] |
The window is closing, free the sub-BaseApplet.
@param e The window event.
|
[
"The",
"window",
"is",
"closing",
"free",
"the",
"sub",
"-",
"BaseApplet",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseFrameAdapter.java#L35-L41
|
154,477
|
marcos-garcia/smartsantanderdataanalysis
|
ssjsonformatterinterceptor/src/main/java/com/marcosgarciacasado/ssjsonformatterinterceptor/MeasureExtractor.java
|
MeasureExtractor.getJSONMeasures
|
public JSONArray getJSONMeasures(String content){
JSONArray ja = new JSONArray();
for(Entry<String, String> measure : measureRegexps.entrySet()){
Pattern r = Pattern.compile(measure.getValue());
Matcher m = r.matcher(content);
if(m.find()){
JSONObject jsonMeasure = new JSONObject();
jsonMeasure.put(measure.getKey(), m.group(1));
ja.add(jsonMeasure);
}
}
return ja;
}
|
java
|
public JSONArray getJSONMeasures(String content){
JSONArray ja = new JSONArray();
for(Entry<String, String> measure : measureRegexps.entrySet()){
Pattern r = Pattern.compile(measure.getValue());
Matcher m = r.matcher(content);
if(m.find()){
JSONObject jsonMeasure = new JSONObject();
jsonMeasure.put(measure.getKey(), m.group(1));
ja.add(jsonMeasure);
}
}
return ja;
}
|
[
"public",
"JSONArray",
"getJSONMeasures",
"(",
"String",
"content",
")",
"{",
"JSONArray",
"ja",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"measure",
":",
"measureRegexps",
".",
"entrySet",
"(",
")",
")",
"{",
"Pattern",
"r",
"=",
"Pattern",
".",
"compile",
"(",
"measure",
".",
"getValue",
"(",
")",
")",
";",
"Matcher",
"m",
"=",
"r",
".",
"matcher",
"(",
"content",
")",
";",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"JSONObject",
"jsonMeasure",
"=",
"new",
"JSONObject",
"(",
")",
";",
"jsonMeasure",
".",
"put",
"(",
"measure",
".",
"getKey",
"(",
")",
",",
"m",
".",
"group",
"(",
"1",
")",
")",
";",
"ja",
".",
"add",
"(",
"jsonMeasure",
")",
";",
"}",
"}",
"return",
"ja",
";",
"}"
] |
Obtains a JSONArray with the measures extracted from a string passed by argument.
@author Marcos García Casado
|
[
"Obtains",
"a",
"JSONArray",
"with",
"the",
"measures",
"extracted",
"from",
"a",
"string",
"passed",
"by",
"argument",
"."
] |
dc259618887886e294c839a905b18994171d21ef
|
https://github.com/marcos-garcia/smartsantanderdataanalysis/blob/dc259618887886e294c839a905b18994171d21ef/ssjsonformatterinterceptor/src/main/java/com/marcosgarciacasado/ssjsonformatterinterceptor/MeasureExtractor.java#L39-L53
|
154,478
|
marcos-garcia/smartsantanderdataanalysis
|
ssjsonformatterinterceptor/src/main/java/com/marcosgarciacasado/ssjsonformatterinterceptor/MeasureExtractor.java
|
MeasureExtractor.getArrayMeasures
|
public HashMap<String,Double> getArrayMeasures(JSONObject jsonContent){
HashMap<String,Double> i = new HashMap<String,Double>();
return i;
}
|
java
|
public HashMap<String,Double> getArrayMeasures(JSONObject jsonContent){
HashMap<String,Double> i = new HashMap<String,Double>();
return i;
}
|
[
"public",
"HashMap",
"<",
"String",
",",
"Double",
">",
"getArrayMeasures",
"(",
"JSONObject",
"jsonContent",
")",
"{",
"HashMap",
"<",
"String",
",",
"Double",
">",
"i",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Double",
">",
"(",
")",
";",
"return",
"i",
";",
"}"
] |
Obtains a HashMap with the measures extracted from a JSONObject representing the sensor data.
@author Marcos García Casado
|
[
"Obtains",
"a",
"HashMap",
"with",
"the",
"measures",
"extracted",
"from",
"a",
"JSONObject",
"representing",
"the",
"sensor",
"data",
"."
] |
dc259618887886e294c839a905b18994171d21ef
|
https://github.com/marcos-garcia/smartsantanderdataanalysis/blob/dc259618887886e294c839a905b18994171d21ef/ssjsonformatterinterceptor/src/main/java/com/marcosgarciacasado/ssjsonformatterinterceptor/MeasureExtractor.java#L61-L64
|
154,479
|
marcos-garcia/smartsantanderdataanalysis
|
ssjsonformatterinterceptor/src/main/java/com/marcosgarciacasado/ssjsonformatterinterceptor/MeasureExtractor.java
|
MeasureExtractor.fillMeasures
|
public void fillMeasures(String measure, JSONObject jsonContent, Pattern pattern, HashMap<String,Double> i){
String tem = (String)jsonContent.get(measure);
if(tem != null){
Matcher tM = pattern.matcher(tem);
if(tM.find() && !tM.group(1).isEmpty()){
try{
i.put(measure, Double.valueOf(tM.group(1)));
}catch(NumberFormatException e){
e.printStackTrace();
}
}
}
}
|
java
|
public void fillMeasures(String measure, JSONObject jsonContent, Pattern pattern, HashMap<String,Double> i){
String tem = (String)jsonContent.get(measure);
if(tem != null){
Matcher tM = pattern.matcher(tem);
if(tM.find() && !tM.group(1).isEmpty()){
try{
i.put(measure, Double.valueOf(tM.group(1)));
}catch(NumberFormatException e){
e.printStackTrace();
}
}
}
}
|
[
"public",
"void",
"fillMeasures",
"(",
"String",
"measure",
",",
"JSONObject",
"jsonContent",
",",
"Pattern",
"pattern",
",",
"HashMap",
"<",
"String",
",",
"Double",
">",
"i",
")",
"{",
"String",
"tem",
"=",
"(",
"String",
")",
"jsonContent",
".",
"get",
"(",
"measure",
")",
";",
"if",
"(",
"tem",
"!=",
"null",
")",
"{",
"Matcher",
"tM",
"=",
"pattern",
".",
"matcher",
"(",
"tem",
")",
";",
"if",
"(",
"tM",
".",
"find",
"(",
")",
"&&",
"!",
"tM",
".",
"group",
"(",
"1",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"try",
"{",
"i",
".",
"put",
"(",
"measure",
",",
"Double",
".",
"valueOf",
"(",
"tM",
".",
"group",
"(",
"1",
")",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}"
] |
Extracts a pattern from a measure value located in a JSONObject and stores it in a HashMap whether finds it.
@author Marcos García Casado
|
[
"Extracts",
"a",
"pattern",
"from",
"a",
"measure",
"value",
"located",
"in",
"a",
"JSONObject",
"and",
"stores",
"it",
"in",
"a",
"HashMap",
"whether",
"finds",
"it",
"."
] |
dc259618887886e294c839a905b18994171d21ef
|
https://github.com/marcos-garcia/smartsantanderdataanalysis/blob/dc259618887886e294c839a905b18994171d21ef/ssjsonformatterinterceptor/src/main/java/com/marcosgarciacasado/ssjsonformatterinterceptor/MeasureExtractor.java#L72-L84
|
154,480
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/util/TypeDecisor.java
|
TypeDecisor.isInteger
|
public static <T> boolean isInteger(Class<T> field) {
//to compatibility to scala
return Integer.class.getSimpleName().equalsIgnoreCase(field.getSimpleName());
}
|
java
|
public static <T> boolean isInteger(Class<T> field) {
//to compatibility to scala
return Integer.class.getSimpleName().equalsIgnoreCase(field.getSimpleName());
}
|
[
"public",
"static",
"<",
"T",
">",
"boolean",
"isInteger",
"(",
"Class",
"<",
"T",
">",
"field",
")",
"{",
"//to compatibility to scala",
"return",
"Integer",
".",
"class",
".",
"getSimpleName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"field",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] |
Test if a field is Integer.
@param field the field.
@return true if field is Integer. False in other case.
|
[
"Test",
"if",
"a",
"field",
"is",
"Integer",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/TypeDecisor.java#L75-L78
|
154,481
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/util/TypeDecisor.java
|
TypeDecisor.isLong
|
public static <T> boolean isLong(Class<T> field) {
//to compatibility to scala
return Long.class.getSimpleName().equalsIgnoreCase(field.getSimpleName());
}
|
java
|
public static <T> boolean isLong(Class<T> field) {
//to compatibility to scala
return Long.class.getSimpleName().equalsIgnoreCase(field.getSimpleName());
}
|
[
"public",
"static",
"<",
"T",
">",
"boolean",
"isLong",
"(",
"Class",
"<",
"T",
">",
"field",
")",
"{",
"//to compatibility to scala",
"return",
"Long",
".",
"class",
".",
"getSimpleName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"field",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] |
Test if a field is Long.
@param field the field.
@return true if field is Long. False in other case.
|
[
"Test",
"if",
"a",
"field",
"is",
"Long",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/TypeDecisor.java#L86-L89
|
154,482
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java
|
CacheConverter.isCacheValue
|
public boolean isCacheValue(Object objKey)
{
if (m_hmCache == null)
return false;
if (objKey == null)
return false;
Class<?> classKey = this.getField().getDataClass();
objKey = this.convertKey(objKey, classKey);
return m_hmCache.containsKey(objKey);
}
|
java
|
public boolean isCacheValue(Object objKey)
{
if (m_hmCache == null)
return false;
if (objKey == null)
return false;
Class<?> classKey = this.getField().getDataClass();
objKey = this.convertKey(objKey, classKey);
return m_hmCache.containsKey(objKey);
}
|
[
"public",
"boolean",
"isCacheValue",
"(",
"Object",
"objKey",
")",
"{",
"if",
"(",
"m_hmCache",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"objKey",
"==",
"null",
")",
"return",
"false",
";",
"Class",
"<",
"?",
">",
"classKey",
"=",
"this",
".",
"getField",
"(",
")",
".",
"getDataClass",
"(",
")",
";",
"objKey",
"=",
"this",
".",
"convertKey",
"(",
"objKey",
",",
"classKey",
")",
";",
"return",
"m_hmCache",
".",
"containsKey",
"(",
"objKey",
")",
";",
"}"
] |
Is this key cached?
@param objKey The raw key value.
@return True if this key is in the cache.
|
[
"Is",
"this",
"key",
"cached?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java#L81-L90
|
154,483
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java
|
CacheConverter.getCacheValue
|
public ImageIcon getCacheValue(Object objKey)
{
if (m_hmCache == null)
return null;
if (objKey == null)
return null;
Class<?> classKey = this.getField().getDataClass();
objKey = this.convertKey(objKey, classKey);
return (ImageIcon)m_hmCache.get(objKey);
}
|
java
|
public ImageIcon getCacheValue(Object objKey)
{
if (m_hmCache == null)
return null;
if (objKey == null)
return null;
Class<?> classKey = this.getField().getDataClass();
objKey = this.convertKey(objKey, classKey);
return (ImageIcon)m_hmCache.get(objKey);
}
|
[
"public",
"ImageIcon",
"getCacheValue",
"(",
"Object",
"objKey",
")",
"{",
"if",
"(",
"m_hmCache",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"objKey",
"==",
"null",
")",
"return",
"null",
";",
"Class",
"<",
"?",
">",
"classKey",
"=",
"this",
".",
"getField",
"(",
")",
".",
"getDataClass",
"(",
")",
";",
"objKey",
"=",
"this",
".",
"convertKey",
"(",
"objKey",
",",
"classKey",
")",
";",
"return",
"(",
"ImageIcon",
")",
"m_hmCache",
".",
"get",
"(",
"objKey",
")",
";",
"}"
] |
Get the cache value.
@param objKey The raw key value.
@return The value associated with this key.
|
[
"Get",
"the",
"cache",
"value",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java#L96-L105
|
154,484
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java
|
CacheConverter.cacheValue
|
public void cacheValue(Object objKey, Object objValue)
{
//x if ((objKey == null) || (objValue == null))
if (objKey == null)
return;
Class<?> classKey = this.getField().getDataClass();
objKey = this.convertKey(objKey, classKey);
if (m_hmCache == null)
m_hmCache = new HashMap<Object,Object>();
m_hmCache.put(objKey, objValue);
}
|
java
|
public void cacheValue(Object objKey, Object objValue)
{
//x if ((objKey == null) || (objValue == null))
if (objKey == null)
return;
Class<?> classKey = this.getField().getDataClass();
objKey = this.convertKey(objKey, classKey);
if (m_hmCache == null)
m_hmCache = new HashMap<Object,Object>();
m_hmCache.put(objKey, objValue);
}
|
[
"public",
"void",
"cacheValue",
"(",
"Object",
"objKey",
",",
"Object",
"objValue",
")",
"{",
"//x if ((objKey == null) || (objValue == null))",
"if",
"(",
"objKey",
"==",
"null",
")",
"return",
";",
"Class",
"<",
"?",
">",
"classKey",
"=",
"this",
".",
"getField",
"(",
")",
".",
"getDataClass",
"(",
")",
";",
"objKey",
"=",
"this",
".",
"convertKey",
"(",
"objKey",
",",
"classKey",
")",
";",
"if",
"(",
"m_hmCache",
"==",
"null",
")",
"m_hmCache",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"(",
")",
";",
"m_hmCache",
".",
"put",
"(",
"objKey",
",",
"objValue",
")",
";",
"}"
] |
Add this key and value to the cache.
@param objKey The raw key value.
@param objValue The data value to associate with this key.
|
[
"Add",
"this",
"key",
"and",
"value",
"to",
"the",
"cache",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/db/converter/CacheConverter.java#L111-L121
|
154,485
|
tvesalainen/util
|
ham/src/main/java/org/vesalainen/ham/hffax/Fax.java
|
Fax.isAbout
|
public static boolean isAbout(double expected, double value, double tolerance)
{
double delta = expected*tolerance/100.0;
return value > expected-delta && value < expected+delta;
}
|
java
|
public static boolean isAbout(double expected, double value, double tolerance)
{
double delta = expected*tolerance/100.0;
return value > expected-delta && value < expected+delta;
}
|
[
"public",
"static",
"boolean",
"isAbout",
"(",
"double",
"expected",
",",
"double",
"value",
",",
"double",
"tolerance",
")",
"{",
"double",
"delta",
"=",
"expected",
"*",
"tolerance",
"/",
"100.0",
";",
"return",
"value",
">",
"expected",
"-",
"delta",
"&&",
"value",
"<",
"expected",
"+",
"delta",
";",
"}"
] |
Returns true if value differs only tolerance percent.
@param expected
@param value
@param tolerance
@return
|
[
"Returns",
"true",
"if",
"value",
"differs",
"only",
"tolerance",
"percent",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/hffax/Fax.java#L52-L56
|
154,486
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/util/SwitchSubScreenHandler.java
|
SwitchSubScreenHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int moveMode)
{
int iScreenNo = (int)((NumberField)m_owner).getValue();
if ((iScreenNo == -1) || (iScreenNo == m_iCurrentScreenNo))
return DBConstants.NORMAL_RETURN;
ScreenLocation screenLocation = null;
// First, find the current sub-screen
this.setCurrentSubScreen(null); // Make your best guess as to the old sub-screen
// Display wait cursor
BaseAppletReference applet = null;
if (m_screenParent.getTask() instanceof BaseAppletReference)
applet = (BaseAppletReference)m_screenParent.getTask();
Object oldCursor = null;
if (applet != null)
oldCursor = applet.setStatus(DBConstants.WAIT, applet, null);
ScreenField sField = m_screenParent.getSField(m_iScreenSeq);
if ((sField != null) && (sField instanceof BaseScreen))
{ // First, get rid of the old screen
screenLocation = sField.getScreenLocation();
m_screenParent = sField.getParentScreen();
sField.free();
sField = null;
if (m_screenParent == null)
if (this.getOwner().getComponent(0) instanceof ScreenField) // Always
m_screenParent = ((ScreenField)this.getOwner().getComponent(0)).getParentScreen();
}
if (screenLocation == null)
screenLocation = m_screenParent.getNextLocation(ScreenConstants.FLUSH_LEFT, ScreenConstants.FILL_REMAINDER);
sField = this.getSubScreen(m_screenParent, screenLocation, null, iScreenNo);
if (applet != null)
applet.setStatus(0, applet, oldCursor);
if (sField == null)
m_iCurrentScreenNo = -1;
else
m_iCurrentScreenNo = iScreenNo;
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int moveMode)
{
int iScreenNo = (int)((NumberField)m_owner).getValue();
if ((iScreenNo == -1) || (iScreenNo == m_iCurrentScreenNo))
return DBConstants.NORMAL_RETURN;
ScreenLocation screenLocation = null;
// First, find the current sub-screen
this.setCurrentSubScreen(null); // Make your best guess as to the old sub-screen
// Display wait cursor
BaseAppletReference applet = null;
if (m_screenParent.getTask() instanceof BaseAppletReference)
applet = (BaseAppletReference)m_screenParent.getTask();
Object oldCursor = null;
if (applet != null)
oldCursor = applet.setStatus(DBConstants.WAIT, applet, null);
ScreenField sField = m_screenParent.getSField(m_iScreenSeq);
if ((sField != null) && (sField instanceof BaseScreen))
{ // First, get rid of the old screen
screenLocation = sField.getScreenLocation();
m_screenParent = sField.getParentScreen();
sField.free();
sField = null;
if (m_screenParent == null)
if (this.getOwner().getComponent(0) instanceof ScreenField) // Always
m_screenParent = ((ScreenField)this.getOwner().getComponent(0)).getParentScreen();
}
if (screenLocation == null)
screenLocation = m_screenParent.getNextLocation(ScreenConstants.FLUSH_LEFT, ScreenConstants.FILL_REMAINDER);
sField = this.getSubScreen(m_screenParent, screenLocation, null, iScreenNo);
if (applet != null)
applet.setStatus(0, applet, oldCursor);
if (sField == null)
m_iCurrentScreenNo = -1;
else
m_iCurrentScreenNo = iScreenNo;
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"{",
"int",
"iScreenNo",
"=",
"(",
"int",
")",
"(",
"(",
"NumberField",
")",
"m_owner",
")",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"(",
"iScreenNo",
"==",
"-",
"1",
")",
"||",
"(",
"iScreenNo",
"==",
"m_iCurrentScreenNo",
")",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"ScreenLocation",
"screenLocation",
"=",
"null",
";",
"// First, find the current sub-screen",
"this",
".",
"setCurrentSubScreen",
"(",
"null",
")",
";",
"// Make your best guess as to the old sub-screen",
"// Display wait cursor",
"BaseAppletReference",
"applet",
"=",
"null",
";",
"if",
"(",
"m_screenParent",
".",
"getTask",
"(",
")",
"instanceof",
"BaseAppletReference",
")",
"applet",
"=",
"(",
"BaseAppletReference",
")",
"m_screenParent",
".",
"getTask",
"(",
")",
";",
"Object",
"oldCursor",
"=",
"null",
";",
"if",
"(",
"applet",
"!=",
"null",
")",
"oldCursor",
"=",
"applet",
".",
"setStatus",
"(",
"DBConstants",
".",
"WAIT",
",",
"applet",
",",
"null",
")",
";",
"ScreenField",
"sField",
"=",
"m_screenParent",
".",
"getSField",
"(",
"m_iScreenSeq",
")",
";",
"if",
"(",
"(",
"sField",
"!=",
"null",
")",
"&&",
"(",
"sField",
"instanceof",
"BaseScreen",
")",
")",
"{",
"// First, get rid of the old screen",
"screenLocation",
"=",
"sField",
".",
"getScreenLocation",
"(",
")",
";",
"m_screenParent",
"=",
"sField",
".",
"getParentScreen",
"(",
")",
";",
"sField",
".",
"free",
"(",
")",
";",
"sField",
"=",
"null",
";",
"if",
"(",
"m_screenParent",
"==",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
"instanceof",
"ScreenField",
")",
"// Always",
"m_screenParent",
"=",
"(",
"(",
"ScreenField",
")",
"this",
".",
"getOwner",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
")",
".",
"getParentScreen",
"(",
")",
";",
"}",
"if",
"(",
"screenLocation",
"==",
"null",
")",
"screenLocation",
"=",
"m_screenParent",
".",
"getNextLocation",
"(",
"ScreenConstants",
".",
"FLUSH_LEFT",
",",
"ScreenConstants",
".",
"FILL_REMAINDER",
")",
";",
"sField",
"=",
"this",
".",
"getSubScreen",
"(",
"m_screenParent",
",",
"screenLocation",
",",
"null",
",",
"iScreenNo",
")",
";",
"if",
"(",
"applet",
"!=",
"null",
")",
"applet",
".",
"setStatus",
"(",
"0",
",",
"applet",
",",
"oldCursor",
")",
";",
"if",
"(",
"sField",
"==",
"null",
")",
"m_iCurrentScreenNo",
"=",
"-",
"1",
";",
"else",
"m_iCurrentScreenNo",
"=",
"iScreenNo",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
The Field has Changed.
Get the value of this listener's field and setup the new sub-screen.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
Change the sub-screen to coorespond to this screen number.
|
[
"The",
"Field",
"has",
"Changed",
".",
"Get",
"the",
"value",
"of",
"this",
"listener",
"s",
"field",
"and",
"setup",
"the",
"new",
"sub",
"-",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/util/SwitchSubScreenHandler.java#L105-L142
|
154,487
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/util/SwitchSubScreenHandler.java
|
SwitchSubScreenHandler.getSubScreen
|
public BasePanel getSubScreen(BasePanel parentScreen, ScreenLocation screenLocation, Map<String, Object> properties, int screenNo)
{
return null; // Must override
}
|
java
|
public BasePanel getSubScreen(BasePanel parentScreen, ScreenLocation screenLocation, Map<String, Object> properties, int screenNo)
{
return null; // Must override
}
|
[
"public",
"BasePanel",
"getSubScreen",
"(",
"BasePanel",
"parentScreen",
",",
"ScreenLocation",
"screenLocation",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"int",
"screenNo",
")",
"{",
"return",
"null",
";",
"// Must override",
"}"
] |
Build this sub-screen.
@param parentScreen The parent screen.
@param screenLocation The location to place the new sub-screen (null = same as current sub-screen).
@param iScreenNo The sub-screen to build.
|
[
"Build",
"this",
"sub",
"-",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/util/SwitchSubScreenHandler.java#L161-L164
|
154,488
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/util/SwitchSubScreenHandler.java
|
SwitchSubScreenHandler.setCurrentSubScreen
|
public void setCurrentSubScreen(BasePanel subScreen)
{
m_screenParent = null; // Screen's parent
m_iScreenSeq = -1;
if (subScreen != null)
m_screenParent = subScreen.getParentScreen(); // Screen's parent
if (m_screenParent == null) if (this.getOwner() != null) if (this.getOwner().getRecord() != null)
m_screenParent = (BaseScreen)this.getOwner().getRecord().getRecordOwner();
if (m_screenParent == null) if (this.getOwner() != null) if (this.getOwner().getComponent(0) instanceof ScreenField)
m_screenParent = ((ScreenField)this.getOwner().getComponent(0)).getParentScreen();
if (m_screenParent == null)
return;
int iBestGuess = -1;
for (m_iScreenSeq = 0; m_iScreenSeq < m_screenParent.getSFieldCount(); m_iScreenSeq++)
{
ScreenField sField = m_screenParent.getSField(m_iScreenSeq);
if (sField == subScreen)
return; // Found (m_iScreenSeq is correct)
if (sField instanceof BaseScreen)
iBestGuess = m_iScreenSeq;
}
m_iScreenSeq = iBestGuess;
}
|
java
|
public void setCurrentSubScreen(BasePanel subScreen)
{
m_screenParent = null; // Screen's parent
m_iScreenSeq = -1;
if (subScreen != null)
m_screenParent = subScreen.getParentScreen(); // Screen's parent
if (m_screenParent == null) if (this.getOwner() != null) if (this.getOwner().getRecord() != null)
m_screenParent = (BaseScreen)this.getOwner().getRecord().getRecordOwner();
if (m_screenParent == null) if (this.getOwner() != null) if (this.getOwner().getComponent(0) instanceof ScreenField)
m_screenParent = ((ScreenField)this.getOwner().getComponent(0)).getParentScreen();
if (m_screenParent == null)
return;
int iBestGuess = -1;
for (m_iScreenSeq = 0; m_iScreenSeq < m_screenParent.getSFieldCount(); m_iScreenSeq++)
{
ScreenField sField = m_screenParent.getSField(m_iScreenSeq);
if (sField == subScreen)
return; // Found (m_iScreenSeq is correct)
if (sField instanceof BaseScreen)
iBestGuess = m_iScreenSeq;
}
m_iScreenSeq = iBestGuess;
}
|
[
"public",
"void",
"setCurrentSubScreen",
"(",
"BasePanel",
"subScreen",
")",
"{",
"m_screenParent",
"=",
"null",
";",
"// Screen's parent",
"m_iScreenSeq",
"=",
"-",
"1",
";",
"if",
"(",
"subScreen",
"!=",
"null",
")",
"m_screenParent",
"=",
"subScreen",
".",
"getParentScreen",
"(",
")",
";",
"// Screen's parent",
"if",
"(",
"m_screenParent",
"==",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
"!=",
"null",
")",
"m_screenParent",
"=",
"(",
"BaseScreen",
")",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
";",
"if",
"(",
"m_screenParent",
"==",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
"instanceof",
"ScreenField",
")",
"m_screenParent",
"=",
"(",
"(",
"ScreenField",
")",
"this",
".",
"getOwner",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
")",
".",
"getParentScreen",
"(",
")",
";",
"if",
"(",
"m_screenParent",
"==",
"null",
")",
"return",
";",
"int",
"iBestGuess",
"=",
"-",
"1",
";",
"for",
"(",
"m_iScreenSeq",
"=",
"0",
";",
"m_iScreenSeq",
"<",
"m_screenParent",
".",
"getSFieldCount",
"(",
")",
";",
"m_iScreenSeq",
"++",
")",
"{",
"ScreenField",
"sField",
"=",
"m_screenParent",
".",
"getSField",
"(",
"m_iScreenSeq",
")",
";",
"if",
"(",
"sField",
"==",
"subScreen",
")",
"return",
";",
"// Found (m_iScreenSeq is correct)",
"if",
"(",
"sField",
"instanceof",
"BaseScreen",
")",
"iBestGuess",
"=",
"m_iScreenSeq",
";",
"}",
"m_iScreenSeq",
"=",
"iBestGuess",
";",
"}"
] |
Set up m_iScreenSeq so I can find this sub-screen.
@param subScreen The current sub-screen.
|
[
"Set",
"up",
"m_iScreenSeq",
"so",
"I",
"can",
"find",
"this",
"sub",
"-",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/util/SwitchSubScreenHandler.java#L169-L191
|
154,489
|
hoegertn/restdoc-java-server
|
src/main/java/org/restdoc/server/impl/RestDocGenerator.java
|
RestDocGenerator.init
|
public void init(final Class<?>[] classes, final GlobalHeader globalHeader, final String baseURI) {
if (!this.initialized.compareAndSet(false, true)) {
throw new RestDocException("Generator already initialized");
}
this.logger.info("Starting generation of RestDoc");
this.logger.info("Searching for RestDoc API classes");
if (globalHeader != null) {
if (globalHeader.getRequestHeader() != null) {
this.requestHeaderMap.putAll(globalHeader.getRequestHeader());
}
if (globalHeader.getResponseHeader() != null) {
this.responseHeaderMap.putAll(globalHeader.getResponseHeader());
}
if ((globalHeader.getAdditionalFields() != null) && !globalHeader.getAdditionalFields().isEmpty()) {
this.globalAdditional.putAll(globalHeader.getAdditionalFields());
}
}
for (final Class<?> apiClass : classes) {
// check if class provides predefined RestDoc
boolean scanNeeded = true;
if (Arrays.asList(apiClass.getInterfaces()).contains(IProvideRestDoc.class)) {
try {
this.logger.info("Class {} provides predefined RestDoc", apiClass.getCanonicalName());
final IProvideRestDoc apiObject = (IProvideRestDoc) apiClass.newInstance();
final RestResource[] restDocResources = apiObject.getRestDocResources();
for (final RestResource restResource : restDocResources) {
this.resources.put(restResource.getPath(), restResource);
}
this.schemaMap.putAll(apiObject.getRestDocSchemas());
scanNeeded = false;
} catch (final Exception e) {
// ignore it and fall back to annotation scan
}
}
if (scanNeeded) {
this.addResourcesOfClass(apiClass, baseURI);
}
}
}
|
java
|
public void init(final Class<?>[] classes, final GlobalHeader globalHeader, final String baseURI) {
if (!this.initialized.compareAndSet(false, true)) {
throw new RestDocException("Generator already initialized");
}
this.logger.info("Starting generation of RestDoc");
this.logger.info("Searching for RestDoc API classes");
if (globalHeader != null) {
if (globalHeader.getRequestHeader() != null) {
this.requestHeaderMap.putAll(globalHeader.getRequestHeader());
}
if (globalHeader.getResponseHeader() != null) {
this.responseHeaderMap.putAll(globalHeader.getResponseHeader());
}
if ((globalHeader.getAdditionalFields() != null) && !globalHeader.getAdditionalFields().isEmpty()) {
this.globalAdditional.putAll(globalHeader.getAdditionalFields());
}
}
for (final Class<?> apiClass : classes) {
// check if class provides predefined RestDoc
boolean scanNeeded = true;
if (Arrays.asList(apiClass.getInterfaces()).contains(IProvideRestDoc.class)) {
try {
this.logger.info("Class {} provides predefined RestDoc", apiClass.getCanonicalName());
final IProvideRestDoc apiObject = (IProvideRestDoc) apiClass.newInstance();
final RestResource[] restDocResources = apiObject.getRestDocResources();
for (final RestResource restResource : restDocResources) {
this.resources.put(restResource.getPath(), restResource);
}
this.schemaMap.putAll(apiObject.getRestDocSchemas());
scanNeeded = false;
} catch (final Exception e) {
// ignore it and fall back to annotation scan
}
}
if (scanNeeded) {
this.addResourcesOfClass(apiClass, baseURI);
}
}
}
|
[
"public",
"void",
"init",
"(",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
",",
"final",
"GlobalHeader",
"globalHeader",
",",
"final",
"String",
"baseURI",
")",
"{",
"if",
"(",
"!",
"this",
".",
"initialized",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"throw",
"new",
"RestDocException",
"(",
"\"Generator already initialized\"",
")",
";",
"}",
"this",
".",
"logger",
".",
"info",
"(",
"\"Starting generation of RestDoc\"",
")",
";",
"this",
".",
"logger",
".",
"info",
"(",
"\"Searching for RestDoc API classes\"",
")",
";",
"if",
"(",
"globalHeader",
"!=",
"null",
")",
"{",
"if",
"(",
"globalHeader",
".",
"getRequestHeader",
"(",
")",
"!=",
"null",
")",
"{",
"this",
".",
"requestHeaderMap",
".",
"putAll",
"(",
"globalHeader",
".",
"getRequestHeader",
"(",
")",
")",
";",
"}",
"if",
"(",
"globalHeader",
".",
"getResponseHeader",
"(",
")",
"!=",
"null",
")",
"{",
"this",
".",
"responseHeaderMap",
".",
"putAll",
"(",
"globalHeader",
".",
"getResponseHeader",
"(",
")",
")",
";",
"}",
"if",
"(",
"(",
"globalHeader",
".",
"getAdditionalFields",
"(",
")",
"!=",
"null",
")",
"&&",
"!",
"globalHeader",
".",
"getAdditionalFields",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"globalAdditional",
".",
"putAll",
"(",
"globalHeader",
".",
"getAdditionalFields",
"(",
")",
")",
";",
"}",
"}",
"for",
"(",
"final",
"Class",
"<",
"?",
">",
"apiClass",
":",
"classes",
")",
"{",
"// check if class provides predefined RestDoc",
"boolean",
"scanNeeded",
"=",
"true",
";",
"if",
"(",
"Arrays",
".",
"asList",
"(",
"apiClass",
".",
"getInterfaces",
"(",
")",
")",
".",
"contains",
"(",
"IProvideRestDoc",
".",
"class",
")",
")",
"{",
"try",
"{",
"this",
".",
"logger",
".",
"info",
"(",
"\"Class {} provides predefined RestDoc\"",
",",
"apiClass",
".",
"getCanonicalName",
"(",
")",
")",
";",
"final",
"IProvideRestDoc",
"apiObject",
"=",
"(",
"IProvideRestDoc",
")",
"apiClass",
".",
"newInstance",
"(",
")",
";",
"final",
"RestResource",
"[",
"]",
"restDocResources",
"=",
"apiObject",
".",
"getRestDocResources",
"(",
")",
";",
"for",
"(",
"final",
"RestResource",
"restResource",
":",
"restDocResources",
")",
"{",
"this",
".",
"resources",
".",
"put",
"(",
"restResource",
".",
"getPath",
"(",
")",
",",
"restResource",
")",
";",
"}",
"this",
".",
"schemaMap",
".",
"putAll",
"(",
"apiObject",
".",
"getRestDocSchemas",
"(",
")",
")",
";",
"scanNeeded",
"=",
"false",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"// ignore it and fall back to annotation scan",
"}",
"}",
"if",
"(",
"scanNeeded",
")",
"{",
"this",
".",
"addResourcesOfClass",
"(",
"apiClass",
",",
"baseURI",
")",
";",
"}",
"}",
"}"
] |
initialize the RestDoc Generator
@param classes the array of JAX-RS classes
@param globalHeader the global headers
@param baseURI an optional base uri like "/api"
|
[
"initialize",
"the",
"RestDoc",
"Generator"
] |
a9c86c21b59c7580c7997cc8a38e45928919b459
|
https://github.com/hoegertn/restdoc-java-server/blob/a9c86c21b59c7580c7997cc8a38e45928919b459/src/main/java/org/restdoc/server/impl/RestDocGenerator.java#L108-L148
|
154,490
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/sel/SelChannel.java
|
SelChannel.register
|
public SelKey register(ChannelSelector sel, Op ops, Object att)
{
if (selector != null)
{
throw new IllegalStateException("already registered with "+selector);
}
if (validOp != ops)
{
throw new IllegalArgumentException("expected "+validOp+" got "+ops);
}
key = sel.register(this, ops, att);
selector = sel;
return key;
}
|
java
|
public SelKey register(ChannelSelector sel, Op ops, Object att)
{
if (selector != null)
{
throw new IllegalStateException("already registered with "+selector);
}
if (validOp != ops)
{
throw new IllegalArgumentException("expected "+validOp+" got "+ops);
}
key = sel.register(this, ops, att);
selector = sel;
return key;
}
|
[
"public",
"SelKey",
"register",
"(",
"ChannelSelector",
"sel",
",",
"Op",
"ops",
",",
"Object",
"att",
")",
"{",
"if",
"(",
"selector",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"already registered with \"",
"+",
"selector",
")",
";",
"}",
"if",
"(",
"validOp",
"!=",
"ops",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expected \"",
"+",
"validOp",
"+",
"\" got \"",
"+",
"ops",
")",
";",
"}",
"key",
"=",
"sel",
".",
"register",
"(",
"this",
",",
"ops",
",",
"att",
")",
";",
"selector",
"=",
"sel",
";",
"return",
"key",
";",
"}"
] |
Registers channel for selection.
@param sel
@param ops
@param att
@return
|
[
"Registers",
"channel",
"for",
"selection",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/sel/SelChannel.java#L93-L106
|
154,491
|
jbundle/jbundle
|
app/program/demo/src/main/java/org/jbundle/app/program/demo/BaseRegistrationScreen.java
|
BaseRegistrationScreen.displayError
|
public void displayError(DBException ex)
{
if ((ex instanceof DatabaseException) && (ex.getErrorCode() == Constants.DUPLICATE_KEY))
this.displayError("Account already exists, sign-in using this user name", DBConstants.WARNING_MESSAGE);
else
super.displayError(ex);
}
|
java
|
public void displayError(DBException ex)
{
if ((ex instanceof DatabaseException) && (ex.getErrorCode() == Constants.DUPLICATE_KEY))
this.displayError("Account already exists, sign-in using this user name", DBConstants.WARNING_MESSAGE);
else
super.displayError(ex);
}
|
[
"public",
"void",
"displayError",
"(",
"DBException",
"ex",
")",
"{",
"if",
"(",
"(",
"ex",
"instanceof",
"DatabaseException",
")",
"&&",
"(",
"ex",
".",
"getErrorCode",
"(",
")",
"==",
"Constants",
".",
"DUPLICATE_KEY",
")",
")",
"this",
".",
"displayError",
"(",
"\"Account already exists, sign-in using this user name\"",
",",
"DBConstants",
".",
"WARNING_MESSAGE",
")",
";",
"else",
"super",
".",
"displayError",
"(",
"ex",
")",
";",
"}"
] |
DisplayError Method.
|
[
"DisplayError",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/demo/src/main/java/org/jbundle/app/program/demo/BaseRegistrationScreen.java#L435-L441
|
154,492
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ActiveSession.java
|
ActiveSession.after
|
@Override
protected void after() {
super.after();
if (adminSession != null) {
LOG.info("Logging off {}", adminSession.getUserID());
adminSession.logout();
adminSession = null;
}
if (anonSession != null) {
LOG.info("Logging off {}", anonSession.getUserID());
anonSession.logout();
anonSession = null;
}
for (final Session session : userSessions.values()) {
LOG.info("Logging off {}", session.getUserID());
session.logout();
}
userSessions.clear();
LOG.info("Closed all sessions");
}
|
java
|
@Override
protected void after() {
super.after();
if (adminSession != null) {
LOG.info("Logging off {}", adminSession.getUserID());
adminSession.logout();
adminSession = null;
}
if (anonSession != null) {
LOG.info("Logging off {}", anonSession.getUserID());
anonSession.logout();
anonSession = null;
}
for (final Session session : userSessions.values()) {
LOG.info("Logging off {}", session.getUserID());
session.logout();
}
userSessions.clear();
LOG.info("Closed all sessions");
}
|
[
"@",
"Override",
"protected",
"void",
"after",
"(",
")",
"{",
"super",
".",
"after",
"(",
")",
";",
"if",
"(",
"adminSession",
"!=",
"null",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Logging off {}\"",
",",
"adminSession",
".",
"getUserID",
"(",
")",
")",
";",
"adminSession",
".",
"logout",
"(",
")",
";",
"adminSession",
"=",
"null",
";",
"}",
"if",
"(",
"anonSession",
"!=",
"null",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Logging off {}\"",
",",
"anonSession",
".",
"getUserID",
"(",
")",
")",
";",
"anonSession",
".",
"logout",
"(",
")",
";",
"anonSession",
"=",
"null",
";",
"}",
"for",
"(",
"final",
"Session",
"session",
":",
"userSessions",
".",
"values",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Logging off {}\"",
",",
"session",
".",
"getUserID",
"(",
")",
")",
";",
"session",
".",
"logout",
"(",
")",
";",
"}",
"userSessions",
".",
"clear",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Closed all sessions\"",
")",
";",
"}"
] |
Closes all sessions
|
[
"Closes",
"all",
"sessions"
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ActiveSession.java#L66-L85
|
154,493
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ActiveSession.java
|
ActiveSession.login
|
public Session login() throws RepositoryException {
assertStateAfterOrEqual(State.CREATED);
final Session session;
if (username != null && password != null) {
session = getRepository().login(new SimpleCredentials(username, password.toCharArray()));
userSessions.put(username, session);
} else if (anonSession == null) {
anonSession = getRepository().login();
session = anonSession;
} else {
session = anonSession;
}
return session;
}
|
java
|
public Session login() throws RepositoryException {
assertStateAfterOrEqual(State.CREATED);
final Session session;
if (username != null && password != null) {
session = getRepository().login(new SimpleCredentials(username, password.toCharArray()));
userSessions.put(username, session);
} else if (anonSession == null) {
anonSession = getRepository().login();
session = anonSession;
} else {
session = anonSession;
}
return session;
}
|
[
"public",
"Session",
"login",
"(",
")",
"throws",
"RepositoryException",
"{",
"assertStateAfterOrEqual",
"(",
"State",
".",
"CREATED",
")",
";",
"final",
"Session",
"session",
";",
"if",
"(",
"username",
"!=",
"null",
"&&",
"password",
"!=",
"null",
")",
"{",
"session",
"=",
"getRepository",
"(",
")",
".",
"login",
"(",
"new",
"SimpleCredentials",
"(",
"username",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
")",
";",
"userSessions",
".",
"put",
"(",
"username",
",",
"session",
")",
";",
"}",
"else",
"if",
"(",
"anonSession",
"==",
"null",
")",
"{",
"anonSession",
"=",
"getRepository",
"(",
")",
".",
"login",
"(",
")",
";",
"session",
"=",
"anonSession",
";",
"}",
"else",
"{",
"session",
"=",
"anonSession",
";",
"}",
"return",
"session",
";",
"}"
] |
Logs into the repository. If a username and password has been specified, is is used for the login, otherwise an
anonymous login is done.
@return the session for the login
@throws RepositoryException
@throws LoginException
|
[
"Logs",
"into",
"the",
"repository",
".",
"If",
"a",
"username",
"and",
"password",
"has",
"been",
"specified",
"is",
"is",
"used",
"for",
"the",
"login",
"otherwise",
"an",
"anonymous",
"login",
"is",
"done",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ActiveSession.java#L103-L116
|
154,494
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ActiveSession.java
|
ActiveSession.login
|
public Session login(final String username, final String password) throws RepositoryException {
assertStateAfterOrEqual(State.CREATED);
if (!userSessions.containsKey(username)) {
userSessions.put(username, getRepository().login(new SimpleCredentials(username, password.toCharArray())));
}
return userSessions.get(username);
}
|
java
|
public Session login(final String username, final String password) throws RepositoryException {
assertStateAfterOrEqual(State.CREATED);
if (!userSessions.containsKey(username)) {
userSessions.put(username, getRepository().login(new SimpleCredentials(username, password.toCharArray())));
}
return userSessions.get(username);
}
|
[
"public",
"Session",
"login",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"throws",
"RepositoryException",
"{",
"assertStateAfterOrEqual",
"(",
"State",
".",
"CREATED",
")",
";",
"if",
"(",
"!",
"userSessions",
".",
"containsKey",
"(",
"username",
")",
")",
"{",
"userSessions",
".",
"put",
"(",
"username",
",",
"getRepository",
"(",
")",
".",
"login",
"(",
"new",
"SimpleCredentials",
"(",
"username",
",",
"password",
".",
"toCharArray",
"(",
")",
")",
")",
")",
";",
"}",
"return",
"userSessions",
".",
"get",
"(",
"username",
")",
";",
"}"
] |
Creates a login for the given username and password
@param username
the username to log in
@param password
the password to log in
@return the session for the user
@throws RepositoryException
|
[
"Creates",
"a",
"login",
"for",
"the",
"given",
"username",
"and",
"password"
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ActiveSession.java#L128-L134
|
154,495
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/IntArray.java
|
IntArray.getInstance
|
public static IntArray getInstance(byte[] buffer, int offset, int length)
{
return getInstance(buffer, offset, length, 8, ByteOrder.BIG_ENDIAN);
}
|
java
|
public static IntArray getInstance(byte[] buffer, int offset, int length)
{
return getInstance(buffer, offset, length, 8, ByteOrder.BIG_ENDIAN);
}
|
[
"public",
"static",
"IntArray",
"getInstance",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"getInstance",
"(",
"buffer",
",",
"offset",
",",
"length",
",",
"8",
",",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"}"
] |
Creates IntArray backed by byte array
@param buffer
@param offset
@param length
@return
|
[
"Creates",
"IntArray",
"backed",
"by",
"byte",
"array"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L73-L76
|
154,496
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/IntArray.java
|
IntArray.getInstance
|
public static IntArray getInstance(short[] buffer, int offset, int length)
{
return getInstance(ShortBuffer.wrap(buffer, offset, length));
}
|
java
|
public static IntArray getInstance(short[] buffer, int offset, int length)
{
return getInstance(ShortBuffer.wrap(buffer, offset, length));
}
|
[
"public",
"static",
"IntArray",
"getInstance",
"(",
"short",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"getInstance",
"(",
"ShortBuffer",
".",
"wrap",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
")",
";",
"}"
] |
Creates IntArray backed by short array
@param buffer
@param offset
@param length
@return
|
[
"Creates",
"IntArray",
"backed",
"by",
"short",
"array"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L117-L120
|
154,497
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/IntArray.java
|
IntArray.getInstance
|
public static IntArray getInstance(int[] buffer, int offset, int length)
{
return getInstance(IntBuffer.wrap(buffer, offset, length));
}
|
java
|
public static IntArray getInstance(int[] buffer, int offset, int length)
{
return getInstance(IntBuffer.wrap(buffer, offset, length));
}
|
[
"public",
"static",
"IntArray",
"getInstance",
"(",
"int",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"getInstance",
"(",
"IntBuffer",
".",
"wrap",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
")",
";",
"}"
] |
Creates IntArray backed by int array
@param buffer
@param offset
@param length
@return
|
[
"Creates",
"IntArray",
"backed",
"by",
"int",
"array"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L137-L140
|
154,498
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/IntArray.java
|
IntArray.getInstance
|
public static IntArray getInstance(int size, int bitCount, ByteOrder order)
{
switch (bitCount)
{
case 8:
return getInstance(new byte[size], bitCount, order);
case 16:
return getInstance(new byte[2*size], bitCount, order);
case 32:
return new InArray(size);
default:
throw new UnsupportedOperationException(bitCount+" not supported");
}
}
|
java
|
public static IntArray getInstance(int size, int bitCount, ByteOrder order)
{
switch (bitCount)
{
case 8:
return getInstance(new byte[size], bitCount, order);
case 16:
return getInstance(new byte[2*size], bitCount, order);
case 32:
return new InArray(size);
default:
throw new UnsupportedOperationException(bitCount+" not supported");
}
}
|
[
"public",
"static",
"IntArray",
"getInstance",
"(",
"int",
"size",
",",
"int",
"bitCount",
",",
"ByteOrder",
"order",
")",
"{",
"switch",
"(",
"bitCount",
")",
"{",
"case",
"8",
":",
"return",
"getInstance",
"(",
"new",
"byte",
"[",
"size",
"]",
",",
"bitCount",
",",
"order",
")",
";",
"case",
"16",
":",
"return",
"getInstance",
"(",
"new",
"byte",
"[",
"2",
"*",
"size",
"]",
",",
"bitCount",
",",
"order",
")",
";",
"case",
"32",
":",
"return",
"new",
"InArray",
"(",
"size",
")",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
"bitCount",
"+",
"\" not supported\"",
")",
";",
"}",
"}"
] |
Creates IntArray of given length, bitCount and byte-order
@param size
@param bitCount
@param order
@return
|
[
"Creates",
"IntArray",
"of",
"given",
"length",
"bitCount",
"and",
"byte",
"-",
"order"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L199-L212
|
154,499
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/IntArray.java
|
IntArray.copy
|
public void copy(IntArray to)
{
if (length() != to.length())
{
throw new IllegalArgumentException("array not same size");
}
if (buffer.hasArray() && to.buffer.hasArray() &&
buffer.array().getClass().getComponentType() == to.buffer.array().getClass().getComponentType())
{
System.arraycopy(to.buffer.array(), 0, buffer.array(), 0, length());
}
else
{
int len = length();
for (int ii=0;ii<len;ii++)
{
put(ii, to.get(ii));
}
}
}
|
java
|
public void copy(IntArray to)
{
if (length() != to.length())
{
throw new IllegalArgumentException("array not same size");
}
if (buffer.hasArray() && to.buffer.hasArray() &&
buffer.array().getClass().getComponentType() == to.buffer.array().getClass().getComponentType())
{
System.arraycopy(to.buffer.array(), 0, buffer.array(), 0, length());
}
else
{
int len = length();
for (int ii=0;ii<len;ii++)
{
put(ii, to.get(ii));
}
}
}
|
[
"public",
"void",
"copy",
"(",
"IntArray",
"to",
")",
"{",
"if",
"(",
"length",
"(",
")",
"!=",
"to",
".",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"array not same size\"",
")",
";",
"}",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
"&&",
"to",
".",
"buffer",
".",
"hasArray",
"(",
")",
"&&",
"buffer",
".",
"array",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
"==",
"to",
".",
"buffer",
".",
"array",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
")",
"{",
"System",
".",
"arraycopy",
"(",
"to",
".",
"buffer",
".",
"array",
"(",
")",
",",
"0",
",",
"buffer",
".",
"array",
"(",
")",
",",
"0",
",",
"length",
"(",
")",
")",
";",
"}",
"else",
"{",
"int",
"len",
"=",
"length",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"len",
";",
"ii",
"++",
")",
"{",
"put",
"(",
"ii",
",",
"to",
".",
"get",
"(",
"ii",
")",
")",
";",
"}",
"}",
"}"
] |
Copies given IntArrays values to this. Throws IllegalArgumentException
if lengths are not same.
@param to
|
[
"Copies",
"given",
"IntArrays",
"values",
"to",
"this",
".",
"Throws",
"IllegalArgumentException",
"if",
"lengths",
"are",
"not",
"same",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L250-L269
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.