id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,000 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/marshalling/impl/ProcessInstanceResolverStrategy.java | ProcessInstanceResolverStrategy.connectProcessInstanceToRuntimeAndProcess | private void connectProcessInstanceToRuntimeAndProcess(ProcessInstance processInstance,
Object streamContext) {
ProcessInstanceImpl processInstanceImpl = (ProcessInstanceImpl) processInstance;
InternalKnowledgeRuntime kruntime = processInstanceI... | java | private void connectProcessInstanceToRuntimeAndProcess(ProcessInstance processInstance,
Object streamContext) {
ProcessInstanceImpl processInstanceImpl = (ProcessInstanceImpl) processInstance;
InternalKnowledgeRuntime kruntime = processInstanceI... | [
"private",
"void",
"connectProcessInstanceToRuntimeAndProcess",
"(",
"ProcessInstance",
"processInstance",
",",
"Object",
"streamContext",
")",
"{",
"ProcessInstanceImpl",
"processInstanceImpl",
"=",
"(",
"ProcessInstanceImpl",
")",
"processInstance",
";",
"InternalKnowledgeRun... | Fill the process instance .kruntime and .process fields with the appropriate values.
@param processInstance
@param streamContext | [
"Fill",
"the",
"process",
"instance",
".",
"kruntime",
"and",
".",
"process",
"fields",
"with",
"the",
"appropriate",
"values",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/marshalling/impl/ProcessInstanceResolverStrategy.java#L117-L137 |
23,001 | kiegroup/jbpm | jbpm-audit/src/main/java/org/jbpm/process/audit/JPAWorkingMemoryDbLogger.java | JPAWorkingMemoryDbLogger.getEntityManager | private EntityManager getEntityManager(KieRuntimeEvent event) {
Environment env = event.getKieRuntime().getEnvironment();
/**
* It's important to set the sharedEM flag with _every_ operation
* otherwise, there are situations where:
* 1. it can be set to "true... | java | private EntityManager getEntityManager(KieRuntimeEvent event) {
Environment env = event.getKieRuntime().getEnvironment();
/**
* It's important to set the sharedEM flag with _every_ operation
* otherwise, there are situations where:
* 1. it can be set to "true... | [
"private",
"EntityManager",
"getEntityManager",
"(",
"KieRuntimeEvent",
"event",
")",
"{",
"Environment",
"env",
"=",
"event",
".",
"getKieRuntime",
"(",
")",
".",
"getEnvironment",
"(",
")",
";",
"/**\n * It's important to set the sharedEM flag with _every_ operati... | This method creates a entity manager. | [
"This",
"method",
"creates",
"a",
"entity",
"manager",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-audit/src/main/java/org/jbpm/process/audit/JPAWorkingMemoryDbLogger.java#L254-L291 |
23,002 | kiegroup/jbpm | jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SingletonRuntimeManager.java | SingletonRuntimeManager.getPersistedSessionId | protected Long getPersistedSessionId(String location, String identifier) {
File sessionIdStore = new File(location + File.separator + identifier+ "-jbpmSessionId.ser");
if (sessionIdStore.exists()) {
Long knownSessionId = null;
FileInputStream fis = null;
ObjectInputStr... | java | protected Long getPersistedSessionId(String location, String identifier) {
File sessionIdStore = new File(location + File.separator + identifier+ "-jbpmSessionId.ser");
if (sessionIdStore.exists()) {
Long knownSessionId = null;
FileInputStream fis = null;
ObjectInputStr... | [
"protected",
"Long",
"getPersistedSessionId",
"(",
"String",
"location",
",",
"String",
"identifier",
")",
"{",
"File",
"sessionIdStore",
"=",
"new",
"File",
"(",
"location",
"+",
"File",
".",
"separator",
"+",
"identifier",
"+",
"\"-jbpmSessionId.ser\"",
")",
"... | Retrieves session id from serialized file named jbpmSessionId.ser from given location.
@param location directory where jbpmSessionId.ser file should be
@param identifier of the manager owning this ksessionId
@return sessionId if file was found otherwise 0 | [
"Retrieves",
"session",
"id",
"from",
"serialized",
"file",
"named",
"jbpmSessionId",
".",
"ser",
"from",
"given",
"location",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SingletonRuntimeManager.java#L246-L285 |
23,003 | kiegroup/jbpm | jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SingletonRuntimeManager.java | SingletonRuntimeManager.persistSessionId | protected void persistSessionId(String location, String identifier, Long ksessionId) {
if (location == null) {
return;
}
FileOutputStream fos = null;
ObjectOutputStream out = null;
try {
fos = new FileOutputStream(location + File.separator + identifier + "... | java | protected void persistSessionId(String location, String identifier, Long ksessionId) {
if (location == null) {
return;
}
FileOutputStream fos = null;
ObjectOutputStream out = null;
try {
fos = new FileOutputStream(location + File.separator + identifier + "... | [
"protected",
"void",
"persistSessionId",
"(",
"String",
"location",
",",
"String",
"identifier",
",",
"Long",
"ksessionId",
")",
"{",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"return",
";",
"}",
"FileOutputStream",
"fos",
"=",
"null",
";",
"ObjectOutpu... | Stores gives ksessionId in a serialized file in given location under jbpmSessionId.ser file name
@param location directory where serialized file should be stored
@param identifier of the manager owning this ksessionId
@param ksessionId value of ksessionId to be stored | [
"Stores",
"gives",
"ksessionId",
"in",
"a",
"serialized",
"file",
"in",
"given",
"location",
"under",
"jbpmSessionId",
".",
"ser",
"file",
"name"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SingletonRuntimeManager.java#L293-L320 |
23,004 | kiegroup/jbpm | jbpm-document/src/main/java/org/jbpm/document/service/impl/DocumentStorageServiceImpl.java | DocumentStorageServiceImpl.generateUniquePath | protected String generateUniquePath() {
File parent;
String destinationPath;
do {
destinationPath = UUID.randomUUID().toString();
parent = getFileByPath(destinationPath);
} while (parent.exists());
return destinationPath;
} | java | protected String generateUniquePath() {
File parent;
String destinationPath;
do {
destinationPath = UUID.randomUUID().toString();
parent = getFileByPath(destinationPath);
} while (parent.exists());
return destinationPath;
} | [
"protected",
"String",
"generateUniquePath",
"(",
")",
"{",
"File",
"parent",
";",
"String",
"destinationPath",
";",
"do",
"{",
"destinationPath",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"parent",
"=",
"getFileByPath",
"(",
... | Generates a random path to store the file to avoid overwritting files with the same name
@return A String containging the path where the document is going to be stored. | [
"Generates",
"a",
"random",
"path",
"to",
"store",
"the",
"file",
"to",
"avoid",
"overwritting",
"files",
"with",
"the",
"same",
"name"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-document/src/main/java/org/jbpm/document/service/impl/DocumentStorageServiceImpl.java#L178-L188 |
23,005 | kiegroup/jbpm | jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/xml/StartEventHandler.java | StartEventHandler.readDataOutput | protected void readDataOutput(org.w3c.dom.Node xmlNode, StartNode startNode) {
String id = ((Element) xmlNode).getAttribute("id");
String outputName = ((Element) xmlNode).getAttribute("name");
dataOutputs.put(id, outputName);
} | java | protected void readDataOutput(org.w3c.dom.Node xmlNode, StartNode startNode) {
String id = ((Element) xmlNode).getAttribute("id");
String outputName = ((Element) xmlNode).getAttribute("name");
dataOutputs.put(id, outputName);
} | [
"protected",
"void",
"readDataOutput",
"(",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"xmlNode",
",",
"StartNode",
"startNode",
")",
"{",
"String",
"id",
"=",
"(",
"(",
"Element",
")",
"xmlNode",
")",
".",
"getAttribute",
"(",
"\"id\"",
")",
";",
"St... | The results of this method are only used to check syntax | [
"The",
"results",
"of",
"this",
"method",
"are",
"only",
"used",
"to",
"check",
"syntax"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/xml/StartEventHandler.java#L242-L246 |
23,006 | kiegroup/jbpm | jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java | ClassCacheManager.findCommand | public Command findCommand(String name, ClassLoader cl) {
synchronized (commandCache) {
if (!commandCache.containsKey(name)) {
try {
Command commandInstance = (Command) Class.forName(name, true, cl).newInstance();
... | java | public Command findCommand(String name, ClassLoader cl) {
synchronized (commandCache) {
if (!commandCache.containsKey(name)) {
try {
Command commandInstance = (Command) Class.forName(name, true, cl).newInstance();
... | [
"public",
"Command",
"findCommand",
"(",
"String",
"name",
",",
"ClassLoader",
"cl",
")",
"{",
"synchronized",
"(",
"commandCache",
")",
"{",
"if",
"(",
"!",
"commandCache",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"try",
"{",
"Command",
"commandIns... | Finds command by FQCN and if not found loads the class and store the instance in
the cache.
@param name - fully qualified class name of the command
@return initialized class instance | [
"Finds",
"command",
"by",
"FQCN",
"and",
"if",
"not",
"found",
"loads",
"the",
"class",
"and",
"store",
"the",
"instance",
"in",
"the",
"cache",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java#L51-L79 |
23,007 | kiegroup/jbpm | jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java | ClassCacheManager.findCommandCallback | public CommandCallback findCommandCallback(String name, ClassLoader cl) {
synchronized (callbackCache) {
if (!callbackCache.containsKey(name)) {
try {
CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstanc... | java | public CommandCallback findCommandCallback(String name, ClassLoader cl) {
synchronized (callbackCache) {
if (!callbackCache.containsKey(name)) {
try {
CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstanc... | [
"public",
"CommandCallback",
"findCommandCallback",
"(",
"String",
"name",
",",
"ClassLoader",
"cl",
")",
"{",
"synchronized",
"(",
"callbackCache",
")",
"{",
"if",
"(",
"!",
"callbackCache",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"try",
"{",
"Comma... | Finds command callback by FQCN and if not found loads the class and store the instance in
the cache.
@param name - fully qualified class name of the command callback
@return initialized class instance | [
"Finds",
"command",
"callback",
"by",
"FQCN",
"and",
"if",
"not",
"found",
"loads",
"the",
"class",
"and",
"store",
"the",
"instance",
"in",
"the",
"cache",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java#L87-L114 |
23,008 | kiegroup/jbpm | jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java | ClassCacheManager.buildCommandCallback | public List<CommandCallback> buildCommandCallback(CommandContext ctx, ClassLoader cl) {
List<CommandCallback> callbackList = new ArrayList<CommandCallback>();
if (ctx != null && ctx.getData("callbacks") != null) {
logger.debug("Callback: {}", ctx.getData("callbacks"));
String[] c... | java | public List<CommandCallback> buildCommandCallback(CommandContext ctx, ClassLoader cl) {
List<CommandCallback> callbackList = new ArrayList<CommandCallback>();
if (ctx != null && ctx.getData("callbacks") != null) {
logger.debug("Callback: {}", ctx.getData("callbacks"));
String[] c... | [
"public",
"List",
"<",
"CommandCallback",
">",
"buildCommandCallback",
"(",
"CommandContext",
"ctx",
",",
"ClassLoader",
"cl",
")",
"{",
"List",
"<",
"CommandCallback",
">",
"callbackList",
"=",
"new",
"ArrayList",
"<",
"CommandCallback",
">",
"(",
")",
";",
"... | Builds completely initialized list of callbacks for given context.
@param ctx contextual data given by execution service
@return | [
"Builds",
"completely",
"initialized",
"list",
"of",
"callbacks",
"for",
"given",
"context",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java#L121-L133 |
23,009 | kiegroup/jbpm | jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/data/QueryWhere.java | QueryWhere.clear | public void clear() {
this.union = true;
this.type = QueryCriteriaType.NORMAL;
this.ancestry.clear();
if( this.criteria != null ) {
this.criteria.clear();
}
this.currentCriteria = this.criteria;
this.maxResults = null;
this.offset = null;
... | java | public void clear() {
this.union = true;
this.type = QueryCriteriaType.NORMAL;
this.ancestry.clear();
if( this.criteria != null ) {
this.criteria.clear();
}
this.currentCriteria = this.criteria;
this.maxResults = null;
this.offset = null;
... | [
"public",
"void",
"clear",
"(",
")",
"{",
"this",
".",
"union",
"=",
"true",
";",
"this",
".",
"type",
"=",
"QueryCriteriaType",
".",
"NORMAL",
";",
"this",
".",
"ancestry",
".",
"clear",
"(",
")",
";",
"if",
"(",
"this",
".",
"criteria",
"!=",
"nu... | clear & clone | [
"clear",
"&",
"clone"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/data/QueryWhere.java#L312-L327 |
23,010 | kiegroup/jbpm | jbpm-audit/src/main/java/org/jbpm/process/audit/query/AbstractAuditDeleteBuilderImpl.java | AbstractAuditDeleteBuilderImpl.date | @SuppressWarnings("unchecked")
public T date( Date... date ) {
if (checkIfNull(date)) {
return (T) this;
}
date = ensureDateNotTimestamp(date);
addObjectParameter(DATE_LIST, "date", date);
return (T) this;
} | java | @SuppressWarnings("unchecked")
public T date( Date... date ) {
if (checkIfNull(date)) {
return (T) this;
}
date = ensureDateNotTimestamp(date);
addObjectParameter(DATE_LIST, "date", date);
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"date",
"(",
"Date",
"...",
"date",
")",
"{",
"if",
"(",
"checkIfNull",
"(",
"date",
")",
")",
"{",
"return",
"(",
"T",
")",
"this",
";",
"}",
"date",
"=",
"ensureDateNotTimestamp",
"("... | query builder methods | [
"query",
"builder",
"methods"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-audit/src/main/java/org/jbpm/process/audit/query/AbstractAuditDeleteBuilderImpl.java#L74-L82 |
23,011 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/assignment/AssignmentServiceProvider.java | AssignmentServiceProvider.override | static AssignmentService override(AssignmentStrategy strategy) {
Holder.INSTANCE.setAssignmentService(new AssignmentServiceImpl(strategy));
return get();
} | java | static AssignmentService override(AssignmentStrategy strategy) {
Holder.INSTANCE.setAssignmentService(new AssignmentServiceImpl(strategy));
return get();
} | [
"static",
"AssignmentService",
"override",
"(",
"AssignmentStrategy",
"strategy",
")",
"{",
"Holder",
".",
"INSTANCE",
".",
"setAssignmentService",
"(",
"new",
"AssignmentServiceImpl",
"(",
"strategy",
")",
")",
";",
"return",
"get",
"(",
")",
";",
"}"
] | for test purpose | [
"for",
"test",
"purpose"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/assignment/AssignmentServiceProvider.java#L48-L52 |
23,012 | kiegroup/jbpm | jbpm-case-mgmt/jbpm-case-mgmt-impl/src/main/java/org/jbpm/casemgmt/impl/marshalling/CaseMarshallerFactory.java | CaseMarshallerFactory.withJpa | public CaseMarshallerFactory withJpa(String puName) {
marshallers.add(new JPAPlaceholderResolverStrategy(puName, classLoader));
this.toString.append(".withJpa(\"" + puName + "\")");
return this;
} | java | public CaseMarshallerFactory withJpa(String puName) {
marshallers.add(new JPAPlaceholderResolverStrategy(puName, classLoader));
this.toString.append(".withJpa(\"" + puName + "\")");
return this;
} | [
"public",
"CaseMarshallerFactory",
"withJpa",
"(",
"String",
"puName",
")",
"{",
"marshallers",
".",
"add",
"(",
"new",
"JPAPlaceholderResolverStrategy",
"(",
"puName",
",",
"classLoader",
")",
")",
";",
"this",
".",
"toString",
".",
"append",
"(",
"\".withJpa(\... | Add JPA marshalling strategy to be used by CaseFileMarshaller
@param puName persistence unit name to be used
@return this factory instance | [
"Add",
"JPA",
"marshalling",
"strategy",
"to",
"be",
"used",
"by",
"CaseFileMarshaller"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-case-mgmt/jbpm-case-mgmt-impl/src/main/java/org/jbpm/casemgmt/impl/marshalling/CaseMarshallerFactory.java#L64-L68 |
23,013 | kiegroup/jbpm | jbpm-case-mgmt/jbpm-case-mgmt-impl/src/main/java/org/jbpm/casemgmt/impl/marshalling/CaseMarshallerFactory.java | CaseMarshallerFactory.with | public CaseMarshallerFactory with(ObjectMarshallingStrategy custom) {
marshallers.add(custom);
this.toString.append(".with(new " + custom.getClass().getName() + "())");
return this;
} | java | public CaseMarshallerFactory with(ObjectMarshallingStrategy custom) {
marshallers.add(custom);
this.toString.append(".with(new " + custom.getClass().getName() + "())");
return this;
} | [
"public",
"CaseMarshallerFactory",
"with",
"(",
"ObjectMarshallingStrategy",
"custom",
")",
"{",
"marshallers",
".",
"add",
"(",
"custom",
")",
";",
"this",
".",
"toString",
".",
"append",
"(",
"\".with(new \"",
"+",
"custom",
".",
"getClass",
"(",
")",
".",
... | Adds given custom marshalling strategy to be used by CaseFileMarshaller
@param custom any marshalling strategy fully configured
@return this factory instance | [
"Adds",
"given",
"custom",
"marshalling",
"strategy",
"to",
"be",
"used",
"by",
"CaseFileMarshaller"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-case-mgmt/jbpm-case-mgmt-impl/src/main/java/org/jbpm/casemgmt/impl/marshalling/CaseMarshallerFactory.java#L75-L79 |
23,014 | kiegroup/jbpm | jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/commands/error/AutoAckErrorCommand.java | AutoAckErrorCommand.getScheduleTime | @Override
public Date getScheduleTime() {
if (nextScheduleTimeAdd < 0) {
return null;
}
long current = System.currentTimeMillis();
Date nextSchedule = new Date(current + nextScheduleTimeAdd);
logger.debug("Next schedule for job {} is set to {}", this.getClass().getSimpleName(), nextSchedule);
r... | java | @Override
public Date getScheduleTime() {
if (nextScheduleTimeAdd < 0) {
return null;
}
long current = System.currentTimeMillis();
Date nextSchedule = new Date(current + nextScheduleTimeAdd);
logger.debug("Next schedule for job {} is set to {}", this.getClass().getSimpleName(), nextSchedule);
r... | [
"@",
"Override",
"public",
"Date",
"getScheduleTime",
"(",
")",
"{",
"if",
"(",
"nextScheduleTimeAdd",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"long",
"current",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Date",
"nextSchedule",
"=",
... | one day in milliseconds | [
"one",
"day",
"in",
"milliseconds"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/commands/error/AutoAckErrorCommand.java#L45-L57 |
23,015 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/utils/LdapSearcher.java | LdapSearcher.search | public LdapSearcher search(String context, String filterExpr, Object... filterArgs) {
searchResults.clear();
LdapContext ldapContext = null;
NamingEnumeration<SearchResult> ldapResult = null;
try {
ldapContext = buildLdapContext();
ldapResult = ldapContext.search... | java | public LdapSearcher search(String context, String filterExpr, Object... filterArgs) {
searchResults.clear();
LdapContext ldapContext = null;
NamingEnumeration<SearchResult> ldapResult = null;
try {
ldapContext = buildLdapContext();
ldapResult = ldapContext.search... | [
"public",
"LdapSearcher",
"search",
"(",
"String",
"context",
",",
"String",
"filterExpr",
",",
"Object",
"...",
"filterArgs",
")",
"{",
"searchResults",
".",
"clear",
"(",
")",
";",
"LdapContext",
"ldapContext",
"=",
"null",
";",
"NamingEnumeration",
"<",
"Se... | Search LDAP and stores the results in searchResults field.
@param context the name of the context where the search starts (the depth depends on ldap.search.scope)
@param filterExpr the filter expression to use for the search. The expression may contain variables of the form
"<code>{i}</code>" where <code>i</code> is a ... | [
"Search",
"LDAP",
"and",
"stores",
"the",
"results",
"in",
"searchResults",
"field",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/utils/LdapSearcher.java#L69-L100 |
23,016 | kiegroup/jbpm | jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/data/QueryCriteria.java | QueryCriteria.getParameters | public List<Object> getParameters() {
List<Object> parameters = new ArrayList<Object>(getValues());
if( this.dateValues != null && ! this.dateValues.isEmpty() ) {
parameters.addAll(this.dateValues);
}
if( parameters.isEmpty() ) {
return parameters;
}
... | java | public List<Object> getParameters() {
List<Object> parameters = new ArrayList<Object>(getValues());
if( this.dateValues != null && ! this.dateValues.isEmpty() ) {
parameters.addAll(this.dateValues);
}
if( parameters.isEmpty() ) {
return parameters;
}
... | [
"public",
"List",
"<",
"Object",
">",
"getParameters",
"(",
")",
"{",
"List",
"<",
"Object",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
"getValues",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"dateValues",
"!=",
"null",
"&&... | This method returns a list that should only be read
@return | [
"This",
"method",
"returns",
"a",
"list",
"that",
"should",
"only",
"be",
"read"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/data/QueryCriteria.java#L219-L228 |
23,017 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/process/core/event/NonAcceptingEventTypeFilter.java | NonAcceptingEventTypeFilter.acceptsEvent | @Override
public boolean acceptsEvent(String type, Object event, Function<String, String> resolver) {
return false;
} | java | @Override
public boolean acceptsEvent(String type, Object event, Function<String, String> resolver) {
return false;
} | [
"@",
"Override",
"public",
"boolean",
"acceptsEvent",
"(",
"String",
"type",
",",
"Object",
"event",
",",
"Function",
"<",
"String",
",",
"String",
">",
"resolver",
")",
"{",
"return",
"false",
";",
"}"
] | Nodes that use this event filter should never be triggered by this event | [
"Nodes",
"that",
"use",
"this",
"event",
"filter",
"should",
"never",
"be",
"triggered",
"by",
"this",
"event"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/process/core/event/NonAcceptingEventTypeFilter.java#L37-L40 |
23,018 | kiegroup/jbpm | jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/service/ServiceRegistry.java | ServiceRegistry.service | public Object service(String name) {
Object service = this.services.get(name);
if (service == null) {
throw new IllegalArgumentException("Service '" + name + "' not found");
}
return service;
} | java | public Object service(String name) {
Object service = this.services.get(name);
if (service == null) {
throw new IllegalArgumentException("Service '" + name + "' not found");
}
return service;
} | [
"public",
"Object",
"service",
"(",
"String",
"name",
")",
"{",
"Object",
"service",
"=",
"this",
".",
"services",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Servic... | Retrieves service registered under given name
@param name name of the service
@return instance of the service registered with given name
@throws IllegalArgumentException thrown in case service with given name is not registered | [
"Retrieves",
"service",
"registered",
"under",
"given",
"name"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/service/ServiceRegistry.java#L93-L99 |
23,019 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/audit/TaskAuditLoggerFactory.java | TaskAuditLoggerFactory.newJMSInstance | public static AsyncTaskLifeCycleEventProducer newJMSInstance(boolean transacted, ConnectionFactory connFactory, Queue queue) {
AsyncTaskLifeCycleEventProducer logger = new AsyncTaskLifeCycleEventProducer();
logger.setTransacted(transacted);
logger.setConnectionFactory(connFactory);
logge... | java | public static AsyncTaskLifeCycleEventProducer newJMSInstance(boolean transacted, ConnectionFactory connFactory, Queue queue) {
AsyncTaskLifeCycleEventProducer logger = new AsyncTaskLifeCycleEventProducer();
logger.setTransacted(transacted);
logger.setConnectionFactory(connFactory);
logge... | [
"public",
"static",
"AsyncTaskLifeCycleEventProducer",
"newJMSInstance",
"(",
"boolean",
"transacted",
",",
"ConnectionFactory",
"connFactory",
",",
"Queue",
"queue",
")",
"{",
"AsyncTaskLifeCycleEventProducer",
"logger",
"=",
"new",
"AsyncTaskLifeCycleEventProducer",
"(",
... | Creates new instance of JMS task audit logger based on given connection factory and queue.
@param transacted determines if JMS session is transacted or not
@param connFactory connection factory instance
@param queue JMS queue instance
@return new instance of JMS task audit logger | [
"Creates",
"new",
"instance",
"of",
"JMS",
"task",
"audit",
"logger",
"based",
"on",
"given",
"connection",
"factory",
"and",
"queue",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/audit/TaskAuditLoggerFactory.java#L109-L116 |
23,020 | kiegroup/jbpm | jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SimpleRuntimeEnvironment.java | SimpleRuntimeEnvironment.addAsset | public void addAsset(Resource resource, ResourceType type) {
/**
* The code below (CSV/XLS) was added because of timelines related to switchyard/fuse.
*
* However, it is an ugly hack: As soon as is possible, the code below should be removed or refactored.
* - an "addAsset(... | java | public void addAsset(Resource resource, ResourceType type) {
/**
* The code below (CSV/XLS) was added because of timelines related to switchyard/fuse.
*
* However, it is an ugly hack: As soon as is possible, the code below should be removed or refactored.
* - an "addAsset(... | [
"public",
"void",
"addAsset",
"(",
"Resource",
"resource",
",",
"ResourceType",
"type",
")",
"{",
"/**\n * The code below (CSV/XLS) was added because of timelines related to switchyard/fuse.\n * \n * However, it is an ugly hack: As soon as is possible, the code below s... | Adds given asset to knowledge builder to produce KieBase
@param resource asset to be added
@param type type of the asset | [
"Adds",
"given",
"asset",
"to",
"knowledge",
"builder",
"to",
"produce",
"KieBase"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SimpleRuntimeEnvironment.java#L115-L175 |
23,021 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java | TaskDataImpl.addComment | public void addComment(Comment comment) {
if (comments == null || comments.size() == 0) {
comments = new ArrayList<Comment>();
}
comments.add((CommentImpl) comment);
} | java | public void addComment(Comment comment) {
if (comments == null || comments.size() == 0) {
comments = new ArrayList<Comment>();
}
comments.add((CommentImpl) comment);
} | [
"public",
"void",
"addComment",
"(",
"Comment",
"comment",
")",
"{",
"if",
"(",
"comments",
"==",
"null",
"||",
"comments",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"comments",
"=",
"new",
"ArrayList",
"<",
"Comment",
">",
"(",
")",
";",
"}",
"c... | Adds the specified comment to our list of comments.
@param comment comment to add | [
"Adds",
"the",
"specified",
"comment",
"to",
"our",
"list",
"of",
"comments",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java#L653-L659 |
23,022 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java | TaskDataImpl.removeComment | public Comment removeComment(final long commentId) {
Comment removedComment = null;
if (comments != null) {
for (int index = comments.size() - 1; index >= 0; --index) {
Comment currentComment = comments.get(index);
if (currentComment.getId() == commentId) {
... | java | public Comment removeComment(final long commentId) {
Comment removedComment = null;
if (comments != null) {
for (int index = comments.size() - 1; index >= 0; --index) {
Comment currentComment = comments.get(index);
if (currentComment.getId() == commentId) {
... | [
"public",
"Comment",
"removeComment",
"(",
"final",
"long",
"commentId",
")",
"{",
"Comment",
"removedComment",
"=",
"null",
";",
"if",
"(",
"comments",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"comments",
".",
"size",
"(",
")",
"-",
"1... | Removes the Comment specified by the commentId.
@param commentId id of Comment to remove
@return removed Comment or null if one was not found with the id | [
"Removes",
"the",
"Comment",
"specified",
"by",
"the",
"commentId",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java#L667-L682 |
23,023 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java | TaskDataImpl.addAttachment | public void addAttachment(Attachment attachment) {
if (attachments == null || attachments == Collections.<Attachment>emptyList()) {
attachments = new ArrayList<Attachment>();
}
attachments.add((AttachmentImpl) attachment);
} | java | public void addAttachment(Attachment attachment) {
if (attachments == null || attachments == Collections.<Attachment>emptyList()) {
attachments = new ArrayList<Attachment>();
}
attachments.add((AttachmentImpl) attachment);
} | [
"public",
"void",
"addAttachment",
"(",
"Attachment",
"attachment",
")",
"{",
"if",
"(",
"attachments",
"==",
"null",
"||",
"attachments",
"==",
"Collections",
".",
"<",
"Attachment",
">",
"emptyList",
"(",
")",
")",
"{",
"attachments",
"=",
"new",
"ArrayLis... | Adds the specified attachment to our list of Attachments.
@param attachment attachment to add | [
"Adds",
"the",
"specified",
"attachment",
"to",
"our",
"list",
"of",
"Attachments",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java#L697-L703 |
23,024 | kiegroup/jbpm | jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java | TaskDataImpl.removeAttachment | public Attachment removeAttachment(final long attachmentId) {
Attachment removedAttachment = null;
if (attachments != null) {
for (int index = attachments.size() - 1; index >= 0; --index) {
Attachment currentAttachment = attachments.get(index);
if (currentAt... | java | public Attachment removeAttachment(final long attachmentId) {
Attachment removedAttachment = null;
if (attachments != null) {
for (int index = attachments.size() - 1; index >= 0; --index) {
Attachment currentAttachment = attachments.get(index);
if (currentAt... | [
"public",
"Attachment",
"removeAttachment",
"(",
"final",
"long",
"attachmentId",
")",
"{",
"Attachment",
"removedAttachment",
"=",
"null",
";",
"if",
"(",
"attachments",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"attachments",
".",
"size",
"(... | Removes the Attachment specified by the attachmentId.
@param attachmentId id of attachment to remove
@return removed Attachment or null if one was not found with the id | [
"Removes",
"the",
"Attachment",
"specified",
"by",
"the",
"attachmentId",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java#L711-L726 |
23,025 | kiegroup/jbpm | jbpm-services/jbpm-services-ejb/jbpm-services-ejb-impl/src/main/java/org/jbpm/services/ejb/impl/DeploymentServiceEJBImpl.java | DeploymentServiceEJBImpl.setBpmn2Service | @EJB(beanInterface=DefinitionServiceEJBLocal.class)
@Override
public void setBpmn2Service(DefinitionService bpmn2Service) {
super.setBpmn2Service(bpmn2Service);
super.addListener((DeploymentEventListener) bpmn2Service);
} | java | @EJB(beanInterface=DefinitionServiceEJBLocal.class)
@Override
public void setBpmn2Service(DefinitionService bpmn2Service) {
super.setBpmn2Service(bpmn2Service);
super.addListener((DeploymentEventListener) bpmn2Service);
} | [
"@",
"EJB",
"(",
"beanInterface",
"=",
"DefinitionServiceEJBLocal",
".",
"class",
")",
"@",
"Override",
"public",
"void",
"setBpmn2Service",
"(",
"DefinitionService",
"bpmn2Service",
")",
"{",
"super",
".",
"setBpmn2Service",
"(",
"bpmn2Service",
")",
";",
"super"... | inject ejb beans | [
"inject",
"ejb",
"beans"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-ejb/jbpm-services-ejb-impl/src/main/java/org/jbpm/services/ejb/impl/DeploymentServiceEJBImpl.java#L105-L111 |
23,026 | kiegroup/jbpm | jbpm-case-mgmt/jbpm-case-mgmt-api/src/main/java/org/jbpm/casemgmt/api/admin/CaseMigrationReport.java | CaseMigrationReport.complete | public void complete() {
this.endDate = new Date();
if (reports.stream().allMatch(report -> report.isSuccessful() == true)) {
this.successful = true;
}
} | java | public void complete() {
this.endDate = new Date();
if (reports.stream().allMatch(report -> report.isSuccessful() == true)) {
this.successful = true;
}
} | [
"public",
"void",
"complete",
"(",
")",
"{",
"this",
".",
"endDate",
"=",
"new",
"Date",
"(",
")",
";",
"if",
"(",
"reports",
".",
"stream",
"(",
")",
".",
"allMatch",
"(",
"report",
"->",
"report",
".",
"isSuccessful",
"(",
")",
"==",
"true",
")",... | Completes the migration and calculates the status. | [
"Completes",
"the",
"migration",
"and",
"calculates",
"the",
"status",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-case-mgmt/jbpm-case-mgmt-api/src/main/java/org/jbpm/casemgmt/api/admin/CaseMigrationReport.java#L79-L85 |
23,027 | kiegroup/jbpm | jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/query/QueryMapperRegistry.java | QueryMapperRegistry.mapperFor | public QueryResultMapper<?> mapperFor(String name, Map<String, String> columnMapping) {
if (!knownMappers.containsKey(name)) {
throw new IllegalArgumentException("No mapper found with name " + name);
}
if (columnMapping == null) {
return knownMappers.get(name);
} ... | java | public QueryResultMapper<?> mapperFor(String name, Map<String, String> columnMapping) {
if (!knownMappers.containsKey(name)) {
throw new IllegalArgumentException("No mapper found with name " + name);
}
if (columnMapping == null) {
return knownMappers.get(name);
} ... | [
"public",
"QueryResultMapper",
"<",
"?",
">",
"mapperFor",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"String",
">",
"columnMapping",
")",
"{",
"if",
"(",
"!",
"knownMappers",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"throw",
"new",
... | Returns mapper for given name if found
@param name unique name that mapper is bound to
@param columnMapping provides column mapping (name to type) that can be
shipped to mapper for improved transformation - can be null (accepted types: string, long, integer, date, double)
@return instance of the <code>QueryResultMapper... | [
"Returns",
"mapper",
"for",
"given",
"name",
"if",
"found"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/query/QueryMapperRegistry.java#L64-L73 |
23,028 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/process/core/timer/TimerServiceRegistry.java | TimerServiceRegistry.registerTimerService | public void registerTimerService(String id, TimerService timerService) {
if (timerService instanceof GlobalTimerService) {
((GlobalTimerService) timerService).setTimerServiceId(id);
}
this.registeredServices.put(id, timerService);
} | java | public void registerTimerService(String id, TimerService timerService) {
if (timerService instanceof GlobalTimerService) {
((GlobalTimerService) timerService).setTimerServiceId(id);
}
this.registeredServices.put(id, timerService);
} | [
"public",
"void",
"registerTimerService",
"(",
"String",
"id",
",",
"TimerService",
"timerService",
")",
"{",
"if",
"(",
"timerService",
"instanceof",
"GlobalTimerService",
")",
"{",
"(",
"(",
"GlobalTimerService",
")",
"timerService",
")",
".",
"setTimerServiceId",... | Registers timerServie under given id. In case timer service is already registered
with this id it will be overridden.
@param id key used to get hold of the timer service instance
@param timerService fully initialized TimerService instance | [
"Registers",
"timerServie",
"under",
"given",
"id",
".",
"In",
"case",
"timer",
"service",
"is",
"already",
"registered",
"with",
"this",
"id",
"it",
"will",
"be",
"overridden",
"."
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/process/core/timer/TimerServiceRegistry.java#L48-L53 |
23,029 | kiegroup/jbpm | jbpm-flow/src/main/java/org/jbpm/process/core/timer/TimerServiceRegistry.java | TimerServiceRegistry.get | public TimerService get(String id) {
if (id == null) {
return null;
}
return this.registeredServices.get(id);
} | java | public TimerService get(String id) {
if (id == null) {
return null;
}
return this.registeredServices.get(id);
} | [
"public",
"TimerService",
"get",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"this",
".",
"registeredServices",
".",
"get",
"(",
"id",
")",
";",
"}"
] | Returns TimerService instance registered under given key
@param id timer service identifier
@return returns timer service instance or null of there was none registered with given id | [
"Returns",
"TimerService",
"instance",
"registered",
"under",
"given",
"key"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/process/core/timer/TimerServiceRegistry.java#L60-L65 |
23,030 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/BiomeGeneratorImplementation.java | BiomeGeneratorImplementation.onBiomeGenInit | @SubscribeEvent(priority = EventPriority.LOWEST)
public void onBiomeGenInit(WorldTypeEvent.InitBiomeGens event) {
// Negative one is flag value for normal world gen
if (bparams.getBiome() == -1)
return;
GenLayer[] replacement = new GenLayer[2];
replacement[0] = new GenLayerConstant(bparams.getBiome());
re... | java | @SubscribeEvent(priority = EventPriority.LOWEST)
public void onBiomeGenInit(WorldTypeEvent.InitBiomeGens event) {
// Negative one is flag value for normal world gen
if (bparams.getBiome() == -1)
return;
GenLayer[] replacement = new GenLayer[2];
replacement[0] = new GenLayerConstant(bparams.getBiome());
re... | [
"@",
"SubscribeEvent",
"(",
"priority",
"=",
"EventPriority",
".",
"LOWEST",
")",
"public",
"void",
"onBiomeGenInit",
"(",
"WorldTypeEvent",
".",
"InitBiomeGens",
"event",
")",
"{",
"// Negative one is flag value for normal world gen",
"if",
"(",
"bparams",
".",
"getB... | Make sure that the biome is one type with an event on biome gen | [
"Make",
"sure",
"that",
"the",
"biome",
"is",
"one",
"type",
"with",
"an",
"event",
"on",
"biome",
"gen"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/BiomeGeneratorImplementation.java#L84-L93 |
23,031 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java | CraftingHelper.itemStackIngredientsMatch | private static boolean itemStackIngredientsMatch(ItemStack A, ItemStack B)
{
if (A == null && B == null)
return true;
if (A == null || B == null)
return false;
if (A.getMetadata() == OreDictionary.WILDCARD_VALUE || B.getMetadata() == OreDictionary.WILDCARD_VALUE)
... | java | private static boolean itemStackIngredientsMatch(ItemStack A, ItemStack B)
{
if (A == null && B == null)
return true;
if (A == null || B == null)
return false;
if (A.getMetadata() == OreDictionary.WILDCARD_VALUE || B.getMetadata() == OreDictionary.WILDCARD_VALUE)
... | [
"private",
"static",
"boolean",
"itemStackIngredientsMatch",
"(",
"ItemStack",
"A",
",",
"ItemStack",
"B",
")",
"{",
"if",
"(",
"A",
"==",
"null",
"&&",
"B",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"A",
"==",
"null",
"||",
"B",
"==",
"nu... | Compare two ItemStacks and see if their items match - take wildcards into account, don't take stacksize into account.
@param A ItemStack A
@param B ItemStack B
@return true if the stacks contain matching items. | [
"Compare",
"two",
"ItemStacks",
"and",
"see",
"if",
"their",
"items",
"match",
"-",
"take",
"wildcards",
"into",
"account",
"don",
"t",
"take",
"stacksize",
"into",
"account",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L210-L219 |
23,032 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java | CraftingHelper.totalBurnTimeInInventory | public static int totalBurnTimeInInventory(EntityPlayerMP player)
{
Integer fromCache = fuelCaches.get(player);
int total = (fromCache != null) ? fromCache : 0;
for (int i = 0; i < player.inventory.mainInventory.size(); i++)
{
ItemStack is = player.inventory.mainInventory... | java | public static int totalBurnTimeInInventory(EntityPlayerMP player)
{
Integer fromCache = fuelCaches.get(player);
int total = (fromCache != null) ? fromCache : 0;
for (int i = 0; i < player.inventory.mainInventory.size(); i++)
{
ItemStack is = player.inventory.mainInventory... | [
"public",
"static",
"int",
"totalBurnTimeInInventory",
"(",
"EntityPlayerMP",
"player",
")",
"{",
"Integer",
"fromCache",
"=",
"fuelCaches",
".",
"get",
"(",
"player",
")",
";",
"int",
"total",
"=",
"(",
"fromCache",
"!=",
"null",
")",
"?",
"fromCache",
":",... | Go through player's inventory and see how much fuel they have.
@param player
@return the amount of fuel available in ticks | [
"Go",
"through",
"player",
"s",
"inventory",
"and",
"see",
"how",
"much",
"fuel",
"they",
"have",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L225-L235 |
23,033 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java | CraftingHelper.getRecipesForRequestedOutput | public static List<IRecipe> getRecipesForRequestedOutput(String output)
{
List<IRecipe> matchingRecipes = new ArrayList<IRecipe>();
ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
List<?> recipes = CraftingManager.getInstance().getRecipeList();
for (Ob... | java | public static List<IRecipe> getRecipesForRequestedOutput(String output)
{
List<IRecipe> matchingRecipes = new ArrayList<IRecipe>();
ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
List<?> recipes = CraftingManager.getInstance().getRecipeList();
for (Ob... | [
"public",
"static",
"List",
"<",
"IRecipe",
">",
"getRecipesForRequestedOutput",
"(",
"String",
"output",
")",
"{",
"List",
"<",
"IRecipe",
">",
"matchingRecipes",
"=",
"new",
"ArrayList",
"<",
"IRecipe",
">",
"(",
")",
";",
"ItemStack",
"target",
"=",
"Mine... | Attempt to find all recipes that result in an item of the requested output.
@param output the desired item, eg from Types.xsd - "diamond_pickaxe" etc - or as a Minecraft name - eg "tile.woolCarpet.blue"
@return a list of IRecipe objects that result in this item. | [
"Attempt",
"to",
"find",
"all",
"recipes",
"that",
"result",
"in",
"an",
"item",
"of",
"the",
"requested",
"output",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L329-L350 |
23,034 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java | CraftingHelper.getSmeltingRecipeForRequestedOutput | public static ItemStack getSmeltingRecipeForRequestedOutput(String output)
{
ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
Iterator<?> furnaceIt = FurnaceRecipes.instance().getSmeltingList().keySet().iterator();
while (furnaceIt.hasNext())
{
... | java | public static ItemStack getSmeltingRecipeForRequestedOutput(String output)
{
ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
Iterator<?> furnaceIt = FurnaceRecipes.instance().getSmeltingList().keySet().iterator();
while (furnaceIt.hasNext())
{
... | [
"public",
"static",
"ItemStack",
"getSmeltingRecipeForRequestedOutput",
"(",
"String",
"output",
")",
"{",
"ItemStack",
"target",
"=",
"MinecraftTypeHelper",
".",
"getItemStackFromParameterString",
"(",
"output",
")",
";",
"Iterator",
"<",
"?",
">",
"furnaceIt",
"=",
... | Attempt to find a smelting recipe that results in the requested output.
@param output
@return an ItemStack representing the required input. | [
"Attempt",
"to",
"find",
"a",
"smelting",
"recipe",
"that",
"results",
"in",
"the",
"requested",
"output",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L356-L368 |
23,035 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java | CraftingHelper.dumpRecipes | public static void dumpRecipes(String filename) throws IOException
{
FileOutputStream fos = new FileOutputStream(filename);
OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
BufferedWriter writer = new BufferedWriter(osw);
List<?> recipes = CraftingManager.getInstance().... | java | public static void dumpRecipes(String filename) throws IOException
{
FileOutputStream fos = new FileOutputStream(filename);
OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
BufferedWriter writer = new BufferedWriter(osw);
List<?> recipes = CraftingManager.getInstance().... | [
"public",
"static",
"void",
"dumpRecipes",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"filename",
")",
";",
"OutputStreamWriter",
"osw",
"=",
"new",
"OutputStreamWriter",
"(",
"fos"... | Little utility method for dumping out a list of all the recipes we understand.
@param filename location to save the dumped list.
@throws IOException | [
"Little",
"utility",
"method",
"for",
"dumping",
"out",
"a",
"list",
"of",
"all",
"the",
"recipes",
"we",
"understand",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/CraftingHelper.java#L527-L568 |
23,036 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Server/ServerStateMachine.java | ServerStateMachine.onCheckSpawn | @SubscribeEvent
public void onCheckSpawn(CheckSpawn cs)
{
// Decide whether or not to allow spawning.
// We shouldn't allow spawning unless it has been specifically turned on - whether
// a mission is running or not. (Otherwise spawning may happen in between missions.)
boolean al... | java | @SubscribeEvent
public void onCheckSpawn(CheckSpawn cs)
{
// Decide whether or not to allow spawning.
// We shouldn't allow spawning unless it has been specifically turned on - whether
// a mission is running or not. (Otherwise spawning may happen in between missions.)
boolean al... | [
"@",
"SubscribeEvent",
"public",
"void",
"onCheckSpawn",
"(",
"CheckSpawn",
"cs",
")",
"{",
"// Decide whether or not to allow spawning.",
"// We shouldn't allow spawning unless it has been specifically turned on - whether",
"// a mission is running or not. (Otherwise spawning may happen in ... | Called by Forge - return ALLOW, DENY or DEFAULT to control spawning in our world. | [
"Called",
"by",
"Forge",
"-",
"return",
"ALLOW",
"DENY",
"or",
"DEFAULT",
"to",
"control",
"spawning",
"in",
"our",
"world",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Server/ServerStateMachine.java#L256-L291 |
23,037 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java | JSONWorldDataHelper.buildAchievementStats | public static void buildAchievementStats(JsonObject json, EntityPlayerMP player)
{
StatisticsManagerServer sfw = player.getStatFile();
json.addProperty("DistanceTravelled",
sfw.readStat((StatBase)StatList.WALK_ONE_CM)
+ sfw.readStat((StatBase)StatList.SWIM_ONE_CM)
... | java | public static void buildAchievementStats(JsonObject json, EntityPlayerMP player)
{
StatisticsManagerServer sfw = player.getStatFile();
json.addProperty("DistanceTravelled",
sfw.readStat((StatBase)StatList.WALK_ONE_CM)
+ sfw.readStat((StatBase)StatList.SWIM_ONE_CM)
... | [
"public",
"static",
"void",
"buildAchievementStats",
"(",
"JsonObject",
"json",
",",
"EntityPlayerMP",
"player",
")",
"{",
"StatisticsManagerServer",
"sfw",
"=",
"player",
".",
"getStatFile",
"(",
")",
";",
"json",
".",
"addProperty",
"(",
"\"DistanceTravelled\"",
... | Builds the basic achievement world data to be used as observation signals by the listener.
@param json a JSON object into which the achievement stats will be added. | [
"Builds",
"the",
"basic",
"achievement",
"world",
"data",
"to",
"be",
"used",
"as",
"observation",
"signals",
"by",
"the",
"listener",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java#L100-L119 |
23,038 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java | JSONWorldDataHelper.buildLifeStats | public static void buildLifeStats(JsonObject json, EntityPlayerMP player)
{
json.addProperty("Life", player.getHealth());
json.addProperty("Score", player.getScore()); // Might always be the same as XP?
json.addProperty("Food", player.getFoodStats().getFoodLevel());
json.addProper... | java | public static void buildLifeStats(JsonObject json, EntityPlayerMP player)
{
json.addProperty("Life", player.getHealth());
json.addProperty("Score", player.getScore()); // Might always be the same as XP?
json.addProperty("Food", player.getFoodStats().getFoodLevel());
json.addProper... | [
"public",
"static",
"void",
"buildLifeStats",
"(",
"JsonObject",
"json",
",",
"EntityPlayerMP",
"player",
")",
"{",
"json",
".",
"addProperty",
"(",
"\"Life\"",
",",
"player",
".",
"getHealth",
"(",
")",
")",
";",
"json",
".",
"addProperty",
"(",
"\"Score\""... | Builds the basic life world data to be used as observation signals by the listener.
@param json a JSON object into which the life stats will be added. | [
"Builds",
"the",
"basic",
"life",
"world",
"data",
"to",
"be",
"used",
"as",
"observation",
"signals",
"by",
"the",
"listener",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java#L124-L133 |
23,039 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java | JSONWorldDataHelper.buildPositionStats | public static void buildPositionStats(JsonObject json, EntityPlayerMP player)
{
json.addProperty("XPos", player.posX);
json.addProperty("YPos", player.posY);
json.addProperty("ZPos", player.posZ);
json.addProperty("Pitch", player.rotationPitch);
json.addProperty("Yaw", pla... | java | public static void buildPositionStats(JsonObject json, EntityPlayerMP player)
{
json.addProperty("XPos", player.posX);
json.addProperty("YPos", player.posY);
json.addProperty("ZPos", player.posZ);
json.addProperty("Pitch", player.rotationPitch);
json.addProperty("Yaw", pla... | [
"public",
"static",
"void",
"buildPositionStats",
"(",
"JsonObject",
"json",
",",
"EntityPlayerMP",
"player",
")",
"{",
"json",
".",
"addProperty",
"(",
"\"XPos\"",
",",
"player",
".",
"posX",
")",
";",
"json",
".",
"addProperty",
"(",
"\"YPos\"",
",",
"play... | Builds the player position data to be used as observation signals by the listener.
@param json a JSON object into which the positional information will be added. | [
"Builds",
"the",
"player",
"position",
"data",
"to",
"be",
"used",
"as",
"observation",
"signals",
"by",
"the",
"listener",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java#L138-L145 |
23,040 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java | MapFileHelper.copyMapFiles | static public File copyMapFiles(File mapFile, boolean isTemporary)
{
System.out.println("Current directory: "+System.getProperty("user.dir"));
// Look for the basemap file.
// If it exists, copy it into the Minecraft saves folder,
// and attempt to load it.
File savesDir = FM... | java | static public File copyMapFiles(File mapFile, boolean isTemporary)
{
System.out.println("Current directory: "+System.getProperty("user.dir"));
// Look for the basemap file.
// If it exists, copy it into the Minecraft saves folder,
// and attempt to load it.
File savesDir = FM... | [
"static",
"public",
"File",
"copyMapFiles",
"(",
"File",
"mapFile",
",",
"boolean",
"isTemporary",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Current directory: \"",
"+",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
")",
";",
"// Look f... | Attempt to copy the specified file into the Minecraft saves folder.
@param mapFile full path to the map file required
@param overwriteOldFiles if false, will rename copy to avoid overwriting any other saved games
@return if successful, a File object representing the new copy, which can be fed to Minecraft to load - oth... | [
"Attempt",
"to",
"copy",
"the",
"specified",
"file",
"into",
"the",
"Minecraft",
"saves",
"folder",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java#L48-L72 |
23,041 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java | MapFileHelper.createAndLaunchWorld | public static boolean createAndLaunchWorld(WorldSettings worldsettings, boolean isTemporary)
{
String s = getNewSaveFileLocation(isTemporary);
Minecraft.getMinecraft().launchIntegratedServer(s, s, worldsettings);
cleanupTemporaryWorlds(s);
return true;
} | java | public static boolean createAndLaunchWorld(WorldSettings worldsettings, boolean isTemporary)
{
String s = getNewSaveFileLocation(isTemporary);
Minecraft.getMinecraft().launchIntegratedServer(s, s, worldsettings);
cleanupTemporaryWorlds(s);
return true;
} | [
"public",
"static",
"boolean",
"createAndLaunchWorld",
"(",
"WorldSettings",
"worldsettings",
",",
"boolean",
"isTemporary",
")",
"{",
"String",
"s",
"=",
"getNewSaveFileLocation",
"(",
"isTemporary",
")",
";",
"Minecraft",
".",
"getMinecraft",
"(",
")",
".",
"lau... | Creates and launches a unique world according to the settings.
@param worldsettings the world's settings
@param isTemporary if true, the world will be deleted whenever newer worlds are created
@return | [
"Creates",
"and",
"launches",
"a",
"unique",
"world",
"according",
"to",
"the",
"settings",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java#L106-L112 |
23,042 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java | MapFileHelper.cleanupTemporaryWorlds | public static void cleanupTemporaryWorlds(String currentWorld){
List<WorldSummary> saveList;
ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
isaveformat.flushCache();
try{
saveList = isaveformat.getSaveList();
} catch (AnvilConverterException e){
... | java | public static void cleanupTemporaryWorlds(String currentWorld){
List<WorldSummary> saveList;
ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
isaveformat.flushCache();
try{
saveList = isaveformat.getSaveList();
} catch (AnvilConverterException e){
... | [
"public",
"static",
"void",
"cleanupTemporaryWorlds",
"(",
"String",
"currentWorld",
")",
"{",
"List",
"<",
"WorldSummary",
">",
"saveList",
";",
"ISaveFormat",
"isaveformat",
"=",
"Minecraft",
".",
"getMinecraft",
"(",
")",
".",
"getSaveLoader",
"(",
")",
";",
... | Attempts to delete all Minecraft Worlds with "TEMP_" in front of the name
@param currentWorld excludes this world from deletion, can be null | [
"Attempts",
"to",
"delete",
"all",
"Minecraft",
"Worlds",
"with",
"TEMP_",
"in",
"front",
"of",
"the",
"name"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java#L118-L138 |
23,043 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.Draw | public void Draw( DrawingDecorator drawingNode, World world ) throws Exception
{
beginDrawing(world);
for(JAXBElement<?> jaxbobj : drawingNode.getDrawObjectType())
{
Object obj = jaxbobj.getValue();
// isn't there an easier way of doing this?
if( obj inst... | java | public void Draw( DrawingDecorator drawingNode, World world ) throws Exception
{
beginDrawing(world);
for(JAXBElement<?> jaxbobj : drawingNode.getDrawObjectType())
{
Object obj = jaxbobj.getValue();
// isn't there an easier way of doing this?
if( obj inst... | [
"public",
"void",
"Draw",
"(",
"DrawingDecorator",
"drawingNode",
",",
"World",
"world",
")",
"throws",
"Exception",
"{",
"beginDrawing",
"(",
"world",
")",
";",
"for",
"(",
"JAXBElement",
"<",
"?",
">",
"jaxbobj",
":",
"drawingNode",
".",
"getDrawObjectType",... | Draws the specified drawing into the Minecraft world supplied.
@param drawingNode The sequence of drawing primitives to draw.
@param world The world in which to draw them.
@throws Exception Unrecognised block types or primitives cause an exception to be thrown. | [
"Draws",
"the",
"specified",
"drawing",
"into",
"the",
"Minecraft",
"world",
"supplied",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L180-L209 |
23,044 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.DrawPrimitive | private void DrawPrimitive( DrawBlock b, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(b.getType(), b.getColour(), b.getFace(), b.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecogised item type: " + b.getType().value());
BlockPos po... | java | private void DrawPrimitive( DrawBlock b, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(b.getType(), b.getColour(), b.getFace(), b.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecogised item type: " + b.getType().value());
BlockPos po... | [
"private",
"void",
"DrawPrimitive",
"(",
"DrawBlock",
"b",
",",
"World",
"w",
")",
"throws",
"Exception",
"{",
"XMLBlockState",
"blockType",
"=",
"new",
"XMLBlockState",
"(",
"b",
".",
"getType",
"(",
")",
",",
"b",
".",
"getColour",
"(",
")",
",",
"b",
... | Draw a single Minecraft block.
@param b Contains information about the block to be drawn.
@param w The world in which to draw.
@throws Exception Throws an exception if the block type is not recognised. | [
"Draw",
"a",
"single",
"Minecraft",
"block",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L217-L225 |
23,045 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.DrawPrimitive | private void DrawPrimitive( DrawSphere s, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(s.getType(), s.getColour(), null, s.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecognised block type: " + s.getType().value());
int radius = s... | java | private void DrawPrimitive( DrawSphere s, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(s.getType(), s.getColour(), null, s.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecognised block type: " + s.getType().value());
int radius = s... | [
"private",
"void",
"DrawPrimitive",
"(",
"DrawSphere",
"s",
",",
"World",
"w",
")",
"throws",
"Exception",
"{",
"XMLBlockState",
"blockType",
"=",
"new",
"XMLBlockState",
"(",
"s",
".",
"getType",
"(",
")",
",",
"s",
".",
"getColour",
"(",
")",
",",
"nul... | Draw a solid sphere made up of Minecraft blocks.
@param s Contains information about the sphere to be drawn.
@param w The world in which to draw.
@throws Exception Throws an exception if the block type is not recognised. | [
"Draw",
"a",
"solid",
"sphere",
"made",
"up",
"of",
"Minecraft",
"blocks",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L248-L271 |
23,046 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.DrawPrimitive | private void DrawPrimitive( DrawEntity e, World w ) throws Exception
{
String oldEntityName = e.getType().getValue();
String id = null;
for (EntityEntry ent : net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES)
{
if (ent.getName().equals(oldEntityName))
... | java | private void DrawPrimitive( DrawEntity e, World w ) throws Exception
{
String oldEntityName = e.getType().getValue();
String id = null;
for (EntityEntry ent : net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES)
{
if (ent.getName().equals(oldEntityName))
... | [
"private",
"void",
"DrawPrimitive",
"(",
"DrawEntity",
"e",
",",
"World",
"w",
")",
"throws",
"Exception",
"{",
"String",
"oldEntityName",
"=",
"e",
".",
"getType",
"(",
")",
".",
"getValue",
"(",
")",
";",
"String",
"id",
"=",
"null",
";",
"for",
"(",... | Spawn a single entity at the specified position.
@param e the actual entity to be spawned.
@param w the world in which to spawn the entity.
@throws Exception | [
"Spawn",
"a",
"single",
"entity",
"at",
"the",
"specified",
"position",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L360-L408 |
23,047 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.DrawPrimitive | private void DrawPrimitive( DrawCuboid c, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(c.getType(), c.getColour(), c.getFace(), c.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecogised item type: "+c.getType().value());
int x1 = Mat... | java | private void DrawPrimitive( DrawCuboid c, World w ) throws Exception
{
XMLBlockState blockType = new XMLBlockState(c.getType(), c.getColour(), c.getFace(), c.getVariant());
if (!blockType.isValid())
throw new Exception("Unrecogised item type: "+c.getType().value());
int x1 = Mat... | [
"private",
"void",
"DrawPrimitive",
"(",
"DrawCuboid",
"c",
",",
"World",
"w",
")",
"throws",
"Exception",
"{",
"XMLBlockState",
"blockType",
"=",
"new",
"XMLBlockState",
"(",
"c",
".",
"getType",
"(",
")",
",",
"c",
".",
"getColour",
"(",
")",
",",
"c",... | Draw a filled cuboid of Minecraft blocks of a single type.
@param c Contains information about the cuboid to be drawn.
@param w The world in which to draw.
@throws Exception Throws an exception if the block type is not recognised. | [
"Draw",
"a",
"filled",
"cuboid",
"of",
"Minecraft",
"blocks",
"of",
"a",
"single",
"type",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L513-L536 |
23,048 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/TCPUtils.java | TCPUtils.getSocketInRange | public static ServerSocket getSocketInRange(int minPort, int maxPort, boolean random)
{
TCPUtils.Log(Level.INFO, "Attempting to create a ServerSocket in range (" + minPort + "-" + maxPort + (random ? ") at random..." : ") sequentially..."));
ServerSocket s = null;
int port = minPort - 1;
... | java | public static ServerSocket getSocketInRange(int minPort, int maxPort, boolean random)
{
TCPUtils.Log(Level.INFO, "Attempting to create a ServerSocket in range (" + minPort + "-" + maxPort + (random ? ") at random..." : ") sequentially..."));
ServerSocket s = null;
int port = minPort - 1;
... | [
"public",
"static",
"ServerSocket",
"getSocketInRange",
"(",
"int",
"minPort",
",",
"int",
"maxPort",
",",
"boolean",
"random",
")",
"{",
"TCPUtils",
".",
"Log",
"(",
"Level",
".",
"INFO",
",",
"\"Attempting to create a ServerSocket in range (\"",
"+",
"minPort",
... | Choose a port from the specified range - either sequentially, or at random.
@param minPort minimum (inclusive) value for port.
@param maxPort max (inclusive) possible port value.
@param random true to allocate based on a random sample; false to allocate sequentially, starting from minPort.
@return a Serve... | [
"Choose",
"a",
"port",
"from",
"the",
"specified",
"range",
"-",
"either",
"sequentially",
"or",
"at",
"random",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/TCPUtils.java#L175-L202 |
23,049 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/PositionHelper.java | PositionHelper.calcDistanceFromPlayerToPosition | public static float calcDistanceFromPlayerToPosition(EntityPlayerSP player, Pos targetPos)
{
double x = player.posX - targetPos.getX().doubleValue();
double y = player.posY - targetPos.getY().doubleValue();
double z = player.posZ - targetPos.getZ().doubleValue();
return (float)Math.sqrt(x*x + y*y +... | java | public static float calcDistanceFromPlayerToPosition(EntityPlayerSP player, Pos targetPos)
{
double x = player.posX - targetPos.getX().doubleValue();
double y = player.posY - targetPos.getY().doubleValue();
double z = player.posZ - targetPos.getZ().doubleValue();
return (float)Math.sqrt(x*x + y*y +... | [
"public",
"static",
"float",
"calcDistanceFromPlayerToPosition",
"(",
"EntityPlayerSP",
"player",
",",
"Pos",
"targetPos",
")",
"{",
"double",
"x",
"=",
"player",
".",
"posX",
"-",
"targetPos",
".",
"getX",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"doubl... | Calculate the Euclidean distance between the player and the target position.
@param player the player whose distance from target we want to know
@param targetPos the target position, specified as a Schema pos object
@return a float containing the Euclidean distance 'twixt player and target | [
"Calculate",
"the",
"Euclidean",
"distance",
"between",
"the",
"player",
"and",
"the",
"target",
"position",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/PositionHelper.java#L39-L45 |
23,050 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/CommandForWheeledRobotNavigationImplementation.java | CommandForWheeledRobotNavigationImplementation.updateState | protected boolean updateState()
{
if (!overrideKeyboardInput)
{
return false; // Let the class do the default thing.
}
// Update movement:
mTicksSinceLastVelocityChange++;
if (mTicksSinceLastVelocityChange <= mInertiaTicks)
{
mVelocit... | java | protected boolean updateState()
{
if (!overrideKeyboardInput)
{
return false; // Let the class do the default thing.
}
// Update movement:
mTicksSinceLastVelocityChange++;
if (mTicksSinceLastVelocityChange <= mInertiaTicks)
{
mVelocit... | [
"protected",
"boolean",
"updateState",
"(",
")",
"{",
"if",
"(",
"!",
"overrideKeyboardInput",
")",
"{",
"return",
"false",
";",
"// Let the class do the default thing.",
"}",
"// Update movement:",
"mTicksSinceLastVelocityChange",
"++",
";",
"if",
"(",
"mTicksSinceLast... | Called by our overridden MovementInputFromOptions class.
@return true if we've handled the movement; false if the MovementInputFromOptions class should delegate to the default handling. | [
"Called",
"by",
"our",
"overridden",
"MovementInputFromOptions",
"class",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/CommandForWheeledRobotNavigationImplementation.java#L146-L174 |
23,051 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/QuitFromComposite.java | QuitFromComposite.addQuitter | public void addQuitter(IWantToQuit quitter)
{
if (this.quitters == null)
{
this.quitters = new ArrayList<IWantToQuit>();
}
this.quitters.add(quitter);
} | java | public void addQuitter(IWantToQuit quitter)
{
if (this.quitters == null)
{
this.quitters = new ArrayList<IWantToQuit>();
}
this.quitters.add(quitter);
} | [
"public",
"void",
"addQuitter",
"(",
"IWantToQuit",
"quitter",
")",
"{",
"if",
"(",
"this",
".",
"quitters",
"==",
"null",
")",
"{",
"this",
".",
"quitters",
"=",
"new",
"ArrayList",
"<",
"IWantToQuit",
">",
"(",
")",
";",
"}",
"this",
".",
"quitters",... | Add another IWantToQuit object to the children.
@param quitter the IWantToQuit object. | [
"Add",
"another",
"IWantToQuit",
"object",
"to",
"the",
"children",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/QuitFromComposite.java#L58-L65 |
23,052 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java | VideoHook.start | public void start(MissionInit missionInit, IVideoProducer videoProducer, VideoProducedObserver observer, MalmoEnvServer envServer)
{
if (videoProducer == null)
{
return; // Don't start up if there is nothing to provide the video.
}
videoProducer.prepare(missionInit);
... | java | public void start(MissionInit missionInit, IVideoProducer videoProducer, VideoProducedObserver observer, MalmoEnvServer envServer)
{
if (videoProducer == null)
{
return; // Don't start up if there is nothing to provide the video.
}
videoProducer.prepare(missionInit);
... | [
"public",
"void",
"start",
"(",
"MissionInit",
"missionInit",
",",
"IVideoProducer",
"videoProducer",
",",
"VideoProducedObserver",
"observer",
",",
"MalmoEnvServer",
"envServer",
")",
"{",
"if",
"(",
"videoProducer",
"==",
"null",
")",
"{",
"return",
";",
"// Don... | Resize the rendering and start sending video over TCP. | [
"Resize",
"the",
"rendering",
"and",
"start",
"sending",
"video",
"over",
"TCP",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java#L115-L168 |
23,053 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java | VideoHook.resizeIfNeeded | private void resizeIfNeeded()
{
// resize the window if we need to
int oldRenderWidth = Display.getWidth();
int oldRenderHeight = Display.getHeight();
if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
return;
try {
... | java | private void resizeIfNeeded()
{
// resize the window if we need to
int oldRenderWidth = Display.getWidth();
int oldRenderHeight = Display.getHeight();
if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
return;
try {
... | [
"private",
"void",
"resizeIfNeeded",
"(",
")",
"{",
"// resize the window if we need to",
"int",
"oldRenderWidth",
"=",
"Display",
".",
"getWidth",
"(",
")",
";",
"int",
"oldRenderHeight",
"=",
"Display",
".",
"getHeight",
"(",
")",
";",
"if",
"(",
"this",
"."... | Resizes the window and the Minecraft rendering if necessary. Set renderWidth and renderHeight first. | [
"Resizes",
"the",
"window",
"and",
"the",
"Minecraft",
"rendering",
"if",
"necessary",
".",
"Set",
"renderWidth",
"and",
"renderHeight",
"first",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java#L173-L192 |
23,054 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java | VideoHook.stop | public void stop(MissionDiagnostics diags)
{
if( !this.isRunning )
{
return;
}
if (this.videoProducer != null)
this.videoProducer.cleanup();
// stop sending video frames
try
{
MinecraftForge.EVENT_BUS.unregister(this);
... | java | public void stop(MissionDiagnostics diags)
{
if( !this.isRunning )
{
return;
}
if (this.videoProducer != null)
this.videoProducer.cleanup();
// stop sending video frames
try
{
MinecraftForge.EVENT_BUS.unregister(this);
... | [
"public",
"void",
"stop",
"(",
"MissionDiagnostics",
"diags",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isRunning",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"videoProducer",
"!=",
"null",
")",
"this",
".",
"videoProducer",
".",
"cleanup",
"(... | Stop sending video. | [
"Stop",
"sending",
"video",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java#L197-L234 |
23,055 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java | VideoHook.forceResize | private void forceResize(int width, int height)
{
// Are we in the dev environment or deployed?
boolean devEnv = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
// We need to know, because the method name will either be obfuscated or not.
String resizeMethodName = dev... | java | private void forceResize(int width, int height)
{
// Are we in the dev environment or deployed?
boolean devEnv = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
// We need to know, because the method name will either be obfuscated or not.
String resizeMethodName = dev... | [
"private",
"void",
"forceResize",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// Are we in the dev environment or deployed?",
"boolean",
"devEnv",
"=",
"(",
"Boolean",
")",
"Launch",
".",
"blackboard",
".",
"get",
"(",
"\"fml.deobfuscatedEnvironment\"",
")... | Force Minecraft to resize its GUI
@param width new width of window
@param height new height of window | [
"Force",
"Minecraft",
"to",
"resize",
"its",
"GUI"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/VideoHook.java#L356-L398 |
23,056 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.ParseBlockType | public static IBlockState ParseBlockType( String s )
{
if( s == null )
return null;
Block block = (Block)Block.REGISTRY.getObject(new ResourceLocation( s ));
if( block instanceof BlockAir && !s.equals("air") ) // Minecraft returns BlockAir when it doesn't recognise the string
... | java | public static IBlockState ParseBlockType( String s )
{
if( s == null )
return null;
Block block = (Block)Block.REGISTRY.getObject(new ResourceLocation( s ));
if( block instanceof BlockAir && !s.equals("air") ) // Minecraft returns BlockAir when it doesn't recognise the string
... | [
"public",
"static",
"IBlockState",
"ParseBlockType",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"Block",
"block",
"=",
"(",
"Block",
")",
"Block",
".",
"REGISTRY",
".",
"getObject",
"(",
"new",
"ResourceLocati... | Attempts to parse the block type string.
@param s The string to parse.
@return The block type, or null if the string is not recognised. | [
"Attempts",
"to",
"parse",
"the",
"block",
"type",
"string",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L68-L76 |
23,057 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.ParseItemType | public static Item ParseItemType( String s, boolean checkBlocks )
{
if (s == null)
return null;
Item item = (Item)Item.REGISTRY.getObject(new ResourceLocation(s)); // Minecraft returns null when it doesn't recognise the string
if (item == null && checkBlocks)
{
... | java | public static Item ParseItemType( String s, boolean checkBlocks )
{
if (s == null)
return null;
Item item = (Item)Item.REGISTRY.getObject(new ResourceLocation(s)); // Minecraft returns null when it doesn't recognise the string
if (item == null && checkBlocks)
{
... | [
"public",
"static",
"Item",
"ParseItemType",
"(",
"String",
"s",
",",
"boolean",
"checkBlocks",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"Item",
"item",
"=",
"(",
"Item",
")",
"Item",
".",
"REGISTRY",
".",
"getObject",
"(",
... | Attempts to parse the item type string.
@param s The string to parse.
@param checkBlocks if string can't be parsed as an item, attempt to parse as a block, if checkBlocks is true
@return The item type, or null if the string is not recognised. | [
"Attempts",
"to",
"parse",
"the",
"item",
"type",
"string",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L84-L96 |
23,058 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.blockColourMatches | public static boolean blockColourMatches(IBlockState bs, List<Colour> allowedColours)
{
for (IProperty prop : bs.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
// The block in ... | java | public static boolean blockColourMatches(IBlockState bs, List<Colour> allowedColours)
{
for (IProperty prop : bs.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
// The block in ... | [
"public",
"static",
"boolean",
"blockColourMatches",
"(",
"IBlockState",
"bs",
",",
"List",
"<",
"Colour",
">",
"allowedColours",
")",
"{",
"for",
"(",
"IProperty",
"prop",
":",
"bs",
".",
"getProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"if... | Test whether this block has a colour attribute which matches the list of allowed colours
@param bs blockstate to test
@param allowedColours list of allowed Colour enum values
@return true if the block matches. | [
"Test",
"whether",
"this",
"block",
"has",
"a",
"colour",
"attribute",
"which",
"matches",
"the",
"list",
"of",
"allowed",
"colours"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L103-L119 |
23,059 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.blockVariantMatches | public static boolean blockVariantMatches(IBlockState bs, List<Variation> allowedVariants)
{
for (IProperty prop : bs.getProperties().keySet())
{
if (prop.getName().equals("variant") && prop.getValueClass().isEnum())
{
Object current = bs.getValue(prop);
... | java | public static boolean blockVariantMatches(IBlockState bs, List<Variation> allowedVariants)
{
for (IProperty prop : bs.getProperties().keySet())
{
if (prop.getName().equals("variant") && prop.getValueClass().isEnum())
{
Object current = bs.getValue(prop);
... | [
"public",
"static",
"boolean",
"blockVariantMatches",
"(",
"IBlockState",
"bs",
",",
"List",
"<",
"Variation",
">",
"allowedVariants",
")",
"{",
"for",
"(",
"IProperty",
"prop",
":",
"bs",
".",
"getProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
... | Test whether this block has a variant attribute which matches the list of allowed variants
@param bs the blockstate to test
@param allowedVariants list of allowed Variant enum values
@return true if the block matches. | [
"Test",
"whether",
"this",
"block",
"has",
"a",
"variant",
"attribute",
"which",
"matches",
"the",
"list",
"of",
"allowed",
"variants"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L126-L144 |
23,060 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.attemptToGetAsColour | public static Colour attemptToGetAsColour(String part)
{
String target = part.toUpperCase();
for (int i = 0; i < Colour.values().length; i++)
{
String col = Colour.values()[i].name().replace("_", "");
if (col.equals(target))
return Colour.values()[i];... | java | public static Colour attemptToGetAsColour(String part)
{
String target = part.toUpperCase();
for (int i = 0; i < Colour.values().length; i++)
{
String col = Colour.values()[i].name().replace("_", "");
if (col.equals(target))
return Colour.values()[i];... | [
"public",
"static",
"Colour",
"attemptToGetAsColour",
"(",
"String",
"part",
")",
"{",
"String",
"target",
"=",
"part",
".",
"toUpperCase",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Colour",
".",
"values",
"(",
")",
".",
"lengt... | Attempt to parse string as a Colour
@param part string token to parse
@return the Colour enum value for the requested colour, or null if it wasn't valid. | [
"Attempt",
"to",
"parse",
"string",
"as",
"a",
"Colour"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L150-L160 |
23,061 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.attemptToGetAsVariant | public static Variation attemptToGetAsVariant(String part)
{
// Annoyingly JAXB won't bind Variation as an enum, so we have to do this manually.
// TODO - can we do something more clever... eg make StoneTypes, WoodTypes etc inherit from an XSD baseclass,
// and have an object in the schemas ... | java | public static Variation attemptToGetAsVariant(String part)
{
// Annoyingly JAXB won't bind Variation as an enum, so we have to do this manually.
// TODO - can we do something more clever... eg make StoneTypes, WoodTypes etc inherit from an XSD baseclass,
// and have an object in the schemas ... | [
"public",
"static",
"Variation",
"attemptToGetAsVariant",
"(",
"String",
"part",
")",
"{",
"// Annoyingly JAXB won't bind Variation as an enum, so we have to do this manually.",
"// TODO - can we do something more clever... eg make StoneTypes, WoodTypes etc inherit from an XSD baseclass,",
"//... | Attempt to parse string as a Variation
@param part string token to parse
@return the BlockVariant enum value for the requested variant, or null if it wasn't valid. | [
"Attempt",
"to",
"parse",
"string",
"as",
"a",
"Variation"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L207-L311 |
23,062 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.getItemStackFromParameterString | public static ItemStack getItemStackFromParameterString(String parameters)
{
// Split into parameters:
List<String> params = new ArrayList<String>(Arrays.asList(parameters.split(" ")));
Colour col = null;
Variation var = null;
// See if any parameters appear to be a colour:
... | java | public static ItemStack getItemStackFromParameterString(String parameters)
{
// Split into parameters:
List<String> params = new ArrayList<String>(Arrays.asList(parameters.split(" ")));
Colour col = null;
Variation var = null;
// See if any parameters appear to be a colour:
... | [
"public",
"static",
"ItemStack",
"getItemStackFromParameterString",
"(",
"String",
"parameters",
")",
"{",
"// Split into parameters:",
"List",
"<",
"String",
">",
"params",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"parameter... | Take a string of parameters, delimited by spaces, and create an ItemStack from it.
@param parameters the item name, variation, colour etc of the required item, separated by spaces.
@return an Itemstack for these parameters, or null if unrecognised. | [
"Take",
"a",
"string",
"of",
"parameters",
"delimited",
"by",
"spaces",
"and",
"create",
"an",
"ItemStack",
"from",
"it",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L434-L469 |
23,063 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.applyVariant | static IBlockState applyVariant(IBlockState state, Variation variant)
{
// Try the variant property first - if that fails, look for other properties that match the supplied variant.
boolean relaxRequirements = false;
for (int i = 0; i < 2; i++)
{
for (IProperty prop : sta... | java | static IBlockState applyVariant(IBlockState state, Variation variant)
{
// Try the variant property first - if that fails, look for other properties that match the supplied variant.
boolean relaxRequirements = false;
for (int i = 0; i < 2; i++)
{
for (IProperty prop : sta... | [
"static",
"IBlockState",
"applyVariant",
"(",
"IBlockState",
"state",
",",
"Variation",
"variant",
")",
"{",
"// Try the variant property first - if that fails, look for other properties that match the supplied variant.",
"boolean",
"relaxRequirements",
"=",
"false",
";",
"for",
... | Select the request variant of the Minecraft block, if applicable
@param state The block to be varied
@param colour The new variation
@return A new blockstate which is the requested variant of the original, if such a variant exists; otherwise it returns the original block. | [
"Select",
"the",
"request",
"variant",
"of",
"the",
"Minecraft",
"block",
"if",
"applicable"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L530-L553 |
23,064 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.applyColour | static IBlockState applyColour(IBlockState state, Colour colour)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
net.minecraft.item.EnumDyeColor current = (net.minec... | java | static IBlockState applyColour(IBlockState state, Colour colour)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
net.minecraft.item.EnumDyeColor current = (net.minec... | [
"static",
"IBlockState",
"applyColour",
"(",
"IBlockState",
"state",
",",
"Colour",
"colour",
")",
"{",
"for",
"(",
"IProperty",
"prop",
":",
"state",
".",
"getProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"prop",
".",
"getName",
... | Recolour the Minecraft block
@param state The block to be recoloured
@param colour The new colour
@return A new blockstate which is a recoloured version of the original | [
"Recolour",
"the",
"Minecraft",
"block"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L560-L574 |
23,065 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.applyFacing | static IBlockState applyFacing(IBlockState state, Facing facing)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("facing"))
{
if (prop.getValueClass() == EnumFacing.class)
{
EnumFacing cur... | java | static IBlockState applyFacing(IBlockState state, Facing facing)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("facing"))
{
if (prop.getValueClass() == EnumFacing.class)
{
EnumFacing cur... | [
"static",
"IBlockState",
"applyFacing",
"(",
"IBlockState",
"state",
",",
"Facing",
"facing",
")",
"{",
"for",
"(",
"IProperty",
"prop",
":",
"state",
".",
"getProperties",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"prop",
".",
"getName",
... | Change the facing attribute of the Minecraft block
@param state The block to be edited
@param facing The new direction (N/S/E/W/U/D)
@return A new blockstate with the facing attribute edited | [
"Change",
"the",
"facing",
"attribute",
"of",
"the",
"Minecraft",
"block"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L581-L606 |
23,066 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/CommandForKey.java | CommandForKey.create | private KeyHook create(KeyBinding key)
{
if (key != null && key instanceof KeyHook)
{
return (KeyHook)key; // Don't create a KeyHook to replace this KeyBinding, since that has already been done at some point.
// (Minecraft keeps a pointer to every KeyBinding that gets created... | java | private KeyHook create(KeyBinding key)
{
if (key != null && key instanceof KeyHook)
{
return (KeyHook)key; // Don't create a KeyHook to replace this KeyBinding, since that has already been done at some point.
// (Minecraft keeps a pointer to every KeyBinding that gets created... | [
"private",
"KeyHook",
"create",
"(",
"KeyBinding",
"key",
")",
"{",
"if",
"(",
"key",
"!=",
"null",
"&&",
"key",
"instanceof",
"KeyHook",
")",
"{",
"return",
"(",
"KeyHook",
")",
"key",
";",
"// Don't create a KeyHook to replace this KeyBinding, since that has alrea... | Helper function to create a KeyHook object for a given KeyBinding object.
@param key the Minecraft KeyBinding object we are wrapping
@return an ExternalAIKey object to replace the original Minecraft KeyBinding object | [
"Helper",
"function",
"to",
"create",
"a",
"KeyHook",
"object",
"for",
"a",
"given",
"KeyBinding",
"object",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/CommandForKey.java#L223-L232 |
23,067 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/CommandForKey.java | CommandForKey.setOverriding | @Override
public void setOverriding(boolean b)
{
if (this.keyHook != null)
{
this.keyHook.isDown = false;
this.keyHook.justPressed = false;
this.keyHook.isOverridingPresses = b;
}
} | java | @Override
public void setOverriding(boolean b)
{
if (this.keyHook != null)
{
this.keyHook.isDown = false;
this.keyHook.justPressed = false;
this.keyHook.isOverridingPresses = b;
}
} | [
"@",
"Override",
"public",
"void",
"setOverriding",
"(",
"boolean",
"b",
")",
"{",
"if",
"(",
"this",
".",
"keyHook",
"!=",
"null",
")",
"{",
"this",
".",
"keyHook",
".",
"isDown",
"=",
"false",
";",
"this",
".",
"keyHook",
".",
"justPressed",
"=",
"... | Switch this object "on" or "off".
@param b true if this object is to start overriding the normal Minecraft handling. | [
"Switch",
"this",
"object",
"on",
"or",
"off",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/CommandForKey.java#L254-L263 |
23,068 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java | MultidimensionalReward.add | public void add(int dimension, float value) {
if(this.map.containsKey(dimension))
this.map.put(dimension, this.map.get(dimension) + value);
else
this.map.put(dimension, value);
} | java | public void add(int dimension, float value) {
if(this.map.containsKey(dimension))
this.map.put(dimension, this.map.get(dimension) + value);
else
this.map.put(dimension, value);
} | [
"public",
"void",
"add",
"(",
"int",
"dimension",
",",
"float",
"value",
")",
"{",
"if",
"(",
"this",
".",
"map",
".",
"containsKey",
"(",
"dimension",
")",
")",
"this",
".",
"map",
".",
"put",
"(",
"dimension",
",",
"this",
".",
"map",
".",
"get",... | Add a given reward value on a specified dimension.
@param dimension
the dimension to add the reward on.
@param value
the value of the reward. | [
"Add",
"a",
"given",
"reward",
"value",
"on",
"a",
"specified",
"dimension",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java#L70-L75 |
23,069 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java | MultidimensionalReward.add | public void add(MultidimensionalReward other) {
for (Map.Entry<Integer, Float> entry : other.map.entrySet()) {
Integer dimension = entry.getKey();
Float reward_value = entry.getValue();
this.add(dimension.intValue(), reward_value.floatValue());
}
} | java | public void add(MultidimensionalReward other) {
for (Map.Entry<Integer, Float> entry : other.map.entrySet()) {
Integer dimension = entry.getKey();
Float reward_value = entry.getValue();
this.add(dimension.intValue(), reward_value.floatValue());
}
} | [
"public",
"void",
"add",
"(",
"MultidimensionalReward",
"other",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Float",
">",
"entry",
":",
"other",
".",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"Integer",
"dimension",
"=",
"entry",... | Merge in another multidimensional reward structure.
@param other
the other multidimensional reward structure. | [
"Merge",
"in",
"another",
"multidimensional",
"reward",
"structure",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java#L83-L89 |
23,070 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java | MultidimensionalReward.getAsReward | public Reward getAsReward() {
Reward reward = new Reward();
for (Map.Entry<Integer, Float> entry : this.map.entrySet()) {
Integer dimension = entry.getKey();
Float reward_value = entry.getValue();
Value reward_entry = new Value();
reward_entry.setDimension... | java | public Reward getAsReward() {
Reward reward = new Reward();
for (Map.Entry<Integer, Float> entry : this.map.entrySet()) {
Integer dimension = entry.getKey();
Float reward_value = entry.getValue();
Value reward_entry = new Value();
reward_entry.setDimension... | [
"public",
"Reward",
"getAsReward",
"(",
")",
"{",
"Reward",
"reward",
"=",
"new",
"Reward",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Float",
">",
"entry",
":",
"this",
".",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
... | Retrieve the reward structure as defined by the schema.
@return the reward structure as defined by the schema. | [
"Retrieve",
"the",
"reward",
"structure",
"as",
"defined",
"by",
"the",
"schema",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java#L96-L107 |
23,071 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java | MultidimensionalReward.getAsXMLString | public String getAsXMLString() {
// Create a string XML representation:
String rewardString = null;
try {
rewardString = SchemaHelper.serialiseObject(this.getAsReward(), Reward.class);
} catch (JAXBException e) {
System.out.println("Caught reward serialization exc... | java | public String getAsXMLString() {
// Create a string XML representation:
String rewardString = null;
try {
rewardString = SchemaHelper.serialiseObject(this.getAsReward(), Reward.class);
} catch (JAXBException e) {
System.out.println("Caught reward serialization exc... | [
"public",
"String",
"getAsXMLString",
"(",
")",
"{",
"// Create a string XML representation:",
"String",
"rewardString",
"=",
"null",
";",
"try",
"{",
"rewardString",
"=",
"SchemaHelper",
".",
"serialiseObject",
"(",
"this",
".",
"getAsReward",
"(",
")",
",",
"Rew... | Gets the reward structure as an XML string as defined by the schema.
@return the XML string. | [
"Gets",
"the",
"reward",
"structure",
"as",
"an",
"XML",
"string",
"as",
"defined",
"by",
"the",
"schema",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java#L114-L123 |
23,072 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java | MultidimensionalReward.getRewardTotal | public double getRewardTotal() {
double rewards = 0.0;
for (Map.Entry<Integer, Float> entry : this.map.entrySet()) {
rewards += entry.getValue();
}
return rewards;
} | java | public double getRewardTotal() {
double rewards = 0.0;
for (Map.Entry<Integer, Float> entry : this.map.entrySet()) {
rewards += entry.getValue();
}
return rewards;
} | [
"public",
"double",
"getRewardTotal",
"(",
")",
"{",
"double",
"rewards",
"=",
"0.0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Float",
">",
"entry",
":",
"this",
".",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"rewards",
"+=",
"... | Get the total rewards from all dimensions, each of which may be positive or negative.
@return The total rewards. | [
"Get",
"the",
"total",
"rewards",
"from",
"all",
"dimensions",
"each",
"of",
"which",
"may",
"be",
"positive",
"or",
"negative",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MultidimensionalReward.java#L148-L154 |
23,073 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java | MalmoEnvServer.serve | public void serve() throws IOException {
ServerSocket serverSocket = new ServerSocket(port);
while (true) {
try {
final Socket socket = serverSocket.accept();
Thread thread = new Thread("EnvServerSocketHandler") {
public void run() {
... | java | public void serve() throws IOException {
ServerSocket serverSocket = new ServerSocket(port);
while (true) {
try {
final Socket socket = serverSocket.accept();
Thread thread = new Thread("EnvServerSocketHandler") {
public void run() {
... | [
"public",
"void",
"serve",
"(",
")",
"throws",
"IOException",
"{",
"ServerSocket",
"serverSocket",
"=",
"new",
"ServerSocket",
"(",
"port",
")",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"final",
"Socket",
"socket",
"=",
"serverSocket",
".",
"accept... | Start servicing the MalmoEnv protocol.
@throws IOException | [
"Start",
"servicing",
"the",
"MalmoEnv",
"protocol",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java#L118-L207 |
23,074 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java | MalmoEnvServer.getObservation | private byte[] getObservation(boolean done) {
byte[] obs = envState.obs;
if (obs == null && !done) {
try {
cond.await(COND_WAIT_SECONDS, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
}
obs = envState.obs;
}
if (obs ... | java | private byte[] getObservation(boolean done) {
byte[] obs = envState.obs;
if (obs == null && !done) {
try {
cond.await(COND_WAIT_SECONDS, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
}
obs = envState.obs;
}
if (obs ... | [
"private",
"byte",
"[",
"]",
"getObservation",
"(",
"boolean",
"done",
")",
"{",
"byte",
"[",
"]",
"obs",
"=",
"envState",
".",
"obs",
";",
"if",
"(",
"obs",
"==",
"null",
"&&",
"!",
"done",
")",
"{",
"try",
"{",
"cond",
".",
"await",
"(",
"COND_... | Get the current observation. If none and not done wait for a short time. | [
"Get",
"the",
"current",
"observation",
".",
"If",
"none",
"and",
"not",
"done",
"wait",
"for",
"a",
"short",
"time",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java#L510-L523 |
23,075 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java | MalmoEnvServer.observation | public void observation(String info) {
// Parsing obs as JSON would be slower but less fragile than extracting the turn_key using string search.
String pattern = "\"turn_key\":\"";
int i = info.indexOf(pattern);
String turnKey = "";
if (i != -1) {
turnKey = info.subst... | java | public void observation(String info) {
// Parsing obs as JSON would be slower but less fragile than extracting the turn_key using string search.
String pattern = "\"turn_key\":\"";
int i = info.indexOf(pattern);
String turnKey = "";
if (i != -1) {
turnKey = info.subst... | [
"public",
"void",
"observation",
"(",
"String",
"info",
")",
"{",
"// Parsing obs as JSON would be slower but less fragile than extracting the turn_key using string search.",
"String",
"pattern",
"=",
"\"\\\"turn_key\\\":\\\"\"",
";",
"int",
"i",
"=",
"info",
".",
"indexOf",
... | Record a Malmo "observation" json - as the env info since an environment "obs" is a video frame. | [
"Record",
"a",
"Malmo",
"observation",
"json",
"-",
"as",
"the",
"env",
"info",
"since",
"an",
"environment",
"obs",
"is",
"a",
"video",
"frame",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java#L693-L716 |
23,076 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java | MalmoEnvServer.doIWantToQuit | @Override
public boolean doIWantToQuit(MissionInit missionInit) {
lock.lock();
try {
return envState.quit;
} finally {
lock.unlock();
}
} | java | @Override
public boolean doIWantToQuit(MissionInit missionInit) {
lock.lock();
try {
return envState.quit;
} finally {
lock.unlock();
}
} | [
"@",
"Override",
"public",
"boolean",
"doIWantToQuit",
"(",
"MissionInit",
"missionInit",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"envState",
".",
"quit",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
... | IWantToQuit implementation. | [
"IWantToQuit",
"implementation",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/MalmoEnvServer.java#L763-L771 |
23,077 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/TCPInputPoller.java | TCPInputPoller.stopServer | public void stopServer()
{
Log(Level.INFO, "Attempting to stop SocketServer");
keepRunning = false;
// Thread will be blocked waiting for input - unblock it by closing the socket underneath it:
if (this.serverSocket != null)
{
try
{
thi... | java | public void stopServer()
{
Log(Level.INFO, "Attempting to stop SocketServer");
keepRunning = false;
// Thread will be blocked waiting for input - unblock it by closing the socket underneath it:
if (this.serverSocket != null)
{
try
{
thi... | [
"public",
"void",
"stopServer",
"(",
")",
"{",
"Log",
"(",
"Level",
".",
"INFO",
",",
"\"Attempting to stop SocketServer\"",
")",
";",
"keepRunning",
"=",
"false",
";",
"// Thread will be blocked waiting for input - unblock it by closing the socket underneath it:",
"if",
"(... | Immediately stop waiting for messages, and close the SocketServer. | [
"Immediately",
"stop",
"waiting",
"for",
"messages",
"and",
"close",
"the",
"SocketServer",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/TCPInputPoller.java#L186-L203 |
23,078 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/StateEpisode.java | StateEpisode.start | public void start() {
this.isLive = true; // This episode is now active.
try {
execute();
} catch (Exception e) {
System.out.println("State start - exception: " + e);
e.printStackTrace();
// TODO... what?
}
} | java | public void start() {
this.isLive = true; // This episode is now active.
try {
execute();
} catch (Exception e) {
System.out.println("State start - exception: " + e);
e.printStackTrace();
// TODO... what?
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"this",
".",
"isLive",
"=",
"true",
";",
"// This episode is now active.",
"try",
"{",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Stat... | Called to kick off the episode - should be no need for subclasses to override. | [
"Called",
"to",
"kick",
"off",
"the",
"episode",
"-",
"should",
"be",
"no",
"need",
"for",
"subclasses",
"to",
"override",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/StateEpisode.java#L50-L59 |
23,079 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForStructureCopyingImplementation.java | RewardForStructureCopyingImplementation.getReward | @Override
public void getReward(MissionInit missionInit, MultidimensionalReward multidimReward)
{
super.getReward(missionInit, multidimReward);
if (this.rewardDensity == RewardDensityForBuildAndBreak.MISSION_END)
{
// Only send the reward at the very end of the mission.
... | java | @Override
public void getReward(MissionInit missionInit, MultidimensionalReward multidimReward)
{
super.getReward(missionInit, multidimReward);
if (this.rewardDensity == RewardDensityForBuildAndBreak.MISSION_END)
{
// Only send the reward at the very end of the mission.
... | [
"@",
"Override",
"public",
"void",
"getReward",
"(",
"MissionInit",
"missionInit",
",",
"MultidimensionalReward",
"multidimReward",
")",
"{",
"super",
".",
"getReward",
"(",
"missionInit",
",",
"multidimReward",
")",
";",
"if",
"(",
"this",
".",
"rewardDensity",
... | Get the reward value for the current Minecraft state.
@param missionInit the MissionInit object for the currently running mission,
which may contain parameters for the reward requirements.
@param multidimReward | [
"Get",
"the",
"reward",
"value",
"for",
"the",
"current",
"Minecraft",
"state",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForStructureCopyingImplementation.java#L52-L78 |
23,080 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForStructureCopyingImplementation.java | RewardForStructureCopyingImplementation.cleanup | @Override
public void cleanup()
{
super.cleanup();
MinecraftForge.EVENT_BUS.unregister(this);
structureHasBeenCompleted = false;
MalmoMod.MalmoMessageHandler.deregisterForMessage(this, MalmoMessageType.SERVER_MISSIONOVER);
} | java | @Override
public void cleanup()
{
super.cleanup();
MinecraftForge.EVENT_BUS.unregister(this);
structureHasBeenCompleted = false;
MalmoMod.MalmoMessageHandler.deregisterForMessage(this, MalmoMessageType.SERVER_MISSIONOVER);
} | [
"@",
"Override",
"public",
"void",
"cleanup",
"(",
")",
"{",
"super",
".",
"cleanup",
"(",
")",
";",
"MinecraftForge",
".",
"EVENT_BUS",
".",
"unregister",
"(",
"this",
")",
";",
"structureHasBeenCompleted",
"=",
"false",
";",
"MalmoMod",
".",
"MalmoMessageH... | Called once after the mission ends - use for any necessary cleanup. | [
"Called",
"once",
"after",
"the",
"mission",
"ends",
"-",
"use",
"for",
"any",
"necessary",
"cleanup",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForStructureCopyingImplementation.java#L126-L133 |
23,081 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MissionBehaviour.java | MissionBehaviour.addHandler | private void addHandler(Object handler)
{
// Would be nice to have a better way to do this,
// but the type information isn't preserved in the XML format anymore -
// and the number of types of handler is pretty unlikely to change, so this list
// won't have to be added to often, if ... | java | private void addHandler(Object handler)
{
// Would be nice to have a better way to do this,
// but the type information isn't preserved in the XML format anymore -
// and the number of types of handler is pretty unlikely to change, so this list
// won't have to be added to often, if ... | [
"private",
"void",
"addHandler",
"(",
"Object",
"handler",
")",
"{",
"// Would be nice to have a better way to do this,",
"// but the type information isn't preserved in the XML format anymore -",
"// and the number of types of handler is pretty unlikely to change, so this list",
"// won't hav... | Add this handler to our set, creating containers as needs be.
@param handler The handler to add. | [
"Add",
"this",
"handler",
"to",
"our",
"set",
"creating",
"containers",
"as",
"needs",
"be",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MissionBehaviour.java#L152-L179 |
23,082 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MissionBehaviour.java | MissionBehaviour.createHandlerFromParams | private Object createHandlerFromParams(Object xmlHandler)
{
if (xmlHandler == null)
return null;
Object handler = null;
String handlerClass = xmlHandler.getClass().getSimpleName();
if (handlerClass == null || handlerClass.length() == 0)
{
retu... | java | private Object createHandlerFromParams(Object xmlHandler)
{
if (xmlHandler == null)
return null;
Object handler = null;
String handlerClass = xmlHandler.getClass().getSimpleName();
if (handlerClass == null || handlerClass.length() == 0)
{
retu... | [
"private",
"Object",
"createHandlerFromParams",
"(",
"Object",
"xmlHandler",
")",
"{",
"if",
"(",
"xmlHandler",
"==",
"null",
")",
"return",
"null",
";",
"Object",
"handler",
"=",
"null",
";",
"String",
"handlerClass",
"=",
"xmlHandler",
".",
"getClass",
"(",
... | Attempt to create an instance of the specified handler class, using reflection.
@param xmlHandler the object which specifies both the name and the parameters of the requested handler.
@return an instance of the requested class, if possible, or null if the class wasn't found. | [
"Attempt",
"to",
"create",
"an",
"instance",
"of",
"the",
"specified",
"handler",
"class",
"using",
"reflection",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MissionBehaviour.java#L291-L326 |
23,083 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java | ScoreHelper.update | static public void update(Configuration configs)
{
scoringPolicy = configs.get(MalmoMod.SCORING_CONFIGS, "policy", DEFAULT_NO_SCORING).getInt();
if (scoringPolicy > 0) {
String customLogHandler = configs.get(MalmoMod.SCORING_CONFIGS, "handler", "").getString();
setLogging(Lev... | java | static public void update(Configuration configs)
{
scoringPolicy = configs.get(MalmoMod.SCORING_CONFIGS, "policy", DEFAULT_NO_SCORING).getInt();
if (scoringPolicy > 0) {
String customLogHandler = configs.get(MalmoMod.SCORING_CONFIGS, "handler", "").getString();
setLogging(Lev... | [
"static",
"public",
"void",
"update",
"(",
"Configuration",
"configs",
")",
"{",
"scoringPolicy",
"=",
"configs",
".",
"get",
"(",
"MalmoMod",
".",
"SCORING_CONFIGS",
",",
"\"policy\"",
",",
"DEFAULT_NO_SCORING",
")",
".",
"getInt",
"(",
")",
";",
"if",
"(",... | Initialize scoing. | [
"Initialize",
"scoing",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java#L60-L69 |
23,084 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java | ScoreHelper.logMissionInit | public static void logMissionInit(MissionInit missionInit) throws JAXBException {
if (!logging || !isScoring())
return;
totalRewards = 0.0;
String missionXml = SchemaHelper.serialiseObject(missionInit.getMission(), Mission.class);
String hash;
try {
hash... | java | public static void logMissionInit(MissionInit missionInit) throws JAXBException {
if (!logging || !isScoring())
return;
totalRewards = 0.0;
String missionXml = SchemaHelper.serialiseObject(missionInit.getMission(), Mission.class);
String hash;
try {
hash... | [
"public",
"static",
"void",
"logMissionInit",
"(",
"MissionInit",
"missionInit",
")",
"throws",
"JAXBException",
"{",
"if",
"(",
"!",
"logging",
"||",
"!",
"isScoring",
"(",
")",
")",
"return",
";",
"totalRewards",
"=",
"0.0",
";",
"String",
"missionXml",
"=... | Record a secure hash of the mission init XML - if scoring. | [
"Record",
"a",
"secure",
"hash",
"of",
"the",
"mission",
"init",
"XML",
"-",
"if",
"scoring",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java#L74-L99 |
23,085 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java | ScoreHelper.logReward | public static void logReward(String reward) {
if (!logging || !isScoring())
return;
if (scoringPolicy == LOG_EACH_REWARD) {
log("<Reward>" + reward + "</Reward>");
} else if (scoringPolicy == TOTAL_ALL_REWARDS || scoringPolicy == TOTAL_WITH_MISSION_XML) {
int ... | java | public static void logReward(String reward) {
if (!logging || !isScoring())
return;
if (scoringPolicy == LOG_EACH_REWARD) {
log("<Reward>" + reward + "</Reward>");
} else if (scoringPolicy == TOTAL_ALL_REWARDS || scoringPolicy == TOTAL_WITH_MISSION_XML) {
int ... | [
"public",
"static",
"void",
"logReward",
"(",
"String",
"reward",
")",
"{",
"if",
"(",
"!",
"logging",
"||",
"!",
"isScoring",
"(",
")",
")",
"return",
";",
"if",
"(",
"scoringPolicy",
"==",
"LOG_EACH_REWARD",
")",
"{",
"log",
"(",
"\"<Reward>\"",
"+",
... | Log a reward. | [
"Log",
"a",
"reward",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java#L102-L111 |
23,086 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java | ScoreHelper.logMissionEndRewards | public static void logMissionEndRewards(Reward reward) throws JAXBException {
if (!logging || !isScoring())
return;
if (scoringPolicy == LOG_EACH_REWARD) {
String rewardString = SchemaHelper.serialiseObject(reward, Reward.class);
log("<MissionEnd>" + rewardString + "<... | java | public static void logMissionEndRewards(Reward reward) throws JAXBException {
if (!logging || !isScoring())
return;
if (scoringPolicy == LOG_EACH_REWARD) {
String rewardString = SchemaHelper.serialiseObject(reward, Reward.class);
log("<MissionEnd>" + rewardString + "<... | [
"public",
"static",
"void",
"logMissionEndRewards",
"(",
"Reward",
"reward",
")",
"throws",
"JAXBException",
"{",
"if",
"(",
"!",
"logging",
"||",
"!",
"isScoring",
"(",
")",
")",
"return",
";",
"if",
"(",
"scoringPolicy",
"==",
"LOG_EACH_REWARD",
")",
"{",
... | Log mission end rewards. | [
"Log",
"mission",
"end",
"rewards",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/ScoreHelper.java#L114-L129 |
23,087 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Client/KeyManager.java | KeyManager.fixAdditionalKeyBindings | private void fixAdditionalKeyBindings(GameSettings settings)
{
if (this.additionalKeys == null)
{
return; // No extra keybindings to add.
}
// The keybindings are stored in GameSettings as a java built-in array.
// There is no way to append to such arrays, so... | java | private void fixAdditionalKeyBindings(GameSettings settings)
{
if (this.additionalKeys == null)
{
return; // No extra keybindings to add.
}
// The keybindings are stored in GameSettings as a java built-in array.
// There is no way to append to such arrays, so... | [
"private",
"void",
"fixAdditionalKeyBindings",
"(",
"GameSettings",
"settings",
")",
"{",
"if",
"(",
"this",
".",
"additionalKeys",
"==",
"null",
")",
"{",
"return",
";",
"// No extra keybindings to add.",
"}",
"// The keybindings are stored in GameSettings as a java built-... | Call this to finalise any additional key bindings we want to create in the mod.
@param settings Minecraft's original GameSettings object which we are appending to. | [
"Call",
"this",
"to",
"finalise",
"any",
"additional",
"key",
"bindings",
"we",
"want",
"to",
"create",
"in",
"the",
"mod",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Client/KeyManager.java#L57-L72 |
23,088 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java | SchemaHelper.getJAXBContext | static private JAXBContext getJAXBContext(Class<?> objclass) throws JAXBException
{
JAXBContext jaxbContext;
if (jaxbContentCache.containsKey(objclass.getName()))
{
jaxbContext = jaxbContentCache.get(objclass.getName());
}
else
{
jaxbContext = ... | java | static private JAXBContext getJAXBContext(Class<?> objclass) throws JAXBException
{
JAXBContext jaxbContext;
if (jaxbContentCache.containsKey(objclass.getName()))
{
jaxbContext = jaxbContentCache.get(objclass.getName());
}
else
{
jaxbContext = ... | [
"static",
"private",
"JAXBContext",
"getJAXBContext",
"(",
"Class",
"<",
"?",
">",
"objclass",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"jaxbContext",
";",
"if",
"(",
"jaxbContentCache",
".",
"containsKey",
"(",
"objclass",
".",
"getName",
"(",
")",
... | Serialise the object to an XML string
@param obj the object to be serialised
@param objclass the class of the object to be serialised
@return an XML string representing the object, or null if the object couldn't be serialised
@throws JAXBException | [
"Serialise",
"the",
"object",
"to",
"an",
"XML",
"string"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java#L67-L80 |
23,089 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java | SchemaHelper.deserialiseObject | static public Object deserialiseObject(String xml, String xsdFile, Class<?> objclass) throws JAXBException, SAXException, XMLStreamException
{
Object obj = null;
JAXBContext jaxbContext = getJAXBContext(objclass);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_S... | java | static public Object deserialiseObject(String xml, String xsdFile, Class<?> objclass) throws JAXBException, SAXException, XMLStreamException
{
Object obj = null;
JAXBContext jaxbContext = getJAXBContext(objclass);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_S... | [
"static",
"public",
"Object",
"deserialiseObject",
"(",
"String",
"xml",
",",
"String",
"xsdFile",
",",
"Class",
"<",
"?",
">",
"objclass",
")",
"throws",
"JAXBException",
",",
"SAXException",
",",
"XMLStreamException",
"{",
"Object",
"obj",
"=",
"null",
";",
... | Attempt to construct the specified object from this XML string
@param xml the XML string to parse
@param xsdFile the name of the XSD schema that defines the object
@param objclass the class of the object requested
@return if successful, an instance of class objclass that captures the data in the XML string | [
"Attempt",
"to",
"construct",
"the",
"specified",
"object",
"from",
"this",
"XML",
"string"
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java#L98-L118 |
23,090 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java | SchemaHelper.getRootNodeName | static public String getRootNodeName(String xml)
{
String rootNodeName = null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setExpandEntityReferences(false);
DocumentBuilder dBuilder = dbf.newDocumentBuilder();
InputSour... | java | static public String getRootNodeName(String xml)
{
String rootNodeName = null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setExpandEntityReferences(false);
DocumentBuilder dBuilder = dbf.newDocumentBuilder();
InputSour... | [
"static",
"public",
"String",
"getRootNodeName",
"(",
"String",
"xml",
")",
"{",
"String",
"rootNodeName",
"=",
"null",
";",
"try",
"{",
"DocumentBuilderFactory",
"dbf",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"dbf",
".",
"setExpandEnti... | Retrieve the name of the root node in an XML string.
@param xml The XML string to parse.
@return The name of the root node, or null if parsing failed. | [
"Retrieve",
"the",
"name",
"of",
"the",
"root",
"node",
"in",
"an",
"XML",
"string",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/SchemaHelper.java#L124-L143 |
23,091 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/AddressHelper.java | AddressHelper.setMissionControlPort | static public void setMissionControlPort(int port)
{
if (port != AddressHelper.missionControlPort)
{
AddressHelper.missionControlPort = port;
// Also update our metadata, for displaying to the user:
ModMetadata md = Loader.instance().activeModContainer().getMetadata();
if (port != -1)
md.descriptio... | java | static public void setMissionControlPort(int port)
{
if (port != AddressHelper.missionControlPort)
{
AddressHelper.missionControlPort = port;
// Also update our metadata, for displaying to the user:
ModMetadata md = Loader.instance().activeModContainer().getMetadata();
if (port != -1)
md.descriptio... | [
"static",
"public",
"void",
"setMissionControlPort",
"(",
"int",
"port",
")",
"{",
"if",
"(",
"port",
"!=",
"AddressHelper",
".",
"missionControlPort",
")",
"{",
"AddressHelper",
".",
"missionControlPort",
"=",
"port",
";",
"// Also update our metadata, for displaying... | Set the actual port used for mission control - not persisted, could be different each time the Mod is run.
@param port the port currently in use for mission control. | [
"Set",
"the",
"actual",
"port",
"used",
"for",
"mission",
"control",
"-",
"not",
"persisted",
"could",
"be",
"different",
"each",
"time",
"the",
"Mod",
"is",
"run",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/AddressHelper.java#L64-L79 |
23,092 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/TCPSocketChannel.java | TCPSocketChannel.sendTCPString | public boolean sendTCPString(String message, int retries)
{
Log(Level.FINE, "About to send: " + message);
byte[] bytes = message.getBytes();
return sendTCPBytes(bytes, retries);
} | java | public boolean sendTCPString(String message, int retries)
{
Log(Level.FINE, "About to send: " + message);
byte[] bytes = message.getBytes();
return sendTCPBytes(bytes, retries);
} | [
"public",
"boolean",
"sendTCPString",
"(",
"String",
"message",
",",
"int",
"retries",
")",
"{",
"Log",
"(",
"Level",
".",
"FINE",
",",
"\"About to send: \"",
"+",
"message",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"message",
".",
"getBytes",
"(",
")",... | Send string over TCP to the specified address via the specified port, including a header.
@param message string to be sent over TCP
@param retries number of times to retry in event of failure
@return true if message was successfully sent | [
"Send",
"string",
"over",
"TCP",
"to",
"the",
"specified",
"address",
"via",
"the",
"specified",
"port",
"including",
"a",
"header",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/TCPSocketChannel.java#L108-L113 |
23,093 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForSendingMatchingChatMessageImplementation.java | RewardForSendingMatchingChatMessageImplementation.addChatMatchSpecToRewardStructure | private void addChatMatchSpecToRewardStructure(ChatMatchSpec c) {
Float reward = c.getReward().floatValue();
Pattern pattern = Pattern.compile(c.getRegex(), Pattern.CASE_INSENSITIVE);
patternMap.put(pattern, reward);
distributionMap.put(pattern, c.getDistribution());
} | java | private void addChatMatchSpecToRewardStructure(ChatMatchSpec c) {
Float reward = c.getReward().floatValue();
Pattern pattern = Pattern.compile(c.getRegex(), Pattern.CASE_INSENSITIVE);
patternMap.put(pattern, reward);
distributionMap.put(pattern, c.getDistribution());
} | [
"private",
"void",
"addChatMatchSpecToRewardStructure",
"(",
"ChatMatchSpec",
"c",
")",
"{",
"Float",
"reward",
"=",
"c",
".",
"getReward",
"(",
")",
".",
"floatValue",
"(",
")",
";",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"c",
".",
"ge... | Helper function for adding a chat match specification to the pattern map.
@param c the chat message specification that contains the pattern and reward. | [
"Helper",
"function",
"for",
"adding",
"a",
"chat",
"match",
"specification",
"to",
"the",
"pattern",
"map",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForSendingMatchingChatMessageImplementation.java#L61-L66 |
23,094 | Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/Discrete.java | Discrete.sample | public int sample()
{
double val = this.rand.nextDouble() * this.sum;
int sample = 0;
while(sample < this.likelihoods.length){
val -= this.likelihoods[sample];
if(val < 0){
return sample;
}
sample++;
}
... | java | public int sample()
{
double val = this.rand.nextDouble() * this.sum;
int sample = 0;
while(sample < this.likelihoods.length){
val -= this.likelihoods[sample];
if(val < 0){
return sample;
}
sample++;
}
... | [
"public",
"int",
"sample",
"(",
")",
"{",
"double",
"val",
"=",
"this",
".",
"rand",
".",
"nextDouble",
"(",
")",
"*",
"this",
".",
"sum",
";",
"int",
"sample",
"=",
"0",
";",
"while",
"(",
"sample",
"<",
"this",
".",
"likelihoods",
".",
"length",
... | Sample a value from the distribution.
@return The sampled dimension | [
"Sample",
"a",
"value",
"from",
"the",
"distribution",
"."
] | 4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/Discrete.java#L78-L92 |
23,095 | willowtreeapps/Hyperion-Android | hyperion-core/src/main/java/com/willowtreeapps/hyperion/core/Hyperion.java | Hyperion.setShakeGestureSensitivity | public static void setShakeGestureSensitivity(float sensitivity) {
requireApplication();
AppComponent.Holder.getInstance(application).getPublicControl().setShakeGestureSensitivity(sensitivity);
} | java | public static void setShakeGestureSensitivity(float sensitivity) {
requireApplication();
AppComponent.Holder.getInstance(application).getPublicControl().setShakeGestureSensitivity(sensitivity);
} | [
"public",
"static",
"void",
"setShakeGestureSensitivity",
"(",
"float",
"sensitivity",
")",
"{",
"requireApplication",
"(",
")",
";",
"AppComponent",
".",
"Holder",
".",
"getInstance",
"(",
"application",
")",
".",
"getPublicControl",
"(",
")",
".",
"setShakeGestu... | Set the sensitivity threshold of shake detection in G's. Default is 3
@param sensitivity Sensitivity of shake detection in G's. Lower is easier to activate. | [
"Set",
"the",
"sensitivity",
"threshold",
"of",
"shake",
"detection",
"in",
"G",
"s",
".",
"Default",
"is",
"3"
] | 1910f53869a53f1395ba90588a0b4db7afdec79c | https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-core/src/main/java/com/willowtreeapps/hyperion/core/Hyperion.java#L35-L38 |
23,096 | willowtreeapps/Hyperion-Android | hyperion-core/src/main/java/com/willowtreeapps/hyperion/core/Hyperion.java | Hyperion.setPlugins | public static void setPlugins(PluginSource pluginSource) {
requireApplication();
AppComponent.Holder.getInstance(application).getPublicControl().setPluginSource(pluginSource);
} | java | public static void setPlugins(PluginSource pluginSource) {
requireApplication();
AppComponent.Holder.getInstance(application).getPublicControl().setPluginSource(pluginSource);
} | [
"public",
"static",
"void",
"setPlugins",
"(",
"PluginSource",
"pluginSource",
")",
"{",
"requireApplication",
"(",
")",
";",
"AppComponent",
".",
"Holder",
".",
"getInstance",
"(",
"application",
")",
".",
"getPublicControl",
"(",
")",
".",
"setPluginSource",
"... | Hook to manually register a plugin source.
This API does not update the Hyperion menu retroactively,
so clients should call this as early as possible.
NOTE: For most users, the default {@link java.util.ServiceLoader} implementation will suffice.
@param pluginSource the {@link PluginSource} invoked in place of the def... | [
"Hook",
"to",
"manually",
"register",
"a",
"plugin",
"source",
".",
"This",
"API",
"does",
"not",
"update",
"the",
"Hyperion",
"menu",
"retroactively",
"so",
"clients",
"should",
"call",
"this",
"as",
"early",
"as",
"possible",
"."
] | 1910f53869a53f1395ba90588a0b4db7afdec79c | https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-core/src/main/java/com/willowtreeapps/hyperion/core/Hyperion.java#L67-L70 |
23,097 | willowtreeapps/Hyperion-Android | hyperion-timber/src/main/java/com/willowtreeapps/hyperion/timber/model/CircularBuffer.java | CircularBuffer.enqueue | public void enqueue(T item) {
queue[head] = item;
head++;
size++;
if (head == queue.length) head = 0;
} | java | public void enqueue(T item) {
queue[head] = item;
head++;
size++;
if (head == queue.length) head = 0;
} | [
"public",
"void",
"enqueue",
"(",
"T",
"item",
")",
"{",
"queue",
"[",
"head",
"]",
"=",
"item",
";",
"head",
"++",
";",
"size",
"++",
";",
"if",
"(",
"head",
"==",
"queue",
".",
"length",
")",
"head",
"=",
"0",
";",
"}"
] | Add an item to the queue.
@param item to be added | [
"Add",
"an",
"item",
"to",
"the",
"queue",
"."
] | 1910f53869a53f1395ba90588a0b4db7afdec79c | https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-timber/src/main/java/com/willowtreeapps/hyperion/timber/model/CircularBuffer.java#L28-L33 |
23,098 | willowtreeapps/Hyperion-Android | hyperion-timber/src/main/java/com/willowtreeapps/hyperion/timber/model/CircularBuffer.java | CircularBuffer.getItem | @SuppressWarnings("unchecked")
public T getItem(int index) {
int target = head - 1 - index;
if (target < 0) target = size + target - head;
return (T) queue[target];
} | java | @SuppressWarnings("unchecked")
public T getItem(int index) {
int target = head - 1 - index;
if (target < 0) target = size + target - head;
return (T) queue[target];
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"getItem",
"(",
"int",
"index",
")",
"{",
"int",
"target",
"=",
"head",
"-",
"1",
"-",
"index",
";",
"if",
"(",
"target",
"<",
"0",
")",
"target",
"=",
"size",
"+",
"target",
"-",
"... | Get the item at a position `n` positions from the head.
@param index of the item to retrieve
@return the stored item | [
"Get",
"the",
"item",
"at",
"a",
"position",
"n",
"positions",
"from",
"the",
"head",
"."
] | 1910f53869a53f1395ba90588a0b4db7afdec79c | https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-timber/src/main/java/com/willowtreeapps/hyperion/timber/model/CircularBuffer.java#L50-L55 |
23,099 | willowtreeapps/Hyperion-Android | hyperion-phoenix/src/main/java/com/willowtreeapps/hyperion/phoenix/ProcessPhoenix.java | ProcessPhoenix.isPhoenixProcess | public static boolean isPhoenixProcess(Context context) {
int currentPid = Process.myPid();
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningProcesses = manager.getRunningAppProcesses();
if ... | java | public static boolean isPhoenixProcess(Context context) {
int currentPid = Process.myPid();
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningProcesses = manager.getRunningAppProcesses();
if ... | [
"public",
"static",
"boolean",
"isPhoenixProcess",
"(",
"Context",
"context",
")",
"{",
"int",
"currentPid",
"=",
"Process",
".",
"myPid",
"(",
")",
";",
"ActivityManager",
"manager",
"=",
"(",
"ActivityManager",
")",
"context",
".",
"getSystemService",
"(",
"... | Checks if the current process is a temporary Phoenix Process.
This can be used to avoid initialisation of unused resources or to prevent running code that
is not multi-process ready.
@return true if the current process is a temporary Phoenix Process | [
"Checks",
"if",
"the",
"current",
"process",
"is",
"a",
"temporary",
"Phoenix",
"Process",
".",
"This",
"can",
"be",
"used",
"to",
"avoid",
"initialisation",
"of",
"unused",
"resources",
"or",
"to",
"prevent",
"running",
"code",
"that",
"is",
"not",
"multi",... | 1910f53869a53f1395ba90588a0b4db7afdec79c | https://github.com/willowtreeapps/Hyperion-Android/blob/1910f53869a53f1395ba90588a0b4db7afdec79c/hyperion-phoenix/src/main/java/com/willowtreeapps/hyperion/phoenix/ProcessPhoenix.java#L164-L176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.