Get an input split to be assigned to this evaluator.
<p>
Allocates one if its not already allocated

@param evaluatorId
@return a numberedSplit
@throws RuntimeException
if couldn't find any split
555511
@Override
  public NumberedSplit<InputSplit> getInputSplit(final NodeDescriptor nodeDescriptor, final String evaluatorId) {
    synchronized (evaluatorToSplits) {
      if (evaluatorToSplits.containsKey(evaluatorId)) {
        LOG.log(Level.FINE, "Found an already allocated split, {0}", evaluatorToSplits.toString());
        return evaluatorToSplits.get(evaluatorId);
      }
    }
    // always first try to allocate based on the hostName
    final String hostName = nodeDescriptor.getName();
    LOG.log(Level.FINE, "Allocated split not found, trying on {0}", hostName);
    if (locationToSplits.containsKey(hostName)) {
      LOG.log(Level.FINE, "Found splits possibly hosted for {0} at {1}", new Object[] {evaluatorId, hostName});
      final NumberedSplit<InputSplit> split = allocateSplit(evaluatorId, locationToSplits.get(hostName));
      if (split != null) {
        return split;
      }
    }
    LOG.log(Level.FINE, "{0} does not host any splits or someone else took splits hosted here. Picking other ones",
        hostName);
    final NumberedSplit<InputSplit> split = tryAllocate(nodeDescriptor, evaluatorId);
    if (split == null) {
      throw new RuntimeException("Unable to find an input split to evaluator " + evaluatorId);
    } else {
      LOG.log(Level.FINE, evaluatorToSplits.toString());
    }
    return split;
  }
215993
@Override
  protected NumberedSplit<InputSplit> tryAllocate(final NodeDescriptor nodeDescriptor, final String evaluatorId) {
    final String rackName = nodeDescriptor.getRackDescriptor().getName();
    LOG.log(Level.FINE, "Trying an exact match on rack name {0}", rackName);
    if (locationToSplits.containsKey(rackName)) {
      LOG.log(Level.FINE, "Found splits possibly hosted for {0} at {1}", new Object[] {evaluatorId, rackName});
      final NumberedSplit<InputSplit> split = allocateSplit(evaluatorId, locationToSplits.get(rackName));
      if (split != null) {
        return split;
      }
    }
    LOG.fine("No success, trying based on a partial match on locations");
    final Iterator<String> it = normalizedLocations.iterator();
    while (it.hasNext()) {
      final String possibleLocation = it.next();
      LOG.log(Level.FINE, "Trying on possible location {0}", possibleLocation);
      if (rackName.startsWith(possibleLocation)) {
        LOG.log(Level.FINE, "Found splits possibly hosted for {0} at {1} for rack {2}", new Object[] {evaluatorId,
            possibleLocation, rackName});
        final NumberedSplit<InputSplit> split = allocateSplit(evaluatorId,
            partialLocationsToSplits.get(possibleLocation));
        if (split != null) {
          return split;
        }
      }
    }
    LOG.fine("Nothing found");
    return null;
  }
