Migration to maven almost complete. At least everything builds and works
[utils] / crawler / kiss / src / main / java / org / wamblee / crawler / kiss / guide / PrintVisitor.java
diff --git a/crawler/kiss/src/main/java/org/wamblee/crawler/kiss/guide/PrintVisitor.java b/crawler/kiss/src/main/java/org/wamblee/crawler/kiss/guide/PrintVisitor.java
new file mode 100644 (file)
index 0000000..028cdf5
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005 the original author or authors.
+ * 
+ * Licensed 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.
+ */ 
+
+package org.wamblee.crawler.kiss.guide;
+
+import java.io.PrintStream;
+
+
+/**
+ * Print visitor for pretty printing the TV guide. 
+ */
+public class PrintVisitor extends AbstractVisitor {
+    
+    /**
+     * Stream to print the guide on. 
+     */
+    private PrintStream _stream; 
+    
+    /**
+     * Constructs the print visitor. 
+     * @param aStream Stream to print on. 
+     */
+    public PrintVisitor(PrintStream aStream) { 
+        _stream = aStream;
+    }
+
+    /* (non-Javadoc)
+     * @see org.wamblee.crawler.kiss.Visitor#visitProgram(org.wamblee.crawler.kiss.Program)
+     */
+    public void visitProgram(Program aProgram) {
+        _stream.println("  " + aProgram.toString());   
+    }
+    
+    /* (non-Javadoc)
+     * @see org.wamblee.crawler.kiss.AbstractVisitor#visitChannel(org.wamblee.crawler.kiss.Channel)
+     */
+    @Override
+    public void visitChannel(Channel aChannel) {
+        _stream.println(aChannel.getName());
+        super.visitChannel(aChannel);
+    }
+}