Java 类com.google.common.base.Predicate 实例源码

项目:harshencastle    文件:EntitySoulPart.java   
@Override
protected void initEntityAI() {
    this.tasks.addTask(8, new AIEntityFlyingTowardsPlayer(this));
       this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 3.0F, 1.0F));
       this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
    this.tasks.addTask(11, new EntityAILookIdle(this));

    this.targetTasks.addTask(0, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, 10, false, false, new Predicate<EntityLivingBase>() {

        @Override
        public boolean apply(EntityLivingBase input) {
            return !input.isPotionActive(HarshenPotions.potionSoulless);
        }
    }));

}
项目:Reer    文件:ManagedProxyClassGenerator.java   
private void writeViewPropertyDslMethods(ClassVisitor visitor, Type generatedType, Collection<ModelProperty<?>> viewProperties, Class<?> viewClass) {
    boolean writable = Iterables.any(viewProperties, new Predicate<ModelProperty<?>>() {
        @Override
        public boolean apply(ModelProperty<?> viewProperty) {
            return viewProperty.isWritable();
        }
    });
    // TODO:LPTR Instead of the first view property, we should figure out these parameters from the actual property
    ModelProperty<?> firstProperty = viewProperties.iterator().next();

    writeConfigureMethod(visitor, generatedType, firstProperty, writable);
    writeSetMethod(visitor, generatedType, firstProperty);
    writeTypeConvertingSetter(visitor, generatedType, viewClass, firstProperty);

    // TODO - this should be applied to all methods, including delegating methods
    writeReadOnlySetter(visitor, viewClass, writable, firstProperty);
}
项目:Backmemed    文件:EntityOcelot.java   
protected void initEntityAI()
{
    this.aiSit = new EntityAISit(this);
    this.aiTempt = new EntityAITempt(this, 0.6D, Items.FISH, true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, this.aiTempt);
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F));
    this.tasks.addTask(6, new EntityAIOcelotSit(this, 0.8D));
    this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.3F));
    this.tasks.addTask(8, new EntityAIOcelotAttack(this));
    this.tasks.addTask(9, new EntityAIMate(this, 0.8D));
    this.tasks.addTask(10, new EntityAIWanderAvoidWater(this, 0.8D, 1.0000001E-5F));
    this.tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
    this.targetTasks.addTask(1, new EntityAITargetNonTamed(this, EntityChicken.class, false, (Predicate)null));
}
项目:BaseClient    文件:BlockPattern.java   
public BlockPattern(Predicate<BlockWorldState>[][][] predicatesIn)
{
    this.blockMatches = predicatesIn;
    this.fingerLength = predicatesIn.length;

    if (this.fingerLength > 0)
    {
        this.thumbLength = predicatesIn[0].length;

        if (this.thumbLength > 0)
        {
            this.palmLength = predicatesIn[0][0].length;
        }
        else
        {
            this.palmLength = 0;
        }
    }
    else
    {
        this.thumbLength = 0;
        this.palmLength = 0;
    }
}
项目:reflect    文件:Example.java   
private static void resources() {
  Resources rs1 = Scanner.paths("/io/ytcode/reflect/").scan();

  Resources rs2 = rs1.pattern(".*/resource/.*").suffix(".class");
  System.out.println(rs2.size());

  Resources rs3 =
      rs1.filter(
          new Predicate<Resource>() {
            @Override
            public boolean apply(Resource r) {
              return r.name().endsWith(".xml");
            }
          });
  System.out.println(rs3.size());
}
项目:DecompiledMinecraft    文件:EntityAIAvoidEntity.java   
public EntityAIAvoidEntity(EntityCreature p_i46405_1_, Class<T> p_i46405_2_, Predicate <? super T > p_i46405_3_, float p_i46405_4_, double p_i46405_5_, double p_i46405_7_)
{
    this.canBeSeenSelector = new Predicate<Entity>()
    {
        public boolean apply(Entity p_apply_1_)
        {
            return p_apply_1_.isEntityAlive() && EntityAIAvoidEntity.this.theEntity.getEntitySenses().canSee(p_apply_1_);
        }
    };
    this.theEntity = p_i46405_1_;
    this.field_181064_i = p_i46405_2_;
    this.avoidTargetSelector = p_i46405_3_;
    this.avoidDistance = p_i46405_4_;
    this.farSpeed = p_i46405_5_;
    this.nearSpeed = p_i46405_7_;
    this.entityPathNavigate = p_i46405_1_.getNavigator();
    this.setMutexBits(1);
}
项目:vscrawler    文件:EventLoop.java   
public void offerEvent(final Event event) {
    if (!isRunning.get()) {
        log.warn("程序已停止");
        return;
    }
    if (!allHandlers.containsKey(event.getTopic()) || allHandlers.get(event.getTopic()).size() < 0) {
        log.debug("cannot find handle for event:{}", event.getTopic());
        return;
    }
    if (event.isSync()) {
        disPatch(event);
        return;
    }
    if (event.isCleanExpire()) {
        eventQueue.removeAll(Collections2.filter(eventQueue, new Predicate<Event>() {
            @Override
            public boolean apply(Event input) {
                return StringUtils.equals(input.getTopic(), event.getTopic());
            }
        }));
    }
    eventQueue.put(event);


}
项目:DecompiledMinecraft    文件:FactoryBlockPattern.java   
private void checkMissingPredicates()
{
    List<Character> list = Lists.<Character>newArrayList();

    for (Entry<Character, Predicate<BlockWorldState>> entry : this.symbolMap.entrySet())
    {
        if (entry.getValue() == null)
        {
            list.add(entry.getKey());
        }
    }

    if (!list.isEmpty())
    {
        throw new IllegalStateException("Predicates for character(s) " + COMMA_JOIN.join(list) + " are missing");
    }
}
项目:CountryCurrencyPicker    文件:Country.java   
public static ArrayList<Country> listAll(Context context, final String filter) {
    ArrayList<Country> list = new ArrayList<>();

    for (String countryCode : Locale.getISOCountries()) {
        Country country = getCountry(countryCode, context);

        list.add(country);
    }

    sortList(list);

    if (filter != null && filter.length() > 0) {
        return new ArrayList<>(Collections2.filter(list, new Predicate<Country>() {
            @Override
            public boolean apply(Country input) {
                return input.getName().toLowerCase().contains(filter.toLowerCase());
            }
        }));
    } else {
        return list;
    }
}
项目:tac-kbp-eal    文件:ScoreKBPAgainstERE.java   
@Inject
ScoreKBPAgainstERE(
    final Parameters params,
    final Map<String, ScoringEventObserver<DocLevelEventArg, DocLevelEventArg>> scoringEventObservers,
    final ResponsesAndLinkingFromEREExtractor responsesAndLinkingFromEREExtractor,
    ResponsesAndLinkingFromKBPExtractorFactory responsesAndLinkingFromKBPExtractorFactory,
    @DocIDsToScoreP Set<Symbol> docIdsToScore,
    @KeyFileMapP Map<Symbol, File> keyFilesMap,
    Predicate<DocLevelEventArg> inScopePredicate,
    @PermitMissingSystemDocsP boolean permitMissingSystemDocuments) {
  this.params = checkNotNull(params);
  // we use a sorted map because the binding of plugins may be non-deterministic
  this.scoringEventObservers = ImmutableSortedMap.copyOf(scoringEventObservers);
  this.responsesAndLinkingFromEREExtractor = checkNotNull(responsesAndLinkingFromEREExtractor);
  this.responsesAndLinkingFromKBPExtractorFactory = responsesAndLinkingFromKBPExtractorFactory;
  this.docIDsToScore = ImmutableSet.copyOf(docIdsToScore);
  this.goldDocIDToFileMap = ImmutableMap.copyOf(keyFilesMap);
  this.inScopePredicate = inScopePredicate;
  this.permitMissingSystemDocuments = permitMissingSystemDocuments;
}
项目:Backmemed    文件:EntityAIFindEntityNearest.java   
public EntityAIFindEntityNearest(EntityLiving mobIn, Class <? extends EntityLivingBase > p_i45884_2_)
{
    this.mob = mobIn;
    this.classToCheck = p_i45884_2_;

    if (mobIn instanceof EntityCreature)
    {
        LOGGER.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!");
    }

    this.predicate = new Predicate<EntityLivingBase>()
    {
        public boolean apply(@Nullable EntityLivingBase p_apply_1_)
        {
            double d0 = EntityAIFindEntityNearest.this.getFollowRange();

            if (p_apply_1_.isSneaking())
            {
                d0 *= 0.800000011920929D;
            }

            return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.mob) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.mob, p_apply_1_, false, true));
        }
    };
    this.sorter = new EntityAINearestAttackableTarget.Sorter(mobIn);
}
项目:BaseClient    文件:Chunk.java   
public <T extends Entity> void getEntitiesOfTypeWithinAAAB(Class <? extends T > entityClass, AxisAlignedBB aabb, List<T> listToFill, Predicate <? super T > p_177430_4_)
{
    int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D);
    int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D);
    i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        for (T t : this.entityLists[k].getByClass(entityClass))
        {
            if (t.getEntityBoundingBox().intersectsWith(aabb) && (p_177430_4_ == null || p_177430_4_.apply(t)))
            {
                listToFill.add(t);
            }
        }
    }
}
项目:Backmemed    文件:Chunk.java   
public <T extends Entity> void getEntitiesOfTypeWithinAAAB(Class <? extends T > entityClass, AxisAlignedBB aabb, List<T> listToFill, Predicate <? super T > filter)
{
    int i = MathHelper.floor((aabb.minY - 2.0D) / 16.0D);
    int j = MathHelper.floor((aabb.maxY + 2.0D) / 16.0D);
    i = MathHelper.clamp(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        for (T t : this.entityLists[k].getByClass(entityClass))
        {
            if (t.getEntityBoundingBox().intersectsWith(aabb) && (filter == null || filter.apply(t)))
            {
                listToFill.add(t);
            }
        }
    }
}
项目:Backmemed    文件:MultipartBakedModel.java   
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand)
{
    List<BakedQuad> list = Lists.<BakedQuad>newArrayList();

    if (state != null)
    {
        for (Entry<Predicate<IBlockState>, IBakedModel> entry : this.selectors.entrySet())
        {
            if (((Predicate)entry.getKey()).apply(state))
            {
                list.addAll(((IBakedModel)entry.getValue()).getQuads(state, side, rand++));
            }
        }
    }

    return list;
}
项目:dremio-oss    文件:ConvertFromJsonOperator.java   
/**
 * Update field schema
 * @param datasetConfig old dataset config
 * @param fieldName field's name
 * @param fieldSchema new field schema
 * @return updated dataset config
 */