512343
private void split() throws IOException {
        hasSplit = true;
        IntegerBuffer before = new IntegerBuffer();
        IntegerBuffer after = new IntegerBuffer();

        int current;
        boolean ready = false;
        boolean stillNeedToSeeDoctype = true;
        while (!ready && (current = original.read()) != -1) {
            if (Character.isWhitespace((char) current)) {
                before.append(current);
            } else if (current == '<') {
                // could be XML declaration, comment, PI, DOCTYPE
                // or the first element
                int[] elementOrDeclOr = readUntilCloseCharIsReached();
                if (elementOrDeclOr.length > 0) {
                    if (elementOrDeclOr[0] == '?') {
                        // XML declaration or PI
                        before.append('<');
                        before.append(elementOrDeclOr);
                    } else if (elementOrDeclOr[0] != '!') {
                        // first element
                        after.append('<');
                        after.append(elementOrDeclOr);
                        stillNeedToSeeDoctype = false;
                        ready = true;
                    } else {
                        // comment or doctype
                        IntegerBuffer b =
                            new IntegerBuffer(elementOrDeclOr.length);
                        b.append(elementOrDeclOr);
                        if (b.indexOf(DOCTYPE_INTS) == -1) {
                            after.append('<');
                            after.append(elementOrDeclOr);
                        } else {
                            // swallow old declaration
                            stillNeedToSeeDoctype = false;
                        }
                        ready = true;
                    }
                } else {
                    after.append('<');
                    stillNeedToSeeDoctype = false;
                    ready = true;
                }
            } else {
                after.append(current);
                stillNeedToSeeDoctype = false;
                ready = true;
            }
        }

        // need to eliminate original DOCTYPE if it exists
        while (stillNeedToSeeDoctype && (current = original.read()) != -1) {
            if (Character.isWhitespace((char) current)) {
                after.append(current);
            } else if (current == '<') {
                int[] elementOrDeclOr = readUntilCloseCharIsReached();
                if (elementOrDeclOr.length > 0) {
                    if (elementOrDeclOr[0] == '?') {
                        // PI
                        after.append('<');
                        after.append(elementOrDeclOr);
                    } else if (elementOrDeclOr[0] != '!') {
                        // first element
                        after.append('<');
                        after.append(elementOrDeclOr);
                        stillNeedToSeeDoctype = false;
                    } else {
                        // comment or doctype
                        IntegerBuffer b =
                            new IntegerBuffer(elementOrDeclOr.length);
                        b.append(elementOrDeclOr);
                        if (b.indexOf(DOCTYPE_INTS) == -1) {
                            after.append('<');
                            after.append(elementOrDeclOr);
                        } else {
                            // swallow old declaration
                            stillNeedToSeeDoctype = false;
                        }
                    }
                } else {
                    after.append('<');
                    stillNeedToSeeDoctype = false;
                }
            } else {
                after.append(current);
                stillNeedToSeeDoctype = false;
            }
        }

        beforeDoctype = before.size() > 0
            ? new IntBufferReadable(before) : null;
        afterDoctype = after.size() > 0
            ? new IntBufferReadable(after) : null;
    }
903445
public void split() {
    if(hasChildren()) {
      return;
    }

    final boolean issplit = (maxSplitDimension >= (getDimensionality() - 1));
    final int childLevel = issplit ? level + 1 : level;
    final int splitDim = issplit ? 0 : maxSplitDimension + 1;
    final double splitPoint = getMin(splitDim) + (getMax(splitDim) - getMin(splitDim)) * .5;

    // left and right child
    for(int i = 0; i < 2; i++) {
      double[] min = SpatialUtil.getMin(this); // clone
      double[] max = SpatialUtil.getMax(this); // clone

      // right child
      if(i == 0) {
        min[splitDim] = splitPoint;
      }
      // left child
      else {
        max[splitDim] = splitPoint;
      }

      ModifiableDBIDs childIDs = split.determineIDs(getIDs(), new HyperBoundingBox(min, max), d_min, d_max);
      if(childIDs != null) {
        // right child
        if(i == 0) {
          rightChild = new CASHInterval(min, max, split, childIDs, splitDim, childLevel, d_min, d_max);
        }
        // left child
        else {
          leftChild = new CASHInterval(min, max, split, childIDs, splitDim, childLevel, d_min, d_max);
        }
      }
    }

    if(LOG.isDebuggingFine()) {
      StringBuilder msg = new StringBuilder();
      msg.append("Child level ").append(childLevel).append(",  split Dim   ").append(splitDim);
      if(leftChild != null) {
        msg.append("\nleft   ").append(leftChild);
      }
      if(rightChild != null) {
        msg.append("\nright   ").append(rightChild);
      }
      LOG.fine(msg.toString());
    }
  }
82582
public int doStartTag()
            throws JspException {
        Object source = evaluateDataSource();

        // report any errors that may have occured 
        if(hasErrors())
            return SKIP_BODY;

        _renderState = INIT;

        boolean empty = false;
        if(source != null) {
            _iterator = IteratorFactory.createIterator(source);
            if(_iterator == null) {
                LOGGER.warn(Bundle.getString("Tags_Repeater_nullIterator"));
                _iterator = Collections.EMPTY_LIST.iterator();
            }

            if(_iterator.hasNext()) {
                _currentIndex = 0;
                _currentItem = _iterator.next();

                if(_ignoreNulls && _currentItem == null) {
                    /*
                      doStartTag doesn't know if the repeater is structured or unstructured
                      thus, if ignoreNulls is true, it's going to make an attempt to go
                      through the body with a non-null item.  if there are no non-null
                      items in the data structure, the doAfterBody method will handle
                      this correctly, but a data structure with a null first item
                      will render the same as a data structure with a null second item
                     */
                    advanceToNonNullItem();

                    /*
                       this null check needs to re-run here because the advanceToNonNullItem method
                       side-effects the _currentItem.
                     */
                    if(_currentItem == null)
                        empty = true;
                }
            }
            /* there is no data set of there are zero items in the iterator */
            else empty = true;
        }
        /* the dataSource evaluated to null */
        else {
            _iterator = Collections.EMPTY_LIST.iterator();
            empty = true;
        }

        if(empty) {
            /* if the defaultText attribute is non-null, it will be evaluated as an expression and rendered to the page */
            if(_defaultText != null)
                addContent(_defaultText.toString());
            return SKIP_BODY;
        }
        else {
            DataAccessProviderStack.addDataAccessProvider(this, pageContext);
            _containerInPageContext = true;
            return EVAL_BODY_BUFFERED;
        }
    }
