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.crosswire.common.diff
Class Match

    java.lang.Object
      org.crosswire.common.diff.Match

All Implemented Interfaces:
  Locator

    public class Match

extends Object
implements Locator

Computes the difference between two texts to create a patch. Applies the patch onto another text, allowing for errors. Based on the LGPL Diff_Match_Patch v1.5 javascript of Neil Fraser, Copyright (C) 2006
http://neil.fraser.name/software/diff_match_patch/

Author:
  DM Smith
See Also:
  `The GNU Lesser General Public License for details.`

Field Summary
`private int` | `loc` The location in text to focus the search.
`private Locator` | `locator` The strategy for locating a best match.
`private String` | `pattern` The pattern to find in the text.
`private String` | `text` The text to search.

Constructor Summary
`Match()`
`Match(String text, String pattern, int loc)` Locate the best instance of 'pattern' in 'text' near 'loc'.

Method Summary
`int` | `locate()` Locate the best instance of 'pattern' in 'text' near 'loc'.
`int` | `maxPatternLength()` The maximum length a pattern can be.

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

Field Detail

### text

    private String text

  The text to search.

### pattern

    private String pattern

  The pattern to find in the text.

### loc

    private int loc

  The location in text to focus the search.

### locator

    private Locator locator

  The strategy for locating a best match.

Constructor Detail

### Match

    public Match()

### Match

    public Match(String text,
                 String pattern,
                 int loc)

  Locate the best instance of 'pattern' in 'text' near 'loc'.

  Parameters:
    `text` - The text to search
    `pattern` - The pattern to search for
    `loc` - The location to search around

Method Detail

### maxPatternLength

    public int maxPatternLength()

  Description copied from interface: `Locator`
  The maximum length a pattern can be.

  Specified by:
    `maxPatternLength` in interface `Locator`
  Returns:
    maximum pattern length.

### locate

    public int locate()

  Locate the best instance of 'pattern' in 'text' near 'loc'.

  Specified by:
    `locate` in interface `Locator`
  Returns:
    Best match index or -1, if no match found

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