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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
148,800
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.removeRelation
|
synchronized boolean removeRelation(Interval i1, Interval i2) {
if (i1 == i2 || !containsInterval(i1) || !containsInterval(i2)) {
return false;
}
Object i1Start = i1.getStart();
Object i1Finish = i1.getFinish();
Object i2Start = i2.getStart();
Object i2Finish = i2.getFinish();
directedGraph.setEdge(i1Start, i2Start, null);
directedGraph.setEdge(i1Start, i2Finish, null);
directedGraph.setEdge(i2Start, i1Start, null);
directedGraph.setEdge(i2Start, i1Finish, null);
directedGraph.setEdge(i1Finish, i2Start, null);
directedGraph.setEdge(i1Finish, i2Finish, null);
directedGraph.setEdge(i2Finish, i1Start, null);
directedGraph.setEdge(i2Finish, i1Finish, null);
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
return true;
}
|
java
|
synchronized boolean removeRelation(Interval i1, Interval i2) {
if (i1 == i2 || !containsInterval(i1) || !containsInterval(i2)) {
return false;
}
Object i1Start = i1.getStart();
Object i1Finish = i1.getFinish();
Object i2Start = i2.getStart();
Object i2Finish = i2.getFinish();
directedGraph.setEdge(i1Start, i2Start, null);
directedGraph.setEdge(i1Start, i2Finish, null);
directedGraph.setEdge(i2Start, i1Start, null);
directedGraph.setEdge(i2Start, i1Finish, null);
directedGraph.setEdge(i1Finish, i2Start, null);
directedGraph.setEdge(i1Finish, i2Finish, null);
directedGraph.setEdge(i2Finish, i1Start, null);
directedGraph.setEdge(i2Finish, i1Finish, null);
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
return true;
}
|
[
"synchronized",
"boolean",
"removeRelation",
"(",
"Interval",
"i1",
",",
"Interval",
"i2",
")",
"{",
"if",
"(",
"i1",
"==",
"i2",
"||",
"!",
"containsInterval",
"(",
"i1",
")",
"||",
"!",
"containsInterval",
"(",
"i2",
")",
")",
"{",
"return",
"false",
";",
"}",
"Object",
"i1Start",
"=",
"i1",
".",
"getStart",
"(",
")",
";",
"Object",
"i1Finish",
"=",
"i1",
".",
"getFinish",
"(",
")",
";",
"Object",
"i2Start",
"=",
"i2",
".",
"getStart",
"(",
")",
";",
"Object",
"i2Finish",
"=",
"i2",
".",
"getFinish",
"(",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i1Start",
",",
"i2Start",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i1Start",
",",
"i2Finish",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i2Start",
",",
"i1Start",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i2Start",
",",
"i1Finish",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i1Finish",
",",
"i2Start",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i1Finish",
",",
"i2Finish",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i2Finish",
",",
"i1Start",
",",
"null",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"i2Finish",
",",
"i1Finish",
",",
"null",
")",
";",
"calcMinDuration",
"=",
"null",
";",
"calcMaxDuration",
"=",
"null",
";",
"calcMinFinish",
"=",
"null",
";",
"calcMaxFinish",
"=",
"null",
";",
"calcMinStart",
"=",
"null",
";",
"calcMaxStart",
"=",
"null",
";",
"shortestDistancesFromTimeZeroSource",
"=",
"null",
";",
"shortestDistancesFromTimeZeroDestination",
"=",
"null",
";",
"return",
"true",
";",
"}"
] |
Remove the distance relation between two intervals, if such a relation
exists.
@param i1
an interval.
@param i2
another interval.
@return true if the graph changed as a result of this operation, false
otherwise.
|
[
"Remove",
"the",
"distance",
"relation",
"between",
"two",
"intervals",
"if",
"such",
"a",
"relation",
"exists",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L99-L128
|
148,801
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.removeInterval
|
synchronized boolean removeInterval(Interval i) {
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
if (directedGraph.remove(i.getStart()) != null) {
if (directedGraph.remove(i.getFinish()) == null) {
throw new IllegalStateException();
}
intervals.remove(i);
return true;
} else {
return false;
}
}
|
java
|
synchronized boolean removeInterval(Interval i) {
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
if (directedGraph.remove(i.getStart()) != null) {
if (directedGraph.remove(i.getFinish()) == null) {
throw new IllegalStateException();
}
intervals.remove(i);
return true;
} else {
return false;
}
}
|
[
"synchronized",
"boolean",
"removeInterval",
"(",
"Interval",
"i",
")",
"{",
"calcMinDuration",
"=",
"null",
";",
"calcMaxDuration",
"=",
"null",
";",
"calcMinFinish",
"=",
"null",
";",
"calcMaxFinish",
"=",
"null",
";",
"calcMinStart",
"=",
"null",
";",
"calcMaxStart",
"=",
"null",
";",
"shortestDistancesFromTimeZeroSource",
"=",
"null",
";",
"shortestDistancesFromTimeZeroDestination",
"=",
"null",
";",
"if",
"(",
"directedGraph",
".",
"remove",
"(",
"i",
".",
"getStart",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"directedGraph",
".",
"remove",
"(",
"i",
".",
"getFinish",
"(",
")",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"intervals",
".",
"remove",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Remove an interval from this graph.
@param i
an interval.
@return true if the graph changed as a result of this operation, false
otherwise.
|
[
"Remove",
"an",
"interval",
"from",
"this",
"graph",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L138-L157
|
148,802
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.containsInterval
|
private boolean containsInterval(Interval i) {
if (i != null) {
return directedGraph.contains(i.getStart())
&& directedGraph.contains(i.getFinish());
} else {
return false;
}
}
|
java
|
private boolean containsInterval(Interval i) {
if (i != null) {
return directedGraph.contains(i.getStart())
&& directedGraph.contains(i.getFinish());
} else {
return false;
}
}
|
[
"private",
"boolean",
"containsInterval",
"(",
"Interval",
"i",
")",
"{",
"if",
"(",
"i",
"!=",
"null",
")",
"{",
"return",
"directedGraph",
".",
"contains",
"(",
"i",
".",
"getStart",
"(",
")",
")",
"&&",
"directedGraph",
".",
"contains",
"(",
"i",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Determine if an interval is contained in this graph.
@param i
an interval.
@return <code>true</code> if the given interval is found,
<code>false</code> otherwise.
|
[
"Determine",
"if",
"an",
"interval",
"is",
"contained",
"in",
"this",
"graph",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L167-L174
|
148,803
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.addInterval
|
synchronized boolean addInterval(Interval i) {
if (i == null || containsInterval(i) || !intervals.add(i)) {
return false;
}
Object iStart = i.getStart();
Object iFinish = i.getFinish();
directedGraph.add(iStart);
directedGraph.add(iFinish);
Weight mindur = i.getSpecifiedMinimumLength();
Weight maxdur = i.getSpecifiedMaximumLength();
directedGraph.setEdge(iStart, iFinish, maxdur);
directedGraph.setEdge(iFinish, iStart, mindur.invertSign());
Weight minstart = i.getSpecifiedMinimumStart();
Weight maxstart = i.getSpecifiedMaximumStart();
directedGraph.setEdge(timeZero, iStart, maxstart);
directedGraph.setEdge(iStart, timeZero, minstart.invertSign());
Weight minfinish = i.getSpecifiedMinimumFinish();
Weight maxfinish = i.getSpecifiedMaximumFinish();
directedGraph.setEdge(timeZero, iFinish, maxfinish);
directedGraph.setEdge(iFinish, timeZero, minfinish.invertSign());
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
return true;
}
|
java
|
synchronized boolean addInterval(Interval i) {
if (i == null || containsInterval(i) || !intervals.add(i)) {
return false;
}
Object iStart = i.getStart();
Object iFinish = i.getFinish();
directedGraph.add(iStart);
directedGraph.add(iFinish);
Weight mindur = i.getSpecifiedMinimumLength();
Weight maxdur = i.getSpecifiedMaximumLength();
directedGraph.setEdge(iStart, iFinish, maxdur);
directedGraph.setEdge(iFinish, iStart, mindur.invertSign());
Weight minstart = i.getSpecifiedMinimumStart();
Weight maxstart = i.getSpecifiedMaximumStart();
directedGraph.setEdge(timeZero, iStart, maxstart);
directedGraph.setEdge(iStart, timeZero, minstart.invertSign());
Weight minfinish = i.getSpecifiedMinimumFinish();
Weight maxfinish = i.getSpecifiedMaximumFinish();
directedGraph.setEdge(timeZero, iFinish, maxfinish);
directedGraph.setEdge(iFinish, timeZero, minfinish.invertSign());
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
return true;
}
|
[
"synchronized",
"boolean",
"addInterval",
"(",
"Interval",
"i",
")",
"{",
"if",
"(",
"i",
"==",
"null",
"||",
"containsInterval",
"(",
"i",
")",
"||",
"!",
"intervals",
".",
"add",
"(",
"i",
")",
")",
"{",
"return",
"false",
";",
"}",
"Object",
"iStart",
"=",
"i",
".",
"getStart",
"(",
")",
";",
"Object",
"iFinish",
"=",
"i",
".",
"getFinish",
"(",
")",
";",
"directedGraph",
".",
"add",
"(",
"iStart",
")",
";",
"directedGraph",
".",
"add",
"(",
"iFinish",
")",
";",
"Weight",
"mindur",
"=",
"i",
".",
"getSpecifiedMinimumLength",
"(",
")",
";",
"Weight",
"maxdur",
"=",
"i",
".",
"getSpecifiedMaximumLength",
"(",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"iStart",
",",
"iFinish",
",",
"maxdur",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"iFinish",
",",
"iStart",
",",
"mindur",
".",
"invertSign",
"(",
")",
")",
";",
"Weight",
"minstart",
"=",
"i",
".",
"getSpecifiedMinimumStart",
"(",
")",
";",
"Weight",
"maxstart",
"=",
"i",
".",
"getSpecifiedMaximumStart",
"(",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"timeZero",
",",
"iStart",
",",
"maxstart",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"iStart",
",",
"timeZero",
",",
"minstart",
".",
"invertSign",
"(",
")",
")",
";",
"Weight",
"minfinish",
"=",
"i",
".",
"getSpecifiedMinimumFinish",
"(",
")",
";",
"Weight",
"maxfinish",
"=",
"i",
".",
"getSpecifiedMaximumFinish",
"(",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"timeZero",
",",
"iFinish",
",",
"maxfinish",
")",
";",
"directedGraph",
".",
"setEdge",
"(",
"iFinish",
",",
"timeZero",
",",
"minfinish",
".",
"invertSign",
"(",
")",
")",
";",
"calcMinDuration",
"=",
"null",
";",
"calcMaxDuration",
"=",
"null",
";",
"calcMinFinish",
"=",
"null",
";",
"calcMaxFinish",
"=",
"null",
";",
"calcMinStart",
"=",
"null",
";",
"calcMaxStart",
"=",
"null",
";",
"shortestDistancesFromTimeZeroSource",
"=",
"null",
";",
"shortestDistancesFromTimeZeroDestination",
"=",
"null",
";",
"return",
"true",
";",
"}"
] |
Add an interval to this graph.
@param i
an interval.
@return <code>true</code> if successful, <code>false</code> if the
interval could not be added. If there was a problem adding the
interval, then the constraint network may be in an inconsistent
state (e.g., part of the interval got added).
|
[
"Add",
"an",
"interval",
"to",
"this",
"graph",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L186-L222
|
148,804
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.getMinimumStart
|
synchronized Weight getMinimumStart() {
if (calcMinStart == null) {
// Find the shortest distance from a start to time zero.
Weight result = WeightFactory.NEG_INFINITY;
if (shortestDistancesFromTimeZeroDestination == null) {
shortestDistancesFromTimeZeroDestination = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.DESTINATION);
if (shortestDistancesFromTimeZeroDestination == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object start = intervals.get(i).getStart();
result = Weight.max(result,
(Weight) shortestDistancesFromTimeZeroDestination.get(start));
}
calcMinStart = result.invertSign();
}
return calcMinStart;
}
|
java
|
synchronized Weight getMinimumStart() {
if (calcMinStart == null) {
// Find the shortest distance from a start to time zero.
Weight result = WeightFactory.NEG_INFINITY;
if (shortestDistancesFromTimeZeroDestination == null) {
shortestDistancesFromTimeZeroDestination = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.DESTINATION);
if (shortestDistancesFromTimeZeroDestination == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object start = intervals.get(i).getStart();
result = Weight.max(result,
(Weight) shortestDistancesFromTimeZeroDestination.get(start));
}
calcMinStart = result.invertSign();
}
return calcMinStart;
}
|
[
"synchronized",
"Weight",
"getMinimumStart",
"(",
")",
"{",
"if",
"(",
"calcMinStart",
"==",
"null",
")",
"{",
"// Find the shortest distance from a start to time zero.",
"Weight",
"result",
"=",
"WeightFactory",
".",
"NEG_INFINITY",
";",
"if",
"(",
"shortestDistancesFromTimeZeroDestination",
"==",
"null",
")",
"{",
"shortestDistancesFromTimeZeroDestination",
"=",
"BellmanFord",
".",
"calcShortestDistances",
"(",
"timeZero",
",",
"directedGraph",
",",
"BellmanFord",
".",
"Mode",
".",
"DESTINATION",
")",
";",
"if",
"(",
"shortestDistancesFromTimeZeroDestination",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Negative cycle detected!\"",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"intervals",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Object",
"start",
"=",
"intervals",
".",
"get",
"(",
"i",
")",
".",
"getStart",
"(",
")",
";",
"result",
"=",
"Weight",
".",
"max",
"(",
"result",
",",
"(",
"Weight",
")",
"shortestDistancesFromTimeZeroDestination",
".",
"get",
"(",
"start",
")",
")",
";",
"}",
"calcMinStart",
"=",
"result",
".",
"invertSign",
"(",
")",
";",
"}",
"return",
"calcMinStart",
";",
"}"
] |
Calculates and returns the minimum path from time zero to the start of an
interval.
@return a <code>Weight</code> object.
|
[
"Calculates",
"and",
"returns",
"the",
"minimum",
"path",
"from",
"time",
"zero",
"to",
"the",
"start",
"of",
"an",
"interval",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L230-L251
|
148,805
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.getMaximumStart
|
synchronized Weight getMaximumStart() {
if (calcMaxStart == null) {
// Find the longest distance from time zero to a start.
Weight result = WeightFactory.POS_INFINITY;
if (shortestDistancesFromTimeZeroSource == null) {
shortestDistancesFromTimeZeroSource = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.SOURCE);
if (shortestDistancesFromTimeZeroSource == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object start = intervals.get(i).getStart();
result = Weight.min(result,
(Weight) shortestDistancesFromTimeZeroSource.get(start));
}
calcMaxStart = result;
}
return calcMaxStart;
}
|
java
|
synchronized Weight getMaximumStart() {
if (calcMaxStart == null) {
// Find the longest distance from time zero to a start.
Weight result = WeightFactory.POS_INFINITY;
if (shortestDistancesFromTimeZeroSource == null) {
shortestDistancesFromTimeZeroSource = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.SOURCE);
if (shortestDistancesFromTimeZeroSource == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object start = intervals.get(i).getStart();
result = Weight.min(result,
(Weight) shortestDistancesFromTimeZeroSource.get(start));
}
calcMaxStart = result;
}
return calcMaxStart;
}
|
[
"synchronized",
"Weight",
"getMaximumStart",
"(",
")",
"{",
"if",
"(",
"calcMaxStart",
"==",
"null",
")",
"{",
"// Find the longest distance from time zero to a start.",
"Weight",
"result",
"=",
"WeightFactory",
".",
"POS_INFINITY",
";",
"if",
"(",
"shortestDistancesFromTimeZeroSource",
"==",
"null",
")",
"{",
"shortestDistancesFromTimeZeroSource",
"=",
"BellmanFord",
".",
"calcShortestDistances",
"(",
"timeZero",
",",
"directedGraph",
",",
"BellmanFord",
".",
"Mode",
".",
"SOURCE",
")",
";",
"if",
"(",
"shortestDistancesFromTimeZeroSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Negative cycle detected!\"",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"intervals",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Object",
"start",
"=",
"intervals",
".",
"get",
"(",
"i",
")",
".",
"getStart",
"(",
")",
";",
"result",
"=",
"Weight",
".",
"min",
"(",
"result",
",",
"(",
"Weight",
")",
"shortestDistancesFromTimeZeroSource",
".",
"get",
"(",
"start",
")",
")",
";",
"}",
"calcMaxStart",
"=",
"result",
";",
"}",
"return",
"calcMaxStart",
";",
"}"
] |
Calculates and returns the maximum path from time zero to the start of an
interval.
@return a <code>Weight</code> object.
|
[
"Calculates",
"and",
"returns",
"the",
"maximum",
"path",
"from",
"time",
"zero",
"to",
"the",
"start",
"of",
"an",
"interval",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L259-L280
|
148,806
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.getMinimumFinish
|
synchronized Weight getMinimumFinish() {
if (calcMinFinish == null) {
// Find the shortest distance from a finish to time zero.
Weight result = WeightFactory.POS_INFINITY;
if (shortestDistancesFromTimeZeroDestination == null) {
shortestDistancesFromTimeZeroDestination = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.DESTINATION);
if (shortestDistancesFromTimeZeroDestination == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object finish = intervals.get(i).getFinish();
result = Weight.min(result,
(Weight) shortestDistancesFromTimeZeroDestination.get(finish));
}
calcMinFinish = result.invertSign();
}
return calcMinFinish;
}
|
java
|
synchronized Weight getMinimumFinish() {
if (calcMinFinish == null) {
// Find the shortest distance from a finish to time zero.
Weight result = WeightFactory.POS_INFINITY;
if (shortestDistancesFromTimeZeroDestination == null) {
shortestDistancesFromTimeZeroDestination = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.DESTINATION);
if (shortestDistancesFromTimeZeroDestination == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object finish = intervals.get(i).getFinish();
result = Weight.min(result,
(Weight) shortestDistancesFromTimeZeroDestination.get(finish));
}
calcMinFinish = result.invertSign();
}
return calcMinFinish;
}
|
[
"synchronized",
"Weight",
"getMinimumFinish",
"(",
")",
"{",
"if",
"(",
"calcMinFinish",
"==",
"null",
")",
"{",
"// Find the shortest distance from a finish to time zero.",
"Weight",
"result",
"=",
"WeightFactory",
".",
"POS_INFINITY",
";",
"if",
"(",
"shortestDistancesFromTimeZeroDestination",
"==",
"null",
")",
"{",
"shortestDistancesFromTimeZeroDestination",
"=",
"BellmanFord",
".",
"calcShortestDistances",
"(",
"timeZero",
",",
"directedGraph",
",",
"BellmanFord",
".",
"Mode",
".",
"DESTINATION",
")",
";",
"if",
"(",
"shortestDistancesFromTimeZeroDestination",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Negative cycle detected!\"",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"intervals",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Object",
"finish",
"=",
"intervals",
".",
"get",
"(",
"i",
")",
".",
"getFinish",
"(",
")",
";",
"result",
"=",
"Weight",
".",
"min",
"(",
"result",
",",
"(",
"Weight",
")",
"shortestDistancesFromTimeZeroDestination",
".",
"get",
"(",
"finish",
")",
")",
";",
"}",
"calcMinFinish",
"=",
"result",
".",
"invertSign",
"(",
")",
";",
"}",
"return",
"calcMinFinish",
";",
"}"
] |
Calculates and returns the minimum path from time zero to the finish of
an interval.
@return a <code>Weight</code> object.
|
[
"Calculates",
"and",
"returns",
"the",
"minimum",
"path",
"from",
"time",
"zero",
"to",
"the",
"finish",
"of",
"an",
"interval",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L288-L309
|
148,807
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.getMaximumFinish
|
synchronized Weight getMaximumFinish() {
if (calcMaxFinish == null) {
// Find the longest distance from time zero to a finish.
Weight result = WeightFactory.NEG_INFINITY;
if (shortestDistancesFromTimeZeroSource == null) {
shortestDistancesFromTimeZeroSource = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.SOURCE);
if (shortestDistancesFromTimeZeroSource == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object finish = intervals.get(i).getFinish();
result = Weight.max(result,
(Weight) shortestDistancesFromTimeZeroSource.get(finish));
}
calcMaxFinish = result;
}
return calcMaxFinish;
}
|
java
|
synchronized Weight getMaximumFinish() {
if (calcMaxFinish == null) {
// Find the longest distance from time zero to a finish.
Weight result = WeightFactory.NEG_INFINITY;
if (shortestDistancesFromTimeZeroSource == null) {
shortestDistancesFromTimeZeroSource = BellmanFord.calcShortestDistances(timeZero, directedGraph,
BellmanFord.Mode.SOURCE);
if (shortestDistancesFromTimeZeroSource == null) {
throw new IllegalStateException("Negative cycle detected!");
}
}
for (int i = 0, n = intervals.size(); i < n; i++) {
Object finish = intervals.get(i).getFinish();
result = Weight.max(result,
(Weight) shortestDistancesFromTimeZeroSource.get(finish));
}
calcMaxFinish = result;
}
return calcMaxFinish;
}
|
[
"synchronized",
"Weight",
"getMaximumFinish",
"(",
")",
"{",
"if",
"(",
"calcMaxFinish",
"==",
"null",
")",
"{",
"// Find the longest distance from time zero to a finish.",
"Weight",
"result",
"=",
"WeightFactory",
".",
"NEG_INFINITY",
";",
"if",
"(",
"shortestDistancesFromTimeZeroSource",
"==",
"null",
")",
"{",
"shortestDistancesFromTimeZeroSource",
"=",
"BellmanFord",
".",
"calcShortestDistances",
"(",
"timeZero",
",",
"directedGraph",
",",
"BellmanFord",
".",
"Mode",
".",
"SOURCE",
")",
";",
"if",
"(",
"shortestDistancesFromTimeZeroSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Negative cycle detected!\"",
")",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"intervals",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Object",
"finish",
"=",
"intervals",
".",
"get",
"(",
"i",
")",
".",
"getFinish",
"(",
")",
";",
"result",
"=",
"Weight",
".",
"max",
"(",
"result",
",",
"(",
"Weight",
")",
"shortestDistancesFromTimeZeroSource",
".",
"get",
"(",
"finish",
")",
")",
";",
"}",
"calcMaxFinish",
"=",
"result",
";",
"}",
"return",
"calcMaxFinish",
";",
"}"
] |
Calculates and returns the maximum path from time zero to the finish of
an interval.
@return a <code>Weight</code> object.
|
[
"Calculates",
"and",
"returns",
"the",
"maximum",
"path",
"from",
"time",
"zero",
"to",
"the",
"finish",
"of",
"an",
"interval",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L317-L337
|
148,808
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.getMaximumDuration
|
synchronized Weight getMaximumDuration() {
if (calcMaxDuration == null) {
Weight max = WeightFactory.ZERO;
for (int i = 0, n = intervals.size(); i < n; i++) {
Object start = intervals.get(i).getStart();
Map<?, Weight> d = BellmanFord.calcShortestDistances(start,
directedGraph, BellmanFord.Mode.SOURCE);
if (d == null) {
throw new IllegalStateException("Negative cycle detected!");
}
for (int j = 0; j < n; j++) {
Object finish = intervals.get(j).getFinish();
max = Weight.max(max, d.get(finish));
}
}
calcMaxDuration = max;
}
return calcMaxDuration;
}
|
java
|
synchronized Weight getMaximumDuration() {
if (calcMaxDuration == null) {
Weight max = WeightFactory.ZERO;
for (int i = 0, n = intervals.size(); i < n; i++) {
Object start = intervals.get(i).getStart();
Map<?, Weight> d = BellmanFord.calcShortestDistances(start,
directedGraph, BellmanFord.Mode.SOURCE);
if (d == null) {
throw new IllegalStateException("Negative cycle detected!");
}
for (int j = 0; j < n; j++) {
Object finish = intervals.get(j).getFinish();
max = Weight.max(max, d.get(finish));
}
}
calcMaxDuration = max;
}
return calcMaxDuration;
}
|
[
"synchronized",
"Weight",
"getMaximumDuration",
"(",
")",
"{",
"if",
"(",
"calcMaxDuration",
"==",
"null",
")",
"{",
"Weight",
"max",
"=",
"WeightFactory",
".",
"ZERO",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"intervals",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Object",
"start",
"=",
"intervals",
".",
"get",
"(",
"i",
")",
".",
"getStart",
"(",
")",
";",
"Map",
"<",
"?",
",",
"Weight",
">",
"d",
"=",
"BellmanFord",
".",
"calcShortestDistances",
"(",
"start",
",",
"directedGraph",
",",
"BellmanFord",
".",
"Mode",
".",
"SOURCE",
")",
";",
"if",
"(",
"d",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Negative cycle detected!\"",
")",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"Object",
"finish",
"=",
"intervals",
".",
"get",
"(",
"j",
")",
".",
"getFinish",
"(",
")",
";",
"max",
"=",
"Weight",
".",
"max",
"(",
"max",
",",
"d",
".",
"get",
"(",
"finish",
")",
")",
";",
"}",
"}",
"calcMaxDuration",
"=",
"max",
";",
"}",
"return",
"calcMaxDuration",
";",
"}"
] |
Calculates and returns the maximum time distance from the start of an
interval to the finish of an interval.
@return a <code>Weight</code> object.
|
[
"Calculates",
"and",
"returns",
"the",
"maximum",
"time",
"distance",
"from",
"the",
"start",
"of",
"an",
"interval",
"to",
"the",
"finish",
"of",
"an",
"interval",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L345-L364
|
148,809
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java
|
ConstraintNetwork.getMinimumDuration
|
synchronized Weight getMinimumDuration() {
if (calcMinDuration == null) {
Weight min = WeightFactory.POS_INFINITY;
for (int i = 0, n = intervals.size(); i < n; i++) {
Object finish = intervals.get(i).getFinish();
Map<?, Weight> d = BellmanFord.calcShortestDistances(finish,
directedGraph, BellmanFord.Mode.SOURCE);
if (d == null) {
throw new IllegalStateException("Negative cycle detected!");
}
for (int j = 0; j < n; j++) {
Object start = intervals.get(j).getStart();
min = Weight.min(min, d.get(start));
}
}
calcMinDuration = min.invertSign();
}
return calcMinDuration;
}
|
java
|
synchronized Weight getMinimumDuration() {
if (calcMinDuration == null) {
Weight min = WeightFactory.POS_INFINITY;
for (int i = 0, n = intervals.size(); i < n; i++) {
Object finish = intervals.get(i).getFinish();
Map<?, Weight> d = BellmanFord.calcShortestDistances(finish,
directedGraph, BellmanFord.Mode.SOURCE);
if (d == null) {
throw new IllegalStateException("Negative cycle detected!");
}
for (int j = 0; j < n; j++) {
Object start = intervals.get(j).getStart();
min = Weight.min(min, d.get(start));
}
}
calcMinDuration = min.invertSign();
}
return calcMinDuration;
}
|
[
"synchronized",
"Weight",
"getMinimumDuration",
"(",
")",
"{",
"if",
"(",
"calcMinDuration",
"==",
"null",
")",
"{",
"Weight",
"min",
"=",
"WeightFactory",
".",
"POS_INFINITY",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"intervals",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"Object",
"finish",
"=",
"intervals",
".",
"get",
"(",
"i",
")",
".",
"getFinish",
"(",
")",
";",
"Map",
"<",
"?",
",",
"Weight",
">",
"d",
"=",
"BellmanFord",
".",
"calcShortestDistances",
"(",
"finish",
",",
"directedGraph",
",",
"BellmanFord",
".",
"Mode",
".",
"SOURCE",
")",
";",
"if",
"(",
"d",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Negative cycle detected!\"",
")",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"Object",
"start",
"=",
"intervals",
".",
"get",
"(",
"j",
")",
".",
"getStart",
"(",
")",
";",
"min",
"=",
"Weight",
".",
"min",
"(",
"min",
",",
"d",
".",
"get",
"(",
"start",
")",
")",
";",
"}",
"}",
"calcMinDuration",
"=",
"min",
".",
"invertSign",
"(",
")",
";",
"}",
"return",
"calcMinDuration",
";",
"}"
] |
Calculates and returns the minimum time distance from the start of an
interval to the finish of an interval.
@return a <code>Weight</code> object.
|
[
"Calculates",
"and",
"returns",
"the",
"minimum",
"time",
"distance",
"from",
"the",
"start",
"of",
"an",
"interval",
"to",
"the",
"finish",
"of",
"an",
"interval",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L372-L391
|
148,810
|
sematext/sematext-metrics
|
src/main/java/com/sematext/metrics/client/SematextClient.java
|
SematextClient.send
|
public void send(StDatapoint datapoint) {
StDatapointValidator.validate(datapoint);
sender.send(Collections.singletonList(datapoint));
}
|
java
|
public void send(StDatapoint datapoint) {
StDatapointValidator.validate(datapoint);
sender.send(Collections.singletonList(datapoint));
}
|
[
"public",
"void",
"send",
"(",
"StDatapoint",
"datapoint",
")",
"{",
"StDatapointValidator",
".",
"validate",
"(",
"datapoint",
")",
";",
"sender",
".",
"send",
"(",
"Collections",
".",
"singletonList",
"(",
"datapoint",
")",
")",
";",
"}"
] |
Send datapoint.
@param datapoint datapoint
@throws IllegalArgumentException if datapoint is invalid
|
[
"Send",
"datapoint",
"."
] |
a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c
|
https://github.com/sematext/sematext-metrics/blob/a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c/src/main/java/com/sematext/metrics/client/SematextClient.java#L65-L68
|
148,811
|
sematext/sematext-metrics
|
src/main/java/com/sematext/metrics/client/SematextClient.java
|
SematextClient.send
|
public void send(List<StDatapoint> datapoints) {
for (StDatapoint metric : datapoints) {
StDatapointValidator.validate(metric);
}
sender.send(datapoints);
}
|
java
|
public void send(List<StDatapoint> datapoints) {
for (StDatapoint metric : datapoints) {
StDatapointValidator.validate(metric);
}
sender.send(datapoints);
}
|
[
"public",
"void",
"send",
"(",
"List",
"<",
"StDatapoint",
">",
"datapoints",
")",
"{",
"for",
"(",
"StDatapoint",
"metric",
":",
"datapoints",
")",
"{",
"StDatapointValidator",
".",
"validate",
"(",
"metric",
")",
";",
"}",
"sender",
".",
"send",
"(",
"datapoints",
")",
";",
"}"
] |
Send datapoints list.
@param datapoints datapoints
@throws IllegalArgumentException if one of datapoints is invalid
|
[
"Send",
"datapoints",
"list",
"."
] |
a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c
|
https://github.com/sematext/sematext-metrics/blob/a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c/src/main/java/com/sematext/metrics/client/SematextClient.java#L75-L80
|
148,812
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/AbstractSource.java
|
AbstractSource.addSourceListener
|
@Override
public final void addSourceListener(SourceListener<S> listener) {
if (listener != null) {
this.listenerList.add(listener);
}
}
|
java
|
@Override
public final void addSourceListener(SourceListener<S> listener) {
if (listener != null) {
this.listenerList.add(listener);
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"addSourceListener",
"(",
"SourceListener",
"<",
"S",
">",
"listener",
")",
"{",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"this",
".",
"listenerList",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}"
] |
Adds a listener that gets called whenever something changes.
@param listener a {@link DataSourceListener}.
|
[
"Adds",
"a",
"listener",
"that",
"gets",
"called",
"whenever",
"something",
"changes",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/AbstractSource.java#L78-L83
|
148,813
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/AbstractSource.java
|
AbstractSource.fireSourceUpdated
|
protected void fireSourceUpdated(S e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).sourceUpdated(e);
}
}
|
java
|
protected void fireSourceUpdated(S e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).sourceUpdated(e);
}
}
|
[
"protected",
"void",
"fireSourceUpdated",
"(",
"S",
"e",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"this",
".",
"listenerList",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"this",
".",
"listenerList",
".",
"get",
"(",
"i",
")",
".",
"sourceUpdated",
"(",
"e",
")",
";",
"}",
"}"
] |
Notifies registered listeners that the source has been updated.
@param e a {@link SourceUpdatedEvent} representing an update.
@see SourceListener
|
[
"Notifies",
"registered",
"listeners",
"that",
"the",
"source",
"has",
"been",
"updated",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/AbstractSource.java#L102-L106
|
148,814
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/AbstractSQLGenerator.java
|
AbstractSQLGenerator.removeNonApplicableFilters
|
private static void removeNonApplicableFilters(
Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy,
EntitySpec entitySpec) {
Set<EntitySpec> entitySpecsSet = new HashSet<>();
Set<String> filterPropIds = new HashSet<>();
String[] entitySpecPropIds = entitySpec.getPropositionIds();
for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) {
Filter f = itr.next();
Arrays.addAll(filterPropIds, f.getPropositionIds());
for (EntitySpec es : entitySpecs) {
if (Collections.containsAny(filterPropIds,
es.getPropositionIds())) {
entitySpecsSet.add(es);
}
}
if (Collections.containsAny(filterPropIds, entitySpecPropIds)) {
return;
}
if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) {
itr.remove();
}
entitySpecsSet.clear();
filterPropIds.clear();
}
}
|
java
|
private static void removeNonApplicableFilters(
Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy,
EntitySpec entitySpec) {
Set<EntitySpec> entitySpecsSet = new HashSet<>();
Set<String> filterPropIds = new HashSet<>();
String[] entitySpecPropIds = entitySpec.getPropositionIds();
for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) {
Filter f = itr.next();
Arrays.addAll(filterPropIds, f.getPropositionIds());
for (EntitySpec es : entitySpecs) {
if (Collections.containsAny(filterPropIds,
es.getPropositionIds())) {
entitySpecsSet.add(es);
}
}
if (Collections.containsAny(filterPropIds, entitySpecPropIds)) {
return;
}
if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) {
itr.remove();
}
entitySpecsSet.clear();
filterPropIds.clear();
}
}
|
[
"private",
"static",
"void",
"removeNonApplicableFilters",
"(",
"Collection",
"<",
"EntitySpec",
">",
"entitySpecs",
",",
"Set",
"<",
"Filter",
">",
"filtersCopy",
",",
"EntitySpec",
"entitySpec",
")",
"{",
"Set",
"<",
"EntitySpec",
">",
"entitySpecsSet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Set",
"<",
"String",
">",
"filterPropIds",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"entitySpecPropIds",
"=",
"entitySpec",
".",
"getPropositionIds",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"Filter",
">",
"itr",
"=",
"filtersCopy",
".",
"iterator",
"(",
")",
";",
"itr",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Filter",
"f",
"=",
"itr",
".",
"next",
"(",
")",
";",
"Arrays",
".",
"addAll",
"(",
"filterPropIds",
",",
"f",
".",
"getPropositionIds",
"(",
")",
")",
";",
"for",
"(",
"EntitySpec",
"es",
":",
"entitySpecs",
")",
"{",
"if",
"(",
"Collections",
".",
"containsAny",
"(",
"filterPropIds",
",",
"es",
".",
"getPropositionIds",
"(",
")",
")",
")",
"{",
"entitySpecsSet",
".",
"add",
"(",
"es",
")",
";",
"}",
"}",
"if",
"(",
"Collections",
".",
"containsAny",
"(",
"filterPropIds",
",",
"entitySpecPropIds",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"atLeastOneInInboundReferences",
"(",
"entitySpecsSet",
",",
"entitySpec",
")",
")",
"{",
"itr",
".",
"remove",
"(",
")",
";",
"}",
"entitySpecsSet",
".",
"clear",
"(",
")",
";",
"filterPropIds",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
Remove filters that are not directly applicable to the given entity spec
and are not applicable to other entity specs that refer to it.
@param entitySpecs
@param filtersCopy
@param entitySpec
|
[
"Remove",
"filters",
"that",
"are",
"not",
"directly",
"applicable",
"to",
"the",
"given",
"entity",
"spec",
"and",
"are",
"not",
"applicable",
"to",
"other",
"entity",
"specs",
"that",
"refer",
"to",
"it",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/AbstractSQLGenerator.java#L581-L605
|
148,815
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/AbstractSQLGenerator.java
|
AbstractSQLGenerator.needsPropIdInClause
|
static boolean needsPropIdInClause(Set<String> queryPropIds,
String[] entitySpecPropIds) {
Set<String> entitySpecPropIdsSet = Arrays.asSet(entitySpecPropIds);
// Filter propIds that are not in the entitySpecPropIds array.
List<String> filteredPropIds = new ArrayList<>(
entitySpecPropIds.length);
for (String propId : queryPropIds) {
if (entitySpecPropIdsSet.contains(propId)) {
filteredPropIds.add(propId);
}
}
return (filteredPropIds.size() < entitySpecPropIds.length * 0.85f)
&& (filteredPropIds.size() <= 2000);
}
|
java
|
static boolean needsPropIdInClause(Set<String> queryPropIds,
String[] entitySpecPropIds) {
Set<String> entitySpecPropIdsSet = Arrays.asSet(entitySpecPropIds);
// Filter propIds that are not in the entitySpecPropIds array.
List<String> filteredPropIds = new ArrayList<>(
entitySpecPropIds.length);
for (String propId : queryPropIds) {
if (entitySpecPropIdsSet.contains(propId)) {
filteredPropIds.add(propId);
}
}
return (filteredPropIds.size() < entitySpecPropIds.length * 0.85f)
&& (filteredPropIds.size() <= 2000);
}
|
[
"static",
"boolean",
"needsPropIdInClause",
"(",
"Set",
"<",
"String",
">",
"queryPropIds",
",",
"String",
"[",
"]",
"entitySpecPropIds",
")",
"{",
"Set",
"<",
"String",
">",
"entitySpecPropIdsSet",
"=",
"Arrays",
".",
"asSet",
"(",
"entitySpecPropIds",
")",
";",
"// Filter propIds that are not in the entitySpecPropIds array.",
"List",
"<",
"String",
">",
"filteredPropIds",
"=",
"new",
"ArrayList",
"<>",
"(",
"entitySpecPropIds",
".",
"length",
")",
";",
"for",
"(",
"String",
"propId",
":",
"queryPropIds",
")",
"{",
"if",
"(",
"entitySpecPropIdsSet",
".",
"contains",
"(",
"propId",
")",
")",
"{",
"filteredPropIds",
".",
"add",
"(",
"propId",
")",
";",
"}",
"}",
"return",
"(",
"filteredPropIds",
".",
"size",
"(",
")",
"<",
"entitySpecPropIds",
".",
"length",
"*",
"0.85f",
")",
"&&",
"(",
"filteredPropIds",
".",
"size",
"(",
")",
"<=",
"2000",
")",
";",
"}"
] |
Returns whether an IN clause containing the proposition ids of interest
should be added to the WHERE clause.
@param queryPropIds the proposition ids to query.
@param entitySpecPropIds the proposition ids corresponding to the current
entity spec.
@return <code>true</code> if the query contains < 85% of the proposition
ids that are known to the data source and if the where clause would
contain less than or equal to 2000 codes.
|
[
"Returns",
"whether",
"an",
"IN",
"clause",
"containing",
"the",
"proposition",
"ids",
"of",
"interest",
"should",
"be",
"added",
"to",
"the",
"WHERE",
"clause",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/AbstractSQLGenerator.java#L649-L664
|
148,816
|
openbase/jul
|
processing/default/src/main/java/org/openbase/jul/processing/VersionProcessor.java
|
VersionProcessor.getVersion
|
private String getVersion(final Class launcherClass, final String groupId, final String artifactId) throws NotAvailableException {
String version = null;
// try to load from maven properties first
try {
Properties p = new Properties();
InputStream is = getClass().getResourceAsStream("/META-INF/maven/"+groupId+"/"+artifactId+"/pom.properties");
if (is != null) {
p.load(is);
version = p.getProperty("version", "");
}
} catch (Exception e) {
// ignore
}
// fallback to using Java API
if (version == null) {
Package launcherPackage = launcherClass.getClass().getPackage();
if (launcherPackage != null) {
version = launcherPackage.getImplementationVersion();
if (version == null) {
version = launcherPackage.getSpecificationVersion();
}
}
}
if (version == null) {
// we could not compute the version so a blank
throw new NotAvailableException("Application Version");
}
return version;
}
|
java
|
private String getVersion(final Class launcherClass, final String groupId, final String artifactId) throws NotAvailableException {
String version = null;
// try to load from maven properties first
try {
Properties p = new Properties();
InputStream is = getClass().getResourceAsStream("/META-INF/maven/"+groupId+"/"+artifactId+"/pom.properties");
if (is != null) {
p.load(is);
version = p.getProperty("version", "");
}
} catch (Exception e) {
// ignore
}
// fallback to using Java API
if (version == null) {
Package launcherPackage = launcherClass.getClass().getPackage();
if (launcherPackage != null) {
version = launcherPackage.getImplementationVersion();
if (version == null) {
version = launcherPackage.getSpecificationVersion();
}
}
}
if (version == null) {
// we could not compute the version so a blank
throw new NotAvailableException("Application Version");
}
return version;
}
|
[
"private",
"String",
"getVersion",
"(",
"final",
"Class",
"launcherClass",
",",
"final",
"String",
"groupId",
",",
"final",
"String",
"artifactId",
")",
"throws",
"NotAvailableException",
"{",
"String",
"version",
"=",
"null",
";",
"// try to load from maven properties first",
"try",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"is",
"=",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"\"/META-INF/maven/\"",
"+",
"groupId",
"+",
"\"/\"",
"+",
"artifactId",
"+",
"\"/pom.properties\"",
")",
";",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"p",
".",
"load",
"(",
"is",
")",
";",
"version",
"=",
"p",
".",
"getProperty",
"(",
"\"version\"",
",",
"\"\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ignore",
"}",
"// fallback to using Java API",
"if",
"(",
"version",
"==",
"null",
")",
"{",
"Package",
"launcherPackage",
"=",
"launcherClass",
".",
"getClass",
"(",
")",
".",
"getPackage",
"(",
")",
";",
"if",
"(",
"launcherPackage",
"!=",
"null",
")",
"{",
"version",
"=",
"launcherPackage",
".",
"getImplementationVersion",
"(",
")",
";",
"if",
"(",
"version",
"==",
"null",
")",
"{",
"version",
"=",
"launcherPackage",
".",
"getSpecificationVersion",
"(",
")",
";",
"}",
"}",
"}",
"if",
"(",
"version",
"==",
"null",
")",
"{",
"// we could not compute the version so a blank",
"throw",
"new",
"NotAvailableException",
"(",
"\"Application Version\"",
")",
";",
"}",
"return",
"version",
";",
"}"
] |
Method tries to detect the application Version.
@param launcherClass the launcher to extract the class path.
@param groupId the group id of the application.
@param artifactId the artifact id of the application.
@return the semantic version of the application is returned.
@throws NotAvailableException is thrown if the version could not be detected.
|
[
"Method",
"tries",
"to",
"detect",
"the",
"application",
"Version",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/default/src/main/java/org/openbase/jul/processing/VersionProcessor.java#L40-L72
|
148,817
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.init
|
public void init(String strDateParam, Date dateTarget, String strLanguage)
{
if (strDateParam != null)
dateParam = strDateParam; // Property name
initComponents();
this.setName("JCalendarPopup");
nowDate = new Date();
if (dateTarget == null)
dateTarget = nowDate;
selectedDate = dateTarget;
if (strLanguage != null)
{
Locale locale = new Locale(strLanguage, "");
if (locale != null)
{
calendar = Calendar.getInstance(locale);
dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
}
}
calendar.setTime(dateTarget);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
targetDate = calendar.getTime();
this.layoutCalendar(targetDate);
if (dateTarget == nowDate)
selectedDate = targetDate; // If they want a default date, make the time 12:00
}
|
java
|
public void init(String strDateParam, Date dateTarget, String strLanguage)
{
if (strDateParam != null)
dateParam = strDateParam; // Property name
initComponents();
this.setName("JCalendarPopup");
nowDate = new Date();
if (dateTarget == null)
dateTarget = nowDate;
selectedDate = dateTarget;
if (strLanguage != null)
{
Locale locale = new Locale(strLanguage, "");
if (locale != null)
{
calendar = Calendar.getInstance(locale);
dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
}
}
calendar.setTime(dateTarget);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
targetDate = calendar.getTime();
this.layoutCalendar(targetDate);
if (dateTarget == nowDate)
selectedDate = targetDate; // If they want a default date, make the time 12:00
}
|
[
"public",
"void",
"init",
"(",
"String",
"strDateParam",
",",
"Date",
"dateTarget",
",",
"String",
"strLanguage",
")",
"{",
"if",
"(",
"strDateParam",
"!=",
"null",
")",
"dateParam",
"=",
"strDateParam",
";",
"// Property name",
"initComponents",
"(",
")",
";",
"this",
".",
"setName",
"(",
"\"JCalendarPopup\"",
")",
";",
"nowDate",
"=",
"new",
"Date",
"(",
")",
";",
"if",
"(",
"dateTarget",
"==",
"null",
")",
"dateTarget",
"=",
"nowDate",
";",
"selectedDate",
"=",
"dateTarget",
";",
"if",
"(",
"strLanguage",
"!=",
"null",
")",
"{",
"Locale",
"locale",
"=",
"new",
"Locale",
"(",
"strLanguage",
",",
"\"\"",
")",
";",
"if",
"(",
"locale",
"!=",
"null",
")",
"{",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
"locale",
")",
";",
"dateFormat",
"=",
"DateFormat",
".",
"getDateInstance",
"(",
"DateFormat",
".",
"FULL",
",",
"locale",
")",
";",
"}",
"}",
"calendar",
".",
"setTime",
"(",
"dateTarget",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"12",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"targetDate",
"=",
"calendar",
".",
"getTime",
"(",
")",
";",
"this",
".",
"layoutCalendar",
"(",
"targetDate",
")",
";",
"if",
"(",
"dateTarget",
"==",
"nowDate",
")",
"selectedDate",
"=",
"targetDate",
";",
"// If they want a default date, make the time 12:00",
"}"
] |
Creates new form CalendarPopup.
@param strDateParam The name of the date property (defaults to "date").
@param date The initial date for this button.
@param strLanguage The language to use.
|
[
"Creates",
"new",
"form",
"CalendarPopup",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L150-L180
|
148,818
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.nextMonthActionPerformed
|
private void nextMonthActionPerformed (ActionEvent evt)
{
calendar.setTime(targetPanelDate);
calendar.add(Calendar.MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
targetPanelDate = calendar.getTime();
this.layoutCalendar(targetPanelDate);
}
|
java
|
private void nextMonthActionPerformed (ActionEvent evt)
{
calendar.setTime(targetPanelDate);
calendar.add(Calendar.MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
targetPanelDate = calendar.getTime();
this.layoutCalendar(targetPanelDate);
}
|
[
"private",
"void",
"nextMonthActionPerformed",
"(",
"ActionEvent",
"evt",
")",
"{",
"calendar",
".",
"setTime",
"(",
"targetPanelDate",
")",
";",
"calendar",
".",
"add",
"(",
"Calendar",
".",
"MONTH",
",",
"1",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"12",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"targetPanelDate",
"=",
"calendar",
".",
"getTime",
"(",
")",
";",
"this",
".",
"layoutCalendar",
"(",
"targetPanelDate",
")",
";",
"}"
] |
User pressed the "next month" button, change the calendar.
@param evt The action event (ignored).
|
[
"User",
"pressed",
"the",
"next",
"month",
"button",
"change",
"the",
"calendar",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L385-L395
|
148,819
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.nextYearActionPerformed
|
private void nextYearActionPerformed (ActionEvent evt)
{
calendar.setTime(targetPanelDate);
calendar.add(Calendar.YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
targetPanelDate = calendar.getTime();
this.layoutCalendar(targetPanelDate);
}
|
java
|
private void nextYearActionPerformed (ActionEvent evt)
{
calendar.setTime(targetPanelDate);
calendar.add(Calendar.YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
targetPanelDate = calendar.getTime();
this.layoutCalendar(targetPanelDate);
}
|
[
"private",
"void",
"nextYearActionPerformed",
"(",
"ActionEvent",
"evt",
")",
"{",
"calendar",
".",
"setTime",
"(",
"targetPanelDate",
")",
";",
"calendar",
".",
"add",
"(",
"Calendar",
".",
"YEAR",
",",
"1",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"12",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"targetPanelDate",
"=",
"calendar",
".",
"getTime",
"(",
")",
";",
"this",
".",
"layoutCalendar",
"(",
"targetPanelDate",
")",
";",
"}"
] |
User pressed the "next year" button, change the calendar.
@param evt The action event (ignored).
|
[
"User",
"pressed",
"the",
"next",
"year",
"button",
"change",
"the",
"calendar",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L415-L425
|
148,820
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.getFirstDateInCalendar
|
public Date getFirstDateInCalendar(Date dateTarget)
{
// Now get the first box on the calendar
int iFirstDayOfWeek = calendar.getFirstDayOfWeek();
calendar.setTime(dateTarget);
int iTargetDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
int iOffset = -Math.abs(iTargetDayOfWeek - iFirstDayOfWeek);
calendar.add(Calendar.DATE, iOffset);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
|
java
|
public Date getFirstDateInCalendar(Date dateTarget)
{
// Now get the first box on the calendar
int iFirstDayOfWeek = calendar.getFirstDayOfWeek();
calendar.setTime(dateTarget);
int iTargetDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
int iOffset = -Math.abs(iTargetDayOfWeek - iFirstDayOfWeek);
calendar.add(Calendar.DATE, iOffset);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
|
[
"public",
"Date",
"getFirstDateInCalendar",
"(",
"Date",
"dateTarget",
")",
"{",
"// Now get the first box on the calendar",
"int",
"iFirstDayOfWeek",
"=",
"calendar",
".",
"getFirstDayOfWeek",
"(",
")",
";",
"calendar",
".",
"setTime",
"(",
"dateTarget",
")",
";",
"int",
"iTargetDayOfWeek",
"=",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_WEEK",
")",
";",
"int",
"iOffset",
"=",
"-",
"Math",
".",
"abs",
"(",
"iTargetDayOfWeek",
"-",
"iFirstDayOfWeek",
")",
";",
"calendar",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"iOffset",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"return",
"calendar",
".",
"getTime",
"(",
")",
";",
"}"
] |
Given the first date of the calendar, get the first date of that week.
@param dateTarget A valid date.
@return The first day in the week (day of week depends on Locale).
|
[
"Given",
"the",
"first",
"date",
"of",
"the",
"calendar",
"get",
"the",
"first",
"date",
"of",
"that",
"week",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L446-L461
|
148,821
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.mouseEntered
|
public void mouseEntered(MouseEvent evt)
{
JLabel button = (JLabel)evt.getSource();
oldBorder = button.getBorder();
button.setBorder(ROLLOVER_BORDER);
}
|
java
|
public void mouseEntered(MouseEvent evt)
{
JLabel button = (JLabel)evt.getSource();
oldBorder = button.getBorder();
button.setBorder(ROLLOVER_BORDER);
}
|
[
"public",
"void",
"mouseEntered",
"(",
"MouseEvent",
"evt",
")",
"{",
"JLabel",
"button",
"=",
"(",
"JLabel",
")",
"evt",
".",
"getSource",
"(",
")",
";",
"oldBorder",
"=",
"button",
".",
"getBorder",
"(",
")",
";",
"button",
".",
"setBorder",
"(",
"ROLLOVER_BORDER",
")",
";",
"}"
] |
Invoked when the mouse enters a component.
|
[
"Invoked",
"when",
"the",
"mouse",
"enters",
"a",
"component",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L538-L543
|
148,822
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.mouseExited
|
public void mouseExited(MouseEvent evt)
{
JLabel button = (JLabel)evt.getSource();
button.setBorder(oldBorder);
}
|
java
|
public void mouseExited(MouseEvent evt)
{
JLabel button = (JLabel)evt.getSource();
button.setBorder(oldBorder);
}
|
[
"public",
"void",
"mouseExited",
"(",
"MouseEvent",
"evt",
")",
"{",
"JLabel",
"button",
"=",
"(",
"JLabel",
")",
"evt",
".",
"getSource",
"(",
")",
";",
"button",
".",
"setBorder",
"(",
"oldBorder",
")",
";",
"}"
] |
Invoked when the mouse exits a component.
|
[
"Invoked",
"when",
"the",
"mouse",
"exits",
"a",
"component",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L547-L551
|
148,823
|
jbundle/jcalendarbutton
|
src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java
|
JCalendarPopup.getJPopupMenu
|
private JPopupMenu getJPopupMenu()
{
Container parent = this.getParent();
while (parent != null)
{
if (parent instanceof JPopupMenu)
return (JPopupMenu)parent;
parent = parent.getParent();
}
return null;
}
|
java
|
private JPopupMenu getJPopupMenu()
{
Container parent = this.getParent();
while (parent != null)
{
if (parent instanceof JPopupMenu)
return (JPopupMenu)parent;
parent = parent.getParent();
}
return null;
}
|
[
"private",
"JPopupMenu",
"getJPopupMenu",
"(",
")",
"{",
"Container",
"parent",
"=",
"this",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
"instanceof",
"JPopupMenu",
")",
"return",
"(",
"JPopupMenu",
")",
"parent",
";",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get the parent popup menu.
@return The popup menu.
|
[
"Get",
"the",
"parent",
"popup",
"menu",
"."
] |
2944e6a0b634b83768d5c0b7b4a2898176421403
|
https://github.com/jbundle/jcalendarbutton/blob/2944e6a0b634b83768d5c0b7b4a2898176421403/src/main/java/org/jbundle/util/jcalendarbutton/JCalendarPopup.java#L556-L566
|
148,824
|
openbase/jul
|
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGLogoPaneController.java
|
SVGLogoPaneController.setText
|
public void setText(final String text) {
this.text.setText(text);
this.text.setFont(Font.font(this.text.getFont().getFamily(), FontWeight.BOLD, size / 2));
stack.requestLayout();
}
|
java
|
public void setText(final String text) {
this.text.setText(text);
this.text.setFont(Font.font(this.text.getFont().getFamily(), FontWeight.BOLD, size / 2));
stack.requestLayout();
}
|
[
"public",
"void",
"setText",
"(",
"final",
"String",
"text",
")",
"{",
"this",
".",
"text",
".",
"setText",
"(",
"text",
")",
";",
"this",
".",
"text",
".",
"setFont",
"(",
"Font",
".",
"font",
"(",
"this",
".",
"text",
".",
"getFont",
"(",
")",
".",
"getFamily",
"(",
")",
",",
"FontWeight",
".",
"BOLD",
",",
"size",
"/",
"2",
")",
")",
";",
"stack",
".",
"requestLayout",
"(",
")",
";",
"}"
] |
Method sets the text displayed next to the logo.
@param text
|
[
"Method",
"sets",
"the",
"text",
"displayed",
"next",
"to",
"the",
"logo",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGLogoPaneController.java#L62-L66
|
148,825
|
openbase/jul
|
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGLogoPaneController.java
|
SVGLogoPaneController.setSvgIcon
|
public void setSvgIcon(final SVGIcon svgIcon) {
if (this.svgIcon != null) {
stack.getChildren().remove(this.svgIcon);
}
this.svgIcon = svgIcon;
this.svgIcon.setSize(size);
stack.getChildren().add(this.svgIcon);
stack.requestLayout();
}
|
java
|
public void setSvgIcon(final SVGIcon svgIcon) {
if (this.svgIcon != null) {
stack.getChildren().remove(this.svgIcon);
}
this.svgIcon = svgIcon;
this.svgIcon.setSize(size);
stack.getChildren().add(this.svgIcon);
stack.requestLayout();
}
|
[
"public",
"void",
"setSvgIcon",
"(",
"final",
"SVGIcon",
"svgIcon",
")",
"{",
"if",
"(",
"this",
".",
"svgIcon",
"!=",
"null",
")",
"{",
"stack",
".",
"getChildren",
"(",
")",
".",
"remove",
"(",
"this",
".",
"svgIcon",
")",
";",
"}",
"this",
".",
"svgIcon",
"=",
"svgIcon",
";",
"this",
".",
"svgIcon",
".",
"setSize",
"(",
"size",
")",
";",
"stack",
".",
"getChildren",
"(",
")",
".",
"add",
"(",
"this",
".",
"svgIcon",
")",
";",
"stack",
".",
"requestLayout",
"(",
")",
";",
"}"
] |
Method sets the icon to display.
@param svgIcon
|
[
"Method",
"sets",
"the",
"icon",
"to",
"display",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGLogoPaneController.java#L80-L88
|
148,826
|
openbase/jul
|
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGLogoPaneController.java
|
SVGLogoPaneController.setSize
|
public void setSize(final double size) {
this.size = size;
stack.setPrefSize(size, size);
text.setFont(Font.font(text.getFont().getFamily(), FontWeight.BOLD, size / 2));
svgIcon.setSize(size);
stack.requestLayout();
}
|
java
|
public void setSize(final double size) {
this.size = size;
stack.setPrefSize(size, size);
text.setFont(Font.font(text.getFont().getFamily(), FontWeight.BOLD, size / 2));
svgIcon.setSize(size);
stack.requestLayout();
}
|
[
"public",
"void",
"setSize",
"(",
"final",
"double",
"size",
")",
"{",
"this",
".",
"size",
"=",
"size",
";",
"stack",
".",
"setPrefSize",
"(",
"size",
",",
"size",
")",
";",
"text",
".",
"setFont",
"(",
"Font",
".",
"font",
"(",
"text",
".",
"getFont",
"(",
")",
".",
"getFamily",
"(",
")",
",",
"FontWeight",
".",
"BOLD",
",",
"size",
"/",
"2",
")",
")",
";",
"svgIcon",
".",
"setSize",
"(",
"size",
")",
";",
"stack",
".",
"requestLayout",
"(",
")",
";",
"}"
] |
Method can be used to set the size of this component.
@param size
|
[
"Method",
"can",
"be",
"used",
"to",
"set",
"the",
"size",
"of",
"this",
"component",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGLogoPaneController.java#L94-L100
|
148,827
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/PropositionUtil.java
|
PropositionUtil.getView
|
public static <T extends TemporalProposition> List<T> getView(
List<T> params, Long minValid, Long maxValid) {
if (params != null) {
if (minValid == null && maxValid == null) {
return params;
} else {
int min = minValid != null ? binarySearchMinStart(params,
minValid.longValue()) : 0;
int max = maxValid != null ? binarySearchMaxFinish(params,
maxValid.longValue()) : params.size();
return params.subList(min, max);
}
} else {
return null;
}
}
|
java
|
public static <T extends TemporalProposition> List<T> getView(
List<T> params, Long minValid, Long maxValid) {
if (params != null) {
if (minValid == null && maxValid == null) {
return params;
} else {
int min = minValid != null ? binarySearchMinStart(params,
minValid.longValue()) : 0;
int max = maxValid != null ? binarySearchMaxFinish(params,
maxValid.longValue()) : params.size();
return params.subList(min, max);
}
} else {
return null;
}
}
|
[
"public",
"static",
"<",
"T",
"extends",
"TemporalProposition",
">",
"List",
"<",
"T",
">",
"getView",
"(",
"List",
"<",
"T",
">",
"params",
",",
"Long",
"minValid",
",",
"Long",
"maxValid",
")",
"{",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"if",
"(",
"minValid",
"==",
"null",
"&&",
"maxValid",
"==",
"null",
")",
"{",
"return",
"params",
";",
"}",
"else",
"{",
"int",
"min",
"=",
"minValid",
"!=",
"null",
"?",
"binarySearchMinStart",
"(",
"params",
",",
"minValid",
".",
"longValue",
"(",
")",
")",
":",
"0",
";",
"int",
"max",
"=",
"maxValid",
"!=",
"null",
"?",
"binarySearchMaxFinish",
"(",
"params",
",",
"maxValid",
".",
"longValue",
"(",
")",
")",
":",
"params",
".",
"size",
"(",
")",
";",
"return",
"params",
".",
"subList",
"(",
"min",
",",
"max",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Filters a list of temporal propositions by time.
@param params
a <code>List</code> of propositions.
@param minValid
@param maxValid
@return
|
[
"Filters",
"a",
"list",
"of",
"temporal",
"propositions",
"by",
"time",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/PropositionUtil.java#L52-L67
|
148,828
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/PropositionUtil.java
|
PropositionUtil.createPropositionMap
|
public static <T extends Proposition> Map<String, List<T>> createPropositionMap(
List<T> propositions) {
Map<String, List<T>> result = new HashMap<>();
if (propositions != null) {
for (T prop : propositions) {
String propId = prop.getId();
List<T> ts = null;
if (result.containsKey(propId)) {
ts = result.get(propId);
} else {
ts = new ArrayList<>();
result.put(propId, ts);
}
ts.add(prop);
}
}
return result;
}
|
java
|
public static <T extends Proposition> Map<String, List<T>> createPropositionMap(
List<T> propositions) {
Map<String, List<T>> result = new HashMap<>();
if (propositions != null) {
for (T prop : propositions) {
String propId = prop.getId();
List<T> ts = null;
if (result.containsKey(propId)) {
ts = result.get(propId);
} else {
ts = new ArrayList<>();
result.put(propId, ts);
}
ts.add(prop);
}
}
return result;
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Proposition",
">",
"Map",
"<",
"String",
",",
"List",
"<",
"T",
">",
">",
"createPropositionMap",
"(",
"List",
"<",
"T",
">",
"propositions",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"T",
">",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"if",
"(",
"propositions",
"!=",
"null",
")",
"{",
"for",
"(",
"T",
"prop",
":",
"propositions",
")",
"{",
"String",
"propId",
"=",
"prop",
".",
"getId",
"(",
")",
";",
"List",
"<",
"T",
">",
"ts",
"=",
"null",
";",
"if",
"(",
"result",
".",
"containsKey",
"(",
"propId",
")",
")",
"{",
"ts",
"=",
"result",
".",
"get",
"(",
"propId",
")",
";",
"}",
"else",
"{",
"ts",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"result",
".",
"put",
"(",
"propId",
",",
"ts",
")",
";",
"}",
"ts",
".",
"add",
"(",
"prop",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Divides a list of propositions up by id.
@param propositions
a <code>List</code> of <code>Proposition</code>s.
@return a Map of id <code>String</code> -> <code>List</code>, with
propositions in the same order as they were found in the
argument.
|
[
"Divides",
"a",
"list",
"of",
"propositions",
"up",
"by",
"id",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/PropositionUtil.java#L92-L112
|
148,829
|
openbase/jul
|
extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/MessageObservable.java
|
MessageObservable.removeTimestamps
|
public Builder removeTimestamps(final Builder builder) {
final Descriptors.Descriptor descriptorForType = builder.getDescriptorForType();
for (final Descriptors.FieldDescriptor field : descriptorForType.getFields()) {
// if the field is not repeated, a message and a timestamp it is cleared
if (!field.isRepeated() && field.getType() == Descriptors.FieldDescriptor.Type.MESSAGE) {
//===============================================================
//TODO: This is just a hack since states in units now contain action descriptions,
// This line prevents resource allocations to be checked because they contain required fields
// and thus if they are checked calling build on the builder afterwards fails.
// can be removed after switching to protobuf 3 or replacing the resource allocation type
if (field.getName().equals(RESOURCE_ALLOCATION_FIELD)) {
continue;
}
//===============================================================
if (field.getMessageType().getName().equals(TIMESTAMP_MESSAGE_NAME)) {
builder.clearField(field);
} else {
// skip checking recursively if the field is not even initialized
if (builder.hasField(field)) {
removeTimestamps(builder.getFieldBuilder(field));
}
}
}
}
return builder;
}
|
java
|
public Builder removeTimestamps(final Builder builder) {
final Descriptors.Descriptor descriptorForType = builder.getDescriptorForType();
for (final Descriptors.FieldDescriptor field : descriptorForType.getFields()) {
// if the field is not repeated, a message and a timestamp it is cleared
if (!field.isRepeated() && field.getType() == Descriptors.FieldDescriptor.Type.MESSAGE) {
//===============================================================
//TODO: This is just a hack since states in units now contain action descriptions,
// This line prevents resource allocations to be checked because they contain required fields
// and thus if they are checked calling build on the builder afterwards fails.
// can be removed after switching to protobuf 3 or replacing the resource allocation type
if (field.getName().equals(RESOURCE_ALLOCATION_FIELD)) {
continue;
}
//===============================================================
if (field.getMessageType().getName().equals(TIMESTAMP_MESSAGE_NAME)) {
builder.clearField(field);
} else {
// skip checking recursively if the field is not even initialized
if (builder.hasField(field)) {
removeTimestamps(builder.getFieldBuilder(field));
}
}
}
}
return builder;
}
|
[
"public",
"Builder",
"removeTimestamps",
"(",
"final",
"Builder",
"builder",
")",
"{",
"final",
"Descriptors",
".",
"Descriptor",
"descriptorForType",
"=",
"builder",
".",
"getDescriptorForType",
"(",
")",
";",
"for",
"(",
"final",
"Descriptors",
".",
"FieldDescriptor",
"field",
":",
"descriptorForType",
".",
"getFields",
"(",
")",
")",
"{",
"// if the field is not repeated, a message and a timestamp it is cleared",
"if",
"(",
"!",
"field",
".",
"isRepeated",
"(",
")",
"&&",
"field",
".",
"getType",
"(",
")",
"==",
"Descriptors",
".",
"FieldDescriptor",
".",
"Type",
".",
"MESSAGE",
")",
"{",
"//===============================================================",
"//TODO: This is just a hack since states in units now contain action descriptions,",
"// This line prevents resource allocations to be checked because they contain required fields",
"// and thus if they are checked calling build on the builder afterwards fails.",
"// can be removed after switching to protobuf 3 or replacing the resource allocation type",
"if",
"(",
"field",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"RESOURCE_ALLOCATION_FIELD",
")",
")",
"{",
"continue",
";",
"}",
"//===============================================================",
"if",
"(",
"field",
".",
"getMessageType",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"TIMESTAMP_MESSAGE_NAME",
")",
")",
"{",
"builder",
".",
"clearField",
"(",
"field",
")",
";",
"}",
"else",
"{",
"// skip checking recursively if the field is not even initialized",
"if",
"(",
"builder",
".",
"hasField",
"(",
"field",
")",
")",
"{",
"removeTimestamps",
"(",
"builder",
".",
"getFieldBuilder",
"(",
"field",
")",
")",
";",
"}",
"}",
"}",
"}",
"return",
"builder",
";",
"}"
] |
Recursively clear timestamp messages from a builder. For efficiency repeated fields are ignored.
@param builder the builder from which all timestamps are cleared
@return the updated builder
|
[
"Recursively",
"clear",
"timestamp",
"messages",
"from",
"a",
"builder",
".",
"For",
"efficiency",
"repeated",
"fields",
"are",
"ignored",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/MessageObservable.java#L79-L104
|
148,830
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.updateTimestampWithCurrentTime
|
public static <M extends MessageOrBuilder> M updateTimestampWithCurrentTime(final M messageOrBuilder) throws CouldNotPerformException {
return updateTimestamp(System.currentTimeMillis(), messageOrBuilder);
}
|
java
|
public static <M extends MessageOrBuilder> M updateTimestampWithCurrentTime(final M messageOrBuilder) throws CouldNotPerformException {
return updateTimestamp(System.currentTimeMillis(), messageOrBuilder);
}
|
[
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"updateTimestampWithCurrentTime",
"(",
"final",
"M",
"messageOrBuilder",
")",
"throws",
"CouldNotPerformException",
"{",
"return",
"updateTimestamp",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"messageOrBuilder",
")",
";",
"}"
] |
Method updates the timestamp field of the given message with the current time.
@param <M> the message type of the message to update.
@param messageOrBuilder the message
@return the updated message
@throws CouldNotPerformException is thrown in case the copy could not be performed e.g. because of a missing timestamp field.
|
[
"Method",
"updates",
"the",
"timestamp",
"field",
"of",
"the",
"given",
"message",
"with",
"the",
"current",
"time",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L68-L70
|
148,831
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.updateTimestamp
|
public static <M extends MessageOrBuilder> M updateTimestamp(final long milliseconds, final M messageOrBuilder) throws CouldNotPerformException {
return updateTimestamp(milliseconds, messageOrBuilder, TimeUnit.MILLISECONDS);
}
|
java
|
public static <M extends MessageOrBuilder> M updateTimestamp(final long milliseconds, final M messageOrBuilder) throws CouldNotPerformException {
return updateTimestamp(milliseconds, messageOrBuilder, TimeUnit.MILLISECONDS);
}
|
[
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"updateTimestamp",
"(",
"final",
"long",
"milliseconds",
",",
"final",
"M",
"messageOrBuilder",
")",
"throws",
"CouldNotPerformException",
"{",
"return",
"updateTimestamp",
"(",
"milliseconds",
",",
"messageOrBuilder",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] |
Method updates the timestamp field of the given message with the given timestamp.
@param <M> the message type of the message to milliseconds.
@param milliseconds the time to update
@param messageOrBuilder the message
@return the updated message
@throws CouldNotPerformException is thrown in case the copy could not be performed e.g. because of a missing timestamp field.
|
[
"Method",
"updates",
"the",
"timestamp",
"field",
"of",
"the",
"given",
"message",
"with",
"the",
"given",
"timestamp",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L83-L85
|
148,832
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.updateTimestamp
|
public static <M extends MessageOrBuilder> M updateTimestamp(final long time, final M messageOrBuilder, final TimeUnit timeUnit) throws CouldNotPerformException {
long milliseconds = TimeUnit.MILLISECONDS.convert(time, timeUnit);
try {
if (messageOrBuilder == null) {
throw new NotAvailableException("messageOrBuilder");
}
try {
// handle builder
if (messageOrBuilder.getClass().getSimpleName().equals("Builder")) {
messageOrBuilder.getClass().getMethod(SET + TIMESTAMP_NAME, Timestamp.class).invoke(messageOrBuilder, TimestampJavaTimeTransform.transform(milliseconds));
return messageOrBuilder;
}
//handle message
final Object builder = messageOrBuilder.getClass().getMethod("toBuilder").invoke(messageOrBuilder);
builder.getClass().getMethod(SET + TIMESTAMP_NAME, Timestamp.class).invoke(builder, TimestampJavaTimeTransform.transform(milliseconds));
return (M) builder.getClass().getMethod("build").invoke(builder);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex) {
throw new NotSupportedException("Field[Timestamp]", messageOrBuilder.getClass().getName(), ex);
}
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not update timestemp! ", ex);
}
}
|
java
|
public static <M extends MessageOrBuilder> M updateTimestamp(final long time, final M messageOrBuilder, final TimeUnit timeUnit) throws CouldNotPerformException {
long milliseconds = TimeUnit.MILLISECONDS.convert(time, timeUnit);
try {
if (messageOrBuilder == null) {
throw new NotAvailableException("messageOrBuilder");
}
try {
// handle builder
if (messageOrBuilder.getClass().getSimpleName().equals("Builder")) {
messageOrBuilder.getClass().getMethod(SET + TIMESTAMP_NAME, Timestamp.class).invoke(messageOrBuilder, TimestampJavaTimeTransform.transform(milliseconds));
return messageOrBuilder;
}
//handle message
final Object builder = messageOrBuilder.getClass().getMethod("toBuilder").invoke(messageOrBuilder);
builder.getClass().getMethod(SET + TIMESTAMP_NAME, Timestamp.class).invoke(builder, TimestampJavaTimeTransform.transform(milliseconds));
return (M) builder.getClass().getMethod("build").invoke(builder);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex) {
throw new NotSupportedException("Field[Timestamp]", messageOrBuilder.getClass().getName(), ex);
}
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not update timestemp! ", ex);
}
}
|
[
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"updateTimestamp",
"(",
"final",
"long",
"time",
",",
"final",
"M",
"messageOrBuilder",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"throws",
"CouldNotPerformException",
"{",
"long",
"milliseconds",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"time",
",",
"timeUnit",
")",
";",
"try",
"{",
"if",
"(",
"messageOrBuilder",
"==",
"null",
")",
"{",
"throw",
"new",
"NotAvailableException",
"(",
"\"messageOrBuilder\"",
")",
";",
"}",
"try",
"{",
"// handle builder",
"if",
"(",
"messageOrBuilder",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"\"Builder\"",
")",
")",
"{",
"messageOrBuilder",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"SET",
"+",
"TIMESTAMP_NAME",
",",
"Timestamp",
".",
"class",
")",
".",
"invoke",
"(",
"messageOrBuilder",
",",
"TimestampJavaTimeTransform",
".",
"transform",
"(",
"milliseconds",
")",
")",
";",
"return",
"messageOrBuilder",
";",
"}",
"//handle message",
"final",
"Object",
"builder",
"=",
"messageOrBuilder",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"toBuilder\"",
")",
".",
"invoke",
"(",
"messageOrBuilder",
")",
";",
"builder",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"SET",
"+",
"TIMESTAMP_NAME",
",",
"Timestamp",
".",
"class",
")",
".",
"invoke",
"(",
"builder",
",",
"TimestampJavaTimeTransform",
".",
"transform",
"(",
"milliseconds",
")",
")",
";",
"return",
"(",
"M",
")",
"builder",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"build\"",
")",
".",
"invoke",
"(",
"builder",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"IllegalArgumentException",
"|",
"InvocationTargetException",
"|",
"NoSuchMethodException",
"ex",
")",
"{",
"throw",
"new",
"NotSupportedException",
"(",
"\"Field[Timestamp]\"",
",",
"messageOrBuilder",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"ex",
")",
";",
"}",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not update timestemp! \"",
",",
"ex",
")",
";",
"}",
"}"
] |
Method updates the timestamp field of the given message with the given time in the given timeUnit.
@param <M> the message type of the message which is updated
@param time the time which is put in the timestamp field
@param messageOrBuilder the message
@param timeUnit the unit of time
@return the updated message
@throws CouldNotPerformException is thrown in case the copy could not be performed e.g. because of a missing timestamp field.
|
[
"Method",
"updates",
"the",
"timestamp",
"field",
"of",
"the",
"given",
"message",
"with",
"the",
"given",
"time",
"in",
"the",
"given",
"timeUnit",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L99-L125
|
148,833
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.updateTimestamp
|
public static <M extends MessageOrBuilder> M updateTimestamp(final long timestamp, final M messageOrBuilder, final TimeUnit timeUnit, final Logger logger) {
try {
return updateTimestamp(timestamp, messageOrBuilder, timeUnit);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
}
|
java
|
public static <M extends MessageOrBuilder> M updateTimestamp(final long timestamp, final M messageOrBuilder, final TimeUnit timeUnit, final Logger logger) {
try {
return updateTimestamp(timestamp, messageOrBuilder, timeUnit);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
}
|
[
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"updateTimestamp",
"(",
"final",
"long",
"timestamp",
",",
"final",
"M",
"messageOrBuilder",
",",
"final",
"TimeUnit",
"timeUnit",
",",
"final",
"Logger",
"logger",
")",
"{",
"try",
"{",
"return",
"updateTimestamp",
"(",
"timestamp",
",",
"messageOrBuilder",
",",
"timeUnit",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"ExceptionPrinter",
".",
"printHistory",
"(",
"ex",
",",
"logger",
")",
";",
"return",
"messageOrBuilder",
";",
"}",
"}"
] |
Method updates the timestamp field of the given message with the given timestamp.
In case of an error the original message is returned.
@param <M> the message type of the message to update.
@param timestamp the timestamp to update
@param messageOrBuilder the message
@param timeUnit the timeUnit of the timeStamp
@param logger the logger which is used for printing the exception stack in case something went wrong.
@return the updated message or the original one in case of errors.
|
[
"Method",
"updates",
"the",
"timestamp",
"field",
"of",
"the",
"given",
"message",
"with",
"the",
"given",
"timestamp",
".",
"In",
"case",
"of",
"an",
"error",
"the",
"original",
"message",
"is",
"returned",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L157-L164
|
148,834
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.updateTimestampWithCurrentTime
|
public static <M extends MessageOrBuilder> M updateTimestampWithCurrentTime(final M messageOrBuilder, final Logger logger) {
try {
return updateTimestampWithCurrentTime(messageOrBuilder);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
}
|
java
|
public static <M extends MessageOrBuilder> M updateTimestampWithCurrentTime(final M messageOrBuilder, final Logger logger) {
try {
return updateTimestampWithCurrentTime(messageOrBuilder);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
}
|
[
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"updateTimestampWithCurrentTime",
"(",
"final",
"M",
"messageOrBuilder",
",",
"final",
"Logger",
"logger",
")",
"{",
"try",
"{",
"return",
"updateTimestampWithCurrentTime",
"(",
"messageOrBuilder",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"ExceptionPrinter",
".",
"printHistory",
"(",
"ex",
",",
"logger",
")",
";",
"return",
"messageOrBuilder",
";",
"}",
"}"
] |
Method updates the timestamp field of the given message with the current time.
In case of an error the original message is returned.
@param <M> the message type of the message to update.
@param messageOrBuilder the message
@param logger the logger which is used for printing the exception stack in case something went wrong.
@return the updated message or the original one in case of errors.
|
[
"Method",
"updates",
"the",
"timestamp",
"field",
"of",
"the",
"given",
"message",
"with",
"the",
"current",
"time",
".",
"In",
"case",
"of",
"an",
"error",
"the",
"original",
"message",
"is",
"returned",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L232-L239
|
148,835
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.hasTimestamp
|
public static boolean hasTimestamp(final MessageOrBuilder messageOrBuilder) {
try {
final FieldDescriptor fieldDescriptor = ProtoBufFieldProcessor.getFieldDescriptor(messageOrBuilder, TIMESTAMP_FIELD_NAME);
return messageOrBuilder.hasField(fieldDescriptor);
} catch (NotAvailableException ex) {
return false;
}
}
|
java
|
public static boolean hasTimestamp(final MessageOrBuilder messageOrBuilder) {
try {
final FieldDescriptor fieldDescriptor = ProtoBufFieldProcessor.getFieldDescriptor(messageOrBuilder, TIMESTAMP_FIELD_NAME);
return messageOrBuilder.hasField(fieldDescriptor);
} catch (NotAvailableException ex) {
return false;
}
}
|
[
"public",
"static",
"boolean",
"hasTimestamp",
"(",
"final",
"MessageOrBuilder",
"messageOrBuilder",
")",
"{",
"try",
"{",
"final",
"FieldDescriptor",
"fieldDescriptor",
"=",
"ProtoBufFieldProcessor",
".",
"getFieldDescriptor",
"(",
"messageOrBuilder",
",",
"TIMESTAMP_FIELD_NAME",
")",
";",
"return",
"messageOrBuilder",
".",
"hasField",
"(",
"fieldDescriptor",
")",
";",
"}",
"catch",
"(",
"NotAvailableException",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Method return true if the given message contains a timestamp field.
@param messageOrBuilder the message to analyze
@return true if the timestamp field is provided, otherwise false.
|
[
"Method",
"return",
"true",
"if",
"the",
"given",
"message",
"contains",
"a",
"timestamp",
"field",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L246-L253
|
148,836
|
ops4j/org.ops4j.pax.wicket
|
service/src/main/java/org/ops4j/pax/wicket/api/support/AbstractPageFactory.java
|
AbstractPageFactory.setApplicationName
|
protected final void setApplicationName(String applicationName) throws IllegalArgumentException {
validateNotEmpty(applicationName, "applicationName");
synchronized (this) {
properties.put(APPLICATION_NAME, applicationName);
}
}
|
java
|
protected final void setApplicationName(String applicationName) throws IllegalArgumentException {
validateNotEmpty(applicationName, "applicationName");
synchronized (this) {
properties.put(APPLICATION_NAME, applicationName);
}
}
|
[
"protected",
"final",
"void",
"setApplicationName",
"(",
"String",
"applicationName",
")",
"throws",
"IllegalArgumentException",
"{",
"validateNotEmpty",
"(",
"applicationName",
",",
"\"applicationName\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"properties",
".",
"put",
"(",
"APPLICATION_NAME",
",",
"applicationName",
")",
";",
"}",
"}"
] |
Sets the application name.
@param applicationName The application name. This argument must not be {@code null} or empty.
@throws java.lang.IllegalArgumentException Thrown if the specified {@code applicationName} is {@code null}.
@since 1.0.0
|
[
"Sets",
"the",
"application",
"name",
"."
] |
ef7cb4bdf918e9e61ec69789b9c690567616faa9
|
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/api/support/AbstractPageFactory.java#L189-L194
|
148,837
|
ops4j/org.ops4j.pax.wicket
|
service/src/main/java/org/ops4j/pax/wicket/api/support/AbstractPageFactory.java
|
AbstractPageFactory.setPageName
|
protected final void setPageName(String pageName) throws IllegalArgumentException {
validateNotEmpty(pageName, "pageName");
synchronized (this) {
properties.put(PAGE_NAME, pageName);
}
}
|
java
|
protected final void setPageName(String pageName) throws IllegalArgumentException {
validateNotEmpty(pageName, "pageName");
synchronized (this) {
properties.put(PAGE_NAME, pageName);
}
}
|
[
"protected",
"final",
"void",
"setPageName",
"(",
"String",
"pageName",
")",
"throws",
"IllegalArgumentException",
"{",
"validateNotEmpty",
"(",
"pageName",
",",
"\"pageName\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"properties",
".",
"put",
"(",
"PAGE_NAME",
",",
"pageName",
")",
";",
"}",
"}"
] |
Set the page name.
@param pageName The page name. This argument must not be {@code null} or empty.
@throws java.lang.IllegalArgumentException Thrown if the specified {@code pageName} arguments are {@code null}.
@since 1.0.0
|
[
"Set",
"the",
"page",
"name",
"."
] |
ef7cb4bdf918e9e61ec69789b9c690567616faa9
|
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/api/support/AbstractPageFactory.java#L216-L221
|
148,838
|
netkicorp/java-wns-resolver
|
src/main/java/com/netki/WalletNameResolver.java
|
WalletNameResolver.resolve
|
public BitcoinURI resolve(String label, String currency, boolean validateTLSA) throws WalletNameLookupException {
String resolved;
label = label.toLowerCase();
currency = currency.toLowerCase();
if (label.isEmpty()) {
throw new WalletNameLookupException("Wallet Name Label Must Non-Empty");
}
try {
resolved = this.resolver.resolve(String.format("_%s._wallet.%s", currency, DNSUtil.ensureDot(this.preprocessWalletName(label))), Type.TXT);
if (resolved == null || resolved.equals("")) {
throw new WalletNameCurrencyUnavailableException("Currency Not Available in Wallet Name");
}
} catch (DNSSECException e) {
if (this.backupDnsServerIndex >= this.resolver.getBackupDnsServers().size()) {
throw new WalletNameLookupException(e.getMessage(), e);
}
this.resolver.useBackupDnsServer(this.backupDnsServerIndex++);
return this.resolve(label, currency, validateTLSA);
}
byte[] decodeResult = BaseEncoding.base64().decode(resolved);
try {
URL walletNameUrl = new URL(new String(decodeResult));
return processWalletNameUrl(walletNameUrl, validateTLSA);
} catch (MalformedURLException e) { /* This is not a URL */ }
try {
this.backupDnsServerIndex = 0;
return new BitcoinURI(resolved);
} catch (BitcoinURIParseException e) {
try {
return new BitcoinURI("bitcoin:" + resolved);
} catch (BitcoinURIParseException e1) {
throw new WalletNameLookupException("BitcoinURI Creation Failed for " + resolved, e1);
}
}
}
|
java
|
public BitcoinURI resolve(String label, String currency, boolean validateTLSA) throws WalletNameLookupException {
String resolved;
label = label.toLowerCase();
currency = currency.toLowerCase();
if (label.isEmpty()) {
throw new WalletNameLookupException("Wallet Name Label Must Non-Empty");
}
try {
resolved = this.resolver.resolve(String.format("_%s._wallet.%s", currency, DNSUtil.ensureDot(this.preprocessWalletName(label))), Type.TXT);
if (resolved == null || resolved.equals("")) {
throw new WalletNameCurrencyUnavailableException("Currency Not Available in Wallet Name");
}
} catch (DNSSECException e) {
if (this.backupDnsServerIndex >= this.resolver.getBackupDnsServers().size()) {
throw new WalletNameLookupException(e.getMessage(), e);
}
this.resolver.useBackupDnsServer(this.backupDnsServerIndex++);
return this.resolve(label, currency, validateTLSA);
}
byte[] decodeResult = BaseEncoding.base64().decode(resolved);
try {
URL walletNameUrl = new URL(new String(decodeResult));
return processWalletNameUrl(walletNameUrl, validateTLSA);
} catch (MalformedURLException e) { /* This is not a URL */ }
try {
this.backupDnsServerIndex = 0;
return new BitcoinURI(resolved);
} catch (BitcoinURIParseException e) {
try {
return new BitcoinURI("bitcoin:" + resolved);
} catch (BitcoinURIParseException e1) {
throw new WalletNameLookupException("BitcoinURI Creation Failed for " + resolved, e1);
}
}
}
|
[
"public",
"BitcoinURI",
"resolve",
"(",
"String",
"label",
",",
"String",
"currency",
",",
"boolean",
"validateTLSA",
")",
"throws",
"WalletNameLookupException",
"{",
"String",
"resolved",
";",
"label",
"=",
"label",
".",
"toLowerCase",
"(",
")",
";",
"currency",
"=",
"currency",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"label",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"WalletNameLookupException",
"(",
"\"Wallet Name Label Must Non-Empty\"",
")",
";",
"}",
"try",
"{",
"resolved",
"=",
"this",
".",
"resolver",
".",
"resolve",
"(",
"String",
".",
"format",
"(",
"\"_%s._wallet.%s\"",
",",
"currency",
",",
"DNSUtil",
".",
"ensureDot",
"(",
"this",
".",
"preprocessWalletName",
"(",
"label",
")",
")",
")",
",",
"Type",
".",
"TXT",
")",
";",
"if",
"(",
"resolved",
"==",
"null",
"||",
"resolved",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"throw",
"new",
"WalletNameCurrencyUnavailableException",
"(",
"\"Currency Not Available in Wallet Name\"",
")",
";",
"}",
"}",
"catch",
"(",
"DNSSECException",
"e",
")",
"{",
"if",
"(",
"this",
".",
"backupDnsServerIndex",
">=",
"this",
".",
"resolver",
".",
"getBackupDnsServers",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"WalletNameLookupException",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"this",
".",
"resolver",
".",
"useBackupDnsServer",
"(",
"this",
".",
"backupDnsServerIndex",
"++",
")",
";",
"return",
"this",
".",
"resolve",
"(",
"label",
",",
"currency",
",",
"validateTLSA",
")",
";",
"}",
"byte",
"[",
"]",
"decodeResult",
"=",
"BaseEncoding",
".",
"base64",
"(",
")",
".",
"decode",
"(",
"resolved",
")",
";",
"try",
"{",
"URL",
"walletNameUrl",
"=",
"new",
"URL",
"(",
"new",
"String",
"(",
"decodeResult",
")",
")",
";",
"return",
"processWalletNameUrl",
"(",
"walletNameUrl",
",",
"validateTLSA",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"/* This is not a URL */",
"}",
"try",
"{",
"this",
".",
"backupDnsServerIndex",
"=",
"0",
";",
"return",
"new",
"BitcoinURI",
"(",
"resolved",
")",
";",
"}",
"catch",
"(",
"BitcoinURIParseException",
"e",
")",
"{",
"try",
"{",
"return",
"new",
"BitcoinURI",
"(",
"\"bitcoin:\"",
"+",
"resolved",
")",
";",
"}",
"catch",
"(",
"BitcoinURIParseException",
"e1",
")",
"{",
"throw",
"new",
"WalletNameLookupException",
"(",
"\"BitcoinURI Creation Failed for \"",
"+",
"resolved",
",",
"e1",
")",
";",
"}",
"}",
"}"
] |
Resolve a Wallet Name
This method is thread safe as it does not depend on any externally mutable variables.
@param label DNS Name (i.e., wallet.mattdavid.xyz)
@param currency 3 Letter Code to Denote the Requested Currency (i.e., "btc", "ltc", "dgc")
@param validateTLSA Boolean to require TLSA validation for an URL Endpoints
@return Raw Cryptocurrency Address or Bitcoin URI (BIP21/BIP72)
@throws WalletNameLookupException Wallet Name Lookup Failure including message
|
[
"Resolve",
"a",
"Wallet",
"Name"
] |
a7aad04d96c03feb05536aef189617beb4f011bc
|
https://github.com/netkicorp/java-wns-resolver/blob/a7aad04d96c03feb05536aef189617beb4f011bc/src/main/java/com/netki/WalletNameResolver.java#L138-L176
|
148,839
|
netkicorp/java-wns-resolver
|
src/main/java/com/netki/WalletNameResolver.java
|
WalletNameResolver.processWalletNameUrl
|
public BitcoinURI processWalletNameUrl(URL url, boolean verifyTLSA) throws WalletNameLookupException {
HttpsURLConnection conn = null;
InputStream ins;
InputStreamReader isr;
BufferedReader in = null;
Certificate possibleRootCert = null;
if (verifyTLSA) {
try {
if (!this.tlsaValidator.validateTLSA(url)) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed");
}
} catch (ValidSelfSignedCertException ve) {
// TLSA Uses a Self-Signed Root Cert, We Need to Add to CACerts
possibleRootCert = ve.getRootCert();
} catch (Exception e) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed", e);
}
}
try {
conn = (HttpsURLConnection) url.openConnection();
// If we have a self-signed cert returned during TLSA Validation, add it to the SSLContext for the HTTPS Connection
if (possibleRootCert != null) {
try {
KeyStore ssKeystore = KeyStore.getInstance(KeyStore.getDefaultType());
ssKeystore.load(null, null);
ssKeystore.setCertificateEntry(((X509Certificate) possibleRootCert).getSubjectDN().toString(), possibleRootCert);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ssKeystore);
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tmf.getTrustManagers(), null);
conn.setSSLSocketFactory(ctx.getSocketFactory());
} catch (Exception e) {
throw new WalletNameTlsaValidationException("Failed to Add TLSA Self Signed Certificate to HttpsURLConnection", e);
}
}
ins = conn.getInputStream();
isr = new InputStreamReader(ins);
in = new BufferedReader(isr);
String inputLine;
String data = "";
while ((inputLine = in.readLine()) != null) {
data += inputLine;
}
try {
return new BitcoinURI(data);
} catch (BitcoinURIParseException e) {
throw new WalletNameLookupException("Unable to create BitcoinURI", e);
}
} catch (IOException e) {
throw new WalletNameURLFailedException("WalletName URL Connection Failed", e);
} finally {
if (conn != null && in != null) {
try {
in.close();
} catch (IOException e) {
// Do Nothing
}
conn.disconnect();
}
}
}
|
java
|
public BitcoinURI processWalletNameUrl(URL url, boolean verifyTLSA) throws WalletNameLookupException {
HttpsURLConnection conn = null;
InputStream ins;
InputStreamReader isr;
BufferedReader in = null;
Certificate possibleRootCert = null;
if (verifyTLSA) {
try {
if (!this.tlsaValidator.validateTLSA(url)) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed");
}
} catch (ValidSelfSignedCertException ve) {
// TLSA Uses a Self-Signed Root Cert, We Need to Add to CACerts
possibleRootCert = ve.getRootCert();
} catch (Exception e) {
throw new WalletNameTlsaValidationException("TLSA Validation Failed", e);
}
}
try {
conn = (HttpsURLConnection) url.openConnection();
// If we have a self-signed cert returned during TLSA Validation, add it to the SSLContext for the HTTPS Connection
if (possibleRootCert != null) {
try {
KeyStore ssKeystore = KeyStore.getInstance(KeyStore.getDefaultType());
ssKeystore.load(null, null);
ssKeystore.setCertificateEntry(((X509Certificate) possibleRootCert).getSubjectDN().toString(), possibleRootCert);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ssKeystore);
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tmf.getTrustManagers(), null);
conn.setSSLSocketFactory(ctx.getSocketFactory());
} catch (Exception e) {
throw new WalletNameTlsaValidationException("Failed to Add TLSA Self Signed Certificate to HttpsURLConnection", e);
}
}
ins = conn.getInputStream();
isr = new InputStreamReader(ins);
in = new BufferedReader(isr);
String inputLine;
String data = "";
while ((inputLine = in.readLine()) != null) {
data += inputLine;
}
try {
return new BitcoinURI(data);
} catch (BitcoinURIParseException e) {
throw new WalletNameLookupException("Unable to create BitcoinURI", e);
}
} catch (IOException e) {
throw new WalletNameURLFailedException("WalletName URL Connection Failed", e);
} finally {
if (conn != null && in != null) {
try {
in.close();
} catch (IOException e) {
// Do Nothing
}
conn.disconnect();
}
}
}
|
[
"public",
"BitcoinURI",
"processWalletNameUrl",
"(",
"URL",
"url",
",",
"boolean",
"verifyTLSA",
")",
"throws",
"WalletNameLookupException",
"{",
"HttpsURLConnection",
"conn",
"=",
"null",
";",
"InputStream",
"ins",
";",
"InputStreamReader",
"isr",
";",
"BufferedReader",
"in",
"=",
"null",
";",
"Certificate",
"possibleRootCert",
"=",
"null",
";",
"if",
"(",
"verifyTLSA",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"this",
".",
"tlsaValidator",
".",
"validateTLSA",
"(",
"url",
")",
")",
"{",
"throw",
"new",
"WalletNameTlsaValidationException",
"(",
"\"TLSA Validation Failed\"",
")",
";",
"}",
"}",
"catch",
"(",
"ValidSelfSignedCertException",
"ve",
")",
"{",
"// TLSA Uses a Self-Signed Root Cert, We Need to Add to CACerts",
"possibleRootCert",
"=",
"ve",
".",
"getRootCert",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"WalletNameTlsaValidationException",
"(",
"\"TLSA Validation Failed\"",
",",
"e",
")",
";",
"}",
"}",
"try",
"{",
"conn",
"=",
"(",
"HttpsURLConnection",
")",
"url",
".",
"openConnection",
"(",
")",
";",
"// If we have a self-signed cert returned during TLSA Validation, add it to the SSLContext for the HTTPS Connection",
"if",
"(",
"possibleRootCert",
"!=",
"null",
")",
"{",
"try",
"{",
"KeyStore",
"ssKeystore",
"=",
"KeyStore",
".",
"getInstance",
"(",
"KeyStore",
".",
"getDefaultType",
"(",
")",
")",
";",
"ssKeystore",
".",
"load",
"(",
"null",
",",
"null",
")",
";",
"ssKeystore",
".",
"setCertificateEntry",
"(",
"(",
"(",
"X509Certificate",
")",
"possibleRootCert",
")",
".",
"getSubjectDN",
"(",
")",
".",
"toString",
"(",
")",
",",
"possibleRootCert",
")",
";",
"TrustManagerFactory",
"tmf",
"=",
"TrustManagerFactory",
".",
"getInstance",
"(",
"TrustManagerFactory",
".",
"getDefaultAlgorithm",
"(",
")",
")",
";",
"tmf",
".",
"init",
"(",
"ssKeystore",
")",
";",
"SSLContext",
"ctx",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"TLS\"",
")",
";",
"ctx",
".",
"init",
"(",
"null",
",",
"tmf",
".",
"getTrustManagers",
"(",
")",
",",
"null",
")",
";",
"conn",
".",
"setSSLSocketFactory",
"(",
"ctx",
".",
"getSocketFactory",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"WalletNameTlsaValidationException",
"(",
"\"Failed to Add TLSA Self Signed Certificate to HttpsURLConnection\"",
",",
"e",
")",
";",
"}",
"}",
"ins",
"=",
"conn",
".",
"getInputStream",
"(",
")",
";",
"isr",
"=",
"new",
"InputStreamReader",
"(",
"ins",
")",
";",
"in",
"=",
"new",
"BufferedReader",
"(",
"isr",
")",
";",
"String",
"inputLine",
";",
"String",
"data",
"=",
"\"\"",
";",
"while",
"(",
"(",
"inputLine",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"data",
"+=",
"inputLine",
";",
"}",
"try",
"{",
"return",
"new",
"BitcoinURI",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"BitcoinURIParseException",
"e",
")",
"{",
"throw",
"new",
"WalletNameLookupException",
"(",
"\"Unable to create BitcoinURI\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"WalletNameURLFailedException",
"(",
"\"WalletName URL Connection Failed\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"conn",
"!=",
"null",
"&&",
"in",
"!=",
"null",
")",
"{",
"try",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// Do Nothing",
"}",
"conn",
".",
"disconnect",
"(",
")",
";",
"}",
"}",
"}"
] |
Resolve a Wallet Name URL Endpoint
@param url Wallet Name URL Endpoint
@param verifyTLSA Do TLSA validation for URL Endpoint?
@return String data value returned by URL Endpoint
@throws WalletNameLookupException Wallet Name Address Service URL Processing Failure
|
[
"Resolve",
"a",
"Wallet",
"Name",
"URL",
"Endpoint"
] |
a7aad04d96c03feb05536aef189617beb4f011bc
|
https://github.com/netkicorp/java-wns-resolver/blob/a7aad04d96c03feb05536aef189617beb4f011bc/src/main/java/com/netki/WalletNameResolver.java#L186-L256
|
148,840
|
vtatai/srec
|
core/src/main/java/com/github/srec/util/AWTTreeScanner.java
|
AWTTreeScanner.scan
|
public static Component scan(Component root, ScannerMatcher matcher) {
if (matcher.matches(root)) return root;
if (!(root instanceof Container)) return null;
Container container = (Container) root;
for (Component component : container.getComponents()) {
Component found = scan(component, matcher);
if (found != null) return found;
}
return null;
}
|
java
|
public static Component scan(Component root, ScannerMatcher matcher) {
if (matcher.matches(root)) return root;
if (!(root instanceof Container)) return null;
Container container = (Container) root;
for (Component component : container.getComponents()) {
Component found = scan(component, matcher);
if (found != null) return found;
}
return null;
}
|
[
"public",
"static",
"Component",
"scan",
"(",
"Component",
"root",
",",
"ScannerMatcher",
"matcher",
")",
"{",
"if",
"(",
"matcher",
".",
"matches",
"(",
"root",
")",
")",
"return",
"root",
";",
"if",
"(",
"!",
"(",
"root",
"instanceof",
"Container",
")",
")",
"return",
"null",
";",
"Container",
"container",
"=",
"(",
"Container",
")",
"root",
";",
"for",
"(",
"Component",
"component",
":",
"container",
".",
"getComponents",
"(",
")",
")",
"{",
"Component",
"found",
"=",
"scan",
"(",
"component",
",",
"matcher",
")",
";",
"if",
"(",
"found",
"!=",
"null",
")",
"return",
"found",
";",
"}",
"return",
"null",
";",
"}"
] |
Scans a component tree searching for the one which is matched by the given matcher. In case of multiple matches
the firs one found is returned.
@param root The component root
@param matcher The matcher
@return The component found
|
[
"Scans",
"a",
"component",
"tree",
"searching",
"for",
"the",
"one",
"which",
"is",
"matched",
"by",
"the",
"given",
"matcher",
".",
"In",
"case",
"of",
"multiple",
"matches",
"the",
"firs",
"one",
"found",
"is",
"returned",
"."
] |
87fa6754a6a5f8569ef628db4d149eea04062568
|
https://github.com/vtatai/srec/blob/87fa6754a6a5f8569ef628db4d149eea04062568/core/src/main/java/com/github/srec/util/AWTTreeScanner.java#L38-L47
|
148,841
|
openbase/jul
|
storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java
|
AbstractRegistry.isDependingOnConsistentRegistries
|
protected boolean isDependingOnConsistentRegistries() {
dependingRegistryMapLock.readLock().lock();
try {
return dependingRegistryMap.keySet().stream().noneMatch((registry) -> (!registry.isConsistent()));
} finally {
dependingRegistryMapLock.readLock().unlock();
}
}
|
java
|
protected boolean isDependingOnConsistentRegistries() {
dependingRegistryMapLock.readLock().lock();
try {
return dependingRegistryMap.keySet().stream().noneMatch((registry) -> (!registry.isConsistent()));
} finally {
dependingRegistryMapLock.readLock().unlock();
}
}
|
[
"protected",
"boolean",
"isDependingOnConsistentRegistries",
"(",
")",
"{",
"dependingRegistryMapLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"dependingRegistryMap",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"noneMatch",
"(",
"(",
"registry",
")",
"-",
">",
"(",
"!",
"registry",
".",
"isConsistent",
"(",
")",
")",
")",
";",
"}",
"finally",
"{",
"dependingRegistryMapLock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
If this registry depends on other registries, this method can be used to tell this registry if all depending registries are consistent.
@return The method returns should return false if at least one depending registry is not consistent!
|
[
"If",
"this",
"registry",
"depends",
"on",
"other",
"registries",
"this",
"method",
"can",
"be",
"used",
"to",
"tell",
"this",
"registry",
"if",
"all",
"depending",
"registries",
"are",
"consistent",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java#L632-L639
|
148,842
|
openbase/jul
|
storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java
|
AbstractRegistry.removeDependency
|
public void removeDependency(final Registry registry) throws CouldNotPerformException {
if (registry == null) {
throw new NotAvailableException("registry");
}
registryLock.writeLock().lock();
try {
dependingRegistryMapLock.writeLock().lock();
try {
if (!dependingRegistryMap.containsKey(registry)) {
logger.warn("Could not remove a dependency which was never registered!");
return;
}
dependingRegistryMap.remove(registry).shutdown();
} finally {
dependingRegistryMapLock.writeLock().unlock();
}
} finally {
registryLock.writeLock().unlock();
}
}
|
java
|
public void removeDependency(final Registry registry) throws CouldNotPerformException {
if (registry == null) {
throw new NotAvailableException("registry");
}
registryLock.writeLock().lock();
try {
dependingRegistryMapLock.writeLock().lock();
try {
if (!dependingRegistryMap.containsKey(registry)) {
logger.warn("Could not remove a dependency which was never registered!");
return;
}
dependingRegistryMap.remove(registry).shutdown();
} finally {
dependingRegistryMapLock.writeLock().unlock();
}
} finally {
registryLock.writeLock().unlock();
}
}
|
[
"public",
"void",
"removeDependency",
"(",
"final",
"Registry",
"registry",
")",
"throws",
"CouldNotPerformException",
"{",
"if",
"(",
"registry",
"==",
"null",
")",
"{",
"throw",
"new",
"NotAvailableException",
"(",
"\"registry\"",
")",
";",
"}",
"registryLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"dependingRegistryMapLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"dependingRegistryMap",
".",
"containsKey",
"(",
"registry",
")",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Could not remove a dependency which was never registered!\"",
")",
";",
"return",
";",
"}",
"dependingRegistryMap",
".",
"remove",
"(",
"registry",
")",
".",
"shutdown",
"(",
")",
";",
"}",
"finally",
"{",
"dependingRegistryMapLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"registryLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
This method allows the removal of a registered registry dependency.
@param registry the dependency to remove.
@throws org.openbase.jul.exception.CouldNotPerformException
|
[
"This",
"method",
"allows",
"the",
"removal",
"of",
"a",
"registered",
"registry",
"dependency",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java#L697-L716
|
148,843
|
openbase/jul
|
storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java
|
AbstractRegistry.removeAllDependencies
|
public void removeAllDependencies() {
registryLock.writeLock().lock();
try {
dependingRegistryMapLock.writeLock().lock();
try {
List<Registry> dependingRegistryList = new ArrayList<>(dependingRegistryMap.keySet());
Collections.reverse(dependingRegistryList);
dependingRegistryList.stream().forEach((registry) -> {
dependingRegistryMap.remove(registry).shutdown();
});
} finally {
dependingRegistryMapLock.writeLock().unlock();
}
} finally {
registryLock.writeLock().unlock();
}
}
|
java
|
public void removeAllDependencies() {
registryLock.writeLock().lock();
try {
dependingRegistryMapLock.writeLock().lock();
try {
List<Registry> dependingRegistryList = new ArrayList<>(dependingRegistryMap.keySet());
Collections.reverse(dependingRegistryList);
dependingRegistryList.stream().forEach((registry) -> {
dependingRegistryMap.remove(registry).shutdown();
});
} finally {
dependingRegistryMapLock.writeLock().unlock();
}
} finally {
registryLock.writeLock().unlock();
}
}
|
[
"public",
"void",
"removeAllDependencies",
"(",
")",
"{",
"registryLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"dependingRegistryMapLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"List",
"<",
"Registry",
">",
"dependingRegistryList",
"=",
"new",
"ArrayList",
"<>",
"(",
"dependingRegistryMap",
".",
"keySet",
"(",
")",
")",
";",
"Collections",
".",
"reverse",
"(",
"dependingRegistryList",
")",
";",
"dependingRegistryList",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"(",
"registry",
")",
"-",
">",
"{",
"dependingRegistryMap",
".",
"remove",
"(",
"registry",
")",
".",
"shutdown",
"(",
")",
"",
";",
"}",
")",
";",
"}",
"finally",
"{",
"dependingRegistryMapLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"registryLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Removal of all registered registry dependencies in the reversed order in which they where added.
|
[
"Removal",
"of",
"all",
"registered",
"registry",
"dependencies",
"in",
"the",
"reversed",
"order",
"in",
"which",
"they",
"where",
"added",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java#L721-L737
|
148,844
|
openbase/jul
|
storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java
|
AbstractRegistry.notifyObservers
|
protected final boolean notifyObservers() {
try {
// It is not waited until the write actions are finished because the notification will be triggered after the lock release.
if (registryLock.isWriteLockedByCurrentThread()) {
logger.debug("Notification of registry[" + this + "] change skipped because of running write operations!");
notificationSkipped = true;
return false;
}
if (super.notifyObservers(entryMap)) {
try {
pluginPool.afterRegistryChange();
} catch (CouldNotPerformException ex) {
MultiException.ExceptionStack exceptionStack = new MultiException.ExceptionStack();
exceptionStack.push(pluginPool, ex);
throw new MultiException("PluginPool could not execute afterRegistryChange", exceptionStack);
}
}
notificationSkipped = false;
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify all registry observer!", ex), logger, LogLevel.ERROR);
return false;
}
return true;
}
|
java
|
protected final boolean notifyObservers() {
try {
// It is not waited until the write actions are finished because the notification will be triggered after the lock release.
if (registryLock.isWriteLockedByCurrentThread()) {
logger.debug("Notification of registry[" + this + "] change skipped because of running write operations!");
notificationSkipped = true;
return false;
}
if (super.notifyObservers(entryMap)) {
try {
pluginPool.afterRegistryChange();
} catch (CouldNotPerformException ex) {
MultiException.ExceptionStack exceptionStack = new MultiException.ExceptionStack();
exceptionStack.push(pluginPool, ex);
throw new MultiException("PluginPool could not execute afterRegistryChange", exceptionStack);
}
}
notificationSkipped = false;
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify all registry observer!", ex), logger, LogLevel.ERROR);
return false;
}
return true;
}
|
[
"protected",
"final",
"boolean",
"notifyObservers",
"(",
")",
"{",
"try",
"{",
"// It is not waited until the write actions are finished because the notification will be triggered after the lock release.",
"if",
"(",
"registryLock",
".",
"isWriteLockedByCurrentThread",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Notification of registry[\"",
"+",
"this",
"+",
"\"] change skipped because of running write operations!\"",
")",
";",
"notificationSkipped",
"=",
"true",
";",
"return",
"false",
";",
"}",
"if",
"(",
"super",
".",
"notifyObservers",
"(",
"entryMap",
")",
")",
"{",
"try",
"{",
"pluginPool",
".",
"afterRegistryChange",
"(",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"MultiException",
".",
"ExceptionStack",
"exceptionStack",
"=",
"new",
"MultiException",
".",
"ExceptionStack",
"(",
")",
";",
"exceptionStack",
".",
"push",
"(",
"pluginPool",
",",
"ex",
")",
";",
"throw",
"new",
"MultiException",
"(",
"\"PluginPool could not execute afterRegistryChange\"",
",",
"exceptionStack",
")",
";",
"}",
"}",
"notificationSkipped",
"=",
"false",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"ExceptionPrinter",
".",
"printHistory",
"(",
"new",
"CouldNotPerformException",
"(",
"\"Could not notify all registry observer!\"",
",",
"ex",
")",
",",
"logger",
",",
"LogLevel",
".",
"ERROR",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Method triggers a new registry changed notification on all observers.
The notification will be skipped in case the registry is busy. But a final notification is always guaranteed.
@return true if the notification was performed or false if the notification was skipped.
|
[
"Method",
"triggers",
"a",
"new",
"registry",
"changed",
"notification",
"on",
"all",
"observers",
".",
"The",
"notification",
"will",
"be",
"skipped",
"in",
"case",
"the",
"registry",
"is",
"busy",
".",
"But",
"a",
"final",
"notification",
"is",
"always",
"guaranteed",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java#L760-L784
|
148,845
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/KnowledgeSourceImpl.java
|
KnowledgeSourceImpl.getMatchingPropIds
|
@Override
public List<String> getMatchingPropIds(String searchKey)
throws KnowledgeSourceReadException {
LOGGER.log(Level.INFO,
"Searching knowledge source For search string {0}", searchKey);
Set<String> searchResults = getSearchResultsFromBackend(searchKey);
return new ArrayList<>(searchResults);
}
|
java
|
@Override
public List<String> getMatchingPropIds(String searchKey)
throws KnowledgeSourceReadException {
LOGGER.log(Level.INFO,
"Searching knowledge source For search string {0}", searchKey);
Set<String> searchResults = getSearchResultsFromBackend(searchKey);
return new ArrayList<>(searchResults);
}
|
[
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getMatchingPropIds",
"(",
"String",
"searchKey",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Searching knowledge source For search string {0}\"",
",",
"searchKey",
")",
";",
"Set",
"<",
"String",
">",
"searchResults",
"=",
"getSearchResultsFromBackend",
"(",
"searchKey",
")",
";",
"return",
"new",
"ArrayList",
"<>",
"(",
"searchResults",
")",
";",
"}"
] |
Gets the proposition Definitions from each backend that match the
searchKey
@param searchKey
@return
@throws KnowledgeSourceReadException
|
[
"Gets",
"the",
"proposition",
"Definitions",
"from",
"each",
"backend",
"that",
"match",
"the",
"searchKey"
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/KnowledgeSourceImpl.java#L758-L765
|
148,846
|
ebean-orm/querybean-agent-now-merged-into-ebean-agent-
|
src/main/java/io/ebean/typequery/agent/AgentManifestReader.java
|
AgentManifestReader.readManifests
|
private AgentManifestReader readManifests(ClassLoader classLoader, String path) throws IOException {
Enumeration<URL> resources = classLoader.getResources(path);
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
try {
addResource(url.openStream());
} catch (IOException e) {
System.err.println("Error reading manifest resources " + url);
e.printStackTrace();
}
}
return this;
}
|
java
|
private AgentManifestReader readManifests(ClassLoader classLoader, String path) throws IOException {
Enumeration<URL> resources = classLoader.getResources(path);
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
try {
addResource(url.openStream());
} catch (IOException e) {
System.err.println("Error reading manifest resources " + url);
e.printStackTrace();
}
}
return this;
}
|
[
"private",
"AgentManifestReader",
"readManifests",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"Enumeration",
"<",
"URL",
">",
"resources",
"=",
"classLoader",
".",
"getResources",
"(",
"path",
")",
";",
"while",
"(",
"resources",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"URL",
"url",
"=",
"resources",
".",
"nextElement",
"(",
")",
";",
"try",
"{",
"addResource",
"(",
"url",
".",
"openStream",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Error reading manifest resources \"",
"+",
"url",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Read all the specific manifest files and return the set of packages containing type query beans.
|
[
"Read",
"all",
"the",
"specific",
"manifest",
"files",
"and",
"return",
"the",
"set",
"of",
"packages",
"containing",
"type",
"query",
"beans",
"."
] |
a063554fabdbed15ff5e10ad0a0b53b67e039006
|
https://github.com/ebean-orm/querybean-agent-now-merged-into-ebean-agent-/blob/a063554fabdbed15ff5e10ad0a0b53b67e039006/src/main/java/io/ebean/typequery/agent/AgentManifestReader.java#L68-L80
|
148,847
|
ebean-orm/querybean-agent-now-merged-into-ebean-agent-
|
src/main/java/io/ebean/typequery/agent/AgentManifestReader.java
|
AgentManifestReader.add
|
private void add(String packages) {
if (packages != null) {
String[] split = packages.split(",|;| ");
for (int i = 0; i < split.length; i++) {
String pkg = split[i].trim();
if (!pkg.isEmpty()) {
packageSet.add(pkg);
}
}
}
}
|
java
|
private void add(String packages) {
if (packages != null) {
String[] split = packages.split(",|;| ");
for (int i = 0; i < split.length; i++) {
String pkg = split[i].trim();
if (!pkg.isEmpty()) {
packageSet.add(pkg);
}
}
}
}
|
[
"private",
"void",
"add",
"(",
"String",
"packages",
")",
"{",
"if",
"(",
"packages",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"split",
"=",
"packages",
".",
"split",
"(",
"\",|;| \"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"split",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"pkg",
"=",
"split",
"[",
"i",
"]",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"pkg",
".",
"isEmpty",
"(",
")",
")",
"{",
"packageSet",
".",
"add",
"(",
"pkg",
")",
";",
"}",
"}",
"}",
"}"
] |
Collect each individual package splitting by delimiters.
|
[
"Collect",
"each",
"individual",
"package",
"splitting",
"by",
"delimiters",
"."
] |
a063554fabdbed15ff5e10ad0a0b53b67e039006
|
https://github.com/ebean-orm/querybean-agent-now-merged-into-ebean-agent-/blob/a063554fabdbed15ff5e10ad0a0b53b67e039006/src/main/java/io/ebean/typequery/agent/AgentManifestReader.java#L103-L113
|
148,848
|
jboss/jboss-common-beans
|
src/main/java/org/jboss/common/beans/property/LongEditor.java
|
LongEditor.setAsText
|
@Override
public void setAsText(final String text) {
if (BeanUtils.isNull(text)) {
setValue(null);
return;
}
try {
Object newValue = Long.valueOf(text);
setValue(newValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Failed to parse long.", e);
}
}
|
java
|
@Override
public void setAsText(final String text) {
if (BeanUtils.isNull(text)) {
setValue(null);
return;
}
try {
Object newValue = Long.valueOf(text);
setValue(newValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Failed to parse long.", e);
}
}
|
[
"@",
"Override",
"public",
"void",
"setAsText",
"(",
"final",
"String",
"text",
")",
"{",
"if",
"(",
"BeanUtils",
".",
"isNull",
"(",
"text",
")",
")",
"{",
"setValue",
"(",
"null",
")",
";",
"return",
";",
"}",
"try",
"{",
"Object",
"newValue",
"=",
"Long",
".",
"valueOf",
"(",
"text",
")",
";",
"setValue",
"(",
"newValue",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Failed to parse long.\"",
",",
"e",
")",
";",
"}",
"}"
] |
Map the argument text into and Integer using Integer.valueOf.
|
[
"Map",
"the",
"argument",
"text",
"into",
"and",
"Integer",
"using",
"Integer",
".",
"valueOf",
"."
] |
ffb48b1719762534bf92d762eadf91d1815f6748
|
https://github.com/jboss/jboss-common-beans/blob/ffb48b1719762534bf92d762eadf91d1815f6748/src/main/java/org/jboss/common/beans/property/LongEditor.java#L38-L50
|
148,849
|
kevoree/kevoree-library
|
mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/subscriptions/SubscriptionsStore.java
|
SubscriptionsStore.init
|
public void init(IPersistentSubscriptionStore storageService) {
Log.debug("init invoked");
m_storageService = storageService;
//reload any subscriptions persisted
if (Log.DEBUG) {
Log.debug("Reloading all stored subscriptions...subscription tree before {}", dumpTree());
}
for (Subscription subscription : m_storageService.retrieveAllSubscriptions()) {
Log.debug("Re-subscribing {} to topic {}", subscription.getClientId(), subscription.getTopic());
addDirect(subscription);
}
if (Log.DEBUG) {
Log.debug("Finished loading. Subscription tree after {}", dumpTree());
}
}
|
java
|
public void init(IPersistentSubscriptionStore storageService) {
Log.debug("init invoked");
m_storageService = storageService;
//reload any subscriptions persisted
if (Log.DEBUG) {
Log.debug("Reloading all stored subscriptions...subscription tree before {}", dumpTree());
}
for (Subscription subscription : m_storageService.retrieveAllSubscriptions()) {
Log.debug("Re-subscribing {} to topic {}", subscription.getClientId(), subscription.getTopic());
addDirect(subscription);
}
if (Log.DEBUG) {
Log.debug("Finished loading. Subscription tree after {}", dumpTree());
}
}
|
[
"public",
"void",
"init",
"(",
"IPersistentSubscriptionStore",
"storageService",
")",
"{",
"Log",
".",
"debug",
"(",
"\"init invoked\"",
")",
";",
"m_storageService",
"=",
"storageService",
";",
"//reload any subscriptions persisted",
"if",
"(",
"Log",
".",
"DEBUG",
")",
"{",
"Log",
".",
"debug",
"(",
"\"Reloading all stored subscriptions...subscription tree before {}\"",
",",
"dumpTree",
"(",
")",
")",
";",
"}",
"for",
"(",
"Subscription",
"subscription",
":",
"m_storageService",
".",
"retrieveAllSubscriptions",
"(",
")",
")",
"{",
"Log",
".",
"debug",
"(",
"\"Re-subscribing {} to topic {}\"",
",",
"subscription",
".",
"getClientId",
"(",
")",
",",
"subscription",
".",
"getTopic",
"(",
")",
")",
";",
"addDirect",
"(",
"subscription",
")",
";",
"}",
"if",
"(",
"Log",
".",
"DEBUG",
")",
"{",
"Log",
".",
"debug",
"(",
"\"Finished loading. Subscription tree after {}\"",
",",
"dumpTree",
"(",
")",
")",
";",
"}",
"}"
] |
Initialize basic store structures, like the FS storage to maintain
client's topics subscriptions
|
[
"Initialize",
"basic",
"store",
"structures",
"like",
"the",
"FS",
"storage",
"to",
"maintain",
"client",
"s",
"topics",
"subscriptions"
] |
617460e6c5881902ebc488a31ecdea179024d8f1
|
https://github.com/kevoree/kevoree-library/blob/617460e6c5881902ebc488a31ecdea179024d8f1/mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/subscriptions/SubscriptionsStore.java#L81-L98
|
148,850
|
foundation-runtime/configuration
|
configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java
|
ParamValidators.getValidatorsMap
|
private static ConcurrentHashMap<Class, List<ParamValidator>> getValidatorsMap() {
// use <ConcurrentHashMap> in case validators are added while initializing parameters through <getValidator> method.
ConcurrentHashMap<Class, List<ParamValidator>> map = new ConcurrentHashMap();
addValidators(map, ParamValidator.class, new ParamValidator(true), new ParamValidator(false)); // default validator
addValidators(map, FileValidator.class, new FileValidator(true), new FileValidator(false));
addValidators(map, URLValidator.class, new URLValidator(true), new URLValidator(false));
addValidators(map, HEXValidator.class, new HEXValidator(true), new HEXValidator(false));
return map;
}
|
java
|
private static ConcurrentHashMap<Class, List<ParamValidator>> getValidatorsMap() {
// use <ConcurrentHashMap> in case validators are added while initializing parameters through <getValidator> method.
ConcurrentHashMap<Class, List<ParamValidator>> map = new ConcurrentHashMap();
addValidators(map, ParamValidator.class, new ParamValidator(true), new ParamValidator(false)); // default validator
addValidators(map, FileValidator.class, new FileValidator(true), new FileValidator(false));
addValidators(map, URLValidator.class, new URLValidator(true), new URLValidator(false));
addValidators(map, HEXValidator.class, new HEXValidator(true), new HEXValidator(false));
return map;
}
|
[
"private",
"static",
"ConcurrentHashMap",
"<",
"Class",
",",
"List",
"<",
"ParamValidator",
">",
">",
"getValidatorsMap",
"(",
")",
"{",
"// use <ConcurrentHashMap> in case validators are added while initializing parameters through <getValidator> method.",
"ConcurrentHashMap",
"<",
"Class",
",",
"List",
"<",
"ParamValidator",
">",
">",
"map",
"=",
"new",
"ConcurrentHashMap",
"(",
")",
";",
"addValidators",
"(",
"map",
",",
"ParamValidator",
".",
"class",
",",
"new",
"ParamValidator",
"(",
"true",
")",
",",
"new",
"ParamValidator",
"(",
"false",
")",
")",
";",
"// default validator",
"addValidators",
"(",
"map",
",",
"FileValidator",
".",
"class",
",",
"new",
"FileValidator",
"(",
"true",
")",
",",
"new",
"FileValidator",
"(",
"false",
")",
")",
";",
"addValidators",
"(",
"map",
",",
"URLValidator",
".",
"class",
",",
"new",
"URLValidator",
"(",
"true",
")",
",",
"new",
"URLValidator",
"(",
"false",
")",
")",
";",
"addValidators",
"(",
"map",
",",
"HEXValidator",
".",
"class",
",",
"new",
"HEXValidator",
"(",
"true",
")",
",",
"new",
"HEXValidator",
"(",
"false",
")",
")",
";",
"return",
"map",
";",
"}"
] |
build a map of all Validator implementations by their class type and required value
|
[
"build",
"a",
"map",
"of",
"all",
"Validator",
"implementations",
"by",
"their",
"class",
"type",
"and",
"required",
"value"
] |
c5bd171a2cca0dc1c8d568f987843ca47c6d1eed
|
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java#L402-L412
|
148,851
|
foundation-runtime/configuration
|
configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java
|
ParamValidators.getValidator
|
public static<T extends ParamValidator> T getValidator(Class<T> clazz, boolean required) {
List<ParamValidator> validators = validatorsMap.get(clazz);
if (validators != null) {
if (required) {
return (T)validators.get(0);
}
return (T)validators.get(1);
}
return null;
}
|
java
|
public static<T extends ParamValidator> T getValidator(Class<T> clazz, boolean required) {
List<ParamValidator> validators = validatorsMap.get(clazz);
if (validators != null) {
if (required) {
return (T)validators.get(0);
}
return (T)validators.get(1);
}
return null;
}
|
[
"public",
"static",
"<",
"T",
"extends",
"ParamValidator",
">",
"T",
"getValidator",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"boolean",
"required",
")",
"{",
"List",
"<",
"ParamValidator",
">",
"validators",
"=",
"validatorsMap",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"validators",
"!=",
"null",
")",
"{",
"if",
"(",
"required",
")",
"{",
"return",
"(",
"T",
")",
"validators",
".",
"get",
"(",
"0",
")",
";",
"}",
"return",
"(",
"T",
")",
"validators",
".",
"get",
"(",
"1",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
return the relevant Validator by the given class type and required indication
|
[
"return",
"the",
"relevant",
"Validator",
"by",
"the",
"given",
"class",
"type",
"and",
"required",
"indication"
] |
c5bd171a2cca0dc1c8d568f987843ca47c6d1eed
|
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java#L458-L471
|
148,852
|
weblicht/wlfxb
|
src/main/java/eu/clarin/weblicht/wlfxb/ed/xb/ExternalDataStored.java
|
ExternalDataStored.compose
|
public static ExternalDataStored compose(ExternalDataLayerStored... layers) {
ExternalDataStored ed = new ExternalDataStored();
for (ExternalDataLayerStored layer : layers) {
ed.layersInOrder[ExternalDataLayerTag.getFromClass(layer.getClass()).ordinal()] = layer;
}
return ed;
}
|
java
|
public static ExternalDataStored compose(ExternalDataLayerStored... layers) {
ExternalDataStored ed = new ExternalDataStored();
for (ExternalDataLayerStored layer : layers) {
ed.layersInOrder[ExternalDataLayerTag.getFromClass(layer.getClass()).ordinal()] = layer;
}
return ed;
}
|
[
"public",
"static",
"ExternalDataStored",
"compose",
"(",
"ExternalDataLayerStored",
"...",
"layers",
")",
"{",
"ExternalDataStored",
"ed",
"=",
"new",
"ExternalDataStored",
"(",
")",
";",
"for",
"(",
"ExternalDataLayerStored",
"layer",
":",
"layers",
")",
"{",
"ed",
".",
"layersInOrder",
"[",
"ExternalDataLayerTag",
".",
"getFromClass",
"(",
"layer",
".",
"getClass",
"(",
")",
")",
".",
"ordinal",
"(",
")",
"]",
"=",
"layer",
";",
"}",
"return",
"ed",
";",
"}"
] |
Composes the layers into one document. Normally, you should not use this
method, unless you want to manually compose document from the layer
pieces.
@param layers
@return external data composed of the provided layers
|
[
"Composes",
"the",
"layers",
"into",
"one",
"document",
".",
"Normally",
"you",
"should",
"not",
"use",
"this",
"method",
"unless",
"you",
"want",
"to",
"manually",
"compose",
"document",
"from",
"the",
"layer",
"pieces",
"."
] |
a50f3c31062a3d617ed9018aabcc1180a8ceb464
|
https://github.com/weblicht/wlfxb/blob/a50f3c31062a3d617ed9018aabcc1180a8ceb464/src/main/java/eu/clarin/weblicht/wlfxb/ed/xb/ExternalDataStored.java#L222-L228
|
148,853
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/EntitySpec.java
|
EntitySpec.hasReferenceTo
|
public boolean hasReferenceTo(EntitySpec entitySpec) {
if (entitySpec == null) {
throw new IllegalArgumentException("entitySpec cannot be null");
}
boolean found = false;
String entitySpecName = entitySpec.name;
for (ReferenceSpec refSpec : this.referenceSpecs) {
if (refSpec.getEntityName().equals(entitySpecName)) {
found = true;
continue;
}
}
return found;
}
|
java
|
public boolean hasReferenceTo(EntitySpec entitySpec) {
if (entitySpec == null) {
throw new IllegalArgumentException("entitySpec cannot be null");
}
boolean found = false;
String entitySpecName = entitySpec.name;
for (ReferenceSpec refSpec : this.referenceSpecs) {
if (refSpec.getEntityName().equals(entitySpecName)) {
found = true;
continue;
}
}
return found;
}
|
[
"public",
"boolean",
"hasReferenceTo",
"(",
"EntitySpec",
"entitySpec",
")",
"{",
"if",
"(",
"entitySpec",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"entitySpec cannot be null\"",
")",
";",
"}",
"boolean",
"found",
"=",
"false",
";",
"String",
"entitySpecName",
"=",
"entitySpec",
".",
"name",
";",
"for",
"(",
"ReferenceSpec",
"refSpec",
":",
"this",
".",
"referenceSpecs",
")",
"{",
"if",
"(",
"refSpec",
".",
"getEntityName",
"(",
")",
".",
"equals",
"(",
"entitySpecName",
")",
")",
"{",
"found",
"=",
"true",
";",
"continue",
";",
"}",
"}",
"return",
"found",
";",
"}"
] |
Returns whether this entity spec has a reference to another entity spec.
@param entitySpec another entity spec.
@return <code>true</code> or <code>false</code>.
|
[
"Returns",
"whether",
"this",
"entity",
"spec",
"has",
"a",
"reference",
"to",
"another",
"entity",
"spec",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/EntitySpec.java#L455-L469
|
148,854
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/EntitySpec.java
|
EntitySpec.referencesTo
|
public ReferenceSpec[] referencesTo(EntitySpec entitySpec) {
if (entitySpec == null) {
throw new IllegalArgumentException("entitySpec cannot be null");
}
List<ReferenceSpec> result = new ArrayList<>();
String entitySpecName = entitySpec.name;
for (ReferenceSpec refSpec : this.referenceSpecs) {
if (refSpec.getEntityName().equals(entitySpecName)) {
result.add(refSpec);
}
}
return result.toArray(new ReferenceSpec[result.size()]);
}
|
java
|
public ReferenceSpec[] referencesTo(EntitySpec entitySpec) {
if (entitySpec == null) {
throw new IllegalArgumentException("entitySpec cannot be null");
}
List<ReferenceSpec> result = new ArrayList<>();
String entitySpecName = entitySpec.name;
for (ReferenceSpec refSpec : this.referenceSpecs) {
if (refSpec.getEntityName().equals(entitySpecName)) {
result.add(refSpec);
}
}
return result.toArray(new ReferenceSpec[result.size()]);
}
|
[
"public",
"ReferenceSpec",
"[",
"]",
"referencesTo",
"(",
"EntitySpec",
"entitySpec",
")",
"{",
"if",
"(",
"entitySpec",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"entitySpec cannot be null\"",
")",
";",
"}",
"List",
"<",
"ReferenceSpec",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"entitySpecName",
"=",
"entitySpec",
".",
"name",
";",
"for",
"(",
"ReferenceSpec",
"refSpec",
":",
"this",
".",
"referenceSpecs",
")",
"{",
"if",
"(",
"refSpec",
".",
"getEntityName",
"(",
")",
".",
"equals",
"(",
"entitySpecName",
")",
")",
"{",
"result",
".",
"add",
"(",
"refSpec",
")",
";",
"}",
"}",
"return",
"result",
".",
"toArray",
"(",
"new",
"ReferenceSpec",
"[",
"result",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Returns the reference specs that point to the given entity spec.
@param entitySpec another entity spec.
@return a {@link ReferenceSpec[]}.
|
[
"Returns",
"the",
"reference",
"specs",
"that",
"point",
"to",
"the",
"given",
"entity",
"spec",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/EntitySpec.java#L489-L502
|
148,855
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/EntitySpec.java
|
EntitySpec.getColumnSpecs
|
public ColumnSpec[] getColumnSpecs() {
Set<ColumnSpec> results = new HashSet<>();
addTo(results, this.baseSpec);
addTo(results, this.codeSpec);
addTo(results, this.constraintSpecs);
addTo(results, this.finishTimeSpec);
addTo(results, this.startTimeOrTimestampSpec);
addTo(results, this.uniqueIdSpecs);
addTo(results, this.valueSpec);
addTo(results, this.createDateSpec);
addTo(results, this.updateDateSpec);
addTo(results, this.deleteDateSpec);
for (PropertySpec propertySpec : this.propertySpecs) {
addTo(results, propertySpec.getCodeSpec());
}
return results.toArray(new ColumnSpec[results.size()]);
}
|
java
|
public ColumnSpec[] getColumnSpecs() {
Set<ColumnSpec> results = new HashSet<>();
addTo(results, this.baseSpec);
addTo(results, this.codeSpec);
addTo(results, this.constraintSpecs);
addTo(results, this.finishTimeSpec);
addTo(results, this.startTimeOrTimestampSpec);
addTo(results, this.uniqueIdSpecs);
addTo(results, this.valueSpec);
addTo(results, this.createDateSpec);
addTo(results, this.updateDateSpec);
addTo(results, this.deleteDateSpec);
for (PropertySpec propertySpec : this.propertySpecs) {
addTo(results, propertySpec.getCodeSpec());
}
return results.toArray(new ColumnSpec[results.size()]);
}
|
[
"public",
"ColumnSpec",
"[",
"]",
"getColumnSpecs",
"(",
")",
"{",
"Set",
"<",
"ColumnSpec",
">",
"results",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"baseSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"codeSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"constraintSpecs",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"finishTimeSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"startTimeOrTimestampSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"uniqueIdSpecs",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"valueSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"createDateSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"updateDateSpec",
")",
";",
"addTo",
"(",
"results",
",",
"this",
".",
"deleteDateSpec",
")",
";",
"for",
"(",
"PropertySpec",
"propertySpec",
":",
"this",
".",
"propertySpecs",
")",
"{",
"addTo",
"(",
"results",
",",
"propertySpec",
".",
"getCodeSpec",
"(",
")",
")",
";",
"}",
"return",
"results",
".",
"toArray",
"(",
"new",
"ColumnSpec",
"[",
"results",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Returns the distinct tables specified in this entity spec, not including
references to other entity specs.
@return an array of {@link TableSpec}s. Guaranteed not <code>null</code>.
|
[
"Returns",
"the",
"distinct",
"tables",
"specified",
"in",
"this",
"entity",
"spec",
"not",
"including",
"references",
"to",
"other",
"entity",
"specs",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/EntitySpec.java#L622-L638
|
148,856
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/SqlGeneratorUtil.java
|
SqlGeneratorUtil.prepareValue
|
public static String prepareValue(Object val) {
StringBuilder result = new StringBuilder();
boolean numberOrBooleanOrNull;
if (val != null && !(val instanceof Number) && !(val instanceof Boolean)) {
numberOrBooleanOrNull = false;
result.append("'");
} else {
numberOrBooleanOrNull = true;
}
if (val instanceof Boolean) {
Boolean boolVal = (Boolean) val;
if (boolVal.equals(Boolean.TRUE)) {
result.append(1);
} else {
result.append(0);
}
} else {
result.append(val);
}
if (!numberOrBooleanOrNull) {
result.append("'");
}
return result.toString();
}
|
java
|
public static String prepareValue(Object val) {
StringBuilder result = new StringBuilder();
boolean numberOrBooleanOrNull;
if (val != null && !(val instanceof Number) && !(val instanceof Boolean)) {
numberOrBooleanOrNull = false;
result.append("'");
} else {
numberOrBooleanOrNull = true;
}
if (val instanceof Boolean) {
Boolean boolVal = (Boolean) val;
if (boolVal.equals(Boolean.TRUE)) {
result.append(1);
} else {
result.append(0);
}
} else {
result.append(val);
}
if (!numberOrBooleanOrNull) {
result.append("'");
}
return result.toString();
}
|
[
"public",
"static",
"String",
"prepareValue",
"(",
"Object",
"val",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"numberOrBooleanOrNull",
";",
"if",
"(",
"val",
"!=",
"null",
"&&",
"!",
"(",
"val",
"instanceof",
"Number",
")",
"&&",
"!",
"(",
"val",
"instanceof",
"Boolean",
")",
")",
"{",
"numberOrBooleanOrNull",
"=",
"false",
";",
"result",
".",
"append",
"(",
"\"'\"",
")",
";",
"}",
"else",
"{",
"numberOrBooleanOrNull",
"=",
"true",
";",
"}",
"if",
"(",
"val",
"instanceof",
"Boolean",
")",
"{",
"Boolean",
"boolVal",
"=",
"(",
"Boolean",
")",
"val",
";",
"if",
"(",
"boolVal",
".",
"equals",
"(",
"Boolean",
".",
"TRUE",
")",
")",
"{",
"result",
".",
"append",
"(",
"1",
")",
";",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"0",
")",
";",
"}",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"val",
")",
";",
"}",
"if",
"(",
"!",
"numberOrBooleanOrNull",
")",
"{",
"result",
".",
"append",
"(",
"\"'\"",
")",
";",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Generates an SQL-ready string for the given value based on its type.
@param val the value to prepare
@return a <tt>String</tt> ready to be appended to an SQL statement
|
[
"Generates",
"an",
"SQL",
"-",
"ready",
"string",
"for",
"the",
"given",
"value",
"based",
"on",
"its",
"type",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/SqlGeneratorUtil.java#L39-L63
|
148,857
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/LowLevelAbstractionFinder.java
|
LowLevelAbstractionFinder.nextSegmentAfterMatch
|
private static Segment<PrimitiveParameter> nextSegmentAfterMatch(
PatternFinderUser def, Segment<PrimitiveParameter> seg,
Algorithm algorithm, int minPatternLength, int maxPatternLength) {
if (seg == null) {
return null;
}
int arg;
int x = seg.getFirstIndex();
int y = seg.getLastIndex();
Segment<PrimitiveParameter> nextSeg = null;
if ((arg = def.getMaxOverlapping()) > 0) {
int myCurrentColumn = y - (arg + 1);
if (myCurrentColumn - 1 > x) {
nextSeg = resetSegment(def, seg, myCurrentColumn, getYIndex(
def, myCurrentColumn, seg), algorithm,
minPatternLength, maxPatternLength);
} else {
nextSeg = resetSegment(def, seg, getXIndex(def, x, seg),
getYIndex(def, y + 1, seg), algorithm,
minPatternLength, maxPatternLength);
}
} else {
nextSeg = resetSegment(def, seg, getXIndex(def, x, seg), getYIndex(
def, y + 1, seg), algorithm, minPatternLength,
maxPatternLength);
}
return nextSeg;
}
|
java
|
private static Segment<PrimitiveParameter> nextSegmentAfterMatch(
PatternFinderUser def, Segment<PrimitiveParameter> seg,
Algorithm algorithm, int minPatternLength, int maxPatternLength) {
if (seg == null) {
return null;
}
int arg;
int x = seg.getFirstIndex();
int y = seg.getLastIndex();
Segment<PrimitiveParameter> nextSeg = null;
if ((arg = def.getMaxOverlapping()) > 0) {
int myCurrentColumn = y - (arg + 1);
if (myCurrentColumn - 1 > x) {
nextSeg = resetSegment(def, seg, myCurrentColumn, getYIndex(
def, myCurrentColumn, seg), algorithm,
minPatternLength, maxPatternLength);
} else {
nextSeg = resetSegment(def, seg, getXIndex(def, x, seg),
getYIndex(def, y + 1, seg), algorithm,
minPatternLength, maxPatternLength);
}
} else {
nextSeg = resetSegment(def, seg, getXIndex(def, x, seg), getYIndex(
def, y + 1, seg), algorithm, minPatternLength,
maxPatternLength);
}
return nextSeg;
}
|
[
"private",
"static",
"Segment",
"<",
"PrimitiveParameter",
">",
"nextSegmentAfterMatch",
"(",
"PatternFinderUser",
"def",
",",
"Segment",
"<",
"PrimitiveParameter",
">",
"seg",
",",
"Algorithm",
"algorithm",
",",
"int",
"minPatternLength",
",",
"int",
"maxPatternLength",
")",
"{",
"if",
"(",
"seg",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"arg",
";",
"int",
"x",
"=",
"seg",
".",
"getFirstIndex",
"(",
")",
";",
"int",
"y",
"=",
"seg",
".",
"getLastIndex",
"(",
")",
";",
"Segment",
"<",
"PrimitiveParameter",
">",
"nextSeg",
"=",
"null",
";",
"if",
"(",
"(",
"arg",
"=",
"def",
".",
"getMaxOverlapping",
"(",
")",
")",
">",
"0",
")",
"{",
"int",
"myCurrentColumn",
"=",
"y",
"-",
"(",
"arg",
"+",
"1",
")",
";",
"if",
"(",
"myCurrentColumn",
"-",
"1",
">",
"x",
")",
"{",
"nextSeg",
"=",
"resetSegment",
"(",
"def",
",",
"seg",
",",
"myCurrentColumn",
",",
"getYIndex",
"(",
"def",
",",
"myCurrentColumn",
",",
"seg",
")",
",",
"algorithm",
",",
"minPatternLength",
",",
"maxPatternLength",
")",
";",
"}",
"else",
"{",
"nextSeg",
"=",
"resetSegment",
"(",
"def",
",",
"seg",
",",
"getXIndex",
"(",
"def",
",",
"x",
",",
"seg",
")",
",",
"getYIndex",
"(",
"def",
",",
"y",
"+",
"1",
",",
"seg",
")",
",",
"algorithm",
",",
"minPatternLength",
",",
"maxPatternLength",
")",
";",
"}",
"}",
"else",
"{",
"nextSeg",
"=",
"resetSegment",
"(",
"def",
",",
"seg",
",",
"getXIndex",
"(",
"def",
",",
"x",
",",
"seg",
")",
",",
"getYIndex",
"(",
"def",
",",
"y",
"+",
"1",
",",
"seg",
")",
",",
"algorithm",
",",
"minPatternLength",
",",
"maxPatternLength",
")",
";",
"}",
"return",
"nextSeg",
";",
"}"
] |
Return the next segment to be searched if the most recently searched
segment matched this rule. The returned segment is calculated according
to the this rule's search parameters.
@param ts
the sequence being searched.
@param seg
the most recently searched segment.
@param lastMatch
the most recent segment to match this rule.
@return the next segment that should be searched, or null if there are no
more segments to search.
|
[
"Return",
"the",
"next",
"segment",
"to",
"be",
"searched",
"if",
"the",
"most",
"recently",
"searched",
"segment",
"matched",
"this",
"rule",
".",
"The",
"returned",
"segment",
"is",
"calculated",
"according",
"to",
"the",
"this",
"rule",
"s",
"search",
"parameters",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/LowLevelAbstractionFinder.java#L93-L123
|
148,858
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/LowLevelAbstractionFinder.java
|
LowLevelAbstractionFinder.getXIndex
|
private static int getXIndex(PatternFinderUser def, int x,
Segment<PrimitiveParameter> lastMatch) {
int skipStart = def.getSkipStart();
if (lastMatch != null && skipStart > 0) {
return Math.max(x, lastMatch.getFirstIndex() + skipStart);
} else if (lastMatch != null && def.getSkip() > 0) {
return Math.max(x, lastMatch.getLastIndex() + def.getSkip());
} else {
return x;
}
}
|
java
|
private static int getXIndex(PatternFinderUser def, int x,
Segment<PrimitiveParameter> lastMatch) {
int skipStart = def.getSkipStart();
if (lastMatch != null && skipStart > 0) {
return Math.max(x, lastMatch.getFirstIndex() + skipStart);
} else if (lastMatch != null && def.getSkip() > 0) {
return Math.max(x, lastMatch.getLastIndex() + def.getSkip());
} else {
return x;
}
}
|
[
"private",
"static",
"int",
"getXIndex",
"(",
"PatternFinderUser",
"def",
",",
"int",
"x",
",",
"Segment",
"<",
"PrimitiveParameter",
">",
"lastMatch",
")",
"{",
"int",
"skipStart",
"=",
"def",
".",
"getSkipStart",
"(",
")",
";",
"if",
"(",
"lastMatch",
"!=",
"null",
"&&",
"skipStart",
">",
"0",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"x",
",",
"lastMatch",
".",
"getFirstIndex",
"(",
")",
"+",
"skipStart",
")",
";",
"}",
"else",
"if",
"(",
"lastMatch",
"!=",
"null",
"&&",
"def",
".",
"getSkip",
"(",
")",
">",
"0",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"x",
",",
"lastMatch",
".",
"getLastIndex",
"(",
")",
"+",
"def",
".",
"getSkip",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"x",
";",
"}",
"}"
] |
Return the first value of the next segment to be searched.
@param x
the first value of the most recently searched segment.
@param lastMatch
the most recent segment to match this rule.
@return the first value of the next segment to search.
|
[
"Return",
"the",
"first",
"value",
"of",
"the",
"next",
"segment",
"to",
"be",
"searched",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/LowLevelAbstractionFinder.java#L221-L231
|
148,859
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/LowLevelAbstractionFinder.java
|
LowLevelAbstractionFinder.getYIndex
|
private static int getYIndex(PatternFinderUser def, int y,
Segment<PrimitiveParameter> lastMatch) {
int skipEnd = def.getSkipEnd();
if (lastMatch != null && skipEnd > 0) {
return Math.max(y, lastMatch.getLastIndex() + skipEnd);
} else if (lastMatch != null && def.getSkip() > 0) {
return Math.max(y, lastMatch.getLastIndex() + def.getSkip());
} else {
return y;
}
}
|
java
|
private static int getYIndex(PatternFinderUser def, int y,
Segment<PrimitiveParameter> lastMatch) {
int skipEnd = def.getSkipEnd();
if (lastMatch != null && skipEnd > 0) {
return Math.max(y, lastMatch.getLastIndex() + skipEnd);
} else if (lastMatch != null && def.getSkip() > 0) {
return Math.max(y, lastMatch.getLastIndex() + def.getSkip());
} else {
return y;
}
}
|
[
"private",
"static",
"int",
"getYIndex",
"(",
"PatternFinderUser",
"def",
",",
"int",
"y",
",",
"Segment",
"<",
"PrimitiveParameter",
">",
"lastMatch",
")",
"{",
"int",
"skipEnd",
"=",
"def",
".",
"getSkipEnd",
"(",
")",
";",
"if",
"(",
"lastMatch",
"!=",
"null",
"&&",
"skipEnd",
">",
"0",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"y",
",",
"lastMatch",
".",
"getLastIndex",
"(",
")",
"+",
"skipEnd",
")",
";",
"}",
"else",
"if",
"(",
"lastMatch",
"!=",
"null",
"&&",
"def",
".",
"getSkip",
"(",
")",
">",
"0",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"y",
",",
"lastMatch",
".",
"getLastIndex",
"(",
")",
"+",
"def",
".",
"getSkip",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"y",
";",
"}",
"}"
] |
Return the last value of the next segment to be searched.
@param y
the last value of the most recently searched segment.
@param lastMatch
the most recent segment to match this rule.
@return the last value of the next segment to search.
|
[
"Return",
"the",
"last",
"value",
"of",
"the",
"next",
"segment",
"to",
"be",
"searched",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/LowLevelAbstractionFinder.java#L242-L252
|
148,860
|
openbase/jul
|
processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java
|
XMLProcessor.existenceCheck
|
public void existenceCheck(final Nodes nodes, final String nodeNameForDebugging) throws XMLParsingException {
if (nodes.size() == 0) {
throw new XMLParsingException("Message doesn't contain a " + nodeNameForDebugging + "node!");
}
}
|
java
|
public void existenceCheck(final Nodes nodes, final String nodeNameForDebugging) throws XMLParsingException {
if (nodes.size() == 0) {
throw new XMLParsingException("Message doesn't contain a " + nodeNameForDebugging + "node!");
}
}
|
[
"public",
"void",
"existenceCheck",
"(",
"final",
"Nodes",
"nodes",
",",
"final",
"String",
"nodeNameForDebugging",
")",
"throws",
"XMLParsingException",
"{",
"if",
"(",
"nodes",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"XMLParsingException",
"(",
"\"Message doesn't contain a \"",
"+",
"nodeNameForDebugging",
"+",
"\"node!\"",
")",
";",
"}",
"}"
] |
Does nothing if nodes contains at least one node. Throws InvalidCfgDocException otherwise.
@param nodes
@param nodeNameForDebugging
@throws XMLParsingException
|
[
"Does",
"nothing",
"if",
"nodes",
"contains",
"at",
"least",
"one",
"node",
".",
"Throws",
"InvalidCfgDocException",
"otherwise",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java#L326-L330
|
148,861
|
openbase/jul
|
processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java
|
XMLProcessor.xorCheck
|
public static void xorCheck(final Nodes nodes1, final Nodes nodes2, final String nodeTypeForDebugging) throws XMLParsingException {
if (nodes1.size() > 0 && nodes2.size() > 0) {
throw new XMLParsingException("Message contains more than one " + nodeTypeForDebugging + " node. Only one permitted.");
}
}
|
java
|
public static void xorCheck(final Nodes nodes1, final Nodes nodes2, final String nodeTypeForDebugging) throws XMLParsingException {
if (nodes1.size() > 0 && nodes2.size() > 0) {
throw new XMLParsingException("Message contains more than one " + nodeTypeForDebugging + " node. Only one permitted.");
}
}
|
[
"public",
"static",
"void",
"xorCheck",
"(",
"final",
"Nodes",
"nodes1",
",",
"final",
"Nodes",
"nodes2",
",",
"final",
"String",
"nodeTypeForDebugging",
")",
"throws",
"XMLParsingException",
"{",
"if",
"(",
"nodes1",
".",
"size",
"(",
")",
">",
"0",
"&&",
"nodes2",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"XMLParsingException",
"(",
"\"Message contains more than one \"",
"+",
"nodeTypeForDebugging",
"+",
"\" node. Only one permitted.\"",
")",
";",
"}",
"}"
] |
Does nothing if only one of nodes1 or nodes2 contains more than zero nodes. Throws InvalidCfgDocException otherwise.
@param nodes1
@param nodes2
@param nodeTypeForDebugging
@throws XMLParsingException
|
[
"Does",
"nothing",
"if",
"only",
"one",
"of",
"nodes1",
"or",
"nodes2",
"contains",
"more",
"than",
"zero",
"nodes",
".",
"Throws",
"InvalidCfgDocException",
"otherwise",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java#L340-L344
|
148,862
|
hypfvieh/java-utils
|
src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java
|
ComponentRegistry.getComponentsVersions
|
public synchronized Map<String, String> getComponentsVersions() {
SortedMap<String, String> keys = new TreeMap<>(componentVersions);
return keys;
}
|
java
|
public synchronized Map<String, String> getComponentsVersions() {
SortedMap<String, String> keys = new TreeMap<>(componentVersions);
return keys;
}
|
[
"public",
"synchronized",
"Map",
"<",
"String",
",",
"String",
">",
"getComponentsVersions",
"(",
")",
"{",
"SortedMap",
"<",
"String",
",",
"String",
">",
"keys",
"=",
"new",
"TreeMap",
"<>",
"(",
"componentVersions",
")",
";",
"return",
"keys",
";",
"}"
] |
Returns the list of registered Components and Versions as Map.
@return Map, never null
|
[
"Returns",
"the",
"list",
"of",
"registered",
"Components",
"and",
"Versions",
"as",
"Map",
"."
] |
407c32d6b485596d4d2b644f5f7fc7a02d0169c6
|
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java#L85-L88
|
148,863
|
hypfvieh/java-utils
|
src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java
|
ComponentRegistry.registerComponent
|
public synchronized void registerComponent(Class<?> _clazz, String _version) {
componentVersions.put(_clazz.getName(), _version);
}
|
java
|
public synchronized void registerComponent(Class<?> _clazz, String _version) {
componentVersions.put(_clazz.getName(), _version);
}
|
[
"public",
"synchronized",
"void",
"registerComponent",
"(",
"Class",
"<",
"?",
">",
"_clazz",
",",
"String",
"_version",
")",
"{",
"componentVersions",
".",
"put",
"(",
"_clazz",
".",
"getName",
"(",
")",
",",
"_version",
")",
";",
"}"
] |
Register a class with version.
@param _clazz class
@param _version version
|
[
"Register",
"a",
"class",
"with",
"version",
"."
] |
407c32d6b485596d4d2b644f5f7fc7a02d0169c6
|
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java#L106-L108
|
148,864
|
hypfvieh/java-utils
|
src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java
|
ComponentRegistry.isIncluded
|
private synchronized boolean isIncluded(String _clazzName) {
if (includes.size() > 0) {
for (String include : includes) {
if (_clazzName.startsWith(include)) {
return true;
}
}
} // if we dont have a list, we include nothing (to prevent circular classloader dependencies)
return false;
}
|
java
|
private synchronized boolean isIncluded(String _clazzName) {
if (includes.size() > 0) {
for (String include : includes) {
if (_clazzName.startsWith(include)) {
return true;
}
}
} // if we dont have a list, we include nothing (to prevent circular classloader dependencies)
return false;
}
|
[
"private",
"synchronized",
"boolean",
"isIncluded",
"(",
"String",
"_clazzName",
")",
"{",
"if",
"(",
"includes",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"String",
"include",
":",
"includes",
")",
"{",
"if",
"(",
"_clazzName",
".",
"startsWith",
"(",
"include",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"// if we dont have a list, we include nothing (to prevent circular classloader dependencies)",
"return",
"false",
";",
"}"
] |
Check if the given FQCN matches to any given include pattern.
@param _clazzName class
@return true if included, false otherwise
|
[
"Check",
"if",
"the",
"given",
"FQCN",
"matches",
"to",
"any",
"given",
"include",
"pattern",
"."
] |
407c32d6b485596d4d2b644f5f7fc7a02d0169c6
|
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java#L135-L145
|
148,865
|
hypfvieh/java-utils
|
src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java
|
ComponentRegistry.registerComponent
|
public synchronized void registerComponent(Class<?> _clazz) {
if (_clazz == null) {
return;
}
if (isIncluded(_clazz.getName()) || _clazz.getName().equals(this.getClass().getName())) {
String classVersion = getVersionWithReflection(_clazz);
if (classVersion != null) {
componentVersions.put(_clazz.getName(), classVersion);
}
}
}
|
java
|
public synchronized void registerComponent(Class<?> _clazz) {
if (_clazz == null) {
return;
}
if (isIncluded(_clazz.getName()) || _clazz.getName().equals(this.getClass().getName())) {
String classVersion = getVersionWithReflection(_clazz);
if (classVersion != null) {
componentVersions.put(_clazz.getName(), classVersion);
}
}
}
|
[
"public",
"synchronized",
"void",
"registerComponent",
"(",
"Class",
"<",
"?",
">",
"_clazz",
")",
"{",
"if",
"(",
"_clazz",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isIncluded",
"(",
"_clazz",
".",
"getName",
"(",
")",
")",
"||",
"_clazz",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"String",
"classVersion",
"=",
"getVersionWithReflection",
"(",
"_clazz",
")",
";",
"if",
"(",
"classVersion",
"!=",
"null",
")",
"{",
"componentVersions",
".",
"put",
"(",
"_clazz",
".",
"getName",
"(",
")",
",",
"classVersion",
")",
";",
"}",
"}",
"}"
] |
Register a class using the Class-Object.
@param _clazz class
|
[
"Register",
"a",
"class",
"using",
"the",
"Class",
"-",
"Object",
"."
] |
407c32d6b485596d4d2b644f5f7fc7a02d0169c6
|
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java#L151-L162
|
148,866
|
hypfvieh/java-utils
|
src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java
|
ComponentRegistry.registerComponent
|
public synchronized void registerComponent(String _string) {
if (isIncluded(_string)) {
Class<?> dummy;
try {
dummy = Class.forName(_string);
String classVersion = getVersionWithReflection(dummy);
if (classVersion != null) {
componentVersions.put(_string, classVersion);
}
} catch (ClassNotFoundException ex) {
logger.trace("Unable to call getVersion on " + _string);
}
}
}
|
java
|
public synchronized void registerComponent(String _string) {
if (isIncluded(_string)) {
Class<?> dummy;
try {
dummy = Class.forName(_string);
String classVersion = getVersionWithReflection(dummy);
if (classVersion != null) {
componentVersions.put(_string, classVersion);
}
} catch (ClassNotFoundException ex) {
logger.trace("Unable to call getVersion on " + _string);
}
}
}
|
[
"public",
"synchronized",
"void",
"registerComponent",
"(",
"String",
"_string",
")",
"{",
"if",
"(",
"isIncluded",
"(",
"_string",
")",
")",
"{",
"Class",
"<",
"?",
">",
"dummy",
";",
"try",
"{",
"dummy",
"=",
"Class",
".",
"forName",
"(",
"_string",
")",
";",
"String",
"classVersion",
"=",
"getVersionWithReflection",
"(",
"dummy",
")",
";",
"if",
"(",
"classVersion",
"!=",
"null",
")",
"{",
"componentVersions",
".",
"put",
"(",
"_string",
",",
"classVersion",
")",
";",
"}",
"}",
"catch",
"(",
"ClassNotFoundException",
"ex",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Unable to call getVersion on \"",
"+",
"_string",
")",
";",
"}",
"}",
"}"
] |
Register a component with FQCN only. This method will try to get the class version using reflections!
@param _string fqcn
|
[
"Register",
"a",
"component",
"with",
"FQCN",
"only",
".",
"This",
"method",
"will",
"try",
"to",
"get",
"the",
"class",
"version",
"using",
"reflections!"
] |
407c32d6b485596d4d2b644f5f7fc7a02d0169c6
|
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/classloader/ComponentRegistry.java#L170-L184
|
148,867
|
sematext/sematext-metrics
|
src/main/java/com/sematext/metrics/client/StDatapoint.java
|
StDatapoint.name
|
public static Builder name(String name) {
if (name == null || name.trim().isEmpty()) {
throw new IllegalArgumentException("Name should be defined.");
}
return new Builder(name);
}
|
java
|
public static Builder name(String name) {
if (name == null || name.trim().isEmpty()) {
throw new IllegalArgumentException("Name should be defined.");
}
return new Builder(name);
}
|
[
"public",
"static",
"Builder",
"name",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Name should be defined.\"",
")",
";",
"}",
"return",
"new",
"Builder",
"(",
"name",
")",
";",
"}"
] |
Create new datapoint builder for metric's name.
@param name metric's name
@return datapoint builder instance
@throws IllegalArgumentException if name is empty or {@code null}
|
[
"Create",
"new",
"datapoint",
"builder",
"for",
"metric",
"s",
"name",
"."
] |
a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c
|
https://github.com/sematext/sematext-metrics/blob/a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c/src/main/java/com/sematext/metrics/client/StDatapoint.java#L191-L196
|
148,868
|
openbase/jul
|
processing/default/src/main/java/org/openbase/jul/processing/QuaternionEulerTransform.java
|
QuaternionEulerTransform.transform
|
public static Vector3d transform(final Quat4d quat4d) {
Vector3d result = new Vector3d();
double test = quat4d.x * quat4d.z + quat4d.y * quat4d.w;
if (test >= 0.5) { // singularity at north pole
result.x = 0;
result.y = Math.PI / 2;
result.z = 2 * Math.atan2(quat4d.x, quat4d.w);
return result;
}
if (test <= -0.5) { // singularity at south pole
result.x = 0;
result.y = -Math.PI / 2;
result.z = -2 * Math.atan2(quat4d.x, quat4d.w);
return result;
}
double sqx = quat4d.x * quat4d.x;
double sqz = quat4d.y * quat4d.y;
double sqy = quat4d.z * quat4d.z;
result.x = Math.atan2(2 * quat4d.x * quat4d.w - 2 * quat4d.z * quat4d.y, 1 - 2 * sqx - 2 * sqz);
result.y = Math.asin(2 * test);
result.z = Math.atan2(2 * quat4d.z * quat4d.w - 2 * quat4d.x * quat4d.y, 1 - 2 * sqy - 2 * sqz);
return result;
}
|
java
|
public static Vector3d transform(final Quat4d quat4d) {
Vector3d result = new Vector3d();
double test = quat4d.x * quat4d.z + quat4d.y * quat4d.w;
if (test >= 0.5) { // singularity at north pole
result.x = 0;
result.y = Math.PI / 2;
result.z = 2 * Math.atan2(quat4d.x, quat4d.w);
return result;
}
if (test <= -0.5) { // singularity at south pole
result.x = 0;
result.y = -Math.PI / 2;
result.z = -2 * Math.atan2(quat4d.x, quat4d.w);
return result;
}
double sqx = quat4d.x * quat4d.x;
double sqz = quat4d.y * quat4d.y;
double sqy = quat4d.z * quat4d.z;
result.x = Math.atan2(2 * quat4d.x * quat4d.w - 2 * quat4d.z * quat4d.y, 1 - 2 * sqx - 2 * sqz);
result.y = Math.asin(2 * test);
result.z = Math.atan2(2 * quat4d.z * quat4d.w - 2 * quat4d.x * quat4d.y, 1 - 2 * sqy - 2 * sqz);
return result;
}
|
[
"public",
"static",
"Vector3d",
"transform",
"(",
"final",
"Quat4d",
"quat4d",
")",
"{",
"Vector3d",
"result",
"=",
"new",
"Vector3d",
"(",
")",
";",
"double",
"test",
"=",
"quat4d",
".",
"x",
"*",
"quat4d",
".",
"z",
"+",
"quat4d",
".",
"y",
"*",
"quat4d",
".",
"w",
";",
"if",
"(",
"test",
">=",
"0.5",
")",
"{",
"// singularity at north pole",
"result",
".",
"x",
"=",
"0",
";",
"result",
".",
"y",
"=",
"Math",
".",
"PI",
"/",
"2",
";",
"result",
".",
"z",
"=",
"2",
"*",
"Math",
".",
"atan2",
"(",
"quat4d",
".",
"x",
",",
"quat4d",
".",
"w",
")",
";",
"return",
"result",
";",
"}",
"if",
"(",
"test",
"<=",
"-",
"0.5",
")",
"{",
"// singularity at south pole",
"result",
".",
"x",
"=",
"0",
";",
"result",
".",
"y",
"=",
"-",
"Math",
".",
"PI",
"/",
"2",
";",
"result",
".",
"z",
"=",
"-",
"2",
"*",
"Math",
".",
"atan2",
"(",
"quat4d",
".",
"x",
",",
"quat4d",
".",
"w",
")",
";",
"return",
"result",
";",
"}",
"double",
"sqx",
"=",
"quat4d",
".",
"x",
"*",
"quat4d",
".",
"x",
";",
"double",
"sqz",
"=",
"quat4d",
".",
"y",
"*",
"quat4d",
".",
"y",
";",
"double",
"sqy",
"=",
"quat4d",
".",
"z",
"*",
"quat4d",
".",
"z",
";",
"result",
".",
"x",
"=",
"Math",
".",
"atan2",
"(",
"2",
"*",
"quat4d",
".",
"x",
"*",
"quat4d",
".",
"w",
"-",
"2",
"*",
"quat4d",
".",
"z",
"*",
"quat4d",
".",
"y",
",",
"1",
"-",
"2",
"*",
"sqx",
"-",
"2",
"*",
"sqz",
")",
";",
"result",
".",
"y",
"=",
"Math",
".",
"asin",
"(",
"2",
"*",
"test",
")",
";",
"result",
".",
"z",
"=",
"Math",
".",
"atan2",
"(",
"2",
"*",
"quat4d",
".",
"z",
"*",
"quat4d",
".",
"w",
"-",
"2",
"*",
"quat4d",
".",
"x",
"*",
"quat4d",
".",
"y",
",",
"1",
"-",
"2",
"*",
"sqy",
"-",
"2",
"*",
"sqz",
")",
";",
"return",
"result",
";",
"}"
] |
Conversion from quaternion to Euler rotation.
The x value fr
@param quat4d the quaternion from which the euler rotation is computed.
@return a vector with the mapping: x = roll, y = pitch, z = yaw
|
[
"Conversion",
"from",
"quaternion",
"to",
"Euler",
"rotation",
".",
"The",
"x",
"value",
"fr"
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/default/src/main/java/org/openbase/jul/processing/QuaternionEulerTransform.java#L85-L109
|
148,869
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/value/ValueList.java
|
ValueList.getInstance
|
public static <V extends Value> ValueList<V> getInstance(V... value) {
ValueList<V> result = new ValueList<>(value.length);
for (V val : value) {
result.add(val);
}
return result;
}
|
java
|
public static <V extends Value> ValueList<V> getInstance(V... value) {
ValueList<V> result = new ValueList<>(value.length);
for (V val : value) {
result.add(val);
}
return result;
}
|
[
"public",
"static",
"<",
"V",
"extends",
"Value",
">",
"ValueList",
"<",
"V",
">",
"getInstance",
"(",
"V",
"...",
"value",
")",
"{",
"ValueList",
"<",
"V",
">",
"result",
"=",
"new",
"ValueList",
"<>",
"(",
"value",
".",
"length",
")",
";",
"for",
"(",
"V",
"val",
":",
"value",
")",
"{",
"result",
".",
"add",
"(",
"val",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Creates a list of the provided elements in the same order.
@param value zero or more values.
@return a list of the provided values.
|
[
"Creates",
"a",
"list",
"of",
"the",
"provided",
"elements",
"in",
"the",
"same",
"order",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/value/ValueList.java#L47-L53
|
148,870
|
foundation-runtime/configuration
|
configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamReaders.java
|
ParamReaders.getValuesMap
|
private static<V> TreeMap<String, V> getValuesMap (String prefix, ParamReader<V> reader) {
TreeMap<String, V> map = null;
Iterator iter = config().getKeys(prefix);
while(iter.hasNext()){
String key = iter.next().toString();
if (map == null) {
map = new TreeMap(keysComparator); // make sure that all keys are inserted by their configured order
}
map.put(key, reader.readValue(key));
}
return map;
}
|
java
|
private static<V> TreeMap<String, V> getValuesMap (String prefix, ParamReader<V> reader) {
TreeMap<String, V> map = null;
Iterator iter = config().getKeys(prefix);
while(iter.hasNext()){
String key = iter.next().toString();
if (map == null) {
map = new TreeMap(keysComparator); // make sure that all keys are inserted by their configured order
}
map.put(key, reader.readValue(key));
}
return map;
}
|
[
"private",
"static",
"<",
"V",
">",
"TreeMap",
"<",
"String",
",",
"V",
">",
"getValuesMap",
"(",
"String",
"prefix",
",",
"ParamReader",
"<",
"V",
">",
"reader",
")",
"{",
"TreeMap",
"<",
"String",
",",
"V",
">",
"map",
"=",
"null",
";",
"Iterator",
"iter",
"=",
"config",
"(",
")",
".",
"getKeys",
"(",
"prefix",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"key",
"=",
"iter",
".",
"next",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"TreeMap",
"(",
"keysComparator",
")",
";",
"// make sure that all keys are inserted by their configured order",
"}",
"map",
".",
"put",
"(",
"key",
",",
"reader",
".",
"readValue",
"(",
"key",
")",
")",
";",
"}",
"return",
"map",
";",
"}"
] |
return a map with all keys and values where the entries are sorted by the configured order
|
[
"return",
"a",
"map",
"with",
"all",
"keys",
"and",
"values",
"where",
"the",
"entries",
"are",
"sorted",
"by",
"the",
"configured",
"order"
] |
c5bd171a2cca0dc1c8d568f987843ca47c6d1eed
|
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamReaders.java#L411-L427
|
148,871
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/backend/dsb/filter/PositionFilter.java
|
PositionFilter.init
|
private void init() {
if (ival == null) {
this.ival = intervalFactory.getInstance(start, startGran, finish, finishGran);
if (startSide == null) {
startSide = Side.START;
}
if (finishSide == null) {
finishSide = Side.FINISH;
}
}
}
|
java
|
private void init() {
if (ival == null) {
this.ival = intervalFactory.getInstance(start, startGran, finish, finishGran);
if (startSide == null) {
startSide = Side.START;
}
if (finishSide == null) {
finishSide = Side.FINISH;
}
}
}
|
[
"private",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"ival",
"==",
"null",
")",
"{",
"this",
".",
"ival",
"=",
"intervalFactory",
".",
"getInstance",
"(",
"start",
",",
"startGran",
",",
"finish",
",",
"finishGran",
")",
";",
"if",
"(",
"startSide",
"==",
"null",
")",
"{",
"startSide",
"=",
"Side",
".",
"START",
";",
"}",
"if",
"(",
"finishSide",
"==",
"null",
")",
"{",
"finishSide",
"=",
"Side",
".",
"FINISH",
";",
"}",
"}",
"}"
] |
Complete this object's initialization. This method should be called
externally only by Castor.
|
[
"Complete",
"this",
"object",
"s",
"initialization",
".",
"This",
"method",
"should",
"be",
"called",
"externally",
"only",
"by",
"Castor",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/backend/dsb/filter/PositionFilter.java#L95-L105
|
148,872
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/value/DateValue.java
|
DateValue.getInstance
|
public static DateValue getInstance(Date date) {
DateValue result;
if (date != null) {
synchronized (cache) {
result = cache.get(date);
if (result == null) {
result = new DateValue(date);
cache.put(date, result);
}
}
} else {
result = getInstance(new Date());
}
return result;
}
|
java
|
public static DateValue getInstance(Date date) {
DateValue result;
if (date != null) {
synchronized (cache) {
result = cache.get(date);
if (result == null) {
result = new DateValue(date);
cache.put(date, result);
}
}
} else {
result = getInstance(new Date());
}
return result;
}
|
[
"public",
"static",
"DateValue",
"getInstance",
"(",
"Date",
"date",
")",
"{",
"DateValue",
"result",
";",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"cache",
")",
"{",
"result",
"=",
"cache",
".",
"get",
"(",
"date",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"DateValue",
"(",
"date",
")",
";",
"cache",
".",
"put",
"(",
"date",
",",
"result",
")",
";",
"}",
"}",
"}",
"else",
"{",
"result",
"=",
"getInstance",
"(",
"new",
"Date",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Constructs a new date value from a Java date object. Uses a cache to
reuse date value objects.
@param date a {@link Date}. If <code>null</code> a new date value is
created using the current time.
@return a {@link DateValue}.
|
[
"Constructs",
"a",
"new",
"date",
"value",
"from",
"a",
"Java",
"date",
"object",
".",
"Uses",
"a",
"cache",
"to",
"reuse",
"date",
"value",
"objects",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/value/DateValue.java#L67-L81
|
148,873
|
eurekaclinical/eurekaclinical-i2b2-integration-service
|
src/main/java/org/eurekaclinical/i2b2integration/service/resource/FreemarkerBuiltIns.java
|
FreemarkerBuiltIns.eval
|
String eval(String expr, Map<String, ? extends Object> model) throws TemplateException {
if (expr == null) {
throw new IllegalArgumentException("expr cannot be null");
}
try {
Template t = new Template("t", "${(" + expr.trim() + ")?c}", this.cfg);
StringWriter w = new StringWriter();
try (StringWriter ww = w) {
t.process(model, ww);
}
return w.toString();
} catch (IOException ex) {
throw new AssertionError(ex);
}
}
|
java
|
String eval(String expr, Map<String, ? extends Object> model) throws TemplateException {
if (expr == null) {
throw new IllegalArgumentException("expr cannot be null");
}
try {
Template t = new Template("t", "${(" + expr.trim() + ")?c}", this.cfg);
StringWriter w = new StringWriter();
try (StringWriter ww = w) {
t.process(model, ww);
}
return w.toString();
} catch (IOException ex) {
throw new AssertionError(ex);
}
}
|
[
"String",
"eval",
"(",
"String",
"expr",
",",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"model",
")",
"throws",
"TemplateException",
"{",
"if",
"(",
"expr",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expr cannot be null\"",
")",
";",
"}",
"try",
"{",
"Template",
"t",
"=",
"new",
"Template",
"(",
"\"t\"",
",",
"\"${(\"",
"+",
"expr",
".",
"trim",
"(",
")",
"+",
"\")?c}\"",
",",
"this",
".",
"cfg",
")",
";",
"StringWriter",
"w",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"(",
"StringWriter",
"ww",
"=",
"w",
")",
"{",
"t",
".",
"process",
"(",
"model",
",",
"ww",
")",
";",
"}",
"return",
"w",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"ex",
")",
";",
"}",
"}"
] |
Evaluates a string as a Freemarker Template Language expression.
@param expr a Freemarker Template Language expression. Cannot be
<code>null</code>.
@param model a map of variable names to values. The variables may be used
in the expression.
@return the result of the expression as a string. Guaranteed not
<code>null</code>.
@throws TemplateException if an error occurred evaluating the expression.
|
[
"Evaluates",
"a",
"string",
"as",
"a",
"Freemarker",
"Template",
"Language",
"expression",
"."
] |
218fb8d6b5734dc076345693739d284c313f2669
|
https://github.com/eurekaclinical/eurekaclinical-i2b2-integration-service/blob/218fb8d6b5734dc076345693739d284c313f2669/src/main/java/org/eurekaclinical/i2b2integration/service/resource/FreemarkerBuiltIns.java#L78-L92
|
148,874
|
eurekaclinical/protempa
|
protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java
|
Util.parseTimeConstraint
|
static Integer parseTimeConstraint(Instance instance, String constraint,
ConnectionManager cm) throws KnowledgeSourceReadException {
Integer constraintValue = null;
if (instance != null && constraint != null) {
constraintValue = (Integer) cm.getOwnSlotValue(instance,
cm.getSlot(constraint));
}
return constraintValue;
}
|
java
|
static Integer parseTimeConstraint(Instance instance, String constraint,
ConnectionManager cm) throws KnowledgeSourceReadException {
Integer constraintValue = null;
if (instance != null && constraint != null) {
constraintValue = (Integer) cm.getOwnSlotValue(instance,
cm.getSlot(constraint));
}
return constraintValue;
}
|
[
"static",
"Integer",
"parseTimeConstraint",
"(",
"Instance",
"instance",
",",
"String",
"constraint",
",",
"ConnectionManager",
"cm",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"Integer",
"constraintValue",
"=",
"null",
";",
"if",
"(",
"instance",
"!=",
"null",
"&&",
"constraint",
"!=",
"null",
")",
"{",
"constraintValue",
"=",
"(",
"Integer",
")",
"cm",
".",
"getOwnSlotValue",
"(",
"instance",
",",
"cm",
".",
"getSlot",
"(",
"constraint",
")",
")",
";",
"}",
"return",
"constraintValue",
";",
"}"
] |
Calculates a time constraint in milliseconds from a pair of time
constraint and units values in a Protege instance.
@param instance a Protege <code>Instance</code> object.
@param constraint a time constraint slot name. The named slot is expected
to have an Integer value.
@param constraintUnits a time constraint units slot name. May have the
values "Minute", "Hour", or "Day".
@return a <code>Weight</code> object representing a time in milliseconds.
|
[
"Calculates",
"a",
"time",
"constraint",
"in",
"milliseconds",
"from",
"a",
"pair",
"of",
"time",
"constraint",
"and",
"units",
"values",
"in",
"a",
"Protege",
"instance",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java#L208-L217
|
148,875
|
eurekaclinical/protempa
|
protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java
|
Util.setInverseIsAs
|
static void setInverseIsAs(Instance propInstance,
AbstractPropositionDefinition propDef, ConnectionManager cm)
throws KnowledgeSourceReadException {
Collection<?> isas = propInstance.getDirectOwnSlotValues(cm
.getSlot("inverseIsA"));
Logger logger = Util.logger();
if (isas != null && !isas.isEmpty()) {
Set<String> inverseIsANames = resolveAndLogDuplicates(isas, logger,
propInstance, "inverseIsA");
String[] inverseIsAsArr = inverseIsANames
.toArray(new String[inverseIsANames.size()]);
propDef.setInverseIsA(inverseIsAsArr);
}
}
|
java
|
static void setInverseIsAs(Instance propInstance,
AbstractPropositionDefinition propDef, ConnectionManager cm)
throws KnowledgeSourceReadException {
Collection<?> isas = propInstance.getDirectOwnSlotValues(cm
.getSlot("inverseIsA"));
Logger logger = Util.logger();
if (isas != null && !isas.isEmpty()) {
Set<String> inverseIsANames = resolveAndLogDuplicates(isas, logger,
propInstance, "inverseIsA");
String[] inverseIsAsArr = inverseIsANames
.toArray(new String[inverseIsANames.size()]);
propDef.setInverseIsA(inverseIsAsArr);
}
}
|
[
"static",
"void",
"setInverseIsAs",
"(",
"Instance",
"propInstance",
",",
"AbstractPropositionDefinition",
"propDef",
",",
"ConnectionManager",
"cm",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"Collection",
"<",
"?",
">",
"isas",
"=",
"propInstance",
".",
"getDirectOwnSlotValues",
"(",
"cm",
".",
"getSlot",
"(",
"\"inverseIsA\"",
")",
")",
";",
"Logger",
"logger",
"=",
"Util",
".",
"logger",
"(",
")",
";",
"if",
"(",
"isas",
"!=",
"null",
"&&",
"!",
"isas",
".",
"isEmpty",
"(",
")",
")",
"{",
"Set",
"<",
"String",
">",
"inverseIsANames",
"=",
"resolveAndLogDuplicates",
"(",
"isas",
",",
"logger",
",",
"propInstance",
",",
"\"inverseIsA\"",
")",
";",
"String",
"[",
"]",
"inverseIsAsArr",
"=",
"inverseIsANames",
".",
"toArray",
"(",
"new",
"String",
"[",
"inverseIsANames",
".",
"size",
"(",
")",
"]",
")",
";",
"propDef",
".",
"setInverseIsA",
"(",
"inverseIsAsArr",
")",
";",
"}",
"}"
] |
Sets inverseIsA on the given proposition definition. Automatically
resolves duplicate entries but logs a warning.
@param propInstance a Protege proposition definition {@link Instance}.
@param propDef the corresponding {@link AbstractPropositionDefinition}.
@param cm a {@link ConnectionManager}.
@throws KnowledgeSourceReadException if there is an error accessing the
Protege ontology.
|
[
"Sets",
"inverseIsA",
"on",
"the",
"given",
"proposition",
"definition",
".",
"Automatically",
"resolves",
"duplicate",
"entries",
"but",
"logs",
"a",
"warning",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java#L339-L352
|
148,876
|
eurekaclinical/protempa
|
protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java
|
Util.isParameter
|
private static boolean isParameter(Instance extendedParameter,
ConnectionManager cm) throws KnowledgeSourceReadException {
Instance proposition = (Instance) cm.getOwnSlotValue(extendedParameter,
cm.getSlot("proposition"));
if (proposition.hasType(cm.getCls("Parameter"))) {
return true;
} else {
return false;
}
}
|
java
|
private static boolean isParameter(Instance extendedParameter,
ConnectionManager cm) throws KnowledgeSourceReadException {
Instance proposition = (Instance) cm.getOwnSlotValue(extendedParameter,
cm.getSlot("proposition"));
if (proposition.hasType(cm.getCls("Parameter"))) {
return true;
} else {
return false;
}
}
|
[
"private",
"static",
"boolean",
"isParameter",
"(",
"Instance",
"extendedParameter",
",",
"ConnectionManager",
"cm",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"Instance",
"proposition",
"=",
"(",
"Instance",
")",
"cm",
".",
"getOwnSlotValue",
"(",
"extendedParameter",
",",
"cm",
".",
"getSlot",
"(",
"\"proposition\"",
")",
")",
";",
"if",
"(",
"proposition",
".",
"hasType",
"(",
"cm",
".",
"getCls",
"(",
"\"Parameter\"",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Returns whether a Protege instance is a Parameter.
@param extendedParameter a Protege instance that is assumed to be a
Proposition.
@return <code>true</code> if the provided Protege instance is a
Parameter, <code>false</code> otherwise.
|
[
"Returns",
"whether",
"a",
"Protege",
"instance",
"is",
"a",
"Parameter",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java#L704-L713
|
148,877
|
eurekaclinical/protempa
|
protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java
|
Util.propositionId
|
private static String propositionId(Instance extendedProposition) {
Instance proposition = (Instance) extendedProposition
.getOwnSlotValue(extendedProposition.getKnowledgeBase()
.getSlot("proposition"));
if (proposition.hasType(proposition.getKnowledgeBase().getCls(
"ConstantParameter"))) {
throw new IllegalStateException(
"Constant parameters are not yet supported as "
+ "components of a high level abstraction definition.");
} else {
return proposition.getName();
}
}
|
java
|
private static String propositionId(Instance extendedProposition) {
Instance proposition = (Instance) extendedProposition
.getOwnSlotValue(extendedProposition.getKnowledgeBase()
.getSlot("proposition"));
if (proposition.hasType(proposition.getKnowledgeBase().getCls(
"ConstantParameter"))) {
throw new IllegalStateException(
"Constant parameters are not yet supported as "
+ "components of a high level abstraction definition.");
} else {
return proposition.getName();
}
}
|
[
"private",
"static",
"String",
"propositionId",
"(",
"Instance",
"extendedProposition",
")",
"{",
"Instance",
"proposition",
"=",
"(",
"Instance",
")",
"extendedProposition",
".",
"getOwnSlotValue",
"(",
"extendedProposition",
".",
"getKnowledgeBase",
"(",
")",
".",
"getSlot",
"(",
"\"proposition\"",
")",
")",
";",
"if",
"(",
"proposition",
".",
"hasType",
"(",
"proposition",
".",
"getKnowledgeBase",
"(",
")",
".",
"getCls",
"(",
"\"ConstantParameter\"",
")",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Constant parameters are not yet supported as \"",
"+",
"\"components of a high level abstraction definition.\"",
")",
";",
"}",
"else",
"{",
"return",
"proposition",
".",
"getName",
"(",
")",
";",
"}",
"}"
] |
Returns the proposition id for an extended proposition definition.
@param extendedProposition an ExtendedProposition.
@return a proposition id {@link String}.
|
[
"Returns",
"the",
"proposition",
"id",
"for",
"an",
"extended",
"proposition",
"definition",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/Util.java#L721-L733
|
148,878
|
WinRoad-NET/htmldoclet4jdk8
|
src/main/java/net/winroad/htmldoclet4jdk8/HtmlDoclet.java
|
HtmlDoclet.generateWRAPIDetailFiles
|
protected void generateWRAPIDetailFiles(RootDoc root, WRDoc wrDoc) {
List<String> tagList = new ArrayList<String>(wrDoc.getWRTags());
for (String tag : tagList) {
List<OpenAPI> openAPIList = wrDoc.getTaggedOpenAPIs().get(tag);
Set<String> filesGenerated = new HashSet<String>();
for (OpenAPI openAPI : openAPIList) {
Map<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("openAPI", openAPI);
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
String oasJSONStr = null;
try {
oasJSONStr = mapper.writeValueAsString(this.convertToOAS(openAPI, this.configurationEx.branchname));
} catch (JsonProcessingException e) {
logger.error(e);
}
hashMap.put("OASV3", oasJSONStr);
String tagsStr = openAPI.getTags().toString();
// trim '[' and ']'
hashMap.put("tags", tagsStr.substring(1, tagsStr.length() - 1));
hashMap.put("generatedTime", wrDoc.getDocGeneratedTime());
hashMap.put(
"branchName",
this.configurationEx.branchname);
hashMap.put(
"systemName",
this.configurationEx.systemname);
if (StringUtils.isWhitespace(this.configurationEx.buildid) ||
this.configurationEx.buildid.equalsIgnoreCase("time")) {
hashMap.put("buildID", wrDoc.getDocGeneratedTime());
} else {
hashMap.put(
"buildID",
this.configurationEx.buildid);
}
this.logger.info("buildid:" + hashMap.get("buildID"));
String filename = generateWRAPIFileName(openAPI.getRequestMapping());
hashMap.put("filePath", filename);
if (!filesGenerated.contains(filename)) {
this.configurationEx
.getWriterFactory()
.getFreemarkerWriter()
.generateHtmlFile("wrAPIDetail.ftl", hashMap,
this.configurationEx.destDirName, filename);
filesGenerated.add(filename);
}
}
}
}
|
java
|
protected void generateWRAPIDetailFiles(RootDoc root, WRDoc wrDoc) {
List<String> tagList = new ArrayList<String>(wrDoc.getWRTags());
for (String tag : tagList) {
List<OpenAPI> openAPIList = wrDoc.getTaggedOpenAPIs().get(tag);
Set<String> filesGenerated = new HashSet<String>();
for (OpenAPI openAPI : openAPIList) {
Map<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("openAPI", openAPI);
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
String oasJSONStr = null;
try {
oasJSONStr = mapper.writeValueAsString(this.convertToOAS(openAPI, this.configurationEx.branchname));
} catch (JsonProcessingException e) {
logger.error(e);
}
hashMap.put("OASV3", oasJSONStr);
String tagsStr = openAPI.getTags().toString();
// trim '[' and ']'
hashMap.put("tags", tagsStr.substring(1, tagsStr.length() - 1));
hashMap.put("generatedTime", wrDoc.getDocGeneratedTime());
hashMap.put(
"branchName",
this.configurationEx.branchname);
hashMap.put(
"systemName",
this.configurationEx.systemname);
if (StringUtils.isWhitespace(this.configurationEx.buildid) ||
this.configurationEx.buildid.equalsIgnoreCase("time")) {
hashMap.put("buildID", wrDoc.getDocGeneratedTime());
} else {
hashMap.put(
"buildID",
this.configurationEx.buildid);
}
this.logger.info("buildid:" + hashMap.get("buildID"));
String filename = generateWRAPIFileName(openAPI.getRequestMapping());
hashMap.put("filePath", filename);
if (!filesGenerated.contains(filename)) {
this.configurationEx
.getWriterFactory()
.getFreemarkerWriter()
.generateHtmlFile("wrAPIDetail.ftl", hashMap,
this.configurationEx.destDirName, filename);
filesGenerated.add(filename);
}
}
}
}
|
[
"protected",
"void",
"generateWRAPIDetailFiles",
"(",
"RootDoc",
"root",
",",
"WRDoc",
"wrDoc",
")",
"{",
"List",
"<",
"String",
">",
"tagList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"wrDoc",
".",
"getWRTags",
"(",
")",
")",
";",
"for",
"(",
"String",
"tag",
":",
"tagList",
")",
"{",
"List",
"<",
"OpenAPI",
">",
"openAPIList",
"=",
"wrDoc",
".",
"getTaggedOpenAPIs",
"(",
")",
".",
"get",
"(",
"tag",
")",
";",
"Set",
"<",
"String",
">",
"filesGenerated",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"OpenAPI",
"openAPI",
":",
"openAPIList",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"hashMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"hashMap",
".",
"put",
"(",
"\"openAPI\"",
",",
"openAPI",
")",
";",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"mapper",
".",
"setSerializationInclusion",
"(",
"JsonInclude",
".",
"Include",
".",
"NON_EMPTY",
")",
";",
"String",
"oasJSONStr",
"=",
"null",
";",
"try",
"{",
"oasJSONStr",
"=",
"mapper",
".",
"writeValueAsString",
"(",
"this",
".",
"convertToOAS",
"(",
"openAPI",
",",
"this",
".",
"configurationEx",
".",
"branchname",
")",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
")",
";",
"}",
"hashMap",
".",
"put",
"(",
"\"OASV3\"",
",",
"oasJSONStr",
")",
";",
"String",
"tagsStr",
"=",
"openAPI",
".",
"getTags",
"(",
")",
".",
"toString",
"(",
")",
";",
"// trim '[' and ']'",
"hashMap",
".",
"put",
"(",
"\"tags\"",
",",
"tagsStr",
".",
"substring",
"(",
"1",
",",
"tagsStr",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
";",
"hashMap",
".",
"put",
"(",
"\"generatedTime\"",
",",
"wrDoc",
".",
"getDocGeneratedTime",
"(",
")",
")",
";",
"hashMap",
".",
"put",
"(",
"\"branchName\"",
",",
"this",
".",
"configurationEx",
".",
"branchname",
")",
";",
"hashMap",
".",
"put",
"(",
"\"systemName\"",
",",
"this",
".",
"configurationEx",
".",
"systemname",
")",
";",
"if",
"(",
"StringUtils",
".",
"isWhitespace",
"(",
"this",
".",
"configurationEx",
".",
"buildid",
")",
"||",
"this",
".",
"configurationEx",
".",
"buildid",
".",
"equalsIgnoreCase",
"(",
"\"time\"",
")",
")",
"{",
"hashMap",
".",
"put",
"(",
"\"buildID\"",
",",
"wrDoc",
".",
"getDocGeneratedTime",
"(",
")",
")",
";",
"}",
"else",
"{",
"hashMap",
".",
"put",
"(",
"\"buildID\"",
",",
"this",
".",
"configurationEx",
".",
"buildid",
")",
";",
"}",
"this",
".",
"logger",
".",
"info",
"(",
"\"buildid:\"",
"+",
"hashMap",
".",
"get",
"(",
"\"buildID\"",
")",
")",
";",
"String",
"filename",
"=",
"generateWRAPIFileName",
"(",
"openAPI",
".",
"getRequestMapping",
"(",
")",
")",
";",
"hashMap",
".",
"put",
"(",
"\"filePath\"",
",",
"filename",
")",
";",
"if",
"(",
"!",
"filesGenerated",
".",
"contains",
"(",
"filename",
")",
")",
"{",
"this",
".",
"configurationEx",
".",
"getWriterFactory",
"(",
")",
".",
"getFreemarkerWriter",
"(",
")",
".",
"generateHtmlFile",
"(",
"\"wrAPIDetail.ftl\"",
",",
"hashMap",
",",
"this",
".",
"configurationEx",
".",
"destDirName",
",",
"filename",
")",
";",
"filesGenerated",
".",
"add",
"(",
"filename",
")",
";",
"}",
"}",
"}",
"}"
] |
Generate the tag documentation.
@param root
the RootDoc of source to document.
@param wrDoc
the data structure representing the doc to generate.
|
[
"Generate",
"the",
"tag",
"documentation",
"."
] |
1e0aa93c12e0228fb0f7a1b4f8e89d9a17cbe5c7
|
https://github.com/WinRoad-NET/htmldoclet4jdk8/blob/1e0aa93c12e0228fb0f7a1b4f8e89d9a17cbe5c7/src/main/java/net/winroad/htmldoclet4jdk8/HtmlDoclet.java#L234-L282
|
148,879
|
dmfs/xmlobjects
|
src/org/dmfs/xmlobjects/pull/XmlObjectPull.java
|
XmlObjectPull.moveToNext
|
public <T> boolean moveToNext(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException
{
pullInternal(type, null, path, true, false);
return !isEndOfDocument();
}
|
java
|
public <T> boolean moveToNext(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException
{
pullInternal(type, null, path, true, false);
return !isEndOfDocument();
}
|
[
"public",
"<",
"T",
">",
"boolean",
"moveToNext",
"(",
"ElementDescriptor",
"<",
"T",
">",
"type",
",",
"XmlPath",
"path",
")",
"throws",
"XmlPullParserException",
",",
"XmlObjectPullParserException",
",",
"IOException",
"{",
"pullInternal",
"(",
"type",
",",
"null",
",",
"path",
",",
"true",
",",
"false",
")",
";",
"return",
"!",
"isEndOfDocument",
"(",
")",
";",
"}"
] |
Moves forward to the start of the next element that matches the given type and path.
@return <code>true</code> if there is such an element, false otherwise.
@throws XmlPullParserException
@throws XmlObjectPullParserException
@throws IOException
|
[
"Moves",
"forward",
"to",
"the",
"start",
"of",
"the",
"next",
"element",
"that",
"matches",
"the",
"given",
"type",
"and",
"path",
"."
] |
b68ddd0ce994d804fc2ec6da1096bf0d883b37f9
|
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/XmlObjectPull.java#L82-L86
|
148,880
|
dmfs/xmlobjects
|
src/org/dmfs/xmlobjects/pull/XmlObjectPull.java
|
XmlObjectPull.moveToNextSibling
|
public <T> boolean moveToNextSibling(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException
{
return pullInternal(type, null, path, true, true) != null || mParser.getDepth() == path.length() + 1;
}
|
java
|
public <T> boolean moveToNextSibling(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException
{
return pullInternal(type, null, path, true, true) != null || mParser.getDepth() == path.length() + 1;
}
|
[
"public",
"<",
"T",
">",
"boolean",
"moveToNextSibling",
"(",
"ElementDescriptor",
"<",
"T",
">",
"type",
",",
"XmlPath",
"path",
")",
"throws",
"XmlPullParserException",
",",
"XmlObjectPullParserException",
",",
"IOException",
"{",
"return",
"pullInternal",
"(",
"type",
",",
"null",
",",
"path",
",",
"true",
",",
"true",
")",
"!=",
"null",
"||",
"mParser",
".",
"getDepth",
"(",
")",
"==",
"path",
".",
"length",
"(",
")",
"+",
"1",
";",
"}"
] |
Moves forward to the start of the next element that matches the given type and path without leaving the current sub-tree. If there is no other element of
that type in the current sub-tree, this mehtod will stop at the closing tab current sub-tree. Calling this methods with the same parameters won't get you
any further.
@return <code>true</code> if there is such an element, false otherwise.
@throws XmlPullParserException
@throws XmlObjectPullParserException
@throws IOException
|
[
"Moves",
"forward",
"to",
"the",
"start",
"of",
"the",
"next",
"element",
"that",
"matches",
"the",
"given",
"type",
"and",
"path",
"without",
"leaving",
"the",
"current",
"sub",
"-",
"tree",
".",
"If",
"there",
"is",
"no",
"other",
"element",
"of",
"that",
"type",
"in",
"the",
"current",
"sub",
"-",
"tree",
"this",
"mehtod",
"will",
"stop",
"at",
"the",
"closing",
"tab",
"current",
"sub",
"-",
"tree",
".",
"Calling",
"this",
"methods",
"with",
"the",
"same",
"parameters",
"won",
"t",
"get",
"you",
"any",
"further",
"."
] |
b68ddd0ce994d804fc2ec6da1096bf0d883b37f9
|
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/XmlObjectPull.java#L99-L102
|
148,881
|
dmfs/xmlobjects
|
src/org/dmfs/xmlobjects/pull/XmlObjectPull.java
|
XmlObjectPull.getCurrentElementQualifiedName
|
public QualifiedName getCurrentElementQualifiedName()
{
XmlPullParser parser = mParser;
return QualifiedName.get(parser.getNamespace(), parser.getName());
}
|
java
|
public QualifiedName getCurrentElementQualifiedName()
{
XmlPullParser parser = mParser;
return QualifiedName.get(parser.getNamespace(), parser.getName());
}
|
[
"public",
"QualifiedName",
"getCurrentElementQualifiedName",
"(",
")",
"{",
"XmlPullParser",
"parser",
"=",
"mParser",
";",
"return",
"QualifiedName",
".",
"get",
"(",
"parser",
".",
"getNamespace",
"(",
")",
",",
"parser",
".",
"getName",
"(",
")",
")",
";",
"}"
] |
Returns the qualified name of the current element.
@return
|
[
"Returns",
"the",
"qualified",
"name",
"of",
"the",
"current",
"element",
"."
] |
b68ddd0ce994d804fc2ec6da1096bf0d883b37f9
|
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/XmlObjectPull.java#L122-L126
|
148,882
|
dmfs/xmlobjects
|
src/org/dmfs/xmlobjects/pull/XmlObjectPull.java
|
XmlObjectPull.pull
|
public <T> T pull(ElementDescriptor<T> type, T recycle, XmlPath path) throws XmlPullParserException, IOException, XmlObjectPullParserException
{
return pullInternal(type, recycle, path, false, false);
}
|
java
|
public <T> T pull(ElementDescriptor<T> type, T recycle, XmlPath path) throws XmlPullParserException, IOException, XmlObjectPullParserException
{
return pullInternal(type, recycle, path, false, false);
}
|
[
"public",
"<",
"T",
">",
"T",
"pull",
"(",
"ElementDescriptor",
"<",
"T",
">",
"type",
",",
"T",
"recycle",
",",
"XmlPath",
"path",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
",",
"XmlObjectPullParserException",
"{",
"return",
"pullInternal",
"(",
"type",
",",
"recycle",
",",
"path",
",",
"false",
",",
"false",
")",
";",
"}"
] |
Pull the next object of the given type from the XML stream. If the current position is within such an object the current object is returned.
@param type
@param recycle
@param path
@return
@throws XmlPullParserException
@throws IOException
@throws XmlObjectPullParserException
|
[
"Pull",
"the",
"next",
"object",
"of",
"the",
"given",
"type",
"from",
"the",
"XML",
"stream",
".",
"If",
"the",
"current",
"position",
"is",
"within",
"such",
"an",
"object",
"the",
"current",
"object",
"is",
"returned",
"."
] |
b68ddd0ce994d804fc2ec6da1096bf0d883b37f9
|
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/XmlObjectPull.java#L164-L167
|
148,883
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/PrimitiveParameter.java
|
PrimitiveParameter.getGranularity
|
public Granularity getGranularity() {
Interval interval = getInterval();
if (interval != null) {
return interval.getStartGranularity();
} else {
return null;
}
}
|
java
|
public Granularity getGranularity() {
Interval interval = getInterval();
if (interval != null) {
return interval.getStartGranularity();
} else {
return null;
}
}
|
[
"public",
"Granularity",
"getGranularity",
"(",
")",
"{",
"Interval",
"interval",
"=",
"getInterval",
"(",
")",
";",
"if",
"(",
"interval",
"!=",
"null",
")",
"{",
"return",
"interval",
".",
"getStartGranularity",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Returns the granularity of this parameter's timestamp.
@return a {@link Granularity} object.
|
[
"Returns",
"the",
"granularity",
"of",
"this",
"parameter",
"s",
"timestamp",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/PrimitiveParameter.java#L96-L103
|
148,884
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/PrimitiveParameter.java
|
PrimitiveParameter.setGranularity
|
public void setGranularity(Granularity granularity) {
Interval interval = getInterval();
if (interval != null) {
resetInterval(interval.getMinStart(), granularity);
} else {
resetInterval(null, granularity);
}
}
|
java
|
public void setGranularity(Granularity granularity) {
Interval interval = getInterval();
if (interval != null) {
resetInterval(interval.getMinStart(), granularity);
} else {
resetInterval(null, granularity);
}
}
|
[
"public",
"void",
"setGranularity",
"(",
"Granularity",
"granularity",
")",
"{",
"Interval",
"interval",
"=",
"getInterval",
"(",
")",
";",
"if",
"(",
"interval",
"!=",
"null",
")",
"{",
"resetInterval",
"(",
"interval",
".",
"getMinStart",
"(",
")",
",",
"granularity",
")",
";",
"}",
"else",
"{",
"resetInterval",
"(",
"null",
",",
"granularity",
")",
";",
"}",
"}"
] |
Sets the granularity of this parameter's timestamp.
@param granularity
a {@link Granularity} object.
|
[
"Sets",
"the",
"granularity",
"of",
"this",
"parameter",
"s",
"timestamp",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/PrimitiveParameter.java#L111-L118
|
148,885
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/SliceConsequence.java
|
SliceConsequence.evaluate
|
@Override
public void evaluate(KnowledgeHelper arg0, WorkingMemory arg1) {
@SuppressWarnings("unchecked")
List<TemporalProposition> pl = (List<TemporalProposition>) arg0
.get(arg0.getDeclaration("result"));
Comparator<TemporalProposition> comp;
if (this.reverse) {
comp = ProtempaUtil.REVERSE_TEMP_PROP_COMP;
} else {
comp = ProtempaUtil.TEMP_PROP_COMP;
}
Collections.sort(pl, comp);
this.copier.grab(arg0);
if (this.merged) {
mergedInterval(arg0, pl);
} else {
for (ListIterator<TemporalProposition> itr = pl
.listIterator(this.minIndex); itr.hasNext()
&& itr.nextIndex() < this.maxIndex;) {
TemporalProposition o = itr.next();
o.accept(this.copier);
}
}
this.copier.release();
}
|
java
|
@Override
public void evaluate(KnowledgeHelper arg0, WorkingMemory arg1) {
@SuppressWarnings("unchecked")
List<TemporalProposition> pl = (List<TemporalProposition>) arg0
.get(arg0.getDeclaration("result"));
Comparator<TemporalProposition> comp;
if (this.reverse) {
comp = ProtempaUtil.REVERSE_TEMP_PROP_COMP;
} else {
comp = ProtempaUtil.TEMP_PROP_COMP;
}
Collections.sort(pl, comp);
this.copier.grab(arg0);
if (this.merged) {
mergedInterval(arg0, pl);
} else {
for (ListIterator<TemporalProposition> itr = pl
.listIterator(this.minIndex); itr.hasNext()
&& itr.nextIndex() < this.maxIndex;) {
TemporalProposition o = itr.next();
o.accept(this.copier);
}
}
this.copier.release();
}
|
[
"@",
"Override",
"public",
"void",
"evaluate",
"(",
"KnowledgeHelper",
"arg0",
",",
"WorkingMemory",
"arg1",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"TemporalProposition",
">",
"pl",
"=",
"(",
"List",
"<",
"TemporalProposition",
">",
")",
"arg0",
".",
"get",
"(",
"arg0",
".",
"getDeclaration",
"(",
"\"result\"",
")",
")",
";",
"Comparator",
"<",
"TemporalProposition",
">",
"comp",
";",
"if",
"(",
"this",
".",
"reverse",
")",
"{",
"comp",
"=",
"ProtempaUtil",
".",
"REVERSE_TEMP_PROP_COMP",
";",
"}",
"else",
"{",
"comp",
"=",
"ProtempaUtil",
".",
"TEMP_PROP_COMP",
";",
"}",
"Collections",
".",
"sort",
"(",
"pl",
",",
"comp",
")",
";",
"this",
".",
"copier",
".",
"grab",
"(",
"arg0",
")",
";",
"if",
"(",
"this",
".",
"merged",
")",
"{",
"mergedInterval",
"(",
"arg0",
",",
"pl",
")",
";",
"}",
"else",
"{",
"for",
"(",
"ListIterator",
"<",
"TemporalProposition",
">",
"itr",
"=",
"pl",
".",
"listIterator",
"(",
"this",
".",
"minIndex",
")",
";",
"itr",
".",
"hasNext",
"(",
")",
"&&",
"itr",
".",
"nextIndex",
"(",
")",
"<",
"this",
".",
"maxIndex",
";",
")",
"{",
"TemporalProposition",
"o",
"=",
"itr",
".",
"next",
"(",
")",
";",
"o",
".",
"accept",
"(",
"this",
".",
"copier",
")",
";",
"}",
"}",
"this",
".",
"copier",
".",
"release",
"(",
")",
";",
"}"
] |
Called when there exist the minimum necessary number of intervals with
the specified proposition id in order to compute the temporal slice
corresponding to this rule.
@param arg0
a {@link KnowledgeHelper}
@param arg1
a {@link WorkingMemory}
@see JBossRuleCreator
|
[
"Called",
"when",
"there",
"exist",
"the",
"minimum",
"necessary",
"number",
"of",
"intervals",
"with",
"the",
"specified",
"proposition",
"id",
"in",
"order",
"to",
"compute",
"the",
"temporal",
"slice",
"corresponding",
"to",
"this",
"rule",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/SliceConsequence.java#L123-L147
|
148,886
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/dest/table/AbstractTabularWriter.java
|
AbstractTabularWriter.writeValue
|
@Override
public final void writeValue(Value inValue, Format inFormat) throws TabularWriterException {
this.valueVisitor.setFormat(inFormat);
inValue.accept(this.valueVisitor);
TabularWriterException exception = this.valueVisitor.getException();
this.valueVisitor.clear();
if (exception != null) {
throw exception;
}
}
|
java
|
@Override
public final void writeValue(Value inValue, Format inFormat) throws TabularWriterException {
this.valueVisitor.setFormat(inFormat);
inValue.accept(this.valueVisitor);
TabularWriterException exception = this.valueVisitor.getException();
this.valueVisitor.clear();
if (exception != null) {
throw exception;
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"writeValue",
"(",
"Value",
"inValue",
",",
"Format",
"inFormat",
")",
"throws",
"TabularWriterException",
"{",
"this",
".",
"valueVisitor",
".",
"setFormat",
"(",
"inFormat",
")",
";",
"inValue",
".",
"accept",
"(",
"this",
".",
"valueVisitor",
")",
";",
"TabularWriterException",
"exception",
"=",
"this",
".",
"valueVisitor",
".",
"getException",
"(",
")",
";",
"this",
".",
"valueVisitor",
".",
"clear",
"(",
")",
";",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"throw",
"exception",
";",
"}",
"}"
] |
Writes the provided value, taking into account the type of value that it
is and the provided formatter.
@param inValue the value to write. Cannot be <code>null</code>.
@param inFormat the formatter to use.
@throws TabularWriterException if an error occurs trying to write the
value.
|
[
"Writes",
"the",
"provided",
"value",
"taking",
"into",
"account",
"the",
"type",
"of",
"value",
"that",
"it",
"is",
"and",
"the",
"provided",
"formatter",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/dest/table/AbstractTabularWriter.java#L119-L128
|
148,887
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/backend/CommonsBackend.java
|
CommonsBackend.initialize
|
public static void initialize(Object backend,
BackendInstanceSpec backendInstanceSpec) {
assert backend != null : "backend cannot be null";
assert backendInstanceSpec != null :
"backendInstanceSpec cannot be null";
for (Method method : backend.getClass().getMethods()) {
if (method.isAnnotationPresent(BackendProperty.class)) {
try {
BackendProperty annotation =
method.getAnnotation(BackendProperty.class);
String propertyName = propertyName(annotation, method);
Object propertyValue =
backendInstanceSpec.getProperty(propertyName);
if (propertyValue != null) {
method.invoke(backend,
new Object[]{propertyValue
});
}
} catch (IllegalAccessException | InvalidPropertyNameException | InvocationTargetException ex) {
throw new AssertionError(ex);
}
}
}
}
|
java
|
public static void initialize(Object backend,
BackendInstanceSpec backendInstanceSpec) {
assert backend != null : "backend cannot be null";
assert backendInstanceSpec != null :
"backendInstanceSpec cannot be null";
for (Method method : backend.getClass().getMethods()) {
if (method.isAnnotationPresent(BackendProperty.class)) {
try {
BackendProperty annotation =
method.getAnnotation(BackendProperty.class);
String propertyName = propertyName(annotation, method);
Object propertyValue =
backendInstanceSpec.getProperty(propertyName);
if (propertyValue != null) {
method.invoke(backend,
new Object[]{propertyValue
});
}
} catch (IllegalAccessException | InvalidPropertyNameException | InvocationTargetException ex) {
throw new AssertionError(ex);
}
}
}
}
|
[
"public",
"static",
"void",
"initialize",
"(",
"Object",
"backend",
",",
"BackendInstanceSpec",
"backendInstanceSpec",
")",
"{",
"assert",
"backend",
"!=",
"null",
":",
"\"backend cannot be null\"",
";",
"assert",
"backendInstanceSpec",
"!=",
"null",
":",
"\"backendInstanceSpec cannot be null\"",
";",
"for",
"(",
"Method",
"method",
":",
"backend",
".",
"getClass",
"(",
")",
".",
"getMethods",
"(",
")",
")",
"{",
"if",
"(",
"method",
".",
"isAnnotationPresent",
"(",
"BackendProperty",
".",
"class",
")",
")",
"{",
"try",
"{",
"BackendProperty",
"annotation",
"=",
"method",
".",
"getAnnotation",
"(",
"BackendProperty",
".",
"class",
")",
";",
"String",
"propertyName",
"=",
"propertyName",
"(",
"annotation",
",",
"method",
")",
";",
"Object",
"propertyValue",
"=",
"backendInstanceSpec",
".",
"getProperty",
"(",
"propertyName",
")",
";",
"if",
"(",
"propertyValue",
"!=",
"null",
")",
"{",
"method",
".",
"invoke",
"(",
"backend",
",",
"new",
"Object",
"[",
"]",
"{",
"propertyValue",
"}",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"InvalidPropertyNameException",
"|",
"InvocationTargetException",
"ex",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"ex",
")",
";",
"}",
"}",
"}",
"}"
] |
Sets the fields corresponding to the properties in the configuration.
@param backend a backend.
@param backendInstanceSpec a {@link BackendInstanceSpec}
|
[
"Sets",
"the",
"fields",
"corresponding",
"to",
"the",
"properties",
"in",
"the",
"configuration",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/backend/CommonsBackend.java#L52-L75
|
148,888
|
openbase/jul
|
pattern/launch/src/main/java/org/openbase/jul/pattern/launch/AbstractLauncher.java
|
AbstractLauncher.instantiateLaunchable
|
protected L instantiateLaunchable() throws CouldNotPerformException {
try {
return launchableClass.newInstance();
} catch (java.lang.InstantiationException | IllegalAccessException ex) {
throw new CouldNotPerformException("Could not load launchable class!", ex);
}
}
|
java
|
protected L instantiateLaunchable() throws CouldNotPerformException {
try {
return launchableClass.newInstance();
} catch (java.lang.InstantiationException | IllegalAccessException ex) {
throw new CouldNotPerformException("Could not load launchable class!", ex);
}
}
|
[
"protected",
"L",
"instantiateLaunchable",
"(",
")",
"throws",
"CouldNotPerformException",
"{",
"try",
"{",
"return",
"launchableClass",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"InstantiationException",
"|",
"IllegalAccessException",
"ex",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not load launchable class!\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Method creates a launchable instance without any arguments.. In case the launchable needs arguments you can overwrite this method and instantiate the launchable by ourself.
@return the new instantiated launchable.
@throws CouldNotPerformException is thrown in case the launchable could not properly be instantiated.
|
[
"Method",
"creates",
"a",
"launchable",
"instance",
"without",
"any",
"arguments",
"..",
"In",
"case",
"the",
"launchable",
"needs",
"arguments",
"you",
"can",
"overwrite",
"this",
"method",
"and",
"instantiate",
"the",
"launchable",
"by",
"ourself",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/launch/src/main/java/org/openbase/jul/pattern/launch/AbstractLauncher.java#L148-L154
|
148,889
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/dest/table/Link.java
|
Link.validate
|
void validate(KnowledgeSource knowledgeSource) throws
LinkValidationFailedException, KnowledgeSourceReadException {
List<String> invalidPropIds = new ArrayList<>();
List<PropositionDefinition> propDefs = knowledgeSource.readPropositionDefinitions(this.propIdsAsSet.toArray(new String[this.propIdsAsSet.size()]));
Set<String> foundPropIds = new HashSet<>();
for (PropositionDefinition propDef : propDefs) {
foundPropIds.add(propDef.getId());
}
for (String propId : this.propIdsAsSet) {
if (!foundPropIds.contains(propId)) {
invalidPropIds.add(propId);
}
}
if (!invalidPropIds.isEmpty()) {
throw new LinkValidationFailedException(
"Invalid proposition id(s): "
+ StringUtils.join(invalidPropIds, ", "));
}
}
|
java
|
void validate(KnowledgeSource knowledgeSource) throws
LinkValidationFailedException, KnowledgeSourceReadException {
List<String> invalidPropIds = new ArrayList<>();
List<PropositionDefinition> propDefs = knowledgeSource.readPropositionDefinitions(this.propIdsAsSet.toArray(new String[this.propIdsAsSet.size()]));
Set<String> foundPropIds = new HashSet<>();
for (PropositionDefinition propDef : propDefs) {
foundPropIds.add(propDef.getId());
}
for (String propId : this.propIdsAsSet) {
if (!foundPropIds.contains(propId)) {
invalidPropIds.add(propId);
}
}
if (!invalidPropIds.isEmpty()) {
throw new LinkValidationFailedException(
"Invalid proposition id(s): "
+ StringUtils.join(invalidPropIds, ", "));
}
}
|
[
"void",
"validate",
"(",
"KnowledgeSource",
"knowledgeSource",
")",
"throws",
"LinkValidationFailedException",
",",
"KnowledgeSourceReadException",
"{",
"List",
"<",
"String",
">",
"invalidPropIds",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"PropositionDefinition",
">",
"propDefs",
"=",
"knowledgeSource",
".",
"readPropositionDefinitions",
"(",
"this",
".",
"propIdsAsSet",
".",
"toArray",
"(",
"new",
"String",
"[",
"this",
".",
"propIdsAsSet",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"Set",
"<",
"String",
">",
"foundPropIds",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"PropositionDefinition",
"propDef",
":",
"propDefs",
")",
"{",
"foundPropIds",
".",
"add",
"(",
"propDef",
".",
"getId",
"(",
")",
")",
";",
"}",
"for",
"(",
"String",
"propId",
":",
"this",
".",
"propIdsAsSet",
")",
"{",
"if",
"(",
"!",
"foundPropIds",
".",
"contains",
"(",
"propId",
")",
")",
"{",
"invalidPropIds",
".",
"add",
"(",
"propId",
")",
";",
"}",
"}",
"if",
"(",
"!",
"invalidPropIds",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"LinkValidationFailedException",
"(",
"\"Invalid proposition id(s): \"",
"+",
"StringUtils",
".",
"join",
"(",
"invalidPropIds",
",",
"\", \"",
")",
")",
";",
"}",
"}"
] |
Validates the fields of this link specification against the knowledge
source.
@param knowledgeSource a {@link KnowledgeSource}. Guaranteed not
<code>null</code>.
@throws QueryResultsHandlerValidationFailedException if validation
failed.
@throws KnowledgeSourceReadException if the knowledge source could not be
read.
|
[
"Validates",
"the",
"fields",
"of",
"this",
"link",
"specification",
"against",
"the",
"knowledge",
"source",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/dest/table/Link.java#L202-L220
|
148,890
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/dest/table/Link.java
|
Link.createHeaderFragment
|
final String createHeaderFragment(String ref) {
int size = this.propIdsAsSet.size();
boolean sep1Needed = size > 0 && this.constraints.length > 0;
String sep1 = sep1Needed ? ", " : "";
String id = size > 0 ? "id=" : "";
boolean parenNeeded = size > 0 || this.constraints.length > 0;
String startParen = parenNeeded ? "(" : "";
String finishParen = parenNeeded ? ")" : "";
String range = rangeString();
boolean sep2Needed = sep1Needed && range.length() > 0;
String sep2 = sep2Needed ? ", " : "";
return '.' + ref + startParen + id
+ StringUtils.join(this.propIdsAsSet, ',') + sep1
+ constraintHeaderString(this.constraints) + finishParen + sep2
+ range;
}
|
java
|
final String createHeaderFragment(String ref) {
int size = this.propIdsAsSet.size();
boolean sep1Needed = size > 0 && this.constraints.length > 0;
String sep1 = sep1Needed ? ", " : "";
String id = size > 0 ? "id=" : "";
boolean parenNeeded = size > 0 || this.constraints.length > 0;
String startParen = parenNeeded ? "(" : "";
String finishParen = parenNeeded ? ")" : "";
String range = rangeString();
boolean sep2Needed = sep1Needed && range.length() > 0;
String sep2 = sep2Needed ? ", " : "";
return '.' + ref + startParen + id
+ StringUtils.join(this.propIdsAsSet, ',') + sep1
+ constraintHeaderString(this.constraints) + finishParen + sep2
+ range;
}
|
[
"final",
"String",
"createHeaderFragment",
"(",
"String",
"ref",
")",
"{",
"int",
"size",
"=",
"this",
".",
"propIdsAsSet",
".",
"size",
"(",
")",
";",
"boolean",
"sep1Needed",
"=",
"size",
">",
"0",
"&&",
"this",
".",
"constraints",
".",
"length",
">",
"0",
";",
"String",
"sep1",
"=",
"sep1Needed",
"?",
"\", \"",
":",
"\"\"",
";",
"String",
"id",
"=",
"size",
">",
"0",
"?",
"\"id=\"",
":",
"\"\"",
";",
"boolean",
"parenNeeded",
"=",
"size",
">",
"0",
"||",
"this",
".",
"constraints",
".",
"length",
">",
"0",
";",
"String",
"startParen",
"=",
"parenNeeded",
"?",
"\"(\"",
":",
"\"\"",
";",
"String",
"finishParen",
"=",
"parenNeeded",
"?",
"\")\"",
":",
"\"\"",
";",
"String",
"range",
"=",
"rangeString",
"(",
")",
";",
"boolean",
"sep2Needed",
"=",
"sep1Needed",
"&&",
"range",
".",
"length",
"(",
")",
">",
"0",
";",
"String",
"sep2",
"=",
"sep2Needed",
"?",
"\", \"",
":",
"\"\"",
";",
"return",
"'",
"'",
"+",
"ref",
"+",
"startParen",
"+",
"id",
"+",
"StringUtils",
".",
"join",
"(",
"this",
".",
"propIdsAsSet",
",",
"'",
"'",
")",
"+",
"sep1",
"+",
"constraintHeaderString",
"(",
"this",
".",
"constraints",
")",
"+",
"finishParen",
"+",
"sep2",
"+",
"range",
";",
"}"
] |
Returns the default header fragment for this link.
@param ref the name {@link String} of the reference of this link.
@return a header fragment {@link String}.
@see #headerFragment()
|
[
"Returns",
"the",
"default",
"header",
"fragment",
"for",
"this",
"link",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/dest/table/Link.java#L238-L256
|
148,891
|
openbase/jul
|
schedule/src/main/java/org/openbase/jul/schedule/Timeout.java
|
Timeout.restart
|
public void restart(final long waitTime) throws CouldNotPerformException {
logger.debug("Reset timer.");
try {
synchronized (lock) {
cancel();
start(waitTime);
}
} catch (ShutdownInProgressException ex) {
throw ex;
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not restart timer!", ex);
}
}
|
java
|
public void restart(final long waitTime) throws CouldNotPerformException {
logger.debug("Reset timer.");
try {
synchronized (lock) {
cancel();
start(waitTime);
}
} catch (ShutdownInProgressException ex) {
throw ex;
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not restart timer!", ex);
}
}
|
[
"public",
"void",
"restart",
"(",
"final",
"long",
"waitTime",
")",
"throws",
"CouldNotPerformException",
"{",
"logger",
".",
"debug",
"(",
"\"Reset timer.\"",
")",
";",
"try",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"cancel",
"(",
")",
";",
"start",
"(",
"waitTime",
")",
";",
"}",
"}",
"catch",
"(",
"ShutdownInProgressException",
"ex",
")",
"{",
"throw",
"ex",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not restart timer!\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Method restarts the timeout.
@param waitTime the new wait time to update.
@throws CouldNotPerformException is thrown in case the timeout could not be restarted.
@throws ShutdownInProgressException is thrown in case the the system is currently shutting down.
|
[
"Method",
"restarts",
"the",
"timeout",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/Timeout.java#L86-L98
|
148,892
|
openbase/jul
|
schedule/src/main/java/org/openbase/jul/schedule/Timeout.java
|
Timeout.start
|
public void start(final long waitTime) throws CouldNotPerformException {
try {
internal_start(waitTime);
} catch (CouldNotPerformException | RejectedExecutionException ex) {
if (ex instanceof RejectedExecutionException && GlobalScheduledExecutorService.getInstance().getExecutorService().isShutdown()) {
throw new ShutdownInProgressException("GlobalScheduledExecutorService");
}
throw new CouldNotPerformException("Could not start " + this, ex);
}
}
|
java
|
public void start(final long waitTime) throws CouldNotPerformException {
try {
internal_start(waitTime);
} catch (CouldNotPerformException | RejectedExecutionException ex) {
if (ex instanceof RejectedExecutionException && GlobalScheduledExecutorService.getInstance().getExecutorService().isShutdown()) {
throw new ShutdownInProgressException("GlobalScheduledExecutorService");
}
throw new CouldNotPerformException("Could not start " + this, ex);
}
}
|
[
"public",
"void",
"start",
"(",
"final",
"long",
"waitTime",
")",
"throws",
"CouldNotPerformException",
"{",
"try",
"{",
"internal_start",
"(",
"waitTime",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"|",
"RejectedExecutionException",
"ex",
")",
"{",
"if",
"(",
"ex",
"instanceof",
"RejectedExecutionException",
"&&",
"GlobalScheduledExecutorService",
".",
"getInstance",
"(",
")",
".",
"getExecutorService",
"(",
")",
".",
"isShutdown",
"(",
")",
")",
"{",
"throw",
"new",
"ShutdownInProgressException",
"(",
"\"GlobalScheduledExecutorService\"",
")",
";",
"}",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not start \"",
"+",
"this",
",",
"ex",
")",
";",
"}",
"}"
] |
Start the timeout with the given wait time. The default wait time is not modified and still the same as before.
@param waitTime The time to wait until the timeout is reached.
@throws CouldNotPerformException is thrown in case the timeout could not be started.
@throws ShutdownInProgressException is thrown in case the the system is currently shutting down.
|
[
"Start",
"the",
"timeout",
"with",
"the",
"given",
"wait",
"time",
".",
"The",
"default",
"wait",
"time",
"is",
"not",
"modified",
"and",
"still",
"the",
"same",
"as",
"before",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/Timeout.java#L148-L157
|
148,893
|
openbase/jul
|
schedule/src/main/java/org/openbase/jul/schedule/Timeout.java
|
Timeout.internal_start
|
private void internal_start(final long waitTime) throws RejectedExecutionException, CouldNotPerformException {
synchronized (lock) {
if (isActive()) {
logger.debug("Reject start, not interrupted or expired.");
return;
}
expired = false;
timerTask = GlobalScheduledExecutorService.schedule((Callable<Void>) () -> {
synchronized (lock) {
try {
logger.debug("Wait for timeout TimeOut interrupted.");
if (timerTask.isCancelled()) {
logger.debug("TimeOut was canceled.");
return null;
}
logger.debug("Expire...");
expired = true;
} finally {
timerTask = null;
}
}
try {
expired();
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Error during timeout handling!", ex), logger, LogLevel.WARN);
}
logger.debug("Worker finished.");
return null;
}, waitTime, TimeUnit.MILLISECONDS);
}
}
|
java
|
private void internal_start(final long waitTime) throws RejectedExecutionException, CouldNotPerformException {
synchronized (lock) {
if (isActive()) {
logger.debug("Reject start, not interrupted or expired.");
return;
}
expired = false;
timerTask = GlobalScheduledExecutorService.schedule((Callable<Void>) () -> {
synchronized (lock) {
try {
logger.debug("Wait for timeout TimeOut interrupted.");
if (timerTask.isCancelled()) {
logger.debug("TimeOut was canceled.");
return null;
}
logger.debug("Expire...");
expired = true;
} finally {
timerTask = null;
}
}
try {
expired();
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Error during timeout handling!", ex), logger, LogLevel.WARN);
}
logger.debug("Worker finished.");
return null;
}, waitTime, TimeUnit.MILLISECONDS);
}
}
|
[
"private",
"void",
"internal_start",
"(",
"final",
"long",
"waitTime",
")",
"throws",
"RejectedExecutionException",
",",
"CouldNotPerformException",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Reject start, not interrupted or expired.\"",
")",
";",
"return",
";",
"}",
"expired",
"=",
"false",
";",
"timerTask",
"=",
"GlobalScheduledExecutorService",
".",
"schedule",
"(",
"(",
"Callable",
"<",
"Void",
">",
")",
"(",
")",
"->",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"try",
"{",
"logger",
".",
"debug",
"(",
"\"Wait for timeout TimeOut interrupted.\"",
")",
";",
"if",
"(",
"timerTask",
".",
"isCancelled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"TimeOut was canceled.\"",
")",
";",
"return",
"null",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Expire...\"",
")",
";",
"expired",
"=",
"true",
";",
"}",
"finally",
"{",
"timerTask",
"=",
"null",
";",
"}",
"}",
"try",
"{",
"expired",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ExceptionPrinter",
".",
"printHistory",
"(",
"new",
"CouldNotPerformException",
"(",
"\"Error during timeout handling!\"",
",",
"ex",
")",
",",
"logger",
",",
"LogLevel",
".",
"WARN",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Worker finished.\"",
")",
";",
"return",
"null",
";",
"}",
",",
"waitTime",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",
"}"
] |
Internal synchronized start method.
@param waitTime The time to wait until the timeout is reached.
@throws RejectedExecutionException is thrown if the timeout task could not be scheduled.
@throws CouldNotPerformException is thrown in case the timeout could not be started.
|
[
"Internal",
"synchronized",
"start",
"method",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/Timeout.java#L167-L198
|
148,894
|
jboss/jboss-common-beans
|
src/main/java/org/jboss/common/beans/property/DOMWriter.java
|
DOMWriter.sortAttributes
|
private Attr[] sortAttributes(NamedNodeMap attrs) {
int len = (attrs != null) ? attrs.getLength() : 0;
Attr[] array = new Attr[len];
for (int i = 0; i < len; i++) {
array[i] = (Attr) attrs.item(i);
}
for (int i = 0; i < len - 1; i++) {
String name = array[i].getNodeName();
int index = i;
for (int j = i + 1; j < len; j++) {
String curName = array[j].getNodeName();
if (curName.compareTo(name) < 0) {
name = curName;
index = j;
}
}
if (index != i) {
Attr temp = array[i];
array[i] = array[index];
array[index] = temp;
}
}
return (array);
}
|
java
|
private Attr[] sortAttributes(NamedNodeMap attrs) {
int len = (attrs != null) ? attrs.getLength() : 0;
Attr[] array = new Attr[len];
for (int i = 0; i < len; i++) {
array[i] = (Attr) attrs.item(i);
}
for (int i = 0; i < len - 1; i++) {
String name = array[i].getNodeName();
int index = i;
for (int j = i + 1; j < len; j++) {
String curName = array[j].getNodeName();
if (curName.compareTo(name) < 0) {
name = curName;
index = j;
}
}
if (index != i) {
Attr temp = array[i];
array[i] = array[index];
array[index] = temp;
}
}
return (array);
}
|
[
"private",
"Attr",
"[",
"]",
"sortAttributes",
"(",
"NamedNodeMap",
"attrs",
")",
"{",
"int",
"len",
"=",
"(",
"attrs",
"!=",
"null",
")",
"?",
"attrs",
".",
"getLength",
"(",
")",
":",
"0",
";",
"Attr",
"[",
"]",
"array",
"=",
"new",
"Attr",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"array",
"[",
"i",
"]",
"=",
"(",
"Attr",
")",
"attrs",
".",
"item",
"(",
"i",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
"-",
"1",
";",
"i",
"++",
")",
"{",
"String",
"name",
"=",
"array",
"[",
"i",
"]",
".",
"getNodeName",
"(",
")",
";",
"int",
"index",
"=",
"i",
";",
"for",
"(",
"int",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"len",
";",
"j",
"++",
")",
"{",
"String",
"curName",
"=",
"array",
"[",
"j",
"]",
".",
"getNodeName",
"(",
")",
";",
"if",
"(",
"curName",
".",
"compareTo",
"(",
"name",
")",
"<",
"0",
")",
"{",
"name",
"=",
"curName",
";",
"index",
"=",
"j",
";",
"}",
"}",
"if",
"(",
"index",
"!=",
"i",
")",
"{",
"Attr",
"temp",
"=",
"array",
"[",
"i",
"]",
";",
"array",
"[",
"i",
"]",
"=",
"array",
"[",
"index",
"]",
";",
"array",
"[",
"index",
"]",
"=",
"temp",
";",
"}",
"}",
"return",
"(",
"array",
")",
";",
"}"
] |
Returns a sorted list of attributes.
|
[
"Returns",
"a",
"sorted",
"list",
"of",
"attributes",
"."
] |
ffb48b1719762534bf92d762eadf91d1815f6748
|
https://github.com/jboss/jboss-common-beans/blob/ffb48b1719762534bf92d762eadf91d1815f6748/src/main/java/org/jboss/common/beans/property/DOMWriter.java#L465-L489
|
148,895
|
openbase/jul
|
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableController.java
|
AbstractConfigurableController.init
|
@Override
public void init(final CONFIG config) throws InitializationException, InterruptedException {
try {
try(final CloseableWriteLockWrapper ignored = getManageWriteLock(this)) {
if (config == null) {
throw new NotAvailableException("config");
}
currentScope = detectScope(config);
applyConfigUpdate(config);
}
super.init(currentScope);
} catch (CouldNotPerformException ex) {
throw new InitializationException(this, ex);
}
}
|
java
|
@Override
public void init(final CONFIG config) throws InitializationException, InterruptedException {
try {
try(final CloseableWriteLockWrapper ignored = getManageWriteLock(this)) {
if (config == null) {
throw new NotAvailableException("config");
}
currentScope = detectScope(config);
applyConfigUpdate(config);
}
super.init(currentScope);
} catch (CouldNotPerformException ex) {
throw new InitializationException(this, ex);
}
}
|
[
"@",
"Override",
"public",
"void",
"init",
"(",
"final",
"CONFIG",
"config",
")",
"throws",
"InitializationException",
",",
"InterruptedException",
"{",
"try",
"{",
"try",
"(",
"final",
"CloseableWriteLockWrapper",
"ignored",
"=",
"getManageWriteLock",
"(",
"this",
")",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"throw",
"new",
"NotAvailableException",
"(",
"\"config\"",
")",
";",
"}",
"currentScope",
"=",
"detectScope",
"(",
"config",
")",
";",
"applyConfigUpdate",
"(",
"config",
")",
";",
"}",
"super",
".",
"init",
"(",
"currentScope",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"throw",
"new",
"InitializationException",
"(",
"this",
",",
"ex",
")",
";",
"}",
"}"
] |
Initialize the controller with a configuration.
@param config the configuration
@throws InitializationException if the initialization fails
@throws java.lang.InterruptedException if the initialization is interrupted
|
[
"Initialize",
"the",
"controller",
"with",
"a",
"configuration",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableController.java#L66-L80
|
148,896
|
openbase/jul
|
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableController.java
|
AbstractConfigurableController.applyConfigUpdate
|
@Override
public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException {
try {
boolean scopeChanged;
try(final CloseableWriteLockWrapper ignored = getManageWriteLock(this)) {
this.config = config;
if (supportsDataField(TYPE_FIELD_ID) && hasConfigField(TYPE_FIELD_ID)) {
setDataField(TYPE_FIELD_ID, getConfigField(TYPE_FIELD_ID));
}
if (supportsDataField(TYPE_FIELD_LABEL) && hasConfigField(TYPE_FIELD_LABEL)) {
setDataField(TYPE_FIELD_LABEL, getConfigField(TYPE_FIELD_LABEL));
}
scopeChanged = !currentScope.equals(detectScope(config));
currentScope = detectScope();
}
// detect scope change if instance is already active and reinit if needed.
// this needs to be done without holding the config lock to avoid a deadlock with the server manageable lock.
try {
if (isActive() && scopeChanged) {
super.init(currentScope);
}
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not verify scope changes!", ex);
}
return this.config;
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not apply config update!", ex);
}
}
|
java
|
@Override
public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException {
try {
boolean scopeChanged;
try(final CloseableWriteLockWrapper ignored = getManageWriteLock(this)) {
this.config = config;
if (supportsDataField(TYPE_FIELD_ID) && hasConfigField(TYPE_FIELD_ID)) {
setDataField(TYPE_FIELD_ID, getConfigField(TYPE_FIELD_ID));
}
if (supportsDataField(TYPE_FIELD_LABEL) && hasConfigField(TYPE_FIELD_LABEL)) {
setDataField(TYPE_FIELD_LABEL, getConfigField(TYPE_FIELD_LABEL));
}
scopeChanged = !currentScope.equals(detectScope(config));
currentScope = detectScope();
}
// detect scope change if instance is already active and reinit if needed.
// this needs to be done without holding the config lock to avoid a deadlock with the server manageable lock.
try {
if (isActive() && scopeChanged) {
super.init(currentScope);
}
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not verify scope changes!", ex);
}
return this.config;
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not apply config update!", ex);
}
}
|
[
"@",
"Override",
"public",
"CONFIG",
"applyConfigUpdate",
"(",
"final",
"CONFIG",
"config",
")",
"throws",
"CouldNotPerformException",
",",
"InterruptedException",
"{",
"try",
"{",
"boolean",
"scopeChanged",
";",
"try",
"(",
"final",
"CloseableWriteLockWrapper",
"ignored",
"=",
"getManageWriteLock",
"(",
"this",
")",
")",
"{",
"this",
".",
"config",
"=",
"config",
";",
"if",
"(",
"supportsDataField",
"(",
"TYPE_FIELD_ID",
")",
"&&",
"hasConfigField",
"(",
"TYPE_FIELD_ID",
")",
")",
"{",
"setDataField",
"(",
"TYPE_FIELD_ID",
",",
"getConfigField",
"(",
"TYPE_FIELD_ID",
")",
")",
";",
"}",
"if",
"(",
"supportsDataField",
"(",
"TYPE_FIELD_LABEL",
")",
"&&",
"hasConfigField",
"(",
"TYPE_FIELD_LABEL",
")",
")",
"{",
"setDataField",
"(",
"TYPE_FIELD_LABEL",
",",
"getConfigField",
"(",
"TYPE_FIELD_LABEL",
")",
")",
";",
"}",
"scopeChanged",
"=",
"!",
"currentScope",
".",
"equals",
"(",
"detectScope",
"(",
"config",
")",
")",
";",
"currentScope",
"=",
"detectScope",
"(",
")",
";",
"}",
"// detect scope change if instance is already active and reinit if needed.",
"// this needs to be done without holding the config lock to avoid a deadlock with the server manageable lock.",
"try",
"{",
"if",
"(",
"isActive",
"(",
")",
"&&",
"scopeChanged",
")",
"{",
"super",
".",
"init",
"(",
"currentScope",
")",
";",
"}",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not verify scope changes!\"",
",",
"ex",
")",
";",
"}",
"return",
"this",
".",
"config",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not apply config update!\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Apply an update to the configuration of this controller.
@param config the updated configuration
@return the updated configuration
@throws CouldNotPerformException if the update could not be performed
@throws InterruptedException if the update has been interrupted
|
[
"Apply",
"an",
"update",
"to",
"the",
"configuration",
"of",
"this",
"controller",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableController.java#L92-L125
|
148,897
|
foundation-runtime/configuration
|
configuration-lib/src/main/java/com/cisco/oss/foundation/configuration/InfraPropertyPlaceholderConfigurer.java
|
InfraPropertyPlaceholderConfigurer.resolvePlaceholder
|
@Override
protected String resolvePlaceholder(String placeholder, Properties props) {
String resolvedPlaceholder = super.resolvePlaceholder(placeholder, props);
if (null == resolvedPlaceholder) {
LOGGER.trace("could not resolve place holder for key: " + placeholder + ". Please check your configuration files.");
return resolvedPlaceholder;
} else {
return resolvedPlaceholder.trim();
}
}
|
java
|
@Override
protected String resolvePlaceholder(String placeholder, Properties props) {
String resolvedPlaceholder = super.resolvePlaceholder(placeholder, props);
if (null == resolvedPlaceholder) {
LOGGER.trace("could not resolve place holder for key: " + placeholder + ". Please check your configuration files.");
return resolvedPlaceholder;
} else {
return resolvedPlaceholder.trim();
}
}
|
[
"@",
"Override",
"protected",
"String",
"resolvePlaceholder",
"(",
"String",
"placeholder",
",",
"Properties",
"props",
")",
"{",
"String",
"resolvedPlaceholder",
"=",
"super",
".",
"resolvePlaceholder",
"(",
"placeholder",
",",
"props",
")",
";",
"if",
"(",
"null",
"==",
"resolvedPlaceholder",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"could not resolve place holder for key: \"",
"+",
"placeholder",
"+",
"\". Please check your configuration files.\"",
")",
";",
"return",
"resolvedPlaceholder",
";",
"}",
"else",
"{",
"return",
"resolvedPlaceholder",
".",
"trim",
"(",
")",
";",
"}",
"}"
] |
trim the string value before it is returned to the caller method.
@see org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#resolvePlaceholder(String, java.util.Properties)
|
[
"trim",
"the",
"string",
"value",
"before",
"it",
"is",
"returned",
"to",
"the",
"caller",
"method",
"."
] |
c5bd171a2cca0dc1c8d568f987843ca47c6d1eed
|
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-lib/src/main/java/com/cisco/oss/foundation/configuration/InfraPropertyPlaceholderConfigurer.java#L42-L52
|
148,898
|
dmfs/xmlobjects
|
src/org/dmfs/xmlobjects/pull/ParserContext.java
|
ParserContext.getDepthStateMap
|
private Map<ElementDescriptor<?>, Object> getDepthStateMap(int depth, boolean create)
{
if (mState == null)
{
mState = new ArrayList<Map<ElementDescriptor<?>, Object>>(Math.max(16, depth + 8));
}
// fill array list with null values up to the current depth
while (depth > mState.size())
{
mState.add(null);
}
Map<ElementDescriptor<?>, Object> map = mState.get(depth - 1 /* depth is at least 1 */);
if (!create || map != null)
{
return map;
}
// map is null and we shall create it
map = new HashMap<ElementDescriptor<?>, Object>(8);
mState.set(depth - 1, map);
return map;
}
|
java
|
private Map<ElementDescriptor<?>, Object> getDepthStateMap(int depth, boolean create)
{
if (mState == null)
{
mState = new ArrayList<Map<ElementDescriptor<?>, Object>>(Math.max(16, depth + 8));
}
// fill array list with null values up to the current depth
while (depth > mState.size())
{
mState.add(null);
}
Map<ElementDescriptor<?>, Object> map = mState.get(depth - 1 /* depth is at least 1 */);
if (!create || map != null)
{
return map;
}
// map is null and we shall create it
map = new HashMap<ElementDescriptor<?>, Object>(8);
mState.set(depth - 1, map);
return map;
}
|
[
"private",
"Map",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Object",
">",
"getDepthStateMap",
"(",
"int",
"depth",
",",
"boolean",
"create",
")",
"{",
"if",
"(",
"mState",
"==",
"null",
")",
"{",
"mState",
"=",
"new",
"ArrayList",
"<",
"Map",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Object",
">",
">",
"(",
"Math",
".",
"max",
"(",
"16",
",",
"depth",
"+",
"8",
")",
")",
";",
"}",
"// fill array list with null values up to the current depth",
"while",
"(",
"depth",
">",
"mState",
".",
"size",
"(",
")",
")",
"{",
"mState",
".",
"add",
"(",
"null",
")",
";",
"}",
"Map",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Object",
">",
"map",
"=",
"mState",
".",
"get",
"(",
"depth",
"-",
"1",
"/* depth is at least 1 */",
")",
";",
"if",
"(",
"!",
"create",
"||",
"map",
"!=",
"null",
")",
"{",
"return",
"map",
";",
"}",
"// map is null and we shall create it",
"map",
"=",
"new",
"HashMap",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Object",
">",
"(",
"8",
")",
";",
"mState",
".",
"set",
"(",
"depth",
"-",
"1",
",",
"map",
")",
";",
"return",
"map",
";",
"}"
] |
Return the element state map for the given depth, creating non-existing maps if required.
@param depth
The depth for which to retrieve the state map.
@param create
<code>true</code> to create a new map if it doesn't exist.
@return
|
[
"Return",
"the",
"element",
"state",
"map",
"for",
"the",
"given",
"depth",
"creating",
"non",
"-",
"existing",
"maps",
"if",
"required",
"."
] |
b68ddd0ce994d804fc2ec6da1096bf0d883b37f9
|
https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/ParserContext.java#L170-L194
|
148,899
|
hypfvieh/java-utils
|
src/main/java/com/github/hypfvieh/classloader/ClassLoaderWithRegistry.java
|
ClassLoaderWithRegistry.addIncludedPackageNames
|
public void addIncludedPackageNames(String _packageName) {
if (_packageName.endsWith(".")) {
includePackageNames.add(_packageName);
ComponentRegistry.getInstance().addPackageToIncludeList(_packageName);
}
}
|
java
|
public void addIncludedPackageNames(String _packageName) {
if (_packageName.endsWith(".")) {
includePackageNames.add(_packageName);
ComponentRegistry.getInstance().addPackageToIncludeList(_packageName);
}
}
|
[
"public",
"void",
"addIncludedPackageNames",
"(",
"String",
"_packageName",
")",
"{",
"if",
"(",
"_packageName",
".",
"endsWith",
"(",
"\".\"",
")",
")",
"{",
"includePackageNames",
".",
"add",
"(",
"_packageName",
")",
";",
"ComponentRegistry",
".",
"getInstance",
"(",
")",
".",
"addPackageToIncludeList",
"(",
"_packageName",
")",
";",
"}",
"}"
] |
Add a package name which should be loaded with this classloader.
@param _packageName name of the package, has to end with '.'
|
[
"Add",
"a",
"package",
"name",
"which",
"should",
"be",
"loaded",
"with",
"this",
"classloader",
"."
] |
407c32d6b485596d4d2b644f5f7fc7a02d0169c6
|
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/classloader/ClassLoaderWithRegistry.java#L52-L57
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.