notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1501 - trunk/main/transit/core/src/main/net/dpml/lang
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1501 - trunk/main/transit/core/src/main/net/dpml/lang
- Date: Tue, 6 Jun 2006 14:25:01 +0200
Author: mcconnell
Date: 2006-06-06 14:24:59 +0200 (Tue, 06 Jun 2006)
New Revision: 1501
Modified:
trunk/main/transit/core/src/main/net/dpml/lang/Info.java
trunk/main/transit/core/src/main/net/dpml/lang/Part.java
Log:
update the part info datastructure to allow null titles and descriptions
Modified: trunk/main/transit/core/src/main/net/dpml/lang/Info.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Info.java 2006-06-06
09:03:10 UTC (rev 1500)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Info.java 2006-06-06
12:24:59 UTC (rev 1501)
@@ -27,7 +27,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public final class Info implements Serializable
+public final class Info extends AbstractDirective
{
private final String m_title;
private final String m_description;
@@ -42,22 +42,8 @@
public Info( URI uri, String title, String description )
{
m_uri = uri;
- if( null == title )
- {
- m_title = "Untitled";
- }
- else
- {
- m_title = title;
- }
- if( null == description )
- {
- m_description = "";
- }
- else
- {
- m_description = description;
- }
+ m_title = title;
+ m_description = description;
}
/**
@@ -97,20 +83,20 @@
*/
public boolean equals( Object other )
{
- if( null == other )
+ if( !super.equals( other ) )
{
return false;
}
else if( other instanceof Info )
{
Info info = (Info) other;
- if( !m_title.equals( info.m_title ) )
+ if( !equals( m_title, info.m_title ) )
{
return false;
}
else
{
- return m_description.equals( info.m_description );
+ return equals( m_description, info.m_description );
}
}
else
@@ -125,8 +111,9 @@
*/
public int hashCode()
{
- int hash = m_title.hashCode();
- hash ^= m_description.hashCode();
+ int hash = super.hashCode();
+ hash ^= hashValue( m_title );
+ hash ^= hashValue( m_description );
return hash;
}
}
Modified: trunk/main/transit/core/src/main/net/dpml/lang/Part.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/lang/Part.java 2006-06-06
09:03:10 UTC (rev 1500)
+++ trunk/main/transit/core/src/main/net/dpml/lang/Part.java 2006-06-06
12:24:59 UTC (rev 1501)
@@ -471,11 +471,25 @@
String description = info.getDescription();
if( null == description )
{
- writer.write( "\n <info title=\"" + title + "\"/>" );
+ if( null == title )
+ {
+ writer.write( "\n <info/>" );
+ }
+ else
+ {
+ writer.write( "\n <info title=\"" + title + "\"/>" );
+ }
}
else
{
- writer.write( "\n <info title=\"" + title + "\">" );
+ if( null == title )
+ {
+ writer.write( "\n <info>" );
+ }
+ else
+ {
+ writer.write( "\n <info title=\"" + title + "\">" );
+ }
writer.write( "\n <description>" + description +
"</description>" );
writer.write( "\n </info>" );
}
- r1501 - trunk/main/transit/core/src/main/net/dpml/lang, mcconnell at BerliOS, 06/06/2006
Archive powered by MHonArc 2.6.24.