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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
algermissen/hawkj | src/main/java/net/jalg/hawkj/HawkContext.java | HawkContext.getBaseString | protected String getBaseString() {
StringBuilder sb = new StringBuilder(HAWK_HEADER_PREFIX).append(SLF);
sb.append(getTs()).append(SLF);
sb.append(getNonce()).append(SLF);
sb.append(getMethod()).append(SLF);
sb.append(getPath()).append(SLF);
sb.append(getHost()).append(SLF);
sb.append(getPort()).append(SL... | java | protected String getBaseString() {
StringBuilder sb = new StringBuilder(HAWK_HEADER_PREFIX).append(SLF);
sb.append(getTs()).append(SLF);
sb.append(getNonce()).append(SLF);
sb.append(getMethod()).append(SLF);
sb.append(getPath()).append(SLF);
sb.append(getHost()).append(SLF);
sb.append(getPort()).append(SL... | [
"protected",
"String",
"getBaseString",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"HAWK_HEADER_PREFIX",
")",
".",
"append",
"(",
"SLF",
")",
";",
"sb",
".",
"append",
"(",
"getTs",
"(",
")",
")",
".",
"append",
"(",
"SLF",
... | Generate base string for HMAC generation.
@return | [
"Generate",
"base",
"string",
"for",
"HMAC",
"generation",
"."
] | f798a20f058474bcfe761f7c5c02afee17326c71 | https://github.com/algermissen/hawkj/blob/f798a20f058474bcfe761f7c5c02afee17326c71/src/main/java/net/jalg/hawkj/HawkContext.java#L274-L306 | train |
algermissen/hawkj | src/main/java/net/jalg/hawkj/HawkContext.java | HawkContext.request | public static HawkContextBuilder_B request(String method, String path,
String host, int port) {
return new HawkContextBuilder().method(method).path(path).host(host)
.port(port);
} | java | public static HawkContextBuilder_B request(String method, String path,
String host, int port) {
return new HawkContextBuilder().method(method).path(path).host(host)
.port(port);
} | [
"public",
"static",
"HawkContextBuilder_B",
"request",
"(",
"String",
"method",
",",
"String",
"path",
",",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"new",
"HawkContextBuilder",
"(",
")",
".",
"method",
"(",
"method",
")",
".",
"path",
"("... | Create a new RequestBuilder_A, initialized with request data.
@param method
@param path
@param host
@param port
@return | [
"Create",
"a",
"new",
"RequestBuilder_A",
"initialized",
"with",
"request",
"data",
"."
] | f798a20f058474bcfe761f7c5c02afee17326c71 | https://github.com/algermissen/hawkj/blob/f798a20f058474bcfe761f7c5c02afee17326c71/src/main/java/net/jalg/hawkj/HawkContext.java#L369-L373 | train |
svanoort/rest-compress | demo-app/src/main/java/com/restcompress/demoapp/RestDemoApp.java | RestDemoApp.decompress | @Override
public byte[] decompress(InputStream strm) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
LZFInputStream in = new LZFInputStream(strm);
byte[] buffer = new byte[8192];
int len = 0;
//Decode and copy to output
... | java | @Override
public byte[] decompress(InputStream strm) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
LZFInputStream in = new LZFInputStream(strm);
byte[] buffer = new byte[8192];
int len = 0;
//Decode and copy to output
... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"decompress",
"(",
"InputStream",
"strm",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"LZFInputStream",
"in",
"=",
"new",
"LZFInputStream",
"(",
"strm",... | Attempts to decompress an LZF stream
@param strm
@return | [
"Attempts",
"to",
"decompress",
"an",
"LZF",
"stream"
] | 4e34fcbe0d1b510962a93509a78b6a8ade234606 | https://github.com/svanoort/rest-compress/blob/4e34fcbe0d1b510962a93509a78b6a8ade234606/demo-app/src/main/java/com/restcompress/demoapp/RestDemoApp.java#L119-L136 | train |
svanoort/rest-compress | demo-app/src/main/java/com/restcompress/demoapp/RestDemoApp.java | RestDemoApp.getRandomDate | public static GregorianCalendar getRandomDate(long seed) {
GregorianCalendar gc = new GregorianCalendar();
Random rand = new Random(seed);
gc.set(GregorianCalendar.YEAR,1900+rand.nextInt(120)); //Between 1900 & 2020
gc.set(GregorianCalendar.DAY_OF_YEAR,rand.nextInt(364)+1); //Day of year... | java | public static GregorianCalendar getRandomDate(long seed) {
GregorianCalendar gc = new GregorianCalendar();
Random rand = new Random(seed);
gc.set(GregorianCalendar.YEAR,1900+rand.nextInt(120)); //Between 1900 & 2020
gc.set(GregorianCalendar.DAY_OF_YEAR,rand.nextInt(364)+1); //Day of year... | [
"public",
"static",
"GregorianCalendar",
"getRandomDate",
"(",
"long",
"seed",
")",
"{",
"GregorianCalendar",
"gc",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"Random",
"rand",
"=",
"new",
"Random",
"(",
"seed",
")",
";",
"gc",
".",
"set",
"(",
"Grego... | Gets a random date in the last 100 years | [
"Gets",
"a",
"random",
"date",
"in",
"the",
"last",
"100",
"years"
] | 4e34fcbe0d1b510962a93509a78b6a8ade234606 | https://github.com/svanoort/rest-compress/blob/4e34fcbe0d1b510962a93509a78b6a8ade234606/demo-app/src/main/java/com/restcompress/demoapp/RestDemoApp.java#L179-L185 | train |
nikkiii/embedhttp | src/main/java/org/nikkii/embedhttp/impl/HttpRequest.java | HttpRequest.setCookies | public void setCookies(List<HttpCookie> cookies) {
Map<String, HttpCookie> map = new HashMap<String, HttpCookie>();
for (HttpCookie cookie : cookies) {
map.put(cookie.getName(), cookie);
}
this.cookies = map;
} | java | public void setCookies(List<HttpCookie> cookies) {
Map<String, HttpCookie> map = new HashMap<String, HttpCookie>();
for (HttpCookie cookie : cookies) {
map.put(cookie.getName(), cookie);
}
this.cookies = map;
} | [
"public",
"void",
"setCookies",
"(",
"List",
"<",
"HttpCookie",
">",
"cookies",
")",
"{",
"Map",
"<",
"String",
",",
"HttpCookie",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"HttpCookie",
">",
"(",
")",
";",
"for",
"(",
"HttpCookie",
"cooki... | Set the request's cookies
@param cookies The cookie list | [
"Set",
"the",
"request",
"s",
"cookies"
] | 7c965b6910dc6ee4ea46d7ae188c0751b98c2615 | https://github.com/nikkiii/embedhttp/blob/7c965b6910dc6ee4ea46d7ae188c0751b98c2615/src/main/java/org/nikkii/embedhttp/impl/HttpRequest.java#L209-L215 | train |
canhnt/sne-xacml | sne-xacml/src/main/java/nl/uva/sne/midd/partition/PartitionBuilder.java | PartitionBuilder.combine | private static <T extends Comparable<T>> List<Interval<T>> combine(Partition<T> p1, Partition<T> p2) throws MIDDException {
Set<EndPoint<T>> boundSet = new HashSet<EndPoint<T>>();
//collect all bounds and remove duplicated items
for (Interval<T> interval : p1.getIntervals()) {
boun... | java | private static <T extends Comparable<T>> List<Interval<T>> combine(Partition<T> p1, Partition<T> p2) throws MIDDException {
Set<EndPoint<T>> boundSet = new HashSet<EndPoint<T>>();
//collect all bounds and remove duplicated items
for (Interval<T> interval : p1.getIntervals()) {
boun... | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"List",
"<",
"Interval",
"<",
"T",
">",
">",
"combine",
"(",
"Partition",
"<",
"T",
">",
"p1",
",",
"Partition",
"<",
"T",
">",
"p2",
")",
"throws",
"MIDDException",
"{",
"... | Create a list of intervals from two partitions
@param p1
@param p2
@return | [
"Create",
"a",
"list",
"of",
"intervals",
"from",
"two",
"partitions"
] | 7ffca16bf558d2c3ee16181d926f066ab1de75b2 | https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/partition/PartitionBuilder.java#L209-L245 | train |
canhnt/sne-xacml | sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java | Interval.complement | public List<Interval<T>> complement(final Interval<T> op) throws MIDDException {
final boolean disJoined = (this.lowerBound.compareTo(op.upperBound) >= 0) ||
(this.upperBound.compareTo(op.lowerBound) <= 0);
if (disJoined) {
Interval<T> newInterval = new Interval<>(this.lowe... | java | public List<Interval<T>> complement(final Interval<T> op) throws MIDDException {
final boolean disJoined = (this.lowerBound.compareTo(op.upperBound) >= 0) ||
(this.upperBound.compareTo(op.lowerBound) <= 0);
if (disJoined) {
Interval<T> newInterval = new Interval<>(this.lowe... | [
"public",
"List",
"<",
"Interval",
"<",
"T",
">",
">",
"complement",
"(",
"final",
"Interval",
"<",
"T",
">",
"op",
")",
"throws",
"MIDDException",
"{",
"final",
"boolean",
"disJoined",
"=",
"(",
"this",
".",
"lowerBound",
".",
"compareTo",
"(",
"op",
... | Return the complement section of the interval.
@param op
@return The complemented interval(s), or an empty list if the complement is empty. | [
"Return",
"the",
"complement",
"section",
"of",
"the",
"interval",
"."
] | 7ffca16bf558d2c3ee16181d926f066ab1de75b2 | https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java#L123-L171 | train |
canhnt/sne-xacml | sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java | Interval.contains | public boolean contains(final Interval<T> i) {
int compareLow, compareUp;
compareLow = this.lowerBound.compareTo(i.lowerBound);
compareUp = this.upperBound.compareTo(i.upperBound);
if (compareLow < 0) {
// check the upper bound
if (compareUp > 0) {
... | java | public boolean contains(final Interval<T> i) {
int compareLow, compareUp;
compareLow = this.lowerBound.compareTo(i.lowerBound);
compareUp = this.upperBound.compareTo(i.upperBound);
if (compareLow < 0) {
// check the upper bound
if (compareUp > 0) {
... | [
"public",
"boolean",
"contains",
"(",
"final",
"Interval",
"<",
"T",
">",
"i",
")",
"{",
"int",
"compareLow",
",",
"compareUp",
";",
"compareLow",
"=",
"this",
".",
"lowerBound",
".",
"compareTo",
"(",
"i",
".",
"lowerBound",
")",
";",
"compareUp",
"=",
... | Return true if interval in the argument is the subset of the current interval.
@param i
@return | [
"Return",
"true",
"if",
"interval",
"in",
"the",
"argument",
"is",
"the",
"subset",
"of",
"the",
"current",
"interval",
"."
] | 7ffca16bf558d2c3ee16181d926f066ab1de75b2 | https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java#L179-L207 | train |
canhnt/sne-xacml | sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java | Interval.hasValue | public boolean hasValue(final T value) throws MIDDException {
//special processing when missing attribute
if (value == null) {
return this.isLowerInfinite() || this.isUpperInfinite();
}
EndPoint<T> epValue = new EndPoint<>(value);
int compareLow = this.lowerBound.... | java | public boolean hasValue(final T value) throws MIDDException {
//special processing when missing attribute
if (value == null) {
return this.isLowerInfinite() || this.isUpperInfinite();
}
EndPoint<T> epValue = new EndPoint<>(value);
int compareLow = this.lowerBound.... | [
"public",
"boolean",
"hasValue",
"(",
"final",
"T",
"value",
")",
"throws",
"MIDDException",
"{",
"//special processing when missing attribute",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"this",
".",
"isLowerInfinite",
"(",
")",
"||",
"this",
".",
... | Check if the value is presenting in the interval.
@param value
@return | [
"Check",
"if",
"the",
"value",
"is",
"presenting",
"in",
"the",
"interval",
"."
] | 7ffca16bf558d2c3ee16181d926f066ab1de75b2 | https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java#L271-L290 | train |
canhnt/sne-xacml | sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java | Interval.of | public static <T extends Comparable<T>> Interval<T> of(final T v) throws MIDDException {
return new Interval(v);
} | java | public static <T extends Comparable<T>> Interval<T> of(final T v) throws MIDDException {
return new Interval(v);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Interval",
"<",
"T",
">",
"of",
"(",
"final",
"T",
"v",
")",
"throws",
"MIDDException",
"{",
"return",
"new",
"Interval",
"(",
"v",
")",
";",
"}"
] | Create an interval with a single endpoint
@param v
@param <T>
@return
@throws MIDDException | [
"Create",
"an",
"interval",
"with",
"a",
"single",
"endpoint"
] | 7ffca16bf558d2c3ee16181d926f066ab1de75b2 | https://github.com/canhnt/sne-xacml/blob/7ffca16bf558d2c3ee16181d926f066ab1de75b2/sne-xacml/src/main/java/nl/uva/sne/midd/interval/Interval.java#L493-L495 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/CommandLogDispatcher.java | CommandLogDispatcher.logLocalCommands | public void logLocalCommands(final List<Command> commands) {
if (singleValue == null) {
return;
}
for (final Command command : commands) {
if (command instanceof SetPropertyValue) {
singleValue.logLocalCommand((SetPropertyValue) command);
} els... | java | public void logLocalCommands(final List<Command> commands) {
if (singleValue == null) {
return;
}
for (final Command command : commands) {
if (command instanceof SetPropertyValue) {
singleValue.logLocalCommand((SetPropertyValue) command);
} els... | [
"public",
"void",
"logLocalCommands",
"(",
"final",
"List",
"<",
"Command",
">",
"commands",
")",
"{",
"if",
"(",
"singleValue",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"final",
"Command",
"command",
":",
"commands",
")",
"{",
"if",
"("... | Logs a list of locally generated commands that is sent to the server.
@param commands
The commands that where send. | [
"Logs",
"a",
"list",
"of",
"locally",
"generated",
"commands",
"that",
"is",
"sent",
"to",
"the",
"server",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/CommandLogDispatcher.java#L72-L83 | train |
tvbarthel/Cheerleader | sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ui/TrackView.java | TrackView.setModel | public void setModel(SoundCloudTrack track) {
mModel = track;
if (mModel != null) {
Picasso.with(getContext())
.load(SoundCloudArtworkHelper.getArtworkUrl(mModel, SoundCloudArtworkHelper.XLARGE))
.placeholder(R.color.grey_light)
.fi... | java | public void setModel(SoundCloudTrack track) {
mModel = track;
if (mModel != null) {
Picasso.with(getContext())
.load(SoundCloudArtworkHelper.getArtworkUrl(mModel, SoundCloudArtworkHelper.XLARGE))
.placeholder(R.color.grey_light)
.fi... | [
"public",
"void",
"setModel",
"(",
"SoundCloudTrack",
"track",
")",
"{",
"mModel",
"=",
"track",
";",
"if",
"(",
"mModel",
"!=",
"null",
")",
"{",
"Picasso",
".",
"with",
"(",
"getContext",
"(",
")",
")",
".",
"load",
"(",
"SoundCloudArtworkHelper",
".",... | Set the track which must be displayed.
@param track view model. | [
"Set",
"the",
"track",
"which",
"must",
"be",
"displayed",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ui/TrackView.java#L96-L111 | train |
tvbarthel/Cheerleader | sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ui/PlaybackView.java | PlaybackView.setTrack | private void setTrack(SoundCloudTrack track) {
if (track == null) {
mTitle.setText("");
mArtwork.setImageDrawable(null);
mPlayPause.setImageResource(R.drawable.ic_play_white);
mSeekBar.setProgress(0);
String none = String.format(getResources().getStrin... | java | private void setTrack(SoundCloudTrack track) {
if (track == null) {
mTitle.setText("");
mArtwork.setImageDrawable(null);
mPlayPause.setImageResource(R.drawable.ic_play_white);
mSeekBar.setProgress(0);
String none = String.format(getResources().getStrin... | [
"private",
"void",
"setTrack",
"(",
"SoundCloudTrack",
"track",
")",
"{",
"if",
"(",
"track",
"==",
"null",
")",
"{",
"mTitle",
".",
"setText",
"(",
"\"\"",
")",
";",
"mArtwork",
".",
"setImageDrawable",
"(",
"null",
")",
";",
"mPlayPause",
".",
"setImag... | Set the current played track.
@param track track which is played. | [
"Set",
"the",
"current",
"played",
"track",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/sample/src/main/java/fr/tvbarthel/cheerleader/sampleapp/ui/PlaybackView.java#L229-L259 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/FinalFlags.java | FinalFlags.getFinalReason | public String getFinalReason(Path path) {
StringBuilder sb = new StringBuilder(path + " cannot be modified; ");
StringBuilder finalPath = new StringBuilder("/");
// Step through the nodes based on the given path. If any intermediate
// nodes are marked as final, we can just return true.
Node currentNode = r... | java | public String getFinalReason(Path path) {
StringBuilder sb = new StringBuilder(path + " cannot be modified; ");
StringBuilder finalPath = new StringBuilder("/");
// Step through the nodes based on the given path. If any intermediate
// nodes are marked as final, we can just return true.
Node currentNode = r... | [
"public",
"String",
"getFinalReason",
"(",
"Path",
"path",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"path",
"+",
"\" cannot be modified; \"",
")",
";",
"StringBuilder",
"finalPath",
"=",
"new",
"StringBuilder",
"(",
"\"/\"",
")",
";",
... | Return a String with a message indicating why the given path is final.
@param path
Path to check
@return String reason why the path is final or null if the path isn't
final | [
"Return",
"a",
"String",
"with",
"a",
"message",
"indicating",
"why",
"the",
"given",
"path",
"is",
"final",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/FinalFlags.java#L89-L126 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/FinalFlags.java | FinalFlags.setFinal | public void setFinal(Path path) {
// Step through the nodes creating any nodes which don't exist.
Node currentNode = root;
for (Term t : path.getTerms()) {
Node nextNode = currentNode.getChild(t);
if (nextNode == null) {
nextNode = currentNode.newChild(t);
}
currentNode = nextNode;
}
// The ... | java | public void setFinal(Path path) {
// Step through the nodes creating any nodes which don't exist.
Node currentNode = root;
for (Term t : path.getTerms()) {
Node nextNode = currentNode.getChild(t);
if (nextNode == null) {
nextNode = currentNode.newChild(t);
}
currentNode = nextNode;
}
// The ... | [
"public",
"void",
"setFinal",
"(",
"Path",
"path",
")",
"{",
"// Step through the nodes creating any nodes which don't exist.",
"Node",
"currentNode",
"=",
"root",
";",
"for",
"(",
"Term",
"t",
":",
"path",
".",
"getTerms",
"(",
")",
")",
"{",
"Node",
"nextNode"... | Mark the given Path as being final.
@param path
Path to mark as final | [
"Mark",
"the",
"given",
"Path",
"as",
"being",
"final",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/FinalFlags.java#L134-L149 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/Path.java | Path.toList | public List<String> toList() {
List<String> list = new LinkedList<String>();
if (authority != null) {
list.add(authority);
}
for (Term t : terms) {
list.add(t.toString());
}
return list;
} | java | public List<String> toList() {
List<String> list = new LinkedList<String>();
if (authority != null) {
list.add(authority);
}
for (Term t : terms) {
list.add(t.toString());
}
return list;
} | [
"public",
"List",
"<",
"String",
">",
"toList",
"(",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"authority",
"!=",
"null",
")",
"{",
"list",
".",
"add",
"(",
"authority",
... | This method returns the Path as an unmodifiable list of the terms
comprising the Path. | [
"This",
"method",
"returns",
"the",
"Path",
"as",
"an",
"unmodifiable",
"list",
"of",
"the",
"terms",
"comprising",
"the",
"Path",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/Path.java#L240-L249 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/Path.java | Path.compareTo | public int compareTo(Path o) {
// Sanity check.
if (o == null) {
throw new NullPointerException();
}
// If these are not the same type, do the simple comparison.
if (this.type != o.type) {
return type.compareTo(o.type);
}
// Same type of... | java | public int compareTo(Path o) {
// Sanity check.
if (o == null) {
throw new NullPointerException();
}
// If these are not the same type, do the simple comparison.
if (this.type != o.type) {
return type.compareTo(o.type);
}
// Same type of... | [
"public",
"int",
"compareTo",
"(",
"Path",
"o",
")",
"{",
"// Sanity check.",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"// If these are not the same type, do the simple comparison.",
"if",
"(",
"this",
"... | The default ordering for paths is such that it will produce a
post-traversal ordering. All relative paths will be before absolute paths
which are before external paths. | [
"The",
"default",
"ordering",
"for",
"paths",
"is",
"such",
"that",
"it",
"will",
"produce",
"a",
"post",
"-",
"traversal",
"ordering",
".",
"All",
"relative",
"paths",
"will",
"be",
"before",
"absolute",
"paths",
"which",
"are",
"before",
"external",
"paths... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/Path.java#L404-L439 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionReceiver.java | MediaSessionReceiver.sendAction | private void sendAction(Context context, String action) {
Intent intent = new Intent(context, PlaybackService.class);
intent.setAction(action);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} | java | private void sendAction(Context context, String action) {
Intent intent = new Intent(context, PlaybackService.class);
intent.setAction(action);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} | [
"private",
"void",
"sendAction",
"(",
"Context",
"context",
",",
"String",
"action",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"PlaybackService",
".",
"class",
")",
";",
"intent",
".",
"setAction",
"(",
"action",
")",
";",
... | Propagate lock screen event to the player.
@param context context used to start service.
@param action action to send. | [
"Propagate",
"lock",
"screen",
"event",
"to",
"the",
"player",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionReceiver.java#L58-L62 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/CompilerStatistics.java | CompilerStatistics.updateMemoryInfo | public void updateMemoryInfo() {
MemoryMXBean meminfo = ManagementFactory.getMemoryMXBean();
MemoryUsage usage = meminfo.getHeapMemoryUsage();
long _heapUsed = usage.getUsed();
updateMaximum(heapUsed, _heapUsed);
updateMaximum(heapTotal, usage.getMax());
usage = meminfo.getNonHeapMemoryUsage();
updateM... | java | public void updateMemoryInfo() {
MemoryMXBean meminfo = ManagementFactory.getMemoryMXBean();
MemoryUsage usage = meminfo.getHeapMemoryUsage();
long _heapUsed = usage.getUsed();
updateMaximum(heapUsed, _heapUsed);
updateMaximum(heapTotal, usage.getMax());
usage = meminfo.getNonHeapMemoryUsage();
updateM... | [
"public",
"void",
"updateMemoryInfo",
"(",
")",
"{",
"MemoryMXBean",
"meminfo",
"=",
"ManagementFactory",
".",
"getMemoryMXBean",
"(",
")",
";",
"MemoryUsage",
"usage",
"=",
"meminfo",
".",
"getHeapMemoryUsage",
"(",
")",
";",
"long",
"_heapUsed",
"=",
"usage",
... | Take a snapshot of the current memory usage of the JVM and update the
high-water marks. | [
"Take",
"a",
"snapshot",
"of",
"the",
"current",
"memory",
"usage",
"of",
"the",
"JVM",
"and",
"update",
"the",
"high",
"-",
"water",
"marks",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerStatistics.java#L122-L141 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/CompilerStatistics.java | CompilerStatistics.updateMaximum | private static void updateMaximum(AtomicLong counter, long currentValue) {
boolean unset = true;
long counterValue = counter.get();
while ((currentValue > counterValue) && unset) {
unset = !counter.compareAndSet(counterValue, currentValue);
counterValue = counter.get();
}
} | java | private static void updateMaximum(AtomicLong counter, long currentValue) {
boolean unset = true;
long counterValue = counter.get();
while ((currentValue > counterValue) && unset) {
unset = !counter.compareAndSet(counterValue, currentValue);
counterValue = counter.get();
}
} | [
"private",
"static",
"void",
"updateMaximum",
"(",
"AtomicLong",
"counter",
",",
"long",
"currentValue",
")",
"{",
"boolean",
"unset",
"=",
"true",
";",
"long",
"counterValue",
"=",
"counter",
".",
"get",
"(",
")",
";",
"while",
"(",
"(",
"currentValue",
"... | Compares the current value against the value of the counter and updates
the counter if the current value is greater. This is done in a way to
ensure that no updates are lost.
@param counter
AtomicLong counter to update
@param currentValue
current value of the counter | [
"Compares",
"the",
"current",
"value",
"against",
"the",
"value",
"of",
"the",
"counter",
"and",
"updates",
"the",
"counter",
"if",
"the",
"current",
"value",
"is",
"greater",
".",
"This",
"is",
"done",
"in",
"a",
"way",
"to",
"ensure",
"that",
"no",
"up... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerStatistics.java#L153-L160 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/CompilerStatistics.java | CompilerStatistics.getResults | public String getResults(long totalErrors) {
Object[] info = { fileCount, doneTasks.get(COMPILED).get(),
startedTasks.get(COMPILED).get(),
doneTasks.get(ANNOTATION).get(),
startedTasks.get(ANNOTATION).get(), doneTasks.get(XML).get(),
startedTasks.get(XML).get(), doneTasks.get(DEP).get(),
startedT... | java | public String getResults(long totalErrors) {
Object[] info = { fileCount, doneTasks.get(COMPILED).get(),
startedTasks.get(COMPILED).get(),
doneTasks.get(ANNOTATION).get(),
startedTasks.get(ANNOTATION).get(), doneTasks.get(XML).get(),
startedTasks.get(XML).get(), doneTasks.get(DEP).get(),
startedT... | [
"public",
"String",
"getResults",
"(",
"long",
"totalErrors",
")",
"{",
"Object",
"[",
"]",
"info",
"=",
"{",
"fileCount",
",",
"doneTasks",
".",
"get",
"(",
"COMPILED",
")",
".",
"get",
"(",
")",
",",
"startedTasks",
".",
"get",
"(",
"COMPILED",
")",
... | Generates a terse String representation of the statistics.
@param totalErrors total number of errors that have occurred
@return statistics as a String value | [
"Generates",
"a",
"terse",
"String",
"representation",
"of",
"the",
"statistics",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerStatistics.java#L168-L180 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/clientserver/DomainModelServer.java | DomainModelServer.onConnect | @Override
public void onConnect(final Object newClient) {
meta.commandsForDomainModel(new CommandsForDomainModelCallback() {
@Override
public void commandsReady(final List<Command> commands) {
networkLayer.onConnectFinished(newClient);
networkLayer.sen... | java | @Override
public void onConnect(final Object newClient) {
meta.commandsForDomainModel(new CommandsForDomainModelCallback() {
@Override
public void commandsReady(final List<Command> commands) {
networkLayer.onConnectFinished(newClient);
networkLayer.sen... | [
"@",
"Override",
"public",
"void",
"onConnect",
"(",
"final",
"Object",
"newClient",
")",
"{",
"meta",
".",
"commandsForDomainModel",
"(",
"new",
"CommandsForDomainModelCallback",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"commandsReady",
"(",
"final",
"... | Sends the current domain model to a newly connecting client.
@param newClient An object that represent the new client that connected.
@see IncommingEventHandlerServer#onConnect(Object) | [
"Sends",
"the",
"current",
"domain",
"model",
"to",
"a",
"newly",
"connecting",
"client",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/clientserver/DomainModelServer.java#L167-L179 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/clientserver/DomainModelServer.java | DomainModelServer.onClientConnectionError | @Override
public void onClientConnectionError(final Object client, final SynchronizeFXException e) {
serverCallback.onClientConnectionError(client, e);
} | java | @Override
public void onClientConnectionError(final Object client, final SynchronizeFXException e) {
serverCallback.onClientConnectionError(client, e);
} | [
"@",
"Override",
"public",
"void",
"onClientConnectionError",
"(",
"final",
"Object",
"client",
",",
"final",
"SynchronizeFXException",
"e",
")",
"{",
"serverCallback",
".",
"onClientConnectionError",
"(",
"client",
",",
"e",
")",
";",
"}"
] | Logs the unexpected disconnection of an client.
Connection errors to single clients are usually non fatal. The server can still work correctly for the other
clients. Because of that this type of error is just logged here and not passed to the user.
@param client An object that represent the client where the error occ... | [
"Logs",
"the",
"unexpected",
"disconnection",
"of",
"an",
"client",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/clientserver/DomainModelServer.java#L191-L194 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/type/RecordType.java | RecordType.removeDefinedFields | private void removeDefinedFields(Context context, List<Term> undefinedFields)
throws ValidationException {
// Loop through all of the required and optional fields removing each
// from the list of undefined fields.
for (Term term : reqKeys) {
undefinedFields.remove(term);
}
for (Term term : optKeys) {
... | java | private void removeDefinedFields(Context context, List<Term> undefinedFields)
throws ValidationException {
// Loop through all of the required and optional fields removing each
// from the list of undefined fields.
for (Term term : reqKeys) {
undefinedFields.remove(term);
}
for (Term term : optKeys) {
... | [
"private",
"void",
"removeDefinedFields",
"(",
"Context",
"context",
",",
"List",
"<",
"Term",
">",
"undefinedFields",
")",
"throws",
"ValidationException",
"{",
"// Loop through all of the required and optional fields removing each",
"// from the list of undefined fields.",
"for... | This method will loop through all of the fields defined in this record
and remove them from the given list. This is used in the validation of
the fields.
@param context
ObjectContext to use to look up included type definitions
@param undefinedFields
List containing the field names to check; defined fields are
removed ... | [
"This",
"method",
"will",
"loop",
"through",
"all",
"of",
"the",
"fields",
"defined",
"in",
"this",
"record",
"and",
"remove",
"them",
"from",
"the",
"given",
"list",
".",
"This",
"is",
"used",
"in",
"the",
"validation",
"of",
"the",
"fields",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/type/RecordType.java#L317-L352 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/CompilerLogging.java | CompilerLogging.activateLoggers | public static void activateLoggers(String loggerList) {
// Create an empty set. This will contain the list of all of the loggers
// to activate. (Note that NONE may be a logger; in this case, all
// logging will be deactivated.)
EnumSet<LoggingType> flags = EnumSet.noneOf(LoggingType.class);
// Split on com... | java | public static void activateLoggers(String loggerList) {
// Create an empty set. This will contain the list of all of the loggers
// to activate. (Note that NONE may be a logger; in this case, all
// logging will be deactivated.)
EnumSet<LoggingType> flags = EnumSet.noneOf(LoggingType.class);
// Split on com... | [
"public",
"static",
"void",
"activateLoggers",
"(",
"String",
"loggerList",
")",
"{",
"// Create an empty set. This will contain the list of all of the loggers",
"// to activate. (Note that NONE may be a logger; in this case, all",
"// logging will be deactivated.)",
"EnumSet",
"<",
"Log... | Enable the given types of logging. Note that NONE will take precedence
over active logging flags and turn all logging off. Illegal logging
values will be silently ignored.
@param loggerList
a comma-separated list of logging types to enable | [
"Enable",
"the",
"given",
"types",
"of",
"logging",
".",
"Note",
"that",
"NONE",
"will",
"take",
"precedence",
"over",
"active",
"logging",
"flags",
"and",
"turn",
"all",
"logging",
"off",
".",
"Illegal",
"logging",
"values",
"will",
"be",
"silently",
"ignor... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerLogging.java#L134-L154 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/CompilerLogging.java | CompilerLogging.initializeLogger | private static void initializeLogger(Logger logger) {
// Do NOT send any logging information to parent loggers.
topLogger.setUseParentHandlers(false);
// Remove any existing handlers.
for (Handler handler : topLogger.getHandlers()) {
try {
topLogger.removeHandler(handler);
} catch (SecurityException... | java | private static void initializeLogger(Logger logger) {
// Do NOT send any logging information to parent loggers.
topLogger.setUseParentHandlers(false);
// Remove any existing handlers.
for (Handler handler : topLogger.getHandlers()) {
try {
topLogger.removeHandler(handler);
} catch (SecurityException... | [
"private",
"static",
"void",
"initializeLogger",
"(",
"Logger",
"logger",
")",
"{",
"// Do NOT send any logging information to parent loggers.",
"topLogger",
".",
"setUseParentHandlers",
"(",
"false",
")",
";",
"// Remove any existing handlers.",
"for",
"(",
"Handler",
"han... | Remove all handlers associated with the given logger. | [
"Remove",
"all",
"handlers",
"associated",
"with",
"the",
"given",
"logger",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerLogging.java#L159-L174 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/CompilerLogging.java | CompilerLogging.setLogFile | public synchronized static void setLogFile(File logfile) {
// Add a file logger that will use the compiler's customized
// formatter. This formatter provides a terse representation of the
// logging information.
try {
if (logfile != null) {
String absolutePath = logfile.getAbsolutePath();
if (initia... | java | public synchronized static void setLogFile(File logfile) {
// Add a file logger that will use the compiler's customized
// formatter. This formatter provides a terse representation of the
// logging information.
try {
if (logfile != null) {
String absolutePath = logfile.getAbsolutePath();
if (initia... | [
"public",
"synchronized",
"static",
"void",
"setLogFile",
"(",
"File",
"logfile",
")",
"{",
"// Add a file logger that will use the compiler's customized",
"// formatter. This formatter provides a terse representation of the",
"// logging information.",
"try",
"{",
"if",
"(",
"logf... | Define the file that will contain the logging information. If this is
called with null, then the log file will be removed. The log file and
logging parameters are global to the JVM. Interference is possible
between multiple threads.
@param logfile File indicating the log file to use | [
"Define",
"the",
"file",
"that",
"will",
"contain",
"the",
"logging",
"information",
".",
"If",
"this",
"is",
"called",
"with",
"null",
"then",
"the",
"log",
"file",
"will",
"be",
"removed",
".",
"The",
"log",
"file",
"and",
"logging",
"parameters",
"are",... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerLogging.java#L184-L218 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java | OfflinerQueryHandler.put | public void put(String url, String result) {
if (TextUtils.isEmpty(url)) {
return;
}
ContentValues contentValues = new ContentValues();
contentValues.put(OfflinerDBHelper.REQUEST_RESULT, result);
contentValues.put(OfflinerDBHelper.REQUEST_URL, url);
contentVa... | java | public void put(String url, String result) {
if (TextUtils.isEmpty(url)) {
return;
}
ContentValues contentValues = new ContentValues();
contentValues.put(OfflinerDBHelper.REQUEST_RESULT, result);
contentValues.put(OfflinerDBHelper.REQUEST_URL, url);
contentVa... | [
"public",
"void",
"put",
"(",
"String",
"url",
",",
"String",
"result",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
";",
"}",
"ContentValues",
"contentValues",
"=",
"new",
"ContentValues",
"(",
")",
";",
"cont... | Save a result for offline access.
@param url key.
@param result value. | [
"Save",
"a",
"result",
"for",
"offline",
"access",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java#L146-L165 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java | OfflinerQueryHandler.get | public String get(Context context, String url) {
final Cursor cursor = context.getContentResolver().query(getUri(OfflinerDBHelper.TABLE_CACHE),
OfflinerDBHelper.PARAMS_CACHE, OfflinerDBHelper.REQUEST_URL
+ " = '" + url + "'", null, null);
String result = null;
... | java | public String get(Context context, String url) {
final Cursor cursor = context.getContentResolver().query(getUri(OfflinerDBHelper.TABLE_CACHE),
OfflinerDBHelper.PARAMS_CACHE, OfflinerDBHelper.REQUEST_URL
+ " = '" + url + "'", null, null);
String result = null;
... | [
"public",
"String",
"get",
"(",
"Context",
"context",
",",
"String",
"url",
")",
"{",
"final",
"Cursor",
"cursor",
"=",
"context",
".",
"getContentResolver",
"(",
")",
".",
"query",
"(",
"getUri",
"(",
"OfflinerDBHelper",
".",
"TABLE_CACHE",
")",
",",
"Off... | Retrieve a value saved for offline access.
@param context context used to retrieve the content resolver.
@param url key.
@return retrieved value or null if no entry match the given key. | [
"Retrieve",
"a",
"value",
"saved",
"for",
"offline",
"access",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java#L174-L189 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java | OfflinerQueryHandler.getUri | private Uri getUri(String string) {
return Uri.parse(OfflinerProvider.CONTENT + OfflinerProvider.getAuthority(mPackageName)
+ OfflinerProvider.SLASH + string);
} | java | private Uri getUri(String string) {
return Uri.parse(OfflinerProvider.CONTENT + OfflinerProvider.getAuthority(mPackageName)
+ OfflinerProvider.SLASH + string);
} | [
"private",
"Uri",
"getUri",
"(",
"String",
"string",
")",
"{",
"return",
"Uri",
".",
"parse",
"(",
"OfflinerProvider",
".",
"CONTENT",
"+",
"OfflinerProvider",
".",
"getAuthority",
"(",
"mPackageName",
")",
"+",
"OfflinerProvider",
".",
"SLASH",
"+",
"string",... | Retrieve the URI with Cache database provider authority.
@param string ends of the URI.
@return full build URI. | [
"Retrieve",
"the",
"URI",
"with",
"Cache",
"database",
"provider",
"authority",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java#L197-L200 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/remote/RemoteControlClientCompat.java | RemoteControlClientCompat.setPlaybackState | public void setPlaybackState(int state) {
if (sHasRemoteControlAPIs) {
try {
sRCCSetPlayStateMethod.invoke(mActualRemoteControlClient, state);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | java | public void setPlaybackState(int state) {
if (sHasRemoteControlAPIs) {
try {
sRCCSetPlayStateMethod.invoke(mActualRemoteControlClient, state);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | [
"public",
"void",
"setPlaybackState",
"(",
"int",
"state",
")",
"{",
"if",
"(",
"sHasRemoteControlAPIs",
")",
"{",
"try",
"{",
"sRCCSetPlayStateMethod",
".",
"invoke",
"(",
"mActualRemoteControlClient",
",",
"state",
")",
";",
"}",
"catch",
"(",
"Exception",
"... | Sets the current playback state.
@param state The current playback state, one of the following values:
{@link android.media.RemoteControlClient#PLAYSTATE_STOPPED},
{@link android.media.RemoteControlClient#PLAYSTATE_PAUSED},
{@link android.media.RemoteControlClient#PLAYSTATE_PLAYING},
{@link android.media.RemoteControl... | [
"Sets",
"the",
"current",
"playback",
"state",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/remote/RemoteControlClientCompat.java#L325-L333 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/remote/RemoteControlClientCompat.java | RemoteControlClientCompat.setTransportControlFlags | public void setTransportControlFlags(int transportControlFlags) {
if (sHasRemoteControlAPIs) {
try {
sRCCSetTransportControlFlags.invoke(mActualRemoteControlClient,
transportControlFlags);
} catch (Exception e) {
throw new RuntimeEx... | java | public void setTransportControlFlags(int transportControlFlags) {
if (sHasRemoteControlAPIs) {
try {
sRCCSetTransportControlFlags.invoke(mActualRemoteControlClient,
transportControlFlags);
} catch (Exception e) {
throw new RuntimeEx... | [
"public",
"void",
"setTransportControlFlags",
"(",
"int",
"transportControlFlags",
")",
"{",
"if",
"(",
"sHasRemoteControlAPIs",
")",
"{",
"try",
"{",
"sRCCSetTransportControlFlags",
".",
"invoke",
"(",
"mActualRemoteControlClient",
",",
"transportControlFlags",
")",
";... | Sets the flags for the media transport control buttons that this client supports.
@param transportControlFlags A combination of the following flags:
{@link android.media.RemoteControlClient#FLAG_KEY_MEDIA_PREVIOUS} ,
{@link android.media.RemoteControlClient#FLAG_KEY_MEDIA_REWIND} ,
{@link android.media.RemoteControlCl... | [
"Sets",
"the",
"flags",
"for",
"the",
"media",
"transport",
"control",
"buttons",
"that",
"this",
"client",
"supports",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/remote/RemoteControlClientCompat.java#L348-L357 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.onDestroy | @SuppressWarnings("deprecation")
public void onDestroy() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
mAudioManager.unregisterMediaButtonEventReceiver(mMediaButtonReceiverComponent);
... | java | @SuppressWarnings("deprecation")
public void onDestroy() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
mAudioManager.unregisterMediaButtonEventReceiver(mMediaButtonReceiverComponent);
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"onDestroy",
"(",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"{",
"mRemoteControlClientCompat",
".",
"setPlayba... | Should be called to released the internal component. | [
"Should",
"be",
"called",
"to",
"released",
"the",
"internal",
"component",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L149-L157 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.setMetaData | @SuppressWarnings("deprecation")
public void setMetaData(SoundCloudTrack track, Bitmap artwork) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// set meta data on the lock screen for pre lollipop.
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTA... | java | @SuppressWarnings("deprecation")
public void setMetaData(SoundCloudTrack track, Bitmap artwork) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// set meta data on the lock screen for pre lollipop.
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTA... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"setMetaData",
"(",
"SoundCloudTrack",
"track",
",",
"Bitmap",
"artwork",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",... | Update meta data used by the remote control client and the media session.
@param track track currently played.
@param artwork track artwork. | [
"Update",
"meta",
"data",
"used",
"by",
"the",
"remote",
"control",
"client",
"and",
"the",
"media",
"session",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L208-L234 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.setRemoteControlClientPlaybackState | private void setRemoteControlClientPlaybackState(int state) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mRemoteControlClientCompat.setPlaybackState(state);
}
} | java | private void setRemoteControlClientPlaybackState(int state) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mRemoteControlClientCompat.setPlaybackState(state);
}
} | [
"private",
"void",
"setRemoteControlClientPlaybackState",
"(",
"int",
"state",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"{",
"mRemoteControlClientCompat",
".",
"setPlaybackState",
"(",
... | Propagate playback state to the remote control client on the lock screen.
@param state playback state. | [
"Propagate",
"playback",
"state",
"to",
"the",
"remote",
"control",
"client",
"on",
"the",
"lock",
"screen",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L241-L245 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.setMediaSessionCompatPlaybackState | private void setMediaSessionCompatPlaybackState(int state) {
mStateBuilder.setState(state, PlaybackStateCompat.PLAYBACK_POSITION_UNKNOWN, 1.0f);
mMediaSession.setPlaybackState(mStateBuilder.build());
} | java | private void setMediaSessionCompatPlaybackState(int state) {
mStateBuilder.setState(state, PlaybackStateCompat.PLAYBACK_POSITION_UNKNOWN, 1.0f);
mMediaSession.setPlaybackState(mStateBuilder.build());
} | [
"private",
"void",
"setMediaSessionCompatPlaybackState",
"(",
"int",
"state",
")",
"{",
"mStateBuilder",
".",
"setState",
"(",
"state",
",",
"PlaybackStateCompat",
".",
"PLAYBACK_POSITION_UNKNOWN",
",",
"1.0f",
")",
";",
"mMediaSession",
".",
"setPlaybackState",
"(",
... | Propagate playback state to the media session compat.
@param state playback state. | [
"Propagate",
"playback",
"state",
"to",
"the",
"media",
"session",
"compat",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L252-L255 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.initPlaybackStateBuilder | private void initPlaybackStateBuilder() {
mStateBuilder = new PlaybackStateCompat.Builder();
mStateBuilder.setActions(
PlaybackStateCompat.ACTION_PLAY
| PlaybackStateCompat.ACTION_PAUSE
| PlaybackStateCompat.ACTION_PLAY_PAUSE
... | java | private void initPlaybackStateBuilder() {
mStateBuilder = new PlaybackStateCompat.Builder();
mStateBuilder.setActions(
PlaybackStateCompat.ACTION_PLAY
| PlaybackStateCompat.ACTION_PAUSE
| PlaybackStateCompat.ACTION_PLAY_PAUSE
... | [
"private",
"void",
"initPlaybackStateBuilder",
"(",
")",
"{",
"mStateBuilder",
"=",
"new",
"PlaybackStateCompat",
".",
"Builder",
"(",
")",
";",
"mStateBuilder",
".",
"setActions",
"(",
"PlaybackStateCompat",
".",
"ACTION_PLAY",
"|",
"PlaybackStateCompat",
".",
"ACT... | Initialize the playback state builder with supported actions. | [
"Initialize",
"the",
"playback",
"state",
"builder",
"with",
"supported",
"actions",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L260-L269 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.initLockScreenRemoteControlClient | @SuppressWarnings("deprecation")
private void initLockScreenRemoteControlClient(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mMediaButtonReceiverComponent = new ComponentName(
mRuntimePackageName, MediaSessionReceiver.class.getName());
... | java | @SuppressWarnings("deprecation")
private void initLockScreenRemoteControlClient(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mMediaButtonReceiverComponent = new ComponentName(
mRuntimePackageName, MediaSessionReceiver.class.getName());
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"initLockScreenRemoteControlClient",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"{",
... | Initialize the remote control client on the lock screen.
@param context holding context. | [
"Initialize",
"the",
"remote",
"control",
"client",
"on",
"the",
"lock",
"screen",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L276-L301 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java | MediaSessionWrapper.registerLockScreenReceiver | private void registerLockScreenReceiver(Context context) {
mLockScreenReceiver = new LockScreenReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_TOGGLE_PLAYBACK);
intentFilter.addAction(ACTION_NEXT_TRACK);
intentFilter.addAction(ACTION_PREV... | java | private void registerLockScreenReceiver(Context context) {
mLockScreenReceiver = new LockScreenReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_TOGGLE_PLAYBACK);
intentFilter.addAction(ACTION_NEXT_TRACK);
intentFilter.addAction(ACTION_PREV... | [
"private",
"void",
"registerLockScreenReceiver",
"(",
"Context",
"context",
")",
"{",
"mLockScreenReceiver",
"=",
"new",
"LockScreenReceiver",
"(",
")",
";",
"IntentFilter",
"intentFilter",
"=",
"new",
"IntentFilter",
"(",
")",
";",
"intentFilter",
".",
"addAction",... | Register the lock screen receiver used to catch lock screen media buttons events.
@param context holding context. | [
"Register",
"the",
"lock",
"screen",
"receiver",
"used",
"to",
"catch",
"lock",
"screen",
"media",
"buttons",
"events",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/media/MediaSessionWrapper.java#L308-L316 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ListCommandVersionRepairer.java | ListCommandVersionRepairer.repairLocalCommandsVersion | public void repairLocalCommandsVersion(final Queue<ListCommand> localCommands,
final ListCommand originalRemoteCommand) {
localCommands.add(repairCommand(localCommands.poll(), originalRemoteCommand.getListVersionChange()
.getToVersion(), randomUUID()));
final int count = lo... | java | public void repairLocalCommandsVersion(final Queue<ListCommand> localCommands,
final ListCommand originalRemoteCommand) {
localCommands.add(repairCommand(localCommands.poll(), originalRemoteCommand.getListVersionChange()
.getToVersion(), randomUUID()));
final int count = lo... | [
"public",
"void",
"repairLocalCommandsVersion",
"(",
"final",
"Queue",
"<",
"ListCommand",
">",
"localCommands",
",",
"final",
"ListCommand",
"originalRemoteCommand",
")",
"{",
"localCommands",
".",
"add",
"(",
"repairCommand",
"(",
"localCommands",
".",
"poll",
"("... | Updates the versions of repaired local commands that should be resent to the server so that they are based on the
version the original remote command produced.
@param localCommands
The local commands that should be repaired. <b>WARNING:</b> The repaired commands are added directly
to the queue again.
@param originalRe... | [
"Updates",
"the",
"versions",
"of",
"repaired",
"local",
"commands",
"that",
"should",
"be",
"resent",
"to",
"the",
"server",
"so",
"that",
"they",
"are",
"based",
"on",
"the",
"version",
"the",
"original",
"remote",
"command",
"produced",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ListCommandVersionRepairer.java#L54-L64 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ListCommandVersionRepairer.java | ListCommandVersionRepairer.repairRemoteCommandVersion | public List<? extends ListCommand> repairRemoteCommandVersion(
final List<? extends ListCommand> indexRepairedRemoteCommands,
final List<ListCommand> versionRepairedLocalCommands) {
final int commandCount = indexRepairedRemoteCommands.size();
final ListCommand lastLocalCommand =... | java | public List<? extends ListCommand> repairRemoteCommandVersion(
final List<? extends ListCommand> indexRepairedRemoteCommands,
final List<ListCommand> versionRepairedLocalCommands) {
final int commandCount = indexRepairedRemoteCommands.size();
final ListCommand lastLocalCommand =... | [
"public",
"List",
"<",
"?",
"extends",
"ListCommand",
">",
"repairRemoteCommandVersion",
"(",
"final",
"List",
"<",
"?",
"extends",
"ListCommand",
">",
"indexRepairedRemoteCommands",
",",
"final",
"List",
"<",
"ListCommand",
">",
"versionRepairedLocalCommands",
")",
... | Updates the version of the remote commands that should be executed locally to ensure that the local list version
equals the version that is resent to the server when they are executed.
@param indexRepairedRemoteCommands
The remote commands thats indices where already repaired. This list can be empty.
@param versionRep... | [
"Updates",
"the",
"version",
"of",
"the",
"remote",
"commands",
"that",
"should",
"be",
"executed",
"locally",
"to",
"ensure",
"that",
"the",
"local",
"list",
"version",
"equals",
"the",
"version",
"that",
"is",
"resent",
"to",
"the",
"server",
"when",
"they... | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ListCommandVersionRepairer.java#L77-L97 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/Range.java | Range.checkRangeValues | private void checkRangeValues(long minimum, long maximum) {
if (minimum > maximum) {
throw EvaluationException.create(
MSG_MIN_MUST_BE_LESS_OR_EQUAL_TO_MAX, minimum, maximum);
}
} | java | private void checkRangeValues(long minimum, long maximum) {
if (minimum > maximum) {
throw EvaluationException.create(
MSG_MIN_MUST_BE_LESS_OR_EQUAL_TO_MAX, minimum, maximum);
}
} | [
"private",
"void",
"checkRangeValues",
"(",
"long",
"minimum",
",",
"long",
"maximum",
")",
"{",
"if",
"(",
"minimum",
">",
"maximum",
")",
"{",
"throw",
"EvaluationException",
".",
"create",
"(",
"MSG_MIN_MUST_BE_LESS_OR_EQUAL_TO_MAX",
",",
"minimum",
",",
"max... | Checks whether the range values are valid. Specifically whether the
minimum is less than or equal to the maximum. This will throw an
EvaluationException if any problems are found.
@param minimum
@param maximum | [
"Checks",
"whether",
"the",
"range",
"values",
"are",
"valid",
".",
"Specifically",
"whether",
"the",
"minimum",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"maximum",
".",
"This",
"will",
"throw",
"an",
"EvaluationException",
"if",
"any",
"problems",
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/Range.java#L133-L138 | train |
saxsys/SynchronizeFX | transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatChannel.java | SynchronizeFXTomcatChannel.shutdown | @Override
public void shutdown() {
synchronized (connections) {
parent.channelCloses(this);
for (final MessageInbound connection : connections) {
try {
connection.getWsOutbound().close(0, null);
} catch (final IOException e) {
... | java | @Override
public void shutdown() {
synchronized (connections) {
parent.channelCloses(this);
for (final MessageInbound connection : connections) {
try {
connection.getWsOutbound().close(0, null);
} catch (final IOException e) {
... | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
")",
"{",
"synchronized",
"(",
"connections",
")",
"{",
"parent",
".",
"channelCloses",
"(",
"this",
")",
";",
"for",
"(",
"final",
"MessageInbound",
"connection",
":",
"connections",
")",
"{",
"try",
"{"... | Disconnects all clients and makes the servlet refuse new connections. | [
"Disconnects",
"all",
"clients",
"and",
"makes",
"the",
"servlet",
"refuse",
"new",
"connections",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatChannel.java#L143-L163 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.setPropertyValue | public List<Command> setPropertyValue(final UUID propertyId, final Object value) throws SynchronizeFXException {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
setPropertyValue(propertyId, value, state);
... | java | public List<Command> setPropertyValue(final UUID propertyId, final Object value) throws SynchronizeFXException {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
setPropertyValue(propertyId, value, state);
... | [
"public",
"List",
"<",
"Command",
">",
"setPropertyValue",
"(",
"final",
"UUID",
"propertyId",
",",
"final",
"Object",
"value",
")",
"throws",
"SynchronizeFXException",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",
"WithCommandType",
"(",
... | Creates the commands necessary to set a new value for a property.
@param propertyId
The id of the property where the new value should be set.
@param value
The value that should be set.
@throws SynchronizeFXException
When creation of the commands failed.
@return The commands. | [
"Creates",
"the",
"commands",
"necessary",
"to",
"set",
"a",
"new",
"value",
"for",
"a",
"property",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L125-L133 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.addToList | public List<Command> addToList(final UUID listId, final int position, final Object value, final int newSize) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
addToList(listId, position, value, newSize, state... | java | public List<Command> addToList(final UUID listId, final int position, final Object value, final int newSize) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
addToList(listId, position, value, newSize, state... | [
"public",
"List",
"<",
"Command",
">",
"addToList",
"(",
"final",
"UUID",
"listId",
",",
"final",
"int",
"position",
",",
"final",
"Object",
"value",
",",
"final",
"int",
"newSize",
")",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",... | Creates the list with commands necessary for an add to list action.
@param listId
The ID of the list where the element should be added.
@param position
The position in the list at which the value object should be added.
@param value
The object that should be added to the list.
@param newSize
The new size the list has ... | [
"Creates",
"the",
"list",
"with",
"commands",
"necessary",
"for",
"an",
"add",
"to",
"list",
"action",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L148-L156 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.addToSet | public List<Command> addToSet(final UUID setId, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
addToSet(setId, value, state);
}
}, true);
return state.comman... | java | public List<Command> addToSet(final UUID setId, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
addToSet(setId, value, state);
}
}, true);
return state.comman... | [
"public",
"List",
"<",
"Command",
">",
"addToSet",
"(",
"final",
"UUID",
"setId",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",
"WithCommandType",
"(",
")",
"{",
"@",
"Override",
"public",
"void... | Creates the list with commands necessary for an add to set action.
@param setId
The ID of the set where the element should be added.
@param value
The object that should be added to the set.
@return a set with commands necessary to recreate this add to set command. | [
"Creates",
"the",
"list",
"with",
"commands",
"necessary",
"for",
"an",
"add",
"to",
"set",
"action",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L167-L175 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.putToMap | public List<Command> putToMap(final UUID mapId, final Object key, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
putToMap(mapId, key, value, state);
}
}, true);
... | java | public List<Command> putToMap(final UUID mapId, final Object key, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
putToMap(mapId, key, value, state);
}
}, true);
... | [
"public",
"List",
"<",
"Command",
">",
"putToMap",
"(",
"final",
"UUID",
"mapId",
",",
"final",
"Object",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",
"WithCommandType",
"(",
")",
"{",
... | Creates the list with commands necessary to put a mapping into a map.
@param mapId
the id of the map where the mapping should be added.
@param key
the key of the new mapping.
@param value
the value of the new mapping.
@return the list with the commands. | [
"Creates",
"the",
"list",
"with",
"commands",
"necessary",
"to",
"put",
"a",
"mapping",
"into",
"a",
"map",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L188-L196 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.removeFromList | public List<Command> removeFromList(final UUID listId, final int startPosition, final int removeCount) {
final ListVersionChange change = increaseListVersion(listId);
final RemoveFromList msg = new RemoveFromList(listId, change, startPosition, removeCount);
final List<Command> commands = new Arr... | java | public List<Command> removeFromList(final UUID listId, final int startPosition, final int removeCount) {
final ListVersionChange change = increaseListVersion(listId);
final RemoveFromList msg = new RemoveFromList(listId, change, startPosition, removeCount);
final List<Command> commands = new Arr... | [
"public",
"List",
"<",
"Command",
">",
"removeFromList",
"(",
"final",
"UUID",
"listId",
",",
"final",
"int",
"startPosition",
",",
"final",
"int",
"removeCount",
")",
"{",
"final",
"ListVersionChange",
"change",
"=",
"increaseListVersion",
"(",
"listId",
")",
... | Creates the list with commands necessary to remove a object from a list.
@param listId
The ID of the list where an element should be removed.
@param startPosition
The index of the first element in the list which should be removed.
@param removeCount
The element count to remove from the list, starting from <code>startP... | [
"Creates",
"the",
"list",
"with",
"commands",
"necessary",
"to",
"remove",
"a",
"object",
"from",
"a",
"list",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L209-L215 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.removeFromMap | public List<Command> removeFromMap(final UUID mapId, final Object key) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
createObservableObject(key, state);
}
}, false);
final boo... | java | public List<Command> removeFromMap(final UUID mapId, final Object key) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
createObservableObject(key, state);
}
}, false);
final boo... | [
"public",
"List",
"<",
"Command",
">",
"removeFromMap",
"(",
"final",
"UUID",
"mapId",
",",
"final",
"Object",
"key",
")",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",
"WithCommandType",
"(",
")",
"{",
"@",
"Override",
"public",
"v... | Creates the list with command necessary to remove a mapping from a map.
@param mapId
the map where the mapping should be removed.
@param key
the key of the mapping that should be removed.
@return the list with the commands. | [
"Creates",
"the",
"list",
"with",
"command",
"necessary",
"to",
"remove",
"a",
"mapping",
"from",
"a",
"map",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L226-L242 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.removeFromSet | public List<Command> removeFromSet(final UUID setId, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
createObservableObject(value, state);
}
}, false);
final... | java | public List<Command> removeFromSet(final UUID setId, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
createObservableObject(value, state);
}
}, false);
final... | [
"public",
"List",
"<",
"Command",
">",
"removeFromSet",
"(",
"final",
"UUID",
"setId",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",
"WithCommandType",
"(",
")",
"{",
"@",
"Override",
"public",
... | Creates the list with commands necessary to remove a object from a set.
@param setId
The ID of the set where an element should be removed.
@param value
The element that should be removed.
@return The command list. | [
"Creates",
"the",
"list",
"with",
"commands",
"necessary",
"to",
"remove",
"a",
"object",
"from",
"a",
"set",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L253-L269 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java | CommandListCreator.replaceInList | public List<Command> replaceInList(final UUID listId, final int position, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
final boolean isObservableObject = createObservableObject(value,... | java | public List<Command> replaceInList(final UUID listId, final int position, final Object value) {
final State state = createCommandList(new WithCommandType() {
@Override
public void invoke(final State state) {
final boolean isObservableObject = createObservableObject(value,... | [
"public",
"List",
"<",
"Command",
">",
"replaceInList",
"(",
"final",
"UUID",
"listId",
",",
"final",
"int",
"position",
",",
"final",
"Object",
"value",
")",
"{",
"final",
"State",
"state",
"=",
"createCommandList",
"(",
"new",
"WithCommandType",
"(",
")",
... | Creates the list of commands necessary to replace an object in a list.
@param listId
the ID of the list where the element should be replaced
@param position
the position of the element that should be replaced
@param value
the new value
@return the command list | [
"Creates",
"the",
"list",
"of",
"commands",
"necessary",
"to",
"replace",
"an",
"object",
"in",
"a",
"list",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L282-L296 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/parser/PanParserUtils.java | PanParserUtils.replaceHeredocStrings | static void replaceHeredocStrings(ASTTemplate tnode,
List<StringProperty> strings) {
// Only something to do if there were heredoc strings defined.
if (strings.size() > 0) {
processHeredocStrings(tnode, strings);
}
} | java | static void replaceHeredocStrings(ASTTemplate tnode,
List<StringProperty> strings) {
// Only something to do if there were heredoc strings defined.
if (strings.size() > 0) {
processHeredocStrings(tnode, strings);
}
} | [
"static",
"void",
"replaceHeredocStrings",
"(",
"ASTTemplate",
"tnode",
",",
"List",
"<",
"StringProperty",
">",
"strings",
")",
"{",
"// Only something to do if there were heredoc strings defined.",
"if",
"(",
"strings",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
... | A utility to replace HEREDOC operations with the associated
StringProperty operations. This must be done at the end of the template
processing to be sure that all heredoc strings have been captured.
@param tnode
@param strings | [
"A",
"utility",
"to",
"replace",
"HEREDOC",
"operations",
"with",
"the",
"associated",
"StringProperty",
"operations",
".",
"This",
"must",
"be",
"done",
"at",
"the",
"end",
"of",
"the",
"template",
"processing",
"to",
"be",
"sure",
"that",
"all",
"heredoc",
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/parser/PanParserUtils.java#L52-L59 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/parser/PanParserUtils.java | PanParserUtils.processSingleQuotedString | static void processSingleQuotedString(StringBuilder sb) {
// Sanity checking. Make sure input string has at least two characters
// and that the first and last are single quotes.
assert (sb.length() >= 2);
assert (sb.charAt(0) == '\'' && sb.charAt(sb.length() - 1) == '\'');
// ... | java | static void processSingleQuotedString(StringBuilder sb) {
// Sanity checking. Make sure input string has at least two characters
// and that the first and last are single quotes.
assert (sb.length() >= 2);
assert (sb.charAt(0) == '\'' && sb.charAt(sb.length() - 1) == '\'');
// ... | [
"static",
"void",
"processSingleQuotedString",
"(",
"StringBuilder",
"sb",
")",
"{",
"// Sanity checking. Make sure input string has at least two characters",
"// and that the first and last are single quotes.",
"assert",
"(",
"sb",
".",
"length",
"(",
")",
">=",
"2",
")",
";... | This takes a single-quoted string as identified by the parser and
processes it into a standard java string. It removes the surrounding
quotes and substitues a single apostrophe or doubled apostrophes.
Note: This method modifies the given StringBuilder directly. No copies of
the data are made.
@param sb
StringBuilder ... | [
"This",
"takes",
"a",
"single",
"-",
"quoted",
"string",
"as",
"identified",
"by",
"the",
"parser",
"and",
"processes",
"it",
"into",
"a",
"standard",
"java",
"string",
".",
"It",
"removes",
"the",
"surrounding",
"quotes",
"and",
"substitues",
"a",
"single",... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/parser/PanParserUtils.java#L114-L132 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/repository/FileSystemSourceRepository.java | FileSystemSourceRepository.retrievePanSource | public SourceFile retrievePanSource(String name, List<String> loadpath) {
String cacheKey = name + ((String) " ") + String.join(":", loadpath);
SourceFile cachedResult = retrievePanCacheLoadpath.get(cacheKey);
if (cachedResult == null) {
File file = lookupSource(name, loadpath);
... | java | public SourceFile retrievePanSource(String name, List<String> loadpath) {
String cacheKey = name + ((String) " ") + String.join(":", loadpath);
SourceFile cachedResult = retrievePanCacheLoadpath.get(cacheKey);
if (cachedResult == null) {
File file = lookupSource(name, loadpath);
... | [
"public",
"SourceFile",
"retrievePanSource",
"(",
"String",
"name",
",",
"List",
"<",
"String",
">",
"loadpath",
")",
"{",
"String",
"cacheKey",
"=",
"name",
"+",
"(",
"(",
"String",
")",
"\" \"",
")",
"+",
"String",
".",
"join",
"(",
"\":\"",
",",
"lo... | Optimised due to lots of calls and slow lookupSource | [
"Optimised",
"due",
"to",
"lots",
"of",
"calls",
"and",
"slow",
"lookupSource"
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/repository/FileSystemSourceRepository.java#L87-L98 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/IteratorMap.java | IteratorMap.get | public Resource.Iterator get(Resource resource) {
Integer key = Integer.valueOf(System.identityHashCode(resource));
return map.get(key);
} | java | public Resource.Iterator get(Resource resource) {
Integer key = Integer.valueOf(System.identityHashCode(resource));
return map.get(key);
} | [
"public",
"Resource",
".",
"Iterator",
"get",
"(",
"Resource",
"resource",
")",
"{",
"Integer",
"key",
"=",
"Integer",
".",
"valueOf",
"(",
"System",
".",
"identityHashCode",
"(",
"resource",
")",
")",
";",
"return",
"map",
".",
"get",
"(",
"key",
")",
... | Lookup the iterator associated with the given resource. If there is no
iterator, null is returned.
@param resource
resource to use for lookup
@return Resource.Iterator iterator associated with given resource or null
if no mapping exists | [
"Lookup",
"the",
"iterator",
"associated",
"with",
"the",
"given",
"resource",
".",
"If",
"there",
"is",
"no",
"iterator",
"null",
"is",
"returned",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/IteratorMap.java#L37-L40 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/IteratorMap.java | IteratorMap.put | public void put(Resource resource, Resource.Iterator iterator) {
assert (resource != null);
Integer key = Integer.valueOf(System.identityHashCode(resource));
if (iterator != null) {
map.put(key, iterator);
} else {
map.remove(key);
}
} | java | public void put(Resource resource, Resource.Iterator iterator) {
assert (resource != null);
Integer key = Integer.valueOf(System.identityHashCode(resource));
if (iterator != null) {
map.put(key, iterator);
} else {
map.remove(key);
}
} | [
"public",
"void",
"put",
"(",
"Resource",
"resource",
",",
"Resource",
".",
"Iterator",
"iterator",
")",
"{",
"assert",
"(",
"resource",
"!=",
"null",
")",
";",
"Integer",
"key",
"=",
"Integer",
".",
"valueOf",
"(",
"System",
".",
"identityHashCode",
"(",
... | Associate the iterator to the given resource. If the iterator is null,
then the mapping is removed.
@param resource
resource to associate the iterator to
@param iterator
iterator to associate to the resource; if null mapping is
removed | [
"Associate",
"the",
"iterator",
"to",
"the",
"given",
"resource",
".",
"If",
"the",
"iterator",
"is",
"null",
"then",
"the",
"mapping",
"is",
"removed",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/IteratorMap.java#L52-L62 | train |
quattor/pan | panc/src/main/java/org/quattor/ant/PanCheckSyntaxTask.java | PanCheckSyntaxTask.addFiles | private void addFiles(FileSet fs) {
// Get the files included in the fileset.
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
// The base directory for all files.
File basedir = ds.getBasedir();
// Loop over each file creating a File object.
for (String f :... | java | private void addFiles(FileSet fs) {
// Get the files included in the fileset.
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
// The base directory for all files.
File basedir = ds.getBasedir();
// Loop over each file creating a File object.
for (String f :... | [
"private",
"void",
"addFiles",
"(",
"FileSet",
"fs",
")",
"{",
"// Get the files included in the fileset.",
"DirectoryScanner",
"ds",
"=",
"fs",
".",
"getDirectoryScanner",
"(",
"getProject",
"(",
")",
")",
";",
"// The base directory for all files.",
"File",
"basedir",... | Utility method that adds all of the files in a fileset to the list of
files to be processed. Duplicate files appear only once in the final
list. Files not ending with a valid source file extension are ignored.
@param fs
FileSet from which to get the file names | [
"Utility",
"method",
"that",
"adds",
"all",
"of",
"the",
"files",
"in",
"a",
"fileset",
"to",
"the",
"list",
"of",
"files",
"to",
"be",
"processed",
".",
"Duplicate",
"files",
"appear",
"only",
"once",
"in",
"the",
"final",
"list",
".",
"Files",
"not",
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/ant/PanCheckSyntaxTask.java#L83-L97 | train |
quattor/pan | panc/src/main/java/org/quattor/ant/PanCheckSyntaxTask.java | PanCheckSyntaxTask.setWarnings | public void setWarnings(String warnings) {
try {
deprecationWarnings = CompilerOptions.DeprecationWarnings
.fromString(warnings);
} catch (IllegalArgumentException e) {
throw new BuildException("invalid value for warnings: " + warnings);
}
} | java | public void setWarnings(String warnings) {
try {
deprecationWarnings = CompilerOptions.DeprecationWarnings
.fromString(warnings);
} catch (IllegalArgumentException e) {
throw new BuildException("invalid value for warnings: " + warnings);
}
} | [
"public",
"void",
"setWarnings",
"(",
"String",
"warnings",
")",
"{",
"try",
"{",
"deprecationWarnings",
"=",
"CompilerOptions",
".",
"DeprecationWarnings",
".",
"fromString",
"(",
"warnings",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{... | Determines whether deprecation warnings are emitted and if so, whether to
treat them as fatal errors.
@param warnings string value of CompilerOptions.DeprecationWarnings | [
"Determines",
"whether",
"deprecation",
"warnings",
"are",
"emitted",
"and",
"if",
"so",
"whether",
"to",
"treat",
"them",
"as",
"fatal",
"errors",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/ant/PanCheckSyntaxTask.java#L116-L123 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java | CompileTimeContext.setObjectAndLoadpath | public void setObjectAndLoadpath() {
StringProperty sname = StringProperty.getInstance(objectTemplate.name);
setGlobalVariable("OBJECT", sname, true);
setGlobalVariable("LOADPATH", new ListResource(), false);
} | java | public void setObjectAndLoadpath() {
StringProperty sname = StringProperty.getInstance(objectTemplate.name);
setGlobalVariable("OBJECT", sname, true);
setGlobalVariable("LOADPATH", new ListResource(), false);
} | [
"public",
"void",
"setObjectAndLoadpath",
"(",
")",
"{",
"StringProperty",
"sname",
"=",
"StringProperty",
".",
"getInstance",
"(",
"objectTemplate",
".",
"name",
")",
";",
"setGlobalVariable",
"(",
"\"OBJECT\"",
",",
"sname",
",",
"true",
")",
";",
"setGlobalVa... | Set the name of the object template. Define the necessary variables. | [
"Set",
"the",
"name",
"of",
"the",
"object",
"template",
".",
"Define",
"the",
"necessary",
"variables",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java#L247-L253 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java | CompileTimeContext.setIterator | public void setIterator(Resource resource, Resource.Iterator iterator) {
iteratorMap.put(resource, iterator);
} | java | public void setIterator(Resource resource, Resource.Iterator iterator) {
iteratorMap.put(resource, iterator);
} | [
"public",
"void",
"setIterator",
"(",
"Resource",
"resource",
",",
"Resource",
".",
"Iterator",
"iterator",
")",
"{",
"iteratorMap",
".",
"put",
"(",
"resource",
",",
"iterator",
")",
";",
"}"
] | Register a Resource iterator in the context. | [
"Register",
"a",
"Resource",
"iterator",
"in",
"the",
"context",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java#L414-L416 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java | CompileTimeContext.getVariable | public Element getVariable(String name) {
Element result = localVariables.get(name);
// If the result is null, then try to look up a global variable.
if (result == null) {
result = getGlobalVariable(name);
}
return result;
} | java | public Element getVariable(String name) {
Element result = localVariables.get(name);
// If the result is null, then try to look up a global variable.
if (result == null) {
result = getGlobalVariable(name);
}
return result;
} | [
"public",
"Element",
"getVariable",
"(",
"String",
"name",
")",
"{",
"Element",
"result",
"=",
"localVariables",
".",
"get",
"(",
"name",
")",
";",
"// If the result is null, then try to look up a global variable.",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"re... | Return the Element which corresponds to the given variable name. It will
first check local variables and then global variables. This method will
return null if the variable doesn't exist or the argument is null. Note
that this will clone the value before returning it, if it came from a
global variable.
@param name
nam... | [
"Return",
"the",
"Element",
"which",
"corresponds",
"to",
"the",
"given",
"variable",
"name",
".",
"It",
"will",
"first",
"check",
"local",
"variables",
"and",
"then",
"global",
"variables",
".",
"This",
"method",
"will",
"return",
"null",
"if",
"the",
"vari... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java#L685-L695 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java | CompileTimeContext.dereferenceVariable | public Element dereferenceVariable(String name, boolean lookupOnly,
Term[] terms) throws InvalidTermException {
boolean duplicate = false;
Element result = localVariables.get(name);
// If the result is null, then try to look up a global variable.
if (result == null) {
duplicate = true;
result = getGl... | java | public Element dereferenceVariable(String name, boolean lookupOnly,
Term[] terms) throws InvalidTermException {
boolean duplicate = false;
Element result = localVariables.get(name);
// If the result is null, then try to look up a global variable.
if (result == null) {
duplicate = true;
result = getGl... | [
"public",
"Element",
"dereferenceVariable",
"(",
"String",
"name",
",",
"boolean",
"lookupOnly",
",",
"Term",
"[",
"]",
"terms",
")",
"throws",
"InvalidTermException",
"{",
"boolean",
"duplicate",
"=",
"false",
";",
"Element",
"result",
"=",
"localVariables",
".... | Return the Element which corresponds to the given variable name. It will
first check local variables and then the parent context. This method will
return null if the variable doesn't exist or the argument is null. Note
that this will clone the final value, if it originated from a global
variable.
@param name
name of t... | [
"Return",
"the",
"Element",
"which",
"corresponds",
"to",
"the",
"given",
"variable",
"name",
".",
"It",
"will",
"first",
"check",
"local",
"variables",
"and",
"then",
"the",
"parent",
"context",
".",
"This",
"method",
"will",
"return",
"null",
"if",
"the",
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java#L713-L751 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/functions/AbstractMatcher.java | AbstractMatcher.convertMatchFlags | protected int convertMatchFlags(Element opts) {
int flags = 0;
String sopts = ((StringProperty) opts).getValue();
for (int i = 0; i < sopts.length(); i++) {
char c = sopts.charAt(i);
switch (c) {
case 'i':
flags |= Pattern.CASE_INSENSITIVE;
break;
case 's':
flags |= Pattern.DOTALL;
b... | java | protected int convertMatchFlags(Element opts) {
int flags = 0;
String sopts = ((StringProperty) opts).getValue();
for (int i = 0; i < sopts.length(); i++) {
char c = sopts.charAt(i);
switch (c) {
case 'i':
flags |= Pattern.CASE_INSENSITIVE;
break;
case 's':
flags |= Pattern.DOTALL;
b... | [
"protected",
"int",
"convertMatchFlags",
"(",
"Element",
"opts",
")",
"{",
"int",
"flags",
"=",
"0",
";",
"String",
"sopts",
"=",
"(",
"(",
"StringProperty",
")",
"opts",
")",
".",
"getValue",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | A utility function to convert a string containing match options to the
associated integer with the appropriate bits set.
@param opts
string containing matching flags
@return integer with appropriate bits set | [
"A",
"utility",
"function",
"to",
"convert",
"a",
"string",
"containing",
"match",
"options",
"to",
"the",
"associated",
"integer",
"with",
"the",
"appropriate",
"bits",
"set",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/functions/AbstractMatcher.java#L69-L99 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/functions/AbstractMatcher.java | AbstractMatcher.compilePattern | protected Pattern compilePattern(Element regex, int flags) {
Pattern p = null;
try {
String re = ((StringProperty) regex).getValue();
p = Pattern.compile(re, flags);
} catch (PatternSyntaxException pse) {
throw EvaluationException.create(sourceRange, MSG_INVALID_REGEXP,
pse.getLocalizedMessage());
... | java | protected Pattern compilePattern(Element regex, int flags) {
Pattern p = null;
try {
String re = ((StringProperty) regex).getValue();
p = Pattern.compile(re, flags);
} catch (PatternSyntaxException pse) {
throw EvaluationException.create(sourceRange, MSG_INVALID_REGEXP,
pse.getLocalizedMessage());
... | [
"protected",
"Pattern",
"compilePattern",
"(",
"Element",
"regex",
",",
"int",
"flags",
")",
"{",
"Pattern",
"p",
"=",
"null",
";",
"try",
"{",
"String",
"re",
"=",
"(",
"(",
"StringProperty",
")",
"regex",
")",
".",
"getValue",
"(",
")",
";",
"p",
"... | Generate a Pattern from the given string and flags.
@param regex
regular expression to compile
@param flags
matching flags to use for pattern
@return Pattern corresponding to the given regular expression and
matching flags | [
"Generate",
"a",
"Pattern",
"from",
"the",
"given",
"string",
"and",
"flags",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/functions/AbstractMatcher.java#L112-L124 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/cache/BuildCache.java | BuildCache.setDependency | synchronized public void setDependency(String objectName,
String dependencyName) throws EvaluationException {
// Determine if adding this dependency will create a cycle.
String nextObjectName = dependencies.get(dependencyName);
while (nextObjectName != null) {
if (objectName.equals(nextObjectName)) {
t... | java | synchronized public void setDependency(String objectName,
String dependencyName) throws EvaluationException {
// Determine if adding this dependency will create a cycle.
String nextObjectName = dependencies.get(dependencyName);
while (nextObjectName != null) {
if (objectName.equals(nextObjectName)) {
t... | [
"synchronized",
"public",
"void",
"setDependency",
"(",
"String",
"objectName",
",",
"String",
"dependencyName",
")",
"throws",
"EvaluationException",
"{",
"// Determine if adding this dependency will create a cycle.",
"String",
"nextObjectName",
"=",
"dependencies",
".",
"ge... | This method will set the given dependency in the map which holds them.
This method will throw an exception if the specified dependency would
create a cycle in the dependency map. In this case, the dependency will
not be inserted.
Note: This method MUST be synchronized to ensure that the entire cycle
calculation occurs... | [
"This",
"method",
"will",
"set",
"the",
"given",
"dependency",
"in",
"the",
"map",
"which",
"holds",
"them",
".",
"This",
"method",
"will",
"throw",
"an",
"exception",
"if",
"the",
"specified",
"dependency",
"would",
"create",
"a",
"cycle",
"in",
"the",
"d... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/cache/BuildCache.java#L98-L119 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/cache/BuildCache.java | BuildCache.getCycle | synchronized private String getCycle(String objectName,
String dependencyName) {
// Determine if adding this dependency will create a cycle.
StringBuilder sb = new StringBuilder();
sb.append(objectName);
sb.append(" -> ");
sb.append(dependencyName);
String nextObjectName = dependencies.get(dependencyNa... | java | synchronized private String getCycle(String objectName,
String dependencyName) {
// Determine if adding this dependency will create a cycle.
StringBuilder sb = new StringBuilder();
sb.append(objectName);
sb.append(" -> ");
sb.append(dependencyName);
String nextObjectName = dependencies.get(dependencyNa... | [
"synchronized",
"private",
"String",
"getCycle",
"(",
"String",
"objectName",
",",
"String",
"dependencyName",
")",
"{",
"// Determine if adding this dependency will create a cycle.",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append"... | This method creates a string describing a cycle which has been detected.
It should only be called if a cycle with the specified dependency has
actually been detected.
@param objectName
name of the object which has the dependency
@param dependencyName
name of the object objectName depends on
@return String describing ... | [
"This",
"method",
"creates",
"a",
"string",
"describing",
"a",
"cycle",
"which",
"has",
"been",
"detected",
".",
"It",
"should",
"only",
"be",
"called",
"if",
"a",
"cycle",
"with",
"the",
"specified",
"dependency",
"has",
"actually",
"been",
"detected",
"."
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/cache/BuildCache.java#L133-L153 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/operators/Add.java | Add.execute | @Override
public Element execute(Context context) {
try {
Element[] args = calculateArgs(context);
Property a = (Property) args[0];
Property b = (Property) args[1];
return execute(sourceRange, a, b);
} catch (ClassCastException cce) {
throw new EvaluationException(MessageUtils
.format(MSG_INVA... | java | @Override
public Element execute(Context context) {
try {
Element[] args = calculateArgs(context);
Property a = (Property) args[0];
Property b = (Property) args[1];
return execute(sourceRange, a, b);
} catch (ClassCastException cce) {
throw new EvaluationException(MessageUtils
.format(MSG_INVA... | [
"@",
"Override",
"public",
"Element",
"execute",
"(",
"Context",
"context",
")",
"{",
"try",
"{",
"Element",
"[",
"]",
"args",
"=",
"calculateArgs",
"(",
"context",
")",
";",
"Property",
"a",
"=",
"(",
"Property",
")",
"args",
"[",
"0",
"]",
";",
"Pr... | Perform the addition of the two top values on the data stack in the given
DMLContext. This method will handle long, double, and string values.
Exceptions are thrown if the types of the arguments do not match or they
are another type. | [
"Perform",
"the",
"addition",
"of",
"the",
"two",
"top",
"values",
"on",
"the",
"data",
"stack",
"in",
"the",
"given",
"DMLContext",
".",
"This",
"method",
"will",
"handle",
"long",
"double",
"and",
"string",
"values",
".",
"Exceptions",
"are",
"thrown",
"... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/operators/Add.java#L107-L119 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/operators/Add.java | Add.execute | private static Element execute(SourceRange sourceRange, Property a,
Property b) {
assert (a != null);
assert (b != null);
Element result = null;
if ((a instanceof LongProperty) && (b instanceof LongProperty)) {
long l1 = ((Long) a.getValue()).longValue();
long l2 = ((Long) b.getValue()).longValue()... | java | private static Element execute(SourceRange sourceRange, Property a,
Property b) {
assert (a != null);
assert (b != null);
Element result = null;
if ((a instanceof LongProperty) && (b instanceof LongProperty)) {
long l1 = ((Long) a.getValue()).longValue();
long l2 = ((Long) b.getValue()).longValue()... | [
"private",
"static",
"Element",
"execute",
"(",
"SourceRange",
"sourceRange",
",",
"Property",
"a",
",",
"Property",
"b",
")",
"{",
"assert",
"(",
"a",
"!=",
"null",
")",
";",
"assert",
"(",
"b",
"!=",
"null",
")",
";",
"Element",
"result",
"=",
"null"... | Do the actual addition. | [
"Do",
"the",
"actual",
"addition",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/operators/Add.java#L124-L161 | train |
quattor/pan | panc/src/main/java/org/quattor/ant/PanCompilerTask.java | PanCompilerTask.setIncludeRoot | public void setIncludeRoot(File includeroot) {
this.includeroot = includeroot;
if (!includeroot.exists()) {
throw new BuildException("includeroot doesn't exist: "
+ includeroot);
}
if (!includeroot.isDirectory()) {
throw new BuildException("i... | java | public void setIncludeRoot(File includeroot) {
this.includeroot = includeroot;
if (!includeroot.exists()) {
throw new BuildException("includeroot doesn't exist: "
+ includeroot);
}
if (!includeroot.isDirectory()) {
throw new BuildException("i... | [
"public",
"void",
"setIncludeRoot",
"(",
"File",
"includeroot",
")",
"{",
"this",
".",
"includeroot",
"=",
"includeroot",
";",
"if",
"(",
"!",
"includeroot",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"includeroot doesn't exist... | Set the directory to use for the include globs. This is required only if
the includes parameter is set.
@param includeroot
File giving the root directory for the include globs | [
"Set",
"the",
"directory",
"to",
"use",
"for",
"the",
"include",
"globs",
".",
"This",
"is",
"required",
"only",
"if",
"the",
"includes",
"parameter",
"is",
"set",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/ant/PanCompilerTask.java#L217-L229 | train |
quattor/pan | panc/src/main/java/org/quattor/ant/PanCompilerTask.java | PanCompilerTask.setIncludes | public void setIncludes(String includes) {
// Split the string into separate file globs.
String[] globs = includes.split("[\\s,]+");
// Loop over these globs and create dirsets from them.
// Do not set the root directory until the task is
// executed.
for (String glob :... | java | public void setIncludes(String includes) {
// Split the string into separate file globs.
String[] globs = includes.split("[\\s,]+");
// Loop over these globs and create dirsets from them.
// Do not set the root directory until the task is
// executed.
for (String glob :... | [
"public",
"void",
"setIncludes",
"(",
"String",
"includes",
")",
"{",
"// Split the string into separate file globs.",
"String",
"[",
"]",
"globs",
"=",
"includes",
".",
"split",
"(",
"\"[\\\\s,]+\"",
")",
";",
"// Loop over these globs and create dirsets from them.",
"//... | Set the include globs to use for the pan compiler loadpath.
@param includes
String of comma- or space-separated file globs | [
"Set",
"the",
"include",
"globs",
"to",
"use",
"for",
"the",
"pan",
"compiler",
"loadpath",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/ant/PanCompilerTask.java#L237-L250 | train |
quattor/pan | panc/src/main/java/org/quattor/ant/PanCompilerTask.java | PanCompilerTask.addPaths | private void addPaths(Path p) {
for (String d : p.list()) {
File dir = new File(d);
if (dir.exists() && dir.isDirectory()) {
if (!includeDirectories.contains(dir))
includeDirectories.add(dir);
}
}
} | java | private void addPaths(Path p) {
for (String d : p.list()) {
File dir = new File(d);
if (dir.exists() && dir.isDirectory()) {
if (!includeDirectories.contains(dir))
includeDirectories.add(dir);
}
}
} | [
"private",
"void",
"addPaths",
"(",
"Path",
"p",
")",
"{",
"for",
"(",
"String",
"d",
":",
"p",
".",
"list",
"(",
")",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"d",
")",
";",
"if",
"(",
"dir",
".",
"exists",
"(",
")",
"&&",
"dir",
... | Collect all of the directories listed within enclosed path tags. Order of
the path elements is preserved. Duplicates are included where first
specified.
@param p
Path containing directories to include in compilation | [
"Collect",
"all",
"of",
"the",
"directories",
"listed",
"within",
"enclosed",
"path",
"tags",
".",
"Order",
"of",
"the",
"path",
"elements",
"is",
"preserved",
".",
"Duplicates",
"are",
"included",
"where",
"first",
"specified",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/ant/PanCompilerTask.java#L274-L283 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.restoreRelativeRoot | public HashResource restoreRelativeRoot(HashResource previousValue) {
HashResource value = relativeRoot;
relativeRoot = previousValue;
return value;
} | java | public HashResource restoreRelativeRoot(HashResource previousValue) {
HashResource value = relativeRoot;
relativeRoot = previousValue;
return value;
} | [
"public",
"HashResource",
"restoreRelativeRoot",
"(",
"HashResource",
"previousValue",
")",
"{",
"HashResource",
"value",
"=",
"relativeRoot",
";",
"relativeRoot",
"=",
"previousValue",
";",
"return",
"value",
";",
"}"
] | Retrieve and clear the relative root for this context.
@param previousValue
previous value of the relative root to restore
@return value of the relative root which was replaced | [
"Retrieve",
"and",
"clear",
"the",
"relative",
"root",
"for",
"this",
"context",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L258-L262 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.getDependencies | public Set<SourceFile> getDependencies() {
Set<SourceFile> sourceFiles = new TreeSet<SourceFile>();
// Include all of the standard dependencies.
for (Template t : dependencies.values()) {
sourceFiles.add(t.sourceFile);
}
// Add the files that were looked-up but not found as well as the files
// includ... | java | public Set<SourceFile> getDependencies() {
Set<SourceFile> sourceFiles = new TreeSet<SourceFile>();
// Include all of the standard dependencies.
for (Template t : dependencies.values()) {
sourceFiles.add(t.sourceFile);
}
// Add the files that were looked-up but not found as well as the files
// includ... | [
"public",
"Set",
"<",
"SourceFile",
">",
"getDependencies",
"(",
")",
"{",
"Set",
"<",
"SourceFile",
">",
"sourceFiles",
"=",
"new",
"TreeSet",
"<",
"SourceFile",
">",
"(",
")",
";",
"// Include all of the standard dependencies.",
"for",
"(",
"Template",
"t",
... | Returns an unmodifiable copy of the dependencies. | [
"Returns",
"an",
"unmodifiable",
"copy",
"of",
"the",
"dependencies",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L280-L294 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.globalLoad | public Template globalLoad(String name, boolean lookupOnly) {
// If this context was created without a Compiler object specified, then
// no global lookups can be done. Just return null indicating that the
// requested template can't be found.
if (compiler == null) {
return null;
}
// Use the full look... | java | public Template globalLoad(String name, boolean lookupOnly) {
// If this context was created without a Compiler object specified, then
// no global lookups can be done. Just return null indicating that the
// requested template can't be found.
if (compiler == null) {
return null;
}
// Use the full look... | [
"public",
"Template",
"globalLoad",
"(",
"String",
"name",
",",
"boolean",
"lookupOnly",
")",
"{",
"// If this context was created without a Compiler object specified, then",
"// no global lookups can be done. Just return null indicating that the",
"// requested template can't be found.",
... | A method to load a template from the global cache. This may trigger the
global cache to compile the template. | [
"A",
"method",
"to",
"load",
"a",
"template",
"from",
"the",
"global",
"cache",
".",
"This",
"may",
"trigger",
"the",
"global",
"cache",
"to",
"compile",
"the",
"template",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L339-L422 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setBinding | public void setBinding(Path path, FullType fullType, Template template,
SourceRange sourceRange) {
assert (path != null);
assert (path.isAbsolute());
assert (fullType != null);
// Must make sure that all of the subtypes for the given type are
// defined before adding the binding.
try {
fullType.veri... | java | public void setBinding(Path path, FullType fullType, Template template,
SourceRange sourceRange) {
assert (path != null);
assert (path.isAbsolute());
assert (fullType != null);
// Must make sure that all of the subtypes for the given type are
// defined before adding the binding.
try {
fullType.veri... | [
"public",
"void",
"setBinding",
"(",
"Path",
"path",
",",
"FullType",
"fullType",
",",
"Template",
"template",
",",
"SourceRange",
"sourceRange",
")",
"{",
"assert",
"(",
"path",
"!=",
"null",
")",
";",
"assert",
"(",
"path",
".",
"isAbsolute",
"(",
")",
... | This method associates a type definition to a path. These bindings are
checked as part of the validation process. Note that there can be more
than one binding per path.
@param path
absolute path to bind to the type
@param fullType
data type to use
@param template
template where the binding was defined (used for error
... | [
"This",
"method",
"associates",
"a",
"type",
"definition",
"to",
"a",
"path",
".",
"These",
"bindings",
"are",
"checked",
"as",
"part",
"of",
"the",
"validation",
"process",
".",
"Note",
"that",
"there",
"can",
"be",
"more",
"than",
"one",
"binding",
"per"... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L530-L556 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setGlobalVariable | public void setGlobalVariable(String name, Element value) {
assert (name != null);
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
} | java | public void setGlobalVariable(String name, Element value) {
assert (name != null);
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
} | [
"public",
"void",
"setGlobalVariable",
"(",
"String",
"name",
",",
"Element",
"value",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"GlobalVariable",
"gvar",
"=",
"globalVariables",
".",
"get",
"(",
"name",
")",
";",
"gvar",
".",
"setValue",
... | Set the variable to the given value, preserving the status of the final
flag. This will unconditionally set the value without checking if the
value is final; be careful. The value must already exist. | [
"Set",
"the",
"variable",
"to",
"the",
"given",
"value",
"preserving",
"the",
"status",
"of",
"the",
"final",
"flag",
".",
"This",
"will",
"unconditionally",
"set",
"the",
"value",
"without",
"checking",
"if",
"the",
"value",
"is",
"final",
";",
"be",
"car... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L598-L604 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setGlobalVariable | public void setGlobalVariable(String name, GlobalVariable variable) {
assert (name != null);
if (variable != null) {
globalVariables.put(name, variable);
} else {
globalVariables.remove(name);
}
} | java | public void setGlobalVariable(String name, GlobalVariable variable) {
assert (name != null);
if (variable != null) {
globalVariables.put(name, variable);
} else {
globalVariables.remove(name);
}
} | [
"public",
"void",
"setGlobalVariable",
"(",
"String",
"name",
",",
"GlobalVariable",
"variable",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"if",
"(",
"variable",
"!=",
"null",
")",
"{",
"globalVariables",
".",
"put",
"(",
"name",
",",
"var... | Set the variable to the given GlobalVariable. If variable is null, then
the global variable definition is removed.
@param name
global variable name
@param variable
GlobalVariable to associate with name | [
"Set",
"the",
"variable",
"to",
"the",
"given",
"GlobalVariable",
".",
"If",
"variable",
"is",
"null",
"then",
"the",
"global",
"variable",
"definition",
"is",
"removed",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L615-L624 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.replaceGlobalVariable | public GlobalVariable replaceGlobalVariable(String name, Element value,
boolean finalFlag) {
assert (name != null);
GlobalVariable oldVariable = globalVariables.get(name);
GlobalVariable newVariable = new GlobalVariable(finalFlag, value);
globalVariables.put(name, newVariable);
return oldVariable;
} | java | public GlobalVariable replaceGlobalVariable(String name, Element value,
boolean finalFlag) {
assert (name != null);
GlobalVariable oldVariable = globalVariables.get(name);
GlobalVariable newVariable = new GlobalVariable(finalFlag, value);
globalVariables.put(name, newVariable);
return oldVariable;
} | [
"public",
"GlobalVariable",
"replaceGlobalVariable",
"(",
"String",
"name",
",",
"Element",
"value",
",",
"boolean",
"finalFlag",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"GlobalVariable",
"oldVariable",
"=",
"globalVariables",
".",
"get",
"(",
... | Replaces the given global variable with the given value. The flag
indicates whether or not the variable should be marked as final. Note,
however, that this routine does not respect the final flag and replaces
the value unconditionally. The function returns the old value of the
variable or null if it didn't exist. | [
"Replaces",
"the",
"given",
"global",
"variable",
"with",
"the",
"given",
"value",
".",
"The",
"flag",
"indicates",
"whether",
"or",
"not",
"the",
"variable",
"should",
"be",
"marked",
"as",
"final",
".",
"Note",
"however",
"that",
"this",
"routine",
"does",... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L633-L642 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setGlobalVariable | public void setGlobalVariable(String name, Element value, boolean finalFlag) {
assert (name != null);
// Either modify an existing value (with appropriate checks) or add a
// new one.
if (globalVariables.containsKey(name)) {
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
gvar... | java | public void setGlobalVariable(String name, Element value, boolean finalFlag) {
assert (name != null);
// Either modify an existing value (with appropriate checks) or add a
// new one.
if (globalVariables.containsKey(name)) {
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
gvar... | [
"public",
"void",
"setGlobalVariable",
"(",
"String",
"name",
",",
"Element",
"value",
",",
"boolean",
"finalFlag",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"// Either modify an existing value (with appropriate checks) or add a",
"// new one.",
"if",
"... | Set the variable to the given value. If the value is null, then the
variable will be removed from the context. | [
"Set",
"the",
"variable",
"to",
"the",
"given",
"value",
".",
"If",
"the",
"value",
"is",
"null",
"then",
"the",
"variable",
"will",
"be",
"removed",
"from",
"the",
"context",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L649-L665 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.getGlobalVariable | public Element getGlobalVariable(String name) {
GlobalVariable gvar = globalVariables.get(name);
return (gvar != null) ? gvar.getValue() : null;
} | java | public Element getGlobalVariable(String name) {
GlobalVariable gvar = globalVariables.get(name);
return (gvar != null) ? gvar.getValue() : null;
} | [
"public",
"Element",
"getGlobalVariable",
"(",
"String",
"name",
")",
"{",
"GlobalVariable",
"gvar",
"=",
"globalVariables",
".",
"get",
"(",
"name",
")",
";",
"return",
"(",
"gvar",
"!=",
"null",
")",
"?",
"gvar",
".",
"getValue",
"(",
")",
":",
"null",... | Return the Element which corresponds to the given variable name without
duplicating the value. This is useful when dealing with SELF or with
variables in a context where it is known that the value won't be
modified. | [
"Return",
"the",
"Element",
"which",
"corresponds",
"to",
"the",
"given",
"variable",
"name",
"without",
"duplicating",
"the",
"value",
".",
"This",
"is",
"useful",
"when",
"dealing",
"with",
"SELF",
"or",
"with",
"variables",
"in",
"a",
"context",
"where",
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L697-L700 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.getElement | public Element getElement(Path path, boolean errorIfNotFound)
throws EvaluationException {
// Set the initial node to use.
Element node = null;
// The initial element to use depends on the type of path. Define the
// correct root element.
switch (path.getType()) {
case ABSOLUTE:
// Typical, very ea... | java | public Element getElement(Path path, boolean errorIfNotFound)
throws EvaluationException {
// Set the initial node to use.
Element node = null;
// The initial element to use depends on the type of path. Define the
// correct root element.
switch (path.getType()) {
case ABSOLUTE:
// Typical, very ea... | [
"public",
"Element",
"getElement",
"(",
"Path",
"path",
",",
"boolean",
"errorIfNotFound",
")",
"throws",
"EvaluationException",
"{",
"// Set the initial node to use.",
"Element",
"node",
"=",
"null",
";",
"// The initial element to use depends on the type of path. Define the",... | Pull the value of an element from a configuration tree. This can either
be an absolute, relative, or external path.
@param path
path to lookup
@param errorIfNotFound
if true an EvaluationException will be thrown if the path
can't be found
@return Element associated to the given path
@throws EvaluationException
if th... | [
"Pull",
"the",
"value",
"of",
"an",
"element",
"from",
"a",
"configuration",
"tree",
".",
"This",
"can",
"either",
"be",
"an",
"absolute",
"relative",
"or",
"external",
"path",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L808-L930 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setLocalVariable | public void setLocalVariable(String name, Term[] terms, Element value)
throws EvaluationException {
assert (name != null);
// Only truly local variables can be set via this method. Throw an
// exception if a global variable is found which matches the name.
if (globalVariables.containsKey(name)) {
throw ... | java | public void setLocalVariable(String name, Term[] terms, Element value)
throws EvaluationException {
assert (name != null);
// Only truly local variables can be set via this method. Throw an
// exception if a global variable is found which matches the name.
if (globalVariables.containsKey(name)) {
throw ... | [
"public",
"void",
"setLocalVariable",
"(",
"String",
"name",
",",
"Term",
"[",
"]",
"terms",
",",
"Element",
"value",
")",
"throws",
"EvaluationException",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"// Only truly local variables can be set via this method.... | Set the local variable to the given value. If the value is null, then the
corresponding variable will be removed. If there is a global variable of
the same name, then an EvaluationException will be thrown.
@param name
name of the local variable
@param terms
terms used to dereference the variable, or null if the
variab... | [
"Set",
"the",
"local",
"variable",
"to",
"the",
"given",
"value",
".",
"If",
"the",
"value",
"is",
"null",
"then",
"the",
"corresponding",
"variable",
"will",
"be",
"removed",
".",
"If",
"there",
"is",
"a",
"global",
"variable",
"of",
"the",
"same",
"nam... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L1248-L1304 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/SilentChangeExecutor.java | SilentChangeExecutor.execute | public void execute(final Object observable, final Runnable change) {
listeners.disableFor(observable);
change.run();
listeners.enableFor(observable);
} | java | public void execute(final Object observable, final Runnable change) {
listeners.disableFor(observable);
change.run();
listeners.enableFor(observable);
} | [
"public",
"void",
"execute",
"(",
"final",
"Object",
"observable",
",",
"final",
"Runnable",
"change",
")",
"{",
"listeners",
".",
"disableFor",
"(",
"observable",
")",
";",
"change",
".",
"run",
"(",
")",
";",
"listeners",
".",
"enableFor",
"(",
"observab... | Executes a change to an observable of the users domain model without generating change commands for this change.
<p>
Any changes done to the users domain model are executed over the model change executor passed in the constructor.
</p>
@param observable
The observable that is changed.
@param change
The change that is... | [
"Executes",
"a",
"change",
"to",
"an",
"observable",
"of",
"the",
"users",
"domain",
"model",
"without",
"generating",
"change",
"commands",
"for",
"this",
"change",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/SilentChangeExecutor.java#L48-L52 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/statement/IncludeStatement.java | IncludeStatement.executeWithNamedTemplate | protected void executeWithNamedTemplate(Context context, String name)
throws EvaluationException {
assert (context != null);
assert (name != null);
Template template = null;
boolean runStatic = false;
try {
template = context.localLoad(name);
if (template == null) {
template = context.globalLo... | java | protected void executeWithNamedTemplate(Context context, String name)
throws EvaluationException {
assert (context != null);
assert (name != null);
Template template = null;
boolean runStatic = false;
try {
template = context.localLoad(name);
if (template == null) {
template = context.globalLo... | [
"protected",
"void",
"executeWithNamedTemplate",
"(",
"Context",
"context",
",",
"String",
"name",
")",
"throws",
"EvaluationException",
"{",
"assert",
"(",
"context",
"!=",
"null",
")",
";",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"Template",
"template... | This is a utility method which performs an include from a fixed template
name. The validity of the name should be checked by the subclass; this
avoids unnecessary regular expression matching.
@param context
evaluation context to use
@param name
fixed template name
@throws EvaluationException | [
"This",
"is",
"a",
"utility",
"method",
"which",
"performs",
"an",
"include",
"from",
"a",
"fixed",
"template",
"name",
".",
"The",
"validity",
"of",
"the",
"name",
"should",
"be",
"checked",
"by",
"the",
"subclass",
";",
"this",
"avoids",
"unnecessary",
"... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/statement/IncludeStatement.java#L122-L165 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/statement/IncludeStatement.java | IncludeStatement.runDefaultDml | static private Element runDefaultDml(Operation dml) throws SyntaxException {
// If the argument is null, return null as the value immediately.
if (dml == null) {
return null;
}
// Create a nearly empty execution context. There are no global
// variables by default (including no 'SELF' variable). Only the... | java | static private Element runDefaultDml(Operation dml) throws SyntaxException {
// If the argument is null, return null as the value immediately.
if (dml == null) {
return null;
}
// Create a nearly empty execution context. There are no global
// variables by default (including no 'SELF' variable). Only the... | [
"static",
"private",
"Element",
"runDefaultDml",
"(",
"Operation",
"dml",
")",
"throws",
"SyntaxException",
"{",
"// If the argument is null, return null as the value immediately.",
"if",
"(",
"dml",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Create a nearl... | can be reused. | [
"can",
"be",
"reused",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/statement/IncludeStatement.java#L170-L193 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java | Offliner.retrieveFromCache | private String retrieveFromCache(String url) {
String savedJson;
savedJson = mCacheQueryHandler.get(getContext(), url);
log("---------- body found in offline saver : " + savedJson);
log("----- NO NETWORK : retrieving ends");
return savedJson;
} | java | private String retrieveFromCache(String url) {
String savedJson;
savedJson = mCacheQueryHandler.get(getContext(), url);
log("---------- body found in offline saver : " + savedJson);
log("----- NO NETWORK : retrieving ends");
return savedJson;
} | [
"private",
"String",
"retrieveFromCache",
"(",
"String",
"url",
")",
"{",
"String",
"savedJson",
";",
"savedJson",
"=",
"mCacheQueryHandler",
".",
"get",
"(",
"getContext",
"(",
")",
",",
"url",
")",
";",
"log",
"(",
"\"---------- body found in offline saver : \""... | Get a saved body for a given url.
@param url url for which we need to retrieve the response body in offline mode.
@return response body as string. | [
"Get",
"a",
"saved",
"body",
"for",
"a",
"given",
"url",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java#L156-L163 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java | Offliner.getContext | private Context getContext() {
Context context = mContext.get();
if (context == null) {
throw new IllegalStateException("Context used by the instance has been destroyed.");
}
return context;
} | java | private Context getContext() {
Context context = mContext.get();
if (context == null) {
throw new IllegalStateException("Context used by the instance has been destroyed.");
}
return context;
} | [
"private",
"Context",
"getContext",
"(",
")",
"{",
"Context",
"context",
"=",
"mContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Context used by the instance has been destroyed.\"",... | Retrieve the context if not yet garbage collected.
@return context. | [
"Retrieve",
"the",
"context",
"if",
"not",
"yet",
"garbage",
"collected",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java#L181-L187 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java | Offliner.save | private Response save(Response response) {
String jsonBody;
String key = response.request().url().toString();
log("----- SAVE FOR OFFLINE : saving starts");
log("---------- for request : " + key);
log("---------- trying to parse response body");
//Try to get response bo... | java | private Response save(Response response) {
String jsonBody;
String key = response.request().url().toString();
log("----- SAVE FOR OFFLINE : saving starts");
log("---------- for request : " + key);
log("---------- trying to parse response body");
//Try to get response bo... | [
"private",
"Response",
"save",
"(",
"Response",
"response",
")",
"{",
"String",
"jsonBody",
";",
"String",
"key",
"=",
"response",
".",
"request",
"(",
")",
".",
"url",
"(",
")",
".",
"toString",
"(",
")",
";",
"log",
"(",
"\"----- SAVE FOR OFFLINE : savin... | Allow to save the Response body for offline usage.
@param response response to save | [
"Allow",
"to",
"save",
"the",
"Response",
"body",
"for",
"offline",
"usage",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/Offliner.java#L194-L234 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java | CheerleaderPlayer.destroy | public void destroy() {
if (mIsClosed) {
return;
}
if (mState != STATE_STOPPED) {
mDestroyDelayed = true;
return;
}
mIsClosed = true;
PlaybackService.unregisterListener(getContext(), mInternalListener);
mInternalListener = null... | java | public void destroy() {
if (mIsClosed) {
return;
}
if (mState != STATE_STOPPED) {
mDestroyDelayed = true;
return;
}
mIsClosed = true;
PlaybackService.unregisterListener(getContext(), mInternalListener);
mInternalListener = null... | [
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"mIsClosed",
")",
"{",
"return",
";",
"}",
"if",
"(",
"mState",
"!=",
"STATE_STOPPED",
")",
"{",
"mDestroyDelayed",
"=",
"true",
";",
"return",
";",
"}",
"mIsClosed",
"=",
"true",
";",
"PlaybackSer... | Release resources associated with the player. | [
"Release",
"resources",
"associated",
"with",
"the",
"player",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L141-L160 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java | CheerleaderPlayer.play | public void play(int position) {
checkState();
ArrayList<SoundCloudTrack> tracks = mPlayerPlaylist.getPlaylist().getTracks();
if (position >= 0 && position < tracks.size()) {
SoundCloudTrack trackToPlay = tracks.get(position);
mPlayerPlaylist.setPlayingTrack(position);
... | java | public void play(int position) {
checkState();
ArrayList<SoundCloudTrack> tracks = mPlayerPlaylist.getPlaylist().getTracks();
if (position >= 0 && position < tracks.size()) {
SoundCloudTrack trackToPlay = tracks.get(position);
mPlayerPlaylist.setPlayingTrack(position);
... | [
"public",
"void",
"play",
"(",
"int",
"position",
")",
"{",
"checkState",
"(",
")",
";",
"ArrayList",
"<",
"SoundCloudTrack",
">",
"tracks",
"=",
"mPlayerPlaylist",
".",
"getPlaylist",
"(",
")",
".",
"getTracks",
"(",
")",
";",
"if",
"(",
"position",
">=... | Play a track at a given position in the player playlist.
@param position position of the track in the playlist. | [
"Play",
"a",
"track",
"at",
"a",
"given",
"position",
"in",
"the",
"player",
"playlist",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L187-L196 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java | CheerleaderPlayer.addTrack | public void addTrack(SoundCloudTrack track, boolean playNow) {
checkState();
mPlayerPlaylist.add(track);
for (CheerleaderPlaylistListener listener : mCheerleaderPlaylistListeners) {
listener.onTrackAdded(track);
}
if (playNow) {
play(mPlayerPlaylist.size()... | java | public void addTrack(SoundCloudTrack track, boolean playNow) {
checkState();
mPlayerPlaylist.add(track);
for (CheerleaderPlaylistListener listener : mCheerleaderPlaylistListeners) {
listener.onTrackAdded(track);
}
if (playNow) {
play(mPlayerPlaylist.size()... | [
"public",
"void",
"addTrack",
"(",
"SoundCloudTrack",
"track",
",",
"boolean",
"playNow",
")",
"{",
"checkState",
"(",
")",
";",
"mPlayerPlaylist",
".",
"add",
"(",
"track",
")",
";",
"for",
"(",
"CheerleaderPlaylistListener",
"listener",
":",
"mCheerleaderPlayl... | Add a track to the current SoundCloud player playlist.
@param track {@link fr.tvbarthel.cheerleader.library.client.SoundCloudTrack} to be
added to the player.
@param playNow true to play the track immediately. | [
"Add",
"a",
"track",
"to",
"the",
"current",
"SoundCloud",
"player",
"playlist",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L313-L322 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java | CheerleaderPlayer.addTracks | public void addTracks(List<SoundCloudTrack> tracks) {
checkState();
for (SoundCloudTrack track : tracks) {
addTrack(track);
}
} | java | public void addTracks(List<SoundCloudTrack> tracks) {
checkState();
for (SoundCloudTrack track : tracks) {
addTrack(track);
}
} | [
"public",
"void",
"addTracks",
"(",
"List",
"<",
"SoundCloudTrack",
">",
"tracks",
")",
"{",
"checkState",
"(",
")",
";",
"for",
"(",
"SoundCloudTrack",
"track",
":",
"tracks",
")",
"{",
"addTrack",
"(",
"track",
")",
";",
"}",
"}"
] | Add a list of track to thr current SoundCloud player playlist.
@param tracks list of {@link fr.tvbarthel.cheerleader.library.client.SoundCloudTrack}
to be added to the player. | [
"Add",
"a",
"list",
"of",
"track",
"to",
"thr",
"current",
"SoundCloud",
"player",
"playlist",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L330-L335 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java | CheerleaderPlayer.registerPlayerListener | public void registerPlayerListener(CheerleaderPlayerListener listener) {
checkState();
mCheerleaderPlayerListeners.add(listener);
if (mState == STATE_PLAYING) {
listener.onPlayerPlay(mPlayerPlaylist.getCurrentTrack(), mPlayerPlaylist.getCurrentTrackIndex());
} else if (mState... | java | public void registerPlayerListener(CheerleaderPlayerListener listener) {
checkState();
mCheerleaderPlayerListeners.add(listener);
if (mState == STATE_PLAYING) {
listener.onPlayerPlay(mPlayerPlaylist.getCurrentTrack(), mPlayerPlaylist.getCurrentTrackIndex());
} else if (mState... | [
"public",
"void",
"registerPlayerListener",
"(",
"CheerleaderPlayerListener",
"listener",
")",
"{",
"checkState",
"(",
")",
";",
"mCheerleaderPlayerListeners",
".",
"add",
"(",
"listener",
")",
";",
"if",
"(",
"mState",
"==",
"STATE_PLAYING",
")",
"{",
"listener",... | Register a listener to catch player events.
@param listener listener to register. | [
"Register",
"a",
"listener",
"to",
"catch",
"player",
"events",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L403-L411 | train |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java | CheerleaderPlayer.initInternalListener | private void initInternalListener(Context context) {
mInternalListener = new PlaybackListener() {
@Override
protected void onPlay(SoundCloudTrack track) {
super.onPlay(track);
mState = STATE_PLAYING;
for (CheerleaderPlayerListener listener ... | java | private void initInternalListener(Context context) {
mInternalListener = new PlaybackListener() {
@Override
protected void onPlay(SoundCloudTrack track) {
super.onPlay(track);
mState = STATE_PLAYING;
for (CheerleaderPlayerListener listener ... | [
"private",
"void",
"initInternalListener",
"(",
"Context",
"context",
")",
"{",
"mInternalListener",
"=",
"new",
"PlaybackListener",
"(",
")",
"{",
"@",
"Override",
"protected",
"void",
"onPlay",
"(",
"SoundCloudTrack",
"track",
")",
"{",
"super",
".",
"onPlay",... | Initialize the internal listener.
@param context context used to register the internal listener. | [
"Initialize",
"the",
"internal",
"listener",
"."
] | f61527e4cc44fcd0ed2e1e98aca285f8c236f24e | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L460-L525 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/MessageUtils.java | MessageUtils.getMessageString | public static String getMessageString(String msgKey) {
assert (msgKey != null);
try {
return bundle.getString(msgKey);
} catch (MissingResourceException mre) {
throw new CompilerError(mre.getLocalizedMessage());
} catch (ClassCastException cce) {
t... | java | public static String getMessageString(String msgKey) {
assert (msgKey != null);
try {
return bundle.getString(msgKey);
} catch (MissingResourceException mre) {
throw new CompilerError(mre.getLocalizedMessage());
} catch (ClassCastException cce) {
t... | [
"public",
"static",
"String",
"getMessageString",
"(",
"String",
"msgKey",
")",
"{",
"assert",
"(",
"msgKey",
"!=",
"null",
")",
";",
"try",
"{",
"return",
"bundle",
".",
"getString",
"(",
"msgKey",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
... | Look up a localized message in the message bundle and return a MessageFormat for it.
@param msgKey key that identifies which message to retrieve
@return MessageFormat corresponding to the given key | [
"Look",
"up",
"a",
"localized",
"message",
"in",
"the",
"message",
"bundle",
"and",
"return",
"a",
"MessageFormat",
"for",
"it",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/MessageUtils.java#L529-L542 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/utils/MessageUtils.java | MessageUtils.format | public static String format(String msgKey, Object... args) {
try {
return MessageFormat.format(getMessageString(msgKey), args);
} catch (IllegalArgumentException iae) {
throw new CompilerError(
"bundle contains invalid message format for key '" + msgKey + "... | java | public static String format(String msgKey, Object... args) {
try {
return MessageFormat.format(getMessageString(msgKey), args);
} catch (IllegalArgumentException iae) {
throw new CompilerError(
"bundle contains invalid message format for key '" + msgKey + "... | [
"public",
"static",
"String",
"format",
"(",
"String",
"msgKey",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"getMessageString",
"(",
"msgKey",
")",
",",
"args",
")",
";",
"}",
"catch",
"(",
"Illegal... | Format a message corresponding to the given key and using the given arguments.
@param msgKey key that identifies which message to retrieve
@param args arguments to use to complete the message
@return localized String corresponding to the given key and arguments | [
"Format",
"a",
"message",
"corresponding",
"to",
"the",
"given",
"key",
"and",
"using",
"the",
"given",
"arguments",
"."
] | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/utils/MessageUtils.java#L551-L563 | train |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ReparingListPropertyCommandExecutor.java | ReparingListPropertyCommandExecutor.execute | @SuppressWarnings({ "rawtypes", "unchecked" })
// The alternative would be to change the TopologolyLayerCallback.send() to take List<? extends Command>
private void execute(final ListCommand command) {
getMetaData(command);
final Queue<ListCommand> log = metaData.getUnapprovedCommands();
... | java | @SuppressWarnings({ "rawtypes", "unchecked" })
// The alternative would be to change the TopologolyLayerCallback.send() to take List<? extends Command>
private void execute(final ListCommand command) {
getMetaData(command);
final Queue<ListCommand> log = metaData.getUnapprovedCommands();
... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"// The alternative would be to change the TopologolyLayerCallback.send() to take List<? extends Command>",
"private",
"void",
"execute",
"(",
"final",
"ListCommand",
"command",
")",
"{",
"getMet... | Executes a remotely received command, repairs it when necessary and resends repaired versions of local commands
that where obsoleted by the received command.
@param command
The command to execute. | [
"Executes",
"a",
"remotely",
"received",
"command",
"repairs",
"it",
"when",
"necessary",
"and",
"resends",
"repaired",
"versions",
"of",
"local",
"commands",
"that",
"where",
"obsoleted",
"by",
"the",
"received",
"command",
"."
] | f3683020e4749110b38514eb5bc73a247998b579 | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ReparingListPropertyCommandExecutor.java#L123-L153 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java | AbstractElement.checkValidReplacement | public void checkValidReplacement(Element newValue)
throws EvaluationException {
// Only need to check if new values is not undef or null. Undef or null
// can replace any value.
if (!(newValue instanceof Undef) && !(newValue instanceof Null)) {
if (!this.getClass().isAssignableFrom(newValue.getClass())) ... | java | public void checkValidReplacement(Element newValue)
throws EvaluationException {
// Only need to check if new values is not undef or null. Undef or null
// can replace any value.
if (!(newValue instanceof Undef) && !(newValue instanceof Null)) {
if (!this.getClass().isAssignableFrom(newValue.getClass())) ... | [
"public",
"void",
"checkValidReplacement",
"(",
"Element",
"newValue",
")",
"throws",
"EvaluationException",
"{",
"// Only need to check if new values is not undef or null. Undef or null",
"// can replace any value.",
"if",
"(",
"!",
"(",
"newValue",
"instanceof",
"Undef",
")",... | Check that the newValue is a valid replacement for the this value. This
implementation will check if the newValue is assignable from the current
value or that the newValue is either undef or null. If not, an evaluation
exception will be thrown. This implementation should be overridden if
more liberal replacements are a... | [
"Check",
"that",
"the",
"newValue",
"is",
"a",
"valid",
"replacement",
"for",
"the",
"this",
"value",
".",
"This",
"implementation",
"will",
"check",
"if",
"the",
"newValue",
"is",
"assignable",
"from",
"the",
"current",
"value",
"or",
"that",
"the",
"newVal... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java#L170-L185 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java | AbstractElement.rget | public Element rget(Term[] terms, int index, boolean protect,
boolean lookupOnly) throws InvalidTermException {
if (!lookupOnly) {
throw new EvaluationException(MessageUtils.format(
MSG_ILLEGAL_DEREFERENCE, this.getTypeAsString()));
}
return null;
} | java | public Element rget(Term[] terms, int index, boolean protect,
boolean lookupOnly) throws InvalidTermException {
if (!lookupOnly) {
throw new EvaluationException(MessageUtils.format(
MSG_ILLEGAL_DEREFERENCE, this.getTypeAsString()));
}
return null;
} | [
"public",
"Element",
"rget",
"(",
"Term",
"[",
"]",
"terms",
",",
"int",
"index",
",",
"boolean",
"protect",
",",
"boolean",
"lookupOnly",
")",
"throws",
"InvalidTermException",
"{",
"if",
"(",
"!",
"lookupOnly",
")",
"{",
"throw",
"new",
"EvaluationExceptio... | Dereference the Element to return the value of a child. Any resource
should return the value of the given child. The default implementation of
this method will throw an EvaluationException indicating that this
Element cannot be dereferenced.
@param terms
list of terms to use for dereference
@param index
the term to us... | [
"Dereference",
"the",
"Element",
"to",
"return",
"the",
"value",
"of",
"a",
"child",
".",
"Any",
"resource",
"should",
"return",
"the",
"value",
"of",
"the",
"given",
"child",
".",
"The",
"default",
"implementation",
"of",
"this",
"method",
"will",
"throw",
... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java#L218-L225 | train |
quattor/pan | panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java | AbstractElement.rgetList | public ListResource rgetList(Term[] terms, int index)
throws InvalidTermException {
throw new EvaluationException(MessageUtils.format(
MSG_ILLEGAL_DEREFERENCE, this.getTypeAsString()));
} | java | public ListResource rgetList(Term[] terms, int index)
throws InvalidTermException {
throw new EvaluationException(MessageUtils.format(
MSG_ILLEGAL_DEREFERENCE, this.getTypeAsString()));
} | [
"public",
"ListResource",
"rgetList",
"(",
"Term",
"[",
"]",
"terms",
",",
"int",
"index",
")",
"throws",
"InvalidTermException",
"{",
"throw",
"new",
"EvaluationException",
"(",
"MessageUtils",
".",
"format",
"(",
"MSG_ILLEGAL_DEREFERENCE",
",",
"this",
".",
"g... | This is a special lookup function that will retrieve a list from the
resource. If the resource does not exist, an empty list will be created.
All necessary parent resources are created. The returned list is
guaranteed to be a writable resource.
@param terms
list of terms to use for dereference
@param index
the term to... | [
"This",
"is",
"a",
"special",
"lookup",
"function",
"that",
"will",
"retrieve",
"a",
"list",
"from",
"the",
"resource",
".",
"If",
"the",
"resource",
"does",
"not",
"exist",
"an",
"empty",
"list",
"will",
"be",
"created",
".",
"All",
"necessary",
"parent",... | 009934a603dd0c08d3fa4bb7d9389c380a916f54 | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java#L240-L244 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.