Exemplo n.º 1
0
 private void backPropRemPoss() throws ContradictionException {
   ISetIterator iter = poss.iterator();
   while (iter.hasNext()) {
     int i = iter.nextInt();
     IntVar v = vars[i];
     if (v.hasEnumeratedDomain()) {
       for (int value : values) {
         v.removeValue(value, this);
       }
       poss.remove(i);
     } else {
       int newLB = v.getLB();
       int newUB = v.getUB();
       for (int val = v.getLB(); val <= newUB; val = v.nextValue(val)) {
         if (setValues.contains(val)) {
           newLB = val + 1;
         } else {
           break;
         }
       }
       for (int val = newUB; val >= newLB; val = v.previousValue(val)) {
         if (setValues.contains(val)) {
           newUB = val - 1;
         } else {
           break;
         }
       }
       v.updateBounds(newLB, newUB, this);
       if (newLB > values[values.length - 1] || newUB < values[0]) {
         poss.remove(i);
       }
     }
   }
 }
Exemplo n.º 2
0
 private Path dumpSearchResults(User user, Request request)
     throws ParseException, IOException, FileNotFoundException {
   user = userService.validate(user);
   Query query = searchService.getQuery(request);
   IndexSearcher searcher = getSearcher(request, user);
   Filter f =
       NumericRangeFilter.newLongRange(
           MailSchemaField.date.name(), request.startTime, request.endTime, true, true);
   TopDocs docs = searcher.search(query, f, request.scanSize);
   Path tempFile =
       Files.createTempFile(format("kw-%s-%s", user.id, request.keywordField), ".mailytics.temp");
   PrintWriter writer = new PrintWriter(tempFile.toFile());
   TIntHashSet dupSet = new TIntHashSet();
   for (ScoreDoc sd : docs.scoreDocs) {
     Document doc = searcher.doc(sd.doc);
     String string = doc.get(request.keywordField.name());
     int hash = string.hashCode();
     if (!dupSet.contains(hash)) {
       writer.println(string);
       dupSet.add(hash);
     }
   }
   dupSet.clear();
   writer.close();
   return tempFile;
 }
  // Kien added this mathRolesAnhType1AndType2
  public Collection<EnforcedRelation> matchRolesAndType1AndType2(
      TIntHashSet candidateRoles, TIntHashSet candidateType1, TIntHashSet candidateType2) {
    TIntIterator roleKeyI = candidateRoles.iterator();

    int firstRoleKey = roleKeyI.next();

    if (rolesIndex.get(firstRoleKey) == null) {
      return Collections.emptyList();
    }
    Collection<EnforcedRelation> result =
        new ArrayList<EnforcedRelation>(rolesIndex.get(firstRoleKey));

    if (result.isEmpty()) {
      return Collections.emptyList();
    }

    while (roleKeyI.hasNext()) {
      int key = roleKeyI.next();

      if (result.isEmpty()) return result;

      Collection<EnforcedRelation> rest = rolesIndex.get(key);
      if (rest == null) {
        return Collections.emptyList();
      }
      result.retainAll(rest);
    }

    TIntIterator type1KeyI = candidateType1.iterator();
    while (type1KeyI.hasNext()) {
      int key = type1KeyI.next();

      if (result.isEmpty()) return result;

      Collection<EnforcedRelation> rest = type1Index.get(key);
      if (rest == null) {
        return Collections.emptyList();
      }
      result.retainAll(rest);
    }
    TIntIterator type2KeyI = candidateType2.iterator();
    // Old code: while (roleKeyI.hasNext()) {
    // Kien changed roleKeyI to type2KeyI
    while (type2KeyI.hasNext()) {
      int key = type2KeyI.next();

      if (result.isEmpty()) return result;

      Collection<EnforcedRelation> rest2 = type2Index.get(key);
      if (rest2 == null) {
        return Collections.emptyList();
      }
      result.retainAll(rest2);
    }
    return result;
  }
Exemplo n.º 4
0
 /**
  * Updates this {@code Pool}'s store of permanences for the specified {@link Synapse}
  *
  * @param c the connections memory
  * @param s the synapse who's permanence is recorded
  * @param permanence the permanence value to record
  */
 public void updatePool(Connections c, Synapse s, double permanence) {
   int inputIndex = s.getInputIndex();
   if (synapsesBySourceIndex.get(inputIndex) == null) {
     synapsesBySourceIndex.put(inputIndex, s);
   }
   if (permanence > c.getSynPermConnected()) {
     synapseConnections.add(inputIndex);
   } else {
     synapseConnections.remove(inputIndex);
   }
 }
