krysalis-update/src/java/org/krysalis/depot/common/util Tuple.java,1.1,1.2 SystemUtils.java,1.1,1.2 Triple.java,1.1,1.2 IndentWriter.java,1.1,1.2 Registry.java,1.1,1.2
Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:11:55 +0000
| Newsgroups | gmane.comp.krysalis.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26470/src/java/org/krysalis/depot/common/util
Modified Files:
Tuple.java SystemUtils.java Triple.java IndentWriter.java
Registry.java
Log Message:
format
Index: Registry.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/Registry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Registry.java 8 Dec 2004 09:06:31 -0000 1.1
--- Registry.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 15,20 ****
*/
-
package org.krysalis.depot.common.util;
import java.io.PrintWriter;
import java.util.Iterator;
--- 15,20 ----
*/
package org.krysalis.depot.common.util;
+
import java.io.PrintWriter;
import java.util.Iterator;
***************
*** 26,33 ****
/**
! * @author ajack.
*/
public class Registry implements Dumpable {
private TreeMap m_contents = null;
private boolean m_uniqueContents = false;
--- 26,34 ----
/**
! * @author ajack.
*/
public class Registry implements Dumpable {
private TreeMap m_contents = null;
+
private boolean m_uniqueContents = false;
***************
*** 48,53 ****
protected void put(Object key, Object entry) {
if (m_uniqueContents && m_contents.containsKey(key)) {
! throw new DepotError(
! "Can't have same item twice. Entry: " + key + " : " + entry);
}
m_contents.put(key, entry);
--- 49,54 ----
protected void put(Object key, Object entry) {
if (m_uniqueContents && m_contents.containsKey(key)) {
! throw new DepotError("Can't have same item twice. Entry: " + key
! + " : " + entry);
}
m_contents.put(key, entry);
***************
*** 72,96 ****
out.print(indent);
out.println("Registry :" + SystemUtils.getShortName(getClass()));
!
if (hasEntries()) {
out.print(indent1);
out.println("(");
!
for (Iterator i = iterator(); i.hasNext();) {
! DebugUtils.dump(out,depth+2,verbose,(Object) i.next());
}
!
out.print(indent1);
out.println(")");
}
}
//
! // public int compareTo(Object other) {
! // int comparison = -1;
! // String name = getClass().getName();
! // String otherName = other.getClass().getName();
! // comparison = name.compareTo(otherName);
! // return comparison;
! // }
public Object[] toArray() {
--- 73,98 ----
out.print(indent);
out.println("Registry :" + SystemUtils.getShortName(getClass()));
!
if (hasEntries()) {
out.print(indent1);
out.println("(");
!
for (Iterator i = iterator(); i.hasNext();) {
! DebugUtils.dump(out, depth + 2, verbose, (Object) i.next());
}
!
out.print(indent1);
out.println(")");
}
}
+
//
! // public int compareTo(Object other) {
! // int comparison = -1;
! // String name = getClass().getName();
! // String otherName = other.getClass().getName();
! // comparison = name.compareTo(otherName);
! // return comparison;
! // }
public Object[] toArray() {
Index: Tuple.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/Tuple.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Tuple.java 8 Dec 2004 09:06:31 -0000 1.1
--- Tuple.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 21,62 ****
*/
public class Tuple {
! private Object m_first = null;
! private Object m_second = null;
! public Tuple(Object first, Object second) {
! m_first = first;
! m_second = second;
! }
! /**
! * Returns the first.
! * @return Object
! */
! public Object getFirst() {
! return m_first;
! }
! /**
! * Returns the second.
! * @return Object
! */
! public Object getSecond() {
! return m_second;
! }
! /**
! * Sets the first.
! * @param first The first to set
! */
! public void setFirst(Object first) {
! m_first = first;
! }
! /**
! * Sets the second.
! * @param second The second to set
! */
! public void setSecond(Object second) {
! m_second = second;
! }
}
--- 21,69 ----
*/
public class Tuple {
! private Object m_first = null;
! private Object m_second = null;
! public Tuple(Object first, Object second) {
! m_first = first;
! m_second = second;
! }
! /**
! * Returns the first.
! *
! * @return Object
! */
! public Object getFirst() {
! return m_first;
! }
! /**
! * Returns the second.
! *
! * @return Object
! */
! public Object getSecond() {
! return m_second;
! }
! /**
! * Sets the first.
! *
! * @param first
! * The first to set
! */
! public void setFirst(Object first) {
! m_first = first;
! }
!
! /**
! * Sets the second.
! *
! * @param second
! * The second to set
! */
! public void setSecond(Object second) {
! m_second = second;
! }
}
Index: SystemUtils.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/SystemUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SystemUtils.java 8 Dec 2004 09:06:31 -0000 1.1
--- SystemUtils.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 39,44 ****
try {
cwd = new File(getSystemProperty("user.dir"));
! }
! catch (Exception e) {
// World of hurt...
// :TODO:
--- 39,43 ----
try {
cwd = new File(getSystemProperty("user.dir"));
! } catch (Exception e) {
// World of hurt...
// :TODO:
***************
*** 53,58 ****
try {
value = System.getProperty(key);
! }
! catch (SecurityException se) {
// World of hurt...
// :TODO:
--- 52,56 ----
try {
value = System.getProperty(key);
! } catch (SecurityException se) {
// World of hurt...
// :TODO:
***************
*** 84,104 ****
public static PrintWriter getSystemOut() {
! //:TODO: Singleton?
return new PrintWriter(System.out, true);
}
public static PrintWriter getSystemErr() {
! //:TODO: Singleton?
return new PrintWriter(System.err, true);
}
!
public static Triple getMemoryInformation() {
Runtime r = Runtime.getRuntime();
!
Long total = new Long(r.totalMemory());
Long free = new Long(r.freeMemory());
Long max = new Long(r.maxMemory());
!
! return new Triple(total,free,max);
}
}
--- 82,102 ----
public static PrintWriter getSystemOut() {
! // :TODO: Singleton?
return new PrintWriter(System.out, true);
}
public static PrintWriter getSystemErr() {
! // :TODO: Singleton?
return new PrintWriter(System.err, true);
}
!
public static Triple getMemoryInformation() {
Runtime r = Runtime.getRuntime();
!
Long total = new Long(r.totalMemory());
Long free = new Long(r.freeMemory());
Long max = new Long(r.maxMemory());
!
! return new Triple(total, free, max);
}
}
Index: Triple.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/Triple.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Triple.java 8 Dec 2004 09:06:31 -0000 1.1
--- Triple.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 21,31 ****
*/
public class Triple extends Tuple {
! private Object m_third = null;
! public Triple(Object first, Object second, Object third) {
! super(first,second);
!
! m_third = third;
! }
/**
--- 21,31 ----
*/
public class Triple extends Tuple {
! private Object m_third = null;
! public Triple(Object first, Object second, Object third) {
! super(first, second);
!
! m_third = third;
! }
/**
Index: IndentWriter.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/common/util/IndentWriter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IndentWriter.java 8 Dec 2004 09:06:31 -0000 1.1
--- IndentWriter.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 22,44 ****
import java.util.Stack;
-
/**
* @author chalko
! *
! * A PrintWriter that provides line indentations.
! *
*/
public class IndentWriter extends PrintWriter {
private int m_indentLevel = 0;
private int m_defaultIndent = 4;
private String m_indentString = "";
private StringBuffer m_indentBuffer = new StringBuffer();
! //TODO: make static, but thread safe
private Stack m_lastLevelStack = new Stack();
private StringBuffer m_buffer = new StringBuffer();
private boolean m_indented = false;
/**
* Constructor for IndentWriter.
* @param out
*/
--- 22,50 ----
import java.util.Stack;
/**
* @author chalko
! *
! * A PrintWriter that provides line indentations.
! *
*/
public class IndentWriter extends PrintWriter {
private int m_indentLevel = 0;
+
private int m_defaultIndent = 4;
+
private String m_indentString = "";
+
private StringBuffer m_indentBuffer = new StringBuffer();
!
! // TODO: make static, but thread safe
private Stack m_lastLevelStack = new Stack();
+
private StringBuffer m_buffer = new StringBuffer();
+
private boolean m_indented = false;
/**
* Constructor for IndentWriter.
+ *
* @param out
*/
***************
*** 49,52 ****
--- 55,59 ----
/**
* Constructor for IndentWriter.
+ *
* @param out
* @param autoFlush
***************
*** 58,61 ****
--- 65,69 ----
/**
* Constructor for IndentWriter.
+ *
* @param out
*/
***************
*** 66,69 ****
--- 74,78 ----
/**
* Constructor for IndentWriter.
+ *
* @param out
* @param autoFlush
***************
*** 75,78 ****
--- 84,88 ----
/**
* Returns the indentLevel.
+ *
* @return int
*/
***************
*** 83,97 ****
/**
* Sets the indentLevel.
! * @param indentLevel The indentLevel to set
*/
private void setIndent(int indent) {
this.m_indentLevel = Math.max(0, indent);
while (m_indentBuffer.length() < indent) {
! m_indentBuffer.append(" ");
}
m_indentString = m_indentBuffer.substring(0, indent);
// clear lastLevel greater than what we are at
while (!m_lastLevelStack.isEmpty()
! && ((Integer) m_lastLevelStack.peek()).intValue() > m_indentLevel) {
m_lastLevelStack.pop();
}
--- 93,110 ----
/**
* Sets the indentLevel.
! *
! * @param indentLevel
! * The indentLevel to set
*/
private void setIndent(int indent) {
this.m_indentLevel = Math.max(0, indent);
while (m_indentBuffer.length() < indent) {
! m_indentBuffer
! .append(" ");
}
m_indentString = m_indentBuffer.substring(0, indent);
// clear lastLevel greater than what we are at
while (!m_lastLevelStack.isEmpty()
! && ((Integer) m_lastLevelStack.peek()).intValue() > m_indentLevel) {
m_lastLevelStack.pop();
}
***************
*** 99,104 ****
/**
! * Increase the indent level by the defaultIndent.
! * Remembers the current indent level for later undenting.
*/
--- 112,117 ----
/**
! * Increase the indent level by the defaultIndent. Remembers the current
! * indent level for later undenting.
*/
***************
*** 120,123 ****
--- 133,137 ----
}
}
+
private void writeIndentIfNeeded() {
if (!m_indented) {
***************
*** 131,134 ****
--- 145,149 ----
/**
* Returns the defaultIndent.
+ *
* @return int
*/
***************
*** 139,143 ****
/**
* Sets the defaultIndent.
! * @param defaultIndent The defaultIndent to set
*/
public void setDefaultIndent(int defaultIndent) {
--- 154,160 ----
/**
* Sets the defaultIndent.
! *
! * @param defaultIndent
! * The defaultIndent to set
*/
public void setDefaultIndent(int defaultIndent) {
***************
*** 265,268 ****
--- 282,286 ----
m_indented = false;
}
+
/**
* @see java.io.PrintWriter#println()
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/