You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ma...@apache.org on 2009/06/28 01:44:44 UTC

svn commit: r789027 - in /incubator/ace/trunk/liq/src/org/apache/ace: consolelogger/Logger.java log/Log.java log/LogEvent.java repository/Range.java repository/SortedRangeSet.java

Author: marrs
Date: Sat Jun 27 23:44:44 2009
New Revision: 789027

URL: http://svn.apache.org/viewvc?rev=789027&view=rev
Log:
Added some more documentation to the code.

Modified:
    incubator/ace/trunk/liq/src/org/apache/ace/consolelogger/Logger.java
    incubator/ace/trunk/liq/src/org/apache/ace/log/Log.java
    incubator/ace/trunk/liq/src/org/apache/ace/log/LogEvent.java
    incubator/ace/trunk/liq/src/org/apache/ace/repository/Range.java
    incubator/ace/trunk/liq/src/org/apache/ace/repository/SortedRangeSet.java

Modified: incubator/ace/trunk/liq/src/org/apache/ace/consolelogger/Logger.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/liq/src/org/apache/ace/consolelogger/Logger.java?rev=789027&r1=789026&r2=789027&view=diff
==============================================================================
--- incubator/ace/trunk/liq/src/org/apache/ace/consolelogger/Logger.java (original)
+++ incubator/ace/trunk/liq/src/org/apache/ace/consolelogger/Logger.java Sat Jun 27 23:44:44 2009
@@ -22,6 +22,10 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.log.LogService;
 
+/**
+ * An implementation of the OSGi LogService that directly outputs each log message 
+ * to <code>System.out</code>. It does not implement the LogReader or LogListeners.
+ */
 public class Logger implements LogService {
     private static String[] LEVEL = { "", "Error", "Warn ", "Info ", "Debug" };
 

Modified: incubator/ace/trunk/liq/src/org/apache/ace/log/Log.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/liq/src/org/apache/ace/log/Log.java?rev=789027&r1=789026&r2=789027&view=diff
==============================================================================
--- incubator/ace/trunk/liq/src/org/apache/ace/log/Log.java (original)
+++ incubator/ace/trunk/liq/src/org/apache/ace/log/Log.java Sat Jun 27 23:44:44 2009
@@ -21,7 +21,8 @@
 import java.util.Dictionary;
 
 /**
- * Log interface.
+ * Log interface for a fairly generic logging mechanism, where each log entry has a type
+ * and a dictionary of properties.
  */
 public interface Log {
     /**

Modified: incubator/ace/trunk/liq/src/org/apache/ace/log/LogEvent.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/liq/src/org/apache/ace/log/LogEvent.java?rev=789027&r1=789026&r2=789027&view=diff
==============================================================================
--- incubator/ace/trunk/liq/src/org/apache/ace/log/LogEvent.java (original)
+++ incubator/ace/trunk/liq/src/org/apache/ace/log/LogEvent.java Sat Jun 27 23:44:44 2009
@@ -27,7 +27,7 @@
 
 
 /**
- * Log event.
+ * Log event from a specific gateway and log.
  */
 public class LogEvent implements Comparable {
     

Modified: incubator/ace/trunk/liq/src/org/apache/ace/repository/Range.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/liq/src/org/apache/ace/repository/Range.java?rev=789027&r1=789026&r2=789027&view=diff
==============================================================================
--- incubator/ace/trunk/liq/src/org/apache/ace/repository/Range.java (original)
+++ incubator/ace/trunk/liq/src/org/apache/ace/repository/Range.java Sat Jun 27 23:44:44 2009
@@ -25,6 +25,11 @@
     private long m_low;
     private long m_high;
     
+    /**
+     * Create a new range based on a string representation of that range.
+     * 
+     * @param representation the string representation
+     */
     public Range(String representation) {
         int i = representation.indexOf('-');
         if (i == -1) {
@@ -43,10 +48,21 @@
         }
     }
     
+    /**
+     * Create a range that consists of a single number.
+     * 
+     * @param number the number
+     */
     public Range(long number) {
         m_low = m_high = number;
     }
     
+    /**
+     * Creates a range from a lower to a higher bound.
+     * 
+     * @param low the lower bound
+     * @param high the higher bound
+     */
     public Range(long low, long high) {
         if (low <= high) {
             m_low = low;
@@ -57,10 +73,22 @@
         }
     }
     
+    /**
+     * Returns the lower bound.
+     * 
+     * @return the lower bound
+     */
     public long getLow() {
         return m_low;
     }
     
+    /**
+     * Sets a new lower bound. Will make sure the range stays valid, 
+     * so if the higher bound is smaller than the new lower bound, it will
+     * be made equal to this new lower bound.
+     * 
+     * @param low the new lower bound
+     */
     public void setLow(long low) {
         m_low = low;
         if (m_high < m_low) {
@@ -68,10 +96,22 @@
         }
     }
 
+    /**
+     * Returns the higher bound.
+     * 
+     * @return the higher bound
+     */
     public long getHigh() {
         return m_high;
     }
     
+    /**
+     * Sets a new higher bound. Will make sure the range stays valid,
+     * so if the lower bound is bigger than the new higher bound, it will
+     * be made equal to this new higher bound.
+     * 
+     * @param high the new higher bound
+     */
     public void setHigh(long high) {
         m_high = high;
         if (m_low > m_high) {
@@ -79,10 +119,21 @@
         }
     }
     
+    /**
+     * Checks if a number falls within this range.
+     * 
+     * @param number the number to check
+     * @return <code>true</code> if the number was inside the range
+     */
     public boolean contains(long number) {
         return (m_low <= number) && (m_high >= number);
     }
-    
+
+    /**
+     * Converts the range to a string representation that can be parsed
+     * back to a new <code>Range</code> object.
+     * @return
+     */
     public String toRepresentation() {
         if (m_low == m_high) {
             return Long.toString(m_low);

Modified: incubator/ace/trunk/liq/src/org/apache/ace/repository/SortedRangeSet.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/liq/src/org/apache/ace/repository/SortedRangeSet.java?rev=789027&r1=789026&r2=789027&view=diff
==============================================================================
--- incubator/ace/trunk/liq/src/org/apache/ace/repository/SortedRangeSet.java (original)
+++ incubator/ace/trunk/liq/src/org/apache/ace/repository/SortedRangeSet.java Sat Jun 27 23:44:44 2009
@@ -121,6 +121,12 @@
         return result;
     }
     
+    /**
+     * Checks if a number falls within any range in this set.
+     * 
+     * @param number the number to check
+     * @return <code>true</code> if the number was inside any range in this set
+     */
     public boolean contains(long number) {
         Iterator i = m_ranges.iterator();
         while (i.hasNext()) {
@@ -131,7 +137,12 @@
         }
         return false;
     }
-    
+
+    /**
+     * Adds a number to the set of ranges. Tries to be as smart as possible about it.
+     * 
+     * @param number the number to add
+     */
     private void add(long number) {
         ListIterator i = m_ranges.listIterator();
         while (i.hasNext()) {
@@ -169,6 +180,11 @@
         m_ranges.add(nr);
     }
     
+    /**
+     * Returns an iterator that iterates over all the ranges in this set.
+     * 
+     * @return a range iterator
+     */
     public RangeIterator iterator() {
         return new RangeIterator(m_ranges.iterator());
     }