Exemplo n.º 5
0
  private TIntHashSet getIntersection(TIntHashSet contextA, TIntHashSet contextB) {
    TIntHashSet is = new TIntHashSet();

    for (int a : contextA.toArray()) {
      if (contextB.contains(a) || contextB.contains(DataAccess.expandTerm(a))) {
        is.add(a);
      }
    }

    return is;
  }
  public static boolean contains(EdgeIterator iter, int... locs) {
    TIntHashSet set = new TIntHashSet();

    while (iter.next()) {
      set.add(iter.node());
    }
    for (int l : locs) {
      if (!set.contains(l)) return false;
    }
    return true;
  }
 public static boolean contains(Iterable<? extends Edge> iter, int... locs) {
   Iterator<? extends Edge> i = iter.iterator();
   TIntHashSet set = new TIntHashSet();
   while (i.hasNext()) {
     set.add(i.next().node);
   }
   for (int l : locs) {
     if (!set.contains(l)) return false;
   }
   return true;
 }
Exemplo n.º 8
0
  @Override
  public double calcSimilarity(
      Mention mention, Context context, Entity entity, EntitiesContext entitiesContext) {
    TIntHashSet contextA = new TIntHashSet(context.getTokenIds());
    TIntHashSet contextB = new TIntHashSet(entitiesContext.getContext(entity));

    TIntHashSet union = getUnion(contextA, contextB);
    TIntHashSet intersection = getIntersection(contextA, contextB);

    double jaccardSim = (double) intersection.size() / (double) union.size();
    return jaccardSim;
  }
Exemplo n.º 9
0
  public TIntHashSet computeTypeOfX(Variable x) {
    TIntHashSet bs = new TIntHashSet();
    for (Atom atom : body) {
      int typeOfX = 0;
      if (atom.getPredicate().getArity() == 1 && atom.getTerms().contains(x)) {
        typeOfX = atom.getPredicate().getEncoding();
        bs.add(typeOfX);
      }
    }

    return bs;
  }
  @Override
  public boolean onOutgoingPacket(Player ply, int packetID, Packet packet) {
    switch (packetID) {
      case 20:
        final PacketPlayOutNamedEntitySpawn p20 = (PacketPlayOutNamedEntitySpawn) packet;
        if (!choppedEntities.contains(p20.a)) // v1_7_R1
        break;

        p20.g = CHOPPED_PITCH; // v1_7_R1

        break;

      case 24:
        final PacketPlayOutSpawnEntityLiving p24 = (PacketPlayOutSpawnEntityLiving) packet;
        if (!choppedEntities.contains(p24.a)) // v1_7_R1
        break;

        p24.j = CHOPPED_PITCH; // v1_7_R1

        break;

      case 34:
        final PacketPlayOutEntityTeleport p34 = (PacketPlayOutEntityTeleport) packet;
        if (!choppedEntities.contains(p34.a)) // v1_7_R1
        break;

        p34.f = CHOPPED_PITCH; // v1_7_R1

        break;

      case 32:
      case 33:
        final PacketPlayOutEntity p30 = (PacketPlayOutEntity) packet;
        if (!choppedEntities.contains(p30.a)) // v1_7_R1
        break;

        p30.f = CHOPPED_PITCH; // v1_7_R1

        break;

      case 35:
        final PacketPlayOutEntityHeadRotation p35 = (PacketPlayOutEntityHeadRotation) packet;
        if (!choppedEntities.contains(p35.a)) // v1_7_R1
        break;

        final float yaw = Utils.getEntityByID(p35.a, ply.getWorld()).yaw; // v1_7_R1
        p35.b = (byte) (((yaw % 360) / 360) * 255); // v1_7_R1

        break;
    }
    return true;
  }
  /** Creates a deep copy of a HashSet<TIntHashSet>. */
  public static HashSet<TIntHashSet> deepClone(HashSet<TIntHashSet> set) {

    HashSet<TIntHashSet> clone = new HashSet<TIntHashSet>();

    for (TIntHashSet elements : set) {
      TIntHashSet newElements = new TIntHashSet(elements.capacity());
      newElements.addAll(elements);

      clone.add(newElements);
    }

    return clone;
  }