private DatasetConfig updateDatasetField(DatasetConfig datasetConfig, final String fieldName, CompleteType fieldSchema) {
  // clone the dataset config
  Serializer<DatasetConfig> serializer = ProtostuffSerializer.of(DatasetConfig.getSchema());
  DatasetConfig newDatasetConfig = serializer.deserialize(serializer.serialize(datasetConfig));

  List<DatasetField> datasetFields = newDatasetConfig.getDatasetFieldsList();
  if (datasetFields == null) {
    datasetFields = Lists.newArrayList();
  }

  DatasetField datasetField = Iterables.find(datasetFields, new Predicate<DatasetField>() {
    @Override
    public boolean apply(@Nullable DatasetField input) {
      return fieldName.equals(input.getFieldName());
    }
  }, null);

  if (datasetField == null) {
    datasetField = new DatasetField().setFieldName(fieldName);
    datasetFields.add(datasetField);
  }

  datasetField.setFieldSchema(ByteString.copyFrom(fieldSchema.serialize()));
  newDatasetConfig.setDatasetFieldsList(datasetFields);

  return newDatasetConfig;
}
项目:ArchUnit    文件:Locations.java   
private static Set<Location> jarLocationsOf(URLClassLoader loader) {
    return FluentIterable.from(Locations.of(ImmutableSet.copyOf(loader.getURLs())))
            .filter(new Predicate<Location>() {
                @Override
                public boolean apply(Location input) {
                    return input.isJar();
                }
            }).toSet();
}
项目:Mods    文件:ItemFromData.java   
public static ItemStack getRandomWeapon(Random random, Predicate<WeaponData> predicate) {

        ArrayList<String> weapons = new ArrayList<>();
        for (Entry<String, WeaponData> entry : MapList.nameToData.entrySet())
            if (predicate.apply(entry.getValue())){
                weapons.add(entry.getKey());
            }
        if (weapons.isEmpty())
            return ItemStack.EMPTY;
        return getNewStack(weapons.get(random.nextInt(weapons.size())));
    }
