Source Code Cross Referenced for Table.java in  » Database-Client » Henplus » henplus » sqlmodel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » Henplus » henplus.sqlmodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This is free software, licensed under the Gnu Public License (GPL)
003:         * get a copy from <http://www.gnu.org/licenses/gpl.html>
004:         * @version $Id: Table.java,v 1.5 2004/09/22 11:49:32 magrokosmos Exp $ 
005:         * @author <a href="mailto:martin.grotzke@javakaffee.de">Martin Grotzke</a>
006:         */
007:        package henplus.sqlmodel;
008:
009:        import henplus.util.ListMap;
010:
011:        import java.util.HashSet;
012:        import java.util.Iterator;
013:        import java.util.ListIterator;
014:        import java.util.Set;
015:
016:        public final class Table implements  Comparable {
017:
018:            private String _name;
019:            private ListMap /*<String, Column>*/_columns;
020:
021:            // private PrimaryKey _pk;
022:
023:            // FIXME: add notion of schema.
024:
025:            public Table(String name) {
026:                _name = name;
027:                _columns = new ListMap();
028:            }
029:
030:            public String getName() {
031:                return _name;
032:            }
033:
034:            public void setName(String string) {
035:                _name = string;
036:            }
037:
038:            public void addColumn(Column column) {
039:                _columns.put(column.getName(), column);
040:            }
041:
042:            public ListIterator getColumnIterator() {
043:                ListIterator result = null;
044:                if (_columns != null) {
045:                    result = _columns.valuesListIterator();
046:                }
047:                return result;
048:            }
049:
050:            public Column getColumnByName(String name, boolean ignoreCase) {
051:                Column result = null;
052:                if (_columns != null) {
053:                    result = (Column) _columns.get(name);
054:                    if (result == null && ignoreCase) {
055:                        final Iterator iter = _columns.keysListIterator();
056:                        while (iter.hasNext()) {
057:                            String colName = (String) iter.next();
058:                            if (colName.equalsIgnoreCase(name)) {
059:                                result = (Column) _columns.get(colName);
060:                                break;
061:                            }
062:                        }
063:                    }
064:                }
065:                return result;
066:            }
067:
068:            /**
069:             * @return <code>true</code>, if this <code>Table</code> has any foreign key, otherwise <code>false</code>.
070:             */
071:            public boolean hasForeignKeys() {
072:                return getForeignKeys() != null;
073:            }
074:
075:            /**
076:             * @return A <code>Set</code> of <code>ColumnFkInfo</code> objects or <code>null</code>.
077:             */
078:            public Set/*<ColumnFkInfo>*/getForeignKeys() {
079:                Set result = null;
080:
081:                if (_columns != null) {
082:                    final Iterator iter = _columns.values().iterator();
083:                    while (iter.hasNext()) {
084:                        Column c = (Column) iter.next();
085:                        if (c.getFkInfo() != null) {
086:                            if (result == null)
087:                                result = new HashSet();
088:                            result.add(c.getFkInfo());
089:                        }
090:                    }
091:                }
092:
093:                return result;
094:            }
095:
096:            /* (non-Javadoc)
097:             * @see java.lang.Object#toString()
098:             */
099:            public String toString() {
100:                return _name;
101:            }
102:
103:            public int hashCode() {
104:                return _name.hashCode();
105:            }
106:
107:            /* (non-Javadoc)
108:             * @see java.lang.Object#equals(java.lang.Object)
109:             */
110:            public boolean equals(Object other) {
111:                boolean result = false;
112:
113:                if (other == this )
114:                    result = true;
115:
116:                else if (other instanceof  Table) {
117:                    Table o = (Table) other;
118:
119:                    if (_name != null && _name.equals(o.getName()))
120:                        result = true;
121:
122:                    else if (_name == null && o.getName() == null)
123:                        result = true;
124:                }
125:
126:                return result;
127:            }
128:
129:            /* (non-Javadoc)
130:             * @see java.lang.Comparable#compareTo(java.lang.Object)
131:             */
132:            public int compareTo(Object other) {
133:                int result = 0;
134:                if (other instanceof  Table) {
135:                    Table o = (Table) other;
136:                    result = _name.compareTo(o.getName());
137:                }
138:                return result;
139:            }
140:
141:            /*
142:            public boolean columnIsPartOfPk(String column) {
143:                boolean result = false;
144:                if (_pk != null) {
145:                    result = _pk.columnParticipates(column);
146:                }
147:                return result;
148:            }
149:             */
150:
151:            /**
152:             * @return
153:             */
154:            /*
155:            public PrimaryKey getPk() {
156:                return _pk;
157:            }
158:             */
159:
160:            /**
161:             * @param key
162:             */
163:            /*
164:            public void setPk(PrimaryKey key) {
165:                _pk = key;
166:            }
167:             */
168:
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.