707833
private String performSplitting(String source, String splitString, String indexString)
        throws TransformationOperationException {
        Integer index = parseIntString(indexString, false, 0);
        Matcher matcher = generateMatcher(splitString, source);
        for (int i = 0; i <= index; i++) {
            matcher.find();
        }
        String value = matcher.group();
        if (value == null) {
            getLogger().warn("No result for given regex and index. The empty string will be taken instead.");
            value = "";
        }
        return value;
    }
1156281
public static DeweyNumber fromString(final String deweyNumberString) {
		String[] splits = deweyNumberString.split("\\.");

		if (splits.length == 0) {
			return new DeweyNumber(Integer.parseInt(deweyNumberString));
		} else {
			int[] deweyNumber = new int[splits.length];

			for (int i = 0; i < splits.length; i++) {
				deweyNumber[i] = Integer.parseInt(splits[i]);
			}

			return new DeweyNumber(deweyNumber);
		}
	}
77786
public static List<String> splitNicely( String toSplit, String separator ) {

		if( separator == null || separator.isEmpty())
			throw new IllegalArgumentException( "The separator cannot be null or the empty string." );

		return splitNicelyWithPattern( toSplit, Pattern.quote( separator ));
	}
1082593
public double evaluate(Map<String, Double> localVariables) {
        if (this.root == null) {
            throw new RuntimeException("[function error] evaluation failed " +
                    "because function is not loaded");
        }
        return this.root.evaluate(localVariables);
    }
408369
protected List<BigInteger> split(
      BigInteger start,
      BigInteger range,
      BigInteger ringEnd,
      BigInteger ringLength,
      int numberOfSplits) {
    BigInteger[] tmp = range.divideAndRemainder(BigInteger.valueOf(numberOfSplits));
    BigInteger divider = tmp[0];
    int remainder = tmp[1].intValue();

    List<BigInteger> results = Lists.newArrayListWithExpectedSize(numberOfSplits - 1);
    BigInteger current = start;
    BigInteger dividerPlusOne =
        (remainder == 0)
            ? null // won't be used
            : divider.add(BigInteger.ONE);

    for (int i = 1; i < numberOfSplits; i++) {
      current = current.add(remainder-- > 0 ? dividerPlusOne : divider);
      if (ringEnd != null && current.compareTo(ringEnd) > 0) current = current.subtract(ringLength);
      results.add(current);
    }
    return results;
  }
847909
public static String[] split(final String input, final char split) {
        int index = indexOf(input, split);
        int prevIndex = 0;
        final ArrayList<String> output = new ArrayList<String>();
        if (index == -1) {
            output.add(input);
            return output.toArray(new String[1]);
        }
        while (index != -1) {
            output.add(input.substring(prevIndex, index));
            prevIndex = index + 1;
            index = indexOf(input, split, index + 1);
        }
        output.add(input.substring(prevIndex, input.length()));
        return output.toArray(new String[output.size()]);
    }
462633
public static int findSplitpoint(String s, int width) {
    // the newline (or EOS) is the fallback split position.
    int in = s.indexOf(NEWLINE);
    in = in < 0 ? s.length() : in;
    // Good enough?
    if(in < width) {
      return in;
    }
    // otherwise, search for whitespace
    int iw = s.lastIndexOf(' ', width);
    // good whitespace found?
    if(iw >= 0 && iw < width) {
      return iw;
    }
    // sub-optimal splitpoint - retry AFTER the given position
    int bp = nextPosition(s.indexOf(' ', width), s.indexOf(NEWLINE, width));
    if(bp >= 0) {
      return bp;
    }
    // even worse - can't split!
    return s.length();
  }
