Checks if the from and the to parameters are valid for the given source
352790
private void checkBounds(String source, Integer from, Integer to) throws TransformationOperationException {
        Integer length = source.length();
        if (from > to) {
            throw new TransformationOperationException(
                "The from parameter is bigger than the to parameter");
        }
        if (from < 0 || from > length) {
            throw new TransformationOperationException(
                "The from parameter is not fitting to the size of the source");
        }
        if (to < 0 || to > length) {
            throw new TransformationOperationException(
                "The to parameter is not fitting to the size of the source");
        }
    }
698974
def valid_result(self, r):
        '''
            
        '''
        source_mapping_elements = [elem['source_mapping']['filename_absolute'] for elem in r['elements'] if 'source_mapping' in elem]
        if r['elements'] and all((any(path in src_mapping for path in self._paths_to_filter) for src_mapping in source_mapping_elements)):
            return False
        return not r['description'] in [pr['description'] for pr in self._previous_results]
519974
protected boolean checkSliceArguments(long from, Long to) {
        if (from < 0) {
            throw new IllegalArgumentException("Slice from is negative: " + from);
        }
        if (to == null) {
            if (from == 0) {
                return false;
            }
        } else if (from > to) {
            throw new IllegalArgumentException
                ("Slice from is more than to: " + from + " > " + to);
        }
        return true;
    }
1289033
def is_valid_int_param(param):
    
    if param is None:
        return False
    try:
        param = int(param)
        if param < 0:
            return False
    except (TypeError, ValueError):
        return False
    return True
206263
function isValidExtension(src){
   var extension = src.split('.').pop();
   var isValid = ENUM_INVALID_EXTENSIONS[extension] === false ? false : true;
   return isValid;
}
566622
public function validate()
    {
        parent::validate();

        $from = $this->getFrom();
        if (!($from instanceof Person)) {
            throw new InvalidDocumentException("The from parameter must be a Person object");
        }
        $from->validate();
    }
56960
private function checkParams()
    {
        if ($this->file === null && empty($this->filesets) && empty($this->dirsets)) {
            throw new BuildException("Specify at least one source - a file or a fileset.");
        }

        if ($this->user === null && $this->group === null) {
            throw new BuildException("You have to specify either an owner or a group for chown.");
        }
    }
751078
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);

  var source = '' + args[0]
    , destination = '' + args[1];

  if(!info.db.getKey(args[0], info)) {
    throw NoSuchKey;
  }else if(source === destination) {
    throw SourceDestination;
  }
  args[0] = source;
  args[1] = destination;
}
243787
private String determineQualifiedName(String name, CompilationUnit from) {
        if (from != null) {
            // Determine qualified name as being relative to "from"

            String fromName = from.getName();
            int index = fromName.lastIndexOf('.');
            if (index >= 0) {
                String qual = fromName.substring(0, index + 1) + name;
                if (sourceExists(qual)) {
                    return qual;
                }
            }
        }

        if (sourceExists(name)) {
            return name;
        }

        return null;
    }
603152
private void validateRecordedMapping() {
    if (currentMapping.destinationMutators == null || currentMapping.destinationMutators.isEmpty())
      errors.missingDestination();
    // If mapping a field without a source
    else if (options.skipType == 0
        && (currentMapping.sourceAccessors == null || currentMapping.sourceAccessors.isEmpty())
        && currentMapping.destinationMutators.get(currentMapping.destinationMutators.size() - 1)
            .getPropertyType()
            .equals(PropertyType.FIELD) && options.converter == null && !options.mapFromSource
        && sourceConstant == null)
      errors.missingSource();
    else if (options.skipType == 2 && options.condition != null)
      errors.conditionalSkipWithoutSource();
  }
1169366
public static void checkIndex(final int from, final int until, final int size) {
		if (from < 0) {
			throw new ArrayIndexOutOfBoundsException("fromIndex = " + from);
		}
		if (until > size) {
			throw new ArrayIndexOutOfBoundsException(format(
				"Invalid index range: [%d, %s)", from, until
			));
		}
		if (from > until) {
			throw new IllegalArgumentException(format(
				"fromIndex(%d) > toIndex(%d)", from, until
			));
		}
	}