项目:Reer    文件:LibraryResolutionResult.java   
public static LibraryResolutionResult of(Class<? extends Binary> binaryType, Collection<? extends VariantComponent> libraries, String libraryName, Predicate<? super VariantComponent> libraryFilter) {
    LibraryResolutionResult result = new LibraryResolutionResult(binaryType);
    for (VariantComponent librarySpec : libraries) {
        if (libraryFilter.apply(librarySpec)) {
            result.libsMatchingRequirements.put(librarySpec.getName(), librarySpec);
        } else {
            result.libsNotMatchingRequirements.put(librarySpec.getName(), librarySpec);
        }
    }
    result.resolve(libraryName);
    return result;
}
项目:morf    文件:TableOutputter.java   
/**
 * Indicates if the table has a column with a column type which we can't
 * output to a spreadsheet.
 *
 * @param table The table metadata.
 * @return
 */
boolean tableHasUnsupportedColumns(Table table) {
  return Iterables.any(table.columns(), new Predicate<Column>() {
    @Override
    public boolean apply(Column column) {
      return !supportedDataTypes.contains(column.getType());
    }
  });
}
项目:dremio-oss    文件:AccelerationStore.java   
public Optional<Layout> getLayoutById(final LayoutId id) {
  final Optional<Acceleration> acceleration = getByIndex(AccelerationIndexKeys.LAYOUT_ID, id.getId());
  if (!acceleration.isPresent()) {
    return Optional.absent();
  }

  return Iterables.tryFind(AccelerationUtils.getAllLayouts(acceleration.get()), new Predicate<Layout>() {
    @Override
    public boolean apply(@Nullable final Layout current) {
      return id.equals(current.getId());
    }
  });
}
项目:Reer    文件:DefaultModelSchemaExtractor.java   
private void pushUnsatisfiedDependencies(Iterable<? extends DefaultModelSchemaExtractionContext<?>> allDependencies, Queue<DefaultModelSchemaExtractionContext<?>> dependencyQueue, final ModelSchemaCache cache) {
    Iterables.addAll(dependencyQueue, Iterables.filter(allDependencies, new Predicate<ModelSchemaExtractionContext<?>>() {
        public boolean apply(ModelSchemaExtractionContext<?> dependency) {
            return cache.get(dependency.getType()) == null;
        }
    }));
}
项目:Mods    文件:EntityHHH.java   
protected void initEntityAI()
  {
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class,2, false,false,new Predicate<EntityLivingBase>(){

    @Override
    public boolean apply(EntityLivingBase input) {
        // TODO Auto-generated method stub
        return input.getActivePotionEffect(TF2weapons.it)!=null;
    }

      }));
