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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Application.java | Application.registerTemplateEngine | public void registerTemplateEngine(Class<? extends TemplateEngine> engineClass) {
if (templateEngine != null) {
log.debug("Template engine already registered, ignoring '{}'", engineClass.getName());
return;
}
try {
TemplateEngine engine = engineClass.newInsta... | java | public void registerTemplateEngine(Class<? extends TemplateEngine> engineClass) {
if (templateEngine != null) {
log.debug("Template engine already registered, ignoring '{}'", engineClass.getName());
return;
}
try {
TemplateEngine engine = engineClass.newInsta... | [
"public",
"void",
"registerTemplateEngine",
"(",
"Class",
"<",
"?",
"extends",
"TemplateEngine",
">",
"engineClass",
")",
"{",
"if",
"(",
"templateEngine",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Template engine already registered, ignoring '{}'\"",
","... | Registers a template engine if no other engine has been registered.
@param engineClass | [
"Registers",
"a",
"template",
"engine",
"if",
"no",
"other",
"engine",
"has",
"been",
"registered",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Application.java#L181-L193 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/PippoUtils.java | PippoUtils.getPippoVersion | public static String getPippoVersion() {
// and the key inside the properties file.
String pippoVersionPropertyKey = "pippo.version";
String pippoVersion;
try {
Properties prop = new Properties();
URL url = ClasspathUtils.locateOnClasspath(PippoConstants.LOCATIO... | java | public static String getPippoVersion() {
// and the key inside the properties file.
String pippoVersionPropertyKey = "pippo.version";
String pippoVersion;
try {
Properties prop = new Properties();
URL url = ClasspathUtils.locateOnClasspath(PippoConstants.LOCATIO... | [
"public",
"static",
"String",
"getPippoVersion",
"(",
")",
"{",
"// and the key inside the properties file.",
"String",
"pippoVersionPropertyKey",
"=",
"\"pippo.version\"",
";",
"String",
"pippoVersion",
";",
"try",
"{",
"Properties",
"prop",
"=",
"new",
"Properties",
"... | Simply reads a property resource file that contains the version of this
Pippo build. Helps to identify the Pippo version currently running.
@return The version of Pippo. Eg. "1.6-SNAPSHOT" while developing of "1.6" when released. | [
"Simply",
"reads",
"a",
"property",
"resource",
"file",
"that",
"contains",
"the",
"version",
"of",
"this",
"Pippo",
"build",
".",
"Helps",
"to",
"identify",
"the",
"Pippo",
"version",
"currently",
"running",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/PippoUtils.java#L48-L68 | train |
pippo-java/pippo | pippo-template-parent/pippo-groovy/src/main/java/ro/pippo/groovy/PippoGroovyTemplate.java | PippoGroovyTemplate.layout | @Override
public Object layout(Map model, String templateName, boolean inheritModel) throws IOException,
ClassNotFoundException {
Map submodel = inheritModel ? forkModel(model) : model;
URL resource = engine.resolveTemplate(templateName);
PippoGroovyTemplate template = (PippoGroo... | java | @Override
public Object layout(Map model, String templateName, boolean inheritModel) throws IOException,
ClassNotFoundException {
Map submodel = inheritModel ? forkModel(model) : model;
URL resource = engine.resolveTemplate(templateName);
PippoGroovyTemplate template = (PippoGroo... | [
"@",
"Override",
"public",
"Object",
"layout",
"(",
"Map",
"model",
",",
"String",
"templateName",
",",
"boolean",
"inheritModel",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"Map",
"submodel",
"=",
"inheritModel",
"?",
"forkModel",
"(",
"m... | Imports a template and renders it using the specified model, allowing
fine grained composition of templates and layouting. This works
similarily to a template include but allows a distinct model to be used.
If the layout inherits from the parent model, a new model is created,
with the values from the parent model, even... | [
"Imports",
"a",
"template",
"and",
"renders",
"it",
"using",
"the",
"specified",
"model",
"allowing",
"fine",
"grained",
"composition",
"of",
"templates",
"and",
"layouting",
".",
"This",
"works",
"similarily",
"to",
"a",
"template",
"include",
"but",
"allows",
... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-template-parent/pippo-groovy/src/main/java/ro/pippo/groovy/PippoGroovyTemplate.java#L217-L228 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-infinispan/src/main/java/ro/pippo/session/infinispan/InfinispanFactory.java | InfinispanFactory.create | public static EmbeddedCacheManager create(long idleTime) {
Configuration configuration = new ConfigurationBuilder()
.expiration().maxIdle(idleTime, TimeUnit.SECONDS)
.build();
return new DefaultCacheManager(configuration);
} | java | public static EmbeddedCacheManager create(long idleTime) {
Configuration configuration = new ConfigurationBuilder()
.expiration().maxIdle(idleTime, TimeUnit.SECONDS)
.build();
return new DefaultCacheManager(configuration);
} | [
"public",
"static",
"EmbeddedCacheManager",
"create",
"(",
"long",
"idleTime",
")",
"{",
"Configuration",
"configuration",
"=",
"new",
"ConfigurationBuilder",
"(",
")",
".",
"expiration",
"(",
")",
".",
"maxIdle",
"(",
"idleTime",
",",
"TimeUnit",
".",
"SECONDS"... | Create cache manager with custom idle time.
@param idleTime idle time in seconds
@return cache manager | [
"Create",
"cache",
"manager",
"with",
"custom",
"idle",
"time",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-infinispan/src/main/java/ro/pippo/session/infinispan/InfinispanFactory.java#L48-L53 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-infinispan/src/main/java/ro/pippo/session/infinispan/InfinispanFactory.java | InfinispanFactory.create | public static EmbeddedCacheManager create(String file) {
try {
return new DefaultCacheManager(file);
} catch (IOException ex) {
log.error("", ex);
throw new PippoRuntimeException(ex);
}
} | java | public static EmbeddedCacheManager create(String file) {
try {
return new DefaultCacheManager(file);
} catch (IOException ex) {
log.error("", ex);
throw new PippoRuntimeException(ex);
}
} | [
"public",
"static",
"EmbeddedCacheManager",
"create",
"(",
"String",
"file",
")",
"{",
"try",
"{",
"return",
"new",
"DefaultCacheManager",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"log",
".",
"error",
"(",
"\"\"",
",",
"ex... | Create cache manager with custom config file.
@param file config file
@return cache manager | [
"Create",
"cache",
"manager",
"with",
"custom",
"config",
"file",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-infinispan/src/main/java/ro/pippo/session/infinispan/InfinispanFactory.java#L70-L77 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.bind | public Response bind(String name, Object model) {
getLocals().put(name, model);
return this;
} | java | public Response bind(String name, Object model) {
getLocals().put(name, model);
return this;
} | [
"public",
"Response",
"bind",
"(",
"String",
"name",
",",
"Object",
"model",
")",
"{",
"getLocals",
"(",
")",
".",
"put",
"(",
"name",
",",
"model",
")",
";",
"return",
"this",
";",
"}"
] | Binds an object to the response.
@param name
@param model
@return the response | [
"Binds",
"an",
"object",
"to",
"the",
"response",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L110-L114 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.removeCookie | public Response removeCookie(String name) {
Cookie cookie = new Cookie(name, "");
cookie.setSecure(true);
cookie.setMaxAge(0);
addCookie(cookie);
return this;
} | java | public Response removeCookie(String name) {
Cookie cookie = new Cookie(name, "");
cookie.setSecure(true);
cookie.setMaxAge(0);
addCookie(cookie);
return this;
} | [
"public",
"Response",
"removeCookie",
"(",
"String",
"name",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"\"\"",
")",
";",
"cookie",
".",
"setSecure",
"(",
"true",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"0",
")",
";",
"a... | Removes the specified cookie by name.
@param name
@return the response | [
"Removes",
"the",
"specified",
"cookie",
"by",
"name",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L247-L254 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.noCache | public Response noCache() {
checkCommitted();
// no-cache headers for HTTP/1.1
header(HttpConstants.Header.CACHE_CONTROL, "no-store, no-cache, must-revalidate");
// no-cache headers for HTTP/1.1 (IE)
header(HttpConstants.Header.CACHE_CONTROL, "post-check=0, pre-check=0");
... | java | public Response noCache() {
checkCommitted();
// no-cache headers for HTTP/1.1
header(HttpConstants.Header.CACHE_CONTROL, "no-store, no-cache, must-revalidate");
// no-cache headers for HTTP/1.1 (IE)
header(HttpConstants.Header.CACHE_CONTROL, "post-check=0, pre-check=0");
... | [
"public",
"Response",
"noCache",
"(",
")",
"{",
"checkCommitted",
"(",
")",
";",
"// no-cache headers for HTTP/1.1",
"header",
"(",
"HttpConstants",
".",
"Header",
".",
"CACHE_CONTROL",
",",
"\"no-store, no-cache, must-revalidate\"",
")",
";",
"// no-cache headers for HTT... | Sets this response as not cacheable.
@return the response | [
"Sets",
"this",
"response",
"as",
"not",
"cacheable",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L337-L353 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.getContentType | public String getContentType() {
String contentType = getHeader(HttpConstants.Header.CONTENT_TYPE);
if (contentType == null) {
contentType = httpServletResponse.getContentType();
}
return contentType;
} | java | public String getContentType() {
String contentType = getHeader(HttpConstants.Header.CONTENT_TYPE);
if (contentType == null) {
contentType = httpServletResponse.getContentType();
}
return contentType;
} | [
"public",
"String",
"getContentType",
"(",
")",
"{",
"String",
"contentType",
"=",
"getHeader",
"(",
"HttpConstants",
".",
"Header",
".",
"CONTENT_TYPE",
")",
";",
"if",
"(",
"contentType",
"==",
"null",
")",
"{",
"contentType",
"=",
"httpServletResponse",
"."... | Returns the content type of the response.
@return the content type | [
"Returns",
"the",
"content",
"type",
"of",
"the",
"response",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L721-L728 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.contentType | public Response contentType(String contentType) {
checkCommitted();
header(HttpConstants.Header.CONTENT_TYPE, contentType);
httpServletResponse.setContentType(contentType);
return this;
} | java | public Response contentType(String contentType) {
checkCommitted();
header(HttpConstants.Header.CONTENT_TYPE, contentType);
httpServletResponse.setContentType(contentType);
return this;
} | [
"public",
"Response",
"contentType",
"(",
"String",
"contentType",
")",
"{",
"checkCommitted",
"(",
")",
";",
"header",
"(",
"HttpConstants",
".",
"Header",
".",
"CONTENT_TYPE",
",",
"contentType",
")",
";",
"httpServletResponse",
".",
"setContentType",
"(",
"co... | Sets the content type of the response.
@param contentType
@return the response | [
"Sets",
"the",
"content",
"type",
"of",
"the",
"response",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L736-L743 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java | CryptoUtils.getHashSHA256 | public static String getHashSHA256(String text) {
byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
return getHashSHA256(bytes);
} | java | public static String getHashSHA256(String text) {
byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
return getHashSHA256(bytes);
} | [
"public",
"static",
"String",
"getHashSHA256",
"(",
"String",
"text",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"text",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"ISO_8859_1",
")",
";",
"return",
"getHashSHA256",
"(",
"bytes",
")",
";",
"}"
] | Calculates the SHA256 hash of the string.
@param text
@return sha256 hash of the string | [
"Calculates",
"the",
"SHA256",
"hash",
"of",
"the",
"string",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java#L74-L77 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java | CryptoUtils.getHashSHA1 | public static String getHashSHA1(String text) {
byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
return getHashSHA1(bytes);
} | java | public static String getHashSHA1(String text) {
byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
return getHashSHA1(bytes);
} | [
"public",
"static",
"String",
"getHashSHA1",
"(",
"String",
"text",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"text",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"ISO_8859_1",
")",
";",
"return",
"getHashSHA1",
"(",
"bytes",
")",
";",
"}"
] | Calculates the SHA1 hash of the string.
@param text
@return sha1 hash of the string | [
"Calculates",
"the",
"SHA1",
"hash",
"of",
"the",
"string",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java#L102-L105 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java | CryptoUtils.getHashMD5 | public static String getHashMD5(String text) {
byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
return getHashMD5(bytes);
} | java | public static String getHashMD5(String text) {
byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
return getHashMD5(bytes);
} | [
"public",
"static",
"String",
"getHashMD5",
"(",
"String",
"text",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"text",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"ISO_8859_1",
")",
";",
"return",
"getHashMD5",
"(",
"bytes",
")",
";",
"}"
] | Calculates the MD5 hash of the string.
@param text
@return md5 hash of the string | [
"Calculates",
"the",
"MD5",
"hash",
"of",
"the",
"string",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java#L130-L133 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java | CryptoUtils.getHashMD5 | public static String getHashMD5(byte[] bytes) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes, 0, bytes.length);
byte[] digest = md.digest();
return toHex(digest);
} catch (NoSuchAlgorithmException t) {
throw new Ru... | java | public static String getHashMD5(byte[] bytes) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes, 0, bytes.length);
byte[] digest = md.digest();
return toHex(digest);
} catch (NoSuchAlgorithmException t) {
throw new Ru... | [
"public",
"static",
"String",
"getHashMD5",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"try",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md",
".",
"update",
"(",
"bytes",
",",
"0",
",",
"bytes",
".",... | Calculates the MD5 hash of the byte array.
@param bytes
@return md5 hash of the byte array | [
"Calculates",
"the",
"MD5",
"hash",
"of",
"the",
"byte",
"array",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java#L141-L150 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java | CryptoUtils.generateSecretKey | public static String generateSecretKey() {
return hmacDigest(UUID.randomUUID().toString(), UUID.randomUUID().toString(), HMAC_SHA256);
} | java | public static String generateSecretKey() {
return hmacDigest(UUID.randomUUID().toString(), UUID.randomUUID().toString(), HMAC_SHA256);
} | [
"public",
"static",
"String",
"generateSecretKey",
"(",
")",
"{",
"return",
"hmacDigest",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
",",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
",",
"HMAC_SHA256",
")",
... | Generates a random secret key.
@return a random secret key. | [
"Generates",
"a",
"random",
"secret",
"key",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/CryptoUtils.java#L169-L171 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-mongodb/src/main/java/ro/pippo/session/mongodb/MongoDBFactory.java | MongoDBFactory.create | public static MongoClient create(final PippoSettings settings) {
String host = settings.getString(HOST, "mongodb://localhost:27017");
return create(host);
} | java | public static MongoClient create(final PippoSettings settings) {
String host = settings.getString(HOST, "mongodb://localhost:27017");
return create(host);
} | [
"public",
"static",
"MongoClient",
"create",
"(",
"final",
"PippoSettings",
"settings",
")",
"{",
"String",
"host",
"=",
"settings",
".",
"getString",
"(",
"HOST",
",",
"\"mongodb://localhost:27017\"",
")",
";",
"return",
"create",
"(",
"host",
")",
";",
"}"
] | Create a MongoDB client with pippo settings.
@param settings pippo settings
@return MongoDB client | [
"Create",
"a",
"MongoDB",
"client",
"with",
"pippo",
"settings",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-mongodb/src/main/java/ro/pippo/session/mongodb/MongoDBFactory.java#L42-L45 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-mongodb/src/main/java/ro/pippo/session/mongodb/MongoDBFactory.java | MongoDBFactory.create | public static MongoClient create(String hosts) {
MongoClientURI connectionString = new MongoClientURI(hosts);
return new MongoClient(connectionString);
} | java | public static MongoClient create(String hosts) {
MongoClientURI connectionString = new MongoClientURI(hosts);
return new MongoClient(connectionString);
} | [
"public",
"static",
"MongoClient",
"create",
"(",
"String",
"hosts",
")",
"{",
"MongoClientURI",
"connectionString",
"=",
"new",
"MongoClientURI",
"(",
"hosts",
")",
";",
"return",
"new",
"MongoClient",
"(",
"connectionString",
")",
";",
"}"
] | Create a MongoDB client with params.
@param hosts list of hosts of the form
"mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
@return MongoDB client
@see <a href="https://docs.mongodb.com/manual/reference/connection-string/">Mongo docs</a> | [
"Create",
"a",
"MongoDB",
"client",
"with",
"params",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-mongodb/src/main/java/ro/pippo/session/mongodb/MongoDBFactory.java#L55-L58 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java | RouteDispatcher.onPreDispatch | protected void onPreDispatch(Request request, Response response) {
application.getRoutePreDispatchListeners().onPreDispatch(request, response);
} | java | protected void onPreDispatch(Request request, Response response) {
application.getRoutePreDispatchListeners().onPreDispatch(request, response);
} | [
"protected",
"void",
"onPreDispatch",
"(",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"application",
".",
"getRoutePreDispatchListeners",
"(",
")",
".",
"onPreDispatch",
"(",
"request",
",",
"response",
")",
";",
"}"
] | Executes onPreDispatch of registered route pre-dispatch listeners.
@param request
@param response | [
"Executes",
"onPreDispatch",
"of",
"registered",
"route",
"pre",
"-",
"dispatch",
"listeners",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java#L111-L113 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java | RouteDispatcher.onRouteDispatch | protected void onRouteDispatch(Request request, Response response) {
final String requestPath = request.getPath();
final String requestMethod = request.getMethod();
if (shouldIgnorePath(requestPath)) {
// NOT FOUND (404)
RouteContext routeContext = routeContextFactory.cr... | java | protected void onRouteDispatch(Request request, Response response) {
final String requestPath = request.getPath();
final String requestMethod = request.getMethod();
if (shouldIgnorePath(requestPath)) {
// NOT FOUND (404)
RouteContext routeContext = routeContextFactory.cr... | [
"protected",
"void",
"onRouteDispatch",
"(",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"final",
"String",
"requestPath",
"=",
"request",
".",
"getPath",
"(",
")",
";",
"final",
"String",
"requestMethod",
"=",
"request",
".",
"getMethod",
"("... | onRouteDispatch is the front-line for Route processing.
@param request
@param response | [
"onRouteDispatch",
"is",
"the",
"front",
"-",
"line",
"for",
"Route",
"processing",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java#L121-L176 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java | RouteDispatcher.onPostDispatch | protected void onPostDispatch(Request request, Response response) {
application.getRoutePostDispatchListeners().onPostDispatch(request, response);
} | java | protected void onPostDispatch(Request request, Response response) {
application.getRoutePostDispatchListeners().onPostDispatch(request, response);
} | [
"protected",
"void",
"onPostDispatch",
"(",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"application",
".",
"getRoutePostDispatchListeners",
"(",
")",
".",
"onPostDispatch",
"(",
"request",
",",
"response",
")",
";",
"}"
] | Executes onPostDispatch of registered route post-dispatch listeners.
@param request
@param response | [
"Executes",
"onPostDispatch",
"of",
"registered",
"route",
"post",
"-",
"dispatch",
"listeners",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java#L184-L186 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java | RouteDispatcher.processFlash | private void processFlash(RouteContext routeContext) {
Flash flash = null;
if (routeContext.hasSession()) {
// get flash from session
flash = routeContext.removeSession("flash");
// put an empty flash (outgoing flash) in session; defense against session.get("flash")
... | java | private void processFlash(RouteContext routeContext) {
Flash flash = null;
if (routeContext.hasSession()) {
// get flash from session
flash = routeContext.removeSession("flash");
// put an empty flash (outgoing flash) in session; defense against session.get("flash")
... | [
"private",
"void",
"processFlash",
"(",
"RouteContext",
"routeContext",
")",
"{",
"Flash",
"flash",
"=",
"null",
";",
"if",
"(",
"routeContext",
".",
"hasSession",
"(",
")",
")",
"{",
"// get flash from session",
"flash",
"=",
"routeContext",
".",
"removeSession... | Removes a Flash instance from the session, binds it to the RouteContext,
and creates a new Flash instance.
@param routeContext | [
"Removes",
"a",
"Flash",
"instance",
"from",
"the",
"session",
"binds",
"it",
"to",
"the",
"RouteContext",
"and",
"creates",
"a",
"new",
"Flash",
"instance",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/RouteDispatcher.java#L211-L227 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java | DefaultErrorHandler.prepareTemplateBindings | protected Map<String, Object> prepareTemplateBindings(int statusCode, RouteContext routeContext) {
Map<String, Object> locals = new LinkedHashMap<>();
locals.put("applicationName", application.getApplicationName());
locals.put("applicationVersion", application.getApplicationVersion());
l... | java | protected Map<String, Object> prepareTemplateBindings(int statusCode, RouteContext routeContext) {
Map<String, Object> locals = new LinkedHashMap<>();
locals.put("applicationName", application.getApplicationName());
locals.put("applicationVersion", application.getApplicationVersion());
l... | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"prepareTemplateBindings",
"(",
"int",
"statusCode",
",",
"RouteContext",
"routeContext",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"locals",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
... | Get the template bindings for the error response.
@param routeContext
@return bindings map | [
"Get",
"the",
"template",
"bindings",
"for",
"the",
"error",
"response",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java#L264-L274 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java | DefaultErrorHandler.prepareError | protected Error prepareError(int statusCode, RouteContext routeContext) {
String messageKey = "pippo.statusCode" + statusCode;
Error error = new Error();
error.setStatusCode(statusCode);
error.setStatusMessage(application.getMessages().get(messageKey, routeContext));
error.setRe... | java | protected Error prepareError(int statusCode, RouteContext routeContext) {
String messageKey = "pippo.statusCode" + statusCode;
Error error = new Error();
error.setStatusCode(statusCode);
error.setStatusMessage(application.getMessages().get(messageKey, routeContext));
error.setRe... | [
"protected",
"Error",
"prepareError",
"(",
"int",
"statusCode",
",",
"RouteContext",
"routeContext",
")",
"{",
"String",
"messageKey",
"=",
"\"pippo.statusCode\"",
"+",
"statusCode",
";",
"Error",
"error",
"=",
"new",
"Error",
"(",
")",
";",
"error",
".",
"set... | Prepares an Error instance for the error response.
@param statusCode
@param routeContext
@return an Error | [
"Prepares",
"an",
"Error",
"instance",
"for",
"the",
"error",
"response",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java#L283-L295 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/MethodParameter.java | MethodParameter.getParameterName | public String getParameterName() {
if (parameterName == null) {
Parameter parameter = getParameter();
if (parameter.isNamePresent()) {
parameterName = parameter.getName();
}
}
return parameterName;
} | java | public String getParameterName() {
if (parameterName == null) {
Parameter parameter = getParameter();
if (parameter.isNamePresent()) {
parameterName = parameter.getName();
}
}
return parameterName;
} | [
"public",
"String",
"getParameterName",
"(",
")",
"{",
"if",
"(",
"parameterName",
"==",
"null",
")",
"{",
"Parameter",
"parameter",
"=",
"getParameter",
"(",
")",
";",
"if",
"(",
"parameter",
".",
"isNamePresent",
"(",
")",
")",
"{",
"parameterName",
"=",... | Try looking for the parameter name in the compiled .class file.
@return | [
"Try",
"looking",
"for",
"the",
"parameter",
"name",
"in",
"the",
"compiled",
".",
"class",
"file",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/MethodParameter.java#L60-L69 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Messages.java | Messages.loadRegisteredMessageResources | private Map<String, Properties> loadRegisteredMessageResources() {
Map<String, Properties> internalMessages = loadRegisteredMessageResources("pippo/pippo-messages%s.properties");
Map<String, Properties> applicationMessages = loadRegisteredMessageResources("conf/messages%s.properties");
Map<Strin... | java | private Map<String, Properties> loadRegisteredMessageResources() {
Map<String, Properties> internalMessages = loadRegisteredMessageResources("pippo/pippo-messages%s.properties");
Map<String, Properties> applicationMessages = loadRegisteredMessageResources("conf/messages%s.properties");
Map<Strin... | [
"private",
"Map",
"<",
"String",
",",
"Properties",
">",
"loadRegisteredMessageResources",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Properties",
">",
"internalMessages",
"=",
"loadRegisteredMessageResources",
"(",
"\"pippo/pippo-messages%s.properties\"",
")",
";",
"... | Loads Pippo internal messages & application messages and returns the merger.
@return all messages | [
"Loads",
"Pippo",
"internal",
"messages",
"&",
"application",
"messages",
"and",
"returns",
"the",
"merger",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Messages.java#L236-L264 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Messages.java | Messages.loadRegisteredMessageResources | private Map<String, Properties> loadRegisteredMessageResources(String name) {
Map<String, Properties> messageResources = new TreeMap<>();
// Load default messages
Properties defaultMessages = loadMessages(String.format(name, ""));
if (defaultMessages == null) {
log.error("Co... | java | private Map<String, Properties> loadRegisteredMessageResources(String name) {
Map<String, Properties> messageResources = new TreeMap<>();
// Load default messages
Properties defaultMessages = loadMessages(String.format(name, ""));
if (defaultMessages == null) {
log.error("Co... | [
"private",
"Map",
"<",
"String",
",",
"Properties",
">",
"loadRegisteredMessageResources",
"(",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"Properties",
">",
"messageResources",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"// Load default messages",
... | Loads all registered message resources. | [
"Loads",
"all",
"registered",
"message",
"resources",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Messages.java#L269-L336 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Messages.java | Messages.loadMessages | private Properties loadMessages(String fileOrUrl) {
URL url = ClasspathUtils.locateOnClasspath(fileOrUrl);
if (url != null) {
try (InputStreamReader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) {
Properties messages = new Properties();
... | java | private Properties loadMessages(String fileOrUrl) {
URL url = ClasspathUtils.locateOnClasspath(fileOrUrl);
if (url != null) {
try (InputStreamReader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) {
Properties messages = new Properties();
... | [
"private",
"Properties",
"loadMessages",
"(",
"String",
"fileOrUrl",
")",
"{",
"URL",
"url",
"=",
"ClasspathUtils",
".",
"locateOnClasspath",
"(",
"fileOrUrl",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"try",
"(",
"InputStreamReader",
"reader",
"="... | Attempts to load a message resource. | [
"Attempts",
"to",
"load",
"a",
"message",
"resource",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Messages.java#L341-L354 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/FileItem.java | FileItem.getSubmittedFileName | public String getSubmittedFileName() {
// TODO this method also introduced in servlet 3.1 specification (delegate to part when I adopt servlet 3.1)
if (submittedFileName == null) {
String header = part.getHeader(HttpConstants.Header.CONTENT_DISPOSITION);
if (header == null) {
... | java | public String getSubmittedFileName() {
// TODO this method also introduced in servlet 3.1 specification (delegate to part when I adopt servlet 3.1)
if (submittedFileName == null) {
String header = part.getHeader(HttpConstants.Header.CONTENT_DISPOSITION);
if (header == null) {
... | [
"public",
"String",
"getSubmittedFileName",
"(",
")",
"{",
"// TODO this method also introduced in servlet 3.1 specification (delegate to part when I adopt servlet 3.1)",
"if",
"(",
"submittedFileName",
"==",
"null",
")",
"{",
"String",
"header",
"=",
"part",
".",
"getHeader",
... | Retrieves the filename specified by the client.
@return | [
"Retrieves",
"the",
"filename",
"specified",
"by",
"the",
"client",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/FileItem.java#L52-L69 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/FileItem.java | FileItem.write | public void write(File file) throws IOException {
try (InputStream inputStream = getInputStream()) {
IoUtils.copy(inputStream, file);
}
} | java | public void write(File file) throws IOException {
try (InputStream inputStream = getInputStream()) {
IoUtils.copy(inputStream, file);
}
} | [
"public",
"void",
"write",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"getInputStream",
"(",
")",
")",
"{",
"IoUtils",
".",
"copy",
"(",
"inputStream",
",",
"file",
")",
";",
"}",
"}"
] | Saves this file item to a given file on the server side.
@param file
@throws IOException | [
"Saves",
"this",
"file",
"item",
"to",
"a",
"given",
"file",
"on",
"the",
"server",
"side",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/FileItem.java#L119-L123 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-jcache/src/main/java/ro/pippo/session/jcache/JCacheSessionDataStorage.java | JCacheSessionDataStorage.create | protected Cache<String, SessionData> create(String name, long idleTime) {
return Caching
.getCachingProvider()
.getCacheManager()
.createCache(
name,
new MutableConfiguration<String, SessionData>()
... | java | protected Cache<String, SessionData> create(String name, long idleTime) {
return Caching
.getCachingProvider()
.getCacheManager()
.createCache(
name,
new MutableConfiguration<String, SessionData>()
... | [
"protected",
"Cache",
"<",
"String",
",",
"SessionData",
">",
"create",
"(",
"String",
"name",
",",
"long",
"idleTime",
")",
"{",
"return",
"Caching",
".",
"getCachingProvider",
"(",
")",
".",
"getCacheManager",
"(",
")",
".",
"createCache",
"(",
"name",
"... | Create a cache with name and expiry policy with idle time.
@param name name of cache
@param idleTime idle time in seconds
@return the cache with name and expiry policy with idle time | [
"Create",
"a",
"cache",
"with",
"name",
"and",
"expiry",
"policy",
"with",
"idle",
"time",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-jcache/src/main/java/ro/pippo/session/jcache/JCacheSessionDataStorage.java#L111-L124 | train |
citiususc/hipster | hipster-examples/src/main/java/es/usc/citius/hipster/examples/problem/NPuzzle.java | NPuzzle.getPrettyPath | public static String getPrettyPath(List<Puzzle> path, int size) {
// Print each row of all states
StringBuffer output = new StringBuffer();
for (int y = 0; y < size; y++) {
String row = "";
for (Puzzle state : path) {
int[][] board = state.getMatrixBoard()... | java | public static String getPrettyPath(List<Puzzle> path, int size) {
// Print each row of all states
StringBuffer output = new StringBuffer();
for (int y = 0; y < size; y++) {
String row = "";
for (Puzzle state : path) {
int[][] board = state.getMatrixBoard()... | [
"public",
"static",
"String",
"getPrettyPath",
"(",
"List",
"<",
"Puzzle",
">",
"path",
",",
"int",
"size",
")",
"{",
"// Print each row of all states",
"StringBuffer",
"output",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"y",
"=",
"0",
... | Prints a search path in a readable form.
@param path List of puzzle states of the path.
@param size Size of the puzzle state (8 for 8-puzzle)
@return String representing all the transitions from initial to goal. | [
"Prints",
"a",
"search",
"path",
"in",
"a",
"readable",
"form",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-examples/src/main/java/es/usc/citius/hipster/examples/problem/NPuzzle.java#L40-L57 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.read | public static Maze2D read(File file) throws IOException {
ArrayList<String> array = new ArrayList<String>();
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
array.add(line);
}
br.close();
... | java | public static Maze2D read(File file) throws IOException {
ArrayList<String> array = new ArrayList<String>();
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
array.add(line);
}
br.close();
... | [
"public",
"static",
"Maze2D",
"read",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"String",
">",
"array",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
... | Read a maze from a file in plain text.
@param file file with the plain ascii text.
@return a new Maze2D.
@throws IOException | [
"Read",
"a",
"maze",
"from",
"a",
"file",
"in",
"plain",
"text",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L209-L218 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.updateLocation | public void updateLocation(Point p, Symbol symbol) {
int row = p.y;
int column = p.x;
this.maze[row][column] = symbol.value();
} | java | public void updateLocation(Point p, Symbol symbol) {
int row = p.y;
int column = p.x;
this.maze[row][column] = symbol.value();
} | [
"public",
"void",
"updateLocation",
"(",
"Point",
"p",
",",
"Symbol",
"symbol",
")",
"{",
"int",
"row",
"=",
"p",
".",
"y",
";",
"int",
"column",
"=",
"p",
".",
"x",
";",
"this",
".",
"maze",
"[",
"row",
"]",
"[",
"column",
"]",
"=",
"symbol",
... | Replace a tile in the maze
@param p Point of the tile to be replaced
@param symbol New symbol | [
"Replace",
"a",
"tile",
"in",
"the",
"maze"
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L251-L255 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.updateRectangle | public void updateRectangle(Point a, Point b, Symbol symbol) {
int xfrom = (a.x < b.x) ? a.x : b.x;
int xto = (a.x > b.x) ? a.x : b.x;
int yfrom = (a.y < b.y) ? a.y : b.y;
int yto = (a.y > b.y) ? a.y : b.y;
for (int x = xfrom; x <= xto; x++) {
for (int y = yfrom; y <=... | java | public void updateRectangle(Point a, Point b, Symbol symbol) {
int xfrom = (a.x < b.x) ? a.x : b.x;
int xto = (a.x > b.x) ? a.x : b.x;
int yfrom = (a.y < b.y) ? a.y : b.y;
int yto = (a.y > b.y) ? a.y : b.y;
for (int x = xfrom; x <= xto; x++) {
for (int y = yfrom; y <=... | [
"public",
"void",
"updateRectangle",
"(",
"Point",
"a",
",",
"Point",
"b",
",",
"Symbol",
"symbol",
")",
"{",
"int",
"xfrom",
"=",
"(",
"a",
".",
"x",
"<",
"b",
".",
"x",
")",
"?",
"a",
".",
"x",
":",
"b",
".",
"x",
";",
"int",
"xto",
"=",
... | Replace all tiles inside the rectangle with the provided symbol.
@param a point a of the rectangle.
@param b point b of the rectangle.
@param symbol symbol to be inserted in each tile. | [
"Replace",
"all",
"tiles",
"inside",
"the",
"rectangle",
"with",
"the",
"provided",
"symbol",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L263-L273 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.putObstacleRectangle | public void putObstacleRectangle(Point a, Point b) {
updateRectangle(a, b, Symbol.OCCUPIED);
} | java | public void putObstacleRectangle(Point a, Point b) {
updateRectangle(a, b, Symbol.OCCUPIED);
} | [
"public",
"void",
"putObstacleRectangle",
"(",
"Point",
"a",
",",
"Point",
"b",
")",
"{",
"updateRectangle",
"(",
"a",
",",
"b",
",",
"Symbol",
".",
"OCCUPIED",
")",
";",
"}"
] | Fill a rectangle defined by points a and b with occupied tiles.
@param a point a of the rectangle.
@param b point b of the rectangle. | [
"Fill",
"a",
"rectangle",
"defined",
"by",
"points",
"a",
"and",
"b",
"with",
"occupied",
"tiles",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L296-L298 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.removeObstacleRectangle | public void removeObstacleRectangle(Point a, Point b) {
updateRectangle(a, b, Symbol.EMPTY);
} | java | public void removeObstacleRectangle(Point a, Point b) {
updateRectangle(a, b, Symbol.EMPTY);
} | [
"public",
"void",
"removeObstacleRectangle",
"(",
"Point",
"a",
",",
"Point",
"b",
")",
"{",
"updateRectangle",
"(",
"a",
",",
"b",
",",
"Symbol",
".",
"EMPTY",
")",
";",
"}"
] | Fill a rectangle defined by points a and b with empty tiles.
@param a point a of the rectangle.
@param b point b of the rectangle. | [
"Fill",
"a",
"rectangle",
"defined",
"by",
"points",
"a",
"and",
"b",
"with",
"empty",
"tiles",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L305-L307 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.getReplacedMazeString | public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
String[] stringMaze = toStringArray();
for (Map<Point, Character> replacement : replacements) {
for (Point p : replacement.keySet()) {
int row = p.y;
int column = p.x;
... | java | public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
String[] stringMaze = toStringArray();
for (Map<Point, Character> replacement : replacements) {
for (Point p : replacement.keySet()) {
int row = p.y;
int column = p.x;
... | [
"public",
"String",
"getReplacedMazeString",
"(",
"List",
"<",
"Map",
"<",
"Point",
",",
"Character",
">",
">",
"replacements",
")",
"{",
"String",
"[",
"]",
"stringMaze",
"=",
"toStringArray",
"(",
")",
";",
"for",
"(",
"Map",
"<",
"Point",
",",
"Charac... | Generates a string representation of this maze but replacing all the indicated
points with the characters provided.
@param replacements list with maps of point-character replacements.
@return String representation of the maze with the replacements. | [
"Generates",
"a",
"string",
"representation",
"of",
"this",
"maze",
"but",
"replacing",
"all",
"the",
"indicated",
"points",
"with",
"the",
"characters",
"provided",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L315-L332 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.getStringMazeFilled | public String getStringMazeFilled(Collection<Point> points, char symbol) {
Map<Point, Character> replacements = new HashMap<Point, Character>();
for (Point p : points) {
replacements.put(p, symbol);
}
return getReplacedMazeString(Collections.singletonList(replacements));
... | java | public String getStringMazeFilled(Collection<Point> points, char symbol) {
Map<Point, Character> replacements = new HashMap<Point, Character>();
for (Point p : points) {
replacements.put(p, symbol);
}
return getReplacedMazeString(Collections.singletonList(replacements));
... | [
"public",
"String",
"getStringMazeFilled",
"(",
"Collection",
"<",
"Point",
">",
"points",
",",
"char",
"symbol",
")",
"{",
"Map",
"<",
"Point",
",",
"Character",
">",
"replacements",
"=",
"new",
"HashMap",
"<",
"Point",
",",
"Character",
">",
"(",
")",
... | Generates a string representation of this maze, with the indicated points replaced
with the symbol provided.
@param points points of the maze.
@param symbol symbol to be inserted in each point.
@return the string representation of the maze with the points changed. | [
"Generates",
"a",
"string",
"representation",
"of",
"this",
"maze",
"with",
"the",
"indicated",
"points",
"replaced",
"with",
"the",
"symbol",
"provided",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L341-L347 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.pointInBounds | public boolean pointInBounds(Point loc) {
return loc.x >= 0 && loc.x < this.columns && loc.y >= 0 && loc.y < this.rows;
} | java | public boolean pointInBounds(Point loc) {
return loc.x >= 0 && loc.x < this.columns && loc.y >= 0 && loc.y < this.rows;
} | [
"public",
"boolean",
"pointInBounds",
"(",
"Point",
"loc",
")",
"{",
"return",
"loc",
".",
"x",
">=",
"0",
"&&",
"loc",
".",
"x",
"<",
"this",
".",
"columns",
"&&",
"loc",
".",
"y",
">=",
"0",
"&&",
"loc",
".",
"y",
"<",
"this",
".",
"rows",
";... | Check if the provided point is in the maze bounds or outside.
@param loc point to be tested.
@return true if the point is in the maze. | [
"Check",
"if",
"the",
"provided",
"point",
"is",
"in",
"the",
"maze",
"bounds",
"or",
"outside",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L373-L375 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.validLocationsFrom | public Collection<Point> validLocationsFrom(Point loc) {
Collection<Point> validMoves = new HashSet<Point>();
// Check for all valid movements
for (int row = -1; row <= 1; row++) {
for (int column = -1; column <= 1; column++) {
try {
if (isFree(new... | java | public Collection<Point> validLocationsFrom(Point loc) {
Collection<Point> validMoves = new HashSet<Point>();
// Check for all valid movements
for (int row = -1; row <= 1; row++) {
for (int column = -1; column <= 1; column++) {
try {
if (isFree(new... | [
"public",
"Collection",
"<",
"Point",
">",
"validLocationsFrom",
"(",
"Point",
"loc",
")",
"{",
"Collection",
"<",
"Point",
">",
"validMoves",
"=",
"new",
"HashSet",
"<",
"Point",
">",
"(",
")",
";",
"// Check for all valid movements",
"for",
"(",
"int",
"ro... | Return all neighbor empty points from a specific location point.
@param loc source point
@return collection of empty neighbor points. | [
"Return",
"all",
"neighbor",
"empty",
"points",
"from",
"a",
"specific",
"location",
"point",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L382-L399 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.diff | public Set<Point> diff(Maze2D to) {
char[][] maze1 = this.getMazeCharArray();
char[][] maze2 = to.getMazeCharArray();
Set<Point> differentLocations = new HashSet<Point>();
for (int row = 0; row < this.rows; row++) {
for (int column = 0; column < this.columns; column++) {
... | java | public Set<Point> diff(Maze2D to) {
char[][] maze1 = this.getMazeCharArray();
char[][] maze2 = to.getMazeCharArray();
Set<Point> differentLocations = new HashSet<Point>();
for (int row = 0; row < this.rows; row++) {
for (int column = 0; column < this.columns; column++) {
... | [
"public",
"Set",
"<",
"Point",
">",
"diff",
"(",
"Maze2D",
"to",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"maze1",
"=",
"this",
".",
"getMazeCharArray",
"(",
")",
";",
"char",
"[",
"]",
"[",
"]",
"maze2",
"=",
"to",
".",
"getMazeCharArray",
"(",
")"... | Returns a set of points that are different with respect this maze.
Both mazes must have same size.
@param to maze to be compared.
@return set of different points. | [
"Returns",
"a",
"set",
"of",
"points",
"that",
"are",
"different",
"with",
"respect",
"this",
"maze",
".",
"Both",
"mazes",
"must",
"have",
"same",
"size",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L430-L442 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.empty | public static Maze2D empty(int size) {
char[][] maze = new char[size][size];
for (int i = 0; i < size; i++) {
Arrays.fill(maze[i], Symbol.EMPTY.value());
}
maze[0][0] = Symbol.START.value();
maze[size][size] = Symbol.GOAL.value();
return new Maze2D(maze);
... | java | public static Maze2D empty(int size) {
char[][] maze = new char[size][size];
for (int i = 0; i < size; i++) {
Arrays.fill(maze[i], Symbol.EMPTY.value());
}
maze[0][0] = Symbol.START.value();
maze[size][size] = Symbol.GOAL.value();
return new Maze2D(maze);
... | [
"public",
"static",
"Maze2D",
"empty",
"(",
"int",
"size",
")",
"{",
"char",
"[",
"]",
"[",
"]",
"maze",
"=",
"new",
"char",
"[",
"size",
"]",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
"... | Generate an empty squared maze of the indicated size.
@param size maze size.
@return empty maze. | [
"Generate",
"an",
"empty",
"squared",
"maze",
"of",
"the",
"indicated",
"size",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L473-L481 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java | FibonacciHeap.enqueue | public Entry<T> enqueue(T value, double priority) {
checkPriority(priority);
/* Create the entry object, which is a circularly-linked list of length
* one.
*/
Entry<T> result = new Entry<T>(value, priority);
/* Merge this singleton list with the tree list. */
... | java | public Entry<T> enqueue(T value, double priority) {
checkPriority(priority);
/* Create the entry object, which is a circularly-linked list of length
* one.
*/
Entry<T> result = new Entry<T>(value, priority);
/* Merge this singleton list with the tree list. */
... | [
"public",
"Entry",
"<",
"T",
">",
"enqueue",
"(",
"T",
"value",
",",
"double",
"priority",
")",
"{",
"checkPriority",
"(",
"priority",
")",
";",
"/* Create the entry object, which is a circularly-linked list of length\n * one.\n */",
"Entry",
"<",
"T",
"... | Inserts the specified element into the Fibonacci heap with the specified
priority. Its priority must be a valid double, so you cannot set the
priority to NaN.
@param value The value to insert.
@param priority Its priority, which must be valid.
@return An Entry representing that element in the tree. | [
"Inserts",
"the",
"specified",
"element",
"into",
"the",
"Fibonacci",
"heap",
"with",
"the",
"specified",
"priority",
".",
"Its",
"priority",
"must",
"be",
"a",
"valid",
"double",
"so",
"you",
"cannot",
"set",
"the",
"priority",
"to",
"NaN",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L160-L176 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java | FibonacciHeap.merge | public static <T> FibonacciHeap<T> merge(FibonacciHeap<T> one, FibonacciHeap<T> two) {
/* Create a new FibonacciHeap to hold the result. */
FibonacciHeap<T> result = new FibonacciHeap<T>();
/* Merge the two Fibonacci heap root lists together. This helper function
* also computes the m... | java | public static <T> FibonacciHeap<T> merge(FibonacciHeap<T> one, FibonacciHeap<T> two) {
/* Create a new FibonacciHeap to hold the result. */
FibonacciHeap<T> result = new FibonacciHeap<T>();
/* Merge the two Fibonacci heap root lists together. This helper function
* also computes the m... | [
"public",
"static",
"<",
"T",
">",
"FibonacciHeap",
"<",
"T",
">",
"merge",
"(",
"FibonacciHeap",
"<",
"T",
">",
"one",
",",
"FibonacciHeap",
"<",
"T",
">",
"two",
")",
"{",
"/* Create a new FibonacciHeap to hold the result. */",
"FibonacciHeap",
"<",
"T",
">"... | Given two Fibonacci heaps, returns a new Fibonacci heap that contains
all of the elements of the two heaps. Each of the input heaps is
destructively modified by having all its elements removed. You can
continue to use those heaps, but be aware that they will be empty
after this call completes.
@param one The first F... | [
"Given",
"two",
"Fibonacci",
"heaps",
"returns",
"a",
"new",
"Fibonacci",
"heap",
"that",
"contains",
"all",
"of",
"the",
"elements",
"of",
"the",
"two",
"heaps",
".",
"Each",
"of",
"the",
"input",
"heaps",
"is",
"destructively",
"modified",
"by",
"having",
... | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L222-L242 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java | FibonacciHeap.dequeueMin | public Entry<T> dequeueMin() {
/* Check for whether we're empty. */
if (isEmpty())
throw new NoSuchElementException("Heap is empty.");
/* Otherwise, we're about to lose an element, so decrement the number of
* entries in this heap.
*/
--mSize;
/* G... | java | public Entry<T> dequeueMin() {
/* Check for whether we're empty. */
if (isEmpty())
throw new NoSuchElementException("Heap is empty.");
/* Otherwise, we're about to lose an element, so decrement the number of
* entries in this heap.
*/
--mSize;
/* G... | [
"public",
"Entry",
"<",
"T",
">",
"dequeueMin",
"(",
")",
"{",
"/* Check for whether we're empty. */",
"if",
"(",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"NoSuchElementException",
"(",
"\"Heap is empty.\"",
")",
";",
"/* Otherwise, we're about to lose an element, so d... | Dequeues and returns the minimum element of the Fibonacci heap. If the
heap is empty, this throws a NoSuchElementException.
@return The smallest element of the Fibonacci heap.
@throws java.util.NoSuchElementException If the heap is empty. | [
"Dequeues",
"and",
"returns",
"the",
"minimum",
"element",
"of",
"the",
"Fibonacci",
"heap",
".",
"If",
"the",
"heap",
"is",
"empty",
"this",
"throws",
"a",
"NoSuchElementException",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L251-L388 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java | FibonacciHeap.decreaseKeyUnchecked | private void decreaseKeyUnchecked(Entry<T> entry, double priority) {
/* First, change the node's priority. */
entry.mPriority = priority;
/* If the node no longer has a higher priority than its parent, cut it.
* Note that this also means that if we try to run a delete operation
... | java | private void decreaseKeyUnchecked(Entry<T> entry, double priority) {
/* First, change the node's priority. */
entry.mPriority = priority;
/* If the node no longer has a higher priority than its parent, cut it.
* Note that this also means that if we try to run a delete operation
... | [
"private",
"void",
"decreaseKeyUnchecked",
"(",
"Entry",
"<",
"T",
">",
"entry",
",",
"double",
"priority",
")",
"{",
"/* First, change the node's priority. */",
"entry",
".",
"mPriority",
"=",
"priority",
";",
"/* If the node no longer has a higher priority than its parent... | Decreases the key of a node in the tree without doing any checking to ensure
that the new priority is valid.
@param entry The node whose key should be decreased.
@param priority The node's new priority. | [
"Decreases",
"the",
"key",
"of",
"a",
"node",
"in",
"the",
"tree",
"without",
"doing",
"any",
"checking",
"to",
"ensure",
"that",
"the",
"new",
"priority",
"is",
"valid",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L520-L538 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java | FibonacciHeap.cutNode | private void cutNode(Entry<T> entry) {
/* Begin by clearing the node's mark, since we just cut it. */
entry.mIsMarked = false;
/* Base case: If the node has no parent, we're done. */
if (entry.mParent == null) return;
/* Rewire the node's siblings around it, if it has any sibli... | java | private void cutNode(Entry<T> entry) {
/* Begin by clearing the node's mark, since we just cut it. */
entry.mIsMarked = false;
/* Base case: If the node has no parent, we're done. */
if (entry.mParent == null) return;
/* Rewire the node's siblings around it, if it has any sibli... | [
"private",
"void",
"cutNode",
"(",
"Entry",
"<",
"T",
">",
"entry",
")",
"{",
"/* Begin by clearing the node's mark, since we just cut it. */",
"entry",
".",
"mIsMarked",
"=",
"false",
";",
"/* Base case: If the node has no parent, we're done. */",
"if",
"(",
"entry",
"."... | Cuts a node from its parent. If the parent was already marked, recursively
cuts that node from its parent as well.
@param entry The node to cut from its parent. | [
"Cuts",
"a",
"node",
"from",
"its",
"parent",
".",
"If",
"the",
"parent",
"was",
"already",
"marked",
"recursively",
"cuts",
"that",
"node",
"from",
"its",
"parent",
"as",
"well",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L546-L595 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ScalarOperation.java | ScalarOperation.doubleMultiplicationOp | public static ScalarOperation<Double> doubleMultiplicationOp() {
return new ScalarOperation<Double>(new ScalarFunction<Double>() {
@Override
public Double scale(Double a, double b) {
return a * b;
}
}, 1d);
} | java | public static ScalarOperation<Double> doubleMultiplicationOp() {
return new ScalarOperation<Double>(new ScalarFunction<Double>() {
@Override
public Double scale(Double a, double b) {
return a * b;
}
}, 1d);
} | [
"public",
"static",
"ScalarOperation",
"<",
"Double",
">",
"doubleMultiplicationOp",
"(",
")",
"{",
"return",
"new",
"ScalarOperation",
"<",
"Double",
">",
"(",
"new",
"ScalarFunction",
"<",
"Double",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Double",
... | Builds the scaling operation for Doubles, that is the multiplying
operation for the factor.
@return {@link ScalarOperation} for Double | [
"Builds",
"the",
"scaling",
"operation",
"for",
"Doubles",
"that",
"is",
"the",
"multiplying",
"operation",
"for",
"the",
"factor",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ScalarOperation.java#L53-L62 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java | ADStarNodeExpander.expandTransitionsChanged | public Iterable<N> expandTransitionsChanged(N begin, Iterable<Transition<A, S>> transitions){
Collection<N> nodes = new ArrayList<N>();
for (Transition<A, S> transition : transitions) {
S state = transition.getState();
//if v != start
if (!state.equals(begin.state()))... | java | public Iterable<N> expandTransitionsChanged(N begin, Iterable<Transition<A, S>> transitions){
Collection<N> nodes = new ArrayList<N>();
for (Transition<A, S> transition : transitions) {
S state = transition.getState();
//if v != start
if (!state.equals(begin.state()))... | [
"public",
"Iterable",
"<",
"N",
">",
"expandTransitionsChanged",
"(",
"N",
"begin",
",",
"Iterable",
"<",
"Transition",
"<",
"A",
",",
"S",
">",
">",
"transitions",
")",
"{",
"Collection",
"<",
"N",
">",
"nodes",
"=",
"new",
"ArrayList",
"<",
"N",
">",... | Generates an iterable list of nodes, updated as inconsistent after applying the cost changes in the
list of transitions passed as parameter.
@param begin beginning state of the search
@param transitions list of transitions with changed costs
@return list of updated nodes | [
"Generates",
"an",
"iterable",
"list",
"of",
"nodes",
"updated",
"as",
"inconsistent",
"after",
"applying",
"the",
"cost",
"changes",
"in",
"the",
"list",
"of",
"transitions",
"passed",
"as",
"parameter",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L135-L154 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java | ADStarNodeExpander.predecessorsMap | private Map<Transition<A, S>, N> predecessorsMap(S current){
//Map<Transition, Node> containing predecessors relations
Map<Transition<A, S>, N> mapPredecessors = new HashMap<Transition<A, S>, N>();
//Fill with non-null pairs of <Transition, Node>
for (Transition<A, S> predecessor : prede... | java | private Map<Transition<A, S>, N> predecessorsMap(S current){
//Map<Transition, Node> containing predecessors relations
Map<Transition<A, S>, N> mapPredecessors = new HashMap<Transition<A, S>, N>();
//Fill with non-null pairs of <Transition, Node>
for (Transition<A, S> predecessor : prede... | [
"private",
"Map",
"<",
"Transition",
"<",
"A",
",",
"S",
">",
",",
"N",
">",
"predecessorsMap",
"(",
"S",
"current",
")",
"{",
"//Map<Transition, Node> containing predecessors relations",
"Map",
"<",
"Transition",
"<",
"A",
",",
"S",
">",
",",
"N",
">",
"m... | Retrieves a map with the predecessors states and the node associated
to each predecessor state.
@param current current state to calculate predecessors of
@return map pairs of <state, node> with the visited predecessors of the state | [
"Retrieves",
"a",
"map",
"with",
"the",
"predecessors",
"states",
"and",
"the",
"node",
"associated",
"to",
"each",
"predecessor",
"state",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L221-L232 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java | ADStarNodeExpander.makeNode | public N makeNode(N from, Transition<A, S> transition){
return nodeFactory.makeNode(from, transition);
} | java | public N makeNode(N from, Transition<A, S> transition){
return nodeFactory.makeNode(from, transition);
} | [
"public",
"N",
"makeNode",
"(",
"N",
"from",
",",
"Transition",
"<",
"A",
",",
"S",
">",
"transition",
")",
"{",
"return",
"nodeFactory",
".",
"makeNode",
"(",
"from",
",",
"transition",
")",
";",
"}"
] | Creates a new node from the parent and a transition, calling the node factory.
@param from parent node
@param transition transition between the parent and the new node
@return new node created by the node factory | [
"Creates",
"a",
"new",
"node",
"from",
"the",
"parent",
"and",
"a",
"transition",
"calling",
"the",
"node",
"factory",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L287-L289 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java | ADStarNodeExpander.updateKey | public void updateKey(N node){
node.getKey().update(node.getG(), node.getV(), heuristicFunction.estimate(node.state()), epsilon, add, scale);
} | java | public void updateKey(N node){
node.getKey().update(node.getG(), node.getV(), heuristicFunction.estimate(node.state()), epsilon, add, scale);
} | [
"public",
"void",
"updateKey",
"(",
"N",
"node",
")",
"{",
"node",
".",
"getKey",
"(",
")",
".",
"update",
"(",
"node",
".",
"getG",
"(",
")",
",",
"node",
".",
"getV",
"(",
")",
",",
"heuristicFunction",
".",
"estimate",
"(",
"node",
".",
"state",... | Updating the priority of a node is required when changing the value of Epsilon. | [
"Updating",
"the",
"priority",
"of",
"a",
"node",
"is",
"required",
"when",
"changing",
"the",
"value",
"of",
"Epsilon",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L294-L296 | train |
citiususc/hipster | hipster-examples/src/main/java/es/usc/citius/hipster/examples/BlueprintsGraphMultiobjectiveSearch.java | BlueprintsGraphMultiobjectiveSearch.buildGraph | private static Graph buildGraph() {
Graph g = new TinkerGraph();
//add vertices
Vertex v1 = g.addVertex("v1");
Vertex v2 = g.addVertex("v2");
Vertex v3 = g.addVertex("v3");
Vertex v4 = g.addVertex("v4");
Vertex v5 = g.addVertex("v5");
Vertex v6 = g.addVert... | java | private static Graph buildGraph() {
Graph g = new TinkerGraph();
//add vertices
Vertex v1 = g.addVertex("v1");
Vertex v2 = g.addVertex("v2");
Vertex v3 = g.addVertex("v3");
Vertex v4 = g.addVertex("v4");
Vertex v5 = g.addVertex("v5");
Vertex v6 = g.addVert... | [
"private",
"static",
"Graph",
"buildGraph",
"(",
")",
"{",
"Graph",
"g",
"=",
"new",
"TinkerGraph",
"(",
")",
";",
"//add vertices",
"Vertex",
"v1",
"=",
"g",
".",
"addVertex",
"(",
"\"v1\"",
")",
";",
"Vertex",
"v2",
"=",
"g",
".",
"addVertex",
"(",
... | Build an example graph to execute in this example.
@return example graph | [
"Build",
"an",
"example",
"graph",
"to",
"execute",
"in",
"this",
"example",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-examples/src/main/java/es/usc/citius/hipster/examples/BlueprintsGraphMultiobjectiveSearch.java#L98-L146 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/Transition.java | Transition.create | public static <A,S> Transition<A,S> create(S fromState, A action, S toState){
return new Transition<A, S>(fromState, action, toState);
} | java | public static <A,S> Transition<A,S> create(S fromState, A action, S toState){
return new Transition<A, S>(fromState, action, toState);
} | [
"public",
"static",
"<",
"A",
",",
"S",
">",
"Transition",
"<",
"A",
",",
"S",
">",
"create",
"(",
"S",
"fromState",
",",
"A",
"action",
",",
"S",
"toState",
")",
"{",
"return",
"new",
"Transition",
"<",
"A",
",",
"S",
">",
"(",
"fromState",
",",... | Instantiates a transition specifying an action, the origin and
destination states.
@param fromState state origin of the transition
@param action action associated to this transition
@param toState state destination of the transition
@param <A> type of the actions
@param <S> type of the state
@return instance of a tran... | [
"Instantiates",
"a",
"transition",
"specifying",
"an",
"action",
"the",
"origin",
"and",
"destination",
"states",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/Transition.java#L81-L83 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/Transition.java | Transition.create | public static <S> Transition<Void,S> create(S fromState, S toState){
return new Transition<Void, S>(fromState, null, toState);
} | java | public static <S> Transition<Void,S> create(S fromState, S toState){
return new Transition<Void, S>(fromState, null, toState);
} | [
"public",
"static",
"<",
"S",
">",
"Transition",
"<",
"Void",
",",
"S",
">",
"create",
"(",
"S",
"fromState",
",",
"S",
"toState",
")",
"{",
"return",
"new",
"Transition",
"<",
"Void",
",",
"S",
">",
"(",
"fromState",
",",
"null",
",",
"toState",
"... | Offers a way to instantiate a transition without specifying an action but
only the origin and destination states.
@param fromState state origin of the transition
@param toState state destination of the transition
@param <S> type of the state
@return instance of a transition with an origin and destination, but without ... | [
"Offers",
"a",
"way",
"to",
"instantiate",
"a",
"transition",
"without",
"specifying",
"an",
"action",
"but",
"only",
"the",
"origin",
"and",
"destination",
"states",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/Transition.java#L94-L96 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/MazeSearch.java | MazeSearch.printSearch | public static void printSearch(Iterator<? extends Node<?,Point,?>> it, Maze2D maze) throws InterruptedException {
Collection<Point> explored = new HashSet<Point>();
while (it.hasNext()) {
Node<?,Point,?> currentNode = it.next();
if (currentNode.previousNode() != null) {
... | java | public static void printSearch(Iterator<? extends Node<?,Point,?>> it, Maze2D maze) throws InterruptedException {
Collection<Point> explored = new HashSet<Point>();
while (it.hasNext()) {
Node<?,Point,?> currentNode = it.next();
if (currentNode.previousNode() != null) {
... | [
"public",
"static",
"void",
"printSearch",
"(",
"Iterator",
"<",
"?",
"extends",
"Node",
"<",
"?",
",",
"Point",
",",
"?",
">",
">",
"it",
",",
"Maze2D",
"maze",
")",
"throws",
"InterruptedException",
"{",
"Collection",
"<",
"Point",
">",
"explored",
"="... | Prints the maze and the result of the current iteration until the solution is found.
@param it search iterator
@param maze maze to perform the search
@throws InterruptedException sleep exception between iterations | [
"Prints",
"the",
"maze",
"and",
"the",
"result",
"of",
"the",
"current",
"iteration",
"until",
"the",
"solution",
"is",
"found",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/MazeSearch.java#L94-L112 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/MazeSearch.java | MazeSearch.getMazeStringSolution | public static String getMazeStringSolution(Maze2D maze, Collection<Point> explored, Collection<Point> path) {
List<Map<Point, Character>> replacements = new ArrayList<Map<Point, Character>>();
Map<Point, Character> replacement = new HashMap<Point, Character>();
for (Point p : explored) {
... | java | public static String getMazeStringSolution(Maze2D maze, Collection<Point> explored, Collection<Point> path) {
List<Map<Point, Character>> replacements = new ArrayList<Map<Point, Character>>();
Map<Point, Character> replacement = new HashMap<Point, Character>();
for (Point p : explored) {
... | [
"public",
"static",
"String",
"getMazeStringSolution",
"(",
"Maze2D",
"maze",
",",
"Collection",
"<",
"Point",
">",
"explored",
",",
"Collection",
"<",
"Point",
">",
"path",
")",
"{",
"List",
"<",
"Map",
"<",
"Point",
",",
"Character",
">",
">",
"replaceme... | Returns the maze passed as parameter but replacing some characters to print the path found in the
current iteration.
@param maze used to search
@param explored collection of the points of the maze explored by the iterator
@param path current path found by the iterator
@return maze with the characters of the explored p... | [
"Returns",
"the",
"maze",
"passed",
"as",
"parameter",
"but",
"replacing",
"some",
"characters",
"to",
"print",
"the",
"path",
"found",
"in",
"the",
"current",
"iteration",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/MazeSearch.java#L134-L147 | train |
citiususc/hipster | hipster-examples/src/main/java/es/usc/citius/hipster/examples/SimpleEightPuzzleExample.java | SimpleEightPuzzleExample.main | public static void main(String[] args){
/*
SearchProblem is the structure used by Hipster to store all the
information about the search query, like: start, goals, transition function,
cost function, etc. Once created it is used to instantiate the search
iterators... | java | public static void main(String[] args){
/*
SearchProblem is the structure used by Hipster to store all the
information about the search query, like: start, goals, transition function,
cost function, etc. Once created it is used to instantiate the search
iterators... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"/*\n SearchProblem is the structure used by Hipster to store all the\n information about the search query, like: start, goals, transition function,\n cost function, etc. Once create... | Possible actions of our problem | [
"Possible",
"actions",
"of",
"our",
"problem"
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-examples/src/main/java/es/usc/citius/hipster/examples/SimpleEightPuzzleExample.java#L61-L147 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/graph/HashBasedHipsterGraph.java | HashBasedHipsterGraph.edges | @Override
public Iterable<GraphEdge<V, E>> edges() {
return F.map(vedges(), new Function<Map.Entry<V, GraphEdge<V, E>>, GraphEdge<V, E>>() {
@Override
public GraphEdge<V, E> apply(Map.Entry<V, GraphEdge<V, E>> entry) {
return entry.getValue();
}
})... | java | @Override
public Iterable<GraphEdge<V, E>> edges() {
return F.map(vedges(), new Function<Map.Entry<V, GraphEdge<V, E>>, GraphEdge<V, E>>() {
@Override
public GraphEdge<V, E> apply(Map.Entry<V, GraphEdge<V, E>> entry) {
return entry.getValue();
}
})... | [
"@",
"Override",
"public",
"Iterable",
"<",
"GraphEdge",
"<",
"V",
",",
"E",
">",
">",
"edges",
"(",
")",
"{",
"return",
"F",
".",
"map",
"(",
"vedges",
"(",
")",
",",
"new",
"Function",
"<",
"Map",
".",
"Entry",
"<",
"V",
",",
"GraphEdge",
"<",
... | Returns a list of the edges in the graph.
@return edges of the graph. | [
"Returns",
"a",
"list",
"of",
"the",
"edges",
"in",
"the",
"graph",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/graph/HashBasedHipsterGraph.java#L142-L150 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Algorithm.java | Algorithm.search | public SearchResult search(final S goalState){
return search(new Predicate<N>() {
@Override
public boolean apply(N n) {
if (goalState != null) {
return n.state().equals(goalState);
}
return false;
}
}... | java | public SearchResult search(final S goalState){
return search(new Predicate<N>() {
@Override
public boolean apply(N n) {
if (goalState != null) {
return n.state().equals(goalState);
}
return false;
}
}... | [
"public",
"SearchResult",
"search",
"(",
"final",
"S",
"goalState",
")",
"{",
"return",
"search",
"(",
"new",
"Predicate",
"<",
"N",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"N",
"n",
")",
"{",
"if",
"(",
"goalState",
"... | Run the algorithm until the goal is found or no more states are
available.
@return SearchResult with the information of the search | [
"Run",
"the",
"algorithm",
"until",
"the",
"goal",
"is",
"found",
"or",
"no",
"more",
"states",
"are",
"available",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Algorithm.java#L127-L137 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Algorithm.java | Algorithm.search | public SearchResult search(Predicate<N> condition){
int iteration = 0;
Iterator<N> it = iterator();
long begin = System.currentTimeMillis();
N currentNode = null;
while(it.hasNext()){
iteration++;
currentNode = it.next();
if (condition.apply(cu... | java | public SearchResult search(Predicate<N> condition){
int iteration = 0;
Iterator<N> it = iterator();
long begin = System.currentTimeMillis();
N currentNode = null;
while(it.hasNext()){
iteration++;
currentNode = it.next();
if (condition.apply(cu... | [
"public",
"SearchResult",
"search",
"(",
"Predicate",
"<",
"N",
">",
"condition",
")",
"{",
"int",
"iteration",
"=",
"0",
";",
"Iterator",
"<",
"N",
">",
"it",
"=",
"iterator",
"(",
")",
";",
"long",
"begin",
"=",
"System",
".",
"currentTimeMillis",
"(... | Executes the search algorithm until the predicate condition is
satisfied or there are no more nodes to explore.
@param condition predicate with the boolean condition.
@return {@link es.usc.citius.hipster.algorithm.Algorithm.SearchResult with information about the search} | [
"Executes",
"the",
"search",
"algorithm",
"until",
"the",
"predicate",
"condition",
"is",
"satisfied",
"or",
"there",
"are",
"no",
"more",
"nodes",
"to",
"explore",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Algorithm.java#L147-L162 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Algorithm.java | Algorithm.recoverStatePath | public static <S, N extends Node<?,S,N>> List<S> recoverStatePath(N node){
List<S> states = new LinkedList<S>();
for(N n : node.path()){
states.add(n.state());
}
return states;
} | java | public static <S, N extends Node<?,S,N>> List<S> recoverStatePath(N node){
List<S> states = new LinkedList<S>();
for(N n : node.path()){
states.add(n.state());
}
return states;
} | [
"public",
"static",
"<",
"S",
",",
"N",
"extends",
"Node",
"<",
"?",
",",
"S",
",",
"N",
">",
">",
"List",
"<",
"S",
">",
"recoverStatePath",
"(",
"N",
"node",
")",
"{",
"List",
"<",
"S",
">",
"states",
"=",
"new",
"LinkedList",
"<",
"S",
">",
... | Returns a path with all the states of the path.
@param <S> type of the state.
@param <N> type of the node.
@return a list with the states of the path, from the initial state
to the state of the provided node ({@link es.usc.citius.hipster.model.Node#state()}). | [
"Returns",
"a",
"path",
"with",
"all",
"the",
"states",
"of",
"the",
"path",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Algorithm.java#L198-L204 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createBellmanFord | public static <A, S, C extends Comparable<C>, N extends CostNode<A, S, C, N>> BellmanFord<A, S, C, N> createBellmanFord(
SearchProblem<A, S, N> components) {
return new BellmanFord<A, S, C, N>(components.getInitialNode(), components.getExpander());
} | java | public static <A, S, C extends Comparable<C>, N extends CostNode<A, S, C, N>> BellmanFord<A, S, C, N> createBellmanFord(
SearchProblem<A, S, N> components) {
return new BellmanFord<A, S, C, N>(components.getInitialNode(), components.getExpander());
} | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"C",
"extends",
"Comparable",
"<",
"C",
">",
",",
"N",
"extends",
"CostNode",
"<",
"A",
",",
"S",
",",
"C",
",",
"N",
">",
">",
"BellmanFord",
"<",
"A",
",",
"S",
",",
"C",
",",
"N",
">",
"createBe... | Instantiates a Bellman Ford algorithm for a problem definition.
@param components
search problem definition with the components of the algorithm
@param <A>
type of the actions
@param <S>
type of the states
@param <C>
type of the cost
@param <N>
type of the nodes
@return instance of {@link es.usc.citius.hipster.algorit... | [
"Instantiates",
"a",
"Bellman",
"Ford",
"algorithm",
"for",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L118-L121 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createBreadthFirstSearch | public static <A, S, N extends Node<A, S, N>> BreadthFirstSearch<A, S, N> createBreadthFirstSearch(
SearchProblem<A, S, N> components) {
return new BreadthFirstSearch<A, S, N>(components.getInitialNode(), components.getExpander());
} | java | public static <A, S, N extends Node<A, S, N>> BreadthFirstSearch<A, S, N> createBreadthFirstSearch(
SearchProblem<A, S, N> components) {
return new BreadthFirstSearch<A, S, N>(components.getInitialNode(), components.getExpander());
} | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"N",
"extends",
"Node",
"<",
"A",
",",
"S",
",",
"N",
">",
">",
"BreadthFirstSearch",
"<",
"A",
",",
"S",
",",
"N",
">",
"createBreadthFirstSearch",
"(",
"SearchProblem",
"<",
"A",
",",
"S",
",",
"N",
... | Instantiates Breadth First Search algorithm for a problem definition.
@param components
search problem definition with the components of the algorithm
@param <A>
type of the actions
@param <S>
type of the states
@param <N>
type of the nodes
@return instance of
{@link es.usc.citius.hipster.algorithm.BreadthFirstSearch}... | [
"Instantiates",
"Breadth",
"First",
"Search",
"algorithm",
"for",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L138-L141 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createDepthFirstSearch | public static <A, S, N extends Node<A, S, N>> DepthFirstSearch<A, S, N> createDepthFirstSearch(
SearchProblem<A, S, N> components) {
return new DepthFirstSearch<A, S, N>(components.getInitialNode(), components.getExpander());
} | java | public static <A, S, N extends Node<A, S, N>> DepthFirstSearch<A, S, N> createDepthFirstSearch(
SearchProblem<A, S, N> components) {
return new DepthFirstSearch<A, S, N>(components.getInitialNode(), components.getExpander());
} | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"N",
"extends",
"Node",
"<",
"A",
",",
"S",
",",
"N",
">",
">",
"DepthFirstSearch",
"<",
"A",
",",
"S",
",",
"N",
">",
"createDepthFirstSearch",
"(",
"SearchProblem",
"<",
"A",
",",
"S",
",",
"N",
">",... | Instantiates Depth First Search algorithm for a problem definition.
@param components
search problem definition with the components of the algorithm
@param <A>
type of the actions
@param <S>
type of the states
@param <N>
type of the nodes
@return instance of
{@link es.usc.citius.hipster.algorithm.DepthFirstSearch} for... | [
"Instantiates",
"Depth",
"First",
"Search",
"algorithm",
"for",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L158-L161 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createDepthLimitedSearch | public static <A, S, N extends Node<A, S, N>> DepthLimitedSearch<A, S, N> createDepthLimitedSearch(
SearchProblem<A, S, N> components, int depth) {
return new DepthLimitedSearch<A, S, N>(components.getInitialNode(), components.getFinalNode(),
components.getExpander(), depth);
} | java | public static <A, S, N extends Node<A, S, N>> DepthLimitedSearch<A, S, N> createDepthLimitedSearch(
SearchProblem<A, S, N> components, int depth) {
return new DepthLimitedSearch<A, S, N>(components.getInitialNode(), components.getFinalNode(),
components.getExpander(), depth);
} | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"N",
"extends",
"Node",
"<",
"A",
",",
"S",
",",
"N",
">",
">",
"DepthLimitedSearch",
"<",
"A",
",",
"S",
",",
"N",
">",
"createDepthLimitedSearch",
"(",
"SearchProblem",
"<",
"A",
",",
"S",
",",
"N",
... | Instantiates Depth Limited Search algorithm for a problem definition.
@param components
search problem definition with the components of the algorithm
@param <A>
type of the actions
@param <S>
type of the states
@param <N>
type of the nodes
@return instance of
{@link es.usc.citius.hipster.algorithm.DepthFirstSearch} f... | [
"Instantiates",
"Depth",
"Limited",
"Search",
"algorithm",
"for",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L178-L182 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createHillClimbing | public static <A, S, C extends Comparable<C>, N extends HeuristicNode<A, S, C, N>> HillClimbing<A, S, C, N> createHillClimbing(
SearchProblem<A, S, N> components, boolean enforced) {
return new HillClimbing<A, S, C, N>(components.getInitialNode(), components.getExpander(), enforced);
} | java | public static <A, S, C extends Comparable<C>, N extends HeuristicNode<A, S, C, N>> HillClimbing<A, S, C, N> createHillClimbing(
SearchProblem<A, S, N> components, boolean enforced) {
return new HillClimbing<A, S, C, N>(components.getInitialNode(), components.getExpander(), enforced);
} | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"C",
"extends",
"Comparable",
"<",
"C",
">",
",",
"N",
"extends",
"HeuristicNode",
"<",
"A",
",",
"S",
",",
"C",
",",
"N",
">",
">",
"HillClimbing",
"<",
"A",
",",
"S",
",",
"C",
",",
"N",
">",
"cr... | Instantiates a Hill Climbing algorithm given a problem definition.
@param components
search problem definition with the components of the algorithm
@param enforced
flag to use Enforced Hill Climbing instead of classic Hill
Climbing algorithm
@param <A>
type of the actions
@param <S>
type of the states
@param <C>
type ... | [
"Instantiates",
"a",
"Hill",
"Climbing",
"algorithm",
"given",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L225-L228 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createAnnealingSearch | public static <A, S, N extends HeuristicNode<A, S, Double, N>> AnnealingSearch<A, S, N> createAnnealingSearch(
SearchProblem<A, S, N> components, Double alpha, Double minTemp,
AcceptanceProbability acceptanceProbability, SuccessorFinder<A, S, N> successorFinder) {
return new AnnealingSearch<A, S, N>(componen... | java | public static <A, S, N extends HeuristicNode<A, S, Double, N>> AnnealingSearch<A, S, N> createAnnealingSearch(
SearchProblem<A, S, N> components, Double alpha, Double minTemp,
AcceptanceProbability acceptanceProbability, SuccessorFinder<A, S, N> successorFinder) {
return new AnnealingSearch<A, S, N>(componen... | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"N",
"extends",
"HeuristicNode",
"<",
"A",
",",
"S",
",",
"Double",
",",
"N",
">",
">",
"AnnealingSearch",
"<",
"A",
",",
"S",
",",
"N",
">",
"createAnnealingSearch",
"(",
"SearchProblem",
"<",
"A",
",",
... | Instantiates an AnnealingSearch algorithm given a problem definition.
@param components
search problem definition with the components of the algorithm
@param alpha
coefficient of the geometric cooling schedule
@param <A>
type of the actions
@param <S>
type of the states
@param <C>
type of the cost
@param <N>
type of t... | [
"Instantiates",
"an",
"AnnealingSearch",
"algorithm",
"given",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L249-L254 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java | Hipster.createMultiobjectiveLS | public static <A, S, C extends Comparable<C>, N extends HeuristicNode<A, S, C, N>> MultiobjectiveLS<A, S, C, N> createMultiobjectiveLS(
SearchProblem<A, S, N> components) {
return new MultiobjectiveLS<A, S, C, N>(components.getInitialNode(), components.getExpander());
} | java | public static <A, S, C extends Comparable<C>, N extends HeuristicNode<A, S, C, N>> MultiobjectiveLS<A, S, C, N> createMultiobjectiveLS(
SearchProblem<A, S, N> components) {
return new MultiobjectiveLS<A, S, C, N>(components.getInitialNode(), components.getExpander());
} | [
"public",
"static",
"<",
"A",
",",
"S",
",",
"C",
"extends",
"Comparable",
"<",
"C",
">",
",",
"N",
"extends",
"HeuristicNode",
"<",
"A",
",",
"S",
",",
"C",
",",
"N",
">",
">",
"MultiobjectiveLS",
"<",
"A",
",",
"S",
",",
"C",
",",
"N",
">",
... | Instantiates a Multi-objective Label Setting algorithm given a problem
definition.
@param components
search problem definition with the components of the algorithm
@param <A>
type of the actions
@param <S>
type of the states
@param <C>
type of the cost
@param <N>
type of the nodes
@return instance of
{@link es.usc.cit... | [
"Instantiates",
"a",
"Multi",
"-",
"objective",
"Label",
"Setting",
"algorithm",
"given",
"a",
"problem",
"definition",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/algorithm/Hipster.java#L274-L277 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/RomanianProblem.java | RomanianProblem.heuristicFunction | public static HeuristicFunction<City, Double> heuristicFunction(){
return new HeuristicFunction<City, Double>() {
@Override
public Double estimate(City state) {
return heuristics().get(state);
}
};
} | java | public static HeuristicFunction<City, Double> heuristicFunction(){
return new HeuristicFunction<City, Double>() {
@Override
public Double estimate(City state) {
return heuristics().get(state);
}
};
} | [
"public",
"static",
"HeuristicFunction",
"<",
"City",
",",
"Double",
">",
"heuristicFunction",
"(",
")",
"{",
"return",
"new",
"HeuristicFunction",
"<",
"City",
",",
"Double",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Double",
"estimate",
"(",
"City",
... | Heuristic function required to define search problems to be used with Hipster.
@see es.usc.citius.hipster.model.problem.SearchProblem
@return {@link es.usc.citius.hipster.model.function.HeuristicFunction} with the {@link #heuristics()} values. | [
"Heuristic",
"function",
"required",
"to",
"define",
"search",
"problems",
"to",
"be",
"used",
"with",
"Hipster",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/RomanianProblem.java#L110-L117 | train |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/impl/UnweightedNode.java | UnweightedNode.newNodeWithoutAction | public static <S> UnweightedNode<Void,S> newNodeWithoutAction(UnweightedNode<Void,S> previousNode, S state){
return new UnweightedNode<Void, S>(previousNode, state, null);
} | java | public static <S> UnweightedNode<Void,S> newNodeWithoutAction(UnweightedNode<Void,S> previousNode, S state){
return new UnweightedNode<Void, S>(previousNode, state, null);
} | [
"public",
"static",
"<",
"S",
">",
"UnweightedNode",
"<",
"Void",
",",
"S",
">",
"newNodeWithoutAction",
"(",
"UnweightedNode",
"<",
"Void",
",",
"S",
">",
"previousNode",
",",
"S",
"state",
")",
"{",
"return",
"new",
"UnweightedNode",
"<",
"Void",
",",
... | This static method creates an unweighted node without defining an explicit action, using
the parent node and a state.
@param previousNode parent node
@param state state of the node to be created
@param <S> type of the state
@return new node for the state specified, without need of specifying the action connecting them | [
"This",
"static",
"method",
"creates",
"an",
"unweighted",
"node",
"without",
"defining",
"an",
"explicit",
"action",
"using",
"the",
"parent",
"node",
"and",
"a",
"state",
"."
] | 9ab1236abb833a27641ae73ba9ca890d5c17598e | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/impl/UnweightedNode.java#L65-L67 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java | GraphUtils.getFirstChild | public static <T extends GraphNode<T>> T getFirstChild(T node) {
return hasChildren(node) ? node.getChildren().get(0) : null;
} | java | public static <T extends GraphNode<T>> T getFirstChild(T node) {
return hasChildren(node) ? node.getChildren().get(0) : null;
} | [
"public",
"static",
"<",
"T",
"extends",
"GraphNode",
"<",
"T",
">",
">",
"T",
"getFirstChild",
"(",
"T",
"node",
")",
"{",
"return",
"hasChildren",
"(",
"node",
")",
"?",
"node",
".",
"getChildren",
"(",
")",
".",
"get",
"(",
"0",
")",
":",
"null"... | Returns the first child node of the given node or null if node is null or does not have any children.
@param node a node
@return the first child node of the given node or null if node is null or does not have any children | [
"Returns",
"the",
"first",
"child",
"node",
"of",
"the",
"given",
"node",
"or",
"null",
"if",
"node",
"is",
"null",
"or",
"does",
"not",
"have",
"any",
"children",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L50-L52 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java | GraphUtils.getLastChild | public static <T extends GraphNode<T>> T getLastChild(T node) {
return hasChildren(node) ? node.getChildren().get(node.getChildren().size() - 1) : null;
} | java | public static <T extends GraphNode<T>> T getLastChild(T node) {
return hasChildren(node) ? node.getChildren().get(node.getChildren().size() - 1) : null;
} | [
"public",
"static",
"<",
"T",
"extends",
"GraphNode",
"<",
"T",
">",
">",
"T",
"getLastChild",
"(",
"T",
"node",
")",
"{",
"return",
"hasChildren",
"(",
"node",
")",
"?",
"node",
".",
"getChildren",
"(",
")",
".",
"get",
"(",
"node",
".",
"getChildre... | Returns the last child node of the given node or null if node is null or does not have any children.
@param node a node
@return the last child node of the given node or null if node is null or does not have any children | [
"Returns",
"the",
"last",
"child",
"node",
"of",
"the",
"given",
"node",
"or",
"null",
"if",
"node",
"is",
"null",
"or",
"does",
"not",
"have",
"any",
"children",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L60-L62 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java | GraphUtils.countAllDistinct | public static <T extends GraphNode<T>> int countAllDistinct(T node) {
if (node == null) return 0;
return collectAllNodes(node, new HashSet<T>()).size();
} | java | public static <T extends GraphNode<T>> int countAllDistinct(T node) {
if (node == null) return 0;
return collectAllNodes(node, new HashSet<T>()).size();
} | [
"public",
"static",
"<",
"T",
"extends",
"GraphNode",
"<",
"T",
">",
">",
"int",
"countAllDistinct",
"(",
"T",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"0",
";",
"return",
"collectAllNodes",
"(",
"node",
",",
"new",
"HashSet",
... | Counts all distinct nodes in the graph reachable from the given node.
This method can properly deal with cycles in the graph.
@param node the root node
@return the number of distinct nodes | [
"Counts",
"all",
"distinct",
"nodes",
"in",
"the",
"graph",
"reachable",
"from",
"the",
"given",
"node",
".",
"This",
"method",
"can",
"properly",
"deal",
"with",
"cycles",
"in",
"the",
"graph",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L71-L74 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java | GraphUtils.collectAllNodes | public static <T extends GraphNode<T>, C extends Collection<T>> C collectAllNodes(T node, C collection) {
// we don't recurse if the collecion already contains the node
// this costs a bit of performance but prevents infinite recursion in the case of graph cycles
checkArgNotNull(collection, "col... | java | public static <T extends GraphNode<T>, C extends Collection<T>> C collectAllNodes(T node, C collection) {
// we don't recurse if the collecion already contains the node
// this costs a bit of performance but prevents infinite recursion in the case of graph cycles
checkArgNotNull(collection, "col... | [
"public",
"static",
"<",
"T",
"extends",
"GraphNode",
"<",
"T",
">",
",",
"C",
"extends",
"Collection",
"<",
"T",
">",
">",
"C",
"collectAllNodes",
"(",
"T",
"node",
",",
"C",
"collection",
")",
"{",
"// we don't recurse if the collecion already contains the nod... | Collects all nodes from the graph reachable from the given node in the given collection.
This method can properly deal with cycles in the graph.
@param node the root node
@param collection the collection to collect into
@return the same collection passed as a parameter | [
"Collects",
"all",
"nodes",
"from",
"the",
"graph",
"reachable",
"from",
"the",
"given",
"node",
"in",
"the",
"given",
"collection",
".",
"This",
"method",
"can",
"properly",
"deal",
"with",
"cycles",
"in",
"the",
"graph",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L84-L95 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java | GraphUtils.printTree | public static <T extends GraphNode<T>> String printTree(T node, Formatter<T> formatter) {
checkArgNotNull(formatter, "formatter");
return printTree(node, formatter, Predicates.<T>alwaysTrue(), Predicates.<T>alwaysTrue());
} | java | public static <T extends GraphNode<T>> String printTree(T node, Formatter<T> formatter) {
checkArgNotNull(formatter, "formatter");
return printTree(node, formatter, Predicates.<T>alwaysTrue(), Predicates.<T>alwaysTrue());
} | [
"public",
"static",
"<",
"T",
"extends",
"GraphNode",
"<",
"T",
">",
">",
"String",
"printTree",
"(",
"T",
"node",
",",
"Formatter",
"<",
"T",
">",
"formatter",
")",
"{",
"checkArgNotNull",
"(",
"formatter",
",",
"\"formatter\"",
")",
";",
"return",
"pri... | Creates a string representation of the graph reachable from the given node using the given formatter.
@param node the root node
@param formatter the node formatter
@return a new string | [
"Creates",
"a",
"string",
"representation",
"of",
"the",
"graph",
"reachable",
"from",
"the",
"given",
"node",
"using",
"the",
"given",
"formatter",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L104-L107 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java | GraphUtils.printTree | private static <T extends GraphNode<T>> StringBuilder printTree(T node, Formatter<T> formatter,
String indent, StringBuilder sb,
Predicate<T> nodeFilter,
... | java | private static <T extends GraphNode<T>> StringBuilder printTree(T node, Formatter<T> formatter,
String indent, StringBuilder sb,
Predicate<T> nodeFilter,
... | [
"private",
"static",
"<",
"T",
"extends",
"GraphNode",
"<",
"T",
">",
">",
"StringBuilder",
"printTree",
"(",
"T",
"node",
",",
"Formatter",
"<",
"T",
">",
"formatter",
",",
"String",
"indent",
",",
"StringBuilder",
"sb",
",",
"Predicate",
"<",
"T",
">",... | private recursion helper | [
"private",
"recursion",
"helper"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L132-L149 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Utils.java | Utils.isBoxedType | public static boolean isBoxedType(Class<?> primitive, Class<?> boxed) {
return (primitive.equals(boolean.class) && boxed.equals(Boolean.class)) ||
(primitive.equals(byte.class) && boxed.equals(Byte.class)) ||
(primitive.equals(char.class) && boxed.equals(Character.class)) ||
... | java | public static boolean isBoxedType(Class<?> primitive, Class<?> boxed) {
return (primitive.equals(boolean.class) && boxed.equals(Boolean.class)) ||
(primitive.equals(byte.class) && boxed.equals(Byte.class)) ||
(primitive.equals(char.class) && boxed.equals(Character.class)) ||
... | [
"public",
"static",
"boolean",
"isBoxedType",
"(",
"Class",
"<",
"?",
">",
"primitive",
",",
"Class",
"<",
"?",
">",
"boxed",
")",
"{",
"return",
"(",
"primitive",
".",
"equals",
"(",
"boolean",
".",
"class",
")",
"&&",
"boxed",
".",
"equals",
"(",
"... | Determines if the primitive type is boxed as the boxed type
@param primitive the primitive type to check if boxed is the boxed type
@param boxed the possible boxed type of the primitive
@return true if boxed is the boxed type of primitive, false otherwise. | [
"Determines",
"if",
"the",
"primitive",
"type",
"is",
"boxed",
"as",
"the",
"boxed",
"type"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Utils.java#L282-L292 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Utils.java | Utils.findConstructor | public static Constructor findConstructor(Class<?> type, Object[] args) {
outer:
for (Constructor constructor : type.getConstructors()) {
Class<?>[] paramTypes = constructor.getParameterTypes();
if (paramTypes.length != args.length) continue;
for (int i = 0; i < args.... | java | public static Constructor findConstructor(Class<?> type, Object[] args) {
outer:
for (Constructor constructor : type.getConstructors()) {
Class<?>[] paramTypes = constructor.getParameterTypes();
if (paramTypes.length != args.length) continue;
for (int i = 0; i < args.... | [
"public",
"static",
"Constructor",
"findConstructor",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"outer",
":",
"for",
"(",
"Constructor",
"constructor",
":",
"type",
".",
"getConstructors",
"(",
")",
")",
"{",
"Class"... | Finds the constructor of the given class that is compatible with the given arguments.
@param type the class to find the constructor of
@param args the arguments
@return the constructor | [
"Finds",
"the",
"constructor",
"of",
"the",
"given",
"class",
"that",
"is",
"compatible",
"with",
"the",
"given",
"arguments",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Utils.java#L301-L314 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Utils.java | Utils.humanize | public static String humanize(long value) {
if (value < 0) {
return '-' + humanize(-value);
} else if (value > 1000000000000000000L) {
return Double.toString(
(value + 500000000000000L) / 1000000000000000L * 1000000000000000L / 1000000000000000000.0) + 'E';
... | java | public static String humanize(long value) {
if (value < 0) {
return '-' + humanize(-value);
} else if (value > 1000000000000000000L) {
return Double.toString(
(value + 500000000000000L) / 1000000000000000L * 1000000000000000L / 1000000000000000000.0) + 'E';
... | [
"public",
"static",
"String",
"humanize",
"(",
"long",
"value",
")",
"{",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"return",
"'",
"'",
"+",
"humanize",
"(",
"-",
"value",
")",
";",
"}",
"else",
"if",
"(",
"value",
">",
"1000000000000000000L",
")",
"... | Formats the given long value into a human readable notation using the Kilo, Mega, Giga, etc. abbreviations.
@param value the value to format
@return the string representation | [
"Formats",
"the",
"given",
"long",
"value",
"into",
"a",
"human",
"readable",
"notation",
"using",
"the",
"Kilo",
"Mega",
"Giga",
"etc",
".",
"abbreviations",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Utils.java#L322-L364 | train |
sirthias/parboiled | examples-java/src/main/java/org/parboiled/examples/calculators/CalculatorParser3.java | CalculatorParser3.fromStringLiteral | @Override
protected Rule fromStringLiteral(String string) {
return string.endsWith(" ") ?
Sequence(String(string.substring(0, string.length() - 1)), WhiteSpace()) :
String(string);
} | java | @Override
protected Rule fromStringLiteral(String string) {
return string.endsWith(" ") ?
Sequence(String(string.substring(0, string.length() - 1)), WhiteSpace()) :
String(string);
} | [
"@",
"Override",
"protected",
"Rule",
"fromStringLiteral",
"(",
"String",
"string",
")",
"{",
"return",
"string",
".",
"endsWith",
"(",
"\" \"",
")",
"?",
"Sequence",
"(",
"String",
"(",
"string",
".",
"substring",
"(",
"0",
",",
"string",
".",
"length",
... | character or string literal | [
"character",
"or",
"string",
"literal"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/examples-java/src/main/java/org/parboiled/examples/calculators/CalculatorParser3.java#L125-L130 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java | ErrorUtils.findProperLabelMatcher | static Matcher findProperLabelMatcher(MatcherPath path, int errorIndex) {
try { return findProperLabelMatcher0(path, errorIndex); }
catch(RuntimeException e) {
if (e == UnderneathTestNot) return null; else throw e;
}
} | java | static Matcher findProperLabelMatcher(MatcherPath path, int errorIndex) {
try { return findProperLabelMatcher0(path, errorIndex); }
catch(RuntimeException e) {
if (e == UnderneathTestNot) return null; else throw e;
}
} | [
"static",
"Matcher",
"findProperLabelMatcher",
"(",
"MatcherPath",
"path",
",",
"int",
"errorIndex",
")",
"{",
"try",
"{",
"return",
"findProperLabelMatcher0",
"(",
"path",
",",
"errorIndex",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"if"... | Finds the Matcher in the given failedMatcherPath whose label is best for presentation in "expected" strings
of parse error messages, given the provided lastMatchPath.
@param path the path to the failed matcher
@param errorIndex the start index of the respective parse error
@return the matcher whose label is best... | [
"Finds",
"the",
"Matcher",
"in",
"the",
"given",
"failedMatcherPath",
"whose",
"label",
"is",
"best",
"for",
"presentation",
"in",
"expected",
"strings",
"of",
"parse",
"error",
"messages",
"given",
"the",
"provided",
"lastMatchPath",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java#L47-L52 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java | ErrorUtils.printParseErrors | public static String printParseErrors(List<ParseError> errors) {
checkArgNotNull(errors, "errors");
StringBuilder sb = new StringBuilder();
for (ParseError error : errors) {
if (sb.length() > 0) sb.append("---\n");
sb.append(printParseError(error));
}
retu... | java | public static String printParseErrors(List<ParseError> errors) {
checkArgNotNull(errors, "errors");
StringBuilder sb = new StringBuilder();
for (ParseError error : errors) {
if (sb.length() > 0) sb.append("---\n");
sb.append(printParseError(error));
}
retu... | [
"public",
"static",
"String",
"printParseErrors",
"(",
"List",
"<",
"ParseError",
">",
"errors",
")",
"{",
"checkArgNotNull",
"(",
"errors",
",",
"\"errors\"",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"ParseErr... | Pretty prints the given parse errors showing their location in the given input buffer.
@param errors the parse errors
@return the pretty print text | [
"Pretty",
"prints",
"the",
"given",
"parse",
"errors",
"showing",
"their",
"location",
"in",
"the",
"given",
"input",
"buffer",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java#L84-L92 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java | ErrorUtils.printParseError | public static String printParseError(ParseError error, Formatter<InvalidInputError> formatter) {
checkArgNotNull(error, "error");
checkArgNotNull(formatter, "formatter");
String message = error.getErrorMessage() != null ? error.getErrorMessage() :
error instanceof InvalidInputErr... | java | public static String printParseError(ParseError error, Formatter<InvalidInputError> formatter) {
checkArgNotNull(error, "error");
checkArgNotNull(formatter, "formatter");
String message = error.getErrorMessage() != null ? error.getErrorMessage() :
error instanceof InvalidInputErr... | [
"public",
"static",
"String",
"printParseError",
"(",
"ParseError",
"error",
",",
"Formatter",
"<",
"InvalidInputError",
">",
"formatter",
")",
"{",
"checkArgNotNull",
"(",
"error",
",",
"\"error\"",
")",
";",
"checkArgNotNull",
"(",
"formatter",
",",
"\"formatter... | Pretty prints the given parse error showing its location in the given input buffer.
@param error the parse error
@param formatter the formatter for InvalidInputErrors
@return the pretty print text | [
"Pretty",
"prints",
"the",
"given",
"parse",
"error",
"showing",
"its",
"location",
"in",
"the",
"given",
"input",
"buffer",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java#L112-L120 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/StringUtils.java | StringUtils.repeat | public static String repeat(char c, int n) {
char[] array = new char[n];
Arrays.fill(array, c);
return String.valueOf(array);
} | java | public static String repeat(char c, int n) {
char[] array = new char[n];
Arrays.fill(array, c);
return String.valueOf(array);
} | [
"public",
"static",
"String",
"repeat",
"(",
"char",
"c",
",",
"int",
"n",
")",
"{",
"char",
"[",
"]",
"array",
"=",
"new",
"char",
"[",
"n",
"]",
";",
"Arrays",
".",
"fill",
"(",
"array",
",",
"c",
")",
";",
"return",
"String",
".",
"valueOf",
... | Creates a string consisting of n times the given character.
@param c the char
@param n the number of times to repeat
@return the string | [
"Creates",
"a",
"string",
"consisting",
"of",
"n",
"times",
"the",
"given",
"character",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/StringUtils.java#L99-L103 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/StringUtils.java | StringUtils.startsWith | public static boolean startsWith(String string, String prefix) {
return string != null && (prefix == null || string.startsWith(prefix));
} | java | public static boolean startsWith(String string, String prefix) {
return string != null && (prefix == null || string.startsWith(prefix));
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"String",
"string",
",",
"String",
"prefix",
")",
"{",
"return",
"string",
"!=",
"null",
"&&",
"(",
"prefix",
"==",
"null",
"||",
"string",
".",
"startsWith",
"(",
"prefix",
")",
")",
";",
"}"
] | Test whether a string starts with a given prefix, handling null values without exceptions.
StringUtils.startsWith(null, null) = false
StringUtils.startsWith(null, "abc") = false
StringUtils.startsWith("abc", null) = true
StringUtils.startsWith("abc", "ab") = true
StringUtils.startsWith("abc", "abc") = true
@para... | [
"Test",
"whether",
"a",
"string",
"starts",
"with",
"a",
"given",
"prefix",
"handling",
"null",
"values",
"without",
"exceptions",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/StringUtils.java#L306-L308 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/buffers/DefaultInputBuffer.java | DefaultInputBuffer.getLine0 | private static int getLine0(int[] newlines, int index) {
int j = Arrays.binarySearch(newlines, index);
return j >= 0 ? j : -(j + 1);
} | java | private static int getLine0(int[] newlines, int index) {
int j = Arrays.binarySearch(newlines, index);
return j >= 0 ? j : -(j + 1);
} | [
"private",
"static",
"int",
"getLine0",
"(",
"int",
"[",
"]",
"newlines",
",",
"int",
"index",
")",
"{",
"int",
"j",
"=",
"Arrays",
".",
"binarySearch",
"(",
"newlines",
",",
"index",
")",
";",
"return",
"j",
">=",
"0",
"?",
"j",
":",
"-",
"(",
"... | returns the zero based input line number the character with the given index is found in | [
"returns",
"the",
"zero",
"based",
"input",
"line",
"number",
"the",
"character",
"with",
"the",
"given",
"index",
"is",
"found",
"in"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/buffers/DefaultInputBuffer.java#L98-L101 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/Var.java | Var.enterFrame | public boolean enterFrame() {
if (level++ > 0) {
if (stack == null) stack = new LinkedList<T>();
stack.add(get());
}
return set(initialValueFactory.create());
} | java | public boolean enterFrame() {
if (level++ > 0) {
if (stack == null) stack = new LinkedList<T>();
stack.add(get());
}
return set(initialValueFactory.create());
} | [
"public",
"boolean",
"enterFrame",
"(",
")",
"{",
"if",
"(",
"level",
"++",
">",
"0",
")",
"{",
"if",
"(",
"stack",
"==",
"null",
")",
"stack",
"=",
"new",
"LinkedList",
"<",
"T",
">",
"(",
")",
";",
"stack",
".",
"add",
"(",
"get",
"(",
")",
... | Provides a new frame for the variable.
Potentially existing previous frames are saved.
Normally you do not have to call this method manually as parboiled provides for automatic Var frame management.
@return true | [
"Provides",
"a",
"new",
"frame",
"for",
"the",
"variable",
".",
"Potentially",
"existing",
"previous",
"frames",
"are",
"saved",
".",
"Normally",
"you",
"do",
"not",
"have",
"to",
"call",
"this",
"method",
"manually",
"as",
"parboiled",
"provides",
"for",
"a... | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Var.java#L111-L117 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/matchers/MemoMismatchesMatcher.java | MemoMismatchesMatcher.unwrap | public static Matcher unwrap(Matcher matcher) {
if (matcher instanceof MemoMismatchesMatcher) {
MemoMismatchesMatcher memoMismatchesMatcher = (MemoMismatchesMatcher) matcher;
return unwrap(memoMismatchesMatcher.inner);
}
return matcher;
} | java | public static Matcher unwrap(Matcher matcher) {
if (matcher instanceof MemoMismatchesMatcher) {
MemoMismatchesMatcher memoMismatchesMatcher = (MemoMismatchesMatcher) matcher;
return unwrap(memoMismatchesMatcher.inner);
}
return matcher;
} | [
"public",
"static",
"Matcher",
"unwrap",
"(",
"Matcher",
"matcher",
")",
"{",
"if",
"(",
"matcher",
"instanceof",
"MemoMismatchesMatcher",
")",
"{",
"MemoMismatchesMatcher",
"memoMismatchesMatcher",
"=",
"(",
"MemoMismatchesMatcher",
")",
"matcher",
";",
"return",
"... | Retrieves the innermost Matcher that is not a MemoMismatchesMatcher.
@param matcher the matcher to unwrap
@return the given instance if it is not a MemoMismatchesMatcher, otherwise the innermost Matcher | [
"Retrieves",
"the",
"innermost",
"Matcher",
"that",
"is",
"not",
"a",
"MemoMismatchesMatcher",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/matchers/MemoMismatchesMatcher.java#L114-L120 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/errors/DefaultInvalidInputErrorFormatter.java | DefaultInvalidInputErrorFormatter.getLabels | public String[] getLabels(Matcher matcher) {
if ((matcher instanceof AnyOfMatcher) && ((AnyOfMatcher)matcher).characters.toString().equals(matcher.getLabel())) {
AnyOfMatcher cMatcher = (AnyOfMatcher) matcher;
if (!cMatcher.characters.isSubtractive()) {
String[] labels = ... | java | public String[] getLabels(Matcher matcher) {
if ((matcher instanceof AnyOfMatcher) && ((AnyOfMatcher)matcher).characters.toString().equals(matcher.getLabel())) {
AnyOfMatcher cMatcher = (AnyOfMatcher) matcher;
if (!cMatcher.characters.isSubtractive()) {
String[] labels = ... | [
"public",
"String",
"[",
"]",
"getLabels",
"(",
"Matcher",
"matcher",
")",
"{",
"if",
"(",
"(",
"matcher",
"instanceof",
"AnyOfMatcher",
")",
"&&",
"(",
"(",
"AnyOfMatcher",
")",
"matcher",
")",
".",
"characters",
".",
"toString",
"(",
")",
".",
"equals"... | Gets the labels corresponding to the given matcher, AnyOfMatchers are treated specially in that their
label is constructed as a list of their contents
@param matcher the matcher
@return the labels | [
"Gets",
"the",
"labels",
"corresponding",
"to",
"the",
"given",
"matcher",
"AnyOfMatchers",
"are",
"treated",
"specially",
"in",
"that",
"their",
"label",
"is",
"constructed",
"as",
"a",
"list",
"of",
"their",
"contents"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/DefaultInvalidInputErrorFormatter.java#L90-L102 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/matchers/VarFramingMatcher.java | VarFramingMatcher.unwrap | public static Matcher unwrap(Matcher matcher) {
if (matcher instanceof VarFramingMatcher) {
VarFramingMatcher varFramingMatcher = (VarFramingMatcher) matcher;
return unwrap(varFramingMatcher.inner);
}
return matcher;
} | java | public static Matcher unwrap(Matcher matcher) {
if (matcher instanceof VarFramingMatcher) {
VarFramingMatcher varFramingMatcher = (VarFramingMatcher) matcher;
return unwrap(varFramingMatcher.inner);
}
return matcher;
} | [
"public",
"static",
"Matcher",
"unwrap",
"(",
"Matcher",
"matcher",
")",
"{",
"if",
"(",
"matcher",
"instanceof",
"VarFramingMatcher",
")",
"{",
"VarFramingMatcher",
"varFramingMatcher",
"=",
"(",
"VarFramingMatcher",
")",
"matcher",
";",
"return",
"unwrap",
"(",
... | Retrieves the innermost Matcher that is not a VarFramingMatcher.
@param matcher the matcher to unwrap
@return the given instance if it is not a VarFramingMatcher, otherwise the innermost Matcher | [
"Retrieves",
"the",
"innermost",
"Matcher",
"that",
"is",
"not",
"a",
"VarFramingMatcher",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/matchers/VarFramingMatcher.java#L119-L125 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java | AsmUtils.findLoadedClass | public static Class<?> findLoadedClass(String className, ClassLoader classLoader) {
checkArgNotNull(className, "className");
checkArgNotNull(classLoader, "classLoader");
try {
Class<?> classLoaderBaseClass = Class.forName("java.lang.ClassLoader");
Method findLoadedClassMe... | java | public static Class<?> findLoadedClass(String className, ClassLoader classLoader) {
checkArgNotNull(className, "className");
checkArgNotNull(classLoader, "classLoader");
try {
Class<?> classLoaderBaseClass = Class.forName("java.lang.ClassLoader");
Method findLoadedClassMe... | [
"public",
"static",
"Class",
"<",
"?",
">",
"findLoadedClass",
"(",
"String",
"className",
",",
"ClassLoader",
"classLoader",
")",
"{",
"checkArgNotNull",
"(",
"className",
",",
"\"className\"",
")",
";",
"checkArgNotNull",
"(",
"classLoader",
",",
"\"classLoader\... | Returns the class with the given name if it has already been loaded by the given class loader.
Otherwise the method returns null.
@param className the full name of the class to be loaded
@param classLoader the class loader to use
@return the class instance or null | [
"Returns",
"the",
"class",
"with",
"the",
"given",
"name",
"if",
"it",
"has",
"already",
"been",
"loaded",
"by",
"the",
"given",
"class",
"loader",
".",
"Otherwise",
"the",
"method",
"returns",
"null",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java#L202-L220 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java | AsmUtils.isAssignableTo | public static boolean isAssignableTo(String classInternalName, Class<?> type) {
checkArgNotNull(classInternalName, "classInternalName");
checkArgNotNull(type, "type");
return type.isAssignableFrom(getClassForInternalName(classInternalName));
} | java | public static boolean isAssignableTo(String classInternalName, Class<?> type) {
checkArgNotNull(classInternalName, "classInternalName");
checkArgNotNull(type, "type");
return type.isAssignableFrom(getClassForInternalName(classInternalName));
} | [
"public",
"static",
"boolean",
"isAssignableTo",
"(",
"String",
"classInternalName",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"checkArgNotNull",
"(",
"classInternalName",
",",
"\"classInternalName\"",
")",
";",
"checkArgNotNull",
"(",
"type",
",",
"\"type\""... | Determines whether the class with the given descriptor is assignable to the given type.
@param classInternalName the class descriptor
@param type the type
@return true if the class with the given descriptor is assignable to the given type | [
"Determines",
"whether",
"the",
"class",
"with",
"the",
"given",
"descriptor",
"is",
"assignable",
"to",
"the",
"given",
"type",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java#L295-L299 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java | TreeUtils.getRoot | public static <T extends TreeNode<T>> T getRoot(T node) {
if (node == null) return null;
if (node.getParent() != null) return getRoot(node.getParent());
return node;
} | java | public static <T extends TreeNode<T>> T getRoot(T node) {
if (node == null) return null;
if (node.getParent() != null) return getRoot(node.getParent());
return node;
} | [
"public",
"static",
"<",
"T",
"extends",
"TreeNode",
"<",
"T",
">",
">",
"T",
"getRoot",
"(",
"T",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"node",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
... | Returns the root of the tree the given node is part of.
@param node the node to get the root of
@return the root or null if the given node is null | [
"Returns",
"the",
"root",
"of",
"the",
"tree",
"the",
"given",
"node",
"is",
"part",
"of",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java#L34-L38 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java | TreeUtils.addChild | public static <T extends MutableTreeNode<T>> void addChild(T parent, T child) {
checkArgNotNull(parent, "parent");
parent.addChild(parent.getChildren().size(), child);
} | java | public static <T extends MutableTreeNode<T>> void addChild(T parent, T child) {
checkArgNotNull(parent, "parent");
parent.addChild(parent.getChildren().size(), child);
} | [
"public",
"static",
"<",
"T",
"extends",
"MutableTreeNode",
"<",
"T",
">",
">",
"void",
"addChild",
"(",
"T",
"parent",
",",
"T",
"child",
")",
"{",
"checkArgNotNull",
"(",
"parent",
",",
"\"parent\"",
")",
";",
"parent",
".",
"addChild",
"(",
"parent",
... | Adds a new child node to a given MutableTreeNode parent.
@param parent the parent node
@param child the child node to add | [
"Adds",
"a",
"new",
"child",
"node",
"to",
"a",
"given",
"MutableTreeNode",
"parent",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java#L46-L49 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java | TreeUtils.removeChild | public static <T extends MutableTreeNode<T>> void removeChild(T parent, T child) {
checkArgNotNull(parent, "parent");
int index = parent.getChildren().indexOf(child);
checkElementIndex(index, parent.getChildren().size());
parent.removeChild(index);
} | java | public static <T extends MutableTreeNode<T>> void removeChild(T parent, T child) {
checkArgNotNull(parent, "parent");
int index = parent.getChildren().indexOf(child);
checkElementIndex(index, parent.getChildren().size());
parent.removeChild(index);
} | [
"public",
"static",
"<",
"T",
"extends",
"MutableTreeNode",
"<",
"T",
">",
">",
"void",
"removeChild",
"(",
"T",
"parent",
",",
"T",
"child",
")",
"{",
"checkArgNotNull",
"(",
"parent",
",",
"\"parent\"",
")",
";",
"int",
"index",
"=",
"parent",
".",
"... | Removes the given child from the given parent node.
@param parent the parent node
@param child the child node | [
"Removes",
"the",
"given",
"child",
"from",
"the",
"given",
"parent",
"node",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java#L57-L62 | train |
sirthias/parboiled | examples-java/src/main/java/org/parboiled/examples/java/JavaParser.java | JavaParser.ArrayCreatorRest | Rule ArrayCreatorRest() {
return Sequence(
LBRK,
FirstOf(
Sequence(RBRK, ZeroOrMore(Dim()), ArrayInitializer()),
Sequence(Expression(), RBRK, ZeroOrMore(DimExpr()), ZeroOrMore(Dim()))
)
);
} | java | Rule ArrayCreatorRest() {
return Sequence(
LBRK,
FirstOf(
Sequence(RBRK, ZeroOrMore(Dim()), ArrayInitializer()),
Sequence(Expression(), RBRK, ZeroOrMore(DimExpr()), ZeroOrMore(Dim()))
)
);
} | [
"Rule",
"ArrayCreatorRest",
"(",
")",
"{",
"return",
"Sequence",
"(",
"LBRK",
",",
"FirstOf",
"(",
"Sequence",
"(",
"RBRK",
",",
"ZeroOrMore",
"(",
"Dim",
"(",
")",
")",
",",
"ArrayInitializer",
"(",
")",
")",
",",
"Sequence",
"(",
"Expression",
"(",
"... | BasicType must be followed by at least one DimExpr or by ArrayInitializer. | [
"BasicType",
"must",
"be",
"followed",
"by",
"at",
"least",
"one",
"DimExpr",
"or",
"by",
"ArrayInitializer",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/examples-java/src/main/java/org/parboiled/examples/java/JavaParser.java#L649-L657 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Reference.java | Reference.getAndSet | public T getAndSet(T value) {
T t = this.value;
this.value = value;
return t;
} | java | public T getAndSet(T value) {
T t = this.value;
this.value = value;
return t;
} | [
"public",
"T",
"getAndSet",
"(",
"T",
"value",
")",
"{",
"T",
"t",
"=",
"this",
".",
"value",
";",
"this",
".",
"value",
"=",
"value",
";",
"return",
"t",
";",
"}"
] | Replaces this references value with the given one.
@param value the new value
@return the previous value | [
"Replaces",
"this",
"references",
"value",
"with",
"the",
"given",
"one",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Reference.java#L88-L92 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/matchers/FirstOfStringsMatcher.java | FirstOfStringsMatcher.verify | private static void verify(char[][] strings) {
int length = strings.length;
for (int i = 0; i < length; i++) {
char[] a = strings[i];
inner:
for (int j = i + 1; j < length; j++) {
char[] b = strings[j];
if (b.length < a.length) continue... | java | private static void verify(char[][] strings) {
int length = strings.length;
for (int i = 0; i < length; i++) {
char[] a = strings[i];
inner:
for (int j = i + 1; j < length; j++) {
char[] b = strings[j];
if (b.length < a.length) continue... | [
"private",
"static",
"void",
"verify",
"(",
"char",
"[",
"]",
"[",
"]",
"strings",
")",
"{",
"int",
"length",
"=",
"strings",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"char",
"[",
... | but match in the fast implementation | [
"but",
"match",
"in",
"the",
"fast",
"implementation"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/matchers/FirstOfStringsMatcher.java#L132-L152 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.findNode | public static <V> Node<V> findNode(Node<V> parent, Predicate<Node<V>> predicate) {
checkArgNotNull(predicate, "predicate");
if (parent != null) {
if (predicate.apply(parent)) return parent;
if (hasChildren(parent)) {
Node<V> found = findNode(parent.getChildren(), ... | java | public static <V> Node<V> findNode(Node<V> parent, Predicate<Node<V>> predicate) {
checkArgNotNull(predicate, "predicate");
if (parent != null) {
if (predicate.apply(parent)) return parent;
if (hasChildren(parent)) {
Node<V> found = findNode(parent.getChildren(), ... | [
"public",
"static",
"<",
"V",
">",
"Node",
"<",
"V",
">",
"findNode",
"(",
"Node",
"<",
"V",
">",
"parent",
",",
"Predicate",
"<",
"Node",
"<",
"V",
">",
">",
"predicate",
")",
"{",
"checkArgNotNull",
"(",
"predicate",
",",
"\"predicate\"",
")",
";",... | Returns the first node underneath the given parent for which the given predicate evaluates to true.
If parent is null or no node is found the method returns null.
@param parent the parent Node
@param predicate the predicate
@return the Node if found or null if not found | [
"Returns",
"the",
"first",
"node",
"underneath",
"the",
"given",
"parent",
"for",
"which",
"the",
"given",
"predicate",
"evaluates",
"to",
"true",
".",
"If",
"parent",
"is",
"null",
"or",
"no",
"node",
"is",
"found",
"the",
"method",
"returns",
"null",
"."... | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L143-L153 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.