1347220
TextView generateSplit(int i) {
        TextView split = new TextView(getContext());
        int generateViewId = PinViewUtils.generateViewId();
        split.setId(generateViewId);
        setStylesSplit(split);
        pinSplitsIds[i] = generateViewId;
        return split;
    }
381190
public static <U, I> Splitter<U, I> instantiateSplitter(final Properties properties) {
        // read parameters
        String splitterClassName = properties.getProperty(DATASET_SPLITTER);
        Boolean perUser = Boolean.parseBoolean(properties.getProperty(SPLIT_PERUSER));
        Boolean doSplitPerItems = Boolean.parseBoolean(properties.getProperty(SPLIT_PERITEMS, "true"));
        // generate splitter
        Splitter<U, I> splitter = null;
        if (splitterClassName.contains("CrossValidation")) {
            Long seed = Long.parseLong(properties.getProperty(SPLIT_SEED));
            Integer nFolds = Integer.parseInt(properties.getProperty(SPLIT_CV_NFOLDS));
            splitter = new CrossValidationSplitter<>(nFolds, perUser, seed);
        } else if (splitterClassName.contains("Random")) {
            Long seed = Long.parseLong(properties.getProperty(SPLIT_SEED));
            Float percentage = Float.parseFloat(properties.getProperty(SPLIT_RANDOM_PERCENTAGE));
            splitter = new RandomSplitter<>(percentage, perUser, seed, doSplitPerItems);
        } else if (splitterClassName.contains("Temporal")) {
            Float percentage = Float.parseFloat(properties.getProperty(SPLIT_RANDOM_PERCENTAGE));
            splitter = new TemporalSplitter<>(percentage, perUser, doSplitPerItems);
        } else if (splitterClassName.contains("Validation")) {
            Long seed = Long.parseLong(properties.getProperty(SPLIT_SEED));
            Float percentage = Float.parseFloat(properties.getProperty(SPLIT_RANDOM_PERCENTAGE));
            Splitter<U, I> randomSplitter = new RandomSplitter<>(percentage, perUser, seed, doSplitPerItems);
            splitter = new ValidationSplitter<>(randomSplitter);
        }
        return splitter;
    }
1308953
public Map<String, String> split(final CharSequence source) {
    java.util.Objects.requireNonNull(source, "source");
    Map<String, String> parameters = new HashMap<>();
    Iterator<String> i = new StringIterator(source, pairSeparator);
    while (i.hasNext()) {
      String keyValue = i.next();

      int keyValueSeparatorPosition = keyValueSeparatorStart(keyValue);
      if (keyValueSeparatorPosition == 0 || keyValue.length() == 0) {
        continue;
      }
      if (keyValueSeparatorPosition < 0) {
        parameters.put(keyValue, null);
        continue;
      }
      int keyStart = 0;
      int keyEnd = keyValueSeparatorPosition;

      while (keyStart < keyEnd && keyTrimMatcher.matches(keyValue.charAt(keyStart))) {
        keyStart++;
      }
      while (keyStart < keyEnd && keyTrimMatcher.matches(keyValue.charAt(keyEnd - 1))) {
        keyEnd--;
      }

      int valueStart = keyValueSeparatorPosition + keyValueSeparator.length();
      int valueEnd = keyValue.length();

      while (valueStart < valueEnd && valueTrimMatcher.matches(keyValue.charAt(valueStart))) {
        valueStart++;
      }
      while (valueStart < valueEnd && valueTrimMatcher.matches(keyValue.charAt(valueEnd - 1))) {
        valueEnd--;
      }

      String key = keyValue.substring(keyStart, keyEnd);
      String value = keyValue.substring(valueStart, valueEnd);
      parameters.put(key, value);
    }
    return parameters;
  }
1368940
public int getSplittingAttribute()
    {
        //TODO refactor the splittingAttribute to just be in this order already
        if(splittingAttribute < catAttributes.length)//categorical feature
            return numNumericFeatures+splittingAttribute;
        //else, is Numerical attribute
        int numerAttribute = splittingAttribute - catAttributes.length;
        return numerAttribute;
    }
787809
public static Elements select(Evaluator evaluator, Element root) {
        Validate.notNull(evaluator);
        Validate.notNull(root);
        return Collector.collect(evaluator, root);
    }