Exemplo n.º 12
0
  /** Deduplicates an array in linear time, it does not change the order of the elements. */
  public static int[] deduplicate(int[] arr) {
    if (arr.length <= 1) return arr;
    TIntArrayList list = new TIntArrayList();
    TIntHashSet set = new TIntHashSet();

    for (int a : arr) {
      if (set.add(a)) {
        list.add(a);
      }
    }

    return list.toArray();
  }
  protected Collection<EnforcedRelation> match(
      TIntHashSet subset, TIntObjectHashMap<Collection<EnforcedRelation>> index) {
    TIntIterator keyI = subset.iterator();

    int firstKey = keyI.next();

    if (index.get(firstKey) == null) {
      return Collections.emptyList();
    }
    Collection<EnforcedRelation> result = new ArrayList<EnforcedRelation>(index.get(firstKey));

    if (result.isEmpty()) {
      return Collections.emptyList();
    }

    while (keyI.hasNext()) {
      int key = keyI.next();

      if (result.isEmpty()) return result;

      Collection<EnforcedRelation> rest = index.get(key);
      if (rest == null) {
        return Collections.emptyList();
      }
      result.retainAll(rest);
    }

    return result;
  }
Exemplo n.º 14
0
 /**
  * Returns a dense array representing the potential pool bits with the connected bits set to 1.
  *
  * <p>Note: Only called from tests for now...
  *
  * @param c
  * @return
  */
 public int[] getDenseConnections(Connections c) {
   int[] retVal = new int[c.getNumInputs()];
   for (int inputIndex : synapseConnections.toArray()) {
     retVal[inputIndex] = 1;
   }
   return retVal;
 }
  @Override
  public DoubleArrayIntegerObject call() throws Exception {
    double corrPvalueThreshold = 0.0001;
    double[] zScores = new double[datasetGenotypes.nrProbes];
    for (int snp = 0; snp < datasetGenotypes.nrProbes; snp++) {

      if (snpsToTest != null && !snpsToTest.contains(snp)) {
        continue;
      }

      double corrPvalue = correlateCovariateWithGenotype(snp);
      if (corrPvalue
          > corrPvalueThreshold) { // don't compute the interaction if the covariate expression is
                                   // affected by this SNP
        try {

          double[][] valsX = new double[nrSamples][3];
          for (int s = 0; s < nrSamples; s++) {
            valsX[s][0] = datasetGenotypes.rawData[snp][s];
            valsX[s][1] = datasetCovariates.rawData[covToTest][s];
            valsX[s][2] = valsX[s][0] * valsX[s][1];
          }
          double[] valsY = datasetExpression.rawData[snp];
          regression.newSampleData(valsY, valsX);
          double betaInteraction = regression.estimateRegressionParameters()[3];
          double seInteraction = regression.estimateRegressionParametersStandardErrors()[3];
          double tInteraction = betaInteraction / seInteraction;
          double pValueInteraction = 1;
          double zScoreInteraction = 0;
          if (tInteraction < 0) {
            pValueInteraction = tDistColt.cdf(tInteraction);
            if (pValueInteraction < 2.0E-323) {
              pValueInteraction = 2.0E-323;
            }
            zScoreInteraction = cern.jet.stat.tdouble.Probability.normalInverse(pValueInteraction);
          } else {
            pValueInteraction = tDistColt.cdf(-tInteraction);
            if (pValueInteraction < 2.0E-323) {
              pValueInteraction = 2.0E-323;
            }
            zScoreInteraction = -cern.jet.stat.tdouble.Probability.normalInverse(pValueInteraction);
          }
          zScores[snp] = zScoreInteraction;
        } catch (SingularMatrixException e) {
          zScores[snp] = 0;
          skippedTracker.addSkipped(
              SkippedInteractionTracker.Reason.SINGULAR, datasetGenotypes.probeNames[snp]);
        }
      } else {
        // System.out.println("Removing covariate because of eQTL effect! " +
        // datasetCovariatesPCAForceNormal.probeNames[covToTest] + " : " +
        // datasetGenotypes.probeNames[snp]);
        skippedTracker.addSkipped(
            SkippedInteractionTracker.Reason.SHARED_QTL, datasetGenotypes.probeNames[snp]);
        zScores[snp] = 0;
      }
    }
    skippedWriter.add(skippedTracker);
    return new DoubleArrayIntegerObject(zScores, covToTest);
  }
  @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void onEntityDamage(EntityDamageEvent event) {
    if (event.getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK) return;

    if (!(event instanceof EntityDamageByEntityEvent)) return;

    final Entity damagedEntity = event.getEntity();
    if (damagedEntity instanceof Player) return;

    if (!(damagedEntity instanceof LivingEntity)) return;

    final int entityId = damagedEntity.getEntityId();
    if (choppedEntities.contains(entityId)) return;

    final Entity damager = ((EntityDamageByEntityEvent) event).getDamager();
    if (!(damager instanceof Player)) return;

    final Material materialInHand = ((Player) damager).getItemInHand().getType();

    switch (materialInHand) {
      case DIAMOND_SPADE:
      case GOLD_SPADE:
      case IRON_SPADE:
      case WOOD_SPADE:
      case STONE_SPADE:
        addChoppedEntity(entityId);
        break;
    }
  }
