HashvalueAlgorithm (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.types.selectors.modifiedselector, class: HashvalueAlgorithm

Package org.apache.tools.ant.types.selectors.modifiedselector

# Class HashvalueAlgorithm

java.lang.Object
org.apache.tools.ant.types.selectors.modifiedselector.HashvalueAlgorithm

All Implemented Interfaces:
  `Algorithm`

public class HashvalueAlgorithm extends Object implements Algorithm
Computes a 'hashvalue' for the content of file using String.hashValue(). Use of this algorithm doesn't require any additional nested <param>s and doesn't support any.

Since:
  Ant 1.6
Version:
  2003-09-13

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HashvalueAlgorithm()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getValue(File file)`
  Computes a 'hashvalue' for a file content.
  `boolean`
  `isValid()`
  This algorithm doesn't need any configuration.
  `String`
  `toString()`
  Override Object.toString().

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### HashvalueAlgorithm

    public HashvalueAlgorithm()

- ## Method Details

  - ### isValid

    public boolean isValid()
    This algorithm doesn't need any configuration. Therefore it's always valid.
    Specified by:
      `isValid` in interface `Algorithm`
    Returns:
      always true

  - ### getValue

    public String getValue(File file)
    Computes a 'hashvalue' for a file content. It reads the content of a file, convert that to String and use the String.hashCode() method.
    Specified by:
      `getValue` in interface `Algorithm`
    Parameters:
      `file` - The file for which the value should be computed
    Returns:
      the hashvalue or null if the file couldn't be read

  - ### toString

    public String toString()
    Override Object.toString().
    Overrides:
      `toString` in class `Object`
    Returns:
      information about this comparator