You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2006/09/08 21:14:39 UTC

svn commit: r441619 - /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/util/TargetIterator.java

Author: jmsnell
Date: Fri Sep  8 12:14:38 2006
New Revision: 441619

URL: http://svn.apache.org/viewvc?view=rev&rev=441619
Log:
Make Target implement Iterable to provide another way of getting to the parsed target tokens

(forgot this one)

Added:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/util/TargetIterator.java

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/util/TargetIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/util/TargetIterator.java?view=auto&rev=441619
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/util/TargetIterator.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/util/TargetIterator.java Fri Sep  8 12:14:38 2006
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.server.util;
+
+import java.util.Iterator;
+
+import org.apache.abdera.protocol.server.target.Target;
+
+public final class TargetIterator 
+  implements Iterator<String> {
+
+  private final Target target;
+  private int counter = -1;
+  
+  public TargetIterator(Target target) {
+    this.target = target;
+  }
+  
+  public boolean hasNext() {
+    return (target.getValue(counter + 1) != null);
+  }
+
+  public String next() {
+    return (hasNext()) ? target.getValue(++counter) : null;
+  }
+
+  public void remove() {
+    throw new UnsupportedOperationException();
+  }
+
+}