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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.postDelete | public void postDelete(String blogName, Long postId) {
Map<String, String> map = new HashMap<String, String>();
map.put("id", postId.toString());
requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map);
} | java | public void postDelete(String blogName, Long postId) {
Map<String, String> map = new HashMap<String, String>();
map.put("id", postId.toString());
requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map);
} | [
"public",
"void",
"postDelete",
"(",
"String",
"blogName",
",",
"Long",
"postId",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"id\"",
... | Delete a given post
@param blogName the name of the blog the post is in
@param postId the id of the post to delete | [
"Delete",
"a",
"given",
"post"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L328-L332 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.postEdit | public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException {
Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail);
sdetail.put("id", id);
requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail);
} | java | public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException {
Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail);
sdetail.put("id", id);
requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail);
} | [
"public",
"void",
"postEdit",
"(",
"String",
"blogName",
",",
"Long",
"id",
",",
"Map",
"<",
"String",
",",
"?",
">",
"detail",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"sdetail",
"=",
"JumblrClient",
".",
"safeOptionM... | Save edits for a given post
@param blogName The blog name of the post
@param id the Post id
@param detail The detail to save
@throws IOException if any file specified in detail cannot be read | [
"Save",
"edits",
"for",
"a",
"given",
"post"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L371-L375 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.postCreate | public Long postCreate(String blogName, Map<String, ?> detail) throws IOException {
return requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post"), detail).getId();
} | java | public Long postCreate(String blogName, Map<String, ?> detail) throws IOException {
return requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post"), detail).getId();
} | [
"public",
"Long",
"postCreate",
"(",
"String",
"blogName",
",",
"Map",
"<",
"String",
",",
"?",
">",
"detail",
")",
"throws",
"IOException",
"{",
"return",
"requestBuilder",
".",
"postMultipart",
"(",
"JumblrClient",
".",
"blogPath",
"(",
"blogName",
",",
"\... | Create a post
@param blogName The blog name for the post
@param detail the detail to save
@return Long the created post's id
@throws IOException if any file specified in detail cannot be read | [
"Create",
"a",
"post"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L384-L386 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.newPost | public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException {
T post = klass.newInstance();
post.setClient(this);
post.setBlogName(blogName);
return post;
} | java | public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException {
T post = klass.newInstance();
post.setClient(this);
post.setBlogName(blogName);
return post;
} | [
"public",
"<",
"T",
"extends",
"Post",
">",
"T",
"newPost",
"(",
"String",
"blogName",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"IllegalAccessException",
",",
"InstantiationException",
"{",
"T",
"post",
"=",
"klass",
".",
"newInstance",
"(",
")... | Set up a new post of a given type
@param blogName the name of the blog for this post (or null)
@param klass the type of Post to instantiate
@param <T> the type of Post to instantiate
@return the new post with the client set
@throws IllegalAccessException if class instantiation fails
@throws InstantiationException if cl... | [
"Set",
"up",
"a",
"new",
"post",
"of",
"a",
"given",
"type"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L397-L402 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.followers | public List<User> followers(Map<String, ?> options) {
return client.blogFollowers(this.name, options);
} | java | public List<User> followers(Map<String, ?> options) {
return client.blogFollowers(this.name, options);
} | [
"public",
"List",
"<",
"User",
">",
"followers",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"options",
")",
"{",
"return",
"client",
".",
"blogFollowers",
"(",
"this",
".",
"name",
",",
"options",
")",
";",
"}"
] | Get followers for this blog
@param options a map of options (or null)
@return A List of users | [
"Get",
"followers",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L105-L107 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.posts | public List<Post> posts(Map<String, ?> options) {
return client.blogPosts(name, options);
} | java | public List<Post> posts(Map<String, ?> options) {
return client.blogPosts(name, options);
} | [
"public",
"List",
"<",
"Post",
">",
"posts",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"options",
")",
"{",
"return",
"client",
".",
"blogPosts",
"(",
"name",
",",
"options",
")",
";",
"}"
] | Get the posts for this blog
@param options a map of options (or null)
@return A List of posts | [
"Get",
"the",
"posts",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L116-L118 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.likedPosts | public List<Post> likedPosts(Map<String, ?> options) {
return client.blogLikes(this.name, options);
} | java | public List<Post> likedPosts(Map<String, ?> options) {
return client.blogLikes(this.name, options);
} | [
"public",
"List",
"<",
"Post",
">",
"likedPosts",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"options",
")",
"{",
"return",
"client",
".",
"blogLikes",
"(",
"this",
".",
"name",
",",
"options",
")",
";",
"}"
] | Get likes posts for this blog
@param options a map of options (or null)
@return A List of posts | [
"Get",
"likes",
"posts",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L138-L140 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.queuedPosts | public List<Post> queuedPosts(Map<String, ?> options) {
return client.blogQueuedPosts(name, options);
} | java | public List<Post> queuedPosts(Map<String, ?> options) {
return client.blogQueuedPosts(name, options);
} | [
"public",
"List",
"<",
"Post",
">",
"queuedPosts",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"options",
")",
"{",
"return",
"client",
".",
"blogQueuedPosts",
"(",
"name",
",",
"options",
")",
";",
"}"
] | Get the queued posts for this blog
@param options the options (or null)
@return a List of posts | [
"Get",
"the",
"queued",
"posts",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L163-L165 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.draftPosts | public List<Post> draftPosts(Map<String, ?> options) {
return client.blogDraftPosts(name, options);
} | java | public List<Post> draftPosts(Map<String, ?> options) {
return client.blogDraftPosts(name, options);
} | [
"public",
"List",
"<",
"Post",
">",
"draftPosts",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"options",
")",
"{",
"return",
"client",
".",
"blogDraftPosts",
"(",
"name",
",",
"options",
")",
";",
"}"
] | Get the draft posts for this blog
@param options the options (or null)
@return a List of posts | [
"Get",
"the",
"draft",
"posts",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L176-L178 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.submissions | public List<Post> submissions(Map<String, ?> options) {
return client.blogSubmissions(name, options);
} | java | public List<Post> submissions(Map<String, ?> options) {
return client.blogSubmissions(name, options);
} | [
"public",
"List",
"<",
"Post",
">",
"submissions",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"options",
")",
"{",
"return",
"client",
".",
"blogSubmissions",
"(",
"name",
",",
"options",
")",
";",
"}"
] | Get the submissions for this blog
@param options the options (or null)
@return a List of posts | [
"Get",
"the",
"submissions",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L189-L191 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Blog.java | Blog.newPost | public <T extends Post> T newPost(Class<T> klass) throws IllegalAccessException, InstantiationException {
return client.newPost(name, klass);
} | java | public <T extends Post> T newPost(Class<T> klass) throws IllegalAccessException, InstantiationException {
return client.newPost(name, klass);
} | [
"public",
"<",
"T",
"extends",
"Post",
">",
"T",
"newPost",
"(",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"IllegalAccessException",
",",
"InstantiationException",
"{",
"return",
"client",
".",
"newPost",
"(",
"name",
",",
"klass",
")",
";",
"}"
] | Create a new post of a given type for this blog
@param klass the class of the post to make
@param <T> the class of the post to make
@return new post
@throws IllegalAccessException if class instantiation fails
@throws InstantiationException if class instantiation fails | [
"Create",
"a",
"new",
"post",
"of",
"a",
"given",
"type",
"for",
"this",
"blog"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L205-L207 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/types/Photo.java | Photo.getType | public PhotoType getType() {
if (this.source != null) { return PhotoType.SOURCE; }
if (this.file != null) { return PhotoType.FILE; }
return null;
} | java | public PhotoType getType() {
if (this.source != null) { return PhotoType.SOURCE; }
if (this.file != null) { return PhotoType.FILE; }
return null;
} | [
"public",
"PhotoType",
"getType",
"(",
")",
"{",
"if",
"(",
"this",
".",
"source",
"!=",
"null",
")",
"{",
"return",
"PhotoType",
".",
"SOURCE",
";",
"}",
"if",
"(",
"this",
".",
"file",
"!=",
"null",
")",
"{",
"return",
"PhotoType",
".",
"FILE",
"... | Get the type of this photo
@return PhotoType the type of photo | [
"Get",
"the",
"type",
"of",
"this",
"photo"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Photo.java#L56-L60 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/request/RequestBuilder.java | RequestBuilder.postXAuth | public Token postXAuth(final String email, final String password) {
OAuthRequest request = constructXAuthPost(email, password);
setToken("", ""); // Empty token is required for Scribe to execute XAuth.
sign(request);
return clearXAuth(request.send());
} | java | public Token postXAuth(final String email, final String password) {
OAuthRequest request = constructXAuthPost(email, password);
setToken("", ""); // Empty token is required for Scribe to execute XAuth.
sign(request);
return clearXAuth(request.send());
} | [
"public",
"Token",
"postXAuth",
"(",
"final",
"String",
"email",
",",
"final",
"String",
"password",
")",
"{",
"OAuthRequest",
"request",
"=",
"constructXAuthPost",
"(",
"email",
",",
"password",
")",
";",
"setToken",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"/... | Posts an XAuth request. A new method is needed because the response from
the server is not a standard Tumblr JSON response.
@param email the user's login email.
@param password the user's password.
@return the login token. | [
"Posts",
"an",
"XAuth",
"request",
".",
"A",
"new",
"method",
"is",
"needed",
"because",
"the",
"response",
"from",
"the",
"server",
"is",
"not",
"a",
"standard",
"Tumblr",
"JSON",
"response",
"."
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/request/RequestBuilder.java#L74-L79 | train |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/request/RequestBuilder.java | RequestBuilder.constructXAuthPost | private OAuthRequest constructXAuthPost(String email, String password) {
OAuthRequest request = new OAuthRequest(Verb.POST, xauthEndpoint);
request.addBodyParameter("x_auth_username", email);
request.addBodyParameter("x_auth_password", password);
request.addBodyParameter("x_auth_mode", "... | java | private OAuthRequest constructXAuthPost(String email, String password) {
OAuthRequest request = new OAuthRequest(Verb.POST, xauthEndpoint);
request.addBodyParameter("x_auth_username", email);
request.addBodyParameter("x_auth_password", password);
request.addBodyParameter("x_auth_mode", "... | [
"private",
"OAuthRequest",
"constructXAuthPost",
"(",
"String",
"email",
",",
"String",
"password",
")",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"POST",
",",
"xauthEndpoint",
")",
";",
"request",
".",
"addBodyParameter",
"("... | Construct an XAuth request | [
"Construct",
"an",
"XAuth",
"request"
] | 373629fd545defb016e227ea758f092507fbd624 | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/request/RequestBuilder.java#L82-L88 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.getType | public LazyType getType(int index) throws LazyException{
LazyNode token=getValueToken(index);
switch(token.type){
case LazyNode.OBJECT: return LazyType.OBJECT;
case LazyNode.ARRAY: return LazyType.ARRAY;
case LazyNode.VALUE_TRUE: return LazyType.BOOLEAN;
case LazyNode.VALUE_FALSE: return LazyType.BOOLEA... | java | public LazyType getType(int index) throws LazyException{
LazyNode token=getValueToken(index);
switch(token.type){
case LazyNode.OBJECT: return LazyType.OBJECT;
case LazyNode.ARRAY: return LazyType.ARRAY;
case LazyNode.VALUE_TRUE: return LazyType.BOOLEAN;
case LazyNode.VALUE_FALSE: return LazyType.BOOLEA... | [
"public",
"LazyType",
"getType",
"(",
"int",
"index",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getValueToken",
"(",
"index",
")",
";",
"switch",
"(",
"token",
".",
"type",
")",
"{",
"case",
"LazyNode",
".",
"OBJECT",
":",
"return",
... | Returns the value type of the given field.
@param index the requested field
@return the type of the value for the given index
@throws LazyException if the requested index did not exist | [
"Returns",
"the",
"value",
"type",
"of",
"the",
"given",
"field",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L124-L138 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.getBoolean | public boolean getBoolean(int index){
LazyNode token=getValueToken(index);
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a boolean",token);
} | java | public boolean getBoolean(int index){
LazyNode token=getValueToken(index);
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a boolean",token);
} | [
"public",
"boolean",
"getBoolean",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"VALUE_TRUE",
")",
"return",
"true",
";",
"if",
"(",
"token",
"... | Returns the boolean value stored at the given index.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"boolean",
"value",
"stored",
"at",
"the",
"given",
"index",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L500-L505 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.optBoolean | public boolean optBoolean(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return false;
if(token.type==LazyNode.VALUE_NULL)return false;
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a... | java | public boolean optBoolean(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return false;
if(token.type==LazyNode.VALUE_NULL)return false;
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a... | [
"public",
"boolean",
"optBoolean",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",... | Returns the boolean value stored at the given index or null if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"boolean",
"value",
"stored",
"at",
"the",
"given",
"index",
"or",
"null",
"if",
"there",
"was",
"no",
"such",
"value",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L514-L521 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.getString | public String getString(int index) throws LazyException{
LazyNode token=getValueToken(index);
return token.getStringValue();
} | java | public String getString(int index) throws LazyException{
LazyNode token=getValueToken(index);
return token.getStringValue();
} | [
"public",
"String",
"getString",
"(",
"int",
"index",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getValueToken",
"(",
"index",
")",
";",
"return",
"token",
".",
"getStringValue",
"(",
")",
";",
"}"
] | Returns the string value stored at the given index.
@param index the location of the value in this array
@return the value if it could be parsed as a string
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"string",
"value",
"stored",
"at",
"the",
"given",
"index",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L547-L550 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.optString | public String optString(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return null;
if(token.type==LazyNode.VALUE_NULL)return null;
return token.getStringValue();
} | java | public String optString(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return null;
if(token.type==LazyNode.VALUE_NULL)return null;
return token.getStringValue();
} | [
"public",
"String",
"optString",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
... | Returns the string value stored at the given index or null if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"string",
"value",
"stored",
"at",
"the",
"given",
"index",
"or",
"null",
"if",
"there",
"was",
"no",
"such",
"value",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L559-L564 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.optInt | public int optInt(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return 0;
if(token.type==LazyNode.VALUE_NULL)return 0;
return token.getIntValue();
} | java | public int optInt(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return 0;
if(token.type==LazyNode.VALUE_NULL)return 0;
return token.getIntValue();
} | [
"public",
"int",
"optInt",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"0",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"V... | Returns the int value stored at the given index or 0 if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"int",
"value",
"stored",
"at",
"the",
"given",
"index",
"or",
"0",
"if",
"there",
"was",
"no",
"such",
"value",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L600-L605 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.optLong | public long optLong(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return 0l;
if(token.type==LazyNode.VALUE_NULL)return 0l;
return token.getLongValue();
} | java | public long optLong(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return 0l;
if(token.type==LazyNode.VALUE_NULL)return 0l;
return token.getLongValue();
} | [
"public",
"long",
"optLong",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"0l",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
... | Returns the long value stored at the given index or 0 if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"long",
"value",
"stored",
"at",
"the",
"given",
"index",
"or",
"0",
"if",
"there",
"was",
"no",
"such",
"value",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L641-L646 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.optDouble | public double optDouble(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return 0.0;
if(token.type==LazyNode.VALUE_NULL)return 0.0;
return token.getDoubleValue();
} | java | public double optDouble(int index){
LazyNode token=getOptionalValueToken(index);
if(token==null)return 0.0;
if(token.type==LazyNode.VALUE_NULL)return 0.0;
return token.getDoubleValue();
} | [
"public",
"double",
"optDouble",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"0.0",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
"... | Returns the double value stored at the given index or 0.0 if there was no such value.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean or null if there was no such value
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"double",
"value",
"stored",
"at",
"the",
"given",
"index",
"or",
"0",
".",
"0",
"if",
"there",
"was",
"no",
"such",
"value",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L682-L687 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.isNull | public boolean isNull(int index) throws LazyException{
LazyNode token=getValueToken(index);
if(token.type==LazyNode.VALUE_NULL)return true;
return false;
} | java | public boolean isNull(int index) throws LazyException{
LazyNode token=getValueToken(index);
if(token.type==LazyNode.VALUE_NULL)return true;
return false;
} | [
"public",
"boolean",
"isNull",
"(",
"int",
"index",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"VALUE_NULL",
")",
"return",
"true",
";",
... | Returns true if the value stored at the given index is null.
@param index the location of the value in this array
@return true if the value is null, false otherwise
@throws LazyException if the index is out of bounds | [
"Returns",
"true",
"if",
"the",
"value",
"stored",
"at",
"the",
"given",
"index",
"is",
"null",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L711-L715 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.getOptionalValueToken | private LazyNode getOptionalValueToken(int index) throws LazyException{
if(index<0)throw new LazyException("Array undex can not be negative");
int num=0;
LazyNode child=root.child;
// If the value we are looking for is past our previous traversal point
// continue at the previous point
if(selectInt>-1 && in... | java | private LazyNode getOptionalValueToken(int index) throws LazyException{
if(index<0)throw new LazyException("Array undex can not be negative");
int num=0;
LazyNode child=root.child;
// If the value we are looking for is past our previous traversal point
// continue at the previous point
if(selectInt>-1 && in... | [
"private",
"LazyNode",
"getOptionalValueToken",
"(",
"int",
"index",
")",
"throws",
"LazyException",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"throw",
"new",
"LazyException",
"(",
"\"Array undex can not be negative\"",
")",
";",
"int",
"num",
"=",
"0",
";",
"La... | Values for an array are attached as children on the token representing
the array itself. This method finds the correct child for a given index
and returns it.
Since children are stored as a linked list, this method is likely to be
a serious O(n) performance bottleneck for array access. To improve this
for the most com... | [
"Values",
"for",
"an",
"array",
"are",
"attached",
"as",
"children",
"on",
"the",
"token",
"representing",
"the",
"array",
"itself",
".",
"This",
"method",
"finds",
"the",
"correct",
"child",
"for",
"a",
"given",
"index",
"and",
"returns",
"it",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L770-L791 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyParser.java | LazyParser.push | private void push(final LazyNode token){
stackTop.addChild(token);
// The stack allocation strategy here is to increase it in increments
// of a power of two. This lets us check when all low bits are set and
// its time to increase the stack again.
// This lets us do a compare between a constant and a variabl... | java | private void push(final LazyNode token){
stackTop.addChild(token);
// The stack allocation strategy here is to increase it in increments
// of a power of two. This lets us check when all low bits are set and
// its time to increase the stack again.
// This lets us do a compare between a constant and a variabl... | [
"private",
"void",
"push",
"(",
"final",
"LazyNode",
"token",
")",
"{",
"stackTop",
".",
"addChild",
"(",
"token",
")",
";",
"// The stack allocation strategy here is to increase it in increments",
"// of a power of two. This lets us check when all low bits are set and",
"// its ... | Push a token onto the stack and attach it to the previous top as a child | [
"Push",
"a",
"token",
"onto",
"the",
"stack",
"and",
"attach",
"it",
"to",
"the",
"previous",
"top",
"as",
"a",
"child"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L59-L74 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyParser.java | LazyParser.pop | private LazyNode pop(){
LazyNode value=stackTop;
stackPointer--;
if(stackPointer>0){
stackTop=stack[stackPointer-1];
}
return value;
} | java | private LazyNode pop(){
LazyNode value=stackTop;
stackPointer--;
if(stackPointer>0){
stackTop=stack[stackPointer-1];
}
return value;
} | [
"private",
"LazyNode",
"pop",
"(",
")",
"{",
"LazyNode",
"value",
"=",
"stackTop",
";",
"stackPointer",
"--",
";",
"if",
"(",
"stackPointer",
">",
"0",
")",
"{",
"stackTop",
"=",
"stack",
"[",
"stackPointer",
"-",
"1",
"]",
";",
"}",
"return",
"value",... | Pop a token off the stack and reset the stackTop pointer | [
"Pop",
"a",
"token",
"off",
"the",
"stack",
"and",
"reset",
"the",
"stackTop",
"pointer"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L77-L84 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyParser.java | LazyParser.consumeWhiteSpace | private final void consumeWhiteSpace(){
char c=cbuf[n];
while(c==CH_SPACE|| c==CH_LINEFEED || c==CH_TAB || c==CH_CARRIAGE_RETURN){
n++;
c=cbuf[n];
}
} | java | private final void consumeWhiteSpace(){
char c=cbuf[n];
while(c==CH_SPACE|| c==CH_LINEFEED || c==CH_TAB || c==CH_CARRIAGE_RETURN){
n++;
c=cbuf[n];
}
} | [
"private",
"final",
"void",
"consumeWhiteSpace",
"(",
")",
"{",
"char",
"c",
"=",
"cbuf",
"[",
"n",
"]",
";",
"while",
"(",
"c",
"==",
"CH_SPACE",
"||",
"c",
"==",
"CH_LINEFEED",
"||",
"c",
"==",
"CH_TAB",
"||",
"c",
"==",
"CH_CARRIAGE_RETURN",
")",
... | Utility method to consume sections of whitespace | [
"Utility",
"method",
"to",
"consume",
"sections",
"of",
"whitespace"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L97-L103 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyParser.java | LazyParser.consumeString | private final boolean consumeString() throws LazyException{
boolean escaped=false;
n++;
char c=cbuf[n];
while(c!=CH_QUOTE){
if(c==CH_BACKSLASH){
n++;
c=cbuf[n];
if(!(c==CH_QUOTE || c==CH_BACKSLASH || c==CH_SLASH || c==CH_b || c==CH_f || c==CH_n || c==CH_r || c==CH_t || c==CH_u)){
throw new L... | java | private final boolean consumeString() throws LazyException{
boolean escaped=false;
n++;
char c=cbuf[n];
while(c!=CH_QUOTE){
if(c==CH_BACKSLASH){
n++;
c=cbuf[n];
if(!(c==CH_QUOTE || c==CH_BACKSLASH || c==CH_SLASH || c==CH_b || c==CH_f || c==CH_n || c==CH_r || c==CH_t || c==CH_u)){
throw new L... | [
"private",
"final",
"boolean",
"consumeString",
"(",
")",
"throws",
"LazyException",
"{",
"boolean",
"escaped",
"=",
"false",
";",
"n",
"++",
";",
"char",
"c",
"=",
"cbuf",
"[",
"n",
"]",
";",
"while",
"(",
"c",
"!=",
"CH_QUOTE",
")",
"{",
"if",
"(",... | element if an escape character is found | [
"element",
"if",
"an",
"escape",
"character",
"is",
"found"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L116-L133 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyParser.java | LazyParser.consumeNumber | private final boolean consumeNumber(char c) throws LazyException{
boolean floatChar=false;
if(c==CH_DASH){
// If the number started with a minus sign it must be followed by at least one digit
n++;
c=cbuf[n];
if(c<CH_0 || c>CH_9){
throw new LazyException("Digit expected",n);
}
}
n++;
if(c==C... | java | private final boolean consumeNumber(char c) throws LazyException{
boolean floatChar=false;
if(c==CH_DASH){
// If the number started with a minus sign it must be followed by at least one digit
n++;
c=cbuf[n];
if(c<CH_0 || c>CH_9){
throw new LazyException("Digit expected",n);
}
}
n++;
if(c==C... | [
"private",
"final",
"boolean",
"consumeNumber",
"(",
"char",
"c",
")",
"throws",
"LazyException",
"{",
"boolean",
"floatChar",
"=",
"false",
";",
"if",
"(",
"c",
"==",
"CH_DASH",
")",
"{",
"// If the number started with a minus sign it must be followed by at least one d... | of the number does not validate correctly | [
"of",
"the",
"number",
"does",
"not",
"validate",
"correctly"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L137-L198 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java | DictionaryCache.init | private void init(){
// We are going to use a linked hash map to maintain our sliding window
slidingWindow=new LinkedHashMap<String,Integer>(windowSize+1, .75F, false){
protected boolean removeEldestEntry(Map.Entry<String,Integer> eldest){
return size()>windowSize; ... | java | private void init(){
// We are going to use a linked hash map to maintain our sliding window
slidingWindow=new LinkedHashMap<String,Integer>(windowSize+1, .75F, false){
protected boolean removeEldestEntry(Map.Entry<String,Integer> eldest){
return size()>windowSize; ... | [
"private",
"void",
"init",
"(",
")",
"{",
"// We are going to use a linked hash map to maintain our sliding window",
"slidingWindow",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Integer",
">",
"(",
"windowSize",
"+",
"1",
",",
".75F",
",",
"false",
")",
"{",
... | Initializes the internal sliding window data structure. | [
"Initializes",
"the",
"internal",
"sliding",
"window",
"data",
"structure",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java#L36-L43 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java | DictionaryCache.get | public String get(short index){
if(index<0)return null;
if(index>=next)return null;
return data[index];
} | java | public String get(short index){
if(index<0)return null;
if(index>=next)return null;
return data[index];
} | [
"public",
"String",
"get",
"(",
"short",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"return",
"null",
";",
"if",
"(",
"index",
">=",
"next",
")",
"return",
"null",
";",
"return",
"data",
"[",
"index",
"]",
";",
"}"
] | Returns the value held at a specific location in the dictionary.
@param index the value to look up
@return the value from the dictionary or null if no such value exists | [
"Returns",
"the",
"value",
"held",
"at",
"a",
"specific",
"location",
"in",
"the",
"dictionary",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java#L116-L120 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java | DictionaryCache.put | public short put(String value){
// Do we already have this value?
if(dataMap.containsKey(value)){
dictionaryHit++;
return dataMap.get(value);
}
// Are we filled up?
if(next==MAX_SIZE){
dictionaryMiss++;
return -1;
}
// Should we add values without actual repetitions?
if(minRepetitions==0){
... | java | public short put(String value){
// Do we already have this value?
if(dataMap.containsKey(value)){
dictionaryHit++;
return dataMap.get(value);
}
// Are we filled up?
if(next==MAX_SIZE){
dictionaryMiss++;
return -1;
}
// Should we add values without actual repetitions?
if(minRepetitions==0){
... | [
"public",
"short",
"put",
"(",
"String",
"value",
")",
"{",
"// Do we already have this value?",
"if",
"(",
"dataMap",
".",
"containsKey",
"(",
"value",
")",
")",
"{",
"dictionaryHit",
"++",
";",
"return",
"dataMap",
".",
"get",
"(",
"value",
")",
";",
"}"... | Add a new value to the dictionary if we have seen it a certain number
of times within the current sliding window. If not, return -1 and mark
that we saw it. If the value is already in the dictionary, just return
the lookup position.
@param value the value to add
@return the index of the value in the dictionary of -1 i... | [
"Add",
"a",
"new",
"value",
"to",
"the",
"dictionary",
"if",
"we",
"have",
"seen",
"it",
"a",
"certain",
"number",
"of",
"times",
"within",
"the",
"current",
"sliding",
"window",
".",
"If",
"not",
"return",
"-",
"1",
"and",
"mark",
"that",
"we",
"saw",... | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java#L145-L184 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.addChild | protected void addChild(LazyNode token){
// If no children have been added yet, lastChild will be null
if(lastChild==null){
child=token;
lastChild=token;
return;
}
// Set the next pointer on the current end of the child list and set last child to the given token
lastChild.next=token;
lastChild=toke... | java | protected void addChild(LazyNode token){
// If no children have been added yet, lastChild will be null
if(lastChild==null){
child=token;
lastChild=token;
return;
}
// Set the next pointer on the current end of the child list and set last child to the given token
lastChild.next=token;
lastChild=toke... | [
"protected",
"void",
"addChild",
"(",
"LazyNode",
"token",
")",
"{",
"// If no children have been added yet, lastChild will be null",
"if",
"(",
"lastChild",
"==",
"null",
")",
"{",
"child",
"=",
"token",
";",
"lastChild",
"=",
"token",
";",
"return",
";",
"}",
... | Add a new child to the current linked list of child tokens
@param token the child to add | [
"Add",
"a",
"new",
"child",
"to",
"the",
"current",
"linked",
"list",
"of",
"child",
"tokens"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L100-L110 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.getChildCount | protected int getChildCount(){
int num=0;
LazyNode token=child;
while(token!=null){
num++;
token=token.next;
}
return num;
} | java | protected int getChildCount(){
int num=0;
LazyNode token=child;
while(token!=null){
num++;
token=token.next;
}
return num;
} | [
"protected",
"int",
"getChildCount",
"(",
")",
"{",
"int",
"num",
"=",
"0",
";",
"LazyNode",
"token",
"=",
"child",
";",
"while",
"(",
"token",
"!=",
"null",
")",
"{",
"num",
"++",
";",
"token",
"=",
"token",
".",
"next",
";",
"}",
"return",
"num",... | Count the children attached to this token. Be aware that this requires actual linked list traversal!
@return the number of child tokens attached to this token | [
"Count",
"the",
"children",
"attached",
"to",
"this",
"token",
".",
"Be",
"aware",
"that",
"this",
"requires",
"actual",
"linked",
"list",
"traversal!"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L117-L125 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.getIntValue | protected int getIntValue() throws LazyException{
int i=startIndex;
boolean sign=false;
int value=0;
if(type==VALUE_FLOAT){
return (int)getDoubleValue();
}else if(type==VALUE_STRING || type==VALUE_ESTRING){
// Attempt to parse as an int, throw if impossible
if(dirty){
if(dirtyBuf.charAt(i)=='-'){... | java | protected int getIntValue() throws LazyException{
int i=startIndex;
boolean sign=false;
int value=0;
if(type==VALUE_FLOAT){
return (int)getDoubleValue();
}else if(type==VALUE_STRING || type==VALUE_ESTRING){
// Attempt to parse as an int, throw if impossible
if(dirty){
if(dirtyBuf.charAt(i)=='-'){... | [
"protected",
"int",
"getIntValue",
"(",
")",
"throws",
"LazyException",
"{",
"int",
"i",
"=",
"startIndex",
";",
"boolean",
"sign",
"=",
"false",
";",
"int",
"value",
"=",
"0",
";",
"if",
"(",
"type",
"==",
"VALUE_FLOAT",
")",
"{",
"return",
"(",
"int"... | Parses the characters of this token and attempts to construct an integer
value from them.
@return the integer value if it could be parsed
@throws LazyException if the value could not be parsed | [
"Parses",
"the",
"characters",
"of",
"this",
"token",
"and",
"attempts",
"to",
"construct",
"an",
"integer",
"value",
"from",
"them",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L226-L295 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.getDoubleValue | protected double getDoubleValue() throws LazyException{
double d=0.0;
String str=getStringValue();
try{
d=Double.parseDouble(str);
}catch(NumberFormatException nfe){
// This basically can't happen since we already validate the numeric format when parsing
// throw new LazyException("'"+str+"' is not a v... | java | protected double getDoubleValue() throws LazyException{
double d=0.0;
String str=getStringValue();
try{
d=Double.parseDouble(str);
}catch(NumberFormatException nfe){
// This basically can't happen since we already validate the numeric format when parsing
// throw new LazyException("'"+str+"' is not a v... | [
"protected",
"double",
"getDoubleValue",
"(",
")",
"throws",
"LazyException",
"{",
"double",
"d",
"=",
"0.0",
";",
"String",
"str",
"=",
"getStringValue",
"(",
")",
";",
"try",
"{",
"d",
"=",
"Double",
".",
"parseDouble",
"(",
"str",
")",
";",
"}",
"ca... | Parses the characters of this token and attempts to construct a double
value from them.
@return the double value if it could be parsed
@throws LazyException if the value could not be parsed | [
"Parses",
"the",
"characters",
"of",
"this",
"token",
"and",
"attempts",
"to",
"construct",
"a",
"double",
"value",
"from",
"them",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L386-L396 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.getStringValue | protected String getStringValue(){
if(type==VALUE_NULL){
return null;
}else if(!(type==VALUE_ESTRING||type==EFIELD)){
if(dirty){
return dirtyBuf.substring(startIndex,endIndex);
}
return new String(cbuf,startIndex,endIndex-startIndex);
}else{
StringBuilder buf=new StringBuilder(endIndex-startInd... | java | protected String getStringValue(){
if(type==VALUE_NULL){
return null;
}else if(!(type==VALUE_ESTRING||type==EFIELD)){
if(dirty){
return dirtyBuf.substring(startIndex,endIndex);
}
return new String(cbuf,startIndex,endIndex-startIndex);
}else{
StringBuilder buf=new StringBuilder(endIndex-startInd... | [
"protected",
"String",
"getStringValue",
"(",
")",
"{",
"if",
"(",
"type",
"==",
"VALUE_NULL",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"!",
"(",
"type",
"==",
"VALUE_ESTRING",
"||",
"type",
"==",
"EFIELD",
")",
")",
"{",
"if",
"(",
... | Extracts a string containing the characters given by this token. If the
token was marked as having escaped characters, they will be unescaped
before the value is returned.
@return the string value held by this token | [
"Extracts",
"a",
"string",
"containing",
"the",
"characters",
"given",
"by",
"this",
"token",
".",
"If",
"the",
"token",
"was",
"marked",
"as",
"having",
"escaped",
"characters",
"they",
"will",
"be",
"unescaped",
"before",
"the",
"value",
"is",
"returned",
... | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L409-L476 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.addCommaSeparatedChildren | private void addCommaSeparatedChildren(Template template){
LazyNode next=child;
boolean first=true;
while(next!=null){
if(first){
first=false;
}else{
template.addConstant(",");
}
next.addSegments(template);
next=next.next;
}
} | java | private void addCommaSeparatedChildren(Template template){
LazyNode next=child;
boolean first=true;
while(next!=null){
if(first){
first=false;
}else{
template.addConstant(",");
}
next.addSegments(template);
next=next.next;
}
} | [
"private",
"void",
"addCommaSeparatedChildren",
"(",
"Template",
"template",
")",
"{",
"LazyNode",
"next",
"=",
"child",
";",
"boolean",
"first",
"=",
"true",
";",
"while",
"(",
"next",
"!=",
"null",
")",
"{",
"if",
"(",
"first",
")",
"{",
"first",
"=",
... | Functionality for extracting templates | [
"Functionality",
"for",
"extracting",
"templates"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L561-L573 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.readFromBuffer | protected static LazyNode readFromBuffer(byte[] raw){
ByteBuffer buf=ByteBuffer.wrap(raw);
return readFromBuffer(buf);
} | java | protected static LazyNode readFromBuffer(byte[] raw){
ByteBuffer buf=ByteBuffer.wrap(raw);
return readFromBuffer(buf);
} | [
"protected",
"static",
"LazyNode",
"readFromBuffer",
"(",
"byte",
"[",
"]",
"raw",
")",
"{",
"ByteBuffer",
"buf",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"raw",
")",
";",
"return",
"readFromBuffer",
"(",
"buf",
")",
";",
"}"
] | Functionality for reading and writing LazyNode structures | [
"Functionality",
"for",
"reading",
"and",
"writing",
"LazyNode",
"structures"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L705-L708 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyElement.java | LazyElement.parse | public static LazyElement parse(String str) throws LazyException{
int index=0;
while(index<str.length()){
char ch=str.charAt(index);
if(ch=='['){
return new LazyArray(str);
}
if(ch=='{'){
return new LazyObject(str);
}
index++;
}
throw new LazyException("The given string is not a JSON o... | java | public static LazyElement parse(String str) throws LazyException{
int index=0;
while(index<str.length()){
char ch=str.charAt(index);
if(ch=='['){
return new LazyArray(str);
}
if(ch=='{'){
return new LazyObject(str);
}
index++;
}
throw new LazyException("The given string is not a JSON o... | [
"public",
"static",
"LazyElement",
"parse",
"(",
"String",
"str",
")",
"throws",
"LazyException",
"{",
"int",
"index",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"str",
".",
"length",
"(",
")",
")",
"{",
"char",
"ch",
"=",
"str",
".",
"charAt",
"(",
... | Parses a string and returns either a LazyObject or LazyArray
@param str the source json data
@return either a LazyObject or LazyArray instance
@throws LazyException if the string could not be parsed | [
"Parses",
"a",
"string",
"and",
"returns",
"either",
"a",
"LazyObject",
"or",
"LazyArray"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyElement.java#L52-L65 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyElement.java | LazyElement.length | public int length(){
if(root.child==null){
return 0;
}
if(length>-1){
return length;
}
length=root.getChildCount();
return length;
} | java | public int length(){
if(root.child==null){
return 0;
}
if(length>-1){
return length;
}
length=root.getChildCount();
return length;
} | [
"public",
"int",
"length",
"(",
")",
"{",
"if",
"(",
"root",
".",
"child",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"length",
">",
"-",
"1",
")",
"{",
"return",
"length",
";",
"}",
"length",
"=",
"root",
".",
"getChildCount",
... | Returns the number of fields on this object
@return the number of fields | [
"Returns",
"the",
"number",
"of",
"fields",
"on",
"this",
"object"
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyElement.java#L138-L147 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getString | public String getString(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getStringValue();
} | java | public String getString(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getStringValue();
} | [
"public",
"String",
"getString",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"return",
"token",
".",
"getStringValue",
"(",
")",
";",
"}"
] | Returns the string value stored in this object for the given key.
@param key the name of the field on this object
@return the requested string value
@throws LazyException if the value for the given key was not a string. | [
"Returns",
"the",
"string",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L336-L339 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optString | public String optString(String key,String defaultValue){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return defaultValue;
if(token.type==LazyNode.VALUE_NULL)return defaultValue;
return token.getStringValue();
} | java | public String optString(String key,String defaultValue){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return defaultValue;
if(token.type==LazyNode.VALUE_NULL)return defaultValue;
return token.getStringValue();
} | [
"public",
"String",
"optString",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"defaultValue",
";",
"if",
"(",
"token... | Returns the string value stored in this object for the given key.
Returns the default value if there is no such key.
@param key the name of the field on this object
@param defaultValue the default value to return
@return the requested string value or the default value if there was no such key | [
"Returns",
"the",
"string",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
".",
"Returns",
"the",
"default",
"value",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L363-L368 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getInt | public int getInt(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getIntValue();
} | java | public int getInt(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getIntValue();
} | [
"public",
"int",
"getInt",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"return",
"token",
".",
"getIntValue",
"(",
")",
";",
"}"
] | Returns the integer value stored in this object for the given key.
@param key the name of the field on this object
@return an integer value
@throws LazyException if the value for the given key was not an integer. | [
"Returns",
"the",
"integer",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L377-L380 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optInt | public int optInt(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return 0;
if(token.type==LazyNode.VALUE_NULL)return 0;
return token.getIntValue();
} | java | public int optInt(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return 0;
if(token.type==LazyNode.VALUE_NULL)return 0;
return token.getIntValue();
} | [
"public",
"int",
"optInt",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"0",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"VA... | Returns the integer value stored in this object for the given key.
Returns 0 if there is no such key.
@param key the name of the field on this object
@return the requested integer value or 0 if there was no such key | [
"Returns",
"the",
"integer",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
".",
"Returns",
"0",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L389-L394 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getLong | public long getLong(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getLongValue();
} | java | public long getLong(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getLongValue();
} | [
"public",
"long",
"getLong",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"return",
"token",
".",
"getLongValue",
"(",
")",
";",
"}"
] | Returns the long value stored in this object for the given key.
@param key the name of the field on this object
@return a boolean value
@throws LazyException if the value for the given key was not a long. | [
"Returns",
"the",
"long",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L418-L421 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optLong | public long optLong(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return 0l;
if(token.type==LazyNode.VALUE_NULL)return 0l;
return token.getLongValue();
} | java | public long optLong(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return 0l;
if(token.type==LazyNode.VALUE_NULL)return 0l;
return token.getLongValue();
} | [
"public",
"long",
"optLong",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"0l",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
... | Returns the long value stored in this object for the given key.
Returns 0 if there is no such key.
@param key the name of the field on this object
@return the requested long value or 0 if there was no such key | [
"Returns",
"the",
"long",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
".",
"Returns",
"0",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L430-L435 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getDouble | public double getDouble(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getDoubleValue();
} | java | public double getDouble(String key) throws LazyException{
LazyNode token=getFieldToken(key);
return token.getDoubleValue();
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"return",
"token",
".",
"getDoubleValue",
"(",
")",
";",
"}"
] | Returns the double value stored in this object for the given key.
@param key the name of the field on this object
@return a boolean value
@throws LazyException if the value for the given key was not a double. | [
"Returns",
"the",
"double",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L459-L462 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optDouble | public double optDouble(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return 0.0;
if(token.type==LazyNode.VALUE_NULL)return 0.0;
return token.getDoubleValue();
} | java | public double optDouble(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return 0.0;
if(token.type==LazyNode.VALUE_NULL)return 0.0;
return token.getDoubleValue();
} | [
"public",
"double",
"optDouble",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"0.0",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".... | Returns the double value stored in this object for the given key.
Returns 0.0 if there is no such key.
@param key the name of the field on this object
@return the requested double value or 0.0 if there was no such key | [
"Returns",
"the",
"double",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
".",
"Returns",
"0",
".",
"0",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L471-L476 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.isNull | public boolean isNull(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return true;
if(token.type==LazyNode.VALUE_NULL)return true;
return false;
} | java | public boolean isNull(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return true;
if(token.type==LazyNode.VALUE_NULL)return true;
return false;
} | [
"public",
"boolean",
"isNull",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
"."... | Returns true if the value stored in this object for the given key is null.
@param key the name of the field on this object
@return true if the value is null, false otherwise
@throws LazyException if no value was set for the given key. | [
"Returns",
"true",
"if",
"the",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"is",
"null",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L500-L505 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getBoolean | public boolean getBoolean(String key){
LazyNode token=getFieldToken(key);
if(token.type==LazyNode.VALUE_STRING || token.type==LazyNode.VALUE_ESTRING){
String str=token.getStringValue().toLowerCase().trim();
if(str.equals("true"))return true;
if(str.equals("false"))return false;
throw new LazyException("... | java | public boolean getBoolean(String key){
LazyNode token=getFieldToken(key);
if(token.type==LazyNode.VALUE_STRING || token.type==LazyNode.VALUE_ESTRING){
String str=token.getStringValue().toLowerCase().trim();
if(str.equals("true"))return true;
if(str.equals("false"))return false;
throw new LazyException("... | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"VALUE_STRING",
"||",
"token",
".",
"type",
"==",
"LazyNode",
".",... | Returns the boolean value stored in this object for the given key.
@param key the name of the field on this object
@return a boolean value
@throws LazyException if the value for the given key was not a boolean. | [
"Returns",
"the",
"boolean",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L514-L525 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optBoolean | public boolean optBoolean(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return false;
if(token.type==LazyNode.VALUE_STRING || token.type==LazyNode.VALUE_ESTRING){
String str=token.getStringValue().toLowerCase().trim();
if(str.equals("true"))return true;
if(str.equals("false"))ret... | java | public boolean optBoolean(String key){
LazyNode token=getOptionalFieldToken(key);
if(token==null)return false;
if(token.type==LazyNode.VALUE_STRING || token.type==LazyNode.VALUE_ESTRING){
String str=token.getStringValue().toLowerCase().trim();
if(str.equals("true"))return true;
if(str.equals("false"))ret... | [
"public",
"boolean",
"optBoolean",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
... | Returns the boolean value stored in this object for the given key.
Returns false if there is no such key.
@param key the name of the field on this object
@return the requested boolean value or false if there was no such key | [
"Returns",
"the",
"boolean",
"value",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
".",
"Returns",
"false",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L534-L547 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getJSONObject | public LazyObject getJSONObject(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.OBJECT)throw new LazyException("Requested value is not an object",token);
LazyObject obj=new LazyObject(token);
obj.parent=this;
return obj;
} | java | public LazyObject getJSONObject(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.OBJECT)throw new LazyException("Requested value is not an object",token);
LazyObject obj=new LazyObject(token);
obj.parent=this;
return obj;
} | [
"public",
"LazyObject",
"getJSONObject",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
".",
"type",
"!=",
"LazyNode",
".",
"OBJECT",
")",
"throw",
"new",
"Laz... | Returns the JSON object stored in this object for the given key.
@param key the name of the field on this object
@return an array value
@throws LazyException if the value for the given key was not an object. | [
"Returns",
"the",
"JSON",
"object",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L578-L584 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optJSONObject | public LazyObject optJSONObject(String key) throws LazyException{
LazyNode token=getOptionalFieldToken(key);
if(token==null)return null;
if(token.type==LazyNode.VALUE_NULL)return null;
if(token.type!=LazyNode.OBJECT)return null;
LazyObject obj=new LazyObject(token);
obj.parent=this;
return obj;
} | java | public LazyObject optJSONObject(String key) throws LazyException{
LazyNode token=getOptionalFieldToken(key);
if(token==null)return null;
if(token.type==LazyNode.VALUE_NULL)return null;
if(token.type!=LazyNode.OBJECT)return null;
LazyObject obj=new LazyObject(token);
obj.parent=this;
return obj;
} | [
"public",
"LazyObject",
"optJSONObject",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"token",
"... | Returns the JSON object stored in this object for the given key on null if the key doesn't exist.
@param key the name of the field on this object
@throws LazyException if the value for the given key was not an object.
@return an object value or null if there was no such key | [
"Returns",
"the",
"JSON",
"object",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"on",
"null",
"if",
"the",
"key",
"doesn",
"t",
"exist",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L593-L601 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getJSONArray | public LazyArray getJSONArray(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.ARRAY)throw new LazyException("Requested value is not an array",token);
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | java | public LazyArray getJSONArray(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.ARRAY)throw new LazyException("Requested value is not an array",token);
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | [
"public",
"LazyArray",
"getJSONArray",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
".",
"type",
"!=",
"LazyNode",
".",
"ARRAY",
")",
"throw",
"new",
"LazyEx... | Returns the JSON array stored in this object for the given key.
@param key the name of the field on this object
@return an array value
@throws LazyException if the value for the given key was not an array. | [
"Returns",
"the",
"JSON",
"array",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L610-L616 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.optJSONArray | public LazyArray optJSONArray(String key) throws LazyException{
LazyNode token=getOptionalFieldToken(key);
if(token==null)return null;
if(token.type==LazyNode.VALUE_NULL)return null;
if(token.type!=LazyNode.ARRAY)return null;
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | java | public LazyArray optJSONArray(String key) throws LazyException{
LazyNode token=getOptionalFieldToken(key);
if(token==null)return null;
if(token.type==LazyNode.VALUE_NULL)return null;
if(token.type!=LazyNode.ARRAY)return null;
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | [
"public",
"LazyArray",
"optJSONArray",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getOptionalFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"token",
"."... | Returns the JSON array stored in this object for the given key or null if the key doesn't exist.
@param key the name of the field on this object
@return an array value or null if the key doesn't exist
@throws LazyException if the value for the given key was not an array. | [
"Returns",
"the",
"JSON",
"array",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"or",
"null",
"if",
"the",
"key",
"doesn",
"t",
"exist",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L625-L633 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.keySet | public Set<String> keySet(){
HashSet<String> set=new HashSet<String>();
Iterator<String> keys=keys();
while(keys.hasNext()){
set.add(keys.next());
}
return set;
} | java | public Set<String> keySet(){
HashSet<String> set=new HashSet<String>();
Iterator<String> keys=keys();
while(keys.hasNext()){
set.add(keys.next());
}
return set;
} | [
"public",
"Set",
"<",
"String",
">",
"keySet",
"(",
")",
"{",
"HashSet",
"<",
"String",
">",
"set",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"Iterator",
"<",
"String",
">",
"keys",
"=",
"keys",
"(",
")",
";",
"while",
"(",
"keys"... | Returns a set containing all keys on this object. If possible, use the keys iterator instead for improved performance.
@return a set containing all keys in this object | [
"Returns",
"a",
"set",
"containing",
"all",
"keys",
"on",
"this",
"object",
".",
"If",
"possible",
"use",
"the",
"keys",
"iterator",
"instead",
"for",
"improved",
"performance",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L649-L656 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.keyMatch | private boolean keyMatch(String key,LazyNode token){
if(token.type==LazyNode.EFIELD){
String field=token.getStringValue();
return field.equals(key);
}else{
// Quickly check the length first
int length=key.length();
if(token.endIndex-token.startIndex!=length){
return false;
}
// Now go throu... | java | private boolean keyMatch(String key,LazyNode token){
if(token.type==LazyNode.EFIELD){
String field=token.getStringValue();
return field.equals(key);
}else{
// Quickly check the length first
int length=key.length();
if(token.endIndex-token.startIndex!=length){
return false;
}
// Now go throu... | [
"private",
"boolean",
"keyMatch",
"(",
"String",
"key",
",",
"LazyNode",
"token",
")",
"{",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"EFIELD",
")",
"{",
"String",
"field",
"=",
"token",
".",
"getStringValue",
"(",
")",
";",
"return",
"fi... | Utility method to evaluate wether a given string matches the value
of a field.
@param key the key to compare a token to
@param token the field token
@return true if the key matches, false otherwise | [
"Utility",
"method",
"to",
"evaluate",
"wether",
"a",
"given",
"string",
"matches",
"the",
"value",
"of",
"a",
"field",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L702-L730 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.has | public boolean has(String key){
LazyNode child=root.child;
while(child!=null){
if(keyMatch(key,child)){
return true;
}
child=child.next;
}
return false;
} | java | public boolean has(String key){
LazyNode child=root.child;
while(child!=null){
if(keyMatch(key,child)){
return true;
}
child=child.next;
}
return false;
} | [
"public",
"boolean",
"has",
"(",
"String",
"key",
")",
"{",
"LazyNode",
"child",
"=",
"root",
".",
"child",
";",
"while",
"(",
"child",
"!=",
"null",
")",
"{",
"if",
"(",
"keyMatch",
"(",
"key",
",",
"child",
")",
")",
"{",
"return",
"true",
";",
... | Returns true if the given key matches a field on this object.
@param key the name of the field to look for
@return true if the key exists, false otherwise | [
"Returns",
"true",
"if",
"the",
"given",
"key",
"matches",
"a",
"field",
"on",
"this",
"object",
"."
] | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L738-L747 | train |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/compressor/Segment.java | Segment.read | public String read(ByteBuffer buf,DictionaryCache dict){
StringBuilder out=new StringBuilder();
if(pre!=null)out.append(pre);
if(type==VOID)return out.toString();
if(type==NULL){
out.append("null");
return out.toString();
}
if(type==BYTE){
out.append(buf.get());
return out.toString();
}
if(t... | java | public String read(ByteBuffer buf,DictionaryCache dict){
StringBuilder out=new StringBuilder();
if(pre!=null)out.append(pre);
if(type==VOID)return out.toString();
if(type==NULL){
out.append("null");
return out.toString();
}
if(type==BYTE){
out.append(buf.get());
return out.toString();
}
if(t... | [
"public",
"String",
"read",
"(",
"ByteBuffer",
"buf",
",",
"DictionaryCache",
"dict",
")",
"{",
"StringBuilder",
"out",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"pre",
"!=",
"null",
")",
"out",
".",
"append",
"(",
"pre",
")",
";",
"if",
... | Read this segment from a byte buffer using the given dictionary for
lookups. The dictionary may be null if no dictionary values were used
when writing data for this segment.
@param buf the byte buffer holding the raw data
@param dict a dictionary holding lookup values or null if a dictionary was not used for encoding
... | [
"Read",
"this",
"segment",
"from",
"a",
"byte",
"buffer",
"using",
"the",
"given",
"dictionary",
"for",
"lookups",
".",
"The",
"dictionary",
"may",
"be",
"null",
"if",
"no",
"dictionary",
"values",
"were",
"used",
"when",
"writing",
"data",
"for",
"this",
... | 1a223f57fc0cb9941bc175739697ac95da5618cc | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/Segment.java#L85-L144 | train |
susom/database | src/main/java/com/github/susom/database/DatabaseProvider.java | DatabaseProvider.fromJndi | @CheckReturnValue
public static Builder fromJndi(final Context context, final String lookupKey, Flavor flavor) {
Options options = new OptionsDefault(flavor);
return new BuilderImpl(null, () -> {
DataSource ds;
try {
ds = (DataSource) context.lookup(lookupKey);
} catch (Exception e)... | java | @CheckReturnValue
public static Builder fromJndi(final Context context, final String lookupKey, Flavor flavor) {
Options options = new OptionsDefault(flavor);
return new BuilderImpl(null, () -> {
DataSource ds;
try {
ds = (DataSource) context.lookup(lookupKey);
} catch (Exception e)... | [
"@",
"CheckReturnValue",
"public",
"static",
"Builder",
"fromJndi",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"lookupKey",
",",
"Flavor",
"flavor",
")",
"{",
"Options",
"options",
"=",
"new",
"OptionsDefault",
"(",
"flavor",
")",
";",
"return... | Builder method to create and initialize an instance of this class using
a JNDI resource. To use this method you must explicitly indicate what
Flavor of database we are dealing with. | [
"Builder",
"method",
"to",
"create",
"and",
"initialize",
"an",
"instance",
"of",
"this",
"class",
"using",
"a",
"JNDI",
"resource",
".",
"To",
"use",
"this",
"method",
"you",
"must",
"explicitly",
"indicate",
"what",
"Flavor",
"of",
"database",
"we",
"are",... | 25add9e08ad863712f9b5e319b6cb826f6f97640 | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProvider.java#L221-L238 | train |
susom/database | src/main/java/com/github/susom/database/VertxUtil.java | VertxUtil.mdc | public static <T> Handler<T> mdc(final Handler<T> handler) {
if (handler == null) {
// Throw here instead of getting NPE inside the handler so we can see the stack trace
throw new IllegalArgumentException("handler may not be null");
}
final Map<String, String> mdc = MDC.getCopyOfContextMap();
... | java | public static <T> Handler<T> mdc(final Handler<T> handler) {
if (handler == null) {
// Throw here instead of getting NPE inside the handler so we can see the stack trace
throw new IllegalArgumentException("handler may not be null");
}
final Map<String, String> mdc = MDC.getCopyOfContextMap();
... | [
"public",
"static",
"<",
"T",
">",
"Handler",
"<",
"T",
">",
"mdc",
"(",
"final",
"Handler",
"<",
"T",
">",
"handler",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"// Throw here instead of getting NPE inside the handler so we can see the stack trace",
... | Wrap a Handler in a way that will preserve the SLF4J MDC context.
The context from the current thread at the time of this method call
will be cached and restored within the wrapper at the time the
handler is invoked. This version delegates the handler call directly
on the thread that calls it. | [
"Wrap",
"a",
"Handler",
"in",
"a",
"way",
"that",
"will",
"preserve",
"the",
"SLF4J",
"MDC",
"context",
".",
"The",
"context",
"from",
"the",
"current",
"thread",
"at",
"the",
"time",
"of",
"this",
"method",
"call",
"will",
"be",
"cached",
"and",
"restor... | 25add9e08ad863712f9b5e319b6cb826f6f97640 | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/VertxUtil.java#L29-L54 | train |
susom/database | src/main/java/com/github/susom/database/Sql.java | Sql.listSeparator | public Sql listSeparator(/*@Untainted*/ String sql) {
if (listFirstItem.peek()) {
listFirstItem.pop();
listFirstItem.push(false);
return this;
} else {
return append(sql);
}
} | java | public Sql listSeparator(/*@Untainted*/ String sql) {
if (listFirstItem.peek()) {
listFirstItem.pop();
listFirstItem.push(false);
return this;
} else {
return append(sql);
}
} | [
"public",
"Sql",
"listSeparator",
"(",
"/*@Untainted*/",
"String",
"sql",
")",
"{",
"if",
"(",
"listFirstItem",
".",
"peek",
"(",
")",
")",
"{",
"listFirstItem",
".",
"pop",
"(",
")",
";",
"listFirstItem",
".",
"push",
"(",
"false",
")",
";",
"return",
... | Appends the passed bit of sql only if a previous item has already been appended,
and notes that the list is not empty. | [
"Appends",
"the",
"passed",
"bit",
"of",
"sql",
"only",
"if",
"a",
"previous",
"item",
"has",
"already",
"been",
"appended",
"and",
"notes",
"that",
"the",
"list",
"is",
"not",
"empty",
"."
] | 25add9e08ad863712f9b5e319b6cb826f6f97640 | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/Sql.java#L242-L250 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/view/NavigationPresenter.java | NavigationPresenter.getSelectedCategory | public Category getSelectedCategory() {
TreeItem<Category> selectedTreeItem =
navigationView.treeView.getSelectionModel().getSelectedItem();
if (selectedTreeItem != null) {
return navigationView.treeView.getSelectionModel().getSelectedItem().getValue();
}
return null;
} | java | public Category getSelectedCategory() {
TreeItem<Category> selectedTreeItem =
navigationView.treeView.getSelectionModel().getSelectedItem();
if (selectedTreeItem != null) {
return navigationView.treeView.getSelectionModel().getSelectedItem().getValue();
}
return null;
} | [
"public",
"Category",
"getSelectedCategory",
"(",
")",
"{",
"TreeItem",
"<",
"Category",
">",
"selectedTreeItem",
"=",
"navigationView",
".",
"treeView",
".",
"getSelectionModel",
"(",
")",
".",
"getSelectedItem",
"(",
")",
";",
"if",
"(",
"selectedTreeItem",
"!... | Retrieves the currently selected category in the TreeSearchView. | [
"Retrieves",
"the",
"currently",
"selected",
"category",
"in",
"the",
"TreeSearchView",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/NavigationPresenter.java#L126-L133 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleRadioButtonControl.java | SimpleRadioButtonControl.createRadioButtons | private void createRadioButtons() {
node.getChildren().clear();
radioButtons.clear();
for (int i = 0; i < field.getItems().size(); i++) {
RadioButton rb = new RadioButton();
rb.setText(field.getItems().get(i).toString());
rb.setToggleGroup(toggleGroup);
radioButtons.add(rb);
}... | java | private void createRadioButtons() {
node.getChildren().clear();
radioButtons.clear();
for (int i = 0; i < field.getItems().size(); i++) {
RadioButton rb = new RadioButton();
rb.setText(field.getItems().get(i).toString());
rb.setToggleGroup(toggleGroup);
radioButtons.add(rb);
}... | [
"private",
"void",
"createRadioButtons",
"(",
")",
"{",
"node",
".",
"getChildren",
"(",
")",
".",
"clear",
"(",
")",
";",
"radioButtons",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"field",
".",
"getItems",
"(",
... | This method creates radio buttons and adds them to radioButtons
and is used when the itemsProperty on the field changes. | [
"This",
"method",
"creates",
"radio",
"buttons",
"and",
"adds",
"them",
"to",
"radioButtons",
"and",
"is",
"used",
"when",
"the",
"itemsProperty",
"on",
"the",
"field",
"changes",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleRadioButtonControl.java#L124-L142 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/renderer/PreferencesFxGroupRenderer.java | PreferencesFxGroupRenderer.layoutParts | public void layoutParts() {
StringBuilder styleClass = new StringBuilder("group");
// if there are no rows yet, getRowCount returns -1, in this case the next row is 0
int nextRow = PreferencesFxUtils.getRowCount(grid) + 1;
// Only when the preferencesGroup has a title
if (preferencesGroup.getTitle... | java | public void layoutParts() {
StringBuilder styleClass = new StringBuilder("group");
// if there are no rows yet, getRowCount returns -1, in this case the next row is 0
int nextRow = PreferencesFxUtils.getRowCount(grid) + 1;
// Only when the preferencesGroup has a title
if (preferencesGroup.getTitle... | [
"public",
"void",
"layoutParts",
"(",
")",
"{",
"StringBuilder",
"styleClass",
"=",
"new",
"StringBuilder",
"(",
"\"group\"",
")",
";",
"// if there are no rows yet, getRowCount returns -1, in this case the next row is 0",
"int",
"nextRow",
"=",
"PreferencesFxUtils",
".",
"... | Defines the layout of the rendered group. | [
"Defines",
"the",
"layout",
"of",
"the",
"rendered",
"group",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/renderer/PreferencesFxGroupRenderer.java#L65-L113 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/history/view/HistoryDialog.java | HistoryDialog.setupClose | private void setupClose() {
this.getButtonTypes().add(ButtonType.CLOSE);
Node closeButton = dialog.getDialogPane().lookupButton(ButtonType.CLOSE);
closeButton.managedProperty().bind(closeButton.visibleProperty());
closeButton.setVisible(false);
} | java | private void setupClose() {
this.getButtonTypes().add(ButtonType.CLOSE);
Node closeButton = dialog.getDialogPane().lookupButton(ButtonType.CLOSE);
closeButton.managedProperty().bind(closeButton.visibleProperty());
closeButton.setVisible(false);
} | [
"private",
"void",
"setupClose",
"(",
")",
"{",
"this",
".",
"getButtonTypes",
"(",
")",
".",
"add",
"(",
"ButtonType",
".",
"CLOSE",
")",
";",
"Node",
"closeButton",
"=",
"dialog",
".",
"getDialogPane",
"(",
")",
".",
"lookupButton",
"(",
"ButtonType",
... | Instantiates a close button and makes it invisible.
Dialog requires at least one button to close the dialog window.
@see <a href="https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Dialog.html">
javafx.scene.control.Dialog</a>
Chapter: Dialog Closing Rules | [
"Instantiates",
"a",
"close",
"button",
"and",
"makes",
"it",
"invisible",
".",
"Dialog",
"requires",
"at",
"least",
"one",
"button",
"to",
"close",
"the",
"dialog",
"window",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/view/HistoryDialog.java#L79-L84 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java | History.doWithoutListeners | public void doWithoutListeners(Setting setting, Runnable action) {
LOGGER.trace(String.format("doWithoutListeners: setting: %s", setting));
setListenerActive(false);
LOGGER.trace("removed listener");
action.run();
LOGGER.trace("performed action");
setListenerActive(true);
LOGGER.trace("add l... | java | public void doWithoutListeners(Setting setting, Runnable action) {
LOGGER.trace(String.format("doWithoutListeners: setting: %s", setting));
setListenerActive(false);
LOGGER.trace("removed listener");
action.run();
LOGGER.trace("performed action");
setListenerActive(true);
LOGGER.trace("add l... | [
"public",
"void",
"doWithoutListeners",
"(",
"Setting",
"setting",
",",
"Runnable",
"action",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"String",
".",
"format",
"(",
"\"doWithoutListeners: setting: %s\"",
",",
"setting",
")",
")",
";",
"setListenerActive",
"(",
"fa... | Enables to perform an action, without firing the attached ChangeListener of a Setting.
This is used by undo and redo, since those shouldn't cause a new change to be added.
@param setting the setting, whose ChangeListener should be ignored
@param action the action to be performed | [
"Enables",
"to",
"perform",
"an",
"action",
"without",
"firing",
"the",
"attached",
"ChangeListener",
"of",
"a",
"Setting",
".",
"This",
"is",
"used",
"by",
"undo",
"and",
"redo",
"since",
"those",
"shouldn",
"t",
"cause",
"a",
"new",
"change",
"to",
"be",... | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java#L150-L158 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java | History.undo | public boolean undo() {
LOGGER.trace("undo, before, size: " + changes.size() + " pos: " + position.get()
+ " validPos: " + validPosition.get());
Change lastChange = prev();
if (lastChange != null) {
doWithoutListeners(lastChange.getSetting(), lastChange::undo);
LOGGER.trace("undo, after,... | java | public boolean undo() {
LOGGER.trace("undo, before, size: " + changes.size() + " pos: " + position.get()
+ " validPos: " + validPosition.get());
Change lastChange = prev();
if (lastChange != null) {
doWithoutListeners(lastChange.getSetting(), lastChange::undo);
LOGGER.trace("undo, after,... | [
"public",
"boolean",
"undo",
"(",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"undo, before, size: \"",
"+",
"changes",
".",
"size",
"(",
")",
"+",
"\" pos: \"",
"+",
"position",
".",
"get",
"(",
")",
"+",
"\" validPos: \"",
"+",
"validPosition",
".",
"get",
... | Undos a change in the history.
@return true if successful, false if there are no changes to undo | [
"Undos",
"a",
"change",
"in",
"the",
"history",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java#L165-L176 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java | History.redo | public boolean redo() {
LOGGER.trace("redo, before, size: " + changes.size() + " pos: " + position.get()
+ " validPos: " + validPosition.get());
Change nextChange = next();
if (nextChange != null) {
doWithoutListeners(nextChange.getSetting(), nextChange::redo);
LOGGER.trace("redo, after,... | java | public boolean redo() {
LOGGER.trace("redo, before, size: " + changes.size() + " pos: " + position.get()
+ " validPos: " + validPosition.get());
Change nextChange = next();
if (nextChange != null) {
doWithoutListeners(nextChange.getSetting(), nextChange::redo);
LOGGER.trace("redo, after,... | [
"public",
"boolean",
"redo",
"(",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"redo, before, size: \"",
"+",
"changes",
".",
"size",
"(",
")",
"+",
"\" pos: \"",
"+",
"position",
".",
"get",
"(",
")",
"+",
"\" validPos: \"",
"+",
"validPosition",
".",
"get",
... | Redos a change in the history.
@return true if successful, false if there are no changes to redo | [
"Redos",
"a",
"change",
"in",
"the",
"history",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java#L191-L202 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java | History.clear | public void clear(boolean undoAll) {
LOGGER.trace("Clear called, with undoAll: " + undoAll);
if (undoAll) {
undoAll();
}
LOGGER.trace("Clearing changes");
changes.clear();
position.set(-1);
validPosition.set(-1);
} | java | public void clear(boolean undoAll) {
LOGGER.trace("Clear called, with undoAll: " + undoAll);
if (undoAll) {
undoAll();
}
LOGGER.trace("Clearing changes");
changes.clear();
position.set(-1);
validPosition.set(-1);
} | [
"public",
"void",
"clear",
"(",
"boolean",
"undoAll",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Clear called, with undoAll: \"",
"+",
"undoAll",
")",
";",
"if",
"(",
"undoAll",
")",
"{",
"undoAll",
"(",
")",
";",
"}",
"LOGGER",
".",
"trace",
"(",
"\"Clea... | Clears the change history.
@param undoAll if true, will undo all changes before clearing | [
"Clears",
"the",
"change",
"history",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/history/History.java#L239-L248 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/renderer/PreferencesFxGroup.java | PreferencesFxGroup.translate | public void translate() {
if (translationService == null) {
title.setValue(titleKey.getValue());
return;
}
if (!Strings.isNullOrEmpty(titleKey.getValue())) {
title.setValue(translationService.translate(titleKey.get()));
}
} | java | public void translate() {
if (translationService == null) {
title.setValue(titleKey.getValue());
return;
}
if (!Strings.isNullOrEmpty(titleKey.getValue())) {
title.setValue(translationService.translate(titleKey.get()));
}
} | [
"public",
"void",
"translate",
"(",
")",
"{",
"if",
"(",
"translationService",
"==",
"null",
")",
"{",
"title",
".",
"setValue",
"(",
"titleKey",
".",
"getValue",
"(",
")",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
... | Updates the title based on the titleKey for i18n.
If there is no translationService, the title will be the same as the titleKey.
If there is a translationService, the titleKey will be used to lookup the translated variant
using the translationService and the title is set. | [
"Updates",
"the",
"title",
"based",
"on",
"the",
"titleKey",
"for",
"i18n",
".",
"If",
"there",
"is",
"no",
"translationService",
"the",
"title",
"will",
"be",
"the",
"same",
"as",
"the",
"titleKey",
".",
"If",
"there",
"is",
"a",
"translationService",
"th... | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/renderer/PreferencesFxGroup.java#L110-L119 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleCheckBoxControl.java | SimpleCheckBoxControl.createCheckboxes | private void createCheckboxes() {
node.getChildren().clear();
checkboxes.clear();
for (int i = 0; i < field.getItems().size(); i++) {
CheckBox cb = new CheckBox();
cb.setText(field.getItems().get(i).toString());
cb.setSelected(field.getSelection().contains(field.getItems().get(i)));
... | java | private void createCheckboxes() {
node.getChildren().clear();
checkboxes.clear();
for (int i = 0; i < field.getItems().size(); i++) {
CheckBox cb = new CheckBox();
cb.setText(field.getItems().get(i).toString());
cb.setSelected(field.getSelection().contains(field.getItems().get(i)));
... | [
"private",
"void",
"createCheckboxes",
"(",
")",
"{",
"node",
".",
"getChildren",
"(",
")",
".",
"clear",
"(",
")",
";",
"checkboxes",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"field",
".",
"getItems",
"(",
")... | This method creates node and adds them to checkboxes and is
used when the itemsProperty on the field changes. | [
"This",
"method",
"creates",
"node",
"and",
"adds",
"them",
"to",
"checkboxes",
"and",
"is",
"used",
"when",
"the",
"itemsProperty",
"on",
"the",
"field",
"changes",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleCheckBoxControl.java#L123-L137 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleCheckBoxControl.java | SimpleCheckBoxControl.setupCheckboxBindings | private void setupCheckboxBindings() {
for (CheckBox checkbox : checkboxes) {
checkbox.disableProperty().bind(field.editableProperty().not());
}
} | java | private void setupCheckboxBindings() {
for (CheckBox checkbox : checkboxes) {
checkbox.disableProperty().bind(field.editableProperty().not());
}
} | [
"private",
"void",
"setupCheckboxBindings",
"(",
")",
"{",
"for",
"(",
"CheckBox",
"checkbox",
":",
"checkboxes",
")",
"{",
"checkbox",
".",
"disableProperty",
"(",
")",
".",
"bind",
"(",
"field",
".",
"editableProperty",
"(",
")",
".",
"not",
"(",
")",
... | Sets up bindings for all checkboxes. | [
"Sets",
"up",
"bindings",
"for",
"all",
"checkboxes",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleCheckBoxControl.java#L142-L146 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleCheckBoxControl.java | SimpleCheckBoxControl.setupCheckboxEventHandlers | private void setupCheckboxEventHandlers() {
for (int i = 0; i < checkboxes.size(); i++) {
final int j = i;
checkboxes.get(i).setOnAction(event -> {
if (checkboxes.get(j).isSelected()) {
field.select(j);
} else {
field.deselect(j);
}
});
}
} | java | private void setupCheckboxEventHandlers() {
for (int i = 0; i < checkboxes.size(); i++) {
final int j = i;
checkboxes.get(i).setOnAction(event -> {
if (checkboxes.get(j).isSelected()) {
field.select(j);
} else {
field.deselect(j);
}
});
}
} | [
"private",
"void",
"setupCheckboxEventHandlers",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"checkboxes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"int",
"j",
"=",
"i",
";",
"checkboxes",
".",
"get",
"(",
"i"... | Sets up event handlers for all checkboxes. | [
"Sets",
"up",
"event",
"handlers",
"for",
"all",
"checkboxes",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleCheckBoxControl.java#L151-L163 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/view/NavigationView.java | NavigationView.setupTextField | private void setupTextField() {
searchFld = new CustomTextField();
GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
Glyph glyph = fontAwesome.create(FontAwesome.Glyph.SEARCH).color(Color.GRAY);
glyph.setPadding(new Insets(0, 3, 0, 5));
searchFld.setLeft(glyph);
} | java | private void setupTextField() {
searchFld = new CustomTextField();
GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
Glyph glyph = fontAwesome.create(FontAwesome.Glyph.SEARCH).color(Color.GRAY);
glyph.setPadding(new Insets(0, 3, 0, 5));
searchFld.setLeft(glyph);
} | [
"private",
"void",
"setupTextField",
"(",
")",
"{",
"searchFld",
"=",
"new",
"CustomTextField",
"(",
")",
";",
"GlyphFont",
"fontAwesome",
"=",
"GlyphFontRegistry",
".",
"font",
"(",
"\"FontAwesome\"",
")",
";",
"Glyph",
"glyph",
"=",
"fontAwesome",
".",
"crea... | Initializes the TextField and sets the search icon. | [
"Initializes",
"the",
"TextField",
"and",
"sets",
"the",
"search",
"icon",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/NavigationView.java#L65-L71 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/SearchHandler.java | SearchHandler.init | public void init(
PreferencesFxModel model,
StringProperty searchText,
ObjectProperty<TreeItemPredicate<Category>> predicateProperty
) {
this.model = model;
initializeSearch();
initializeSearchText(searchText);
bindFilterPredicate(predicateProperty);
} | java | public void init(
PreferencesFxModel model,
StringProperty searchText,
ObjectProperty<TreeItemPredicate<Category>> predicateProperty
) {
this.model = model;
initializeSearch();
initializeSearchText(searchText);
bindFilterPredicate(predicateProperty);
} | [
"public",
"void",
"init",
"(",
"PreferencesFxModel",
"model",
",",
"StringProperty",
"searchText",
",",
"ObjectProperty",
"<",
"TreeItemPredicate",
"<",
"Category",
">",
">",
"predicateProperty",
")",
"{",
"this",
".",
"model",
"=",
"model",
";",
"initializeSearch... | Initializes the SearchHandler by initially creating all necessary lists
for filtering and setting up the bindings.
@param searchText textProperty of a TextField where the search string is being input
@param predicateProperty of the rootItem of a {@link FilterableTreeItem}
@apiNote Must be called to make the fil... | [
"Initializes",
"the",
"SearchHandler",
"by",
"initially",
"creating",
"all",
"necessary",
"lists",
"for",
"filtering",
"and",
"setting",
"up",
"the",
"bindings",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/SearchHandler.java#L93-L102 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/SearchHandler.java | SearchHandler.initializeSearchTextListener | private void initializeSearchTextListener() {
searchText.addListener((observable, oldText, newText) -> {
if (newText.equals("")) { // empty search -> doesn't match anything!
resetSearch();
} else {
updateSearch(newText);
}
});
} | java | private void initializeSearchTextListener() {
searchText.addListener((observable, oldText, newText) -> {
if (newText.equals("")) { // empty search -> doesn't match anything!
resetSearch();
} else {
updateSearch(newText);
}
});
} | [
"private",
"void",
"initializeSearchTextListener",
"(",
")",
"{",
"searchText",
".",
"addListener",
"(",
"(",
"observable",
",",
"oldText",
",",
"newText",
")",
"->",
"{",
"if",
"(",
"newText",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"// empty search -> d... | Reacts upon changes in the search text.
If the search text is empty, everything will be unmarked, else the search will be updated. | [
"Reacts",
"upon",
"changes",
"in",
"the",
"search",
"text",
".",
"If",
"the",
"search",
"text",
"is",
"empty",
"everything",
"will",
"be",
"unmarked",
"else",
"the",
"search",
"will",
"be",
"updated",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/SearchHandler.java#L124-L132 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/SearchHandler.java | SearchHandler.bindFilterPredicate | public void bindFilterPredicate(ObjectProperty<TreeItemPredicate<Category>> predicateProperty) {
predicateProperty.bind(Bindings.createObjectBinding(() -> {
if (searchText.get() == null || searchText.get().isEmpty()) {
return null;
}
return TreeItemPredicate.create(filterPredicate);
},... | java | public void bindFilterPredicate(ObjectProperty<TreeItemPredicate<Category>> predicateProperty) {
predicateProperty.bind(Bindings.createObjectBinding(() -> {
if (searchText.get() == null || searchText.get().isEmpty()) {
return null;
}
return TreeItemPredicate.create(filterPredicate);
},... | [
"public",
"void",
"bindFilterPredicate",
"(",
"ObjectProperty",
"<",
"TreeItemPredicate",
"<",
"Category",
">",
">",
"predicateProperty",
")",
"{",
"predicateProperty",
".",
"bind",
"(",
"Bindings",
".",
"createObjectBinding",
"(",
"(",
")",
"->",
"{",
"if",
"("... | Binds the predicateProperty to ensure filtering according to the searchText.
@param predicateProperty of the rootItem of a {@link FilterableTreeItem} | [
"Binds",
"the",
"predicateProperty",
"to",
"ensure",
"filtering",
"according",
"to",
"the",
"searchText",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/SearchHandler.java#L153-L160 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/PreferencesFx.java | PreferencesFx.saveSettings | public PreferencesFx saveSettings(boolean save) {
preferencesFxModel.setSaveSettings(save);
// if settings shouldn't be saved, clear them if there are any present
if (!save) {
preferencesFxModel.getStorageHandler().clearPreferences();
}
return this;
} | java | public PreferencesFx saveSettings(boolean save) {
preferencesFxModel.setSaveSettings(save);
// if settings shouldn't be saved, clear them if there are any present
if (!save) {
preferencesFxModel.getStorageHandler().clearPreferences();
}
return this;
} | [
"public",
"PreferencesFx",
"saveSettings",
"(",
"boolean",
"save",
")",
"{",
"preferencesFxModel",
".",
"setSaveSettings",
"(",
"save",
")",
";",
"// if settings shouldn't be saved, clear them if there are any present",
"if",
"(",
"!",
"save",
")",
"{",
"preferencesFxMode... | Defines whether the adjusted settings of the application should be saved or not.
@param save if true, the values of all settings of the application are saved. When the
application is started again, the settings values will be restored to the last
saved state. Defaults to false.
@return this object for fluent API | [
"Defines",
"whether",
"the",
"adjusted",
"settings",
"of",
"the",
"application",
"should",
"be",
"saved",
"or",
"not",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/PreferencesFx.java#L179-L186 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/PreferencesFx.java | PreferencesFx.removeEventHandler | public PreferencesFx removeEventHandler(EventType<PreferencesFxEvent> eventType,
EventHandler<? super PreferencesFxEvent> eventHandler) {
preferencesFxModel.removeEventHandler(eventType, eventHandler);
return this;
} | java | public PreferencesFx removeEventHandler(EventType<PreferencesFxEvent> eventType,
EventHandler<? super PreferencesFxEvent> eventHandler) {
preferencesFxModel.removeEventHandler(eventType, eventHandler);
return this;
} | [
"public",
"PreferencesFx",
"removeEventHandler",
"(",
"EventType",
"<",
"PreferencesFxEvent",
">",
"eventType",
",",
"EventHandler",
"<",
"?",
"super",
"PreferencesFxEvent",
">",
"eventHandler",
")",
"{",
"preferencesFxModel",
".",
"removeEventHandler",
"(",
"eventType"... | Unregisters a previously registered event handler from the model. One handler might have been
registered for different event types, so the caller needs to specify the particular event type
from which to unregister the handler.
@param eventType the event type from which to unregister
@param eventHandler the handler ... | [
"Unregisters",
"a",
"previously",
"registered",
"event",
"handler",
"from",
"the",
"model",
".",
"One",
"handler",
"might",
"have",
"been",
"registered",
"for",
"different",
"event",
"types",
"so",
"the",
"caller",
"needs",
"to",
"specify",
"the",
"particular",
... | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/PreferencesFx.java#L256-L260 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/PreferencesFxModel.java | PreferencesFxModel.initializeCategoryTranslation | private void initializeCategoryTranslation() {
flatCategoriesLst.forEach(category -> {
translationServiceProperty().addListener((observable, oldValue, newValue) -> {
category.translate(newValue);
// listen for i18n changes in the TranslationService for this Category
newValue.addListene... | java | private void initializeCategoryTranslation() {
flatCategoriesLst.forEach(category -> {
translationServiceProperty().addListener((observable, oldValue, newValue) -> {
category.translate(newValue);
// listen for i18n changes in the TranslationService for this Category
newValue.addListene... | [
"private",
"void",
"initializeCategoryTranslation",
"(",
")",
"{",
"flatCategoriesLst",
".",
"forEach",
"(",
"category",
"->",
"{",
"translationServiceProperty",
"(",
")",
".",
"addListener",
"(",
"(",
"observable",
",",
"oldValue",
",",
"newValue",
")",
"->",
"... | Sets up a binding of the TranslationService on the model, so that the Category's title gets
translated properly according to the TranslationService used. | [
"Sets",
"up",
"a",
"binding",
"of",
"the",
"TranslationService",
"on",
"the",
"model",
"so",
"that",
"the",
"Category",
"s",
"title",
"gets",
"translated",
"properly",
"according",
"to",
"the",
"TranslationService",
"used",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/PreferencesFxModel.java#L93-L101 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/PreferencesFxModel.java | PreferencesFxModel.loadSelectedCategory | public Category loadSelectedCategory() {
String breadcrumb = storageHandler.loadSelectedCategory();
Category defaultCategory = getCategories().get(DEFAULT_CATEGORY);
if (breadcrumb == null) {
return defaultCategory;
}
return flatCategoriesLst.stream()
.filter(category -> category.getBr... | java | public Category loadSelectedCategory() {
String breadcrumb = storageHandler.loadSelectedCategory();
Category defaultCategory = getCategories().get(DEFAULT_CATEGORY);
if (breadcrumb == null) {
return defaultCategory;
}
return flatCategoriesLst.stream()
.filter(category -> category.getBr... | [
"public",
"Category",
"loadSelectedCategory",
"(",
")",
"{",
"String",
"breadcrumb",
"=",
"storageHandler",
".",
"loadSelectedCategory",
"(",
")",
";",
"Category",
"defaultCategory",
"=",
"getCategories",
"(",
")",
".",
"get",
"(",
"DEFAULT_CATEGORY",
")",
";",
... | Loads the last selected Category before exiting the Preferences window.
@return last selected Category | [
"Loads",
"the",
"last",
"selected",
"Category",
"before",
"exiting",
"the",
"Preferences",
"window",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/PreferencesFxModel.java#L165-L174 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/PreferencesFxModel.java | PreferencesFxModel.removeEventHandler | public void removeEventHandler(EventType<PreferencesFxEvent> eventType,
EventHandler<? super PreferencesFxEvent> eventHandler) {
if (eventType == null) {
throw new NullPointerException("Argument eventType must not be null");
}
if (eventHandler == null) {
throw ne... | java | public void removeEventHandler(EventType<PreferencesFxEvent> eventType,
EventHandler<? super PreferencesFxEvent> eventHandler) {
if (eventType == null) {
throw new NullPointerException("Argument eventType must not be null");
}
if (eventHandler == null) {
throw ne... | [
"public",
"void",
"removeEventHandler",
"(",
"EventType",
"<",
"PreferencesFxEvent",
">",
"eventType",
",",
"EventHandler",
"<",
"?",
"super",
"PreferencesFxEvent",
">",
"eventHandler",
")",
"{",
"if",
"(",
"eventType",
"==",
"null",
")",
"{",
"throw",
"new",
... | Unregisters a previously registered event handler. One handler might have been registered for
different event types, so the caller needs to specify the particular event type from which to
unregister the handler.
@param eventType the event type from which to unregister
@param eventHandler the handler to unregister
@thr... | [
"Unregisters",
"a",
"previously",
"registered",
"event",
"handler",
".",
"One",
"handler",
"might",
"have",
"been",
"registered",
"for",
"different",
"event",
"types",
"so",
"the",
"caller",
"needs",
"to",
"specify",
"the",
"particular",
"event",
"type",
"from",... | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/PreferencesFxModel.java#L303-L316 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/StorageHandlerImpl.java | StorageHandlerImpl.loadObservableList | public ObservableList loadObservableList(
String breadcrumb,
ObservableList defaultObservableList
) {
String json = getSerializedPreferencesValue(breadcrumb, gson.toJson(defaultObservableList));
return FXCollections.observableArrayList(gson.fromJson(json, ArrayList.class));
} | java | public ObservableList loadObservableList(
String breadcrumb,
ObservableList defaultObservableList
) {
String json = getSerializedPreferencesValue(breadcrumb, gson.toJson(defaultObservableList));
return FXCollections.observableArrayList(gson.fromJson(json, ArrayList.class));
} | [
"public",
"ObservableList",
"loadObservableList",
"(",
"String",
"breadcrumb",
",",
"ObservableList",
"defaultObservableList",
")",
"{",
"String",
"json",
"=",
"getSerializedPreferencesValue",
"(",
"breadcrumb",
",",
"gson",
".",
"toJson",
"(",
"defaultObservableList",
... | Searches in the preferences after a serialized ArrayList using the given key,
deserializes and returns it as ObservableArrayList.
When an ObservableList is deserialzed, Gson returns an ArrayList
and needs to be wrapped into an ObservableArrayList. This is only needed for loading.
@param breadcrumb the key w... | [
"Searches",
"in",
"the",
"preferences",
"after",
"a",
"serialized",
"ArrayList",
"using",
"the",
"given",
"key",
"deserializes",
"and",
"returns",
"it",
"as",
"ObservableArrayList",
".",
"When",
"an",
"ObservableList",
"is",
"deserialzed",
"Gson",
"returns",
"an",... | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/StorageHandlerImpl.java#L195-L201 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java | Setting.of | public static <P> Setting of(
String description, ListProperty<P> items, ObjectProperty<P> selection) {
return new Setting<>(
description,
Field.ofSingleSelectionType(items, selection)
.label(description)
.render(new SimpleComboBoxControl<>()),
selection);
} | java | public static <P> Setting of(
String description, ListProperty<P> items, ObjectProperty<P> selection) {
return new Setting<>(
description,
Field.ofSingleSelectionType(items, selection)
.label(description)
.render(new SimpleComboBoxControl<>()),
selection);
} | [
"public",
"static",
"<",
"P",
">",
"Setting",
"of",
"(",
"String",
"description",
",",
"ListProperty",
"<",
"P",
">",
"items",
",",
"ObjectProperty",
"<",
"P",
">",
"selection",
")",
"{",
"return",
"new",
"Setting",
"<>",
"(",
"description",
",",
"Field"... | Creates a combobox with single selection.
@param description the title of this setting
@param items the items which are possible to choose in the combobox, which are shown
in their {@link #toString()} representation
@param selection the currently selected item of the combobox to be bound, saved / loaded and
us... | [
"Creates",
"a",
"combobox",
"with",
"single",
"selection",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java#L174-L182 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java | Setting.of | public static <P> Setting of(
String description, ListProperty<P> items, ListProperty<P> selections) {
return new Setting<>(
description,
Field.ofMultiSelectionType(items, selections)
.label(description)
.render(new SimpleListViewControl<>()),
selections);
} | java | public static <P> Setting of(
String description, ListProperty<P> items, ListProperty<P> selections) {
return new Setting<>(
description,
Field.ofMultiSelectionType(items, selections)
.label(description)
.render(new SimpleListViewControl<>()),
selections);
} | [
"public",
"static",
"<",
"P",
">",
"Setting",
"of",
"(",
"String",
"description",
",",
"ListProperty",
"<",
"P",
">",
"items",
",",
"ListProperty",
"<",
"P",
">",
"selections",
")",
"{",
"return",
"new",
"Setting",
"<>",
"(",
"description",
",",
"Field",... | Creates a combobox with multiselection.
At least one element has to be selected at all times.
@param description the title of this setting
@param items the items which are possible to choose in the combobox, which are shown
in their {@link #toString()} representation
@param selections the currently selected ite... | [
"Creates",
"a",
"combobox",
"with",
"multiselection",
".",
"At",
"least",
"one",
"element",
"has",
"to",
"be",
"selected",
"at",
"all",
"times",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java#L217-L225 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java | Setting.of | public static <F extends Field<F>, P extends Property> Setting of(
String description, F field, P property) {
return new Setting<>(
description,
field.label(description),
property);
} | java | public static <F extends Field<F>, P extends Property> Setting of(
String description, F field, P property) {
return new Setting<>(
description,
field.label(description),
property);
} | [
"public",
"static",
"<",
"F",
"extends",
"Field",
"<",
"F",
">",
",",
"P",
"extends",
"Property",
">",
"Setting",
"of",
"(",
"String",
"description",
",",
"F",
"field",
",",
"P",
"property",
")",
"{",
"return",
"new",
"Setting",
"<>",
"(",
"description... | Creates a setting of a custom defined field.
@param description the title of this setting
@param field custom Field object from FormsFX
@param property to be bound, saved / loaded and used for undo / redo
@return the constructed setting | [
"Creates",
"a",
"setting",
"of",
"a",
"custom",
"defined",
"field",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java#L257-L263 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java | Setting.validate | @SafeVarargs
public final Setting validate(Validator... newValue) {
if (field instanceof DataField) {
((DataField) field).validate(newValue);
} else {
throw new UnsupportedOperationException("Field type must be instance of DataField");
}
return this;
} | java | @SafeVarargs
public final Setting validate(Validator... newValue) {
if (field instanceof DataField) {
((DataField) field).validate(newValue);
} else {
throw new UnsupportedOperationException("Field type must be instance of DataField");
}
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"Setting",
"validate",
"(",
"Validator",
"...",
"newValue",
")",
"{",
"if",
"(",
"field",
"instanceof",
"DataField",
")",
"{",
"(",
"(",
"DataField",
")",
"field",
")",
".",
"validate",
"(",
"newValue",
")",
";",
"}... | Sets the list of validators for the current field. This overrides all
validators that have previously been added.
@param newValue The validators that are to be used for validating this
field. Limited to validators that are able to handle the
field's underlying type.
@return the current setting to allow for chaining
@t... | [
"Sets",
"the",
"list",
"of",
"validators",
"for",
"the",
"current",
"field",
".",
"This",
"overrides",
"all",
"validators",
"that",
"have",
"previously",
"been",
"added",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java#L275-L283 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java | Setting.mark | public void mark() {
// ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times
if (!marked) {
SimpleControl renderer = (SimpleControl) getField().getRenderer();
Node markNode = renderer.getFieldLabel();
markNode.getStyleClass().add(MARKED_STYLE_CLASS);
... | java | public void mark() {
// ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times
if (!marked) {
SimpleControl renderer = (SimpleControl) getField().getRenderer();
Node markNode = renderer.getFieldLabel();
markNode.getStyleClass().add(MARKED_STYLE_CLASS);
... | [
"public",
"void",
"mark",
"(",
")",
"{",
"// ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times",
"if",
"(",
"!",
"marked",
")",
"{",
"SimpleControl",
"renderer",
"=",
"(",
"SimpleControl",
")",
"getField",
"(",
")",
".",
"getRe... | Marks a setting.
Is used for the search, which marks and unmarks items depending on the match as a form of
visual feedback. | [
"Marks",
"a",
"setting",
".",
"Is",
"used",
"for",
"the",
"search",
"which",
"marks",
"and",
"unmarks",
"items",
"depending",
"on",
"the",
"match",
"as",
"a",
"form",
"of",
"visual",
"feedback",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java#L290-L299 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java | Setting.unmark | public void unmark() {
// check if it's marked before removing the style class
if (marked) {
SimpleControl renderer = (SimpleControl) getField().getRenderer();
Node markNode = renderer.getFieldLabel();
markNode.getStyleClass().remove(MARKED_STYLE_CLASS);
markNode.removeEventHandler(Mouse... | java | public void unmark() {
// check if it's marked before removing the style class
if (marked) {
SimpleControl renderer = (SimpleControl) getField().getRenderer();
Node markNode = renderer.getFieldLabel();
markNode.getStyleClass().remove(MARKED_STYLE_CLASS);
markNode.removeEventHandler(Mouse... | [
"public",
"void",
"unmark",
"(",
")",
"{",
"// check if it's marked before removing the style class",
"if",
"(",
"marked",
")",
"{",
"SimpleControl",
"renderer",
"=",
"(",
"SimpleControl",
")",
"getField",
"(",
")",
".",
"getRenderer",
"(",
")",
";",
"Node",
"ma... | Unmarks a setting.
Is used for the search, which marks and unmarks items depending on the match as a form of
visual feedback. | [
"Unmarks",
"a",
"setting",
".",
"Is",
"used",
"for",
"the",
"search",
"which",
"marks",
"and",
"unmarks",
"items",
"depending",
"on",
"the",
"match",
"as",
"a",
"form",
"of",
"visual",
"feedback",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Setting.java#L306-L315 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/view/PreferencesFxDialog.java | PreferencesFxDialog.loadLastWindowState | private void loadLastWindowState() {
if (persistWindowState) {
setPrefSize(storageHandler.loadWindowWidth(), storageHandler.loadWindowHeight());
getScene().getWindow().setX(storageHandler.loadWindowPosX());
getScene().getWindow().setY(storageHandler.loadWindowPosY());
model.setDividerPositio... | java | private void loadLastWindowState() {
if (persistWindowState) {
setPrefSize(storageHandler.loadWindowWidth(), storageHandler.loadWindowHeight());
getScene().getWindow().setX(storageHandler.loadWindowPosX());
getScene().getWindow().setY(storageHandler.loadWindowPosY());
model.setDividerPositio... | [
"private",
"void",
"loadLastWindowState",
"(",
")",
"{",
"if",
"(",
"persistWindowState",
")",
"{",
"setPrefSize",
"(",
"storageHandler",
".",
"loadWindowWidth",
"(",
")",
",",
"storageHandler",
".",
"loadWindowHeight",
"(",
")",
")",
";",
"getScene",
"(",
")"... | Loads last saved size and position of the window. | [
"Loads",
"last",
"saved",
"size",
"and",
"position",
"of",
"the",
"window",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/PreferencesFxDialog.java#L117-L128 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/view/CategoryPresenter.java | CategoryPresenter.addI18nListener | private void addI18nListener() {
model.translationServiceProperty().addListener((observable, oldValue, newValue) -> {
if (oldValue != newValue) {
form.i18n(newValue);
newValue.addListener(categoryModel::updateGroupDescriptions);
if (!Objects.equals(breadCrumbPresenter, null)) {
... | java | private void addI18nListener() {
model.translationServiceProperty().addListener((observable, oldValue, newValue) -> {
if (oldValue != newValue) {
form.i18n(newValue);
newValue.addListener(categoryModel::updateGroupDescriptions);
if (!Objects.equals(breadCrumbPresenter, null)) {
... | [
"private",
"void",
"addI18nListener",
"(",
")",
"{",
"model",
".",
"translationServiceProperty",
"(",
")",
".",
"addListener",
"(",
"(",
"observable",
",",
"oldValue",
",",
"newValue",
")",
"->",
"{",
"if",
"(",
"oldValue",
"!=",
"newValue",
")",
"{",
"for... | Updates the internal FormsFX form with the most current TranslationService.
Makes sure the group descriptions are updated with changing locale. | [
"Updates",
"the",
"internal",
"FormsFX",
"form",
"with",
"the",
"most",
"current",
"TranslationService",
".",
"Makes",
"sure",
"the",
"group",
"descriptions",
"are",
"updated",
"with",
"changing",
"locale",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/CategoryPresenter.java#L68-L79 | train |
dlemmermann/PreferencesFX | preferencesfx-demo/src/main/java/com/dlsc/preferencesfx/i18n/DemoView.java | DemoView.translate | public void translate(String language) {
switch (language) {
case "EN":
rootPane.rbs.changeLocale(rootPane.rbEN);
break;
case "DE":
rootPane.rbs.changeLocale(rootPane.rbDE);
break;
default:
throw new IllegalArgumentException("Not a valid locale");
}
} | java | public void translate(String language) {
switch (language) {
case "EN":
rootPane.rbs.changeLocale(rootPane.rbEN);
break;
case "DE":
rootPane.rbs.changeLocale(rootPane.rbDE);
break;
default:
throw new IllegalArgumentException("Not a valid locale");
}
} | [
"public",
"void",
"translate",
"(",
"String",
"language",
")",
"{",
"switch",
"(",
"language",
")",
"{",
"case",
"\"EN\"",
":",
"rootPane",
".",
"rbs",
".",
"changeLocale",
"(",
"rootPane",
".",
"rbEN",
")",
";",
"break",
";",
"case",
"\"DE\"",
":",
"r... | Sets the locale of the form.
@param language The language identifier for the new locale. Either DE or EN. | [
"Sets",
"the",
"locale",
"of",
"the",
"form",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx-demo/src/main/java/com/dlsc/preferencesfx/i18n/DemoView.java#L165-L176 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Group.java | Group.mark | public void mark() {
// ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times
if (!marked) {
preferencesGroup.getRenderer().addStyleClass(MARKED_STYLE_CLASS);
preferencesGroup.getRenderer().getTitleLabel().setOnMouseExited(unmarker);
marked = !marked;
... | java | public void mark() {
// ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times
if (!marked) {
preferencesGroup.getRenderer().addStyleClass(MARKED_STYLE_CLASS);
preferencesGroup.getRenderer().getTitleLabel().setOnMouseExited(unmarker);
marked = !marked;
... | [
"public",
"void",
"mark",
"(",
")",
"{",
"// ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times",
"if",
"(",
"!",
"marked",
")",
"{",
"preferencesGroup",
".",
"getRenderer",
"(",
")",
".",
"addStyleClass",
"(",
"MARKED_STYLE_CLASS",... | Marks this group in the GUI.
Is used for the search, which marks and unmarks items depending on the match as a form of
visual feedback. | [
"Marks",
"this",
"group",
"in",
"the",
"GUI",
".",
"Is",
"used",
"for",
"the",
"search",
"which",
"marks",
"and",
"unmarks",
"items",
"depending",
"on",
"the",
"match",
"as",
"a",
"form",
"of",
"visual",
"feedback",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Group.java#L98-L105 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Group.java | Group.unmark | public void unmark() {
// check if it's marked before removing the style class
if (marked) {
preferencesGroup.getRenderer().removeStyleClass(MARKED_STYLE_CLASS);
preferencesGroup.getRenderer().getTitleLabel().removeEventHandler(
MouseEvent.MOUSE_EXITED, unmarker
);
marked = !ma... | java | public void unmark() {
// check if it's marked before removing the style class
if (marked) {
preferencesGroup.getRenderer().removeStyleClass(MARKED_STYLE_CLASS);
preferencesGroup.getRenderer().getTitleLabel().removeEventHandler(
MouseEvent.MOUSE_EXITED, unmarker
);
marked = !ma... | [
"public",
"void",
"unmark",
"(",
")",
"{",
"// check if it's marked before removing the style class",
"if",
"(",
"marked",
")",
"{",
"preferencesGroup",
".",
"getRenderer",
"(",
")",
".",
"removeStyleClass",
"(",
"MARKED_STYLE_CLASS",
")",
";",
"preferencesGroup",
"."... | Unmarks this group in the GUI.
Is used for the search, which marks and unmarks items depending on the match as a form of
visual feedback. | [
"Unmarks",
"this",
"group",
"in",
"the",
"GUI",
".",
"Is",
"used",
"for",
"the",
"search",
"which",
"marks",
"and",
"unmarks",
"items",
"depending",
"on",
"the",
"match",
"as",
"a",
"form",
"of",
"visual",
"feedback",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Group.java#L112-L121 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/view/CategoryController.java | CategoryController.setView | public boolean setView(final Category category) {
LOGGER.trace("CategoryController, setView: " + category);
CategoryView categoryView = views.get(category);
if (categoryView != null) { // view is loaded
setContent(categoryView);
// Binding for ScrollPane
categoryView.minWidthProperty().bin... | java | public boolean setView(final Category category) {
LOGGER.trace("CategoryController, setView: " + category);
CategoryView categoryView = views.get(category);
if (categoryView != null) { // view is loaded
setContent(categoryView);
// Binding for ScrollPane
categoryView.minWidthProperty().bin... | [
"public",
"boolean",
"setView",
"(",
"final",
"Category",
"category",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"CategoryController, setView: \"",
"+",
"category",
")",
";",
"CategoryView",
"categoryView",
"=",
"views",
".",
"get",
"(",
"category",
")",
";",
"i... | Sets the current view to the one of the respective category.
This method can be called in the presenter to switch to a different CategoryView.
Controls the way views are being transitioned from one to another.
@param category of the categoryView that will be set
@return true if successfully loaded, false if view is no... | [
"Sets",
"the",
"current",
"view",
"to",
"the",
"one",
"of",
"the",
"respective",
"category",
".",
"This",
"method",
"can",
"be",
"called",
"in",
"the",
"presenter",
"to",
"switch",
"to",
"a",
"different",
"CategoryView",
".",
"Controls",
"the",
"way",
"vie... | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/CategoryController.java#L66-L80 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/view/CategoryController.java | CategoryController.addListener | public void addListener(ReadOnlyObjectProperty<Category> categoryProperty) {
categoryProperty.addListener((observable, oldCategory, newCategory) -> {
setView(newCategory);
});
} | java | public void addListener(ReadOnlyObjectProperty<Category> categoryProperty) {
categoryProperty.addListener((observable, oldCategory, newCategory) -> {
setView(newCategory);
});
} | [
"public",
"void",
"addListener",
"(",
"ReadOnlyObjectProperty",
"<",
"Category",
">",
"categoryProperty",
")",
"{",
"categoryProperty",
".",
"addListener",
"(",
"(",
"observable",
",",
"oldCategory",
",",
"newCategory",
")",
"->",
"{",
"setView",
"(",
"newCategory... | Sets the view according to the current category in categoryProperty.
Must ensure that the category is already loaded, else it will fail.
@param categoryProperty with category to be listened for | [
"Sets",
"the",
"view",
"according",
"to",
"the",
"current",
"category",
"in",
"categoryProperty",
".",
"Must",
"ensure",
"that",
"the",
"category",
"is",
"already",
"loaded",
"else",
"it",
"will",
"fail",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/CategoryController.java#L104-L108 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/PreferencesFxUtils.java | PreferencesFxUtils.flattenCategories | public static List<Category> flattenCategories(List<Category> categoryLst) {
if (categoryLst == null) {
return null;
}
List<Category> flatCategoryLst = new ArrayList<>();
flattenCategories(flatCategoryLst, categoryLst);
return flatCategoryLst;
} | java | public static List<Category> flattenCategories(List<Category> categoryLst) {
if (categoryLst == null) {
return null;
}
List<Category> flatCategoryLst = new ArrayList<>();
flattenCategories(flatCategoryLst, categoryLst);
return flatCategoryLst;
} | [
"public",
"static",
"List",
"<",
"Category",
">",
"flattenCategories",
"(",
"List",
"<",
"Category",
">",
"categoryLst",
")",
"{",
"if",
"(",
"categoryLst",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"Category",
">",
"flatCategoryLst"... | Puts all categories and their respective children recursively flattened into a list.
@param categoryLst list of parent categories
@return list of all parent categories and respective recursive children categories | [
"Puts",
"all",
"categories",
"and",
"their",
"respective",
"children",
"recursively",
"flattened",
"into",
"a",
"list",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/PreferencesFxUtils.java#L167-L174 | train |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/PreferencesFxUtils.java | PreferencesFxUtils.flattenCategories | private static void flattenCategories(List<Category> flatList, List<Category> categories) {
categories.forEach(category -> {
flatList.add(category);
List<Category> children = category.getChildren();
if (children != null) {
flattenCategories(flatList, children);
}
});
} | java | private static void flattenCategories(List<Category> flatList, List<Category> categories) {
categories.forEach(category -> {
flatList.add(category);
List<Category> children = category.getChildren();
if (children != null) {
flattenCategories(flatList, children);
}
});
} | [
"private",
"static",
"void",
"flattenCategories",
"(",
"List",
"<",
"Category",
">",
"flatList",
",",
"List",
"<",
"Category",
">",
"categories",
")",
"{",
"categories",
".",
"forEach",
"(",
"category",
"->",
"{",
"flatList",
".",
"add",
"(",
"category",
"... | Goes through the list of parent categories and adds each category it visists to the flatList.
@param flatList list to which the categories for the flattened list should be added
@param categories list of parent categories to go through recursively
@implNote Internal helper method for {@link PreferencesFxUtils#flatte... | [
"Goes",
"through",
"the",
"list",
"of",
"parent",
"categories",
"and",
"adds",
"each",
"category",
"it",
"visists",
"to",
"the",
"flatList",
"."
] | e06a49663ec949c2f7eb56e6b5952c030ed42d33 | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/PreferencesFxUtils.java#L183-L191 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.