## estraier
Class Document

    java.lang.Object
      estraier.Document

public class Document
extends java.lang.Object

Abstraction of document.

Constructor Summary
`Document()` Create a document object.
`Document(java.lang.String draft)` Create a document object made from draft data.

Method Summary
`void` `add_attr(java.lang.String name, java.lang.String value)` Add an attribute.
`void` `add_hidden_text(java.lang.String text)` Add a hidden sentence.
`void` `add_text(java.lang.String text)` Add a sentence of text.
`java.util.List` `attr_names()` Get a list of attribute names.
`java.lang.String` `attr(java.lang.String name)` Get the value of an attribute.
`java.lang.String` `cat_texts()` Concatenate sentences of the text.
`java.lang.String` `dump_draft()` Dump draft data.
`protected void` `finalize()` Release resources.
`int` `id()` Get the ID number.
`java.util.Map` `keywords()` Get attached keywords.
`java.lang.String` `make_snippet(java.util.List words, int wwidth, int hwidth, int awidth)` Make a snippet of the body text.
`int` `score()` Get the substitute score.
`void` `set_keywords(java.util.Map kwords)` Attach keywords.
`void` `set_score(int score)` Set the substitute score.
`java.util.List` `texts()` Get a list of sentences of the text.

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

Constructor Detail

### Document

    public Document()

  Create a document object.

### Document

    public Document(java.lang.String draft)

  Create a document object made from draft data.

Parameters:
  `draft` - a string of draft data.

Method Detail

### add_attr

    public void add_attr(java.lang.String name,
                         java.lang.String value)

  Add an attribute.

  Parameters:
    `name` - the name of an attribute.
    `value` - the value of the attribute. If it is `null', the attribute is removed.

### add_hidden_text

    public void add_hidden_text(java.lang.String text)

  Add a hidden sentence.

  Parameters:
    `text` - a hidden sentence.

### add_text

    public void add_text(java.lang.String text)

  Add a sentence of text.

  Parameters:
    `text` - sentence of text.

### attr_names

    public java.util.List attr_names()

  Get a list of attribute names.

  Returns:
    a list object of attribute names.

### attr

    public java.lang.String attr(java.lang.String name)

  Get the value of an attribute.

  Parameters:
    `name` - the name of an attribute.
  Returns:
    the value of the attribute or `null' if it does not exist.

### cat_texts

    public java.lang.String cat_texts()

  Concatenate sentences of the text.

  Returns:
    concatenated sentences.

### dump_draft

    public java.lang.String dump_draft()

  Dump draft data.

  Returns:
    draft data.

### finalize

    protected void finalize()

  Release resources.

### id

    public int id()

  Get the ID number.

  Returns:
    the ID number. If this object has never been registered, -1 is returned.

### keywords

    public java.util.Map keywords()

  Get attached keywords.

  Returns:
    a map object of keywords and their scores in decimal string. If no keyword is attached, `null' is returned.

### make_snippet

    public java.lang.String make_snippet(java.util.List words,
                                         int wwidth,
                                         int hwidth,
                                         int awidth)

  Make a snippet of the body text.

  Parameters:
    `words` - a list object of words to be highlight.
    `wwidth` - whole width of the result.
    `hwidth` - width of strings picked up from the beginning of the text.
    `awidth` - width of strings picked up around each highlighted word.
  Returns:
    a snippet string of the body text. There are tab separated values. Each line is a string to be shown. Though most lines have only one field, some lines have two fields. If the second field exists, the first field is to be shown with highlighted, and the second field means its normalized form.

### score

    public int score()

  Get the substitute score.

  Returns:
    the substitute score or -1 if it is not set.

### set_keywords

    public void set_keywords(java.util.Map kwords)

  Attach keywords.

  Parameters:
    `kwords` - a map object of keywords. Keys of the map should be keywords of the document and values should be their scores in decimal string.

### set_score

    public void set_score(int score)

  Set the substitute score.

  Parameters:
    `score` - the substitute score. It it is negative, the substitute score setting is nullified.

### texts

    public java.util.List texts()

  Get a list of sentences of the text.

  Returns:
    a list object of sentences of the text.