/*this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
      this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class,2, false,false,new Predicate<EntityLivingBase>(){

    @Override
    public boolean apply(EntityLivingBase input) {
        // TODO Auto-generated method stub
        return (input instanceof EntityTF2Character || input instanceof EntityPlayer) && getDistanceSqToEntity(input)<600;
    }

      }));*/

  }
项目:empiria.player    文件:HTML5MediaEventMapperJUnitTest.java   
public Object[] parametersForShouldNotCallListener_ifNorEndedNorPlay() {
    List<HTML5MediaEventsType> events = FluentIterable.from(Lists.newArrayList(HTML5MediaEventsType.values()))
            .filter(new Predicate<HTML5MediaEventsType>() {

                @Override
                public boolean apply(HTML5MediaEventsType type) {
                    return type != play && type != ended;
                }

            })
            .toList();

    return $(events.toArray());
}
项目:guava-mock    文件:Sets.java   
/**
 * Returns an unmodifiable <b>view</b> of the difference of two sets. The
 * returned set contains all elements that are contained by {@code set1} and
 * not contained by {@code set2}. {@code set2} may also contain elements not
 * present in {@code set1}; these are simply ignored. The iteration order of
 * the returned set matches that of {@code set1}.
 *
 * <p>Results are undefined if {@code set1} and {@code set2} are sets based
 * on different equivalence relations (as {@code HashSet}, {@code TreeSet},
 * and the keySet of an {@code IdentityHashMap} all are).
 */