Exemplo n.º 17
0
  /**
   * Removes the set of columns who have never been active from the set of active columns selected
   * in the inhibition round. Such columns cannot represent learned pattern and are therefore
   * meaningless if only inference is required. This should not be done when using a random,
   * unlearned SP since you would end up with no active columns.
   *
   * @param activeColumns An array containing the indices of the active columns
   * @return a list of columns with a chance of activation
   */
  public int[] stripUnlearnedColumns(Connections c, int[] activeColumns) {
    TIntHashSet active = new TIntHashSet(activeColumns);
    TIntHashSet aboveZero = new TIntHashSet();
    int numCols = c.getNumColumns();
    double[] colDutyCycles = c.getActiveDutyCycles();
    for (int i = 0; i < numCols; i++) {
      if (colDutyCycles[i] <= 0) {
        aboveZero.add(i);
      }
    }
    active.removeAll(aboveZero);
    TIntArrayList l = new TIntArrayList(active);
    l.sort();
    // return l;

    return Arrays.stream(activeColumns).filter(i -> c.getActiveDutyCycles()[i] > 0).toArray();
  }
Exemplo n.º 18
0
  public TIntHashSet computeRho(Variable x, List<InversePropertyOfAxiom> inverseAxioms) {

    TIntHashSet rho = new TIntHashSet();
    // BitSet emptyRho = new BitSet();
    for (Atom atom : body) {
      List<Term> terms = atom.getTerms();
      if (atom.getPredicate().getArity() == 2) {
        if (terms.get(1).equals(x)) rho.add(atom.getPredicate().getEncoding());
        // else add Inverse of atom.predicate to Rho
        else if (terms.get(0).equals(x)) {
          int rBar = getInverseOf(atom.getPredicate().getEncoding(), inverseAxioms);
          rho.add(rBar);
        } // end of elsse if
      }
    } // end of for
    return rho;
  }
Exemplo n.º 19
0
 /**
  * Records the current solution of the solver clears all previous recordings
  *
  * @param solver a solver
  */
 public void record(Solver solver) {
   if (empty) {
     Variable[] _dvars = solver.getStrategy().getVariables();
     for (int i = 0; i < _dvars.length; i++) {
       dvars.add(_dvars[i].getId());
     }
     empty = false;
   }
   boolean warn = false;
   intmap.clear();
   realmap.clear();
   setmap.clear();
   Variable[] vars = solver.getVars();
   for (int i = 0; i < vars.length; i++) {
     if ((vars[i].getTypeAndKind() & Variable.TYPE) != Variable.CSTE) {
       int kind = vars[i].getTypeAndKind() & Variable.KIND;
       if (!vars[i].isInstantiated()) {
         if (dvars.contains(vars[i].getId())) {
           throw new SolverException(vars[i] + " is not instantiated when recording a solution.");
         } else {
           warn = true;
         }
       } else {
         switch (kind) {
           case Variable.INT:
           case Variable.BOOL:
             IntVar v = (IntVar) vars[i];
             intmap.put(v.getId(), v.getValue());
             break;
           case Variable.REAL:
             RealVar r = (RealVar) vars[i];
             realmap.put(r.getId(), new double[] {r.getLB(), r.getUB()});
             break;
           case Variable.SET:
             SetVar s = (SetVar) vars[i];
             setmap.put(s.getId(), s.getValues());
             break;
         }
       }
     }
   }
   if (warn && solver.getSettings().warnUser()) {
     Chatterbox.err.printf(
         "Some non decision variables are not instantiated in the current solution.");
   }
 }
