repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sachin-handiekar/jMusixMatch | src/main/java/org/jmusixmatch/Helper.java | Helper.getURLString | public static String getURLString(String methodName,
Map<String, Object> params) throws MusixMatchException {
String paramString = new String();
paramString += methodName + "?";
for (Map.Entry<String, Object> entry : params.entrySet()) {
try {
paramString += entry.getKey()
+ "="
+ URLEncod... | java | public static String getURLString(String methodName,
Map<String, Object> params) throws MusixMatchException {
String paramString = new String();
paramString += methodName + "?";
for (Map.Entry<String, Object> entry : params.entrySet()) {
try {
paramString += entry.getKey()
+ "="
+ URLEncod... | [
"public",
"static",
"String",
"getURLString",
"(",
"String",
"methodName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"MusixMatchException",
"{",
"String",
"paramString",
"=",
"new",
"String",
"(",
")",
";",
"paramString",
"+=",
... | This method is used to get a parameter string from the Map.
@param params
key-value parameters
@return A String containing the url parameter.
@throws MusixMatchException | [
"This",
"method",
"is",
"used",
"to",
"get",
"a",
"parameter",
"string",
"from",
"the",
"Map",
"."
] | da909f7732053a801ea7282fe9a8bce385fa3763 | https://github.com/sachin-handiekar/jMusixMatch/blob/da909f7732053a801ea7282fe9a8bce385fa3763/src/main/java/org/jmusixmatch/Helper.java#L31-L54 | train |
samtingleff/jchronic | src/main/java/com/mdimension/jchronic/Chronic.java | Chronic.baseTokenize | protected static List<Token> baseTokenize(String text) {
String[] words = text.split(" ");
List<Token> tokens = new LinkedList<Token>();
for (String word : words) {
tokens.add(new Token(word));
}
return tokens;
} | java | protected static List<Token> baseTokenize(String text) {
String[] words = text.split(" ");
List<Token> tokens = new LinkedList<Token>();
for (String word : words) {
tokens.add(new Token(word));
}
return tokens;
} | [
"protected",
"static",
"List",
"<",
"Token",
">",
"baseTokenize",
"(",
"String",
"text",
")",
"{",
"String",
"[",
"]",
"words",
"=",
"text",
".",
"split",
"(",
"\" \"",
")",
";",
"List",
"<",
"Token",
">",
"tokens",
"=",
"new",
"LinkedList",
"<",
"To... | Split the text on spaces and convert each word into
a Token | [
"Split",
"the",
"text",
"on",
"spaces",
"and",
"convert",
"each",
"word",
"into",
"a",
"Token"
] | b66bd2815eda3e79adefa2642f8ccf6b4b7586ce | https://github.com/samtingleff/jchronic/blob/b66bd2815eda3e79adefa2642f8ccf6b4b7586ce/src/main/java/com/mdimension/jchronic/Chronic.java#L176-L183 | train |
samtingleff/jchronic | src/main/java/com/mdimension/jchronic/handlers/Handler.java | Handler.findWithin | public static Span findWithin(List<Repeater<?>> tags, Span span, Pointer.PointerType pointer, Options options) {
if (options.isDebug()) {
System.out.println("Chronic.findWithin: " + tags + " in " + span);
}
if (tags.isEmpty()) {
return span;
}
Repeater<?> head = tags.get(0);
List<Rep... | java | public static Span findWithin(List<Repeater<?>> tags, Span span, Pointer.PointerType pointer, Options options) {
if (options.isDebug()) {
System.out.println("Chronic.findWithin: " + tags + " in " + span);
}
if (tags.isEmpty()) {
return span;
}
Repeater<?> head = tags.get(0);
List<Rep... | [
"public",
"static",
"Span",
"findWithin",
"(",
"List",
"<",
"Repeater",
"<",
"?",
">",
">",
"tags",
",",
"Span",
"span",
",",
"Pointer",
".",
"PointerType",
"pointer",
",",
"Options",
"options",
")",
"{",
"if",
"(",
"options",
".",
"isDebug",
"(",
")",... | Recursively finds repeaters within other repeaters.
Returns a Span representing the innermost time span
or nil if no repeater union could be found | [
"Recursively",
"finds",
"repeaters",
"within",
"other",
"repeaters",
".",
"Returns",
"a",
"Span",
"representing",
"the",
"innermost",
"time",
"span",
"or",
"nil",
"if",
"no",
"repeater",
"union",
"could",
"be",
"found"
] | b66bd2815eda3e79adefa2642f8ccf6b4b7586ce | https://github.com/samtingleff/jchronic/blob/b66bd2815eda3e79adefa2642f8ccf6b4b7586ce/src/main/java/com/mdimension/jchronic/handlers/Handler.java#L346-L362 | train |
samtingleff/jchronic | src/main/java/com/mdimension/jchronic/utils/Token.java | Token.untag | public void untag(Class<?> tagClass) {
Iterator<Tag<?>> tagIter = _tags.iterator();
while (tagIter.hasNext()) {
Tag<?> tag = tagIter.next();
if (tagClass.isInstance(tag)) {
tagIter.remove();
}
}
} | java | public void untag(Class<?> tagClass) {
Iterator<Tag<?>> tagIter = _tags.iterator();
while (tagIter.hasNext()) {
Tag<?> tag = tagIter.next();
if (tagClass.isInstance(tag)) {
tagIter.remove();
}
}
} | [
"public",
"void",
"untag",
"(",
"Class",
"<",
"?",
">",
"tagClass",
")",
"{",
"Iterator",
"<",
"Tag",
"<",
"?",
">",
">",
"tagIter",
"=",
"_tags",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"tagIter",
".",
"hasNext",
"(",
")",
")",
"{",
"Tag",... | Remove all tags of the given class | [
"Remove",
"all",
"tags",
"of",
"the",
"given",
"class"
] | b66bd2815eda3e79adefa2642f8ccf6b4b7586ce | https://github.com/samtingleff/jchronic/blob/b66bd2815eda3e79adefa2642f8ccf6b4b7586ce/src/main/java/com/mdimension/jchronic/utils/Token.java#L32-L40 | train |
samtingleff/jchronic | src/main/java/com/mdimension/jchronic/repeaters/Repeater.java | Repeater.nextSpan | public Span nextSpan(Pointer.PointerType pointer) {
if (getNow() == null) {
throw new IllegalStateException("Start point must be set before calling #next");
}
return _nextSpan(pointer);
} | java | public Span nextSpan(Pointer.PointerType pointer) {
if (getNow() == null) {
throw new IllegalStateException("Start point must be set before calling #next");
}
return _nextSpan(pointer);
} | [
"public",
"Span",
"nextSpan",
"(",
"Pointer",
".",
"PointerType",
"pointer",
")",
"{",
"if",
"(",
"getNow",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Start point must be set before calling #next\"",
")",
";",
"}",
"return... | returns the next occurance of this repeatable. | [
"returns",
"the",
"next",
"occurance",
"of",
"this",
"repeatable",
"."
] | b66bd2815eda3e79adefa2642f8ccf6b4b7586ce | https://github.com/samtingleff/jchronic/blob/b66bd2815eda3e79adefa2642f8ccf6b4b7586ce/src/main/java/com/mdimension/jchronic/repeaters/Repeater.java#L59-L64 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/TreeNode.java | TreeNode.balanceOut | private TreeNode<T> balanceOut(){
int balance = height(left) - height(right);
if (balance < -1){
// The tree is right-heavy.
if (height(right.left) > height(right.right)){
this.right = this.right.rightRotate();
return leftRotate();
} else{
return leftRotate();
}
} else if (balance > 1){
... | java | private TreeNode<T> balanceOut(){
int balance = height(left) - height(right);
if (balance < -1){
// The tree is right-heavy.
if (height(right.left) > height(right.right)){
this.right = this.right.rightRotate();
return leftRotate();
} else{
return leftRotate();
}
} else if (balance > 1){
... | [
"private",
"TreeNode",
"<",
"T",
">",
"balanceOut",
"(",
")",
"{",
"int",
"balance",
"=",
"height",
"(",
"left",
")",
"-",
"height",
"(",
"right",
")",
";",
"if",
"(",
"balance",
"<",
"-",
"1",
")",
"{",
"// The tree is right-heavy.",
"if",
"(",
"hei... | Checks if the subtree rooted at the current node is balanced and balances it
if necessary.
@return The new root of the subtree, after the balancing operation has been
performed. It may return a {@code null} value, if the balancing has been
triggered by a {@link #removeInterval(IntervalTree, TreeNode, Interval)} operat... | [
"Checks",
"if",
"the",
"subtree",
"rooted",
"at",
"the",
"current",
"node",
"is",
"balanced",
"and",
"balances",
"it",
"if",
"necessary",
"."
] | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/TreeNode.java#L193-L214 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/TreeNode.java | TreeNode.assimilateOverlappingIntervals | private TreeNode<T> assimilateOverlappingIntervals(TreeNode<T> from) {
ArrayList<Interval<T>> tmp = new ArrayList<>();
if (midpoint.compareTo(from.midpoint) < 0){
for (Interval<T> next: from.increasing){
if (next.isRightOf(midpoint))
break;
tmp.add(next);
}
} else {
for (Interval<T> next: f... | java | private TreeNode<T> assimilateOverlappingIntervals(TreeNode<T> from) {
ArrayList<Interval<T>> tmp = new ArrayList<>();
if (midpoint.compareTo(from.midpoint) < 0){
for (Interval<T> next: from.increasing){
if (next.isRightOf(midpoint))
break;
tmp.add(next);
}
} else {
for (Interval<T> next: f... | [
"private",
"TreeNode",
"<",
"T",
">",
"assimilateOverlappingIntervals",
"(",
"TreeNode",
"<",
"T",
">",
"from",
")",
"{",
"ArrayList",
"<",
"Interval",
"<",
"T",
">>",
"tmp",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"midpoint",
".",
"co... | Transfers all intervals from a target node to the current node, if they
intersect the middlepoint of the current node. After this operation, it
is possible that the target node remains empty. If so, it needs to be
deleted, possible causing the subtree to be rebalanced.
@param from The target node, from which intervals... | [
"Transfers",
"all",
"intervals",
"from",
"a",
"target",
"node",
"to",
"the",
"current",
"node",
"if",
"they",
"intersect",
"the",
"middlepoint",
"of",
"the",
"current",
"node",
".",
"After",
"this",
"operation",
"it",
"is",
"possible",
"that",
"the",
"target... | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/TreeNode.java#L261-L286 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/TreeNode.java | TreeNode.deleteNode | private static <T extends Comparable<? super T>> TreeNode<T> deleteNode(TreeNode<T> root) {
if (root.left == null && root.right == null)
return null;
if (root.left == null){
// If the left child is empty, then the right subtree can consist of at most
// one node, otherwise it would have been unbalanced. S... | java | private static <T extends Comparable<? super T>> TreeNode<T> deleteNode(TreeNode<T> root) {
if (root.left == null && root.right == null)
return null;
if (root.left == null){
// If the left child is empty, then the right subtree can consist of at most
// one node, otherwise it would have been unbalanced. S... | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"TreeNode",
"<",
"T",
">",
"deleteNode",
"(",
"TreeNode",
"<",
"T",
">",
"root",
")",
"{",
"if",
"(",
"root",
".",
"left",
"==",
"null",
"&&",
"root",
".",
... | Deletes a node from the tree. The caller of this method needs to check, if the
node is actually empty, because this method only performs the deletion.
@param root The node that needs to be deleted.
@param <T> The type of the start and end points of the intervals.
@return The new root of the subtree rooted at the node ... | [
"Deletes",
"a",
"node",
"from",
"the",
"tree",
".",
"The",
"caller",
"of",
"this",
"method",
"needs",
"to",
"check",
"if",
"the",
"node",
"is",
"actually",
"empty",
"because",
"this",
"method",
"only",
"performs",
"the",
"deletion",
"."
] | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/TreeNode.java#L367-L399 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/TreeNode.java | TreeNode.rangeQueryLeft | static <T extends Comparable<? super T>> void rangeQueryLeft(TreeNode<T> node, Interval<T> query, Set<Interval<T>> result) {
while (node != null) {
if (query.contains(node.midpoint)) {
result.addAll(node.increasing);
if (node.right != null) {
for (Interval<T> next : node.right)
result.add(next);... | java | static <T extends Comparable<? super T>> void rangeQueryLeft(TreeNode<T> node, Interval<T> query, Set<Interval<T>> result) {
while (node != null) {
if (query.contains(node.midpoint)) {
result.addAll(node.increasing);
if (node.right != null) {
for (Interval<T> next : node.right)
result.add(next);... | [
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"rangeQueryLeft",
"(",
"TreeNode",
"<",
"T",
">",
"node",
",",
"Interval",
"<",
"T",
">",
"query",
",",
"Set",
"<",
"Interval",
"<",
"T",
">",
">",
"result",
")"... | A helper method for the range search used in the interval intersection query in the tree.
This corresponds to the left branch of the range search, once we find a node, whose
midpoint is contained in the query interval. All intervals in the left subtree of that node
are guaranteed to intersect with the query, if they ha... | [
"A",
"helper",
"method",
"for",
"the",
"range",
"search",
"used",
"in",
"the",
"interval",
"intersection",
"query",
"in",
"the",
"tree",
".",
"This",
"corresponds",
"to",
"the",
"left",
"branch",
"of",
"the",
"range",
"search",
"once",
"we",
"find",
"a",
... | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/TreeNode.java#L413-L431 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/TreeNode.java | TreeNode.rangeQueryRight | static <T extends Comparable<? super T>> void rangeQueryRight(TreeNode<T> node, Interval<T> query, Set<Interval<T>> result) {
while (node != null) {
if (query.contains(node.midpoint)) {
result.addAll(node.increasing);
if (node.left != null) {
for (Interval<T> next : node.left)
result.add(next);
... | java | static <T extends Comparable<? super T>> void rangeQueryRight(TreeNode<T> node, Interval<T> query, Set<Interval<T>> result) {
while (node != null) {
if (query.contains(node.midpoint)) {
result.addAll(node.increasing);
if (node.left != null) {
for (Interval<T> next : node.left)
result.add(next);
... | [
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"rangeQueryRight",
"(",
"TreeNode",
"<",
"T",
">",
"node",
",",
"Interval",
"<",
"T",
">",
"query",
",",
"Set",
"<",
"Interval",
"<",
"T",
">",
">",
"result",
")... | A helper method for the range search used in the interval intersection query in the tree.
This corresponds to the right branch of the range search, once we find a node, whose
midpoint is contained in the query interval. All intervals in the right subtree of that node
are guaranteed to intersect with the query, if they ... | [
"A",
"helper",
"method",
"for",
"the",
"range",
"search",
"used",
"in",
"the",
"interval",
"intersection",
"query",
"in",
"the",
"tree",
".",
"This",
"corresponds",
"to",
"the",
"right",
"branch",
"of",
"the",
"range",
"search",
"once",
"we",
"find",
"a",
... | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/TreeNode.java#L445-L463 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/Interval.java | Interval.isEmpty | public boolean isEmpty() {
if (start == null || end == null)
return false;
int compare = start.compareTo(end);
if (compare>0)
return true;
if (compare == 0 && (!isEndInclusive || !isStartInclusive))
return true;
return false;
} | java | public boolean isEmpty() {
if (start == null || end == null)
return false;
int compare = start.compareTo(end);
if (compare>0)
return true;
if (compare == 0 && (!isEndInclusive || !isStartInclusive))
return true;
return false;
} | [
"public",
"boolean",
"isEmpty",
"(",
")",
"{",
"if",
"(",
"start",
"==",
"null",
"||",
"end",
"==",
"null",
")",
"return",
"false",
";",
"int",
"compare",
"=",
"start",
".",
"compareTo",
"(",
"end",
")",
";",
"if",
"(",
"compare",
">",
"0",
")",
... | Checks if the current interval contains no points.
<p>In particular, if the end point is less than the start point, then the interval is
considered to be empty. There are, however other instances, in which an interval is empty.
For example, in the class {@link IntegerInterval}, an open interval, whose start and end
po... | [
"Checks",
"if",
"the",
"current",
"interval",
"contains",
"no",
"points",
"."
] | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/Interval.java#L172-L181 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/Interval.java | Interval.isPoint | public boolean isPoint(){
if (start == null || end == null) {
return false;
}
return start.compareTo(end) == 0 && isStartInclusive && isEndInclusive;
} | java | public boolean isPoint(){
if (start == null || end == null) {
return false;
}
return start.compareTo(end) == 0 && isStartInclusive && isEndInclusive;
} | [
"public",
"boolean",
"isPoint",
"(",
")",
"{",
"if",
"(",
"start",
"==",
"null",
"||",
"end",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"start",
".",
"compareTo",
"(",
"end",
")",
"==",
"0",
"&&",
"isStartInclusive",
"&&",
"isEnd... | Determines if the current interval is a single point.
@return {@code true}, if the current interval represents a single point. | [
"Determines",
"if",
"the",
"current",
"interval",
"is",
"a",
"single",
"point",
"."
] | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/Interval.java#L251-L256 | train |
lodborg/interval-tree | src/main/java/com/lodborg/intervaltree/Interval.java | Interval.contains | public boolean contains(T query){
if (isEmpty() || query == null) {
return false;
}
int startCompare = start == null ? 1 : query.compareTo(start);
int endCompare = end == null ? -1 : query.compareTo(end);
if (startCompare > 0 && endCompare < 0) {
return true;
}
return (startCompare == 0 && isStartI... | java | public boolean contains(T query){
if (isEmpty() || query == null) {
return false;
}
int startCompare = start == null ? 1 : query.compareTo(start);
int endCompare = end == null ? -1 : query.compareTo(end);
if (startCompare > 0 && endCompare < 0) {
return true;
}
return (startCompare == 0 && isStartI... | [
"public",
"boolean",
"contains",
"(",
"T",
"query",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
"||",
"query",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"int",
"startCompare",
"=",
"start",
"==",
"null",
"?",
"1",
":",
"query",
".",
"compa... | Determines if the current interval contains a query point.
@param query The point.
@return {@code true}, if the current interval contains the {@code query} point or false otherwise. | [
"Determines",
"if",
"the",
"current",
"interval",
"contains",
"a",
"query",
"point",
"."
] | 716b18fb0a5a53c9add9926176bc263f14c9bf90 | https://github.com/lodborg/interval-tree/blob/716b18fb0a5a53c9add9926176bc263f14c9bf90/src/main/java/com/lodborg/intervaltree/Interval.java#L264-L275 | train |
in-the-keyhole/khs-sherpa | src/main/java/com/khs/sherpa/util/UrlUtil.java | UrlUtil.getRequestBody | public static String getRequestBody(HttpServletRequest request) {
if(request.getMethod().equals("GET") || request.getMethod().equals("DELETE")) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
try {
InputStream inputStream = request.getInputStr... | java | public static String getRequestBody(HttpServletRequest request) {
if(request.getMethod().equals("GET") || request.getMethod().equals("DELETE")) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
try {
InputStream inputStream = request.getInputStr... | [
"public",
"static",
"String",
"getRequestBody",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"request",
".",
"getMethod",
"(",
")",
".",
"equals",
"(",
"\"GET\"",
")",
"||",
"request",
".",
"getMethod",
"(",
")",
".",
"equals",
"(",
"\"DELETE... | not easily tested | [
"not",
"easily",
"tested"
] | c2d4a49abac04c859090f637bdb84eac926a394a | https://github.com/in-the-keyhole/khs-sherpa/blob/c2d4a49abac04c859090f637bdb84eac926a394a/src/main/java/com/khs/sherpa/util/UrlUtil.java#L41-L82 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/sync/SyncAdapter.java | SyncAdapter.updatePrograms | private void updatePrograms(final Uri channelUri, final List<Program> newPrograms) {
new Thread(new Runnable() {
@Override
public void run() {
final int fetchedProgramsCount = newPrograms.size();
if (fetchedProgramsCount == 0) {
return;... | java | private void updatePrograms(final Uri channelUri, final List<Program> newPrograms) {
new Thread(new Runnable() {
@Override
public void run() {
final int fetchedProgramsCount = newPrograms.size();
if (fetchedProgramsCount == 0) {
return;... | [
"private",
"void",
"updatePrograms",
"(",
"final",
"Uri",
"channelUri",
",",
"final",
"List",
"<",
"Program",
">",
"newPrograms",
")",
"{",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
... | Updates the system database, TvProvider, with the given programs.
<p>If there is any overlap between the given and existing programs, the existing ones
will be updated with the given ones if they have the same title or replaced.
@param channelUri The channel where the program info will be added.
@param newPrograms A ... | [
"Updates",
"the",
"system",
"database",
"TvProvider",
"with",
"the",
"given",
"programs",
"."
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/sync/SyncAdapter.java#L177-L262 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/fileio/FileParser.java | FileParser.parseGenericFileUri | public static void parseGenericFileUri(String uri, FileIdentifier identifier) {
if(uri.startsWith("file://"))
identifier.onLocalFile();
else if(uri.startsWith("http://"))
identifier.onHttpFile();
else if(uri.startsWith("android.resource://"))
identifier.onAsse... | java | public static void parseGenericFileUri(String uri, FileIdentifier identifier) {
if(uri.startsWith("file://"))
identifier.onLocalFile();
else if(uri.startsWith("http://"))
identifier.onHttpFile();
else if(uri.startsWith("android.resource://"))
identifier.onAsse... | [
"public",
"static",
"void",
"parseGenericFileUri",
"(",
"String",
"uri",
",",
"FileIdentifier",
"identifier",
")",
"{",
"if",
"(",
"uri",
".",
"startsWith",
"(",
"\"file://\"",
")",
")",
"identifier",
".",
"onLocalFile",
"(",
")",
";",
"else",
"if",
"(",
"... | In order to determine the correct file parser, you can provide the URI and this method
will find the appropriate parser to use
@param uri The Uri of the file you are parsing
@param identifier This interface can be generated in order to handle different actions
based on the source of the file | [
"In",
"order",
"to",
"determine",
"the",
"correct",
"file",
"parser",
"you",
"can",
"provide",
"the",
"URI",
"and",
"this",
"method",
"will",
"find",
"the",
"appropriate",
"parser",
"to",
"use"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/fileio/FileParser.java#L15-L22 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/service/MultimediaInputProvider.java | MultimediaInputProvider.play | @Override
public void play(final String uri) {
Log.d(TAG, "Start playing "+uri);
notifyVideoUnavailable(REASON_BUFFERING);
isWeb = false;
TvInputPlayer.Callback callback = new TvInputPlayer.Callback() {
@Override
public void onPrepared() {
noti... | java | @Override
public void play(final String uri) {
Log.d(TAG, "Start playing "+uri);
notifyVideoUnavailable(REASON_BUFFERING);
isWeb = false;
TvInputPlayer.Callback callback = new TvInputPlayer.Callback() {
@Override
public void onPrepared() {
noti... | [
"@",
"Override",
"public",
"void",
"play",
"(",
"final",
"String",
"uri",
")",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"Start playing \"",
"+",
"uri",
")",
";",
"notifyVideoUnavailable",
"(",
"REASON_BUFFERING",
")",
";",
"isWeb",
"=",
"false",
";",
"Tv... | Tries to load a video file. If one cannot be played, it will be interpreted as a website
and begin to load it in a web browser
@param uri The URL for the file or website | [
"Tries",
"to",
"load",
"a",
"video",
"file",
".",
"If",
"one",
"cannot",
"be",
"played",
"it",
"will",
"be",
"interpreted",
"as",
"a",
"website",
"and",
"begin",
"to",
"load",
"it",
"in",
"a",
"web",
"browser"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/service/MultimediaInputProvider.java#L92-L169 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/service/ExoPlayerInputProvider.java | ExoPlayerInputProvider.play | public void play(String uri) {
tvInputPlayer.setSurface(mSurface);
try {
Log.d(TAG, "Play "+uri+"; "+uri.indexOf("asset:///"));
if(uri.contains("asset:///")) {
Log.i(TAG, "Is a local file");
DataSource dataSource=new AssetDataSource(getApplicationC... | java | public void play(String uri) {
tvInputPlayer.setSurface(mSurface);
try {
Log.d(TAG, "Play "+uri+"; "+uri.indexOf("asset:///"));
if(uri.contains("asset:///")) {
Log.i(TAG, "Is a local file");
DataSource dataSource=new AssetDataSource(getApplicationC... | [
"public",
"void",
"play",
"(",
"String",
"uri",
")",
"{",
"tvInputPlayer",
".",
"setSurface",
"(",
"mSurface",
")",
";",
"try",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"Play \"",
"+",
"uri",
"+",
"\"; \"",
"+",
"uri",
".",
"indexOf",
"(",
"\"asset:/... | Will load and begin to play any RTMP, HLS, or MPEG2-DASH stream
Should also be able to play local videos and audio files
@param uri The URL where the file resides | [
"Will",
"load",
"and",
"begin",
"to",
"play",
"any",
"RTMP",
"HLS",
"or",
"MPEG2",
"-",
"DASH",
"stream",
"Should",
"also",
"be",
"able",
"to",
"play",
"local",
"videos",
"and",
"audio",
"files"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/service/ExoPlayerInputProvider.java#L66-L84 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/sync/DummyAccountService.java | DummyAccountService.getAccount | public static Account getAccount(Context mContext) {
String ACCOUNT_NAME = mContext.getString(R.string.app_name);
return new Account(ACCOUNT_NAME, ACCOUNT_NAME);
} | java | public static Account getAccount(Context mContext) {
String ACCOUNT_NAME = mContext.getString(R.string.app_name);
return new Account(ACCOUNT_NAME, ACCOUNT_NAME);
} | [
"public",
"static",
"Account",
"getAccount",
"(",
"Context",
"mContext",
")",
"{",
"String",
"ACCOUNT_NAME",
"=",
"mContext",
".",
"getString",
"(",
"R",
".",
"string",
".",
"app_name",
")",
";",
"return",
"new",
"Account",
"(",
"ACCOUNT_NAME",
",",
"ACCOUNT... | public static final String ACCOUNT_NAME = ""; | [
"public",
"static",
"final",
"String",
"ACCOUNT_NAME",
"=",
";"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/sync/DummyAccountService.java#L26-L29 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/service/TvInputProvider.java | TvInputProvider.getCurrentChannels | public List<Channel> getCurrentChannels(Context mContext) {
try {
ApplicationInfo app = getApplicationContext().getPackageManager().getApplicationInfo(getApplicationContext().getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = app.metaData;
final String service =... | java | public List<Channel> getCurrentChannels(Context mContext) {
try {
ApplicationInfo app = getApplicationContext().getPackageManager().getApplicationInfo(getApplicationContext().getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = app.metaData;
final String service =... | [
"public",
"List",
"<",
"Channel",
">",
"getCurrentChannels",
"(",
"Context",
"mContext",
")",
"{",
"try",
"{",
"ApplicationInfo",
"app",
"=",
"getApplicationContext",
"(",
")",
".",
"getPackageManager",
"(",
")",
".",
"getApplicationInfo",
"(",
"getApplicationCont... | Goes into the TV guide and obtains the channels currently registered
@return An ArrayList of channels | [
"Goes",
"into",
"the",
"TV",
"guide",
"and",
"obtains",
"the",
"channels",
"currently",
"registered"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/service/TvInputProvider.java#L116-L151 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/service/TvInputProvider.java | TvInputProvider.getGenericProgram | public Program getGenericProgram(Channel channel) {
TvContentRating rating = RATING_PG;
return new Program.Builder()
.setTitle(channel.getName() + " Live")
.setProgramId(channel.getServiceId())
// .setEpisodeNumber(1)
// .setSeasonNumber(1)
/... | java | public Program getGenericProgram(Channel channel) {
TvContentRating rating = RATING_PG;
return new Program.Builder()
.setTitle(channel.getName() + " Live")
.setProgramId(channel.getServiceId())
// .setEpisodeNumber(1)
// .setSeasonNumber(1)
/... | [
"public",
"Program",
"getGenericProgram",
"(",
"Channel",
"channel",
")",
"{",
"TvContentRating",
"rating",
"=",
"RATING_PG",
";",
"return",
"new",
"Program",
".",
"Builder",
"(",
")",
".",
"setTitle",
"(",
"channel",
".",
"getName",
"(",
")",
"+",
"\" Live\... | If you don't have access to an EPG or don't want to supply programs, you can simply
add several instances of this generic program object.
Note you will have to set the start and end times manually.
@param channel The channel for which the program will be displayed
@return A very generic program object | [
"If",
"you",
"don",
"t",
"have",
"access",
"to",
"an",
"EPG",
"or",
"don",
"t",
"want",
"to",
"supply",
"programs",
"you",
"can",
"simply",
"add",
"several",
"instances",
"of",
"this",
"generic",
"program",
"object",
"."
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/service/TvInputProvider.java#L202-L220 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/service/TvInputProvider.java | TvInputProvider.getLocalVideoUri | public String getLocalVideoUri(String assetname) {
File f = new File(assetname);
Log.d(TAG, "Video path "+f.getAbsolutePath());
String uri = Uri.fromFile(f).toString();
Log.d(TAG, "Uri "+uri);
return uri;
// return "file:/"+assetname;
// return "asset:///"+assetname... | java | public String getLocalVideoUri(String assetname) {
File f = new File(assetname);
Log.d(TAG, "Video path "+f.getAbsolutePath());
String uri = Uri.fromFile(f).toString();
Log.d(TAG, "Uri "+uri);
return uri;
// return "file:/"+assetname;
// return "asset:///"+assetname... | [
"public",
"String",
"getLocalVideoUri",
"(",
"String",
"assetname",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"assetname",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"Video path \"",
"+",
"f",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"Strin... | Gets a valid Uri of a local video file
@param assetname The resource id of the video
@return A Uri as a string | [
"Gets",
"a",
"valid",
"Uri",
"of",
"a",
"local",
"video",
"file"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/service/TvInputProvider.java#L356-L364 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/fileio/HttpFileParser.java | HttpFileParser.downloadUrl | private InputStream downloadUrl(String myurl) throws IOException {
InputStream is = null;
// Only display the first 500 characters of the retrieved
// web page content.
try {
URL url = new URL(myurl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection... | java | private InputStream downloadUrl(String myurl) throws IOException {
InputStream is = null;
// Only display the first 500 characters of the retrieved
// web page content.
try {
URL url = new URL(myurl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection... | [
"private",
"InputStream",
"downloadUrl",
"(",
"String",
"myurl",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"// Only display the first 500 characters of the retrieved",
"// web page content.",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
... | Given a URL, establishes an HttpUrlConnection and retrieves
the web page content as a InputStream, which it returns as
a string.
@param myurl The URL of the request
@return The inputstream of the request's return data
@throws IOException | [
"Given",
"a",
"URL",
"establishes",
"an",
"HttpUrlConnection",
"and",
"retrieves",
"the",
"web",
"page",
"content",
"as",
"a",
"InputStream",
"which",
"it",
"returns",
"as",
"a",
"string",
"."
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/fileio/HttpFileParser.java#L55-L76 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/players/TvInputPlayer.java | TvInputPlayer.getCurrentPosition | public long getCurrentPosition() {
try {
return mPlayer.getCurrentPosition();
} catch(Exception e) {
Log.e(TAG, e.getMessage());
return -1;
}
} | java | public long getCurrentPosition() {
try {
return mPlayer.getCurrentPosition();
} catch(Exception e) {
Log.e(TAG, e.getMessage());
return -1;
}
} | [
"public",
"long",
"getCurrentPosition",
"(",
")",
"{",
"try",
"{",
"return",
"mPlayer",
".",
"getCurrentPosition",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"e",
".",
"getMessage",
"(",
")",
")",
... | Returns the current position of the media in milliseconds, if applicable
@return | [
"Returns",
"the",
"current",
"position",
"of",
"the",
"media",
"in",
"milliseconds",
"if",
"applicable"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/players/TvInputPlayer.java#L536-L543 | train |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/utils/LiveChannelsUtils.java | LiveChannelsUtils.getTvInputProvider | public static TvInputProvider getTvInputProvider(Context mContext, final TvInputProviderCallback callback) {
ApplicationInfo app = null;
try {
Log.d(TAG, mContext.getPackageName()+" >");
app = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManag... | java | public static TvInputProvider getTvInputProvider(Context mContext, final TvInputProviderCallback callback) {
ApplicationInfo app = null;
try {
Log.d(TAG, mContext.getPackageName()+" >");
app = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManag... | [
"public",
"static",
"TvInputProvider",
"getTvInputProvider",
"(",
"Context",
"mContext",
",",
"final",
"TvInputProviderCallback",
"callback",
")",
"{",
"ApplicationInfo",
"app",
"=",
"null",
";",
"try",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"mContext",
".",
"... | Returns the TvInputProvider that was defined by the project's manifest | [
"Returns",
"the",
"TvInputProvider",
"that",
"was",
"defined",
"by",
"the",
"project",
"s",
"manifest"
] | f677beae37112f463c0c4783967fdb8fa97eb633 | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/utils/LiveChannelsUtils.java#L52-L87 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java | MLNumericArray.setReal | public void setReal(T value, int m, int n)
{
setReal( value, getIndex(m,n) );
} | java | public void setReal(T value, int m, int n)
{
setReal( value, getIndex(m,n) );
} | [
"public",
"void",
"setReal",
"(",
"T",
"value",
",",
"int",
"m",
",",
"int",
"n",
")",
"{",
"setReal",
"(",
"value",
",",
"getIndex",
"(",
"m",
",",
"n",
")",
")",
";",
"}"
] | Sets single real array element.
@param value - element value
@param m - row index
@param n - column index | [
"Sets",
"single",
"real",
"array",
"element",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java#L99-L102 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java | MLNumericArray.setReal | public void setReal( T[] vector )
{
if ( vector.length != getSize() )
{
throw new IllegalArgumentException("Matrix dimensions do not match. " + getSize() + " not " + vector.length);
}
System.arraycopy(vector, 0, real, 0, vector.length);
} | java | public void setReal( T[] vector )
{
if ( vector.length != getSize() )
{
throw new IllegalArgumentException("Matrix dimensions do not match. " + getSize() + " not " + vector.length);
}
System.arraycopy(vector, 0, real, 0, vector.length);
} | [
"public",
"void",
"setReal",
"(",
"T",
"[",
"]",
"vector",
")",
"{",
"if",
"(",
"vector",
".",
"length",
"!=",
"getSize",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Matrix dimensions do not match. \"",
"+",
"getSize",
"(",
")",
... | Sets real part of matrix
@param vector - column-packed vector of elements | [
"Sets",
"real",
"part",
"of",
"matrix"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java#L118-L125 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java | MLNumericArray.setImaginary | public void setImaginary(T value, int m, int n)
{
setImaginary( value, getIndex(m,n) );
} | java | public void setImaginary(T value, int m, int n)
{
setImaginary( value, getIndex(m,n) );
} | [
"public",
"void",
"setImaginary",
"(",
"T",
"value",
",",
"int",
"m",
",",
"int",
"n",
")",
"{",
"setImaginary",
"(",
"value",
",",
"getIndex",
"(",
"m",
",",
"n",
")",
")",
";",
"}"
] | Sets single imaginary array element.
@param value - element value
@param m - row index
@param n - column index | [
"Sets",
"single",
"imaginary",
"array",
"element",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java#L133-L136 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLChar.java | MLChar.set | public void set(String value, int idx)
{
int rowOffset = getM();
for ( int i = 0; i < getN(); i++ )
{
if ( i < value.length())
{
setChar( value.charAt(i), idx + (rowOffset * i));
}
else
{
setChar(' ', idx + (rowOffset * i));... | java | public void set(String value, int idx)
{
int rowOffset = getM();
for ( int i = 0; i < getN(); i++ )
{
if ( i < value.length())
{
setChar( value.charAt(i), idx + (rowOffset * i));
}
else
{
setChar(' ', idx + (rowOffset * i));... | [
"public",
"void",
"set",
"(",
"String",
"value",
",",
"int",
"idx",
")",
"{",
"int",
"rowOffset",
"=",
"getM",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getN",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"<",
... | Set one row, specifying the row.
@param value
@param idx | [
"Set",
"one",
"row",
"specifying",
"the",
"row",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLChar.java#L108-L123 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLSparse.java | MLSparse.getIR | public int[] getIR()
{
int[] ir = new int[nzmax];
int i = 0;
for ( IndexMN index : indexSet )
{
ir[i++] = index.m;
}
return ir;
} | java | public int[] getIR()
{
int[] ir = new int[nzmax];
int i = 0;
for ( IndexMN index : indexSet )
{
ir[i++] = index.m;
}
return ir;
} | [
"public",
"int",
"[",
"]",
"getIR",
"(",
")",
"{",
"int",
"[",
"]",
"ir",
"=",
"new",
"int",
"[",
"nzmax",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"IndexMN",
"index",
":",
"indexSet",
")",
"{",
"ir",
"[",
"i",
"++",
"]",
"=",
"inde... | Gets row indices
<tt>ir</tt> points to an integer array of length nzmax containing the row indices of
the corresponding elements in <tt>pr</tt> and <tt>pi</tt>. | [
"Gets",
"row",
"indices"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLSparse.java#L53-L62 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLSparse.java | MLSparse.getIC | public int[] getIC()
{
int[] ic = new int[nzmax];
int i = 0;
for ( IndexMN index : indexSet )
{
ic[i++] = index.n;
}
return ic;
} | java | public int[] getIC()
{
int[] ic = new int[nzmax];
int i = 0;
for ( IndexMN index : indexSet )
{
ic[i++] = index.n;
}
return ic;
} | [
"public",
"int",
"[",
"]",
"getIC",
"(",
")",
"{",
"int",
"[",
"]",
"ic",
"=",
"new",
"int",
"[",
"nzmax",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"IndexMN",
"index",
":",
"indexSet",
")",
"{",
"ic",
"[",
"i",
"++",
"]",
"=",
"inde... | Gets column indices
<tt>ic</tt> points to an integer array of length nzmax containing the column indices of
the corresponding elements in <tt>pr</tt> and <tt>pi</tt>. | [
"Gets",
"column",
"indices"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLSparse.java#L70-L79 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLSparse.java | MLSparse.getJC | public int[] getJC()
{
int[] jc = new int[getN()+1];
// jc[j] is the number of nonzero elements in all preceeding columns
for ( IndexMN index : indexSet )
{
for (int column = index.n + 1; column < jc.length; column++)
{
jc[column]++;
... | java | public int[] getJC()
{
int[] jc = new int[getN()+1];
// jc[j] is the number of nonzero elements in all preceeding columns
for ( IndexMN index : indexSet )
{
for (int column = index.n + 1; column < jc.length; column++)
{
jc[column]++;
... | [
"public",
"int",
"[",
"]",
"getJC",
"(",
")",
"{",
"int",
"[",
"]",
"jc",
"=",
"new",
"int",
"[",
"getN",
"(",
")",
"+",
"1",
"]",
";",
"// jc[j] is the number of nonzero elements in all preceeding columns",
"for",
"(",
"IndexMN",
"index",
":",
"indexSet",
... | Gets column indices.
<tt>jc</tt> points to an integer array of length N+1 that contains column index information.
For j, in the range <tt>0<=j<=N</tt>, <tt>jc[j]</tt> is the index in ir and <tt>pr</tt> (and <tt>pi</tt>
if it exists) of the first nonzero entry in the jth column and <tt>jc[j+1]�1</tt> index
of the... | [
"Gets",
"column",
"indices",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLSparse.java#L93-L105 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java | MLStructure.setField | public void setField(String name, MLArray value, int index)
{
keys.add(name);
currentIndex = index;
if ( mlStructArray.isEmpty() || mlStructArray.size() <= index )
{
mlStructArray.add(index, new LinkedHashMap<String, MLArray>() );
}
mlStructArray.... | java | public void setField(String name, MLArray value, int index)
{
keys.add(name);
currentIndex = index;
if ( mlStructArray.isEmpty() || mlStructArray.size() <= index )
{
mlStructArray.add(index, new LinkedHashMap<String, MLArray>() );
}
mlStructArray.... | [
"public",
"void",
"setField",
"(",
"String",
"name",
",",
"MLArray",
"value",
",",
"int",
"index",
")",
"{",
"keys",
".",
"add",
"(",
"name",
")",
";",
"currentIndex",
"=",
"index",
";",
"if",
"(",
"mlStructArray",
".",
"isEmpty",
"(",
")",
"||",
"ml... | Sets filed for structure described by index in struct array
@param name - name of the field
@param value - <code>MLArray</code> field value
@param index | [
"Sets",
"filed",
"for",
"structure",
"described",
"by",
"index",
"in",
"struct",
"array"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java#L80-L90 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java | MLStructure.getMaxFieldLenth | public int getMaxFieldLenth()
{
//get max field name
int maxLen = 0;
for ( String s : keys )
{
maxLen = s.length() > maxLen ? s.length() : maxLen;
}
return maxLen+1;
} | java | public int getMaxFieldLenth()
{
//get max field name
int maxLen = 0;
for ( String s : keys )
{
maxLen = s.length() > maxLen ? s.length() : maxLen;
}
return maxLen+1;
} | [
"public",
"int",
"getMaxFieldLenth",
"(",
")",
"{",
"//get max field name",
"int",
"maxLen",
"=",
"0",
";",
"for",
"(",
"String",
"s",
":",
"keys",
")",
"{",
"maxLen",
"=",
"s",
".",
"length",
"(",
")",
">",
"maxLen",
"?",
"s",
".",
"length",
"(",
... | Gets the maximum length of field descriptor
@return | [
"Gets",
"the",
"maximum",
"length",
"of",
"field",
"descriptor"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java#L97-L107 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java | MLStructure.getKeySetToByteArray | public byte[] getKeySetToByteArray()
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
char[] buffer = new char[getMaxFieldLenth()];
try
{
for ( String s : keys )
{
... | java | public byte[] getKeySetToByteArray()
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
char[] buffer = new char[getMaxFieldLenth()];
try
{
for ( String s : keys )
{
... | [
"public",
"byte",
"[",
"]",
"getKeySetToByteArray",
"(",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutputStream",
"(",
"baos",
")",
";",
"char",
"[",
"]",
"buffer"... | Dumps field names to byte array. Field names are written as Zero End Strings
@return | [
"Dumps",
"field",
"names",
"to",
"byte",
"array",
".",
"Field",
"names",
"are",
"written",
"as",
"Zero",
"End",
"Strings"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java#L114-L137 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java | MLStructure.getAllFields | public Collection<MLArray> getAllFields()
{
ArrayList<MLArray> fields = new ArrayList<MLArray>();
for ( Map<String, MLArray> struct : mlStructArray )
{
fields.addAll( struct.values() );
}
return fields;
} | java | public Collection<MLArray> getAllFields()
{
ArrayList<MLArray> fields = new ArrayList<MLArray>();
for ( Map<String, MLArray> struct : mlStructArray )
{
fields.addAll( struct.values() );
}
return fields;
} | [
"public",
"Collection",
"<",
"MLArray",
">",
"getAllFields",
"(",
")",
"{",
"ArrayList",
"<",
"MLArray",
">",
"fields",
"=",
"new",
"ArrayList",
"<",
"MLArray",
">",
"(",
")",
";",
"for",
"(",
"Map",
"<",
"String",
",",
"MLArray",
">",
"struct",
":",
... | Gets all field from sruct array as flat list of fields.
@return | [
"Gets",
"all",
"field",
"from",
"sruct",
"array",
"as",
"flat",
"list",
"of",
"fields",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java#L143-L152 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java | MLStructure.getField | public MLArray getField(String name, int index)
{
if (mlStructArray.isEmpty()) {
return null;
}
return mlStructArray.get(index).get(name);
} | java | public MLArray getField(String name, int index)
{
if (mlStructArray.isEmpty()) {
return null;
}
return mlStructArray.get(index).get(name);
} | [
"public",
"MLArray",
"getField",
"(",
"String",
"name",
",",
"int",
"index",
")",
"{",
"if",
"(",
"mlStructArray",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"mlStructArray",
".",
"get",
"(",
"index",
")",
".",
"get",
"... | Gets a value of the field described by name from index'th struct
in struct array or null if the field doesn't exist.
@param name
@param index
@return value of the field or null if the field doesn't exist | [
"Gets",
"a",
"value",
"of",
"the",
"field",
"described",
"by",
"name",
"from",
"index",
"th",
"struct",
"in",
"struct",
"array",
"or",
"null",
"if",
"the",
"field",
"doesn",
"t",
"exist",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java#L198-L204 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.read | public synchronized Map<String, MLArray> read(InputStream stream, MatFileFilter filter) throws IOException
{
this.filter = filter;
data.clear();
ByteBuffer buf = null;
final ByteArrayOutputStream2 baos = new ByteArrayOutputStream2();
copy(stream, baos);
buf = ByteB... | java | public synchronized Map<String, MLArray> read(InputStream stream, MatFileFilter filter) throws IOException
{
this.filter = filter;
data.clear();
ByteBuffer buf = null;
final ByteArrayOutputStream2 baos = new ByteArrayOutputStream2();
copy(stream, baos);
buf = ByteB... | [
"public",
"synchronized",
"Map",
"<",
"String",
",",
"MLArray",
">",
"read",
"(",
"InputStream",
"stream",
",",
"MatFileFilter",
"filter",
")",
"throws",
"IOException",
"{",
"this",
".",
"filter",
"=",
"filter",
";",
"data",
".",
"clear",
"(",
")",
";",
... | Read a mat file from a stream. Internally this will read the stream fully
into memory before parsing it.
@param stream
a valid MAT-file stream to be read
@param filter
the array filter applied during reading
@return the same as <code>{@link #getContent()}</code>
@see MatFileFilter
@throws IOException
if error occurs ... | [
"Read",
"a",
"mat",
"file",
"from",
"a",
"stream",
".",
"Internally",
"this",
"will",
"read",
"the",
"stream",
"fully",
"into",
"memory",
"before",
"parsing",
"it",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L646-L662 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.readFlags | private int[] readFlags(ByteBuffer buf) throws IOException
{
ISMatTag tag = new ISMatTag(buf);
int[] flags = tag.readToIntArray();
return flags;
} | java | private int[] readFlags(ByteBuffer buf) throws IOException
{
ISMatTag tag = new ISMatTag(buf);
int[] flags = tag.readToIntArray();
return flags;
} | [
"private",
"int",
"[",
"]",
"readFlags",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"ISMatTag",
"tag",
"=",
"new",
"ISMatTag",
"(",
"buf",
")",
";",
"int",
"[",
"]",
"flags",
"=",
"tag",
".",
"readToIntArray",
"(",
")",
";",
"return",... | Reads Matrix flags.
Modifies <code>buf</code> position.
@param buf <code>ByteBuffer</code>
@return flags int array
@throws IOException if reading from buffer fails | [
"Reads",
"Matrix",
"flags",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L1319-L1326 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.readDimension | private int[] readDimension(ByteBuffer buf ) throws IOException
{
ISMatTag tag = new ISMatTag(buf);
int[] dims = tag.readToIntArray();
return dims;
} | java | private int[] readDimension(ByteBuffer buf ) throws IOException
{
ISMatTag tag = new ISMatTag(buf);
int[] dims = tag.readToIntArray();
return dims;
} | [
"private",
"int",
"[",
"]",
"readDimension",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"ISMatTag",
"tag",
"=",
"new",
"ISMatTag",
"(",
"buf",
")",
";",
"int",
"[",
"]",
"dims",
"=",
"tag",
".",
"readToIntArray",
"(",
")",
";",
"retur... | Reads Matrix dimensions.
Modifies <code>buf</code> position.
@param buf <code>ByteBuffer</code>
@return dimensions int array
@throws IOException if reading from buffer fails | [
"Reads",
"Matrix",
"dimensions",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L1336-L1343 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.readName | private String readName(ByteBuffer buf) throws IOException
{
ISMatTag tag = new ISMatTag(buf);
return tag.readToString();
} | java | private String readName(ByteBuffer buf) throws IOException
{
ISMatTag tag = new ISMatTag(buf);
return tag.readToString();
} | [
"private",
"String",
"readName",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"ISMatTag",
"tag",
"=",
"new",
"ISMatTag",
"(",
"buf",
")",
";",
"return",
"tag",
".",
"readToString",
"(",
")",
";",
"}"
] | Reads Matrix name.
Modifies <code>buf</code> position.
@param buf <code>ByteBuffer</code>
@return name <code>String</code>
@throws IOException if reading from buffer fails | [
"Reads",
"Matrix",
"name",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L1353-L1358 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.readHeader | private void readHeader(ByteBuffer buf) throws IOException
{
//header values
String description;
int version;
byte[] endianIndicator = new byte[2];
// This part of the header is missing if the file isn't a regular mat file. So ignore.
if (matType == MatFileType.Regu... | java | private void readHeader(ByteBuffer buf) throws IOException
{
//header values
String description;
int version;
byte[] endianIndicator = new byte[2];
// This part of the header is missing if the file isn't a regular mat file. So ignore.
if (matType == MatFileType.Regu... | [
"private",
"void",
"readHeader",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"//header values",
"String",
"description",
";",
"int",
"version",
";",
"byte",
"[",
"]",
"endianIndicator",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"// This part of ... | Reads MAT-file header.
Modifies <code>buf</code> position.
@param buf
<code>ByteBuffer</code>
@throws IOException
if reading from buffer fails or if this is not a valid
MAT-file | [
"Reads",
"MAT",
"-",
"file",
"header",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L1370-L1422 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/common/MatDataTypes.java | MatDataTypes.sizeOf | public static int sizeOf(int type)
{
switch ( type )
{
case MatDataTypes.miINT8:
return miSIZE_INT8;
case MatDataTypes.miUINT8:
return miSIZE_UINT8;
case MatDataTypes.miINT16:
return miSIZE_INT16;
case Ma... | java | public static int sizeOf(int type)
{
switch ( type )
{
case MatDataTypes.miINT8:
return miSIZE_INT8;
case MatDataTypes.miUINT8:
return miSIZE_UINT8;
case MatDataTypes.miINT16:
return miSIZE_INT16;
case Ma... | [
"public",
"static",
"int",
"sizeOf",
"(",
"int",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"MatDataTypes",
".",
"miINT8",
":",
"return",
"miSIZE_INT8",
";",
"case",
"MatDataTypes",
".",
"miUINT8",
":",
"return",
"miSIZE_UINT8",
";",
"case"... | Return number of bytes for given type.
@param type - <code>MatDataTypes</code>
@return | [
"Return",
"number",
"of",
"bytes",
"for",
"given",
"type",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/common/MatDataTypes.java#L45-L70 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/common/MatDataTypes.java | MatDataTypes.typeToString | public static String typeToString(int type)
{
String s;
switch (type)
{
case MatDataTypes.miUNKNOWN:
s = "unknown";
break;
case MatDataTypes.miINT8:
s = "int8";
break;
case MatDataTypes.miUINT... | java | public static String typeToString(int type)
{
String s;
switch (type)
{
case MatDataTypes.miUNKNOWN:
s = "unknown";
break;
case MatDataTypes.miINT8:
s = "int8";
break;
case MatDataTypes.miUINT... | [
"public",
"static",
"String",
"typeToString",
"(",
"int",
"type",
")",
"{",
"String",
"s",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"MatDataTypes",
".",
"miUNKNOWN",
":",
"s",
"=",
"\"unknown\"",
";",
"break",
";",
"case",
"MatDataTypes",
".",
"miIN... | Get String representation of a data type
@param type - data type
@return - String representation | [
"Get",
"String",
"representation",
"of",
"a",
"data",
"type"
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/common/MatDataTypes.java#L77-L134 | train |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLDouble.java | MLDouble.getArray | public double[][] getArray()
{
double[][] result = new double[getM()][];
for ( int m = 0; m < getM(); m++ )
{
result[m] = new double[ getN() ];
for ( int n = 0; n < getN(); n++ )
{
result[m][n] = getReal(m,n);
... | java | public double[][] getArray()
{
double[][] result = new double[getM()][];
for ( int m = 0; m < getM(); m++ )
{
result[m] = new double[ getN() ];
for ( int n = 0; n < getN(); n++ )
{
result[m][n] = getReal(m,n);
... | [
"public",
"double",
"[",
"]",
"[",
"]",
"getArray",
"(",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"result",
"=",
"new",
"double",
"[",
"getM",
"(",
")",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"m",
"=",
"0",
";",
"m",
"<",
"getM",
"(",
... | Gets two-dimensional real array.
@return - 2D real array | [
"Gets",
"two",
"-",
"dimensional",
"real",
"array",
"."
] | dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6 | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLDouble.java#L85-L99 | train |
hellojavaer/ddal | ddal-spring/src/main/java/org/hellojavaer/ddal/spring/scan/MethodBasedSpelExpression.java | MethodBasedSpelExpression.getParameterNames | private String[] getParameterNames(Method method) {
if (notSupportParameterNameDiscoverer) {
return null;
} else {
try {
ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();// only support
// from spring4
... | java | private String[] getParameterNames(Method method) {
if (notSupportParameterNameDiscoverer) {
return null;
} else {
try {
ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();// only support
// from spring4
... | [
"private",
"String",
"[",
"]",
"getParameterNames",
"(",
"Method",
"method",
")",
"{",
"if",
"(",
"notSupportParameterNameDiscoverer",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"try",
"{",
"ParameterNameDiscoverer",
"parameterNameDiscoverer",
"=",
"new",
... | DefaultParameterNameDiscoverer is supported spring 4.0
@return | [
"DefaultParameterNameDiscoverer",
"is",
"supported",
"spring",
"4",
".",
"0"
] | 876dc32ece8bb983df64e94bdcc9045f0ee5cc3b | https://github.com/hellojavaer/ddal/blob/876dc32ece8bb983df64e94bdcc9045f0ee5cc3b/ddal-spring/src/main/java/org/hellojavaer/ddal/spring/scan/MethodBasedSpelExpression.java#L70-L87 | train |
hellojavaer/ddal | ddal-ddr/src/main/java/org/hellojavaer/ddal/ddr/shard/rule/SpelShardRouteRule.java | SpelShardRouteRule.buildEvaluationContext | private static EvaluationContext buildEvaluationContext(final String expression) {
return new DDRSpelEvaluationContext() {
@Override
public Object lookupVariable(String name) {
Object val = null;
if (isReservedWords(name)) {
val = supe... | java | private static EvaluationContext buildEvaluationContext(final String expression) {
return new DDRSpelEvaluationContext() {
@Override
public Object lookupVariable(String name) {
Object val = null;
if (isReservedWords(name)) {
val = supe... | [
"private",
"static",
"EvaluationContext",
"buildEvaluationContext",
"(",
"final",
"String",
"expression",
")",
"{",
"return",
"new",
"DDRSpelEvaluationContext",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"lookupVariable",
"(",
"String",
"name",
")",
"{",
... | load order
1.reserved words
2.function
3.user-define var | [
"load",
"order",
"1",
".",
"reserved",
"words",
"2",
".",
"function",
"3",
".",
"user",
"-",
"define",
"var"
] | 876dc32ece8bb983df64e94bdcc9045f0ee5cc3b | https://github.com/hellojavaer/ddal/blob/876dc32ece8bb983df64e94bdcc9045f0ee5cc3b/ddal-ddr/src/main/java/org/hellojavaer/ddal/ddr/shard/rule/SpelShardRouteRule.java#L255-L274 | train |
hellojavaer/ddal | ddal-example/ddal-example-example0/src/main/java/org/hellojavaer/ddal/example/example0/init/InitDatabaseSqlBuilder.java | InitDatabaseSqlBuilder.main | public static void main(String[] args) {
ShardRouter shardRouter = buildShardRouter();
String createDatabaseSql = "CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;";
String createTableSql = "CREATE TABLE `%s`(`id` bigint(20) NOT NULL, `name` varchar(32) NOT NU... | java | public static void main(String[] args) {
ShardRouter shardRouter = buildShardRouter();
String createDatabaseSql = "CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;";
String createTableSql = "CREATE TABLE `%s`(`id` bigint(20) NOT NULL, `name` varchar(32) NOT NU... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"ShardRouter",
"shardRouter",
"=",
"buildShardRouter",
"(",
")",
";",
"String",
"createDatabaseSql",
"=",
"\"CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\"... | run this method | [
"run",
"this",
"method"
] | 876dc32ece8bb983df64e94bdcc9045f0ee5cc3b | https://github.com/hellojavaer/ddal/blob/876dc32ece8bb983df64e94bdcc9045f0ee5cc3b/ddal-example/ddal-example-example0/src/main/java/org/hellojavaer/ddal/example/example0/init/InitDatabaseSqlBuilder.java#L45-L50 | train |
hellojavaer/ddal | ddal-jsqlparser/src/main/java/org/hellojavaer/ddal/jsqlparser/JSQLParserAdapter.java | JSQLParserAdapter.visit | @Override
public void visit(Delete delete) {
if (enableLimitCheck && delete.getLimit() == null) {
throw new IllegalStateException("no limit in sql: " + sql);
}
this.getStack().push(new FrameContext(StatementType.DELETE));
visit0(delete);
afterVisitBaseStatement();... | java | @Override
public void visit(Delete delete) {
if (enableLimitCheck && delete.getLimit() == null) {
throw new IllegalStateException("no limit in sql: " + sql);
}
this.getStack().push(new FrameContext(StatementType.DELETE));
visit0(delete);
afterVisitBaseStatement();... | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"Delete",
"delete",
")",
"{",
"if",
"(",
"enableLimitCheck",
"&&",
"delete",
".",
"getLimit",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"no limit in sql: \"",
"+",
"sql"... | mysql 'delete' doesn't support alais | [
"mysql",
"delete",
"doesn",
"t",
"support",
"alais"
] | 876dc32ece8bb983df64e94bdcc9045f0ee5cc3b | https://github.com/hellojavaer/ddal/blob/876dc32ece8bb983df64e94bdcc9045f0ee5cc3b/ddal-jsqlparser/src/main/java/org/hellojavaer/ddal/jsqlparser/JSQLParserAdapter.java#L472-L480 | train |
lithiumtech/mineraloil-selenium | src/main/java/com/lithium/mineraloil/selenium/elements/TextElement.java | TextElement.type | public void type(final String text) {
autoHover();
if (text == null) return;
waitUntilEnabled();
runWithRetries(() -> {
elementImpl.locateElement().clear();
elementImpl.locateElement().sendKeys(text);
});
} | java | public void type(final String text) {
autoHover();
if (text == null) return;
waitUntilEnabled();
runWithRetries(() -> {
elementImpl.locateElement().clear();
elementImpl.locateElement().sendKeys(text);
});
} | [
"public",
"void",
"type",
"(",
"final",
"String",
"text",
")",
"{",
"autoHover",
"(",
")",
";",
"if",
"(",
"text",
"==",
"null",
")",
"return",
";",
"waitUntilEnabled",
"(",
")",
";",
"runWithRetries",
"(",
"(",
")",
"->",
"{",
"elementImpl",
".",
"l... | Clears out the value of the input field first then types specified text.
@param text the text to put into the text area | [
"Clears",
"out",
"the",
"value",
"of",
"the",
"input",
"field",
"first",
"then",
"types",
"specified",
"text",
"."
] | 3710cf2df0b04c7cbf8790d98f3464207fb8175d | https://github.com/lithiumtech/mineraloil-selenium/blob/3710cf2df0b04c7cbf8790d98f3464207fb8175d/src/main/java/com/lithium/mineraloil/selenium/elements/TextElement.java#L55-L63 | train |
lithiumtech/mineraloil-selenium | src/main/java/com/lithium/mineraloil/selenium/elements/ElementImpl.java | ElementImpl.getListWebElements | private List<WebElement> getListWebElements(Callable<List<WebElement>> callable) {
int retries = 0;
long expireTime = Instant.now().toEpochMilli() + SECONDS.toMillis(INTERACT_WAIT_S);
while (Instant.now().toEpochMilli() < expireTime && retries < LOCATE_RETRIES) {
try {
... | java | private List<WebElement> getListWebElements(Callable<List<WebElement>> callable) {
int retries = 0;
long expireTime = Instant.now().toEpochMilli() + SECONDS.toMillis(INTERACT_WAIT_S);
while (Instant.now().toEpochMilli() < expireTime && retries < LOCATE_RETRIES) {
try {
... | [
"private",
"List",
"<",
"WebElement",
">",
"getListWebElements",
"(",
"Callable",
"<",
"List",
"<",
"WebElement",
">",
">",
"callable",
")",
"{",
"int",
"retries",
"=",
"0",
";",
"long",
"expireTime",
"=",
"Instant",
".",
"now",
"(",
")",
".",
"toEpochMi... | If nothing found by the timeout, return an empty list | [
"If",
"nothing",
"found",
"by",
"the",
"timeout",
"return",
"an",
"empty",
"list"
] | 3710cf2df0b04c7cbf8790d98f3464207fb8175d | https://github.com/lithiumtech/mineraloil-selenium/blob/3710cf2df0b04c7cbf8790d98f3464207fb8175d/src/main/java/com/lithium/mineraloil/selenium/elements/ElementImpl.java#L154-L171 | train |
lithiumtech/mineraloil-selenium | src/main/java/com/lithium/mineraloil/selenium/elements/Driver.java | Driver.switchWindow | public void switchWindow() {
List<String> windowHandles = new ArrayList<>(getWindowHandles());
getDriver().switchTo().window(windowHandles.get(windowHandles.size() - 1));
} | java | public void switchWindow() {
List<String> windowHandles = new ArrayList<>(getWindowHandles());
getDriver().switchTo().window(windowHandles.get(windowHandles.size() - 1));
} | [
"public",
"void",
"switchWindow",
"(",
")",
"{",
"List",
"<",
"String",
">",
"windowHandles",
"=",
"new",
"ArrayList",
"<>",
"(",
"getWindowHandles",
"(",
")",
")",
";",
"getDriver",
"(",
")",
".",
"switchTo",
"(",
")",
".",
"window",
"(",
"windowHandles... | switches to the last opened window | [
"switches",
"to",
"the",
"last",
"opened",
"window"
] | 3710cf2df0b04c7cbf8790d98f3464207fb8175d | https://github.com/lithiumtech/mineraloil-selenium/blob/3710cf2df0b04c7cbf8790d98f3464207fb8175d/src/main/java/com/lithium/mineraloil/selenium/elements/Driver.java#L84-L87 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java | ResourceManager.putCachedResource | private static void putCachedResource( String baseName, Resources resources )
{
synchronized( ResourceManager.class )
{
WeakReference<Resources> ref = new WeakReference<Resources>( resources );
RESOURCES.put( baseName, ref );
}
} | java | private static void putCachedResource( String baseName, Resources resources )
{
synchronized( ResourceManager.class )
{
WeakReference<Resources> ref = new WeakReference<Resources>( resources );
RESOURCES.put( baseName, ref );
}
} | [
"private",
"static",
"void",
"putCachedResource",
"(",
"String",
"baseName",
",",
"Resources",
"resources",
")",
"{",
"synchronized",
"(",
"ResourceManager",
".",
"class",
")",
"{",
"WeakReference",
"<",
"Resources",
">",
"ref",
"=",
"new",
"WeakReference",
"<",... | Cache specified resource in weak reference.
@param baseName the resource key
@param resources the resources object | [
"Cache",
"specified",
"resource",
"in",
"weak",
"reference",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L138-L145 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java | ResourceManager.getCachedResource | private static Resources getCachedResource( String baseName )
{
synchronized( ResourceManager.class )
{
WeakReference weakReference = RESOURCES.get( baseName );
if( null == weakReference )
{
return null;
}
else
{... | java | private static Resources getCachedResource( String baseName )
{
synchronized( ResourceManager.class )
{
WeakReference weakReference = RESOURCES.get( baseName );
if( null == weakReference )
{
return null;
}
else
{... | [
"private",
"static",
"Resources",
"getCachedResource",
"(",
"String",
"baseName",
")",
"{",
"synchronized",
"(",
"ResourceManager",
".",
"class",
")",
"{",
"WeakReference",
"weakReference",
"=",
"RESOURCES",
".",
"get",
"(",
"baseName",
")",
";",
"if",
"(",
"n... | Retrieve cached resource.
@param baseName the resource key
@return resources the resources object | [
"Retrieve",
"cached",
"resource",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L154-L168 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java | ResourceManager.getPackageResources | public static Resources getPackageResources( Class clazz, Locale locale )
{
return getBaseResources( getPackageResourcesBaseName( clazz ), locale, clazz.getClassLoader() );
} | java | public static Resources getPackageResources( Class clazz, Locale locale )
{
return getBaseResources( getPackageResourcesBaseName( clazz ), locale, clazz.getClassLoader() );
} | [
"public",
"static",
"Resources",
"getPackageResources",
"(",
"Class",
"clazz",
",",
"Locale",
"locale",
")",
"{",
"return",
"getBaseResources",
"(",
"getPackageResourcesBaseName",
"(",
"clazz",
")",
",",
"locale",
",",
"clazz",
".",
"getClassLoader",
"(",
")",
"... | Retrieve resource for specified Classes package.
The basename is determined by name of classes package
postfixed with ".Resources".
@param clazz the Class
@param locale the locale of the package resources requested.
@return the Resources | [
"Retrieve",
"resource",
"for",
"specified",
"Classes",
"package",
".",
"The",
"basename",
"is",
"determined",
"by",
"name",
"of",
"classes",
"package",
"postfixed",
"with",
".",
"Resources",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L207-L210 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java | ResourceManager.getClassResources | public static Resources getClassResources( Class clazz, Locale locale )
{
return getBaseResources( getClassResourcesBaseName( clazz ), locale, clazz.getClassLoader() );
} | java | public static Resources getClassResources( Class clazz, Locale locale )
{
return getBaseResources( getClassResourcesBaseName( clazz ), locale, clazz.getClassLoader() );
} | [
"public",
"static",
"Resources",
"getClassResources",
"(",
"Class",
"clazz",
",",
"Locale",
"locale",
")",
"{",
"return",
"getBaseResources",
"(",
"getClassResourcesBaseName",
"(",
"clazz",
")",
",",
"locale",
",",
"clazz",
".",
"getClassLoader",
"(",
")",
")",
... | Retrieve resource for specified Class.
The basename is determined by name of Class
postfixed with "Resources".
@param clazz the Class
@param locale the requested Locale.
@return the Resources | [
"Retrieve",
"resource",
"for",
"specified",
"Class",
".",
"The",
"basename",
"is",
"determined",
"by",
"name",
"of",
"Class",
"postfixed",
"with",
"Resources",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L236-L239 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java | ResourceManager.getPackageResourcesBaseName | public static String getPackageResourcesBaseName( Class clazz )
{
final Package pkg = clazz.getPackage();
String baseName;
if( null == pkg )
{
String name = clazz.getName();
if( -1 == name.lastIndexOf( "." ) )
{
baseName = "Resourc... | java | public static String getPackageResourcesBaseName( Class clazz )
{
final Package pkg = clazz.getPackage();
String baseName;
if( null == pkg )
{
String name = clazz.getName();
if( -1 == name.lastIndexOf( "." ) )
{
baseName = "Resourc... | [
"public",
"static",
"String",
"getPackageResourcesBaseName",
"(",
"Class",
"clazz",
")",
"{",
"final",
"Package",
"pkg",
"=",
"clazz",
".",
"getPackage",
"(",
")",
";",
"String",
"baseName",
";",
"if",
"(",
"null",
"==",
"pkg",
")",
"{",
"String",
"name",
... | Retrieve resource basename for specified Classes package.
The basename is determined by name of classes package
postfixed with ".Resources".
@param clazz the Class
@return the resource basename | [
"Retrieve",
"resource",
"basename",
"for",
"specified",
"Classes",
"package",
".",
"The",
"basename",
"is",
"determined",
"by",
"name",
"of",
"classes",
"package",
"postfixed",
"with",
".",
"Resources",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L250-L273 | train |
ops4j/org.ops4j.base | ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java | ServiceProviderFinder.findServiceProviders | public static <T> List<T> findServiceProviders( Class<T> klass )
{
ServiceLoader<T> loader = ServiceLoader.load( klass );
List<T> providers = new ArrayList<T>();
Iterator<T> it = loader.iterator();
while ( it.hasNext() )
{
providers.add( it.next() );
}
... | java | public static <T> List<T> findServiceProviders( Class<T> klass )
{
ServiceLoader<T> loader = ServiceLoader.load( klass );
List<T> providers = new ArrayList<T>();
Iterator<T> it = loader.iterator();
while ( it.hasNext() )
{
providers.add( it.next() );
}
... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findServiceProviders",
"(",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"ServiceLoader",
"<",
"T",
">",
"loader",
"=",
"ServiceLoader",
".",
"load",
"(",
"klass",
")",
";",
"List",
"<",
"T",
... | Finds all providers for a given service.
@param klass service interface or class
@return list of all providers (not null) | [
"Finds",
"all",
"providers",
"for",
"a",
"given",
"service",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java#L39-L49 | train |
ops4j/org.ops4j.base | ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java | ServiceProviderFinder.findAnyServiceProvider | public static <T> T findAnyServiceProvider( Class<T> klass )
{
ServiceLoader<T> loader = ServiceLoader.load( klass );
Iterator<T> it = loader.iterator();
return it.hasNext() ? it.next() : null;
} | java | public static <T> T findAnyServiceProvider( Class<T> klass )
{
ServiceLoader<T> loader = ServiceLoader.load( klass );
Iterator<T> it = loader.iterator();
return it.hasNext() ? it.next() : null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findAnyServiceProvider",
"(",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"ServiceLoader",
"<",
"T",
">",
"loader",
"=",
"ServiceLoader",
".",
"load",
"(",
"klass",
")",
";",
"Iterator",
"<",
"T",
">",
"it",
"=... | Finds any provider for a given service.
@param klass service interface or class
@return the first provider found, or null | [
"Finds",
"any",
"provider",
"for",
"a",
"given",
"service",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java#L57-L62 | train |
ops4j/org.ops4j.base | ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java | ServiceProviderFinder.loadAnyServiceProvider | public static <T> T loadAnyServiceProvider( Class<T> klass )
{
T provider = findAnyServiceProvider( klass );
if (provider == null) {
throw new NoServiceProviderException( klass.getName()
+ ": no service provider found in META-INF/services on classpath" );
... | java | public static <T> T loadAnyServiceProvider( Class<T> klass )
{
T provider = findAnyServiceProvider( klass );
if (provider == null) {
throw new NoServiceProviderException( klass.getName()
+ ": no service provider found in META-INF/services on classpath" );
... | [
"public",
"static",
"<",
"T",
">",
"T",
"loadAnyServiceProvider",
"(",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"T",
"provider",
"=",
"findAnyServiceProvider",
"(",
"klass",
")",
";",
"if",
"(",
"provider",
"==",
"null",
")",
"{",
"throw",
"new",
"No... | Returns any provider for a given service and throws an exception when no provider
is found on the classpath.
@param klass service interface or class
@return the first provider found
@throws NoServiceProviderException | [
"Returns",
"any",
"provider",
"for",
"a",
"given",
"service",
"and",
"throws",
"an",
"exception",
"when",
"no",
"provider",
"is",
"found",
"on",
"the",
"classpath",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java#L72-L80 | train |
ops4j/org.ops4j.base | ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java | ServiceProviderFinder.loadUniqueServiceProvider | public static <T> T loadUniqueServiceProvider( Class<T> klass )
{
List<T> providers = findServiceProviders( klass );
if( providers.isEmpty() )
{
throw new NoServiceProviderException( klass.getName()
+ ": no service provider found in META-INF/services on classp... | java | public static <T> T loadUniqueServiceProvider( Class<T> klass )
{
List<T> providers = findServiceProviders( klass );
if( providers.isEmpty() )
{
throw new NoServiceProviderException( klass.getName()
+ ": no service provider found in META-INF/services on classp... | [
"public",
"static",
"<",
"T",
">",
"T",
"loadUniqueServiceProvider",
"(",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"List",
"<",
"T",
">",
"providers",
"=",
"findServiceProviders",
"(",
"klass",
")",
";",
"if",
"(",
"providers",
".",
"isEmpty",
"(",
"... | Returns the unique service provider for a given service and throws an exception if there
is no unique provider
@param klass service interface or class
@return the first provider found
@throws NoServiceProviderException
@throws NonUniqueServiceProviderException | [
"Returns",
"the",
"unique",
"service",
"provider",
"for",
"a",
"given",
"service",
"and",
"throws",
"an",
"exception",
"if",
"there",
"is",
"no",
"unique",
"provider"
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-spi/src/main/java/org/ops4j/spi/ServiceProviderFinder.java#L91-L105 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/Pipe.java | Pipe.start | public synchronized Pipe start( final String name )
{
if( null == m_pump && null != m_in && null != m_out )
{
// might re-use a pump
m_pump = startPump( m_in );
m_pump.setName( name );
m_pump.connect( m_out );
}
return this;
} | java | public synchronized Pipe start( final String name )
{
if( null == m_pump && null != m_in && null != m_out )
{
// might re-use a pump
m_pump = startPump( m_in );
m_pump.setName( name );
m_pump.connect( m_out );
}
return this;
} | [
"public",
"synchronized",
"Pipe",
"start",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"m_pump",
"&&",
"null",
"!=",
"m_in",
"&&",
"null",
"!=",
"m_out",
")",
"{",
"// might re-use a pump",
"m_pump",
"=",
"startPump",
"(",
"m_in",
... | Start piping data from input to output.
@param name pipe name
@return pipe instance | [
"Start",
"piping",
"data",
"from",
"input",
"to",
"output",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/Pipe.java#L84-L94 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/Pipe.java | Pipe.stop | public synchronized void stop()
{
if( null != m_pump )
{
// disconnect pump
m_pump.connect( null );
m_pump.setName( m_pump.getName() + " (disconnected)" );
m_pump = null;
}
} | java | public synchronized void stop()
{
if( null != m_pump )
{
// disconnect pump
m_pump.connect( null );
m_pump.setName( m_pump.getName() + " (disconnected)" );
m_pump = null;
}
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"m_pump",
")",
"{",
"// disconnect pump",
"m_pump",
".",
"connect",
"(",
"null",
")",
";",
"m_pump",
".",
"setName",
"(",
"m_pump",
".",
"getName",
"(",
")",
"+",
"\" (di... | Stop piping data from input to output. | [
"Stop",
"piping",
"data",
"from",
"input",
"to",
"output",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/Pipe.java#L99-L108 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/FileUtils.java | FileUtils.getFileFromClasspath | public static File getFileFromClasspath(final String filePath) throws FileNotFoundException {
try {
URL fileURL = FileUtils.class.getClassLoader().getResource(filePath);
if (fileURL == null) {
throw new FileNotFoundException("File [" + filePath + "] could not be found in ... | java | public static File getFileFromClasspath(final String filePath) throws FileNotFoundException {
try {
URL fileURL = FileUtils.class.getClassLoader().getResource(filePath);
if (fileURL == null) {
throw new FileNotFoundException("File [" + filePath + "] could not be found in ... | [
"public",
"static",
"File",
"getFileFromClasspath",
"(",
"final",
"String",
"filePath",
")",
"throws",
"FileNotFoundException",
"{",
"try",
"{",
"URL",
"fileURL",
"=",
"FileUtils",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"filePath... | Searches the classpath for the file denoted by the file path and returns
the corresponding file.
@param filePath
path to the file
@return a file corresponding to the path
@throws FileNotFoundException
if the file cannot be found | [
"Searches",
"the",
"classpath",
"for",
"the",
"file",
"denoted",
"by",
"the",
"file",
"path",
"and",
"returns",
"the",
"corresponding",
"file",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/FileUtils.java#L105-L115 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/FileUtils.java | FileUtils.delete | public static boolean delete(final File file) {
boolean delete = false;
if (file != null && file.exists()) {
// even if is a directory try to delete. maybe is empty or maybe is a *nix symbolic link
delete = file.delete();
if (!delete && file.isDirectory()) {
... | java | public static boolean delete(final File file) {
boolean delete = false;
if (file != null && file.exists()) {
// even if is a directory try to delete. maybe is empty or maybe is a *nix symbolic link
delete = file.delete();
if (!delete && file.isDirectory()) {
... | [
"public",
"static",
"boolean",
"delete",
"(",
"final",
"File",
"file",
")",
"{",
"boolean",
"delete",
"=",
"false",
";",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"exists",
"(",
")",
")",
"{",
"// even if is a directory try to delete. maybe is empty ... | Deletes the file or recursively deletes a directory depending on the file
passed.
@param file
file or directory to be deleted.
@return true if the file was deleted. | [
"Deletes",
"the",
"file",
"or",
"recursively",
"deletes",
"a",
"directory",
"depending",
"on",
"the",
"file",
"passed",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/FileUtils.java#L125-L142 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/ListerUtils.java | ListerUtils.parseFilter | public static Pattern parseFilter( final String spec )
{
StringBuffer sb = new StringBuffer();
for( int j = 0; j < spec.length(); j++ )
{
char c = spec.charAt( j );
switch( c )
{
case '.':
sb.append( "\\." );
... | java | public static Pattern parseFilter( final String spec )
{
StringBuffer sb = new StringBuffer();
for( int j = 0; j < spec.length(); j++ )
{
char c = spec.charAt( j );
switch( c )
{
case '.':
sb.append( "\\." );
... | [
"public",
"static",
"Pattern",
"parseFilter",
"(",
"final",
"String",
"spec",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"spec",
".",
"length",
"(",
")",
";",
"j",
"++... | Parses a usual filter into a regex pattern.
@param spec the filter to be parsed
@return a regexp pattern corresponding to the filter
@throws IllegalArgumentException - If the filter could not be compiled to a pattern | [
"Parses",
"a",
"usual",
"filter",
"into",
"a",
"regex",
"pattern",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ListerUtils.java#L45-L83 | train |
ops4j/org.ops4j.base | ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java | ElementHelper.getRootElement | public static Element getRootElement( InputStream input )
throws ParserConfigurationException, IOException, SAXException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating( false );
factory.setNamespaceAware( false );
try
{
... | java | public static Element getRootElement( InputStream input )
throws ParserConfigurationException, IOException, SAXException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating( false );
factory.setNamespaceAware( false );
try
{
... | [
"public",
"static",
"Element",
"getRootElement",
"(",
"InputStream",
"input",
")",
"throws",
"ParserConfigurationException",
",",
"IOException",
",",
"SAXException",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
"... | Return the root element of the supplied input stream.
@param input the input stream containing a XML definition
@return the root element
@throws IOException If an underlying I/O problem occurred.
@throws ParserConfigurationException if there is a severe problem in the XML parsing subsystem.
@throws ... | [
"Return",
"the",
"root",
"element",
"of",
"the",
"supplied",
"input",
"stream",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L65-L105 | train |
ops4j/org.ops4j.base | ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java | ElementHelper.getChild | public static Element getChild( Element root, String name )
{
if( null == root )
{
return null;
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
if( n < 1 )
{
return null;
}
return (Element)... | java | public static Element getChild( Element root, String name )
{
if( null == root )
{
return null;
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
if( n < 1 )
{
return null;
}
return (Element)... | [
"public",
"static",
"Element",
"getChild",
"(",
"Element",
"root",
",",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"root",
")",
"{",
"return",
"null",
";",
"}",
"NodeList",
"list",
"=",
"root",
".",
"getElementsByTagName",
"(",
"name",
")",
"... | Return a named child relative to a supplied element.
@param root the parent DOM element
@param name the name of a child element
@return the child element of null if the child does not exist | [
"Return",
"a",
"named",
"child",
"relative",
"to",
"a",
"supplied",
"element",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L115-L128 | train |
ops4j/org.ops4j.base | ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java | ElementHelper.getChildren | public static Element[] getChildren( Element root, String name )
{
if( null == root )
{
return new Element[0];
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
ArrayList<Element> result = new ArrayList<Element>();
for(... | java | public static Element[] getChildren( Element root, String name )
{
if( null == root )
{
return new Element[0];
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
ArrayList<Element> result = new ArrayList<Element>();
for(... | [
"public",
"static",
"Element",
"[",
"]",
"getChildren",
"(",
"Element",
"root",
",",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"root",
")",
"{",
"return",
"new",
"Element",
"[",
"0",
"]",
";",
"}",
"NodeList",
"list",
"=",
"root",
".",
"... | Return all children matching the supplied element name.
@param root the parent DOM element
@param name the name against which child element will be matched
@return the array of child elements with a matching name | [
"Return",
"all",
"children",
"matching",
"the",
"supplied",
"element",
"name",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L138-L158 | train |
ops4j/org.ops4j.base | ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java | ElementHelper.getValue | public static String getValue( Element node )
{
if( null == node )
{
return null;
}
String value;
if( node.getChildNodes().getLength() > 0 )
{
value = node.getFirstChild().getNodeValue();
}
else
{
value = nod... | java | public static String getValue( Element node )
{
if( null == node )
{
return null;
}
String value;
if( node.getChildNodes().getLength() > 0 )
{
value = node.getFirstChild().getNodeValue();
}
else
{
value = nod... | [
"public",
"static",
"String",
"getValue",
"(",
"Element",
"node",
")",
"{",
"if",
"(",
"null",
"==",
"node",
")",
"{",
"return",
"null",
";",
"}",
"String",
"value",
";",
"if",
"(",
"node",
".",
"getChildNodes",
"(",
")",
".",
"getLength",
"(",
")",
... | Return the value of an element.
@param node the DOM node
@return the node value | [
"Return",
"the",
"value",
"of",
"an",
"element",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L201-L217 | train |
ops4j/org.ops4j.base | ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java | ElementHelper.normalize | private static String normalize( String value, Properties props )
{
return PropertyResolver.resolve( props, value );
} | java | private static String normalize( String value, Properties props )
{
return PropertyResolver.resolve( props, value );
} | [
"private",
"static",
"String",
"normalize",
"(",
"String",
"value",
",",
"Properties",
"props",
")",
"{",
"return",
"PropertyResolver",
".",
"resolve",
"(",
"props",
",",
"value",
")",
";",
"}"
] | Parse the value for any property tokens relative to the supplied properties.
@param value the value to parse
@param props the reference properties
@return the normalized string | [
"Parse",
"the",
"value",
"for",
"any",
"property",
"tokens",
"relative",
"to",
"the",
"supplied",
"properties",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L279-L282 | train |
ops4j/org.ops4j.base | ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java | ConnectionCache.get | public URLConnection get( Object key )
{
synchronized( this ) // ensure no ConcurrentModificationException can occur.
{
Entry entry = m_hardStore.get( key );
if( entry == null )
{
return null;
}
return entry.m_connection;
... | java | public URLConnection get( Object key )
{
synchronized( this ) // ensure no ConcurrentModificationException can occur.
{
Entry entry = m_hardStore.get( key );
if( entry == null )
{
return null;
}
return entry.m_connection;
... | [
"public",
"URLConnection",
"get",
"(",
"Object",
"key",
")",
"{",
"synchronized",
"(",
"this",
")",
"// ensure no ConcurrentModificationException can occur.",
"{",
"Entry",
"entry",
"=",
"m_hardStore",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"==",
... | Returns the URLConnection associated with the given key.
@param key The key that is associated to the URL.
@return the URLConnection associated with the given key. | [
"Returns",
"the",
"URLConnection",
"associated",
"with",
"the",
"given",
"key",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java#L87-L98 | train |
ops4j/org.ops4j.base | ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java | ConnectionCache.put | public void put( Object key, URLConnection conn )
{
synchronized( this ) // ensure no ConcurrentModificationException can occur.
{
Entry entry = new Entry( conn );
m_hardStore.put( key, entry );
if( m_thread == null )
{
m_thread = new T... | java | public void put( Object key, URLConnection conn )
{
synchronized( this ) // ensure no ConcurrentModificationException can occur.
{
Entry entry = new Entry( conn );
m_hardStore.put( key, entry );
if( m_thread == null )
{
m_thread = new T... | [
"public",
"void",
"put",
"(",
"Object",
"key",
",",
"URLConnection",
"conn",
")",
"{",
"synchronized",
"(",
"this",
")",
"// ensure no ConcurrentModificationException can occur.",
"{",
"Entry",
"entry",
"=",
"new",
"Entry",
"(",
"conn",
")",
";",
"m_hardStore",
... | Stores a URLConnection in association with a key.
@param key The key that is associated to the URLConnection.
@param conn The URLConnection that should be stored in association with the key. | [
"Stores",
"a",
"URLConnection",
"in",
"association",
"with",
"a",
"key",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java#L106-L119 | train |
ops4j/org.ops4j.base | ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java | ConnectionCache.mainLoop | private boolean mainLoop()
throws InterruptedException
{
long now = System.currentTimeMillis();
Iterator list = m_hardStore.values().iterator();
while( list.hasNext() )
{
Entry entry = (Entry) list.next();
if( entry.m_collectTime < now )
{
... | java | private boolean mainLoop()
throws InterruptedException
{
long now = System.currentTimeMillis();
Iterator list = m_hardStore.values().iterator();
while( list.hasNext() )
{
Entry entry = (Entry) list.next();
if( entry.m_collectTime < now )
{
... | [
"private",
"boolean",
"mainLoop",
"(",
")",
"throws",
"InterruptedException",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Iterator",
"list",
"=",
"m_hardStore",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"whil... | The main loop of the cache, which checks for expirations.
@return true if the thread should be stopped.
@throws InterruptedException if the thread was interrupted while blocking. | [
"The",
"main",
"loop",
"of",
"the",
"cache",
"which",
"checks",
"for",
"expirations",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java#L170-L191 | train |
ops4j/org.ops4j.base | ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java | ConnectionCache.unregisterExceptionMonitor | public void unregisterExceptionMonitor( ExceptionMonitor monitor )
{
synchronized( this )
{
if( monitor == null || !monitor.equals( m_exceptionMonitor ) )
{
return;
}
m_exceptionMonitor = null;
}
} | java | public void unregisterExceptionMonitor( ExceptionMonitor monitor )
{
synchronized( this )
{
if( monitor == null || !monitor.equals( m_exceptionMonitor ) )
{
return;
}
m_exceptionMonitor = null;
}
} | [
"public",
"void",
"unregisterExceptionMonitor",
"(",
"ExceptionMonitor",
"monitor",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"monitor",
"==",
"null",
"||",
"!",
"monitor",
".",
"equals",
"(",
"m_exceptionMonitor",
")",
")",
"{",
"return",
... | Unregister a ExceptionMonitor with the source.
@param monitor The ExceptionMonitor to be unregistered.
@requires HansaPermission "api.exceptionmonitor", "remove" | [
"Unregister",
"a",
"ExceptionMonitor",
"with",
"the",
"source",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java#L221-L231 | train |
ops4j/org.ops4j.base | ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java | ConnectionCache.getExceptionMonitors | public List<ExceptionMonitor> getExceptionMonitors()
{
synchronized( this )
{
ArrayList<ExceptionMonitor> result = new ArrayList<ExceptionMonitor>();
result.add( m_exceptionMonitor );
return result;
}
} | java | public List<ExceptionMonitor> getExceptionMonitors()
{
synchronized( this )
{
ArrayList<ExceptionMonitor> result = new ArrayList<ExceptionMonitor>();
result.add( m_exceptionMonitor );
return result;
}
} | [
"public",
"List",
"<",
"ExceptionMonitor",
">",
"getExceptionMonitors",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"ArrayList",
"<",
"ExceptionMonitor",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ExceptionMonitor",
">",
"(",
")",
";",
"result",
... | Returns all ExceptionMonitors that are registered.
@return all ExceptionMonitors that are registered.
@requires HansaPermission "api.exceptionmonitor", "get" | [
"Returns",
"all",
"ExceptionMonitors",
"that",
"are",
"registered",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/ConnectionCache.java#L240-L248 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java | PropertiesUtils.readProps | public static Properties readProps( URL propsUrl, Properties mappings )
throws IOException
{
InputStream stream = propsUrl.openStream();
return readProperties( stream, mappings, true );
} | java | public static Properties readProps( URL propsUrl, Properties mappings )
throws IOException
{
InputStream stream = propsUrl.openStream();
return readProperties( stream, mappings, true );
} | [
"public",
"static",
"Properties",
"readProps",
"(",
"URL",
"propsUrl",
",",
"Properties",
"mappings",
")",
"throws",
"IOException",
"{",
"InputStream",
"stream",
"=",
"propsUrl",
".",
"openStream",
"(",
")",
";",
"return",
"readProperties",
"(",
"stream",
",",
... | Read a set of properties from a property file specificed by a url.
@param propsUrl the url of the property file to read
@param mappings Properties that will be available for translations initially.
@return the resolved properties
@throws IOException if an io error occurs
@see #readProperties(java.io.InputStream,java... | [
"Read",
"a",
"set",
"of",
"properties",
"from",
"a",
"property",
"file",
"specificed",
"by",
"a",
"url",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L54-L59 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java | PropertiesUtils.resolveProperty | public static String resolveProperty( Properties props, String value )
{
return PropertyResolver.resolve( props, value );
} | java | public static String resolveProperty( Properties props, String value )
{
return PropertyResolver.resolve( props, value );
} | [
"public",
"static",
"String",
"resolveProperty",
"(",
"Properties",
"props",
",",
"String",
"value",
")",
"{",
"return",
"PropertyResolver",
".",
"resolve",
"(",
"props",
",",
"value",
")",
";",
"}"
] | Resolve symbols in a supplied value against supplied known properties.
@param props a set of know properties
@param value the string to parse for tokens
@return the resolved string | [
"Resolve",
"symbols",
"in",
"a",
"supplied",
"value",
"against",
"supplied",
"known",
"properties",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L139-L142 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java | PropertiesUtils.getProperty | public static String getProperty( Properties props, String key, String def )
{
String value = props.getProperty( key, def );
if( value == null )
{
return null;
}
if( "".equals( value ) )
{
return value;
}
value = PropertyResolve... | java | public static String getProperty( Properties props, String key, String def )
{
String value = props.getProperty( key, def );
if( value == null )
{
return null;
}
if( "".equals( value ) )
{
return value;
}
value = PropertyResolve... | [
"public",
"static",
"String",
"getProperty",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"String",
"def",
")",
"{",
"String",
"value",
"=",
"props",
".",
"getProperty",
"(",
"key",
",",
"def",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",... | Return the value of a property.
@param props the property file
@param key the property key to lookup
@param def the default value
@return the resolve value | [
"Return",
"the",
"value",
"of",
"a",
"property",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L153-L166 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java | PropertiesUtils.readListFile | public static String[] readListFile( URL listFile )
throws IOException
{
ArrayList<String> list = new ArrayList<String>();
InputStream stream = listFile.openStream();
try
{
InputStreamReader isr = new InputStreamReader( stream, "UTF-8" );
BufferedReade... | java | public static String[] readListFile( URL listFile )
throws IOException
{
ArrayList<String> list = new ArrayList<String>();
InputStream stream = listFile.openStream();
try
{
InputStreamReader isr = new InputStreamReader( stream, "UTF-8" );
BufferedReade... | [
"public",
"static",
"String",
"[",
"]",
"readListFile",
"(",
"URL",
"listFile",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"InputStream",
"stream",
"=",
"listFile"... | Read a file and return the list of lines in an array of strings.
@param listFile the url to read from
@return the lines
@throws IOException if a read error occurs | [
"Read",
"a",
"file",
"and",
"return",
"the",
"list",
"of",
"lines",
"in",
"an",
"array",
"of",
"strings",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L177-L200 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.toFirstCap | private static String toFirstCap( String applicationname )
{
char first = applicationname.charAt( 0 );
first = Character.toUpperCase( first );
String name = first + applicationname.substring( 1 );
return name;
} | java | private static String toFirstCap( String applicationname )
{
char first = applicationname.charAt( 0 );
first = Character.toUpperCase( first );
String name = first + applicationname.substring( 1 );
return name;
} | [
"private",
"static",
"String",
"toFirstCap",
"(",
"String",
"applicationname",
")",
"{",
"char",
"first",
"=",
"applicationname",
".",
"charAt",
"(",
"0",
")",
";",
"first",
"=",
"Character",
".",
"toUpperCase",
"(",
"first",
")",
";",
"String",
"name",
"=... | Capitalizes the first character.
@param applicationname The application name to be capitalized in the first character.
@return A capitalized first character of the provided application name. | [
"Capitalizes",
"the",
"first",
"character",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L190-L196 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getEnvVariable | public static String getEnvVariable( String name )
throws EnvironmentException
{
if( isUnix() )
{
Properties properties = getUnixShellVariables();
return properties.getProperty( name );
}
else if( isWindows() )
{
Properties properti... | java | public static String getEnvVariable( String name )
throws EnvironmentException
{
if( isUnix() )
{
Properties properties = getUnixShellVariables();
return properties.getProperty( name );
}
else if( isWindows() )
{
Properties properti... | [
"public",
"static",
"String",
"getEnvVariable",
"(",
"String",
"name",
")",
"throws",
"EnvironmentException",
"{",
"if",
"(",
"isUnix",
"(",
")",
")",
"{",
"Properties",
"properties",
"=",
"getUnixShellVariables",
"(",
")",
";",
"return",
"properties",
".",
"g... | Gets the value of a shell environment variable.
@param name the name of variable
@return the String representation of an environment variable value
@throws EnvironmentException if there is a problem accessing the environment | [
"Gets",
"the",
"value",
"of",
"a",
"shell",
"environment",
"variable",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L207-L223 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getEnvVariables | public static Properties getEnvVariables()
throws EnvironmentException
{
if( isUnix() )
{
return getUnixShellVariables();
}
if( isWindows() )
{
return getWindowsShellVariables();
}
String message = "Environment operations not s... | java | public static Properties getEnvVariables()
throws EnvironmentException
{
if( isUnix() )
{
return getUnixShellVariables();
}
if( isWindows() )
{
return getWindowsShellVariables();
}
String message = "Environment operations not s... | [
"public",
"static",
"Properties",
"getEnvVariables",
"(",
")",
"throws",
"EnvironmentException",
"{",
"if",
"(",
"isUnix",
"(",
")",
")",
"{",
"return",
"getUnixShellVariables",
"(",
")",
";",
"}",
"if",
"(",
"isWindows",
"(",
")",
")",
"{",
"return",
"get... | Gets all environment variables within a Properties instance where the
key is the environment variable name and value is the value of the
property.
@return the environment variables and values as Properties
@throws EnvironmentException if os is not recognized | [
"Gets",
"all",
"environment",
"variables",
"within",
"a",
"Properties",
"instance",
"where",
"the",
"key",
"is",
"the",
"environment",
"variable",
"name",
"and",
"value",
"is",
"the",
"value",
"of",
"the",
"property",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L288-L303 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getUserShell | public static String getUserShell()
throws EnvironmentException
{
if( isMacOsX() )
{
return getMacUserShell();
}
if( isWindows() )
{
return getWindowsUserShell();
}
if( isUnix() )
{
return getUnixUserShell(... | java | public static String getUserShell()
throws EnvironmentException
{
if( isMacOsX() )
{
return getMacUserShell();
}
if( isWindows() )
{
return getWindowsUserShell();
}
if( isUnix() )
{
return getUnixUserShell(... | [
"public",
"static",
"String",
"getUserShell",
"(",
")",
"throws",
"EnvironmentException",
"{",
"if",
"(",
"isMacOsX",
"(",
")",
")",
"{",
"return",
"getMacUserShell",
"(",
")",
";",
"}",
"if",
"(",
"isWindows",
"(",
")",
")",
"{",
"return",
"getWindowsUser... | Gets the user's shell executable.
@return the shell executable for the user
@throws EnvironmentException the there is a problem accessing shell
information | [
"Gets",
"the",
"user",
"s",
"shell",
"executable",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L313-L334 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getWindowsUserShell | private static String getWindowsUserShell()
{
if( null != m_SHELL )
{
return m_SHELL;
}
if( -1 != OSNAME.indexOf( "98" )
|| -1 != OSNAME.indexOf( "95" )
|| -1 != OSNAME.indexOf( "Me" ) )
{
m_SHELL = "command.com";
r... | java | private static String getWindowsUserShell()
{
if( null != m_SHELL )
{
return m_SHELL;
}
if( -1 != OSNAME.indexOf( "98" )
|| -1 != OSNAME.indexOf( "95" )
|| -1 != OSNAME.indexOf( "Me" ) )
{
m_SHELL = "command.com";
r... | [
"private",
"static",
"String",
"getWindowsUserShell",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"m_SHELL",
")",
"{",
"return",
"m_SHELL",
";",
"}",
"if",
"(",
"-",
"1",
"!=",
"OSNAME",
".",
"indexOf",
"(",
"\"98\"",
")",
"||",
"-",
"1",
"!=",
"OSNAME",... | Gets the shell used by the Windows user.
@return the shell: cmd.exe or command.com. | [
"Gets",
"the",
"shell",
"used",
"by",
"the",
"Windows",
"user",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L345-L362 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getMacUserShell | private static String getMacUserShell()
throws EnvironmentException
{
if( null != m_SHELL )
{
return m_SHELL;
}
String[] args = { "nidump", "passwd", "/" };
return readShellFromPasswdFile( args );
} | java | private static String getMacUserShell()
throws EnvironmentException
{
if( null != m_SHELL )
{
return m_SHELL;
}
String[] args = { "nidump", "passwd", "/" };
return readShellFromPasswdFile( args );
} | [
"private",
"static",
"String",
"getMacUserShell",
"(",
")",
"throws",
"EnvironmentException",
"{",
"if",
"(",
"null",
"!=",
"m_SHELL",
")",
"{",
"return",
"m_SHELL",
";",
"}",
"String",
"[",
"]",
"args",
"=",
"{",
"\"nidump\"",
",",
"\"passwd\"",
",",
"\"/... | Gets the default login shell used by a mac user.
@return the Mac user's default shell as referenced by cmd:
'nidump passwd /'
@throws EnvironmentException if os information is not resolvable | [
"Gets",
"the",
"default",
"login",
"shell",
"used",
"by",
"a",
"mac",
"user",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L372-L381 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getUnixUserShell | private static String getUnixUserShell()
throws EnvironmentException
{
if( null != m_SHELL )
{
return m_SHELL;
}
String[] args = { "cat", "/etc/passwd" };
return readShellFromPasswdFile( args );
} | java | private static String getUnixUserShell()
throws EnvironmentException
{
if( null != m_SHELL )
{
return m_SHELL;
}
String[] args = { "cat", "/etc/passwd" };
return readShellFromPasswdFile( args );
} | [
"private",
"static",
"String",
"getUnixUserShell",
"(",
")",
"throws",
"EnvironmentException",
"{",
"if",
"(",
"null",
"!=",
"m_SHELL",
")",
"{",
"return",
"m_SHELL",
";",
"}",
"String",
"[",
"]",
"args",
"=",
"{",
"\"cat\"",
",",
"\"/etc/passwd\"",
"}",
"... | Gets the default login shell used by a unix user.
@return the Mac user's default shell as referenced by cmd:
'nidump passwd /'
@throws EnvironmentException if os information is not resolvable | [
"Gets",
"the",
"default",
"login",
"shell",
"used",
"by",
"a",
"unix",
"user",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L391-L400 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.processPasswdFile | private static void processPasswdFile( BufferedReader reader )
throws IOException
{
String entry = reader.readLine();
while( null != entry )
{
// Skip entries other than the one for this username
if( entry.startsWith( USERNAME ) )
{
... | java | private static void processPasswdFile( BufferedReader reader )
throws IOException
{
String entry = reader.readLine();
while( null != entry )
{
// Skip entries other than the one for this username
if( entry.startsWith( USERNAME ) )
{
... | [
"private",
"static",
"void",
"processPasswdFile",
"(",
"BufferedReader",
"reader",
")",
"throws",
"IOException",
"{",
"String",
"entry",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"null",
"!=",
"entry",
")",
"{",
"// Skip entries other than the... | Process a password file.
@param reader The Reader connected to the password file.
@throws IOException if an underlying I/O problem occurs. | [
"Process",
"a",
"password",
"file",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L450-L473 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.getUnixEnv | private static String getUnixEnv()
throws EnvironmentException
{
File env = new File( "/bin/env" );
if( env.exists() && env.canRead() && env.isFile() )
{
return env.getAbsolutePath();
}
env = new File( "/usr/bin/env" );
if( env.exists() && env.ca... | java | private static String getUnixEnv()
throws EnvironmentException
{
File env = new File( "/bin/env" );
if( env.exists() && env.canRead() && env.isFile() )
{
return env.getAbsolutePath();
}
env = new File( "/usr/bin/env" );
if( env.exists() && env.ca... | [
"private",
"static",
"String",
"getUnixEnv",
"(",
")",
"throws",
"EnvironmentException",
"{",
"File",
"env",
"=",
"new",
"File",
"(",
"\"/bin/env\"",
")",
";",
"if",
"(",
"env",
".",
"exists",
"(",
")",
"&&",
"env",
".",
"canRead",
"(",
")",
"&&",
"env... | Gets the UNIX env executable path.
@return the absolute path to the env program
@throws EnvironmentException if it cannot be found | [
"Gets",
"the",
"UNIX",
"env",
"executable",
"path",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L506-L523 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.processLinesOfEnvironmentVariables | private static void processLinesOfEnvironmentVariables( BufferedReader reader, Properties properties )
throws IOException
{
String line = reader.readLine();
while( null != line )
{
int index = line.indexOf( '=' );
if( -1 == index && line.length() != 0 )
... | java | private static void processLinesOfEnvironmentVariables( BufferedReader reader, Properties properties )
throws IOException
{
String line = reader.readLine();
while( null != line )
{
int index = line.indexOf( '=' );
if( -1 == index && line.length() != 0 )
... | [
"private",
"static",
"void",
"processLinesOfEnvironmentVariables",
"(",
"BufferedReader",
"reader",
",",
"Properties",
"properties",
")",
"throws",
"IOException",
"{",
"String",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"null",
"!=",
"... | Process the lines of the environment variables returned.
@param reader The Reader that containes the lines to be parsed.
@param properties The Properties objects to be populated with the environment variable names and values.
@throws IOException if an underlying I/O problem occurs. | [
"Process",
"the",
"lines",
"of",
"the",
"environment",
"variables",
"returned",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L559-L580 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.startProcess | private static Process startProcess( String[] exec )
throws IOException
{
Process process = Runtime.getRuntime().exec( exec );
return process;
} | java | private static Process startProcess( String[] exec )
throws IOException
{
Process process = Runtime.getRuntime().exec( exec );
return process;
} | [
"private",
"static",
"Process",
"startProcess",
"(",
"String",
"[",
"]",
"exec",
")",
"throws",
"IOException",
"{",
"Process",
"process",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"exec",
")",
";",
"return",
"process",
";",
"}"
] | Starts a OS level process.
@param exec The commandline arguments, including the process to be started.
@return The Process instance.
@throws IOException if an underlying I/O exception occurs. | [
"Starts",
"a",
"OS",
"level",
"process",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L591-L596 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.createReader | private static BufferedReader createReader( Process process )
{
InputStream inputStream = process.getInputStream();
InputStreamReader in = new InputStreamReader( inputStream );
BufferedReader reader = new BufferedReader( in );
return reader;
} | java | private static BufferedReader createReader( Process process )
{
InputStream inputStream = process.getInputStream();
InputStreamReader in = new InputStreamReader( inputStream );
BufferedReader reader = new BufferedReader( in );
return reader;
} | [
"private",
"static",
"BufferedReader",
"createReader",
"(",
"Process",
"process",
")",
"{",
"InputStream",
"inputStream",
"=",
"process",
".",
"getInputStream",
"(",
")",
";",
"InputStreamReader",
"in",
"=",
"new",
"InputStreamReader",
"(",
"inputStream",
")",
";"... | Creates a Reader instance for the process output.
@param process The process to attach the reader to.
@return A Reader attached to the process. | [
"Creates",
"a",
"Reader",
"instance",
"for",
"the",
"process",
"output",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L605-L611 | train |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java | Environment.readEnvironment | private static int readEnvironment( String cmdExec, Properties properties )
{
// fire up the shell and get echo'd results on stdout
BufferedReader reader = null;
Process process = null;
int exitValue = 99;
try
{
String[] args = new String[]{ cmdExec };
... | java | private static int readEnvironment( String cmdExec, Properties properties )
{
// fire up the shell and get echo'd results on stdout
BufferedReader reader = null;
Process process = null;
int exitValue = 99;
try
{
String[] args = new String[]{ cmdExec };
... | [
"private",
"static",
"int",
"readEnvironment",
"(",
"String",
"cmdExec",
",",
"Properties",
"properties",
")",
"{",
"// fire up the shell and get echo'd results on stdout",
"BufferedReader",
"reader",
"=",
"null",
";",
"Process",
"process",
"=",
"null",
";",
"int",
"e... | Reads the environment variables and stores them in a Properties object.
@param cmdExec The command to execute to get hold of the environment variables.
@param properties The Properties object to be populated with the environment variables.
@return The exit value of the OS level process upon its termination. | [
"Reads",
"the",
"environment",
"variables",
"and",
"stores",
"them",
"in",
"a",
"Properties",
"object",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/Environment.java#L621-L654 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesWriter.java | PropertiesWriter.append | public PropertiesWriter append( final String key, final String value )
{
NullArgumentException.validateNotEmpty( key, "Key" );
String valueToAdd = value;
if( value == null )
{
valueToAdd = "";
}
Integer position = m_positions.get( key );
List<Strin... | java | public PropertiesWriter append( final String key, final String value )
{
NullArgumentException.validateNotEmpty( key, "Key" );
String valueToAdd = value;
if( value == null )
{
valueToAdd = "";
}
Integer position = m_positions.get( key );
List<Strin... | [
"public",
"PropertiesWriter",
"append",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"NullArgumentException",
".",
"validateNotEmpty",
"(",
"key",
",",
"\"Key\"",
")",
";",
"String",
"valueToAdd",
"=",
"value",
";",
"if",
"(",
"v... | Appends a property to be written.
@param key key of property
@param value value of property
@return self for a fluent api
@throws NullArgumentException if key is null or empty | [
"Appends",
"a",
"property",
"to",
"be",
"written",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesWriter.java#L103-L148 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesWriter.java | PropertiesWriter.append | public PropertiesWriter append( final String comment )
{
String commentToAdd = "#" + comment;
if( comment == null )
{
commentToAdd = "#";
}
m_content.add( commentToAdd );
return this;
} | java | public PropertiesWriter append( final String comment )
{
String commentToAdd = "#" + comment;
if( comment == null )
{
commentToAdd = "#";
}
m_content.add( commentToAdd );
return this;
} | [
"public",
"PropertiesWriter",
"append",
"(",
"final",
"String",
"comment",
")",
"{",
"String",
"commentToAdd",
"=",
"\"#\"",
"+",
"comment",
";",
"if",
"(",
"comment",
"==",
"null",
")",
"{",
"commentToAdd",
"=",
"\"#\"",
";",
"}",
"m_content",
".",
"add",... | Appends a comment to be written.
@param comment The comment to add to the Properties file.
@return self for a fluent api | [
"Appends",
"a",
"comment",
"to",
"be",
"written",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesWriter.java#L157-L166 | train |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesWriter.java | PropertiesWriter.write | public void write()
throws IOException
{
BufferedWriter writer = new BufferedWriter( new OutputStreamWriter( m_outputStream ) );
for( String line : m_content )
{
writer.write( line );
writer.newLine();
}
writer.flush();
writer.close();
... | java | public void write()
throws IOException
{
BufferedWriter writer = new BufferedWriter( new OutputStreamWriter( m_outputStream ) );
for( String line : m_content )
{
writer.write( line );
writer.newLine();
}
writer.flush();
writer.close();
... | [
"public",
"void",
"write",
"(",
")",
"throws",
"IOException",
"{",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"m_outputStream",
")",
")",
";",
"for",
"(",
"String",
"line",
":",
"m_content",
")",
"{",
"wr... | Write properties to output stream.
@throws java.io.IOException re-thrown from output stream | [
"Write",
"properties",
"to",
"output",
"stream",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesWriter.java#L200-L211 | train |
ops4j/org.ops4j.base | ops4j-base-monitors/src/main/java/org/ops4j/monitors/exception/ExceptionMonitorRouter.java | ExceptionMonitorRouter.exception | public void exception( ExceptionSource source, Throwable exception )
{
synchronized( m_monitors )
{
for( ExceptionMonitor monitor : m_monitors )
{
monitor.exception( source, exception );
}
}
} | java | public void exception( ExceptionSource source, Throwable exception )
{
synchronized( m_monitors )
{
for( ExceptionMonitor monitor : m_monitors )
{
monitor.exception( source, exception );
}
}
} | [
"public",
"void",
"exception",
"(",
"ExceptionSource",
"source",
",",
"Throwable",
"exception",
")",
"{",
"synchronized",
"(",
"m_monitors",
")",
"{",
"for",
"(",
"ExceptionMonitor",
"monitor",
":",
"m_monitors",
")",
"{",
"monitor",
".",
"exception",
"(",
"so... | This method is called when an Exception or Throwable occurs.
@param source The source of the Exception.
@param exception The Exception being thrown. | [
"This",
"method",
"is",
"called",
"when",
"an",
"Exception",
"or",
"Throwable",
"occurs",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-monitors/src/main/java/org/ops4j/monitors/exception/ExceptionMonitorRouter.java#L58-L67 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/DirectoryLister.java | DirectoryLister.matchesIncludes | private boolean matchesIncludes( final String fileName )
{
if( m_includes.length == 0 )
{
return true;
}
for( Pattern include : m_includes )
{
if( include.matcher( fileName ).matches() )
{
return true;
}
... | java | private boolean matchesIncludes( final String fileName )
{
if( m_includes.length == 0 )
{
return true;
}
for( Pattern include : m_includes )
{
if( include.matcher( fileName ).matches() )
{
return true;
}
... | [
"private",
"boolean",
"matchesIncludes",
"(",
"final",
"String",
"fileName",
")",
"{",
"if",
"(",
"m_includes",
".",
"length",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"Pattern",
"include",
":",
"m_includes",
")",
"{",
"if",
"(",
"i... | Checks if the file name matches inclusion patterns.
@param fileName file name to be matched
@return true if matches, false otherwise | [
"Checks",
"if",
"the",
"file",
"name",
"matches",
"inclusion",
"patterns",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/DirectoryLister.java#L118-L132 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/DirectoryLister.java | DirectoryLister.matchesExcludes | private boolean matchesExcludes( final String fileName )
{
for( Pattern include : m_excludes )
{
if( include.matcher( fileName ).matches() )
{
return true;
}
}
return false;
} | java | private boolean matchesExcludes( final String fileName )
{
for( Pattern include : m_excludes )
{
if( include.matcher( fileName ).matches() )
{
return true;
}
}
return false;
} | [
"private",
"boolean",
"matchesExcludes",
"(",
"final",
"String",
"fileName",
")",
"{",
"for",
"(",
"Pattern",
"include",
":",
"m_excludes",
")",
"{",
"if",
"(",
"include",
".",
"matcher",
"(",
"fileName",
")",
".",
"matches",
"(",
")",
")",
"{",
"return"... | Checks if the file name matches exclusion patterns.
@param fileName file name to be matched
@return true if matches, false otherwise | [
"Checks",
"if",
"the",
"file",
"name",
"matches",
"exclusion",
"patterns",
"."
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/DirectoryLister.java#L141-L151 | train |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/DirectoryLister.java | DirectoryLister.listFiles | private List<String> listFiles( final File dir, final String parentName )
{
final List<String> fileNames = new ArrayList<String>();
File[] files = null;
if( dir.canRead() )
{
files = dir.listFiles();
}
if( files != null )
{
for( File fi... | java | private List<String> listFiles( final File dir, final String parentName )
{
final List<String> fileNames = new ArrayList<String>();
File[] files = null;
if( dir.canRead() )
{
files = dir.listFiles();
}
if( files != null )
{
for( File fi... | [
"private",
"List",
"<",
"String",
">",
"listFiles",
"(",
"final",
"File",
"dir",
",",
"final",
"String",
"parentName",
")",
"{",
"final",
"List",
"<",
"String",
">",
"fileNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"File",
"[",
... | Lists recursively files form a directory
@param dir the directory to list
@param parentName name of the parent; to be used in construction the relative path of the returned files
@return a list foi files from the dir and any sub-folders | [
"Lists",
"recursively",
"files",
"form",
"a",
"directory"
] | b0e742c0d9511f6b19ca64da2ebaf30b7a47256a | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/DirectoryLister.java#L161-L184 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.