621034
def validate_parameters(self):
        """"""
        for p in self.params:
            if p not in self.known_params:
                raise errors.UnknownParameter(p, self.known_params)
696969
private static void rangeCheck(int length, int fromIndex, int toIndex) {
        if (fromIndex > toIndex) {
            throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
        }
        if (fromIndex < 0) {
            throw new ArrayIndexOutOfBoundsException(fromIndex);
        }
        if (toIndex > length) {
            throw new ArrayIndexOutOfBoundsException(toIndex);
        }
    }
394473
private boolean validParameter(final String s) {
        final String[] tokens = PARAMS_REGEX.split(s);
        if (tokens.length != 2) {
            return false;
        }

        final char first = s.charAt(0);
        String second = tokens[1];
        if (second.endsWith(VARARGS_SUFFIX)) {
            // value encoding / return type var args, mangle argument
            second = varargsRoot(second);
        }

        if (first == 'E') {
            if (isWildcard(second)) {
                return true;
            }

            // Verify value encoding exists as an enum
            if (getValueEncoding(second) != null) {
                return true;
            }

            // Fallback to verification based on all character discriminators
            for (final Character c : second.toCharArray()) {
                if (getValueEncoding(c) == null) {
                    return false;
                }
            }
            return true;
        } else if (first == 'F') {
            // Verify return type exists as an enum
            if (ReturnType.getReturnType(second) != null) {
                return true;
            }
        }
        return false;
    }
296869
function validateRequestParams(type, params) {
        var validatedParams = null;

        params = params || {};

        //Don't validate if the formatting is done by the caller
        if (params.format === MESSAGE_FORMAT.LSP) {
            return params;
        }

        switch (type) {
            case ToolingInfo.LANGUAGE_SERVICE.START:
                {
                    if (hasValidProp(params, "rootPaths") || hasValidProp(params, "rootPath")) {
                        validatedParams = params;
                        validatedParams.capabilities = validatedParams.capabilities || false;
                    }
                    break;
                }
            case ToolingInfo.FEATURES.CODE_HINTS:
            case ToolingInfo.FEATURES.PARAMETER_HINTS:
            case ToolingInfo.FEATURES.JUMP_TO_DECLARATION:
            case ToolingInfo.FEATURES.JUMP_TO_DEFINITION:
            case ToolingInfo.FEATURES.JUMP_TO_IMPL:
                {
                    if (hasValidProps(params, ["filePath", "cursorPos"])) {
                        validatedParams = params;
                    }
                    break;
                }
            case ToolingInfo.FEATURES.CODE_HINT_INFO:
                {
                    validatedParams = params;
                    break;
                }
            case ToolingInfo.FEATURES.FIND_REFERENCES:
                {
                    if (hasValidProps(params, ["filePath", "cursorPos"])) {
                        validatedParams = params;
                        validatedParams.includeDeclaration = validatedParams.includeDeclaration || false;
                    }
                    break;
                }
            case ToolingInfo.FEATURES.DOCUMENT_SYMBOLS:
                {
                    if (hasValidProp(params, "filePath")) {
                        validatedParams = params;
                    }
                    break;
                }
            case ToolingInfo.FEATURES.PROJECT_SYMBOLS:
                {
                    if (hasValidProp(params, "query") && typeof params.query === "string") {
                        validatedParams = params;
                    }
                    break;
                }
            case ToolingInfo.LANGUAGE_SERVICE.CUSTOM_REQUEST:
                {
                    validatedParams = params;
                }
        }

        return validatedParams;
    }
193302
public final void validate(StringBuilder source) {

    int length = source.length();
    source.append('/');
    source.append(getSourceIdentifier());
    doValidate(source);
    // reset source for recursive invocation...
    source.setLength(length);
  }
1028669
private boolean verifyProvide(Node methodName, Node arg) {
    if (!verifyLastArgumentIsString(methodName, arg)) {
      return false;
    }

    if (!NodeUtil.isValidQualifiedName(
        compiler.getOptions().getLanguageIn().toFeatureSet(), arg.getString())) {
      compiler.report(
          JSError.make(
              arg,
              INVALID_PROVIDE_ERROR,
              arg.getString(),
              compiler.getOptions().getLanguageIn().toString()));
      return false;
    }

    return true;
  }