org.apache.geronimo.javamail.store.nntp.newsrc
Class RangeList

java.lang.Object
  extended by org.apache.geronimo.javamail.store.nntp.newsrc.RangeList

public class RangeList
extends Object

Manage a list of ranges values from a newsrc file.


Constructor Summary
RangeList(String line)
          Create a RangeList instance from a newsrc range line.
 
Method Summary
 void insert(Range newRange)
          Insert a range item into our list.
 boolean isDirty()
          Return the state of the dirty flag.
 boolean isMarked(int article)
          Test if a given article point falls within one of the contained Ranges.
 void save(Writer out)
          Save this List of Ranges out to a .newsrc file.
 void setMarked(int article)
          Mark a target article as having been seen.
 void setUnmarked(int article)
          Clear the seen mark for a target article.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeList

public RangeList(String line)
Create a RangeList instance from a newsrc range line. Values are saved as a comma separated set of range values. A range value is either a single number or a hypenated pair of numbers.

Parameters:
line - The newsrc range line.
Method Detail

insert

public void insert(Range newRange)
Insert a range item into our list. If possible, the inserted range will be merged with existing ranges.

Parameters:
newRange - The new range item.

isMarked

public boolean isMarked(int article)
Test if a given article point falls within one of the contained Ranges.

Parameters:
article - The test point.
Returns:
true if this falls within one of our current mark Ranges, false otherwise.

setMarked

public void setMarked(int article)
Mark a target article as having been seen.

Parameters:
article - The target article number.

setUnmarked

public void setUnmarked(int article)
Clear the seen mark for a target article.

Parameters:
article - The target article number.

save

public void save(Writer out)
          throws IOException
Save this List of Ranges out to a .newsrc file. This creates a comma-separated list of range values from each of the Ranges.

Parameters:
out - The target output stream.
Throws:
IOException

isDirty

public boolean isDirty()
Return the state of the dirty flag.

Returns:
True if the range list information has changed, false otherwise.


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.