public static <E> SetView<E> difference(final Set<E> set1, final Set<?> set2) {
  checkNotNull(set1, "set1");
  checkNotNull(set2, "set2");

  final Predicate<Object> notInSet2 = Predicates.not(Predicates.in(set2));
  return new SetView<E>() {
    @Override
    public UnmodifiableIterator<E> iterator() {
      return Iterators.filter(set1.iterator(), notInSet2);
    }

    @Override
    public Stream<E> stream() {
      return set1.stream().filter(notInSet2);
    }

    @Override
    public Stream<E> parallelStream() {
      return set1.parallelStream().filter(notInSet2);
    }

    @Override
    public int size() {
      return Iterators.size(iterator());
    }

    @Override
    public boolean isEmpty() {
      return set2.containsAll(set1);
    }

    @Override
    public boolean contains(Object element) {
      return set1.contains(element) && !set2.contains(element);
    }
  };
}
项目:Backmemed    文件:EntityEnderman.java   
public boolean shouldExecute()
{
    double d0 = this.getTargetDistance();
    this.player = this.enderman.world.getNearestAttackablePlayer(this.enderman.posX, this.enderman.posY, this.enderman.posZ, d0, d0, (Function<EntityPlayer, Double>)null, new Predicate<EntityPlayer>()
    {
        public boolean apply(@Nullable EntityPlayer p_apply_1_)
        {
            return p_apply_1_ != null && AIFindPlayer.this.enderman.shouldAttackPlayer(p_apply_1_);
        }
    });
    return this.player != null;
}
项目:CustomWorldGen    文件:ConditionAnd.java   
public Predicate<IBlockState> getPredicate(final BlockStateContainer blockState)
{
    return Predicates.and(Iterables.transform(this.conditions, new Function<ICondition, Predicate<IBlockState>>()
    {
        @Nullable
        public Predicate<IBlockState> apply(@Nullable ICondition p_apply_1_)
        {
            return p_apply_1_ == null ? null : p_apply_1_.getPredicate(blockState);
        }
    }));
}
项目:DecompiledMinecraft    文件:EntityGuardian.java   
protected void updateAITasks()
{
    super.updateAITasks();

    if (this.isElder())
    {
        int i = 1200;
        int j = 1200;
        int k = 6000;
        int l = 2;

        if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
        {
            Potion potion = Potion.digSlowdown;

            for (EntityPlayerMP entityplayermp : this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate<EntityPlayerMP>()
        {
            public boolean apply(EntityPlayerMP p_apply_1_)
                {
                    return EntityGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.theItemInWorldManager.survivalOrAdventure();
                }
            }))
            {
                if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
                {
                    entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F));
                    entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2));
                }
            }
        }

        if (!this.hasHome())
        {
            this.setHomePosAndDistance(new BlockPos(this), 16);
        }
    }
}
项目:CountryCurrencyPicker    文件:Currency.java   
@Nullable
public static Currency getCurrencyWithCountries(java.util.Currency currency, Context context) {
    final Currency myCurrency = getCurrency(currency, context);

    if (tmpCountries == null) {
        tmpCountries = Country.listAllWithCurrencies(context, null);
    }

    ArrayList<Country> foundCountries = new ArrayList<>(Collections2.filter(tmpCountries, new Predicate<Country>() {
        @Override
        public boolean apply(Country input) {
            return input.getCurrency().getCode().equals(myCurrency.getCode());
        }
    }));

    if (foundCountries.size() > 0) {
        myCurrency.setCountries(foundCountries);

        ArrayList<String> names = new ArrayList<>();
        for (Country country : foundCountries) {
            names.add(country.getName());
        }
        myCurrency.setCountriesNames(names);

        return myCurrency;
    }
    return null;
}
项目:empiria.player    文件:FeedbackActionCollector.java   
private Collection<IModule> getSourcesToClear(final IModule currentModule) {
    Set<IModule> modulesCopy = Sets.newHashSet(source2actions.keySet());

    Predicate<IModule> isParentPredicate = new Predicate<IModule>() {
        @Override
        public boolean apply(IModule source) {
            List<HasChildren> parents = getParentHierarchy(source);
            return parents.contains(currentModule);
        }
    };
    return Collections2.filter(modulesCopy, isParentPredicate);
}
项目:andbg    文件:CollectionUtils.java   
public static <T> int lastIndexOf(@Nonnull Iterable<T> iterable, @Nonnull Predicate<? super T> predicate) {
    int index = 0;
    int lastMatchingIndex = -1;
    for (T item: iterable) {
        if (predicate.apply(item)) {
            lastMatchingIndex = index;
        }
        index++;
    }
    return lastMatchingIndex;
}
项目:n4js    文件:DefaultN4GlobalScopeProvider.java   
/**
 * If the type is a {@link Type} a new {@link BuiltInTypeScope} is created.
 */
