本文整理汇总了Java中forestry.api.genetics.IIndividual.isAnalyzed方法的典型用法代码示例。如果您正苦于以下问题:Java IIndividual.isAnalyzed方法的具体用法?Java IIndividual.isAnalyzed怎么用?Java IIndividual.isAnalyzed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forestry.api.genetics.IIndividual
的用法示例。
在下文中一共展示了IIndividual.isAnalyzed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callMethod
import forestry.api.genetics.IIndividual; //导入方法依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
if (!Config.enableAnalyzers)
throw new LuaException("Analyzers have been disabled");
switch (method) {
case 0:
ISpeciesRoot root = getRoot();
ItemStack stack = getStackInSlot(0);
if (stack == null || !root.isMember(stack))
return new Object[] {false};
IIndividual individual = root.getMember(stack);
if (!individual.isAnalyzed())
return new Object[] {null};
HashMap<String, Object> ret = new HashMap<String, Object>();
addGenome(stack, individual.getGenome(), ret);
return new Object[] {ret};
case 1:
ItemStack specimen = getStackInSlot(0);
if (specimen == null || !getRoot().isMember(specimen))
return new Object[] {false};
return new Object[] {true};
}
return new Object[]{};
}
示例2: describeIndividual
import forestry.api.genetics.IIndividual; //导入方法依赖的package包/类
public static Map<String, Object> describeIndividual(IIndividual individual) {
Map<String, Object> map = Maps.newHashMap();
map.put("displayName", individual.getDisplayName());
map.put("ident", individual.getIdent());
final boolean isAnalyzed = individual.isAnalyzed();
map.put("isAnalyzed", isAnalyzed);
map.put("isSecret", individual.isSecret());
map.put("hasEffect", individual.hasEffect());
GenomeReader<?, ?> genomeReader = null;
if (individual instanceof IIndividualLiving) {
IIndividualLiving living = (IIndividualLiving)individual;
map.put("health", living.getHealth());
map.put("maxHealth", living.getMaxHealth());
map.put("isAlive", living.isAlive());
}
if (individual instanceof IBee) {
IBee bee = (IBee)individual;
map.put("type", "bee");
map.put("canSpawn", bee.canSpawn());
map.put("generation", bee.getGeneration());
map.put("isNatural", bee.isNatural());
if (isAnalyzed) genomeReader = new BeeGenomeReader(bee.getGenome());
} else if (individual instanceof IButterfly) {
IButterfly butterfly = (IButterfly)individual;
map.put("type", "butterfly");
map.put("size", butterfly.getSize());
if (isAnalyzed) genomeReader = new ButterflyGenomeReader(butterfly.getGenome());
} else if (individual instanceof ITree) {
ITree tree = (ITree)individual;
map.put("type", "tree");
map.put("plantType", tree.getPlantTypes().toString());
if (isAnalyzed) genomeReader = new TreeGenomeReader(tree.getGenome());
}
if (genomeReader != null) {
map.put("active", genomeReader.getActiveInfo());
map.put("inactive", genomeReader.getInactiveInfo());
}
return map;
}