Exemplo n.º 20
0
 /**
  * Creates a propagator for Among: Counts the number of decision variables which take a value in
  * the input value set
  *
  * @param variables {decision variables, cardinality variable}
  * @param values input value set
  */
 public PropAmongGAC(IntVar[] variables, int[] values) {
   super(variables, PropagatorPriority.LINEAR, true);
   nb_vars = variables.length - 1;
   IEnvironment environment = model.getEnvironment();
   this.setValues = new TIntHashSet(values);
   this.values = setValues.toArray();
   Arrays.sort(this.values);
   poss = SetFactory.makeStoredSet(SetType.BIPARTITESET, 0, model);
   nbSure = environment.makeInt(0);
 }
  @Override
  public boolean remove(Object o) {
    EnforcedRelation enf = (EnforcedRelation) o;
    enfs.remove(enf);

    TIntHashSet type1 = enf.getType1();
    TIntIterator type1Iterator = type1.iterator();
    while (type1Iterator.hasNext()) {
      int key = type1Iterator.next();
      ensureContainsKey(type1Index, key);
      type1Index.get(key).remove(enf);
    }

    TIntHashSet type2 = enf.getType2();
    TIntIterator type2Iterator = type2.iterator();
    while (type2Iterator.hasNext()) {
      int key = type2Iterator.next();
      ensureContainsKey(type2Index, key);
      type2Index.get(key).remove(enf);
    }

    TIntHashSet roles = enf.getRoles();
    TIntIterator rolesIterator = roles.iterator();
    while (rolesIterator.hasNext()) {
      int key = rolesIterator.next();
      ensureContainsKey(rolesIndex, key);
      rolesIndex.get(key).remove(enf);
    }

    return true;
  }
  @Override
  public boolean add(EnforcedRelation enf) {
    if (!this.subsubmedEnf(enf)) {

      enfs.add(enf);

      TIntHashSet type1 = enf.getType1();
      TIntIterator type1Iterator = type1.iterator();
      while (type1Iterator.hasNext()) {
        int key = type1Iterator.next();
        ensureContainsKey(type1Index, key);
        type1Index.get(key).add(enf);
      }

      TIntHashSet type2 = enf.getType2();
      TIntIterator type2Iterator = type2.iterator();
      while (type2Iterator.hasNext()) {
        int key = type2Iterator.next();
        ensureContainsKey(type2Index, key);
        type2Index.get(key).add(enf);
      }

      TIntHashSet roles = enf.getRoles();
      TIntIterator rolesIterator = roles.iterator();
      while (rolesIterator.hasNext()) {
        int key = rolesIterator.next();
        ensureContainsKey(rolesIndex, key);
        rolesIndex.get(key).add(enf);
      }

      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 23
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    if (buffs.size() > 4) showChatWindow(player, 1);

    StringTokenizer st = new StringTokenizer(command);
    String cmd = st.nextToken();
    if (cmd.equalsIgnoreCase("buff")) {
      int id = Integer.parseInt(st.nextToken());
      int lvl = Integer.parseInt(st.nextToken());
      boolean checked = false;
      for (int[] buff : Olympiad.BUFFS_LIST) {
        if (buff.length != 2) continue;

        if (buff[0] != id) continue;

        if (buff[1] != lvl) continue;

        checked = true;
        break;
      }

      if (!checked) {
        // Читер!
        showChatWindow(player, 0);
        return;
      }

      Skill skill = SkillTable.getInstance().getInfo(id, lvl);
      List<Creature> target = new ArrayList<Creature>();
      target.add(player);
      broadcastPacket(new MagicSkillUse(this, player, id, lvl, 0, 0));
      callSkill(skill, target, true);
      buffs.add(id);
      if (buffs.size() > 4) showChatWindow(player, 1);
      else showChatWindow(player, 0);
    } else showChatWindow(player, 0);
  }
Exemplo n.º 24
0
  private TIntHashSet getUnion(TIntHashSet contextA, TIntHashSet contextB) {
    TIntHashSet union = new TIntHashSet();

    for (int a : contextB.toArray()) {
      union.add(a);
    }

    for (int a : contextA.toArray()) {
      if (!union.contains(a) && !union.contains(DataAccess.expandTerm(a))) {
        union.add(a);
      }
    }

    return union;
  }
Exemplo n.º 25
0
  @Override
  public void onAction(Player player, boolean shift) {
    if (Events.onAction(player, this, shift)) {
      player.sendActionFailed();
      return;
    }

    if (this != player.getTarget()) {
      player.setTarget(this);
      player.sendPacket(new ValidateLocation(this));
    } else {
      player.sendPacket(new MyTargetSelected(player, this));
      if (!isInRange(player, INTERACTION_DISTANCE))
        player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
      else if (buffs.size() > 4) showChatWindow(player, 1);
      else showChatWindow(player, 0);
      player.sendActionFailed();
    }
  }
Exemplo n.º 26
0
 // If there is enf(T1,R,T2) such that R contains Rho, T2 contain type of X
 // Then substitute all role wich contain X by T1(X)
 private Set<Atom> addTypeOfXToBody(Term x, TIntHashSet type, Set<Atom> body) {
   Set<Atom> addedAtoms = new HashSet<Atom>();
   TIntIterator iterator = type.iterator();
   while (iterator.hasNext()) {
     int i = iterator.next();
     // for (int i = type.nextSetBit(0); i >= 0; i = type.nextSetBit(i +
     // 1)) {
     if (i != ClipperManager.getInstance().getThing()) {
       Predicate predicate = new DLPredicate(i, 1);
       List<Term> terms = new ArrayList<Term>();
       terms.add(x);
       Atom newAtom = new Atom(predicate, terms);
       if (!body.contains(newAtom) && !addedAtoms.contains(newAtom)) {
         addedAtoms.add(newAtom);
       }
     }
   }
   return addedAtoms;
 }
Exemplo n.º 27
0
  /**
   * Computes the intersection of two <b>unsorted</b> arrays. Will deduplicate the items, so the
   * return is a set of integers.
   */
  public static int[] intersectionUnsorted(int[] arr, int[] arr2) {
    TIntHashSet set = new TIntHashSet();
    TIntHashSet toReturn = new TIntHashSet();
    for (int a : arr) {
      set.add(a);
    }

    for (int a : arr2) {
      if (set.contains(a)) {
        toReturn.add(a);
      }
    }

    return toReturn.toArray();
  }
  public boolean canGenerateRoom(DungeonDir dir) {
    byte tempX = x, tempY = y;
    boolean res = false;

    if (move(dir, 2) && check(x - 1, y - 1) && check(x + 1, y + 1)) {
      for (int xx = x - 1; xx <= x + 1; xx++) {
        for (int yy = y - 1; yy <= y + 1; yy++) {
          if (elementArray[xx][yy] != DungeonElementType.EMPTY
              || blockedLocs.contains(xx + yy * width)) {
            x = tempX;
            y = tempY;
            return false;
          }
        }
      }

      res = true;
    }

    x = tempX;
    y = tempY;

    return res;
  }
Exemplo n.º 29
0
 @Override
 public ESat isEntailed() {
   int min = 0;
   int max = 0;
   int nbInst = vars[nb_vars].isInstantiated() ? 1 : 0;
   for (int i = 0; i < nb_vars; i++) {
     IntVar var = vars[i];
     if (var.isInstantiated()) {
       nbInst++;
       if (setValues.contains(var.getValue())) {
         min++;
         max++;
       }
     } else {
       int nb = 0;
       for (int j : values) {
         if (var.contains(j)) {
           nb++;
         }
       }
       if (nb == var.getDomainSize()) {
         min++;
         max++;
       } else if (nb > 0) {
         max++;
       }
     }
   }
   if (min > vars[nb_vars].getUB() || max < vars[nb_vars].getLB()) {
     return ESat.FALSE;
   }
   if (nbInst == nb_vars + 1) {
     return ESat.TRUE;
   }
   return ESat.UNDEFINED;
 }
Exemplo n.º 30
0
 /**
  * Returns the block at the sight. Returns null if out of range or if no viable target was found
  *
  * @return Block
  */
 public Location getSolidTargetBlock() {
   while (getNextBlock()
       && transparentBlocks.contains(world.getBlockTypeIdAt(getCurrentBlock()))) {;
   }
   return getCurrentBlock();
 }