Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.owasp.dependencycheck.dependency
Class EvidenceCollection

    java.lang.Object
      org.owasp.dependencycheck.dependency.EvidenceCollection

All Implemented Interfaces:
  Iterable<Evidence>

    public class EvidenceCollection

extends Object
implements Iterable<Evidence>

Used to maintain a collection of Evidence.

Author:
  Jeremy Long (jeremy.long@owasp.org)

Constructor Summary
`EvidenceCollection()` Creates a new EvidenceCollection.

Method Summary
`void` | `addEvidence(Evidence e)` Adds evidence to the collection.
`void` | `addEvidence(String source, String name, String value, Evidence.Confidence confidence)` Creates an Evidence object from the parameters and adds the resulting object to the collection.
`void` | `addWeighting(String str)` Adds term to the weighting collection.
`boolean` | `contains(Evidence.Confidence confidence)` Returns whether or not the collection contains evidence of a specified Confidence.
`boolean` | `containsUsedString(String text)` Used to determine if a given string was used (aka read).
`boolean` | `containsUsedVersion(DependencyVersion version)` Used to determine if a given version was used (aka read) from the EvidenceCollection.
`Set<Evidence>` | `getEvidence()` Returns the set of evidence.
`Set<Evidence>` | `getEvidence(String source)` Returns the set of evidence from a given source.
`Set<Evidence>` | `getEvidence(String source, String name)` Returns the set of evidence from a given source and name.
`Set<String>` | `getWeighting()` Returns a set of Weightings - a list of terms that are believed to be of higher confidence when also found in another location.
`Iterator<Evidence>` | `iterator()` Implements the iterator interface for the Evidence Collection.
`Iterable<Evidence>` | `iterator(Evidence.Confidence confidence)` Used to iterate over evidence of the specified confidence.
`static EvidenceCollection` | `merge(EvidenceCollection... ec)` Merges multiple EvidenceCollections together.
`static EvidenceCollection` | `mergeUsed(EvidenceCollection... ec)` Merges multiple EvidenceCollections together, only merging evidence that was used, into a new EvidenceCollection.
`int` | `size()` Returns the number of elements in the EvidenceCollection.
`String` | `toString()` Returns a string of evidence 'values'.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EvidenceCollection

    public EvidenceCollection()

  Creates a new EvidenceCollection.

Method Detail

### iterator

    public final Iterable<Evidence> iterator(Evidence.Confidence confidence)

  Used to iterate over evidence of the specified confidence.

  Parameters:
    `confidence` - the confidence level for the evidence to be iterated over.
  Returns:
    Iterable an iterable collectoin of evidence

### addEvidence

    public void addEvidence(Evidence e)

  Adds evidence to the collection.

  Parameters:
    `e` - Evidence.

### addEvidence

    public void addEvidence(String source,
                            String name,
                            String value,
                            Evidence.Confidence confidence)

  Creates an Evidence object from the parameters and adds the resulting object to the collection.

  Parameters:
    `source` - the source of the Evidence.
    `name` - the name of the Evidence.
    `value` - the value of the Evidence.
    `confidence` - the confidence of the Evidence.

### addWeighting

    public void addWeighting(String str)

  Adds term to the weighting collection. The terms added here are used later to boost the score of other terms. This is a way of combining evidence from multiple sources to boost the confidence of the given evidence. Example: The term 'Apache' is found in the manifest of a JAR and is added to the Collection. When we parse the package names within the JAR file we may add these package names to the "weighted" strings collection to boost the score in the Lucene query. That way when we construct the Lucene query we find the term Apache in the collection AND in the weighted strings; as such, we will boost the confidence of the term Apache.

  Parameters:
    `str` - to add to the weighting collection.

### getWeighting

    public Set<String> getWeighting()

  Returns a set of Weightings - a list of terms that are believed to be of higher confidence when also found in another location.

  Returns:
    Set

### getEvidence

    public Set<Evidence> getEvidence()

  Returns the set of evidence.

  Returns:
    the set of evidence.

### getEvidence

    public Set<Evidence> getEvidence(String source)

  Returns the set of evidence from a given source.

  Parameters:
    `source` - the source of the evidence
  Returns:
    the set of evidence.

### getEvidence

    public Set<Evidence> getEvidence(String source,
                                     String name)

  Returns the set of evidence from a given source and name.

  Parameters:
    `source` - the source of the evidence
    `name` - the name of the evidence to return
  Returns:
    the set of evidence.

### iterator

    public Iterator<Evidence> iterator()

  Implements the iterator interface for the Evidence Collection.

  Specified by:
    `iterator` in interface `Iterable<Evidence>`
  Returns:
    an Iterator.

### containsUsedString

    public boolean containsUsedString(String text)

  Used to determine if a given string was used (aka read).

  Parameters:
    `text` - the string to search for.
  Returns:
    whether or not the string was used.

### containsUsedVersion

    public boolean containsUsedVersion(DependencyVersion version)

  Used to determine if a given version was used (aka read) from the EvidenceCollection.

  Parameters:
    `version` - the version to search for within the collected evidence.
  Returns:
    whether or not the string was used.

### contains

    public boolean contains(Evidence.Confidence confidence)

  Returns whether or not the collection contains evidence of a specified Confidence.

  Parameters:
    `confidence` - A Confidence value.
  Returns:
    boolean.

### mergeUsed

    public static EvidenceCollection mergeUsed(EvidenceCollection... ec)

  Merges multiple EvidenceCollections together, only merging evidence that was used, into a new EvidenceCollection.

  Parameters:
    `ec` - One or more EvidenceCollections.
  Returns:
    a new EvidenceCollection containing the used evidence.

### merge

    public static EvidenceCollection merge(EvidenceCollection... ec)

  Merges multiple EvidenceCollections together.

  Parameters:
    `ec` - One or more EvidenceCollections.
  Returns:
    a new EvidenceCollection.

### toString

    public String toString()

  Returns a string of evidence 'values'.

  Overrides:
    `toString` in class `Object`
  Returns:
    a string containing the evidence.

### size

    public int size()

  Returns the number of elements in the EvidenceCollection.

  Returns:
    the number of elements in the collection.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012-2013 OWASP. All Rights Reserved.