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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
152,200 | js-lib-com/commons | src/main/java/js/util/Params.java | Params.isKindOf | public static void isKindOf(Type parameter, Type typeToMatch, String name) {
if (!Types.isKindOf(parameter, typeToMatch)) {
throw new IllegalArgumentException(Strings.format("%s is not %s.", name, typeToMatch));
}
} | java | public static void isKindOf(Type parameter, Type typeToMatch, String name) {
if (!Types.isKindOf(parameter, typeToMatch)) {
throw new IllegalArgumentException(Strings.format("%s is not %s.", name, typeToMatch));
}
} | [
"public",
"static",
"void",
"isKindOf",
"(",
"Type",
"parameter",
",",
"Type",
"typeToMatch",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"Types",
".",
"isKindOf",
"(",
"parameter",
",",
"typeToMatch",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentEx... | Test if parameter is of requested type and throw exception if not.
@param parameter invocation parameter,
@param typeToMatch type to match,
@param name the name of invocation parameter.
@throws IllegalArgumentException if parameter is not of requested type. | [
"Test",
"if",
"parameter",
"is",
"of",
"requested",
"type",
"and",
"throw",
"exception",
"if",
"not",
"."
] | f8c64482142b163487745da74feb106f0765c16b | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L541-L545 |
152,201 | carewebframework/carewebframework-vista | org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameters.java | RPCParameters.assign | public void assign(RPCParameters source) {
clear();
for (RPCParameter param : source.params) {
params.add(new RPCParameter(param));
}
} | java | public void assign(RPCParameters source) {
clear();
for (RPCParameter param : source.params) {
params.add(new RPCParameter(param));
}
} | [
"public",
"void",
"assign",
"(",
"RPCParameters",
"source",
")",
"{",
"clear",
"(",
")",
";",
"for",
"(",
"RPCParameter",
"param",
":",
"source",
".",
"params",
")",
"{",
"params",
".",
"add",
"(",
"new",
"RPCParameter",
"(",
"param",
")",
")",
";",
... | Copies parameters from another list to this one.
@param source Source parameter list. | [
"Copies",
"parameters",
"from",
"another",
"list",
"to",
"this",
"one",
"."
] | 883b2cbe395d9e8a21cd19db820f0876bda6b1c6 | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameters.java#L110-L116 |
152,202 | carewebframework/carewebframework-vista | org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameters.java | RPCParameters.put | public void put(int index, RPCParameter param) {
expand(index);
if (index < params.size()) {
params.set(index, param);
} else {
params.add(param);
}
} | java | public void put(int index, RPCParameter param) {
expand(index);
if (index < params.size()) {
params.set(index, param);
} else {
params.add(param);
}
} | [
"public",
"void",
"put",
"(",
"int",
"index",
",",
"RPCParameter",
"param",
")",
"{",
"expand",
"(",
"index",
")",
";",
"if",
"(",
"index",
"<",
"params",
".",
"size",
"(",
")",
")",
"{",
"params",
".",
"set",
"(",
"index",
",",
"param",
")",
";"... | Adds a parameter at the specified index.
@param index Index for parameter.
@param param Parameter to add. | [
"Adds",
"a",
"parameter",
"at",
"the",
"specified",
"index",
"."
] | 883b2cbe395d9e8a21cd19db820f0876bda6b1c6 | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameters.java#L124-L132 |
152,203 | tvesalainen/util | ham/src/main/java/org/vesalainen/ham/Station.java | Station.inMap | public boolean inMap(String name, Location location)
{
MapArea map = maps.get(name);
if (map == null)
{
throw new IllegalArgumentException(name);
}
return map.isInside(location);
} | java | public boolean inMap(String name, Location location)
{
MapArea map = maps.get(name);
if (map == null)
{
throw new IllegalArgumentException(name);
}
return map.isInside(location);
} | [
"public",
"boolean",
"inMap",
"(",
"String",
"name",
",",
"Location",
"location",
")",
"{",
"MapArea",
"map",
"=",
"maps",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"na... | Returns true if location is inside named map.
@param name
@param location
@return | [
"Returns",
"true",
"if",
"location",
"is",
"inside",
"named",
"map",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/Station.java#L57-L65 |
152,204 | tvesalainen/util | ham/src/main/java/org/vesalainen/ham/Station.java | Station.inAnyMap | public boolean inAnyMap(Location location)
{
return maps.values().stream().anyMatch((org.vesalainen.ham.MapArea m) -> m.isInside(location));
} | java | public boolean inAnyMap(Location location)
{
return maps.values().stream().anyMatch((org.vesalainen.ham.MapArea m) -> m.isInside(location));
} | [
"public",
"boolean",
"inAnyMap",
"(",
"Location",
"location",
")",
"{",
"return",
"maps",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"(",
"org",
".",
"vesalainen",
".",
"ham",
".",
"MapArea",
"m",
")",
"->",
"m",
".",
"... | Location is inside one of the maps.
@param location
@return | [
"Location",
"is",
"inside",
"one",
"of",
"the",
"maps",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/Station.java#L72-L75 |
152,205 | jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/MenuParser.java | MenuParser.getFirstNonWhitespace | public static int getFirstNonWhitespace(String strText)
{
if (strText != null)
{
for (int i = 0; i < strText.length(); i++)
{
if (!Character.isWhitespace(strText.charAt(i)))
return i;
}
}
return -1;
} | java | public static int getFirstNonWhitespace(String strText)
{
if (strText != null)
{
for (int i = 0; i < strText.length(); i++)
{
if (!Character.isWhitespace(strText.charAt(i)))
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"getFirstNonWhitespace",
"(",
"String",
"strText",
")",
"{",
"if",
"(",
"strText",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strText",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"... | Get the position of the first non-whitespace char.
@param strText
@return | [
"Get",
"the",
"position",
"of",
"the",
"first",
"non",
"-",
"whitespace",
"char",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/MenuParser.java#L98-L109 |
152,206 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/HashUtil.java | HashUtil.sha3 | public static byte[] sha3(byte[] input, int start, int length) {
Keccak256 digest = new Keccak256();
digest.update(input, start, length);
return digest.digest();
} | java | public static byte[] sha3(byte[] input, int start, int length) {
Keccak256 digest = new Keccak256();
digest.update(input, start, length);
return digest.digest();
} | [
"public",
"static",
"byte",
"[",
"]",
"sha3",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"Keccak256",
"digest",
"=",
"new",
"Keccak256",
"(",
")",
";",
"digest",
".",
"update",
"(",
"input",
",",
"start",
"... | hashing chunk of the data
@param input - data for hash
@param start - start of hashing chunk
@param length - length of hashing chunk
@return - keccak hash of the chunk | [
"hashing",
"chunk",
"of",
"the",
"data"
] | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/HashUtil.java#L78-L82 |
152,207 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/HashUtil.java | HashUtil.calcNewAddr | public static byte[] calcNewAddr(byte[] addr, byte[] nonce) {
byte[] encSender = RLP.encodeElement(addr);
byte[] encNonce = RLP.encodeBigInteger(new BigInteger(1, nonce));
return sha3omit12(RLP.encodeList(encSender, encNonce));
} | java | public static byte[] calcNewAddr(byte[] addr, byte[] nonce) {
byte[] encSender = RLP.encodeElement(addr);
byte[] encNonce = RLP.encodeBigInteger(new BigInteger(1, nonce));
return sha3omit12(RLP.encodeList(encSender, encNonce));
} | [
"public",
"static",
"byte",
"[",
"]",
"calcNewAddr",
"(",
"byte",
"[",
"]",
"addr",
",",
"byte",
"[",
"]",
"nonce",
")",
"{",
"byte",
"[",
"]",
"encSender",
"=",
"RLP",
".",
"encodeElement",
"(",
"addr",
")",
";",
"byte",
"[",
"]",
"encNonce",
"=",... | The way to calculate new address
@param addr - creating addres
@param nonce - nonce of creating address
@return new address | [
"The",
"way",
"to",
"calculate",
"new",
"address"
] | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/HashUtil.java#L123-L129 |
152,208 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/HashUtil.java | HashUtil.doubleDigest | public static byte[] doubleDigest(byte[] input, int offset, int length) {
synchronized (sha256digest) {
sha256digest.reset();
sha256digest.update(input, offset, length);
byte[] first = sha256digest.digest();
return sha256digest.digest(first);
}
} | java | public static byte[] doubleDigest(byte[] input, int offset, int length) {
synchronized (sha256digest) {
sha256digest.reset();
sha256digest.update(input, offset, length);
byte[] first = sha256digest.digest();
return sha256digest.digest(first);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"doubleDigest",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"synchronized",
"(",
"sha256digest",
")",
"{",
"sha256digest",
".",
"reset",
"(",
")",
";",
"sha256digest",
".",
... | Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again. This is
standard procedure in Bitcoin. The resulting hash is in big endian form.
@param input -
@param offset -
@param length -
@return - | [
"Calculates",
"the",
"SHA",
"-",
"256",
"hash",
"of",
"the",
"given",
"byte",
"range",
"and",
"then",
"hashes",
"the",
"resulting",
"hash",
"again",
".",
"This",
"is",
"standard",
"procedure",
"in",
"Bitcoin",
".",
"The",
"resulting",
"hash",
"is",
"in",
... | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/HashUtil.java#L150-L157 |
152,209 | jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HMenuScreen.java | HMenuScreen.getHtmlKeywords | public String getHtmlKeywords()
{
Record recMenu = this.getMainRecord();
if (recMenu.getField(MenusModel.KEYWORDS).getLength() > 0)
return recMenu.getField(MenusModel.KEYWORDS).toString();
else
return super.getHtmlKeywords();
} | java | public String getHtmlKeywords()
{
Record recMenu = this.getMainRecord();
if (recMenu.getField(MenusModel.KEYWORDS).getLength() > 0)
return recMenu.getField(MenusModel.KEYWORDS).toString();
else
return super.getHtmlKeywords();
} | [
"public",
"String",
"getHtmlKeywords",
"(",
")",
"{",
"Record",
"recMenu",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"recMenu",
".",
"getField",
"(",
"MenusModel",
".",
"KEYWORDS",
")",
".",
"getLength",
"(",
")",
">",
"0",
")",
"ret... | Get the Html keywords.
@return The Keywords. | [
"Get",
"the",
"Html",
"keywords",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HMenuScreen.java#L125-L132 |
152,210 | jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HMenuScreen.java | HMenuScreen.getHtmlMenudesc | public String getHtmlMenudesc()
{
Record recMenu = this.getMainRecord();
if (recMenu.getField(MenusModel.COMMENT).getLength() > 0)
return recMenu.getField(MenusModel.COMMENT).toString();
else
return super.getHtmlMenudesc();
} | java | public String getHtmlMenudesc()
{
Record recMenu = this.getMainRecord();
if (recMenu.getField(MenusModel.COMMENT).getLength() > 0)
return recMenu.getField(MenusModel.COMMENT).toString();
else
return super.getHtmlMenudesc();
} | [
"public",
"String",
"getHtmlMenudesc",
"(",
")",
"{",
"Record",
"recMenu",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"recMenu",
".",
"getField",
"(",
"MenusModel",
".",
"COMMENT",
")",
".",
"getLength",
"(",
")",
">",
"0",
")",
"retu... | Get the Html Description.
@return The menu description. | [
"Get",
"the",
"Html",
"Description",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HMenuScreen.java#L137-L144 |
152,211 | knowhowlab/org.knowhowlab.osgi.shell | equinox/src/main/java/org/knowhowlab/osgi/shell/equinox/AbstractEquinoxCommandProvider.java | AbstractEquinoxCommandProvider.fetchCommandParams | protected String[] fetchCommandParams(CommandInterpreter interpreter) {
List<String> result = new ArrayList<String>();
String param;
while ((param = interpreter.nextArgument()) != null) {
result.add(param);
}
return result.toArray(new String[result.size()]);
} | java | protected String[] fetchCommandParams(CommandInterpreter interpreter) {
List<String> result = new ArrayList<String>();
String param;
while ((param = interpreter.nextArgument()) != null) {
result.add(param);
}
return result.toArray(new String[result.size()]);
} | [
"protected",
"String",
"[",
"]",
"fetchCommandParams",
"(",
"CommandInterpreter",
"interpreter",
")",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"param",
";",
"while",
"(",
"(",
"param",... | Fetch command line arguments from source
@param interpreter argument source
@return not <code>null</code> arguments array | [
"Fetch",
"command",
"line",
"arguments",
"from",
"source"
] | 5c3172b1e6b741c753f02af48ab42adc4915a6ae | https://github.com/knowhowlab/org.knowhowlab.osgi.shell/blob/5c3172b1e6b741c753f02af48ab42adc4915a6ae/equinox/src/main/java/org/knowhowlab/osgi/shell/equinox/AbstractEquinoxCommandProvider.java#L61-L68 |
152,212 | tvesalainen/util | util/src/main/java/org/vesalainen/util/navi/Velocity.java | Velocity.getTimeSpan | public TimeSpan getTimeSpan(Distance distance)
{
return new TimeSpan((long)(1000*distance.getMeters()/value), TimeUnit.MILLISECONDS);
} | java | public TimeSpan getTimeSpan(Distance distance)
{
return new TimeSpan((long)(1000*distance.getMeters()/value), TimeUnit.MILLISECONDS);
} | [
"public",
"TimeSpan",
"getTimeSpan",
"(",
"Distance",
"distance",
")",
"{",
"return",
"new",
"TimeSpan",
"(",
"(",
"long",
")",
"(",
"1000",
"*",
"distance",
".",
"getMeters",
"(",
")",
"/",
"value",
")",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
... | Returns the time span taken to move the distance
@param distance
@return | [
"Returns",
"the",
"time",
"span",
"taken",
"to",
"move",
"the",
"distance"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Velocity.java#L64-L67 |
152,213 | tvesalainen/util | util/src/main/java/org/vesalainen/util/navi/Velocity.java | Velocity.getThere | public Date getThere(Date start, Distance distance)
{
TimeSpan timeSpan = getTimeSpan(distance);
return timeSpan.addDate(start);
} | java | public Date getThere(Date start, Distance distance)
{
TimeSpan timeSpan = getTimeSpan(distance);
return timeSpan.addDate(start);
} | [
"public",
"Date",
"getThere",
"(",
"Date",
"start",
",",
"Distance",
"distance",
")",
"{",
"TimeSpan",
"timeSpan",
"=",
"getTimeSpan",
"(",
"distance",
")",
";",
"return",
"timeSpan",
".",
"addDate",
"(",
"start",
")",
";",
"}"
] | Returns the time we are there if we started at start
@param start Starting time
@param distance Distance to meve
@return | [
"Returns",
"the",
"time",
"we",
"are",
"there",
"if",
"we",
"started",
"at",
"start"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Velocity.java#L74-L78 |
152,214 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.mul | public static final Point mul(double k, Point p)
{
return new AbstractPoint(k*p.getX(), k*p.getY());
} | java | public static final Point mul(double k, Point p)
{
return new AbstractPoint(k*p.getX(), k*p.getY());
} | [
"public",
"static",
"final",
"Point",
"mul",
"(",
"double",
"k",
",",
"Point",
"p",
")",
"{",
"return",
"new",
"AbstractPoint",
"(",
"k",
"*",
"p",
".",
"getX",
"(",
")",
",",
"k",
"*",
"p",
".",
"getY",
"(",
")",
")",
";",
"}"
] | multiply p's x and y with k.
@param k
@param p
@return A new Point | [
"multiply",
"p",
"s",
"x",
"and",
"y",
"with",
"k",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L104-L107 |
152,215 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.add | public static final Point add(Point... points)
{
AbstractPoint res = new AbstractPoint();
for (Point pp : points)
{
res.x += pp.getX();
res.y += pp.getY();
}
return res;
} | java | public static final Point add(Point... points)
{
AbstractPoint res = new AbstractPoint();
for (Point pp : points)
{
res.x += pp.getX();
res.y += pp.getY();
}
return res;
} | [
"public",
"static",
"final",
"Point",
"add",
"(",
"Point",
"...",
"points",
")",
"{",
"AbstractPoint",
"res",
"=",
"new",
"AbstractPoint",
"(",
")",
";",
"for",
"(",
"Point",
"pp",
":",
"points",
")",
"{",
"res",
".",
"x",
"+=",
"pp",
".",
"getX",
... | Sums points x values to x values and y values to y values
@param points
@return A new Point | [
"Sums",
"points",
"x",
"values",
"to",
"x",
"values",
"and",
"y",
"values",
"to",
"y",
"values"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L113-L122 |
152,216 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.distance | public static final double distance(Point p1, Point p2)
{
return Math.hypot(p1.getX() - p2.getX(), p1.getY() - p2.getY());
} | java | public static final double distance(Point p1, Point p2)
{
return Math.hypot(p1.getX() - p2.getX(), p1.getY() - p2.getY());
} | [
"public",
"static",
"final",
"double",
"distance",
"(",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"return",
"Math",
".",
"hypot",
"(",
"p1",
".",
"getX",
"(",
")",
"-",
"p2",
".",
"getX",
"(",
")",
",",
"p1",
".",
"getY",
"(",
")",
"-",
"p2"... | Calculates the distance between points
@param p1
@param p2
@return | [
"Calculates",
"the",
"distance",
"between",
"points"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L139-L142 |
152,217 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.move | public static final Point move(Point p, double radians, double distance)
{
return new AbstractPoint(
p.getX() + distance*Math.cos(radians),
p.getY() + distance*Math.sin(radians)
);
} | java | public static final Point move(Point p, double radians, double distance)
{
return new AbstractPoint(
p.getX() + distance*Math.cos(radians),
p.getY() + distance*Math.sin(radians)
);
} | [
"public",
"static",
"final",
"Point",
"move",
"(",
"Point",
"p",
",",
"double",
"radians",
",",
"double",
"distance",
")",
"{",
"return",
"new",
"AbstractPoint",
"(",
"p",
".",
"getX",
"(",
")",
"+",
"distance",
"*",
"Math",
".",
"cos",
"(",
"radians",... | Creates a new Point distance from p to radians direction
@param p Start point
@param radians Angle in radians
@param distance Distance
@return A new Point | [
"Creates",
"a",
"new",
"Point",
"distance",
"from",
"p",
"to",
"radians",
"direction"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L164-L170 |
152,218 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.toArray | public static final double[] toArray(Point... points)
{
double[] res = new double[2*points.length];
int idx = 0;
for (Point pp : points)
{
res[idx++] = pp.getX();
res[idx++] = pp.getY();
}
return res;
} | java | public static final double[] toArray(Point... points)
{
double[] res = new double[2*points.length];
int idx = 0;
for (Point pp : points)
{
res[idx++] = pp.getX();
res[idx++] = pp.getY();
}
return res;
} | [
"public",
"static",
"final",
"double",
"[",
"]",
"toArray",
"(",
"Point",
"...",
"points",
")",
"{",
"double",
"[",
"]",
"res",
"=",
"new",
"double",
"[",
"2",
"*",
"points",
".",
"length",
"]",
";",
"int",
"idx",
"=",
"0",
";",
"for",
"(",
"Poin... | Creates an array for points p1, p2,...
@param points
@return An array of [p1.x, p1.y, p2.x, p2.y, ...] | [
"Creates",
"an",
"array",
"for",
"points",
"p1",
"p2",
"..."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L184-L194 |
152,219 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.midPoints | public static final Point[] midPoints(int count, Point p1, Point p2)
{
Point[] res = new Point[count];
Point gap = AbstractPoint.subtract(p2, p1);
Point leg = AbstractPoint.mul((double)(1)/(double)(count+1), gap);
for (int ii=0;ii<count;ii++)
{
res[ii] = AbstractPoint.add(p1, AbstractPoint.mul(ii+1, leg));
}
return res;
} | java | public static final Point[] midPoints(int count, Point p1, Point p2)
{
Point[] res = new Point[count];
Point gap = AbstractPoint.subtract(p2, p1);
Point leg = AbstractPoint.mul((double)(1)/(double)(count+1), gap);
for (int ii=0;ii<count;ii++)
{
res[ii] = AbstractPoint.add(p1, AbstractPoint.mul(ii+1, leg));
}
return res;
} | [
"public",
"static",
"final",
"Point",
"[",
"]",
"midPoints",
"(",
"int",
"count",
",",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"Point",
"[",
"]",
"res",
"=",
"new",
"Point",
"[",
"count",
"]",
";",
"Point",
"gap",
"=",
"AbstractPoint",
".",
"s... | Creates evenly spaced midpoints in a line between p1 and p2
Example if count = 1 it creates point in the midle of p1 and p2
@param count How many points are created
@param p1 First point
@param p2 Second Point
@return Array of evenly spaced points in a line between p1 and p2 | [
"Creates",
"evenly",
"spaced",
"midpoints",
"in",
"a",
"line",
"between",
"p1",
"and",
"p2",
"Example",
"if",
"count",
"=",
"1",
"it",
"creates",
"point",
"in",
"the",
"midle",
"of",
"p1",
"and",
"p2"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L275-L285 |
152,220 | tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractPoint.java | AbstractPoint.searchX | public static final int searchX(Point[] points, Point key)
{
return Arrays.binarySearch(points, key, xcomp);
} | java | public static final int searchX(Point[] points, Point key)
{
return Arrays.binarySearch(points, key, xcomp);
} | [
"public",
"static",
"final",
"int",
"searchX",
"(",
"Point",
"[",
"]",
"points",
",",
"Point",
"key",
")",
"{",
"return",
"Arrays",
".",
"binarySearch",
"(",
"points",
",",
"key",
",",
"xcomp",
")",
";",
"}"
] | Searches given key in array in x-order
@param points
@param key
@return Like in Arrays.binarySearch
@see java.util.Arrays | [
"Searches",
"given",
"key",
"in",
"array",
"in",
"x",
"-",
"order"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractPoint.java#L293-L296 |
152,221 | jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/AmtDescConverter.java | AmtDescConverter.initConstants | public void initConstants()
{
if (NUMBERS != null)
return;
if (((BaseField)this.getField()).getRecord().getRecordOwner() != null)
{
org.jbundle.model.Task task = ((BaseField)this.getField()).getRecord().getRecordOwner().getTask();
ResourceBundle resources = ((BaseApplication)task.getApplication()).getResources(ResourceConstants.AMOUNT_RESOURCE, true);
NUMBERS = new String[10];
for (int i = 0; i < 10; i++)
{
NUMBERS[i] = resources.getString(Integer.toString(i));
}
TEENS = new String[10];
for (int i = 10; i < 20; i++)
{
TEENS[i - 10] = resources.getString(Integer.toString(i));
}
TENS = new String[10];
for (int i = 2; i < 10; i++)
{
TENS[i] = resources.getString(Integer.toString(i * 10));
}
HUNDRED = resources.getString("100");
THOUSAND = resources.getString("1000");
MILLION = resources.getString("1000000");
BILLION = resources.getString("1000000000");
AND = resources.getString("&");
}
else
{
NUMBERS[0] = "Zero";NUMBERS[1] = "One";NUMBERS[2] = "Two";NUMBERS[3] = "Three";NUMBERS[4] = "Four";
NUMBERS[5] = "Five";NUMBERS[6] = "Six";NUMBERS[7] = "Seven";NUMBERS[8] = "Eight";NUMBERS[9] = "Nine";
TEENS[0] = "ten";TEENS[1] = "Eleven";TEENS[2] = "Twelve";TEENS[3] = "Thirteen";TEENS[4] = "Fourteen";
TEENS[5] = "Fifteen";TEENS[6] = "Sixteen";TEENS[7] = "Seventeen";TEENS[8] = "Eighteen";TEENS[9] = "Nineteen";
TENS[0] = Constants.BLANK;TENS[1] = Constants.BLANK;TENS[2] = "Twenty";TENS[3] = "Thirty";TENS[4] = "Forty";
TENS[5] = "Fifty";TENS[6] = "Sixty";TENS[7] = "Seventy";TENS[8] = "Eighty";TENS[9] = "Ninety";
HUNDRED = "Hundred";
THOUSAND = "Thousand";
MILLION = "Million";
BILLION = "Billion";
AND = "and";
}
} | java | public void initConstants()
{
if (NUMBERS != null)
return;
if (((BaseField)this.getField()).getRecord().getRecordOwner() != null)
{
org.jbundle.model.Task task = ((BaseField)this.getField()).getRecord().getRecordOwner().getTask();
ResourceBundle resources = ((BaseApplication)task.getApplication()).getResources(ResourceConstants.AMOUNT_RESOURCE, true);
NUMBERS = new String[10];
for (int i = 0; i < 10; i++)
{
NUMBERS[i] = resources.getString(Integer.toString(i));
}
TEENS = new String[10];
for (int i = 10; i < 20; i++)
{
TEENS[i - 10] = resources.getString(Integer.toString(i));
}
TENS = new String[10];
for (int i = 2; i < 10; i++)
{
TENS[i] = resources.getString(Integer.toString(i * 10));
}
HUNDRED = resources.getString("100");
THOUSAND = resources.getString("1000");
MILLION = resources.getString("1000000");
BILLION = resources.getString("1000000000");
AND = resources.getString("&");
}
else
{
NUMBERS[0] = "Zero";NUMBERS[1] = "One";NUMBERS[2] = "Two";NUMBERS[3] = "Three";NUMBERS[4] = "Four";
NUMBERS[5] = "Five";NUMBERS[6] = "Six";NUMBERS[7] = "Seven";NUMBERS[8] = "Eight";NUMBERS[9] = "Nine";
TEENS[0] = "ten";TEENS[1] = "Eleven";TEENS[2] = "Twelve";TEENS[3] = "Thirteen";TEENS[4] = "Fourteen";
TEENS[5] = "Fifteen";TEENS[6] = "Sixteen";TEENS[7] = "Seventeen";TEENS[8] = "Eighteen";TEENS[9] = "Nineteen";
TENS[0] = Constants.BLANK;TENS[1] = Constants.BLANK;TENS[2] = "Twenty";TENS[3] = "Thirty";TENS[4] = "Forty";
TENS[5] = "Fifty";TENS[6] = "Sixty";TENS[7] = "Seventy";TENS[8] = "Eighty";TENS[9] = "Ninety";
HUNDRED = "Hundred";
THOUSAND = "Thousand";
MILLION = "Million";
BILLION = "Billion";
AND = "and";
}
} | [
"public",
"void",
"initConstants",
"(",
")",
"{",
"if",
"(",
"NUMBERS",
"!=",
"null",
")",
"return",
";",
"if",
"(",
"(",
"(",
"BaseField",
")",
"this",
".",
"getField",
"(",
")",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
"!... | Init the number constants. | [
"Init",
"the",
"number",
"constants",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/AmtDescConverter.java#L161-L208 |
152,222 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/ByteUtils.java | ByteUtils.toBase58 | public static String toBase58(byte[] b) {
if (b.length == 0) {
return "";
}
int lz = 0;
while (lz < b.length && b[lz] == 0) {
++lz;
}
StringBuilder s = new StringBuilder();
BigInteger n = new BigInteger(1, b);
while (n.compareTo(BigInteger.ZERO) > 0) {
BigInteger[] r = n.divideAndRemainder(BigInteger.valueOf(58));
n = r[0];
char digit = b58[r[1].intValue()];
s.append(digit);
}
while (lz > 0) {
--lz;
s.append("1");
}
return s.reverse().toString();
} | java | public static String toBase58(byte[] b) {
if (b.length == 0) {
return "";
}
int lz = 0;
while (lz < b.length && b[lz] == 0) {
++lz;
}
StringBuilder s = new StringBuilder();
BigInteger n = new BigInteger(1, b);
while (n.compareTo(BigInteger.ZERO) > 0) {
BigInteger[] r = n.divideAndRemainder(BigInteger.valueOf(58));
n = r[0];
char digit = b58[r[1].intValue()];
s.append(digit);
}
while (lz > 0) {
--lz;
s.append("1");
}
return s.reverse().toString();
} | [
"public",
"static",
"String",
"toBase58",
"(",
"byte",
"[",
"]",
"b",
")",
"{",
"if",
"(",
"b",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"int",
"lz",
"=",
"0",
";",
"while",
"(",
"lz",
"<",
"b",
".",
"length",
"&&",
"b"... | convert a byte array to a human readable base58 string. Base58 is a Bitcoin
specific encoding similar to widely used base64 but avoids using characters
of similar shape, such as 1 and l or O an 0
@param b
byte data
@return base58 data | [
"convert",
"a",
"byte",
"array",
"to",
"a",
"human",
"readable",
"base58",
"string",
".",
"Base58",
"is",
"a",
"Bitcoin",
"specific",
"encoding",
"similar",
"to",
"widely",
"used",
"base64",
"but",
"avoids",
"using",
"characters",
"of",
"similar",
"shape",
"... | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtils.java#L52-L75 |
152,223 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/ByteUtils.java | ByteUtils.toBase58WithChecksum | public static String toBase58WithChecksum(byte[] b) {
byte[] cs = Hash.hash(b);
byte[] extended = new byte[b.length + 4];
System.arraycopy(b, 0, extended, 0, b.length);
System.arraycopy(cs, 0, extended, b.length, 4);
return toBase58(extended);
} | java | public static String toBase58WithChecksum(byte[] b) {
byte[] cs = Hash.hash(b);
byte[] extended = new byte[b.length + 4];
System.arraycopy(b, 0, extended, 0, b.length);
System.arraycopy(cs, 0, extended, b.length, 4);
return toBase58(extended);
} | [
"public",
"static",
"String",
"toBase58WithChecksum",
"(",
"byte",
"[",
"]",
"b",
")",
"{",
"byte",
"[",
"]",
"cs",
"=",
"Hash",
".",
"hash",
"(",
"b",
")",
";",
"byte",
"[",
"]",
"extended",
"=",
"new",
"byte",
"[",
"b",
".",
"length",
"+",
"4",... | Encode in base58 with an added checksum of four bytes.
@param b
byte[] data
@return toBase58WithChecksum | [
"Encode",
"in",
"base58",
"with",
"an",
"added",
"checksum",
"of",
"four",
"bytes",
"."
] | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtils.java#L84-L90 |
152,224 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/ByteUtils.java | ByteUtils.reverse | public static byte[] reverse(byte[] data) {
for (int i = 0, j = data.length - 1; i < data.length / 2; i++, j--) {
data[i] ^= data[j];
data[j] ^= data[i];
data[i] ^= data[j];
}
return data;
} | java | public static byte[] reverse(byte[] data) {
for (int i = 0, j = data.length - 1; i < data.length / 2; i++, j--) {
data[i] ^= data[j];
data[j] ^= data[i];
data[i] ^= data[j];
}
return data;
} | [
"public",
"static",
"byte",
"[",
"]",
"reverse",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"data",
".",
"length",
"-",
"1",
";",
"i",
"<",
"data",
".",
"length",
"/",
"2",
";",
"i",
"++",
",",... | reverse a byte array in place WARNING the parameter array is altered and
returned.
@param data
ori data
@return reverse data | [
"reverse",
"a",
"byte",
"array",
"in",
"place",
"WARNING",
"the",
"parameter",
"array",
"is",
"altered",
"and",
"returned",
"."
] | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtils.java#L100-L107 |
152,225 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/ByteUtils.java | ByteUtils.fromHex | public static byte[] fromHex(String hex) {
try {
return Hex.decodeHex(hex.toCharArray());
} catch (DecoderException e) {
return null;
}
} | java | public static byte[] fromHex(String hex) {
try {
return Hex.decodeHex(hex.toCharArray());
} catch (DecoderException e) {
return null;
}
} | [
"public",
"static",
"byte",
"[",
"]",
"fromHex",
"(",
"String",
"hex",
")",
"{",
"try",
"{",
"return",
"Hex",
".",
"decodeHex",
"(",
"hex",
".",
"toCharArray",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DecoderException",
"e",
")",
"{",
"return",
"null"... | recreate a byte array from hexadecimal
@param hex
string data
@return byte[] data | [
"recreate",
"a",
"byte",
"array",
"from",
"hexadecimal"
] | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtils.java#L127-L133 |
152,226 | jbundle/jbundle | base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalDatabase.java | PhysicalDatabase.open | public void open() throws DBException
{
if (m_pDatabase == null)
{
PhysicalDatabaseParent pDBParent = null;
Environment env = (Environment)this.getDatabaseOwner().getEnvironment();
if (env != null)
pDBParent = (PhysicalDatabaseParent)env.getPDatabaseParent(mapDBParentProperties, true);
String databaseName = this.getDatabaseName(true);
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
else if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
char strPDatabaseType = this.getPDatabaseType();
m_pDatabase = pDBParent.getPDatabase(databaseName, strPDatabaseType, false);
if (m_pDatabase == null)
m_pDatabase = this.makePDatabase(pDBParent, databaseName);
m_pDatabase.addPDatabaseOwner(this);
}
m_pDatabase.open();
super.open(); // Do any inherited
} | java | public void open() throws DBException
{
if (m_pDatabase == null)
{
PhysicalDatabaseParent pDBParent = null;
Environment env = (Environment)this.getDatabaseOwner().getEnvironment();
if (env != null)
pDBParent = (PhysicalDatabaseParent)env.getPDatabaseParent(mapDBParentProperties, true);
String databaseName = this.getDatabaseName(true);
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
else if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
char strPDatabaseType = this.getPDatabaseType();
m_pDatabase = pDBParent.getPDatabase(databaseName, strPDatabaseType, false);
if (m_pDatabase == null)
m_pDatabase = this.makePDatabase(pDBParent, databaseName);
m_pDatabase.addPDatabaseOwner(this);
}
m_pDatabase.open();
super.open(); // Do any inherited
} | [
"public",
"void",
"open",
"(",
")",
"throws",
"DBException",
"{",
"if",
"(",
"m_pDatabase",
"==",
"null",
")",
"{",
"PhysicalDatabaseParent",
"pDBParent",
"=",
"null",
";",
"Environment",
"env",
"=",
"(",
"Environment",
")",
"this",
".",
"getDatabaseOwner",
... | Open the database.
If this is the first time, a raw data database is created.
@exception DBException. | [
"Open",
"the",
"database",
".",
"If",
"this",
"is",
"the",
"first",
"time",
"a",
"raw",
"data",
"database",
"is",
"created",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalDatabase.java#L92-L114 |
152,227 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.addPTableOwner | public int addPTableOwner(ThinPhysicalTableOwner pTableOwner)
{
if (pTableOwner != null)
{
m_lTimeLastUsed = System.currentTimeMillis();
m_setPTableOwners.add(pTableOwner);
pTableOwner.setPTable(this);
}
return m_setPTableOwners.size();
} | java | public int addPTableOwner(ThinPhysicalTableOwner pTableOwner)
{
if (pTableOwner != null)
{
m_lTimeLastUsed = System.currentTimeMillis();
m_setPTableOwners.add(pTableOwner);
pTableOwner.setPTable(this);
}
return m_setPTableOwners.size();
} | [
"public",
"int",
"addPTableOwner",
"(",
"ThinPhysicalTableOwner",
"pTableOwner",
")",
"{",
"if",
"(",
"pTableOwner",
"!=",
"null",
")",
"{",
"m_lTimeLastUsed",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"m_setPTableOwners",
".",
"add",
"(",
"pTableO... | Bump the use count.
This doesn't have to be synchronized because getPTable in PDatabase is.
@param pTableOwner The table owner to add.
@return The new use count. | [
"Bump",
"the",
"use",
"count",
".",
"This",
"doesn",
"t",
"have",
"to",
"be",
"synchronized",
"because",
"getPTable",
"in",
"PDatabase",
"is",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L134-L143 |
152,228 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.removePTableOwner | public synchronized int removePTableOwner(ThinPhysicalTableOwner pTableOwner, boolean bFreeIfEmpty)
{
if (pTableOwner != null)
{
m_setPTableOwners.remove(pTableOwner);
pTableOwner.setPTable(null);
}
if (m_setPTableOwners.size() == 0)
if (bFreeIfEmpty)
{
this.free();
return 0;
}
m_lTimeLastUsed = System.currentTimeMillis();
return m_setPTableOwners.size();
} | java | public synchronized int removePTableOwner(ThinPhysicalTableOwner pTableOwner, boolean bFreeIfEmpty)
{
if (pTableOwner != null)
{
m_setPTableOwners.remove(pTableOwner);
pTableOwner.setPTable(null);
}
if (m_setPTableOwners.size() == 0)
if (bFreeIfEmpty)
{
this.free();
return 0;
}
m_lTimeLastUsed = System.currentTimeMillis();
return m_setPTableOwners.size();
} | [
"public",
"synchronized",
"int",
"removePTableOwner",
"(",
"ThinPhysicalTableOwner",
"pTableOwner",
",",
"boolean",
"bFreeIfEmpty",
")",
"{",
"if",
"(",
"pTableOwner",
"!=",
"null",
")",
"{",
"m_setPTableOwners",
".",
"remove",
"(",
"pTableOwner",
")",
";",
"pTabl... | Free this table if it is no longer being used.
@param pTableOwner The table owner to remove. | [
"Free",
"this",
"table",
"if",
"it",
"is",
"no",
"longer",
"being",
"used",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L148-L163 |
152,229 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.remove | public synchronized void remove(FieldTable table) throws DBException
{
BaseBuffer bufferOld = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
{ // Delete the current key.
KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);
this.getPKeyArea(iKeyArea).doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
}
bufferOld.free(); // Get rid of the old one
table.setDataSource(null); // same as .doSetHandle(null, Constants.DATA_SOURCE_HANDLE);
} | java | public synchronized void remove(FieldTable table) throws DBException
{
BaseBuffer bufferOld = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
{ // Delete the current key.
KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);
this.getPKeyArea(iKeyArea).doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
}
bufferOld.free(); // Get rid of the old one
table.setDataSource(null); // same as .doSetHandle(null, Constants.DATA_SOURCE_HANDLE);
} | [
"public",
"synchronized",
"void",
"remove",
"(",
"FieldTable",
"table",
")",
"throws",
"DBException",
"{",
"BaseBuffer",
"bufferOld",
"=",
"(",
"BaseBuffer",
")",
"table",
".",
"getDataSource",
"(",
")",
";",
"// same as .getHandle(Constants.DATA_SOURCE_HANDLE);",
"fo... | Delete this record.
@param table The table.
@exception DBException File exception. | [
"Delete",
"this",
"record",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L362-L373 |
152,230 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.move | public synchronized BaseBuffer move(int iRelPosition, FieldTable table) throws DBException
{
int iKeyOrder = table.getRecord().getDefaultOrder();
if (iKeyOrder == -1)
iKeyOrder = Constants.MAIN_KEY_AREA;
KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyOrder);
PKeyArea vKeyArea = this.getPKeyArea(iKeyOrder);
// First, compare the current position with the record you are trying to read past.
BaseBuffer buffer = (BaseBuffer)table.getDataSource();
if ((iRelPosition != Constants.FIRST_RECORD)
&& (iRelPosition != Constants.LAST_RECORD))
if (!vKeyArea.atCurrent(buffer))
{
keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA); // Move these keys back to the record
if (keyArea.getUniqueKeyCode() != Constants.UNIQUE) // The main key is part of the comparison
table.getRecord().getKeyArea(Constants.MAIN_KEY_AREA).reverseKeyBuffer(null, Constants.TEMP_KEY_AREA); // Move these keys back to the record
buffer = vKeyArea.doSeek("==", table, keyArea); // Reposition the key here
}
buffer = vKeyArea.doMove(iRelPosition, table, keyArea);
this.saveCurrentKeys(table, buffer, (buffer == null));
return buffer;
} | java | public synchronized BaseBuffer move(int iRelPosition, FieldTable table) throws DBException
{
int iKeyOrder = table.getRecord().getDefaultOrder();
if (iKeyOrder == -1)
iKeyOrder = Constants.MAIN_KEY_AREA;
KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyOrder);
PKeyArea vKeyArea = this.getPKeyArea(iKeyOrder);
// First, compare the current position with the record you are trying to read past.
BaseBuffer buffer = (BaseBuffer)table.getDataSource();
if ((iRelPosition != Constants.FIRST_RECORD)
&& (iRelPosition != Constants.LAST_RECORD))
if (!vKeyArea.atCurrent(buffer))
{
keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA); // Move these keys back to the record
if (keyArea.getUniqueKeyCode() != Constants.UNIQUE) // The main key is part of the comparison
table.getRecord().getKeyArea(Constants.MAIN_KEY_AREA).reverseKeyBuffer(null, Constants.TEMP_KEY_AREA); // Move these keys back to the record
buffer = vKeyArea.doSeek("==", table, keyArea); // Reposition the key here
}
buffer = vKeyArea.doMove(iRelPosition, table, keyArea);
this.saveCurrentKeys(table, buffer, (buffer == null));
return buffer;
} | [
"public",
"synchronized",
"BaseBuffer",
"move",
"(",
"int",
"iRelPosition",
",",
"FieldTable",
"table",
")",
"throws",
"DBException",
"{",
"int",
"iKeyOrder",
"=",
"table",
".",
"getRecord",
"(",
")",
".",
"getDefaultOrder",
"(",
")",
";",
"if",
"(",
"iKeyOr... | Move the position of the record.
See PKeyArea for the logic behind this method.
@param iRelPosition The relative position to move.
@param table The table.
@return The buffer containing the data at that location or null if EOF/BOF.
@exception DBException File exception. | [
"Move",
"the",
"position",
"of",
"the",
"record",
".",
"See",
"PKeyArea",
"for",
"the",
"logic",
"behind",
"this",
"method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L403-L428 |
152,231 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.initKeyAreas | public void initKeyAreas(FieldTable table) throws DBException
{
if (m_VKeyList == null)
{
m_VKeyList = new Vector<PKeyArea>();
// Now, copy the keys
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea <= table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA - 1; iKeyArea++)
{
this.makePKeyArea(table);
}
}
} | java | public void initKeyAreas(FieldTable table) throws DBException
{
if (m_VKeyList == null)
{
m_VKeyList = new Vector<PKeyArea>();
// Now, copy the keys
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea <= table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA - 1; iKeyArea++)
{
this.makePKeyArea(table);
}
}
} | [
"public",
"void",
"initKeyAreas",
"(",
"FieldTable",
"table",
")",
"throws",
"DBException",
"{",
"if",
"(",
"m_VKeyList",
"==",
"null",
")",
"{",
"m_VKeyList",
"=",
"new",
"Vector",
"<",
"PKeyArea",
">",
"(",
")",
";",
"// Now, copy the keys",
"for",
"(",
... | Set up the raw data key areas.
@param table The table.
@exception DBException File exception. | [
"Set",
"up",
"the",
"raw",
"data",
"key",
"areas",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L459-L470 |
152,232 | jbundle/jbundle | app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/GetFieldData.java | GetFieldData.moveupFieldData | public void moveupFieldData(FieldData fieldInfo)
{ // Move these fields up to the field passed in
BaseField field;
String thisFieldStr;
int count = fieldInfo.getFieldCount() + DBConstants.MAIN_FIELD;
for (int i = DBConstants.MAIN_FIELD; i < count; i++)
{
field = fieldInfo.getField(i);
if (field.getString().length() == 0)
{
thisFieldStr = m_FieldData.getField(i).getString();
if (thisFieldStr.length() != 0)
field.setString(thisFieldStr);
}
}
} | java | public void moveupFieldData(FieldData fieldInfo)
{ // Move these fields up to the field passed in
BaseField field;
String thisFieldStr;
int count = fieldInfo.getFieldCount() + DBConstants.MAIN_FIELD;
for (int i = DBConstants.MAIN_FIELD; i < count; i++)
{
field = fieldInfo.getField(i);
if (field.getString().length() == 0)
{
thisFieldStr = m_FieldData.getField(i).getString();
if (thisFieldStr.length() != 0)
field.setString(thisFieldStr);
}
}
} | [
"public",
"void",
"moveupFieldData",
"(",
"FieldData",
"fieldInfo",
")",
"{",
"// Move these fields up to the field passed in",
"BaseField",
"field",
";",
"String",
"thisFieldStr",
";",
"int",
"count",
"=",
"fieldInfo",
".",
"getFieldCount",
"(",
")",
"+",
"DBConstant... | Move FieldData2 fields to empty FieldData fields. | [
"Move",
"FieldData2",
"fields",
"to",
"empty",
"FieldData",
"fields",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/GetFieldData.java#L92-L107 |
152,233 | js-lib-com/commons | src/main/java/js/lang/AsyncTask.java | AsyncTask.start | public void start() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
onPreExecute();
Value value = execute();
onPostExecute(value);
} catch (Throwable throwable) {
onThrowable(throwable);
}
}
});
thread.start();
} | java | public void start() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
onPreExecute();
Value value = execute();
onPostExecute(value);
} catch (Throwable throwable) {
onThrowable(throwable);
}
}
});
thread.start();
} | [
"public",
"void",
"start",
"(",
")",
"{",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"onPreExecute",
"(",
")",
";",
"Value",
"value",
"=",
"e... | Start asynchronous task execution. | [
"Start",
"asynchronous",
"task",
"execution",
"."
] | f8c64482142b163487745da74feb106f0765c16b | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/AsyncTask.java#L87-L101 |
152,234 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.after | public static boolean after(final Date point, final Date when)
{
final Calendar pointCalendar = Calendar.getInstance();
pointCalendar.setTime(point);
final Calendar whenCalendar = Calendar.getInstance();
whenCalendar.setTime(when);
return pointCalendar.after(whenCalendar);
} | java | public static boolean after(final Date point, final Date when)
{
final Calendar pointCalendar = Calendar.getInstance();
pointCalendar.setTime(point);
final Calendar whenCalendar = Calendar.getInstance();
whenCalendar.setTime(when);
return pointCalendar.after(whenCalendar);
} | [
"public",
"static",
"boolean",
"after",
"(",
"final",
"Date",
"point",
",",
"final",
"Date",
"when",
")",
"{",
"final",
"Calendar",
"pointCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"pointCalendar",
".",
"setTime",
"(",
"point",
")",
";"... | Returns true if the given from Date is after the given when Date otherwise false.
@param point
the point of time from where to check if it is after.
@param when
the when
@return true, if successful | [
"Returns",
"true",
"if",
"the",
"given",
"from",
"Date",
"is",
"after",
"the",
"given",
"when",
"Date",
"otherwise",
"false",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L196-L203 |
152,235 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.computeAge | public static int computeAge(final Date birthday, final Date computeDate)
{
final Age age = new Age(birthday, computeDate);
return (int)age.calculateInYears();
} | java | public static int computeAge(final Date birthday, final Date computeDate)
{
final Age age = new Age(birthday, computeDate);
return (int)age.calculateInYears();
} | [
"public",
"static",
"int",
"computeAge",
"(",
"final",
"Date",
"birthday",
",",
"final",
"Date",
"computeDate",
")",
"{",
"final",
"Age",
"age",
"=",
"new",
"Age",
"(",
"birthday",
",",
"computeDate",
")",
";",
"return",
"(",
"int",
")",
"age",
".",
"c... | Computes the Age from the birthday till the computeDate object.
@param birthday
The Date object from the birthday.
@param computeDate
The Date-object from where to compute.
@return Returns the computed age in years. | [
"Computes",
"the",
"Age",
"from",
"the",
"birthday",
"till",
"the",
"computeDate",
"object",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L246-L250 |
152,236 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.computeEasternSunday | public static Date computeEasternSunday(final int year)
{
final int easternSundayNumber = computeEasternSundayNumber(year);
final int month = easternSundayNumber / 31;
final int day = easternSundayNumber % 31 + 1;
return CreateDateExtensions.newDate(year, month - 1, day);
} | java | public static Date computeEasternSunday(final int year)
{
final int easternSundayNumber = computeEasternSundayNumber(year);
final int month = easternSundayNumber / 31;
final int day = easternSundayNumber % 31 + 1;
return CreateDateExtensions.newDate(year, month - 1, day);
} | [
"public",
"static",
"Date",
"computeEasternSunday",
"(",
"final",
"int",
"year",
")",
"{",
"final",
"int",
"easternSundayNumber",
"=",
"computeEasternSundayNumber",
"(",
"year",
")",
";",
"final",
"int",
"month",
"=",
"easternSundayNumber",
"/",
"31",
";",
"fina... | Computes the eastern sunday for the given year. Year should be greater than 1583.
@param year
The year to compute the eastern sunday.
@return The eastern sunday. | [
"Computes",
"the",
"eastern",
"sunday",
"for",
"the",
"given",
"year",
".",
"Year",
"should",
"be",
"greater",
"than",
"1583",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L259-L266 |
152,237 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.computeEasternSundayNumber | public static int computeEasternSundayNumber(final int year)
{
final int i = year % 19;
final int j = year / 100;
final int k = year % 100;
final int l = (19 * i + j - j / 4 - (j - (j + 8) / 25 + 1) / 3 + 15) % 30;
final int m = (32 + 2 * (j % 4) + 2 * (k / 4) - l - k % 4) % 7;
return (l + m - 7 * ((i + 11 * l + 22 * m) / 451) + 114);
} | java | public static int computeEasternSundayNumber(final int year)
{
final int i = year % 19;
final int j = year / 100;
final int k = year % 100;
final int l = (19 * i + j - j / 4 - (j - (j + 8) / 25 + 1) / 3 + 15) % 30;
final int m = (32 + 2 * (j % 4) + 2 * (k / 4) - l - k % 4) % 7;
return (l + m - 7 * ((i + 11 * l + 22 * m) / 451) + 114);
} | [
"public",
"static",
"int",
"computeEasternSundayNumber",
"(",
"final",
"int",
"year",
")",
"{",
"final",
"int",
"i",
"=",
"year",
"%",
"19",
";",
"final",
"int",
"j",
"=",
"year",
"/",
"100",
";",
"final",
"int",
"k",
"=",
"year",
"%",
"100",
";",
... | Computes the number from eastern sunday for the given year. Year should be greater the 1583.
@param year
The year to compute the number from eastern sunday.
@return The number from eastern sunday. | [
"Computes",
"the",
"number",
"from",
"eastern",
"sunday",
"for",
"the",
"given",
"year",
".",
"Year",
"should",
"be",
"greater",
"the",
"1583",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L275-L283 |
152,238 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.isBetween | public static boolean isBetween(final Date start, final Date end, final Date between)
{
final long min = start.getTime();
final long max = end.getTime();
final long index = between.getTime();
return min <= index && index <= max;
} | java | public static boolean isBetween(final Date start, final Date end, final Date between)
{
final long min = start.getTime();
final long max = end.getTime();
final long index = between.getTime();
return min <= index && index <= max;
} | [
"public",
"static",
"boolean",
"isBetween",
"(",
"final",
"Date",
"start",
",",
"final",
"Date",
"end",
",",
"final",
"Date",
"between",
")",
"{",
"final",
"long",
"min",
"=",
"start",
".",
"getTime",
"(",
")",
";",
"final",
"long",
"max",
"=",
"end",
... | Checks if the Date object "between" is between from the given to Date objects.
@param start
the start time.
@param end
the end time.
@param between
the date to compare if it is between.
@return true, if is between otherwise false. | [
"Checks",
"if",
"the",
"Date",
"object",
"between",
"is",
"between",
"from",
"the",
"given",
"to",
"Date",
"objects",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L296-L302 |
152,239 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.isDateInThePast | public static boolean isDateInThePast(final Date date)
{
boolean inPast = false;
final Calendar compare = Calendar.getInstance();
compare.setTime(date);
final Calendar now = Calendar.getInstance();
now.setTime(new Date(System.currentTimeMillis()));
inPast = now.after(compare);
return inPast;
} | java | public static boolean isDateInThePast(final Date date)
{
boolean inPast = false;
final Calendar compare = Calendar.getInstance();
compare.setTime(date);
final Calendar now = Calendar.getInstance();
now.setTime(new Date(System.currentTimeMillis()));
inPast = now.after(compare);
return inPast;
} | [
"public",
"static",
"boolean",
"isDateInThePast",
"(",
"final",
"Date",
"date",
")",
"{",
"boolean",
"inPast",
"=",
"false",
";",
"final",
"Calendar",
"compare",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"compare",
".",
"setTime",
"(",
"date",
")... | Checks if the given date object is in the past.
@param date
The date to check.
@return Returns true if the given date is in the past otherwise false. | [
"Checks",
"if",
"the",
"given",
"date",
"object",
"is",
"in",
"the",
"past",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L323-L332 |
152,240 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.isValidDate | public static boolean isValidDate(final String date, final String format, final boolean lenient)
{
boolean isValid = true;
if (date == null || format == null || format.length() <= 0)
{
return false;
}
try
{
final DateFormat df = new SimpleDateFormat(format);
df.setLenient(lenient);
df.parse(date);
}
catch (final ParseException | IllegalArgumentException e)
{
isValid = false;
}
return isValid;
} | java | public static boolean isValidDate(final String date, final String format, final boolean lenient)
{
boolean isValid = true;
if (date == null || format == null || format.length() <= 0)
{
return false;
}
try
{
final DateFormat df = new SimpleDateFormat(format);
df.setLenient(lenient);
df.parse(date);
}
catch (final ParseException | IllegalArgumentException e)
{
isValid = false;
}
return isValid;
} | [
"public",
"static",
"boolean",
"isValidDate",
"(",
"final",
"String",
"date",
",",
"final",
"String",
"format",
",",
"final",
"boolean",
"lenient",
")",
"{",
"boolean",
"isValid",
"=",
"true",
";",
"if",
"(",
"date",
"==",
"null",
"||",
"format",
"==",
"... | Checks if the Date is valid to convert.
@param date
The Date as String
@param format
The Format for the Date to parse
@param lenient
Specify whether or not date/time interpretation is to be lenient.
@return True if the Date is valid otherwise false. | [
"Checks",
"if",
"the",
"Date",
"is",
"valid",
"to",
"convert",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L359-L377 |
152,241 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.substractDaysFromDate | public static Date substractDaysFromDate(final Date date, final int substractDays)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.DATE, substractDays * -1);
return dateOnCalendar.getTime();
} | java | public static Date substractDaysFromDate(final Date date, final int substractDays)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.DATE, substractDays * -1);
return dateOnCalendar.getTime();
} | [
"public",
"static",
"Date",
"substractDaysFromDate",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"substractDays",
")",
"{",
"final",
"Calendar",
"dateOnCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"dateOnCalendar",
".",
"setTime",
"(",
... | Substract days to the given Date object and returns it.
@param date
The Date object to substract the days.
@param substractDays
The days to substract.
@return The resulted Date object. | [
"Substract",
"days",
"to",
"the",
"given",
"Date",
"object",
"and",
"returns",
"it",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L388-L394 |
152,242 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.substractMonthsFromDate | public static Date substractMonthsFromDate(final Date date, final int substractMonths)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.MONTH, substractMonths * -1);
return dateOnCalendar.getTime();
} | java | public static Date substractMonthsFromDate(final Date date, final int substractMonths)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.MONTH, substractMonths * -1);
return dateOnCalendar.getTime();
} | [
"public",
"static",
"Date",
"substractMonthsFromDate",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"substractMonths",
")",
"{",
"final",
"Calendar",
"dateOnCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"dateOnCalendar",
".",
"setTime",
"(... | Substract months to the given Date object and returns it.
@param date
The Date object to substract the months.
@param substractMonths
The months to substract.
@return The resulted Date object. | [
"Substract",
"months",
"to",
"the",
"given",
"Date",
"object",
"and",
"returns",
"it",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L405-L411 |
152,243 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.substractYearsFromDate | public static Date substractYearsFromDate(final Date date, final int substractYears)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.YEAR, substractYears * -1);
return dateOnCalendar.getTime();
} | java | public static Date substractYearsFromDate(final Date date, final int substractYears)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.YEAR, substractYears * -1);
return dateOnCalendar.getTime();
} | [
"public",
"static",
"Date",
"substractYearsFromDate",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"substractYears",
")",
"{",
"final",
"Calendar",
"dateOnCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"dateOnCalendar",
".",
"setTime",
"(",... | Substract years to the given Date object and returns it.
@param date
The Date object to substract the years.
@param substractYears
The years to substract.
@return The resulted Date object. | [
"Substract",
"years",
"to",
"the",
"given",
"Date",
"object",
"and",
"returns",
"it",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L436-L442 |
152,244 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.appendSystemtimeToFilename | public static String appendSystemtimeToFilename(final File fileToRename, final Date add2Name)
{
final String format = "HHmmssSSS";
String sysTime = null;
if (null != add2Name)
{
final DateFormat df = new SimpleDateFormat(format);
sysTime = df.format(add2Name);
}
else
{
final DateFormat df = new SimpleDateFormat(format);
sysTime = df.format(new Date());
}
final String fileName = fileToRename.getName();
final int ext_index = fileName.lastIndexOf(".");
final String ext = fileName.substring(ext_index, fileName.length());
String newName = fileName.substring(0, ext_index);
newName += "_" + sysTime + ext;
return newName;
} | java | public static String appendSystemtimeToFilename(final File fileToRename, final Date add2Name)
{
final String format = "HHmmssSSS";
String sysTime = null;
if (null != add2Name)
{
final DateFormat df = new SimpleDateFormat(format);
sysTime = df.format(add2Name);
}
else
{
final DateFormat df = new SimpleDateFormat(format);
sysTime = df.format(new Date());
}
final String fileName = fileToRename.getName();
final int ext_index = fileName.lastIndexOf(".");
final String ext = fileName.substring(ext_index, fileName.length());
String newName = fileName.substring(0, ext_index);
newName += "_" + sysTime + ext;
return newName;
} | [
"public",
"static",
"String",
"appendSystemtimeToFilename",
"(",
"final",
"File",
"fileToRename",
",",
"final",
"Date",
"add2Name",
")",
"{",
"final",
"String",
"format",
"=",
"\"HHmmssSSS\"",
";",
"String",
"sysTime",
"=",
"null",
";",
"if",
"(",
"null",
"!="... | Returns the filename from the given file with the systemtime.
@param fileToRename
The file.
@param add2Name
Adds the Date to the Filename.
@return Returns the filename from the given file with the systemtime. | [
"Returns",
"the",
"filename",
"from",
"the",
"given",
"file",
"with",
"the",
"systemtime",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L77-L98 |
152,245 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.changeAllFilenameSuffix | public static List<File> changeAllFilenameSuffix(final File file, final String oldSuffix,
final String newSuffix)
throws IOException, FileDoesNotExistException, FileIsADirectoryException
{
return changeAllFilenameSuffix(file, oldSuffix, newSuffix, false);
} | java | public static List<File> changeAllFilenameSuffix(final File file, final String oldSuffix,
final String newSuffix)
throws IOException, FileDoesNotExistException, FileIsADirectoryException
{
return changeAllFilenameSuffix(file, oldSuffix, newSuffix, false);
} | [
"public",
"static",
"List",
"<",
"File",
">",
"changeAllFilenameSuffix",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"oldSuffix",
",",
"final",
"String",
"newSuffix",
")",
"throws",
"IOException",
",",
"FileDoesNotExistException",
",",
"FileIsADirectoryExc... | Changes all the Filenames with the new Suffix recursively.
@param file
The file where to change the Filename with the new Suffix.
@param oldSuffix
All files that have the old suffix will be renamed with the new Suffix.
@param newSuffix
The new suffix.
@return the list of files
@throws IOException
Signals that an I/O exception has occurred.
@throws FileDoesNotExistException
If the file does not exist.
@throws FileIsADirectoryException
the file is A directory exception | [
"Changes",
"all",
"the",
"Filenames",
"with",
"the",
"new",
"Suffix",
"recursively",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L117-L122 |
152,246 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.changeAllFilenameSuffix | public static List<File> changeAllFilenameSuffix(final File file, final String oldSuffix,
final String newSuffix, final boolean delete)
throws IOException, FileDoesNotExistException, FileIsADirectoryException
{
boolean success;
List<File> notDeletedFiles = null;
final String filePath = file.getAbsolutePath();
final String suffix[] = { oldSuffix };
final List<File> files = FileSearchExtensions.findFiles(filePath, suffix);
final int fileCount = files.size();
for (int i = 0; i < fileCount; i++)
{
final File currentFile = files.get(i);
success = RenameFileExtensions.changeFilenameSuffix(currentFile, newSuffix, delete);
if (!success)
{
if (null != notDeletedFiles)
{
notDeletedFiles.add(currentFile);
}
else
{
notDeletedFiles = new ArrayList<>();
notDeletedFiles.add(currentFile);
}
}
}
return notDeletedFiles;
} | java | public static List<File> changeAllFilenameSuffix(final File file, final String oldSuffix,
final String newSuffix, final boolean delete)
throws IOException, FileDoesNotExistException, FileIsADirectoryException
{
boolean success;
List<File> notDeletedFiles = null;
final String filePath = file.getAbsolutePath();
final String suffix[] = { oldSuffix };
final List<File> files = FileSearchExtensions.findFiles(filePath, suffix);
final int fileCount = files.size();
for (int i = 0; i < fileCount; i++)
{
final File currentFile = files.get(i);
success = RenameFileExtensions.changeFilenameSuffix(currentFile, newSuffix, delete);
if (!success)
{
if (null != notDeletedFiles)
{
notDeletedFiles.add(currentFile);
}
else
{
notDeletedFiles = new ArrayList<>();
notDeletedFiles.add(currentFile);
}
}
}
return notDeletedFiles;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"changeAllFilenameSuffix",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"oldSuffix",
",",
"final",
"String",
"newSuffix",
",",
"final",
"boolean",
"delete",
")",
"throws",
"IOException",
",",
"FileDoesNotExi... | Changes all the Filenames with the new Suffix recursively. If delete is true its deletes the
existing file with the same name.
@param file
The file where to change the Filename with the new Suffix.
@param oldSuffix
All files that have the old suffix will be renamed with the new Suffix.
@param newSuffix
The new suffix.
@param delete
If its true than its deletes the existing file with the same name. But before it
copys the contents into the new File.
@return the list of files
@throws IOException
Signals that an I/O exception has occurred.
@throws FileDoesNotExistException
If the file does not exist.
@throws FileIsADirectoryException
the file is A directory exception | [
"Changes",
"all",
"the",
"Filenames",
"with",
"the",
"new",
"Suffix",
"recursively",
".",
"If",
"delete",
"is",
"true",
"its",
"deletes",
"the",
"existing",
"file",
"with",
"the",
"same",
"name",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L145-L173 |
152,247 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.forceToMoveFile | public static boolean forceToMoveFile(final File srcFile, final File destinationFile)
throws IOException, FileIsADirectoryException
{
boolean moved = RenameFileExtensions.renameFile(srcFile, destinationFile, true);
return moved;
} | java | public static boolean forceToMoveFile(final File srcFile, final File destinationFile)
throws IOException, FileIsADirectoryException
{
boolean moved = RenameFileExtensions.renameFile(srcFile, destinationFile, true);
return moved;
} | [
"public",
"static",
"boolean",
"forceToMoveFile",
"(",
"final",
"File",
"srcFile",
",",
"final",
"File",
"destinationFile",
")",
"throws",
"IOException",
",",
"FileIsADirectoryException",
"{",
"boolean",
"moved",
"=",
"RenameFileExtensions",
".",
"renameFile",
"(",
... | Moves the given source file to the given destination file.
@param srcFile
The source file.
@param destinationFile
The destination file.
@return true if the file was moved otherwise false.
@throws IOException
Signals that an I/O exception has occurred.
@throws FileIsADirectoryException
the file is A directory exception | [
"Moves",
"the",
"given",
"source",
"file",
"to",
"the",
"given",
"destination",
"file",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L246-L251 |
152,248 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.moveFile | public static boolean moveFile(final File srcFile, final File destDir)
throws IOException, FileIsADirectoryException
{
return RenameFileExtensions.renameFile(srcFile, destDir, true);
} | java | public static boolean moveFile(final File srcFile, final File destDir)
throws IOException, FileIsADirectoryException
{
return RenameFileExtensions.renameFile(srcFile, destDir, true);
} | [
"public",
"static",
"boolean",
"moveFile",
"(",
"final",
"File",
"srcFile",
",",
"final",
"File",
"destDir",
")",
"throws",
"IOException",
",",
"FileIsADirectoryException",
"{",
"return",
"RenameFileExtensions",
".",
"renameFile",
"(",
"srcFile",
",",
"destDir",
"... | Moves the given source file to the destination Directory.
@param srcFile
The source file.
@param destDir
The destination directory.
@return true if the file was moved otherwise false.
@throws IOException
Signals that an I/O exception has occurred.
@throws FileIsADirectoryException
the file is A directory exception | [
"Moves",
"the",
"given",
"source",
"file",
"to",
"the",
"destination",
"Directory",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L266-L270 |
152,249 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.renameFileWithSystemtime | public static File renameFileWithSystemtime(final File fileToRename)
throws IOException, FileIsADirectoryException
{
final String newFilenameWithSystemtime = appendSystemtimeToFilename(fileToRename);
final File fileWithNewName = new File(fileToRename.getParent(), newFilenameWithSystemtime);
renameFile(fileToRename, fileWithNewName, true);
return fileWithNewName;
} | java | public static File renameFileWithSystemtime(final File fileToRename)
throws IOException, FileIsADirectoryException
{
final String newFilenameWithSystemtime = appendSystemtimeToFilename(fileToRename);
final File fileWithNewName = new File(fileToRename.getParent(), newFilenameWithSystemtime);
renameFile(fileToRename, fileWithNewName, true);
return fileWithNewName;
} | [
"public",
"static",
"File",
"renameFileWithSystemtime",
"(",
"final",
"File",
"fileToRename",
")",
"throws",
"IOException",
",",
"FileIsADirectoryException",
"{",
"final",
"String",
"newFilenameWithSystemtime",
"=",
"appendSystemtimeToFilename",
"(",
"fileToRename",
")",
... | Renames the given file and add to the filename the systemtime.
@param fileToRename
The file to rename.
@return Returns the renamed file from the given file with the systemtime.
@throws IOException
Signals that an I/O exception has occurred.
@throws FileIsADirectoryException
the file is A directory exception | [
"Renames",
"the",
"given",
"file",
"and",
"add",
"to",
"the",
"filename",
"the",
"systemtime",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L374-L381 |
152,250 | NessComputing/components-ness-scopes | src/main/java/com/nesscomputing/scopes/threaddelegate/ThreadDelegatedScope.java | ThreadDelegatedScope.changeScope | public void changeScope(@Nullable final ThreadDelegatedContext context)
{
final ThreadDelegatedContext oldContext = threadLocal.get();
if (oldContext != null) {
if (oldContext == context) {
// If the context gets exchanged with itself, do nothing.
return;
}
else {
// This must not clear the context. It might still be
// referenced by another thread.
oldContext.event(ScopeEvent.LEAVE);
}
}
if (context != null) {
threadLocal.set(context);
context.event(ScopeEvent.ENTER);
}
else {
threadLocal.remove();
}
} | java | public void changeScope(@Nullable final ThreadDelegatedContext context)
{
final ThreadDelegatedContext oldContext = threadLocal.get();
if (oldContext != null) {
if (oldContext == context) {
// If the context gets exchanged with itself, do nothing.
return;
}
else {
// This must not clear the context. It might still be
// referenced by another thread.
oldContext.event(ScopeEvent.LEAVE);
}
}
if (context != null) {
threadLocal.set(context);
context.event(ScopeEvent.ENTER);
}
else {
threadLocal.remove();
}
} | [
"public",
"void",
"changeScope",
"(",
"@",
"Nullable",
"final",
"ThreadDelegatedContext",
"context",
")",
"{",
"final",
"ThreadDelegatedContext",
"oldContext",
"=",
"threadLocal",
".",
"get",
"(",
")",
";",
"if",
"(",
"oldContext",
"!=",
"null",
")",
"{",
"if"... | A thread enters the scope. Clear the current context. If a new context
was given, assign it to the scope, otherwise leave it empty. | [
"A",
"thread",
"enters",
"the",
"scope",
".",
"Clear",
"the",
"current",
"context",
".",
"If",
"a",
"new",
"context",
"was",
"given",
"assign",
"it",
"to",
"the",
"scope",
"otherwise",
"leave",
"it",
"empty",
"."
] | f055ea4897b0cca9ee6dc815b7a42c0dc53ffbd4 | https://github.com/NessComputing/components-ness-scopes/blob/f055ea4897b0cca9ee6dc815b7a42c0dc53ffbd4/src/main/java/com/nesscomputing/scopes/threaddelegate/ThreadDelegatedScope.java#L65-L87 |
152,251 | pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java | FixedURLGenerator.generateFixedUrls | public static void generateFixedUrls(final ContentSpec contentSpec, boolean missingOnly, final Integer fixedUrlPropertyTagId) {
final Set<String> existingFixedUrls = new HashSet<String>();
final Set<SpecNode> nodesWithoutFixedUrls = new HashSet<SpecNode>();
final List<SpecNode> specNodes = getAllSpecNodes(contentSpec);
// Collect any current fixed urls or nodes that need configuring
if (missingOnly) {
collectFixedUrlInformation(specNodes, nodesWithoutFixedUrls, existingFixedUrls);
}
generateFixedUrlForNodes(nodesWithoutFixedUrls, existingFixedUrls, fixedUrlPropertyTagId);
} | java | public static void generateFixedUrls(final ContentSpec contentSpec, boolean missingOnly, final Integer fixedUrlPropertyTagId) {
final Set<String> existingFixedUrls = new HashSet<String>();
final Set<SpecNode> nodesWithoutFixedUrls = new HashSet<SpecNode>();
final List<SpecNode> specNodes = getAllSpecNodes(contentSpec);
// Collect any current fixed urls or nodes that need configuring
if (missingOnly) {
collectFixedUrlInformation(specNodes, nodesWithoutFixedUrls, existingFixedUrls);
}
generateFixedUrlForNodes(nodesWithoutFixedUrls, existingFixedUrls, fixedUrlPropertyTagId);
} | [
"public",
"static",
"void",
"generateFixedUrls",
"(",
"final",
"ContentSpec",
"contentSpec",
",",
"boolean",
"missingOnly",
",",
"final",
"Integer",
"fixedUrlPropertyTagId",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"existingFixedUrls",
"=",
"new",
"HashSet",
... | Generate the fixed urls and sets it where required for a content specification.
@param contentSpec The content spec to generate fixed urls for.
@param missingOnly Generate only the missing fixed urls.
@param fixedUrlPropertyTagId The Fixed URL Property Tag ID. | [
"Generate",
"the",
"fixed",
"urls",
"and",
"sets",
"it",
"where",
"required",
"for",
"a",
"content",
"specification",
"."
] | 2bc02e2971e4522b47a130fb7ae5a0f5ad377df1 | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L46-L57 |
152,252 | pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java | FixedURLGenerator.collectFixedUrlInformation | public static void collectFixedUrlInformation(final Collection<SpecNode> specNodes, final Collection<SpecNode> nodesWithoutFixedUrls,
final Set<String> existingFixedUrls) {
for (final SpecNode specNode : specNodes) {
if (isNullOrEmpty(specNode.getFixedUrl())) {
if (specNode instanceof CommonContent) {
// Ignore common content as it can't have a fixed url
continue;
} else if (specNode instanceof Level) {
final Level level = (Level) specNode;
// Ignore initial content and base levels
if (level.getLevelType() != LevelType.INITIAL_CONTENT && level.getLevelType() != LevelType.BASE) {
nodesWithoutFixedUrls.add(specNode);
}
} else if (specNode instanceof ITopicNode) {
final ITopicNode topicNode = ((ITopicNode) specNode);
// Ignore info topics
if (topicNode.getTopicType() != TopicType.INFO && topicNode.getTopicType() != TopicType.INITIAL_CONTENT) {
nodesWithoutFixedUrls.add(specNode);
}
} else {
nodesWithoutFixedUrls.add(specNode);
}
} else {
existingFixedUrls.add(specNode.getFixedUrl());
}
}
} | java | public static void collectFixedUrlInformation(final Collection<SpecNode> specNodes, final Collection<SpecNode> nodesWithoutFixedUrls,
final Set<String> existingFixedUrls) {
for (final SpecNode specNode : specNodes) {
if (isNullOrEmpty(specNode.getFixedUrl())) {
if (specNode instanceof CommonContent) {
// Ignore common content as it can't have a fixed url
continue;
} else if (specNode instanceof Level) {
final Level level = (Level) specNode;
// Ignore initial content and base levels
if (level.getLevelType() != LevelType.INITIAL_CONTENT && level.getLevelType() != LevelType.BASE) {
nodesWithoutFixedUrls.add(specNode);
}
} else if (specNode instanceof ITopicNode) {
final ITopicNode topicNode = ((ITopicNode) specNode);
// Ignore info topics
if (topicNode.getTopicType() != TopicType.INFO && topicNode.getTopicType() != TopicType.INITIAL_CONTENT) {
nodesWithoutFixedUrls.add(specNode);
}
} else {
nodesWithoutFixedUrls.add(specNode);
}
} else {
existingFixedUrls.add(specNode.getFixedUrl());
}
}
} | [
"public",
"static",
"void",
"collectFixedUrlInformation",
"(",
"final",
"Collection",
"<",
"SpecNode",
">",
"specNodes",
",",
"final",
"Collection",
"<",
"SpecNode",
">",
"nodesWithoutFixedUrls",
",",
"final",
"Set",
"<",
"String",
">",
"existingFixedUrls",
")",
"... | Collect the fixed url information from a list of spec nodes.
@param specNodes The spec nodes to collect the information from.
@param nodesWithoutFixedUrls A modifiable collection to add nodes that have no fixed url information.
@param existingFixedUrls A modifiable set to add existing fixed urls to. | [
"Collect",
"the",
"fixed",
"url",
"information",
"from",
"a",
"list",
"of",
"spec",
"nodes",
"."
] | 2bc02e2971e4522b47a130fb7ae5a0f5ad377df1 | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L66-L94 |
152,253 | pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java | FixedURLGenerator.generateFixedURLForNode | public static String generateFixedURLForNode(final SpecNode specNode, final Set<String> existingFixedUrls,
final Integer fixedUrlPropertyTagId) {
String value;
if (specNode instanceof ITopicNode) {
final ITopicNode topicNode = (ITopicNode) specNode;
final BaseTopicWrapper<?> topic = topicNode.getTopic();
if (STATIC_FIXED_URL_TOPIC_TYPES.contains(topicNode.getTopicType())) {
// Ignore certain topics as those are unique per book and should have a static name
value = getStaticFixedURLForTopicNode(topicNode);
} else if (topic != null) {
// See if a fixed url property exists for the topic and it's valid
final PropertyTagInTopicWrapper fixedUrl = topic.getProperty(fixedUrlPropertyTagId);
if (fixedUrl != null && !existingFixedUrls.contains(fixedUrl.getValue())) {
value = fixedUrl.getValue();
} else {
// Get the topic title with conditional content removed
final String topicTitle;
if (topic instanceof TranslatedTopicWrapper) {
topicTitle = ContentSpecUtilities.getTopicTitleWithConditions(topicNode, ((TranslatedTopicWrapper) topic).getTopic());
} else {
topicTitle = ContentSpecUtilities.getTopicTitleWithConditions(topicNode, topic);
}
value = createURLTitle(topicTitle);
}
} else {
value = createURLTitle(specNode.getTitle());
}
} else if (specNode instanceof Level) {
final String levelPrefix = ContentSpecUtilities.getLevelPrefix((Level) specNode);
value = levelPrefix + createURLTitle(specNode.getTitle());
} else {
value = createURLTitle(specNode.getTitle());
}
// If the basic url already exists or couldn't be generated then fix it up
if (isNullOrEmpty(value) || existingFixedUrls.contains(value)) {
// If the title has no characters that can be used in a url, then just use a generic one
String baseUrlName = value;
if (isNullOrEmpty(baseUrlName) || baseUrlName.matches("^\\d+$")) {
if (specNode instanceof Level) {
final Level level = (Level) specNode;
final String levelPrefix = ContentSpecUtilities.getLevelPrefix(level);
baseUrlName = levelPrefix + level.getLevelType().getTitle().replace(" ", "_") + "ID" + specNode.getUniqueId();
} else if (specNode instanceof ITopicNode) {
baseUrlName = "TopicID" + ((ITopicNode) specNode).getDBId();
} else {
throw new RuntimeException("Cannot generate a fixed url for an Unknown SpecNode type");
}
}
// Add a numerical prefix until we have something unique
String postFix = "";
for (int uniqueCount = 1; ; ++uniqueCount) {
if (!existingFixedUrls.contains(baseUrlName + postFix)) {
value = baseUrlName + postFix;
break;
} else {
postFix = uniqueCount + "";
}
}
}
return value;
} | java | public static String generateFixedURLForNode(final SpecNode specNode, final Set<String> existingFixedUrls,
final Integer fixedUrlPropertyTagId) {
String value;
if (specNode instanceof ITopicNode) {
final ITopicNode topicNode = (ITopicNode) specNode;
final BaseTopicWrapper<?> topic = topicNode.getTopic();
if (STATIC_FIXED_URL_TOPIC_TYPES.contains(topicNode.getTopicType())) {
// Ignore certain topics as those are unique per book and should have a static name
value = getStaticFixedURLForTopicNode(topicNode);
} else if (topic != null) {
// See if a fixed url property exists for the topic and it's valid
final PropertyTagInTopicWrapper fixedUrl = topic.getProperty(fixedUrlPropertyTagId);
if (fixedUrl != null && !existingFixedUrls.contains(fixedUrl.getValue())) {
value = fixedUrl.getValue();
} else {
// Get the topic title with conditional content removed
final String topicTitle;
if (topic instanceof TranslatedTopicWrapper) {
topicTitle = ContentSpecUtilities.getTopicTitleWithConditions(topicNode, ((TranslatedTopicWrapper) topic).getTopic());
} else {
topicTitle = ContentSpecUtilities.getTopicTitleWithConditions(topicNode, topic);
}
value = createURLTitle(topicTitle);
}
} else {
value = createURLTitle(specNode.getTitle());
}
} else if (specNode instanceof Level) {
final String levelPrefix = ContentSpecUtilities.getLevelPrefix((Level) specNode);
value = levelPrefix + createURLTitle(specNode.getTitle());
} else {
value = createURLTitle(specNode.getTitle());
}
// If the basic url already exists or couldn't be generated then fix it up
if (isNullOrEmpty(value) || existingFixedUrls.contains(value)) {
// If the title has no characters that can be used in a url, then just use a generic one
String baseUrlName = value;
if (isNullOrEmpty(baseUrlName) || baseUrlName.matches("^\\d+$")) {
if (specNode instanceof Level) {
final Level level = (Level) specNode;
final String levelPrefix = ContentSpecUtilities.getLevelPrefix(level);
baseUrlName = levelPrefix + level.getLevelType().getTitle().replace(" ", "_") + "ID" + specNode.getUniqueId();
} else if (specNode instanceof ITopicNode) {
baseUrlName = "TopicID" + ((ITopicNode) specNode).getDBId();
} else {
throw new RuntimeException("Cannot generate a fixed url for an Unknown SpecNode type");
}
}
// Add a numerical prefix until we have something unique
String postFix = "";
for (int uniqueCount = 1; ; ++uniqueCount) {
if (!existingFixedUrls.contains(baseUrlName + postFix)) {
value = baseUrlName + postFix;
break;
} else {
postFix = uniqueCount + "";
}
}
}
return value;
} | [
"public",
"static",
"String",
"generateFixedURLForNode",
"(",
"final",
"SpecNode",
"specNode",
",",
"final",
"Set",
"<",
"String",
">",
"existingFixedUrls",
",",
"final",
"Integer",
"fixedUrlPropertyTagId",
")",
"{",
"String",
"value",
";",
"if",
"(",
"specNode",
... | Generate a fixed url for a specific content spec node, making sure that it is valid within the Content Specification.
@param specNode The spec node to generate the fixed url for.
@param existingFixedUrls
@param fixedUrlPropertyTagId
@return A unique generate file name for the specified node. | [
"Generate",
"a",
"fixed",
"url",
"for",
"a",
"specific",
"content",
"spec",
"node",
"making",
"sure",
"that",
"it",
"is",
"valid",
"within",
"the",
"Content",
"Specification",
"."
] | 2bc02e2971e4522b47a130fb7ae5a0f5ad377df1 | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L178-L242 |
152,254 | pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java | FixedURLGenerator.setFixedURL | protected static void setFixedURL(final SpecNode specNode, final String fixedURL, final Set<String> existingFixedUrls) {
specNode.setFixedUrl(fixedURL);
// Add the fixed url to the processed file names
existingFixedUrls.add(fixedURL);
} | java | protected static void setFixedURL(final SpecNode specNode, final String fixedURL, final Set<String> existingFixedUrls) {
specNode.setFixedUrl(fixedURL);
// Add the fixed url to the processed file names
existingFixedUrls.add(fixedURL);
} | [
"protected",
"static",
"void",
"setFixedURL",
"(",
"final",
"SpecNode",
"specNode",
",",
"final",
"String",
"fixedURL",
",",
"final",
"Set",
"<",
"String",
">",
"existingFixedUrls",
")",
"{",
"specNode",
".",
"setFixedUrl",
"(",
"fixedURL",
")",
";",
"// Add t... | Sets the fixed URL property on the node.
@param specNode The spec node to update.
@param fixedURL The fixed url to apply to the node.
@param existingFixedUrls A list of file names that already exist in the spec. | [
"Sets",
"the",
"fixed",
"URL",
"property",
"on",
"the",
"node",
"."
] | 2bc02e2971e4522b47a130fb7ae5a0f5ad377df1 | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L251-L256 |
152,255 | pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java | FixedURLGenerator.getStaticFixedURLForTopicNode | public static String getStaticFixedURLForTopicNode(final ITopicNode topicNode) {
if (topicNode.getTopicType() == TopicType.REVISION_HISTORY) {
return "appe-Revision_History";
} else if (topicNode.getTopicType() == TopicType.LEGAL_NOTICE) {
return "Legal_Notice";
} else if (topicNode.getTopicType() == TopicType.AUTHOR_GROUP) {
return "Author_Group";
} else if (topicNode.getTopicType() == TopicType.ABSTRACT) {
return "Abstract";
} else {
return null;
}
} | java | public static String getStaticFixedURLForTopicNode(final ITopicNode topicNode) {
if (topicNode.getTopicType() == TopicType.REVISION_HISTORY) {
return "appe-Revision_History";
} else if (topicNode.getTopicType() == TopicType.LEGAL_NOTICE) {
return "Legal_Notice";
} else if (topicNode.getTopicType() == TopicType.AUTHOR_GROUP) {
return "Author_Group";
} else if (topicNode.getTopicType() == TopicType.ABSTRACT) {
return "Abstract";
} else {
return null;
}
} | [
"public",
"static",
"String",
"getStaticFixedURLForTopicNode",
"(",
"final",
"ITopicNode",
"topicNode",
")",
"{",
"if",
"(",
"topicNode",
".",
"getTopicType",
"(",
")",
"==",
"TopicType",
".",
"REVISION_HISTORY",
")",
"{",
"return",
"\"appe-Revision_History\"",
";",... | Generate the fixed url for a static topic node.
@param topicNode The topic node to generate the static fixed url for.
@return The fixed url for the node. | [
"Generate",
"the",
"fixed",
"url",
"for",
"a",
"static",
"topic",
"node",
"."
] | 2bc02e2971e4522b47a130fb7ae5a0f5ad377df1 | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L264-L276 |
152,256 | pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java | FixedURLGenerator.createURLTitle | public static String createURLTitle(final String title) {
String baseTitle = title;
// Remove XML Elements from the Title.
baseTitle = baseTitle.replaceAll("</(.*?)>", "").replaceAll("<(.*?)>", "");
// Check if the title starts with an invalid sequence
final Matcher invalidSequenceMatcher = STARTS_WITH_INVALID_SEQUENCE_RE.matcher(baseTitle);
if (invalidSequenceMatcher.find()) {
baseTitle = invalidSequenceMatcher.group("EverythingElse");
}
// Start by removing any prefixed numbers (you can't start an xref id with numbers)
final Matcher matcher = STARTS_WITH_NUMBER_RE.matcher(baseTitle);
if (matcher.find()) {
final String numbers = matcher.group("Numbers");
final String everythingElse = matcher.group("EverythingElse");
if (numbers != null && everythingElse != null) {
final NumberFormat formatter = new RuleBasedNumberFormat(RuleBasedNumberFormat.SPELLOUT);
final String numbersSpeltOut = formatter.format(Integer.parseInt(numbers));
baseTitle = numbersSpeltOut + everythingElse;
// Capitalize the first character
if (baseTitle.length() > 0) {
baseTitle = baseTitle.substring(0, 1).toUpperCase() + baseTitle.substring(1, baseTitle.length());
}
}
}
// Escape the title
final String escapedTitle = DocBookUtilities.escapeTitle(baseTitle);
// We don't want only numeric fixed urls, as that is completely meaningless.
if (escapedTitle.matches("^\\d+$")) {
return "";
} else {
return escapedTitle;
}
} | java | public static String createURLTitle(final String title) {
String baseTitle = title;
// Remove XML Elements from the Title.
baseTitle = baseTitle.replaceAll("</(.*?)>", "").replaceAll("<(.*?)>", "");
// Check if the title starts with an invalid sequence
final Matcher invalidSequenceMatcher = STARTS_WITH_INVALID_SEQUENCE_RE.matcher(baseTitle);
if (invalidSequenceMatcher.find()) {
baseTitle = invalidSequenceMatcher.group("EverythingElse");
}
// Start by removing any prefixed numbers (you can't start an xref id with numbers)
final Matcher matcher = STARTS_WITH_NUMBER_RE.matcher(baseTitle);
if (matcher.find()) {
final String numbers = matcher.group("Numbers");
final String everythingElse = matcher.group("EverythingElse");
if (numbers != null && everythingElse != null) {
final NumberFormat formatter = new RuleBasedNumberFormat(RuleBasedNumberFormat.SPELLOUT);
final String numbersSpeltOut = formatter.format(Integer.parseInt(numbers));
baseTitle = numbersSpeltOut + everythingElse;
// Capitalize the first character
if (baseTitle.length() > 0) {
baseTitle = baseTitle.substring(0, 1).toUpperCase() + baseTitle.substring(1, baseTitle.length());
}
}
}
// Escape the title
final String escapedTitle = DocBookUtilities.escapeTitle(baseTitle);
// We don't want only numeric fixed urls, as that is completely meaningless.
if (escapedTitle.matches("^\\d+$")) {
return "";
} else {
return escapedTitle;
}
} | [
"public",
"static",
"String",
"createURLTitle",
"(",
"final",
"String",
"title",
")",
"{",
"String",
"baseTitle",
"=",
"title",
";",
"// Remove XML Elements from the Title.",
"baseTitle",
"=",
"baseTitle",
".",
"replaceAll",
"(",
"\"</(.*?)>\"",
",",
"\"\"",
")",
... | Creates the URL specific title for a topic or level.
@param title The title that will be used to create the URL Title.
@return The URL representation of the title. | [
"Creates",
"the",
"URL",
"specific",
"title",
"for",
"a",
"topic",
"or",
"level",
"."
] | 2bc02e2971e4522b47a130fb7ae5a0f5ad377df1 | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L284-L322 |
152,257 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.containsFile | public static boolean containsFile(final File parent, final File search)
{
boolean exists = false;
final String[] children = parent.list();
if (children == null)
{
return false;
}
final List<String> fileList = Arrays.asList(children);
if (fileList.contains(search.getName()))
{
exists = true;
}
return exists;
} | java | public static boolean containsFile(final File parent, final File search)
{
boolean exists = false;
final String[] children = parent.list();
if (children == null)
{
return false;
}
final List<String> fileList = Arrays.asList(children);
if (fileList.contains(search.getName()))
{
exists = true;
}
return exists;
} | [
"public",
"static",
"boolean",
"containsFile",
"(",
"final",
"File",
"parent",
",",
"final",
"File",
"search",
")",
"{",
"boolean",
"exists",
"=",
"false",
";",
"final",
"String",
"[",
"]",
"children",
"=",
"parent",
".",
"list",
"(",
")",
";",
"if",
"... | Checks if the given file contains only in the parent file, not in the subdirectories.
@param parent
The parent directory to search.
@param search
The file to search.
@return 's true if the file exists in the parent directory otherwise false. | [
"Checks",
"if",
"the",
"given",
"file",
"contains",
"only",
"in",
"the",
"parent",
"file",
"not",
"in",
"the",
"subdirectories",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L55-L69 |
152,258 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.containsFile | public static boolean containsFile(final File fileToSearch, final String pathname)
{
final String[] allFiles = fileToSearch.list();
if (allFiles == null)
{
return false;
}
final List<String> list = Arrays.asList(allFiles);
return list.contains(pathname);
} | java | public static boolean containsFile(final File fileToSearch, final String pathname)
{
final String[] allFiles = fileToSearch.list();
if (allFiles == null)
{
return false;
}
final List<String> list = Arrays.asList(allFiles);
return list.contains(pathname);
} | [
"public",
"static",
"boolean",
"containsFile",
"(",
"final",
"File",
"fileToSearch",
",",
"final",
"String",
"pathname",
")",
"{",
"final",
"String",
"[",
"]",
"allFiles",
"=",
"fileToSearch",
".",
"list",
"(",
")",
";",
"if",
"(",
"allFiles",
"==",
"null"... | Checks if the given file contains in the parent file.
@param fileToSearch
The parent directory to search.
@param pathname
The file to search.
@return 's true if the file exists in the parent directory otherwise false. | [
"Checks",
"if",
"the",
"given",
"file",
"contains",
"in",
"the",
"parent",
"file",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L80-L89 |
152,259 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.containsFileRecursive | public static boolean containsFileRecursive(final File parent, final File search)
{
final File toSearch = search.getAbsoluteFile();
boolean exists = false;
final File[] children = parent.getAbsoluteFile().listFiles();
if (children == null)
{
return false;
}
final List<File> fileList = Arrays.asList(children);
for (final File currentFile : fileList)
{
if (currentFile.isDirectory())
{
exists = FileSearchExtensions.containsFileRecursive(currentFile, toSearch);
if (exists)
{
return true;
}
}
if (fileList.contains(toSearch))
{
return true;
}
}
return exists;
} | java | public static boolean containsFileRecursive(final File parent, final File search)
{
final File toSearch = search.getAbsoluteFile();
boolean exists = false;
final File[] children = parent.getAbsoluteFile().listFiles();
if (children == null)
{
return false;
}
final List<File> fileList = Arrays.asList(children);
for (final File currentFile : fileList)
{
if (currentFile.isDirectory())
{
exists = FileSearchExtensions.containsFileRecursive(currentFile, toSearch);
if (exists)
{
return true;
}
}
if (fileList.contains(toSearch))
{
return true;
}
}
return exists;
} | [
"public",
"static",
"boolean",
"containsFileRecursive",
"(",
"final",
"File",
"parent",
",",
"final",
"File",
"search",
")",
"{",
"final",
"File",
"toSearch",
"=",
"search",
".",
"getAbsoluteFile",
"(",
")",
";",
"boolean",
"exists",
"=",
"false",
";",
"fina... | Checks if the given file contains only in the parent file recursively.
@param parent
The parent directory to search.
@param search
The file to search.
@return 's true if the file exists in the parent directory otherwise false. | [
"Checks",
"if",
"the",
"given",
"file",
"contains",
"only",
"in",
"the",
"parent",
"file",
"recursively",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L100-L126 |
152,260 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.countAllFilesInDirectory | public static long countAllFilesInDirectory(final File dir, long length,
final boolean includeDirectories)
{
// Get all files
final File[] children = dir.getAbsoluteFile().listFiles();
if (children == null || children.length < 1)
{
return length;
}
for (final File element : children)
{
// if the entry is a directory
if (element.isDirectory())
{ // then
// if directories shell be include
if (includeDirectories)
{ // then
// increment the length
length++;
}
// find recursively in the directory the files.
length = countAllFilesInDirectory(element, length, includeDirectories);
}
else
{
// increment length...
length++;
}
}
return length;
} | java | public static long countAllFilesInDirectory(final File dir, long length,
final boolean includeDirectories)
{
// Get all files
final File[] children = dir.getAbsoluteFile().listFiles();
if (children == null || children.length < 1)
{
return length;
}
for (final File element : children)
{
// if the entry is a directory
if (element.isDirectory())
{ // then
// if directories shell be include
if (includeDirectories)
{ // then
// increment the length
length++;
}
// find recursively in the directory the files.
length = countAllFilesInDirectory(element, length, includeDirectories);
}
else
{
// increment length...
length++;
}
}
return length;
} | [
"public",
"static",
"long",
"countAllFilesInDirectory",
"(",
"final",
"File",
"dir",
",",
"long",
"length",
",",
"final",
"boolean",
"includeDirectories",
")",
"{",
"// Get all files",
"final",
"File",
"[",
"]",
"children",
"=",
"dir",
".",
"getAbsoluteFile",
"(... | Counts all the files in a directory recursively. This includes files in the subdirectories.
@param dir
the directory.
@param length
the current length. By start is this 0.
@param includeDirectories
If this is true then the directories are in the count too.
@return the total number of files. | [
"Counts",
"all",
"the",
"files",
"in",
"a",
"directory",
"recursively",
".",
"This",
"includes",
"files",
"in",
"the",
"subdirectories",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L139-L169 |
152,261 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.findFiles | public static List<File> findFiles(final String start, final String[] extensions)
{
final List<File> files = new ArrayList<>();
final Stack<File> dirs = new Stack<>();
final File startdir = new File(start);
if (startdir.isDirectory())
{
dirs.push(new File(start));
}
while (dirs.size() > 0)
{
final File dirFiles = dirs.pop();
final String s[] = dirFiles.list();
if (s != null)
{
for (final String element : s)
{
final File file = new File(
dirFiles.getAbsolutePath() + File.separator + element);
if (file.isDirectory())
{
dirs.push(file);
}
else if (match(element, extensions))
{
files.add(file);
}
}
}
}
return files;
} | java | public static List<File> findFiles(final String start, final String[] extensions)
{
final List<File> files = new ArrayList<>();
final Stack<File> dirs = new Stack<>();
final File startdir = new File(start);
if (startdir.isDirectory())
{
dirs.push(new File(start));
}
while (dirs.size() > 0)
{
final File dirFiles = dirs.pop();
final String s[] = dirFiles.list();
if (s != null)
{
for (final String element : s)
{
final File file = new File(
dirFiles.getAbsolutePath() + File.separator + element);
if (file.isDirectory())
{
dirs.push(file);
}
else if (match(element, extensions))
{
files.add(file);
}
}
}
}
return files;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"findFiles",
"(",
"final",
"String",
"start",
",",
"final",
"String",
"[",
"]",
"extensions",
")",
"{",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"... | Searches for files with the given extensions and adds them to a Vector.
@param start
The path to the file.
@param extensions
The extensions to find.
@return Returns a Vector all founded files. | [
"Searches",
"for",
"files",
"with",
"the",
"given",
"extensions",
"and",
"adds",
"them",
"to",
"a",
"Vector",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L246-L277 |
152,262 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.findFilesRecursive | public static List<File> findFilesRecursive(final File dir, final String filenameToSearch)
{
final List<File> foundedFileList = new ArrayList<>();
final String regex = RegExExtensions.replaceWildcardsWithRE(filenameToSearch);
// Get all files
final File[] children = dir.getAbsoluteFile().listFiles();
if (children == null || children.length < 1)
{
return foundedFileList;
}
for (final File element : children)
{
// if the entry is a directory
if (element.isDirectory())
{ // then
// find recursively in the directory and put it in a List.
final List<File> foundedFiles = findFilesRecursive(element, filenameToSearch);
// Put the founded files in the main List.
foundedFileList.addAll(foundedFiles);
}
else
{
// entry is a file
final String filename = element.getName();
if (filename.matches(regex))
{
foundedFileList.add(element.getAbsoluteFile());
}
}
}
return foundedFileList;
} | java | public static List<File> findFilesRecursive(final File dir, final String filenameToSearch)
{
final List<File> foundedFileList = new ArrayList<>();
final String regex = RegExExtensions.replaceWildcardsWithRE(filenameToSearch);
// Get all files
final File[] children = dir.getAbsoluteFile().listFiles();
if (children == null || children.length < 1)
{
return foundedFileList;
}
for (final File element : children)
{
// if the entry is a directory
if (element.isDirectory())
{ // then
// find recursively in the directory and put it in a List.
final List<File> foundedFiles = findFilesRecursive(element, filenameToSearch);
// Put the founded files in the main List.
foundedFileList.addAll(foundedFiles);
}
else
{
// entry is a file
final String filename = element.getName();
if (filename.matches(regex))
{
foundedFileList.add(element.getAbsoluteFile());
}
}
}
return foundedFileList;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"findFilesRecursive",
"(",
"final",
"File",
"dir",
",",
"final",
"String",
"filenameToSearch",
")",
"{",
"final",
"List",
"<",
"File",
">",
"foundedFileList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"fina... | Finds all files that match the search pattern. The search is recursively.
@param dir
The directory to search.
@param filenameToSearch
The search pattern. Allowed wildcards are "*" and "?".
@return A List with all files that matches the search pattern. | [
"Finds",
"all",
"files",
"that",
"match",
"the",
"search",
"pattern",
".",
"The",
"search",
"is",
"recursively",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L288-L319 |
152,263 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.findFilesWithFilter | public static List<File> findFilesWithFilter(final File dir, final String... extension)
{
final List<File> foundedFileList = new ArrayList<>();
final File[] children = dir.listFiles(new MultiplyExtensionsFileFilter(true, extension));
for (final File element : children)
{
// if the entry is a directory
if (element.isDirectory())
{ // then
// find recursively in the directory and put it in a List.
// Put the founded files in the main List.
foundedFileList.addAll(findFilesWithFilter(element, extension));
}
else
{
foundedFileList.add(element.getAbsoluteFile());
}
}
return foundedFileList;
} | java | public static List<File> findFilesWithFilter(final File dir, final String... extension)
{
final List<File> foundedFileList = new ArrayList<>();
final File[] children = dir.listFiles(new MultiplyExtensionsFileFilter(true, extension));
for (final File element : children)
{
// if the entry is a directory
if (element.isDirectory())
{ // then
// find recursively in the directory and put it in a List.
// Put the founded files in the main List.
foundedFileList.addAll(findFilesWithFilter(element, extension));
}
else
{
foundedFileList.add(element.getAbsoluteFile());
}
}
return foundedFileList;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"findFilesWithFilter",
"(",
"final",
"File",
"dir",
",",
"final",
"String",
"...",
"extension",
")",
"{",
"final",
"List",
"<",
"File",
">",
"foundedFileList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"f... | Finds all files that match the given extension. The search is recursively.
@param dir
The directory to search.
@param extension
The extensions to search.
@return A List with all files that matches the search pattern. | [
"Finds",
"all",
"files",
"that",
"match",
"the",
"given",
"extension",
".",
"The",
"search",
"is",
"recursively",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L330-L349 |
152,264 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.getAllFilesFromDir | public static List<File> getAllFilesFromDir(final File dir)
{
final List<File> foundedFileList = new ArrayList<>();
final File[] children = dir.getAbsoluteFile().listFiles();
if (children == null || children.length < 1)
{
return foundedFileList;
}
for (final File child : children)
{
// if the entry is not a directory
if (!child.isDirectory())
{
// then
// entry is a file
foundedFileList.add(child.getAbsoluteFile());
}
}
return foundedFileList;
} | java | public static List<File> getAllFilesFromDir(final File dir)
{
final List<File> foundedFileList = new ArrayList<>();
final File[] children = dir.getAbsoluteFile().listFiles();
if (children == null || children.length < 1)
{
return foundedFileList;
}
for (final File child : children)
{
// if the entry is not a directory
if (!child.isDirectory())
{
// then
// entry is a file
foundedFileList.add(child.getAbsoluteFile());
}
}
return foundedFileList;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"getAllFilesFromDir",
"(",
"final",
"File",
"dir",
")",
"{",
"final",
"List",
"<",
"File",
">",
"foundedFileList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"File",
"[",
"]",
"children",
"=",
"... | Gets the all files from directory.
@param dir
the dir
@return A list with all files from the given directory. | [
"Gets",
"the",
"all",
"files",
"from",
"directory",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L358-L377 |
152,265 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.getSearchFilePattern | public static String getSearchFilePattern(final String... fileExtensions)
{
if (fileExtensions.length == 0)
{
return "";
}
final String searchFilePatternPrefix = "([^\\s]+(\\.(?i)(";
final String searchFilePatternSuffix = "))$)";
final StringBuilder sb = new StringBuilder();
int count = 1;
for (final String fileExtension : fileExtensions)
{
if (count < fileExtensions.length)
{
sb.append(fileExtension).append("|");
}
else
{
sb.append(fileExtension);
}
count++;
}
return searchFilePatternPrefix + sb.toString().trim() + searchFilePatternSuffix;
} | java | public static String getSearchFilePattern(final String... fileExtensions)
{
if (fileExtensions.length == 0)
{
return "";
}
final String searchFilePatternPrefix = "([^\\s]+(\\.(?i)(";
final String searchFilePatternSuffix = "))$)";
final StringBuilder sb = new StringBuilder();
int count = 1;
for (final String fileExtension : fileExtensions)
{
if (count < fileExtensions.length)
{
sb.append(fileExtension).append("|");
}
else
{
sb.append(fileExtension);
}
count++;
}
return searchFilePatternPrefix + sb.toString().trim() + searchFilePatternSuffix;
} | [
"public",
"static",
"String",
"getSearchFilePattern",
"(",
"final",
"String",
"...",
"fileExtensions",
")",
"{",
"if",
"(",
"fileExtensions",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"final",
"String",
"searchFilePatternPrefix",
"=",
"\"... | Gets a regex search file pattern that can be used for searching files with a Matcher.
@param fileExtensions
The file extensions that shell exist in the search pattern.
@return a regex search file pattern that can be used for searching files with a Matcher. | [
"Gets",
"a",
"regex",
"search",
"file",
"pattern",
"that",
"can",
"be",
"used",
"for",
"searching",
"files",
"with",
"a",
"Matcher",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L429-L452 |
152,266 | lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java | FileSearchExtensions.match | public static boolean match(final String stringToMatch, final String suffixes[])
{
for (final String suffix : suffixes)
{
final int suffixesLength = suffix.length();
final int stringToMatchLength = stringToMatch.length();
final int result = stringToMatchLength - suffixesLength;
final String extensionToMatch = stringToMatch.substring(result, stringToMatchLength);
final boolean equals = extensionToMatch.equalsIgnoreCase(suffix);
if (stringToMatchLength >= suffixesLength && equals)
{
return true;
}
}
return false;
} | java | public static boolean match(final String stringToMatch, final String suffixes[])
{
for (final String suffix : suffixes)
{
final int suffixesLength = suffix.length();
final int stringToMatchLength = stringToMatch.length();
final int result = stringToMatchLength - suffixesLength;
final String extensionToMatch = stringToMatch.substring(result, stringToMatchLength);
final boolean equals = extensionToMatch.equalsIgnoreCase(suffix);
if (stringToMatchLength >= suffixesLength && equals)
{
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"match",
"(",
"final",
"String",
"stringToMatch",
",",
"final",
"String",
"suffixes",
"[",
"]",
")",
"{",
"for",
"(",
"final",
"String",
"suffix",
":",
"suffixes",
")",
"{",
"final",
"int",
"suffixesLength",
"=",
"suffix",
".... | Checks the given String matches the given suffixes.
@param stringToMatch
The string to compare.
@param suffixes
An array with suffixes.
@return Returns true if matches otherwise false. | [
"Checks",
"the",
"given",
"String",
"matches",
"the",
"given",
"suffixes",
"."
] | 2c81de10fb5d68de64c1abc3ed64ca681ce76da8 | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L485-L500 |
152,267 | jbundle/jbundle | main/remote/src/main/java/org/jbundle/main/remote/AjaxScreenSession.java | AjaxScreenSession.getScreen | public BaseScreen getScreen(Map<String,Object> properties)
{
if (m_topScreen == null)
m_topScreen = (ScreenModel)this.createTopScreen(this.getTask(), null);
BaseScreen screen = null;
if (m_topScreen.getSFieldCount() > 0)
screen = (BaseScreen)m_topScreen.getSField(0);
this.setProperties(properties);
BaseScreen newScreen = (BaseScreen)m_topScreen.getScreen(screen, this);
return newScreen;
} | java | public BaseScreen getScreen(Map<String,Object> properties)
{
if (m_topScreen == null)
m_topScreen = (ScreenModel)this.createTopScreen(this.getTask(), null);
BaseScreen screen = null;
if (m_topScreen.getSFieldCount() > 0)
screen = (BaseScreen)m_topScreen.getSField(0);
this.setProperties(properties);
BaseScreen newScreen = (BaseScreen)m_topScreen.getScreen(screen, this);
return newScreen;
} | [
"public",
"BaseScreen",
"getScreen",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"m_topScreen",
"==",
"null",
")",
"m_topScreen",
"=",
"(",
"ScreenModel",
")",
"this",
".",
"createTopScreen",
"(",
"this",
".",
"getTask... | GetScreen Method. | [
"GetScreen",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/remote/src/main/java/org/jbundle/main/remote/AjaxScreenSession.java#L65-L75 |
152,268 | jbundle/jbundle | main/remote/src/main/java/org/jbundle/main/remote/AjaxScreenSession.java | AjaxScreenSession.createTopScreen | public ComponentParent createTopScreen(Task task, Map<String,Object> properties)
{
if (properties == null)
properties = new HashMap<String,Object>();
properties.put(ScreenModel.VIEW_TYPE, ScreenModel.XML_TYPE);
properties.put(DBParams.TASK, task);
ComponentParent topScreen = (ComponentParent)BaseField.createScreenComponent(ScreenModel.TOP_SCREEN, null, null, null, 0, properties);
return topScreen;
} | java | public ComponentParent createTopScreen(Task task, Map<String,Object> properties)
{
if (properties == null)
properties = new HashMap<String,Object>();
properties.put(ScreenModel.VIEW_TYPE, ScreenModel.XML_TYPE);
properties.put(DBParams.TASK, task);
ComponentParent topScreen = (ComponentParent)BaseField.createScreenComponent(ScreenModel.TOP_SCREEN, null, null, null, 0, properties);
return topScreen;
} | [
"public",
"ComponentParent",
"createTopScreen",
"(",
"Task",
"task",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
... | CreateTopScreen Method. | [
"CreateTopScreen",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/remote/src/main/java/org/jbundle/main/remote/AjaxScreenSession.java#L174-L182 |
152,269 | PuyallupFoursquare/ccb-api-client-java | src/main/java/com/p4square/ccbapi/CCBAPIClient.java | CCBAPIClient.makeURI | private URI makeURI(final String service, final Map<String, String> parameters) {
try {
StringBuilder queryStringBuilder = new StringBuilder();
if (apiBaseUri.getQuery() != null) {
queryStringBuilder.append(apiBaseUri.getQuery()).append("&");
}
queryStringBuilder.append("srv=").append(service);
for (Map.Entry<String, String> entry: parameters.entrySet()) {
queryStringBuilder.append("&").append(entry.getKey()).append("=").append(entry.getValue());
}
return new URI(apiBaseUri.getScheme(), apiBaseUri.getAuthority(), apiBaseUri.getPath(),
queryStringBuilder.toString(), apiBaseUri.getFragment());
} catch (URISyntaxException e) {
// This shouldn't happen, but needs to be caught regardless.
throw new AssertionError("Could not construct API URI", e);
}
} | java | private URI makeURI(final String service, final Map<String, String> parameters) {
try {
StringBuilder queryStringBuilder = new StringBuilder();
if (apiBaseUri.getQuery() != null) {
queryStringBuilder.append(apiBaseUri.getQuery()).append("&");
}
queryStringBuilder.append("srv=").append(service);
for (Map.Entry<String, String> entry: parameters.entrySet()) {
queryStringBuilder.append("&").append(entry.getKey()).append("=").append(entry.getValue());
}
return new URI(apiBaseUri.getScheme(), apiBaseUri.getAuthority(), apiBaseUri.getPath(),
queryStringBuilder.toString(), apiBaseUri.getFragment());
} catch (URISyntaxException e) {
// This shouldn't happen, but needs to be caught regardless.
throw new AssertionError("Could not construct API URI", e);
}
} | [
"private",
"URI",
"makeURI",
"(",
"final",
"String",
"service",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"try",
"{",
"StringBuilder",
"queryStringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"apiBa... | Build the URI for a particular service call.
@param service The CCB API service to call (i.e. the srv query parameter).
@param parameters A map of query parameters to include on the URI.
@return The apiBaseUri with the additional query parameters appended. | [
"Build",
"the",
"URI",
"for",
"a",
"particular",
"service",
"call",
"."
] | 54a7a3184dc565fe513aa520e1344b2303ea6834 | https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/CCBAPIClient.java#L217-L233 |
152,270 | PuyallupFoursquare/ccb-api-client-java | src/main/java/com/p4square/ccbapi/CCBAPIClient.java | CCBAPIClient.makeRequest | private <T extends CCBAPIResponse> T makeRequest(final String api, final Map<String, String> params,
final String form, final Class<T> clazz)
throws IOException {
byte[] payload = null;
if (form != null) {
payload = form.getBytes(StandardCharsets.UTF_8);
}
final InputStream entity = httpClient.sendPostRequest(makeURI(api, params), payload);
try {
T response = xmlBinder.bindResponseXML(entity, clazz);
if (response.getErrors() != null && response.getErrors().size() > 0) {
throw new CCBErrorResponseException(response.getErrors());
}
return response;
} finally {
if (entity != null) {
entity.close();
}
}
} | java | private <T extends CCBAPIResponse> T makeRequest(final String api, final Map<String, String> params,
final String form, final Class<T> clazz)
throws IOException {
byte[] payload = null;
if (form != null) {
payload = form.getBytes(StandardCharsets.UTF_8);
}
final InputStream entity = httpClient.sendPostRequest(makeURI(api, params), payload);
try {
T response = xmlBinder.bindResponseXML(entity, clazz);
if (response.getErrors() != null && response.getErrors().size() > 0) {
throw new CCBErrorResponseException(response.getErrors());
}
return response;
} finally {
if (entity != null) {
entity.close();
}
}
} | [
"private",
"<",
"T",
"extends",
"CCBAPIResponse",
">",
"T",
"makeRequest",
"(",
"final",
"String",
"api",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"final",
"String",
"form",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
"... | Send a request to CCB.
@param api The CCB service name.
@param params The URL query params.
@param form The form body parameters.
@param clazz The response class.
@param <T> The type of response.
@return The response.
@throws IOException if an error occurs. | [
"Send",
"a",
"request",
"to",
"CCB",
"."
] | 54a7a3184dc565fe513aa520e1344b2303ea6834 | https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/CCBAPIClient.java#L246-L267 |
152,271 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/EmailMessageTransport.java | EmailMessageTransport.getDestination | public String getDestination(TrxMessageHeader trxMessageHeader)
{
String strDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM);
return strDest;
} | java | public String getDestination(TrxMessageHeader trxMessageHeader)
{
String strDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM);
return strDest;
} | [
"public",
"String",
"getDestination",
"(",
"TrxMessageHeader",
"trxMessageHeader",
")",
"{",
"String",
"strDest",
"=",
"(",
"String",
")",
"trxMessageHeader",
".",
"get",
"(",
"TrxMessageHeader",
".",
"DESTINATION_PARAM",
")",
";",
"return",
"strDest",
";",
"}"
] | Get the message destination address
@param trxMessageHeader
@return | [
"Get",
"the",
"message",
"destination",
"address"
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/EmailMessageTransport.java#L259-L263 |
152,272 | tvesalainen/util | util/src/main/java/org/vesalainen/util/concurrent/TaggableThread.java | TaggableThread.addCompleter | public static void addCompleter(BiConsumer<Map<Object,Object>,Long> completer)
{
Thread currentThread = Thread.currentThread();
if (currentThread instanceof TaggableThread)
{
TaggableThread taggableThread = (TaggableThread) currentThread;
taggableThread.addMe(completer);
}
} | java | public static void addCompleter(BiConsumer<Map<Object,Object>,Long> completer)
{
Thread currentThread = Thread.currentThread();
if (currentThread instanceof TaggableThread)
{
TaggableThread taggableThread = (TaggableThread) currentThread;
taggableThread.addMe(completer);
}
} | [
"public",
"static",
"void",
"addCompleter",
"(",
"BiConsumer",
"<",
"Map",
"<",
"Object",
",",
"Object",
">",
",",
"Long",
">",
"completer",
")",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"if",
"(",
"currentThread"... | Add a completer whose parameters are tag map and elapsed time in milliseconds.
After thread run completers are called.
@param completer | [
"Add",
"a",
"completer",
"whose",
"parameters",
"are",
"tag",
"map",
"and",
"elapsed",
"time",
"in",
"milliseconds",
".",
"After",
"thread",
"run",
"completers",
"are",
"called",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/TaggableThread.java#L46-L54 |
152,273 | tvesalainen/util | util/src/main/java/org/vesalainen/util/concurrent/TaggableThread.java | TaggableThread.tag | public static void tag(Object key, Object value)
{
Thread currentThread = Thread.currentThread();
if (currentThread instanceof TaggableThread)
{
TaggableThread taggableThread = (TaggableThread) currentThread;
taggableThread.tagMe(key, value);
}
} | java | public static void tag(Object key, Object value)
{
Thread currentThread = Thread.currentThread();
if (currentThread instanceof TaggableThread)
{
TaggableThread taggableThread = (TaggableThread) currentThread;
taggableThread.tagMe(key, value);
}
} | [
"public",
"static",
"void",
"tag",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"if",
"(",
"currentThread",
"instanceof",
"TaggableThread",
")",
"{",
"TaggableThread",
... | Adds a tag, if current thread is TaggableThread, otherwise does nothing.
@param key
@param value | [
"Adds",
"a",
"tag",
"if",
"current",
"thread",
"is",
"TaggableThread",
"otherwise",
"does",
"nothing",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/TaggableThread.java#L74-L82 |
152,274 | Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsQueryEngine.java | CommonsQueryEngine.pagedExecute | @Override
public final void pagedExecute(String queryId, LogicalWorkflow workflow, IResultHandler resultHandler,
int pageSize) throws ConnectorException {
Long time = null;
try {
for (LogicalStep project : workflow.getInitialSteps()) {
ClusterName clusterName = ((Project) project).getClusterName();
connectionHandler.startJob(clusterName.getName());
}
if (logger.isDebugEnabled()) {
logger.debug("Async paged Executing [" + workflow.toString() + "] : queryId [" + queryId + "]");
}
time = System.currentTimeMillis();
pagedExecuteWorkFlow(queryId, workflow, resultHandler, pageSize);
if (logger.isDebugEnabled()) {
logger.debug(
"The async query [" + queryId + "] has ended");
}
} finally {
for (LogicalStep project : workflow.getInitialSteps()) {
connectionHandler.endJob(((Project) project).getClusterName().getName());
}
if (time != null) {
logger.info("TIME - The execute time to paged executed with queryId [" + queryId + "] has been [" + (System
.currentTimeMillis() - time)
+ "]");
}
}
} | java | @Override
public final void pagedExecute(String queryId, LogicalWorkflow workflow, IResultHandler resultHandler,
int pageSize) throws ConnectorException {
Long time = null;
try {
for (LogicalStep project : workflow.getInitialSteps()) {
ClusterName clusterName = ((Project) project).getClusterName();
connectionHandler.startJob(clusterName.getName());
}
if (logger.isDebugEnabled()) {
logger.debug("Async paged Executing [" + workflow.toString() + "] : queryId [" + queryId + "]");
}
time = System.currentTimeMillis();
pagedExecuteWorkFlow(queryId, workflow, resultHandler, pageSize);
if (logger.isDebugEnabled()) {
logger.debug(
"The async query [" + queryId + "] has ended");
}
} finally {
for (LogicalStep project : workflow.getInitialSteps()) {
connectionHandler.endJob(((Project) project).getClusterName().getName());
}
if (time != null) {
logger.info("TIME - The execute time to paged executed with queryId [" + queryId + "] has been [" + (System
.currentTimeMillis() - time)
+ "]");
}
}
} | [
"@",
"Override",
"public",
"final",
"void",
"pagedExecute",
"(",
"String",
"queryId",
",",
"LogicalWorkflow",
"workflow",
",",
"IResultHandler",
"resultHandler",
",",
"int",
"pageSize",
")",
"throws",
"ConnectorException",
"{",
"Long",
"time",
"=",
"null",
";",
... | This method execute a async and paged query.
@param queryId the queryId.
@param workflow the workflow.
@param resultHandler the result handler.
@throws ConnectorException if a error happens. | [
"This",
"method",
"execute",
"a",
"async",
"and",
"paged",
"query",
"."
] | d7cc66cb9591344a13055962e87a91f01c3707d1 | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsQueryEngine.java#L108-L138 |
152,275 | Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsQueryEngine.java | CommonsQueryEngine.execute | @Override
public final QueryResult execute(String queryId, LogicalWorkflow workflow) throws ConnectorException {
QueryResult result = null;
Long time = null;
try {
for (LogicalStep project : workflow.getInitialSteps()) {
ClusterName clusterName = ((Project) project).getClusterName();
connectionHandler.startJob(clusterName.getName());
}
if (logger.isDebugEnabled()) {
logger.debug("Executing [" + workflow.toString() + "]");
}
time = System.currentTimeMillis();
result = executeWorkFlow(workflow);
if (logger.isDebugEnabled()) {
logger.debug(
"The query has finished. The result form the query [" + workflow.toString() + "] has returned "
+ "[" +
result
.getResultSet()
.size() + "] rows");
}
} finally {
for (LogicalStep project : workflow.getInitialSteps()) {
connectionHandler.endJob(((Project) project).getClusterName().getName());
}
if (time != null) {
logger.info("TIME - The execute time has been [" + (System.currentTimeMillis() - time) + "]");
}
}
return result;
} | java | @Override
public final QueryResult execute(String queryId, LogicalWorkflow workflow) throws ConnectorException {
QueryResult result = null;
Long time = null;
try {
for (LogicalStep project : workflow.getInitialSteps()) {
ClusterName clusterName = ((Project) project).getClusterName();
connectionHandler.startJob(clusterName.getName());
}
if (logger.isDebugEnabled()) {
logger.debug("Executing [" + workflow.toString() + "]");
}
time = System.currentTimeMillis();
result = executeWorkFlow(workflow);
if (logger.isDebugEnabled()) {
logger.debug(
"The query has finished. The result form the query [" + workflow.toString() + "] has returned "
+ "[" +
result
.getResultSet()
.size() + "] rows");
}
} finally {
for (LogicalStep project : workflow.getInitialSteps()) {
connectionHandler.endJob(((Project) project).getClusterName().getName());
}
if (time != null) {
logger.info("TIME - The execute time has been [" + (System.currentTimeMillis() - time) + "]");
}
}
return result;
} | [
"@",
"Override",
"public",
"final",
"QueryResult",
"execute",
"(",
"String",
"queryId",
",",
"LogicalWorkflow",
"workflow",
")",
"throws",
"ConnectorException",
"{",
"QueryResult",
"result",
"=",
"null",
";",
"Long",
"time",
"=",
"null",
";",
"try",
"{",
"for"... | This method execute a query.
@param workflow the workflow to be executed.
@return the query result.
@throws ConnectorException if a error happens. | [
"This",
"method",
"execute",
"a",
"query",
"."
] | d7cc66cb9591344a13055962e87a91f01c3707d1 | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsQueryEngine.java#L148-L181 |
152,276 | Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java | IndexMetadataBuilder.addColumn | @TimerJ
public IndexMetadataBuilder addColumn(String columnName, ColumnType colType) {
ColumnName colName = new ColumnName(tableName, columnName);
ColumnMetadata colMetadata = new ColumnMetadata(colName, null, colType);
columns.put(colName, colMetadata);
return this;
} | java | @TimerJ
public IndexMetadataBuilder addColumn(String columnName, ColumnType colType) {
ColumnName colName = new ColumnName(tableName, columnName);
ColumnMetadata colMetadata = new ColumnMetadata(colName, null, colType);
columns.put(colName, colMetadata);
return this;
} | [
"@",
"TimerJ",
"public",
"IndexMetadataBuilder",
"addColumn",
"(",
"String",
"columnName",
",",
"ColumnType",
"colType",
")",
"{",
"ColumnName",
"colName",
"=",
"new",
"ColumnName",
"(",
"tableName",
",",
"columnName",
")",
";",
"ColumnMetadata",
"colMetadata",
"=... | Add column. Parameters in columnMetadata will be null.
@param columnName the column name
@param colType the col type
@return the index metadata builder | [
"Add",
"column",
".",
"Parameters",
"in",
"columnMetadata",
"will",
"be",
"null",
"."
] | d7cc66cb9591344a13055962e87a91f01c3707d1 | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java#L119-L125 |
152,277 | Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java | IndexMetadataBuilder.addOption | @TimerJ
public IndexMetadataBuilder addOption(String option, Boolean value) {
if (options == null) {
options = new HashMap<Selector, Selector>();
}
options.put(new StringSelector(option), new BooleanSelector(value));
return this;
} | java | @TimerJ
public IndexMetadataBuilder addOption(String option, Boolean value) {
if (options == null) {
options = new HashMap<Selector, Selector>();
}
options.put(new StringSelector(option), new BooleanSelector(value));
return this;
} | [
"@",
"TimerJ",
"public",
"IndexMetadataBuilder",
"addOption",
"(",
"String",
"option",
",",
"Boolean",
"value",
")",
"{",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"new",
"HashMap",
"<",
"Selector",
",",
"Selector",
">",
"(",
")",
";"... | Adds a new boolean option.
@param option the option
@param value the value
@return the index metadata builder | [
"Adds",
"a",
"new",
"boolean",
"option",
"."
] | d7cc66cb9591344a13055962e87a91f01c3707d1 | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/IndexMetadataBuilder.java#L166-L173 |
152,278 | jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/message/session/ClientSessionMessageFilter.java | ClientSessionMessageFilter.getProperties | public Map getProperties()
{
Map properties = super.getProperties();
if (m_propertiesForFilter != null)
properties.putAll(m_propertiesForFilter);
return properties;
} | java | public Map getProperties()
{
Map properties = super.getProperties();
if (m_propertiesForFilter != null)
properties.putAll(m_propertiesForFilter);
return properties;
} | [
"public",
"Map",
"getProperties",
"(",
")",
"{",
"Map",
"properties",
"=",
"super",
".",
"getProperties",
"(",
")",
";",
"if",
"(",
"m_propertiesForFilter",
"!=",
"null",
")",
"properties",
".",
"putAll",
"(",
"m_propertiesForFilter",
")",
";",
"return",
"pr... | Get the properties for this filter.
@return The filter properties and this SessionMessageFilter's properties merged. | [
"Get",
"the",
"properties",
"for",
"this",
"filter",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/session/ClientSessionMessageFilter.java#L152-L158 |
152,279 | RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.getAllFields | public Field[] getAllFields(Object o) {
Field[] fields = o.getClass().getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
return fields;
} | java | public Field[] getAllFields(Object o) {
Field[] fields = o.getClass().getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
return fields;
} | [
"public",
"Field",
"[",
"]",
"getAllFields",
"(",
"Object",
"o",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"o",
".",
"getClass",
"(",
")",
".",
"getDeclaredFields",
"(",
")",
";",
"AccessibleObject",
".",
"setAccessible",
"(",
"fields",
",",
"true",
... | Returns all declared Fields on Object o as accessible.
@param o Object to access
@return all declared Fields on Object o as accessible | [
"Returns",
"all",
"declared",
"Fields",
"on",
"Object",
"o",
"as",
"accessible",
"."
] | 766603021ff406c950e798ce3fb259c9f1f460c7 | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L50-L54 |
152,280 | RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.getAllMethods | public Method[] getAllMethods(Object o) {
Method[] methods = o.getClass().getDeclaredMethods();
AccessibleObject.setAccessible(methods, true);
return methods;
} | java | public Method[] getAllMethods(Object o) {
Method[] methods = o.getClass().getDeclaredMethods();
AccessibleObject.setAccessible(methods, true);
return methods;
} | [
"public",
"Method",
"[",
"]",
"getAllMethods",
"(",
"Object",
"o",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"o",
".",
"getClass",
"(",
")",
".",
"getDeclaredMethods",
"(",
")",
";",
"AccessibleObject",
".",
"setAccessible",
"(",
"methods",
",",
"tru... | Returns all declared Methods on Object o as accessible.
@param o Object to access
@return all declared Methods on Object o as accessible | [
"Returns",
"all",
"declared",
"Methods",
"on",
"Object",
"o",
"as",
"accessible",
"."
] | 766603021ff406c950e798ce3fb259c9f1f460c7 | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L62-L66 |
152,281 | RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.getField | public Object getField(Object o, String fieldName)
throws NoSuchFieldException, IllegalAccessException {
Field field = o.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(o);
} | java | public Object getField(Object o, String fieldName)
throws NoSuchFieldException, IllegalAccessException {
Field field = o.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(o);
} | [
"public",
"Object",
"getField",
"(",
"Object",
"o",
",",
"String",
"fieldName",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalAccessException",
"{",
"Field",
"field",
"=",
"o",
".",
"getClass",
"(",
")",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";... | Gets the specified field on Object o, even if that field is not normally accessible.
Only fields declared on the class for Object o can be accessed.
@param o Object to access
@param fieldName Name of field whose value will be returned
@throws NoSuchFieldException if no field matches <code>fieldName</code>
@throws IllegalAccessException | [
"Gets",
"the",
"specified",
"field",
"on",
"Object",
"o",
"even",
"if",
"that",
"field",
"is",
"not",
"normally",
"accessible",
".",
"Only",
"fields",
"declared",
"on",
"the",
"class",
"for",
"Object",
"o",
"can",
"be",
"accessed",
"."
] | 766603021ff406c950e798ce3fb259c9f1f460c7 | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L77-L83 |
152,282 | RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.setField | public void setField(Object o, String fieldName, Object value)
throws NoSuchFieldException, IllegalAccessException {
Field field = o.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(o, value);
} | java | public void setField(Object o, String fieldName, Object value)
throws NoSuchFieldException, IllegalAccessException {
Field field = o.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(o, value);
} | [
"public",
"void",
"setField",
"(",
"Object",
"o",
",",
"String",
"fieldName",
",",
"Object",
"value",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalAccessException",
"{",
"Field",
"field",
"=",
"o",
".",
"getClass",
"(",
")",
".",
"getDeclaredField",
"("... | Sets the specified field on Object o to the specified value, even if that field is not normally accessible.
Only fields declared on the class for Object o can be accessed.
@param o Object to access
@param fieldName Name of field whose value will be set
@param value Object value that will be set for the field
@throws NoSuchFieldException if no field matches <code>fieldName</code>
@throws IllegalAccessException
@throws IllegalArgumentException if the type of <code>value</code> is incorrect | [
"Sets",
"the",
"specified",
"field",
"on",
"Object",
"o",
"to",
"the",
"specified",
"value",
"even",
"if",
"that",
"field",
"is",
"not",
"normally",
"accessible",
".",
"Only",
"fields",
"declared",
"on",
"the",
"class",
"for",
"Object",
"o",
"can",
"be",
... | 766603021ff406c950e798ce3fb259c9f1f460c7 | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L96-L102 |
152,283 | jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/RsaEncryptedPropertyField.java | RsaEncryptedPropertyField.init | public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault)
{
super.init(record, strName, DBConstants.DEFAULT_FIELD_LENGTH, strDesc, strDefault);
if (iDataLength == DBConstants.DEFAULT_FIELD_LENGTH)
m_iFakeFieldLength = 24;
else
m_iFakeFieldLength = iDataLength;
} | java | public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault)
{
super.init(record, strName, DBConstants.DEFAULT_FIELD_LENGTH, strDesc, strDefault);
if (iDataLength == DBConstants.DEFAULT_FIELD_LENGTH)
m_iFakeFieldLength = 24;
else
m_iFakeFieldLength = iDataLength;
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"String",
"strName",
",",
"int",
"iDataLength",
",",
"String",
"strDesc",
",",
"Object",
"strDefault",
")",
"{",
"super",
".",
"init",
"(",
"record",
",",
"strName",
",",
"DBConstants",
".",
"DEFAULT_... | Initialize the member fields.
@param record The parent record.
@param strName The field name.
@param iDataLength The maximum string length (pass -1 for default).
@param strDesc The string description (usually pass null, to use the resource file desc).
@param strDefault The default value (if object, this value is the default value, if string, the string is the default). | [
"Initialize",
"the",
"member",
"fields",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/RsaEncryptedPropertyField.java#L73-L80 |
152,284 | tvesalainen/util | util/src/main/java/org/vesalainen/math/CircleFitter.java | CircleFitter.filterInnerPoints | public static void filterInnerPoints(DenseMatrix64F points, DenseMatrix64F center, int minLeft, double percent)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
if (percent <= 0 || percent >= 1)
{
throw new IllegalArgumentException("percent "+percent+" is not between 0 & 1");
}
DistComp dc = new DistComp(center.data[0], center.data[1]);
Matrices.sort(points, dc);
int rows = points.numRows;
double[] d = points.data;
double limit = dc.distance(d[0], d[1])*percent;
for (int r=minLeft;r<rows;r++)
{
double distance = dc.distance(d[2*r], d[2*r+1]);
if (distance < limit)
{
points.reshape(r/2, 2, true);
break;
}
}
} | java | public static void filterInnerPoints(DenseMatrix64F points, DenseMatrix64F center, int minLeft, double percent)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
if (percent <= 0 || percent >= 1)
{
throw new IllegalArgumentException("percent "+percent+" is not between 0 & 1");
}
DistComp dc = new DistComp(center.data[0], center.data[1]);
Matrices.sort(points, dc);
int rows = points.numRows;
double[] d = points.data;
double limit = dc.distance(d[0], d[1])*percent;
for (int r=minLeft;r<rows;r++)
{
double distance = dc.distance(d[2*r], d[2*r+1]);
if (distance < limit)
{
points.reshape(r/2, 2, true);
break;
}
}
} | [
"public",
"static",
"void",
"filterInnerPoints",
"(",
"DenseMatrix64F",
"points",
",",
"DenseMatrix64F",
"center",
",",
"int",
"minLeft",
",",
"double",
"percent",
")",
"{",
"assert",
"points",
".",
"numCols",
"==",
"2",
";",
"assert",
"center",
".",
"numCols"... | Filters points which are closes to the last estimated tempCenter.
@param points
@param center | [
"Filters",
"points",
"which",
"are",
"closes",
"to",
"the",
"last",
"estimated",
"tempCenter",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L115-L138 |
152,285 | tvesalainen/util | util/src/main/java/org/vesalainen/math/CircleFitter.java | CircleFitter.meanCenter | public static double meanCenter(DenseMatrix64F points, DenseMatrix64F center)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
center.zero();
int count = points.numRows;
double[] d = points.data;
for (int i=0;i<count;i++)
{
center.add(0, 0, d[2*i]);
center.add(1, 0, d[2*i+1]);
}
if (count > 0)
{
divide(center, count);
DenseMatrix64F di = new DenseMatrix64F(points.numRows, 1);
computeDi(center, points, di);
return elementSum(di) / (double)points.numRows;
}
else
{
return Double.NaN;
}
} | java | public static double meanCenter(DenseMatrix64F points, DenseMatrix64F center)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
center.zero();
int count = points.numRows;
double[] d = points.data;
for (int i=0;i<count;i++)
{
center.add(0, 0, d[2*i]);
center.add(1, 0, d[2*i+1]);
}
if (count > 0)
{
divide(center, count);
DenseMatrix64F di = new DenseMatrix64F(points.numRows, 1);
computeDi(center, points, di);
return elementSum(di) / (double)points.numRows;
}
else
{
return Double.NaN;
}
} | [
"public",
"static",
"double",
"meanCenter",
"(",
"DenseMatrix64F",
"points",
",",
"DenseMatrix64F",
"center",
")",
"{",
"assert",
"points",
".",
"numCols",
"==",
"2",
";",
"assert",
"center",
".",
"numCols",
"==",
"1",
";",
"assert",
"center",
".",
"numRows"... | Calculates mean tempCenter of points
@param points in
@param center out
@return | [
"Calculates",
"mean",
"tempCenter",
"of",
"points"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L193-L217 |
152,286 | tvesalainen/util | util/src/main/java/org/vesalainen/math/CircleFitter.java | CircleFitter.initialCenter | public static double initialCenter(DenseMatrix64F points, DenseMatrix64F center)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
center.zero();
int count = 0;
int len1 = points.numRows;
int len2 = len1-1;
int len3 = len2-1;
for (int i=0;i<len3;i++)
{
for (int j=i+1;j<len2;j++)
{
for (int k=j+1;k<len1;k++)
{
if (center(points, i, j, k, center))
{
count++;
}
}
}
}
if (count > 0)
{
divide(center, count);
DenseMatrix64F di = new DenseMatrix64F(points.numRows, 1);
computeDi(center, points, di);
return elementSum(di) / (double)points.numRows;
}
else
{
return Double.NaN;
}
} | java | public static double initialCenter(DenseMatrix64F points, DenseMatrix64F center)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
center.zero();
int count = 0;
int len1 = points.numRows;
int len2 = len1-1;
int len3 = len2-1;
for (int i=0;i<len3;i++)
{
for (int j=i+1;j<len2;j++)
{
for (int k=j+1;k<len1;k++)
{
if (center(points, i, j, k, center))
{
count++;
}
}
}
}
if (count > 0)
{
divide(center, count);
DenseMatrix64F di = new DenseMatrix64F(points.numRows, 1);
computeDi(center, points, di);
return elementSum(di) / (double)points.numRows;
}
else
{
return Double.NaN;
}
} | [
"public",
"static",
"double",
"initialCenter",
"(",
"DenseMatrix64F",
"points",
",",
"DenseMatrix64F",
"center",
")",
"{",
"assert",
"points",
".",
"numCols",
"==",
"2",
";",
"assert",
"center",
".",
"numCols",
"==",
"1",
";",
"assert",
"center",
".",
"numRo... | Calculates an initial estimate for tempCenter.
@param points
@param center
@return | [
"Calculates",
"an",
"initial",
"estimate",
"for",
"tempCenter",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L225-L259 |
152,287 | FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/io/FileIO.java | FileIO.writeToFile | public static File writeToFile(InputStream inputStream, File file) throws IOException {
try (RandomAccessFile raf = new RandomAccessFile(file, "rw")) {
ReadableByteChannel inputChannel = Channels.newChannel(inputStream);
FileChannel fileChannel = raf.getChannel();
fastChannelCopy(inputChannel, fileChannel);
}
return file;
} | java | public static File writeToFile(InputStream inputStream, File file) throws IOException {
try (RandomAccessFile raf = new RandomAccessFile(file, "rw")) {
ReadableByteChannel inputChannel = Channels.newChannel(inputStream);
FileChannel fileChannel = raf.getChannel();
fastChannelCopy(inputChannel, fileChannel);
}
return file;
} | [
"public",
"static",
"File",
"writeToFile",
"(",
"InputStream",
"inputStream",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"try",
"(",
"RandomAccessFile",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"file",
",",
"\"rw\"",
")",
")",
"{",
"ReadableByt... | Writes from an InputStream to a file | [
"Writes",
"from",
"an",
"InputStream",
"to",
"a",
"file"
] | 4c7b2f90201327af4eaa3cd46b3fee68f864e5cc | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L87-L96 |
152,288 | FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/io/FileIO.java | FileIO.writeToTempFile | public static File writeToTempFile(InputStream inputStream, String prefix, String suffix) throws IOException {
File file = File.createTempFile(prefix, "." + suffix);
writeToFile(inputStream, file);
return file;
} | java | public static File writeToTempFile(InputStream inputStream, String prefix, String suffix) throws IOException {
File file = File.createTempFile(prefix, "." + suffix);
writeToFile(inputStream, file);
return file;
} | [
"public",
"static",
"File",
"writeToTempFile",
"(",
"InputStream",
"inputStream",
",",
"String",
"prefix",
",",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"File",
".",
"createTempFile",
"(",
"prefix",
",",
"\".\"",
"+",
"suffix... | Writes from an InputStream to a temporary file | [
"Writes",
"from",
"an",
"InputStream",
"to",
"a",
"temporary",
"file"
] | 4c7b2f90201327af4eaa3cd46b3fee68f864e5cc | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L102-L107 |
152,289 | FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/io/FileIO.java | FileIO.writeToTempFile | public static File writeToTempFile(String buf, String prefix, String suffix) throws IOException {
InputStream is = new ByteArrayInputStream(buf.getBytes("UTF-8"));
return writeToTempFile(is, prefix, suffix);
} | java | public static File writeToTempFile(String buf, String prefix, String suffix) throws IOException {
InputStream is = new ByteArrayInputStream(buf.getBytes("UTF-8"));
return writeToTempFile(is, prefix, suffix);
} | [
"public",
"static",
"File",
"writeToTempFile",
"(",
"String",
"buf",
",",
"String",
"prefix",
",",
"String",
"suffix",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"buf",
".",
"getBytes",
"(",
"\"UTF-8\"",
")... | Writes from a String to a temporary file | [
"Writes",
"from",
"a",
"String",
"to",
"a",
"temporary",
"file"
] | 4c7b2f90201327af4eaa3cd46b3fee68f864e5cc | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L112-L116 |
152,290 | jbundle/jbundle | app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java | ScanPackagesProcess.scanProjects | public void scanProjects(int parentProjectID)
{
ClassProject classProject = new ClassProject(this);
try {
classProject.addNew();
classProject.setKeyArea(ClassProject.ID_KEY);
classProject.getField(ClassProject.ID).setValue(parentProjectID);
if (classProject.seek(null))
{
if (isBaseDatabase(classProject))
this.scanAllPackages(classProject);
}
IntegerField field = new IntegerField(null, null, -1, null, null);
field.setValue(parentProjectID);
classProject.addNew();
classProject.close();
classProject.setKeyArea(ClassProject.PARENT_FOLDER_ID_KEY);
classProject.addListener(new SubFileFilter(field, ClassProject.PARENT_FOLDER_ID, null, null, null, null));
while (classProject.hasNext())
{
classProject.next();
this.scanProjects((int)classProject.getField(ClassProject.ID).getValue());
}
field.free();
} catch (DBException e) {
e.printStackTrace();
} finally {
classProject.free();
}
} | java | public void scanProjects(int parentProjectID)
{
ClassProject classProject = new ClassProject(this);
try {
classProject.addNew();
classProject.setKeyArea(ClassProject.ID_KEY);
classProject.getField(ClassProject.ID).setValue(parentProjectID);
if (classProject.seek(null))
{
if (isBaseDatabase(classProject))
this.scanAllPackages(classProject);
}
IntegerField field = new IntegerField(null, null, -1, null, null);
field.setValue(parentProjectID);
classProject.addNew();
classProject.close();
classProject.setKeyArea(ClassProject.PARENT_FOLDER_ID_KEY);
classProject.addListener(new SubFileFilter(field, ClassProject.PARENT_FOLDER_ID, null, null, null, null));
while (classProject.hasNext())
{
classProject.next();
this.scanProjects((int)classProject.getField(ClassProject.ID).getValue());
}
field.free();
} catch (DBException e) {
e.printStackTrace();
} finally {
classProject.free();
}
} | [
"public",
"void",
"scanProjects",
"(",
"int",
"parentProjectID",
")",
"{",
"ClassProject",
"classProject",
"=",
"new",
"ClassProject",
"(",
"this",
")",
";",
"try",
"{",
"classProject",
".",
"addNew",
"(",
")",
";",
"classProject",
".",
"setKeyArea",
"(",
"C... | ScanProjects Method. | [
"ScanProjects",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java#L108-L137 |
152,291 | jbundle/jbundle | app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java | ScanPackagesProcess.scanAllPackages | public void scanAllPackages(ClassProject classProject)
{
this.setProperty("projectID", classProject.getField(ClassProject.ID).toString());
this.scanPackages(classProject, ClassProject.CodeType.RESOURCE_CODE);
this.scanPackages(classProject, ClassProject.CodeType.RESOURCE_PROPERTIES);
this.scanPackages(classProject, ClassProject.CodeType.THIN);
this.scanPackages(classProject, ClassProject.CodeType.INTERFACE);
this.scanPackages(classProject, ClassProject.CodeType.THICK);
} | java | public void scanAllPackages(ClassProject classProject)
{
this.setProperty("projectID", classProject.getField(ClassProject.ID).toString());
this.scanPackages(classProject, ClassProject.CodeType.RESOURCE_CODE);
this.scanPackages(classProject, ClassProject.CodeType.RESOURCE_PROPERTIES);
this.scanPackages(classProject, ClassProject.CodeType.THIN);
this.scanPackages(classProject, ClassProject.CodeType.INTERFACE);
this.scanPackages(classProject, ClassProject.CodeType.THICK);
} | [
"public",
"void",
"scanAllPackages",
"(",
"ClassProject",
"classProject",
")",
"{",
"this",
".",
"setProperty",
"(",
"\"projectID\"",
",",
"classProject",
".",
"getField",
"(",
"ClassProject",
".",
"ID",
")",
".",
"toString",
"(",
")",
")",
";",
"this",
".",... | ScanAllPackages Method. | [
"ScanAllPackages",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java#L141-L150 |
152,292 | jbundle/jbundle | app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java | ScanPackagesProcess.scanPackages | public void scanPackages(ClassProject classProject, ClassProject.CodeType codeType)
{
String projectClassDirectory = classProject.getFileName(null, null, codeType, true, false);
Packages recPackages = (Packages)this.getMainRecord();
Map<String, Object> prop = new HashMap<String, Object>();
prop.put(ConvertCode.SOURCE_DIR, projectClassDirectory);
prop.put(ConvertCode.DEST_DIR, null);
prop.put("codeType", codeType);
Task taskParent = this.getTask();
ConvertCode convert = new ConvertCode(taskParent, null, prop);
convert.setScanListener(new PackagesScanListener(convert, recPackages));
convert.run();
} | java | public void scanPackages(ClassProject classProject, ClassProject.CodeType codeType)
{
String projectClassDirectory = classProject.getFileName(null, null, codeType, true, false);
Packages recPackages = (Packages)this.getMainRecord();
Map<String, Object> prop = new HashMap<String, Object>();
prop.put(ConvertCode.SOURCE_DIR, projectClassDirectory);
prop.put(ConvertCode.DEST_DIR, null);
prop.put("codeType", codeType);
Task taskParent = this.getTask();
ConvertCode convert = new ConvertCode(taskParent, null, prop);
convert.setScanListener(new PackagesScanListener(convert, recPackages));
convert.run();
} | [
"public",
"void",
"scanPackages",
"(",
"ClassProject",
"classProject",
",",
"ClassProject",
".",
"CodeType",
"codeType",
")",
"{",
"String",
"projectClassDirectory",
"=",
"classProject",
".",
"getFileName",
"(",
"null",
",",
"null",
",",
"codeType",
",",
"true",
... | ScanPackages Method. | [
"ScanPackages",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java#L154-L167 |
152,293 | jbundle/jbundle | app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java | ScanPackagesProcess.isBaseDatabase | public boolean isBaseDatabase(Record record)
{
BaseDatabase database = record.getTable().getDatabase();
boolean isBaseDB = true;
int counter = (int)record.getCounterField().getValue();
String startingID = database.getProperty(BaseDatabase.STARTING_ID);
String endingID = database.getProperty(BaseDatabase.ENDING_ID);
if (startingID != null)
if (counter < Integer.parseInt(Converter.stripNonNumber(startingID)))
isBaseDB = false;
if (endingID != null)
if (counter > Integer.parseInt(Converter.stripNonNumber(endingID)))
isBaseDB = false;
return isBaseDB;
} | java | public boolean isBaseDatabase(Record record)
{
BaseDatabase database = record.getTable().getDatabase();
boolean isBaseDB = true;
int counter = (int)record.getCounterField().getValue();
String startingID = database.getProperty(BaseDatabase.STARTING_ID);
String endingID = database.getProperty(BaseDatabase.ENDING_ID);
if (startingID != null)
if (counter < Integer.parseInt(Converter.stripNonNumber(startingID)))
isBaseDB = false;
if (endingID != null)
if (counter > Integer.parseInt(Converter.stripNonNumber(endingID)))
isBaseDB = false;
return isBaseDB;
} | [
"public",
"boolean",
"isBaseDatabase",
"(",
"Record",
"record",
")",
"{",
"BaseDatabase",
"database",
"=",
"record",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
";",
"boolean",
"isBaseDB",
"=",
"true",
";",
"int",
"counter",
"=",
"(",
"int",
... | IsBaseDatabase Method. | [
"IsBaseDatabase",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/ScanPackagesProcess.java#L171-L185 |
152,294 | jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/FieldDescConverter.java | FieldDescConverter.getFieldDesc | public String getFieldDesc()
{
if (m_convDescField != null)
return m_convDescField.getFieldDesc();
if ((m_strAltDesc == null) || (m_strAltDesc.length() == 0))
return super.getFieldDesc();
else
return m_strAltDesc;
} | java | public String getFieldDesc()
{
if (m_convDescField != null)
return m_convDescField.getFieldDesc();
if ((m_strAltDesc == null) || (m_strAltDesc.length() == 0))
return super.getFieldDesc();
else
return m_strAltDesc;
} | [
"public",
"String",
"getFieldDesc",
"(",
")",
"{",
"if",
"(",
"m_convDescField",
"!=",
"null",
")",
"return",
"m_convDescField",
".",
"getFieldDesc",
"(",
")",
";",
"if",
"(",
"(",
"m_strAltDesc",
"==",
"null",
")",
"||",
"(",
"m_strAltDesc",
".",
"length"... | Get the field description.
@return The field description. | [
"Get",
"the",
"field",
"description",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/FieldDescConverter.java#L85-L93 |
152,295 | tacitknowledge/discovery | src/main/java/com/tacitknowledge/util/discovery/WebArchiveResourceListSource.java | WebArchiveResourceListSource.getLibEntries | protected String[] getLibEntries(String dir)
{
String[] entries = new String[0];
File libdir = new File(dir);
if (libdir.exists() && libdir.isDirectory())
{
entries = libdir.list();
}
return entries;
} | java | protected String[] getLibEntries(String dir)
{
String[] entries = new String[0];
File libdir = new File(dir);
if (libdir.exists() && libdir.isDirectory())
{
entries = libdir.list();
}
return entries;
} | [
"protected",
"String",
"[",
"]",
"getLibEntries",
"(",
"String",
"dir",
")",
"{",
"String",
"[",
"]",
"entries",
"=",
"new",
"String",
"[",
"0",
"]",
";",
"File",
"libdir",
"=",
"new",
"File",
"(",
"dir",
")",
";",
"if",
"(",
"libdir",
".",
"exists... | Returns a list of entries in the given directory. This method is
separated so that unit tests can override it to return test-friendly
file names.
@param dir the dir containing the files to return
@return the files and directories in the given directory, or
an empty array if the given directory does not exist or is
a file. | [
"Returns",
"a",
"list",
"of",
"entries",
"in",
"the",
"given",
"directory",
".",
"This",
"method",
"is",
"separated",
"so",
"that",
"unit",
"tests",
"can",
"override",
"it",
"to",
"return",
"test",
"-",
"friendly",
"file",
"names",
"."
] | 700f5492c9cb5c0146d684acb38b71fd4ef4e97a | https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/WebArchiveResourceListSource.java#L73-L82 |
152,296 | jbundle/jbundle | base/base/src/main/java/org/jbundle/base/thread/RemoteRecordOwner.java | RemoteRecordOwner.free | public void free()
{
if (m_recordOwnerCollection != null)
m_recordOwnerCollection.free();
m_recordOwnerCollection = null;
if (m_messageFilterList != null)
m_messageFilterList.free();
m_messageFilterList = null;
// Close all records associated with this SessionObject
if (m_vRecordList != null)
m_vRecordList.free(this); // Free the records that belong to me
m_vRecordList = null;
if (m_databaseCollection != null)
m_databaseCollection.free();
m_databaseCollection = null;
// try {
// UnicastRemoteObject.unexportObject(this, false); // I'm no longer available for remote calls (RMI, not EJB)
// } catch (NoSuchObjectException ex) {
// ex.printStackTrace();
// }
if (m_sessionObjectParent != null)
m_sessionObjectParent.removeRecordOwner(this);
m_sessionObjectParent = null;
} | java | public void free()
{
if (m_recordOwnerCollection != null)
m_recordOwnerCollection.free();
m_recordOwnerCollection = null;
if (m_messageFilterList != null)
m_messageFilterList.free();
m_messageFilterList = null;
// Close all records associated with this SessionObject
if (m_vRecordList != null)
m_vRecordList.free(this); // Free the records that belong to me
m_vRecordList = null;
if (m_databaseCollection != null)
m_databaseCollection.free();
m_databaseCollection = null;
// try {
// UnicastRemoteObject.unexportObject(this, false); // I'm no longer available for remote calls (RMI, not EJB)
// } catch (NoSuchObjectException ex) {
// ex.printStackTrace();
// }
if (m_sessionObjectParent != null)
m_sessionObjectParent.removeRecordOwner(this);
m_sessionObjectParent = null;
} | [
"public",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_recordOwnerCollection",
"!=",
"null",
")",
"m_recordOwnerCollection",
".",
"free",
"(",
")",
";",
"m_recordOwnerCollection",
"=",
"null",
";",
"if",
"(",
"m_messageFilterList",
"!=",
"null",
")",
"m_messag... | Free this remote record owner.
Also explicitly unexports the RMI object. | [
"Free",
"this",
"remote",
"record",
"owner",
".",
"Also",
"explicitly",
"unexports",
"the",
"RMI",
"object",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/RemoteRecordOwner.java#L127-L153 |
152,297 | mbenson/uelbox | src/main/java/uelbox/UEL.java | UEL.embed | public static String embed(final String expression, final char trigger) {
return new StringBuilder().append(trigger).append('{').append(strip(expression)).append('}').toString();
} | java | public static String embed(final String expression, final char trigger) {
return new StringBuilder().append(trigger).append('{').append(strip(expression)).append('}').toString();
} | [
"public",
"static",
"String",
"embed",
"(",
"final",
"String",
"expression",
",",
"final",
"char",
"trigger",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"trigger",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(... | Embed the specified expression, if necessary, using the specified triggering character.
@param expression
@param trigger
@return String | [
"Embed",
"the",
"specified",
"expression",
"if",
"necessary",
"using",
"the",
"specified",
"triggering",
"character",
"."
] | b0c2df2c738295bddfd3c16a916e67c9c7c512ef | https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L143-L145 |
152,298 | mbenson/uelbox | src/main/java/uelbox/UEL.java | UEL.getTrigger | public static char getTrigger(final String delimitedExpression) {
final String expr = StringUtils.trimToEmpty(delimitedExpression);
Validate.isTrue(isDelimited(expr));
return expr.charAt(0);
} | java | public static char getTrigger(final String delimitedExpression) {
final String expr = StringUtils.trimToEmpty(delimitedExpression);
Validate.isTrue(isDelimited(expr));
return expr.charAt(0);
} | [
"public",
"static",
"char",
"getTrigger",
"(",
"final",
"String",
"delimitedExpression",
")",
"{",
"final",
"String",
"expr",
"=",
"StringUtils",
".",
"trimToEmpty",
"(",
"delimitedExpression",
")",
";",
"Validate",
".",
"isTrue",
"(",
"isDelimited",
"(",
"expr"... | Get the trigger character for the specified delimited expression.
@param delimitedExpression
@return first non-whitespace character of {@code delimitedExpression}
@throws IllegalArgumentException if argument expression is not delimited | [
"Get",
"the",
"trigger",
"character",
"for",
"the",
"specified",
"delimited",
"expression",
"."
] | b0c2df2c738295bddfd3c16a916e67c9c7c512ef | https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L164-L168 |
152,299 | mbenson/uelbox | src/main/java/uelbox/UEL.java | UEL.strip | public static String strip(final String expression) {
final String expr = StringUtils.trimToEmpty(expression);
final Matcher matcher = DELIMITED_EXPR.matcher(expr);
return matcher.matches() ? matcher.group(1) : expr;
} | java | public static String strip(final String expression) {
final String expr = StringUtils.trimToEmpty(expression);
final Matcher matcher = DELIMITED_EXPR.matcher(expr);
return matcher.matches() ? matcher.group(1) : expr;
} | [
"public",
"static",
"String",
"strip",
"(",
"final",
"String",
"expression",
")",
"{",
"final",
"String",
"expr",
"=",
"StringUtils",
".",
"trimToEmpty",
"(",
"expression",
")",
";",
"final",
"Matcher",
"matcher",
"=",
"DELIMITED_EXPR",
".",
"matcher",
"(",
... | Strip any delimiter from the specified expression.
@param expression
@return String | [
"Strip",
"any",
"delimiter",
"from",
"the",
"specified",
"expression",
"."
] | b0c2df2c738295bddfd3c16a916e67c9c7c512ef | https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L176-L180 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.