@Override
protected IScope getScope(Resource context, boolean ignoreCase, EClass type, Predicate<IEObjectDescription> filter) {
    if (isSubtypeOfType(type)) {
        return getScope(getBuiltInTypeScope(context), context, ignoreCase, type, filter);
    }
    // do not call super but directly redirect with nullscope, using IScopeExt.NULLSCOPE instead of IScope.NULLSCOPE
    return getScope(IScope.NULLSCOPE, context, ignoreCase, type, filter);
}
项目:Backmemed    文件:EntityAIAvoidEntity.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    List<T> list = this.theEntity.world.<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double)this.avoidDistance, 3.0D, (double)this.avoidDistance), Predicates.and(new Predicate[] {EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector}));

    if (list.isEmpty())
    {
        return false;
    }
    else
    {
        this.closestLivingEntity = list.get(0);
        Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, new Vec3d(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ));

        if (vec3d == null)
        {
            return false;
        }
        else if (this.closestLivingEntity.getDistanceSq(vec3d.xCoord, vec3d.yCoord, vec3d.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity))
        {
            return false;
        }
        else
        {
            this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3d.xCoord, vec3d.yCoord, vec3d.zCoord);
            return this.entityPathEntity != null;
        }
    }
}
项目:googles-monorepo-demo    文件:Maps.java   
private static <K, V> Predicate<Entry<V, K>> inversePredicate(
    final Predicate<? super Entry<K, V>> forwardPredicate) {
  return new Predicate<Entry<V, K>>() {
    @Override
    public boolean apply(Entry<V, K> input) {
      return forwardPredicate.apply(Maps.immutableEntry(input.getValue(), input.getKey()));
    }
  };
}
项目:dremio-oss    文件:PlanningStage.java   
public static List<ViewFieldType> removeUpdateColumn(final List<ViewFieldType> fields) {
  return FluentIterable.from(fields).filter(new Predicate<ViewFieldType>() {
    @Override
    public boolean apply(@Nullable ViewFieldType input) {
      return !IncrementalUpdateUtils.UPDATE_COLUMN.equals(input.getName());
    }
  }).toList();
}
项目:BaseClient    文件:BlockRailDetector.java   
private void updatePoweredState(World worldIn, BlockPos pos, IBlockState state)
{
    boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue();
    boolean flag1 = false;
    List<EntityMinecart> list = this.<EntityMinecart>findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[0]);

    if (!list.isEmpty())
    {
        flag1 = true;
    }

    if (flag1 && !flag)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3);
        worldIn.notifyNeighborsOfStateChange(pos, this);
        worldIn.notifyNeighborsOfStateChange(pos.down(), this);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
    }

    if (!flag1 && flag)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)), 3);
        worldIn.notifyNeighborsOfStateChange(pos, this);
        worldIn.notifyNeighborsOfStateChange(pos.down(), this);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
    }

    if (flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
    }

    worldIn.updateComparatorOutputLevel(pos, this);
}
项目:Equella    文件:SearchWhereModel.java   
private Iterable<BaseEntityLabel> filterByUuids(Iterable<BaseEntityLabel> entities, final Set<String> uuids)
{
    return filter(entities, new Predicate<BaseEntityLabel>()
    {
        @Override
        public boolean apply(@Nullable BaseEntityLabel label)
        {
            return uuids.contains(label.getUuid());
        }
    });
}
项目:robird-reborn    文件:BaseTimelineFragment.java   
protected int findPosition(final long tweetId) {
    return Iterables.indexOf(mTweets, new Predicate<Tweet>() {
        @Override
        public boolean apply(Tweet input) {
            return tweetId == input.tweetId();
        }
    });
}
项目:tac-kbp-eal    文件:EREAligner.java   
@MoveToBUECommon
static <T> Predicate<Collection<T>> containsElement(final T element) {
  return new Predicate<Collection<T>>() {
    @Override
    public boolean apply(@Nullable final Collection<T> input) {
      return checkNotNull(input).contains(element);
    }
  };
}
项目:guava-mock    文件:MoreFiles.java   
/**
 * Returns a predicate that returns the result of {@link Files#isDirectory(Path, LinkOption...)}
 * on input paths with the given link options.
 */
public static Predicate<Path> isDirectory(LinkOption... options) {
  final LinkOption[] optionsCopy = options.clone();
  return new Predicate<Path>() {
    @Override
    public boolean apply(Path input) {
      return Files.isDirectory(input, optionsCopy);
    }

    @Override
    public String toString() {
      return "MoreFiles.isDirectory(" + Arrays.toString(optionsCopy) + ")";
    }
  };
}
项目:GitHub    文件:Use.java   
public static void main(String... args) {
  Predicate<Val> empty = ValFunctions.isEmpty();
  Function<Val, String> name = ValFunctions.getName();
  Function<Val, Integer> age = ValFunctions.age();
  System.out.println(empty);
  System.out.println(name);
  System.out.println(age);
}