<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#copied {background-color:#ccccff;}
tr.alt #copied {background-color:#bbbbf7;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="5">Commit in <b><tt>asxsd/trunk/src/main/java/uk/co/badgersinfoil/asxsd</tt></b></td></tr>
<tr><td><tt><a href="#file1"><span id="added">TypeStore.java</span></a></tt> </td><td></td><td align="right" id="added">+63</td><td></td><td nowrap="nowrap" align="right">added 161</td></tr>
</table>
<pre class="comment">
Oops, should have added before
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added">asxsd/trunk/src/main/java/uk/co/badgersinfoil/asxsd</span><br />
<div class="fileheader" id="added"><big><b>TypeStore.java</b></big> <small id="info">added at 161</small></div>
<pre class="diff"><small id="info">--- trunk/src/main/java/uk/co/badgersinfoil/asxsd/TypeStore.java         (rev 0)
+++ trunk/src/main/java/uk/co/badgersinfoil/asxsd/TypeStore.java        2007-10-07 20:26:44 UTC (rev 161)
@@ -0,0 +1,63 @@
</small></pre><pre class="diff" id="added">+package uk.co.badgersinfoil.asxsd;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public class TypeStore {
+        private Map store = new HashMap();
+        
+        public TypeDescriptor get(CodegenRole role,
+         XSDConcreteComponent component)
+        {
+                Key key = new Key(role, component);
+                return (TypeDescriptor)store.get(key);
+        }
+
+        public void put(CodegenRole role,
+         XSDConcreteComponent component,
+         TypeDescriptor typeDesc)
+        {
+                Key key = new Key(role, component);
+                if (store.containsKey(key)) {
+                        throw new IllegalArgumentException("Function already defined for "+role+"+"+component);
+                }
+                store.put(key, typeDesc);
+        }
+
+        private static class Key {
+                private CodegenRole role;
+                private XSDConcreteComponent component;
+                public Key(CodegenRole role, XSDConcreteComponent component) {
+                        this.role = role;
+                        this.component = component;
+                }
+                public int hashCode() {
+                        final int PRIME = 31;
+                        int result = 1;
+                        result = PRIME * result + ((component == null) ? 0 : component.hashCode());
+                        result = PRIME * result + ((role == null) ? 0 : role.hashCode());
+                        return result;
+                }
+                public boolean equals(Object obj) {
+                        if (this == obj)
+                                return true;
+                        if (obj == null)
+                                return false;
+                        if (getClass() != obj.getClass())
+                                return false;
+                        final Key other = (Key) obj;
+                        if (component == null) {
+                                if (other.component != null)
+                                        return false;
+                        } else if (!component.equals(other.component))
+                                return false;
+                        if (role == null) {
+                                if (other.role != null)
+                                        return false;
+                        } else if (!role.equals(other.role))
+                                return false;
+                        return true;
+                }
+        }
+}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.12</small></center>
</body></html>