Renamed instance vars

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@930353 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2010-04-02 18:54:49 +00:00
parent 0be39371e9
commit c1c6ba636a
1 changed files with 10 additions and 10 deletions

View File

@ -44,37 +44,37 @@ import org.apache.http.annotation.NotThreadSafe;
@NotThreadSafe // HashSet is not synch. @NotThreadSafe // HashSet is not synch.
public class RedirectLocations { public class RedirectLocations {
private final Set<URI> uris; private final Set<URI> unique;
private final List<URI> log; private final List<URI> all;
public RedirectLocations() { public RedirectLocations() {
super(); super();
this.uris = new HashSet<URI>(); this.unique = new HashSet<URI>();
this.log = new ArrayList<URI>(); this.all = new ArrayList<URI>();
} }
/** /**
* Test if the URI is present in the collection. * Test if the URI is present in the collection.
*/ */
public boolean contains(final URI uri) { public boolean contains(final URI uri) {
return this.uris.contains(uri); return this.unique.contains(uri);
} }
/** /**
* Adds a new URI to the collection. * Adds a new URI to the collection.
*/ */
public void add(final URI uri) { public void add(final URI uri) {
this.uris.add(uri); this.unique.add(uri);
this.log.add(uri); this.all.add(uri);
} }
/** /**
* Removes a URI from the collection. * Removes a URI from the collection.
*/ */
public boolean remove(final URI uri) { public boolean remove(final URI uri) {
boolean removed = this.uris.remove(uri); boolean removed = this.unique.remove(uri);
if (removed) { if (removed) {
Iterator<URI> it = this.log.iterator(); Iterator<URI> it = this.all.iterator();
while (it.hasNext()) { while (it.hasNext()) {
URI current = it.next(); URI current = it.next();
if (current.equals(uri)) { if (current.equals(uri)) {
@ -93,7 +93,7 @@ public class RedirectLocations {
* @since 4.1 * @since 4.1
*/ */
public List<URI> getAll() { public List<URI> getAll() {
return new ArrayList<URI>(this.log); return new ArrayList<URI>(this.all);
} }
} }