diff --git a/Diff_java_projects/simple-java-crud-app-master/.classpath b/Diff_java_projects/simple-java-crud-app-master/.classpath
new file mode 100644
index 0000000..15145c7
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Diff_java_projects/simple-java-crud-app-master/.project b/Diff_java_projects/simple-java-crud-app-master/.project
new file mode 100644
index 0000000..f0d9082
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/.project
@@ -0,0 +1,17 @@
+
+
+ Swing26 - Tables
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Diff_java_projects/simple-java-crud-app-master/README.md b/Diff_java_projects/simple-java-crud-app-master/README.md
new file mode 100644
index 0000000..f676366
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/README.md
@@ -0,0 +1,14 @@
+# Java CRUD App
+Simple java business application with CRUD functional made for university course.
+
+## `Note!`As it project became much visible somehow I strongly encourage to use provided code on your own risk. It is very dirty and hacky!
+
+To run it you need to have
+- Eclipse IDE (J2EE) **preferred**
+
+ *or you need to install `JDK` on your own.*
+- MySQL pre-installed
+- some MySQL UI ( I used MySql Workbench )
+- mysql-connector
+
+also i used `weblaf` swing look and feel.
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/TestDatabase.class b/Diff_java_projects/simple-java-crud-app-master/bin/TestDatabase.class
new file mode 100644
index 0000000..9979328
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/TestDatabase.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/controller/Controller.class b/Diff_java_projects/simple-java-crud-app-master/bin/controller/Controller.class
new file mode 100644
index 0000000..9621d41
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/controller/Controller.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/AgeCategory.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/AgeCategory.class
new file mode 100644
index 0000000..09a1ce6
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/AgeCategory.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/App$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App$1.class
new file mode 100644
index 0000000..776a171
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App$1.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/App.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App.class
new file mode 100644
index 0000000..b8630a5
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/App.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor$1.class
new file mode 100644
index 0000000..5f8e808
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor$1.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor.class
new file mode 100644
index 0000000..d3697a4
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryEditor.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryRenderer.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryRenderer.class
new file mode 100644
index 0000000..3cbb53f
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/EmploymentCategoryRenderer.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormEvent.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormEvent.class
new file mode 100644
index 0000000..f6b031f
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormEvent.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormListener.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormListener.class
new file mode 100644
index 0000000..56cdfc8
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormListener.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$1.class
new file mode 100644
index 0000000..3752ffd
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$1.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$2.class
new file mode 100644
index 0000000..b86f840
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel$2.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel.class
new file mode 100644
index 0000000..958afc4
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/FormPanel.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/IconRenderer.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/IconRenderer.class
new file mode 100644
index 0000000..d14577a
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/IconRenderer.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$1.class
new file mode 100644
index 0000000..7ff5e69
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$1.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$10.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$10.class
new file mode 100644
index 0000000..46a6c1d
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$10.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$11.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$11.class
new file mode 100644
index 0000000..139e82f
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$11.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$12.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$12.class
new file mode 100644
index 0000000..5da5d3c
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$12.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$13.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$13.class
new file mode 100644
index 0000000..db7b782
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$13.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$14.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$14.class
new file mode 100644
index 0000000..91157fd
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$14.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$15.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$15.class
new file mode 100644
index 0000000..44ef5d9
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$15.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$2.class
new file mode 100644
index 0000000..6eebe9a
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$2.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$3.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$3.class
new file mode 100644
index 0000000..a3c436e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$3.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$4.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$4.class
new file mode 100644
index 0000000..654d19d
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$4.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$5.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$5.class
new file mode 100644
index 0000000..5d299d2
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$5.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$6.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$6.class
new file mode 100644
index 0000000..1b287f3
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$6.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$7.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$7.class
new file mode 100644
index 0000000..586121e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$7.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$8.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$8.class
new file mode 100644
index 0000000..5b95d4b
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$8.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$9.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$9.class
new file mode 100644
index 0000000..652bb43
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame$9.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame.class
new file mode 100644
index 0000000..100f0a8
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/MainFrame.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonFileFilter.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonFileFilter.class
new file mode 100644
index 0000000..a7bca58
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonFileFilter.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableListener.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableListener.class
new file mode 100644
index 0000000..5c99b0d
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableListener.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableModel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableModel.class
new file mode 100644
index 0000000..2c44977
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/PersonTableModel.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$1.class
new file mode 100644
index 0000000..3790977
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$1.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$2.class
new file mode 100644
index 0000000..6939e2c
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$2.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$3.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$3.class
new file mode 100644
index 0000000..ddf05ad
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel$3.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel.class
new file mode 100644
index 0000000..8f5d1d3
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TablePanel.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel.class
new file mode 100644
index 0000000..a8f9243
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2$1.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2$1.class
new file mode 100644
index 0000000..edd9196
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2$1.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2.class
new file mode 100644
index 0000000..defe669
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/TextPanel2.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/Toolbar.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Toolbar.class
new file mode 100644
index 0000000..a7f12e9
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Toolbar.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/ToolbarListener.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/ToolbarListener.class
new file mode 100644
index 0000000..e6b3513
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/ToolbarListener.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/gui/Utils.class b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Utils.class
new file mode 100644
index 0000000..fcf2227
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/gui/Utils.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444437_save_accept.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444437_save_accept.png
new file mode 100644
index 0000000..48ae6ff
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444437_save_accept.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444440_Save.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444440_Save.png
new file mode 100644
index 0000000..030a28e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444440_Save.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444542_save_16.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444542_save_16.png
new file mode 100644
index 0000000..cd0162b
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444542_save_16.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444547_document-save.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444547_document-save.png
new file mode 100644
index 0000000..bf10639
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444547_document-save.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444559_view-refresh.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444559_view-refresh.png
new file mode 100644
index 0000000..cf70ceb
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444559_view-refresh.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444563_Synchronize.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444563_Synchronize.png
new file mode 100644
index 0000000..01dc229
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444563_Synchronize.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444569_gtk-refresh.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444569_gtk-refresh.png
new file mode 100644
index 0000000..dc14406
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444569_gtk-refresh.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444586_import.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444586_import.png
new file mode 100644
index 0000000..e4703e9
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444586_import.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444602_table-export.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444602_table-export.png
new file mode 100644
index 0000000..f582fb8
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444602_table-export.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444918_application_view_xp_terminal.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444918_application_view_xp_terminal.png
new file mode 100644
index 0000000..c98e419
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400444918_application_view_xp_terminal.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445120_Error.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445120_Error.png
new file mode 100644
index 0000000..0d6d934
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445120_Error.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445243_text_horizontalrule.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445243_text_horizontalrule.png
new file mode 100644
index 0000000..3e70c65
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445243_text_horizontalrule.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445397_accept.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445397_accept.png
new file mode 100644
index 0000000..68f638a
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445397_accept.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445557_Windows_16x16.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445557_Windows_16x16.png
new file mode 100644
index 0000000..3fd4321
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445557_Windows_16x16.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445676_Help.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445676_Help.png
new file mode 100644
index 0000000..0bd60db
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400445676_Help.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400446085_Table_16x16.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400446085_Table_16x16.png
new file mode 100644
index 0000000..4fe7dff
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400446085_Table_16x16.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400447294_1.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400447294_1.png
new file mode 100644
index 0000000..c67d6f1
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400447294_1.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400462129_cart_add.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400462129_cart_add.png
new file mode 100644
index 0000000..bc402b1
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400462129_cart_add.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/1400956144_gear__plus.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400956144_gear__plus.png
new file mode 100644
index 0000000..bc4cd9e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/1400956144_gear__plus.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/Refresh16.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/Refresh16.gif
new file mode 100644
index 0000000..cf7cea3
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/Refresh16.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/Save16.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/Save16.gif
new file mode 100644
index 0000000..954f1ac
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/Save16.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/Server16.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/Server16.gif
new file mode 100644
index 0000000..4e76682
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/Server16.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/car.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/car.png
new file mode 100644
index 0000000..cb18738
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/car.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/gear.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/gear.png
new file mode 100644
index 0000000..bc4cd9e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/gear.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/import1.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/import1.png
new file mode 100644
index 0000000..ff10bad
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/import1.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/notepad.gif b/Diff_java_projects/simple-java-crud-app-master/bin/images/notepad.gif
new file mode 100644
index 0000000..074a105
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/notepad.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/price.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/price.png
new file mode 100644
index 0000000..ff76611
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/price.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/images/ware.png b/Diff_java_projects/simple-java-crud-app-master/bin/images/ware.png
new file mode 100644
index 0000000..db17c45
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/images/ware.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/AgeCategory.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/AgeCategory.class
new file mode 100644
index 0000000..f611783
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/AgeCategory.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/Database.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/Database.class
new file mode 100644
index 0000000..574dba0
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/Database.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/EmploymentCategory.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/EmploymentCategory.class
new file mode 100644
index 0000000..672108c
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/EmploymentCategory.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/Gender.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/Gender.class
new file mode 100644
index 0000000..67e682c
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/Gender.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/bin/model/Person.class b/Diff_java_projects/simple-java-crud-app-master/bin/model/Person.class
new file mode 100644
index 0000000..9e30802
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/bin/model/Person.class differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/TestDatabase.java b/Diff_java_projects/simple-java-crud-app-master/src/TestDatabase.java
new file mode 100644
index 0000000..d435e64
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/TestDatabase.java
@@ -0,0 +1,49 @@
+import java.sql.SQLException;
+
+import model.AgeCategory;
+import model.Database;
+import model.EmploymentCategory;
+import model.Gender;
+import model.Person;
+
+
+public class TestDatabase {
+
+ public static void main(String[] args)
+ {
+
+
+ System.out.println("Running database test");
+
+ Database db = new Database();
+ try {
+ db.connect();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ db.addPerson(new Person("Joe222","sdsdsdsd",AgeCategory.Nissan,EmploymentCategory.sklad,"2323",false,Gender.no));
+ db.addPerson(new Person("Joe222","sdsdsdsd",AgeCategory.Nissan,EmploymentCategory.sklad,"2323",false,Gender.no));
+ db.addPerson(new Person("Suzana","sdssdsdsdd",AgeCategory.Nissan,EmploymentCategory.sklad,"43",true,Gender.no));
+ db.addPerson(new Person("qwqw","sd12dd",AgeCategory.Mazda,EmploymentCategory.no,"43",true,Gender.yes));
+ db.addPerson(new Person("qwqw","sd12dd",AgeCategory.Mazda,EmploymentCategory.no,"43",true,Gender.yes));
+ db.addPerson(new Person("qwasasqw","sd12dd",AgeCategory.Mazda,EmploymentCategory.no,"43",true,Gender.yes));
+
+ try {
+ db.save();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ try {
+ db.load();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ db.disconnect();
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/controller/Controller.java b/Diff_java_projects/simple-java-crud-app-master/src/controller/Controller.java
new file mode 100644
index 0000000..3e170b4
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/controller/Controller.java
@@ -0,0 +1,119 @@
+package controller;
+
+import gui.FormEvent;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.List;
+
+import model.AgeCategory;
+import model.Database;
+import model.EmploymentCategory;
+import model.Gender;
+import model.Person;
+
+public class Controller {
+ Database db = new Database();
+
+ public List getPeople() {
+ return db.getPeople();
+ }
+
+ public void save() throws SQLException
+ {
+ db.save();
+ }
+
+ public void load() throws SQLException
+ {
+ db.load();
+ }
+ public void connect() throws Exception
+ {
+ db.connect();
+ }
+
+ public void disconnect()
+ {
+ db.disconnect();
+ }
+
+
+
+ public void addPerson(FormEvent ev) {
+ String name = ev.getName();
+ String occupation = ev.getOccupation();
+ int ageCatId = ev.getAgeCategory();
+ String empCat = ev.getEmploymentCategory();
+ boolean isUs = ev.isUsCitizen();
+ String taxId = ev.getTaxId();
+ String gender = ev.getGender();
+
+ AgeCategory ageCategory = null;
+
+ switch(ageCatId) {
+ case 0:
+ ageCategory = AgeCategory.Nissan;
+ break;
+ case 1:
+ ageCategory = AgeCategory.Mazda;
+ break;
+ case 2:
+ ageCategory = AgeCategory.Land_Rover;
+ break;
+ case 3:
+ ageCategory = AgeCategory.Lada;
+ break;
+ case 4:
+ ageCategory = AgeCategory.Honda;
+ break;
+
+ }
+
+
+ EmploymentCategory empCategory;
+
+ if(empCat.equals("����")) {
+ empCategory = EmploymentCategory.yes;
+ }
+ else if(empCat.equals("���")) {
+ empCategory = EmploymentCategory.no;
+ }
+ else if(empCat.equals("�����")) {
+ empCategory = EmploymentCategory.sklad;
+ }
+ else {
+ empCategory = EmploymentCategory.other;
+ System.err.println(empCat);
+ }
+
+ Gender genderCat;
+
+ if(gender.equals("yes")) {
+ genderCat = Gender.yes;
+ }
+ else {
+ genderCat = Gender.no;
+ }
+
+ Person person = new Person(name, occupation, ageCategory, empCategory,
+ taxId, isUs, genderCat);
+
+ db.addPerson(person);
+ }
+ public void removePerson(int index)
+ {
+ db.removePerson(index);
+ }
+
+ public void saveToFile(File file) throws IOException
+ {
+ db.saveToFile(file);
+ }
+ public void loadFromFile(File file) throws IOException
+ {
+ db.loadFromFile(file);
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/App.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/App.java
new file mode 100644
index 0000000..e14800b
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/App.java
@@ -0,0 +1,15 @@
+package gui;
+import javax.swing.SwingUtilities;
+
+public class App {
+
+ public static void main(String[] args) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ new MainFrame();
+ }
+ });
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryEditor.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryEditor.java
new file mode 100644
index 0000000..1d6be40
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryEditor.java
@@ -0,0 +1,59 @@
+package gui;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.EventObject;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.TableCellEditor;
+
+import model.EmploymentCategory;
+
+public class EmploymentCategoryEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private JComboBox combo;
+
+ public EmploymentCategoryEditor()
+ {
+ combo = new JComboBox(EmploymentCategory.values());
+ }
+ @Override
+ public boolean isCellEditable(EventObject e) {
+
+ return true;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ // TODO Auto-generated method stub
+ return combo.getSelectedItem();
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+
+
+ combo.setSelectedItem(value);
+
+ combo.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ fireEditingStopped();
+
+ }
+
+ });
+
+
+ return combo;
+ }
+
+
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryRenderer.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryRenderer.java
new file mode 100644
index 0000000..2d5a2e5
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/EmploymentCategoryRenderer.java
@@ -0,0 +1,27 @@
+package gui;
+
+import java.awt.Component;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.TableCellRenderer;
+
+import model.EmploymentCategory;
+
+public class EmploymentCategoryRenderer implements TableCellRenderer {
+
+ private JComboBox combo;
+
+ public EmploymentCategoryRenderer() {
+ combo = new JComboBox(EmploymentCategory.values());
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column) {
+
+ combo.setSelectedItem(value);
+ return combo;
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/FormEvent.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormEvent.java
new file mode 100644
index 0000000..ff8639f
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormEvent.java
@@ -0,0 +1,69 @@
+package gui;
+import java.awt.event.KeyEvent;
+import java.util.EventObject;
+
+public class FormEvent extends EventObject {
+
+ private String name;
+ private String occupation;
+ private int ageCategory;
+ private String empCat;
+ private String taxId;
+ private boolean usCitizen;
+ private String gender;
+
+ public FormEvent(Object source) {
+ super(source);
+ }
+
+ public FormEvent(Object source, String name, String occupation, int ageCat,
+ String empCat, String taxId, boolean usCitizen, String gender) {
+ super(source);
+
+ this.name = name;
+ this.occupation = occupation;
+ this.ageCategory = ageCat;
+ this.empCat = empCat;
+ this.taxId = taxId;
+ this.usCitizen = usCitizen;
+ this.gender = gender;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public String getTaxId() {
+ return taxId;
+ }
+
+ public boolean isUsCitizen() {
+ return usCitizen;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOccupation() {
+ return occupation;
+ }
+
+ public void setOccupation(String occupation) {
+ this.occupation = occupation;
+ }
+
+ public int getAgeCategory() {
+ return ageCategory;
+ }
+
+ public String getEmploymentCategory() {
+ return empCat;
+ }
+
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/FormListener.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormListener.java
new file mode 100644
index 0000000..b460112
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormListener.java
@@ -0,0 +1,6 @@
+package gui;
+import java.util.EventListener;
+
+public interface FormListener extends EventListener {
+ public void formEventOccurred(FormEvent e);
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/FormPanel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormPanel.java
new file mode 100644
index 0000000..4e08532
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/FormPanel.java
@@ -0,0 +1,368 @@
+package gui;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.net.URL;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListModel;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.border.Border;
+import javax.swing.text.TabExpander;
+
+public class FormPanel extends JPanel {
+
+ private JLabel nameLabel;
+ private JLabel imageChooseLabel;
+ private JLabel occupationLabel;
+ private JTextField nameField;
+ private JTextField imageChooseFieldd;
+ private JTextField occupationField;
+ private JButton okBtn;
+ private FormListener formListener;
+ private JList ageList;
+ private JComboBox empCombo;
+ private JCheckBox citizenCheck;
+ private JTextField taxField;
+ private JLabel taxLabel;
+
+
+
+ private JRadioButton maleRadio;
+ private JRadioButton femaleRadio;
+ private ButtonGroup genderGroup;
+
+ public FormPanel() {
+ Dimension dim = getPreferredSize();
+ dim.width = 290;
+ setPreferredSize(dim);
+
+ nameLabel = new JLabel("��������: ");
+ nameLabel.setIcon(createIcon("/images/gear.png"));
+
+ imageChooseLabel = new JLabel("�����������: ");
+ occupationLabel = new JLabel("����: ");
+ occupationLabel.setIcon(createIcon("/images/price.png"));
+ nameField = new JTextField(10);
+ imageChooseFieldd = new JTextField(10);
+ occupationField = new JTextField(10);
+ ageList = new JList();
+ empCombo = new JComboBox();
+ citizenCheck = new JCheckBox();
+ taxField = new JTextField(10);
+ taxLabel = new JLabel("���: ");
+ okBtn = new JButton("OK");
+ okBtn.setIcon(createIcon("/images/1400445397_accept.png"));
+
+
+ // Set up mnemomics
+ okBtn.setMnemonic(KeyEvent.VK_O);
+
+ nameLabel.setDisplayedMnemonic(KeyEvent.VK_N);
+ nameLabel.setLabelFor(nameField);
+
+ maleRadio = new JRadioButton("����������������");
+ femaleRadio = new JRadioButton("������������������");
+
+ maleRadio.setActionCommand("����������������");
+ femaleRadio.setActionCommand("������������������");
+
+ genderGroup = new ButtonGroup();
+
+ maleRadio.setSelected(true);
+
+ // Set up gender radios
+ genderGroup.add(maleRadio);
+ genderGroup.add(femaleRadio);
+
+ // Set up tax ID
+ taxLabel.setEnabled(false);
+ taxField.setEnabled(false);
+
+ citizenCheck.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ boolean isTicked = citizenCheck.isSelected();
+ taxLabel.setEnabled(isTicked);
+ taxField.setEnabled(isTicked);
+ }
+ });
+
+ // Set up list box
+ DefaultListModel ageModel = new DefaultListModel();
+ ageModel.addElement(new AgeCategory(0, "Nissan"));
+ ageModel.addElement(new AgeCategory(1, "Mazda"));
+ ageModel.addElement(new AgeCategory(2, "Land Rover"));
+ ageModel.addElement(new AgeCategory(3, "Lada"));
+ ageModel.addElement(new AgeCategory(4, "Honda"));
+
+ ageList.setModel(ageModel);
+
+ ageList.setPreferredSize(new Dimension(120, 120));
+ ageList.setBorder(BorderFactory.createEtchedBorder());
+ ageList.setSelectedIndex(1);
+
+ // Set up combo box.
+ DefaultComboBoxModel empModel = new DefaultComboBoxModel();
+ empModel.addElement("����");
+ empModel.addElement("���");
+ empModel.addElement("�����");
+ empCombo.setModel(empModel);
+ empCombo.setSelectedIndex(0);
+ empCombo.setEditable(true);
+
+
+ okBtn.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ String name = nameField.getText();
+ String occupation = occupationField.getText();
+ AgeCategory ageCat = (AgeCategory) ageList.getSelectedValue();
+ String empCat = (String) empCombo.getSelectedItem();
+ String taxId = taxField.getText();
+ boolean usCitizen = citizenCheck.isSelected();
+
+ String gender = genderGroup.getSelection().getActionCommand();
+
+ FormEvent ev = new FormEvent(this, name, occupation, ageCat
+ .getId(), empCat, taxId, usCitizen, gender);
+
+ if (formListener != null) {
+ formListener.formEventOccurred(ev);
+ }
+ }
+ });
+
+ Border innerBorder = BorderFactory.createTitledBorder("�������� ��������");
+
+ Border outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
+ setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder));
+
+ layoutComponents();
+ }
+ private ImageIcon createIcon(String path)
+ {
+ URL url = getClass().getResource(path);
+
+ if(url == null)
+ {
+ System.err.println("Unabled to load image"+path);
+ }
+
+ ImageIcon icon = new ImageIcon(url);
+
+ return icon;
+ }
+
+ public void layoutComponents() {
+
+ setLayout(new GridBagLayout());
+
+ GridBagConstraints gc = new GridBagConstraints();
+
+ // ////////// First row ///////////////////////////////////
+
+ gc.gridy = 0;
+
+ gc.weightx = 1;
+ gc.weighty = 0.1;
+
+ gc.gridx = 0;
+ gc.fill = GridBagConstraints.NONE;
+ gc.anchor = GridBagConstraints.LINE_END;
+ gc.insets = new Insets(0, 0, 0, 5);
+ add(nameLabel, gc);
+
+ gc.gridx = 1;
+ gc.gridy = 0;
+ gc.insets = new Insets(0, 0, 0, 0);
+ gc.anchor = GridBagConstraints.LINE_START;
+ add(nameField, gc);
+
+ // //////////Second row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.1;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(0, 0, 0, 5);
+ gc.anchor = GridBagConstraints.LINE_END;
+ add(occupationLabel, gc);
+
+ gc.gridx = 1;
+ gc.insets = new Insets(0, 0, 0, 0);
+ gc.anchor = GridBagConstraints.LINE_START;
+ add(occupationField, gc);
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.2;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(5, 0, 0, 5);
+ gc.anchor = GridBagConstraints.FIRST_LINE_END;
+
+ JLabel carLabel = new JLabel("�����: ");
+ carLabel.setIcon(createIcon("/images/car.png"));
+ add(carLabel, gc);
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(5, 0, 0, 0);
+ add(ageList, gc);
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.2;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(0, 0, 0, 5);
+ gc.anchor = GridBagConstraints.FIRST_LINE_END;
+ JLabel warLabel = new JLabel("�������: ");
+ warLabel.setIcon(createIcon("/images/ware.png"));
+ add(warLabel, gc);
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(0, 0, 0, 0);
+ add(empCombo, gc);
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.2;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(0, 0, 0, 5);
+ gc.anchor = GridBagConstraints.FIRST_LINE_END;
+ JLabel iconLabel = new JLabel("������: ");
+ add(iconLabel, gc);
+ iconLabel.setIcon(createIcon("/images/import1.png"));
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(0, 0, 0, 0);
+ add(citizenCheck, gc);
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.2;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(0, 0, 0, 5);
+ gc.anchor = GridBagConstraints.FIRST_LINE_END;
+ add(taxLabel, gc);
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(0, 0, 0, 0);
+ add(taxField, gc);
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.05;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(0, 0, 0, 5);
+ gc.anchor = GridBagConstraints.LINE_END;
+ add(new JLabel("��������: "), gc);
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(0, 0, 0, 0);
+ add(maleRadio, gc);
+
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.2;
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(0, 0, 0, 0);
+ add(femaleRadio, gc);
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 0.2;
+
+ gc.gridx = 0;
+ gc.insets = new Insets(5, 0, 0, 5);
+ gc.anchor = GridBagConstraints.FIRST_LINE_END;
+ add(imageChooseLabel, gc);
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(5, 0, 0, 0);
+ add(imageChooseFieldd, gc);
+
+
+ // //////////Next row ///////////////////////////////////
+
+ gc.gridy++;
+
+ gc.weightx = 1;
+ gc.weighty = 2.0;
+
+ gc.gridx = 1;
+ gc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gc.insets = new Insets(5, 0, 0, 0);
+ add(okBtn, gc);
+ }
+
+ public void setFormListener(FormListener listener) {
+ this.formListener = listener;
+ }
+}
+
+class AgeCategory {
+ private int id;
+ private String text;
+
+ public AgeCategory(int id, String text) {
+ this.id = id;
+ this.text = text;
+ }
+
+ public String toString() {
+ return text;
+ }
+
+ public int getId() {
+ return id;
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/IconRenderer.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/IconRenderer.java
new file mode 100644
index 0000000..31d3eae
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/IconRenderer.java
@@ -0,0 +1,38 @@
+package gui;
+
+import java.net.URL;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.table.DefaultTableCellRenderer;
+
+public class IconRenderer extends DefaultTableCellRenderer {
+ public IconRenderer() { super(); }
+
+ public void setValue(String value) {
+ if (value == null) {
+ setText("");
+ }
+ else
+ {
+
+ setIcon(createIcon(value));
+ }
+ }
+
+
+
+ private ImageIcon createIcon(String path)
+ {
+ URL url = getClass().getResource(path);
+
+ if(url == null)
+ {
+ System.err.println("Unabled to load image"+path);
+ }
+
+ ImageIcon icon = new ImageIcon(url);
+
+ return icon;
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/MainFrame.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/MainFrame.java
new file mode 100644
index 0000000..be0a02c
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/MainFrame.java
@@ -0,0 +1,479 @@
+package gui;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.IOException;
+import java.net.URL;
+import java.sql.SQLException;
+
+import javax.swing.ImageIcon;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.JTabbedPane;
+import javax.swing.KeyStroke;
+import javax.swing.UIManager;
+
+import com.alee.laf.WebLookAndFeel;
+
+import controller.Controller;
+
+public class MainFrame extends JFrame {
+
+
+ private static final long serialVersionUID = -7906808792207756237L;
+ private TextPanel textPanel;
+ private TextPanel textPanel2;
+ private TextPanel2 textPanel3;
+ private TextPanel2 textPanel4;
+ private Toolbar toolbar;
+ private FormPanel formPanel;
+ private JFileChooser fileChooser;
+ private Controller controller;
+ private TablePanel tablePanel;
+ private JTabbedPane tabbedPane;
+ private JTabbedPane tabbedPane2;
+ private JPopupMenu popup;
+
+ private int pos = 2;
+ private int number = 2;
+
+
+ public MainFrame() {
+
+ super("Course work");
+
+
+
+ try
+ {
+ // Setting up WebLookAndFeel style
+ UIManager.setLookAndFeel ( WebLookAndFeel.class.getCanonicalName () );
+ }
+ catch ( Throwable e )
+ {
+ // Something went wrong
+ }
+
+
+
+
+ setLayout(new BorderLayout());
+
+
+
+ toolbar = new Toolbar();
+
+ formPanel = new FormPanel();
+ tablePanel = new TablePanel();
+
+ popup = new JPopupMenu();
+
+
+ JMenuItem removeItem = new JMenuItem("�������");
+ popup.add(removeItem);
+
+
+ removeItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+
+ CloseLastText();
+
+ }
+
+ });
+
+ tabbedPane2 = new JTabbedPane();
+ tabbedPane = new JTabbedPane();
+
+ getContentPane().add(tabbedPane);
+ getContentPane().add(tabbedPane);
+
+ textPanel = new TextPanel();
+ textPanel2 = new TextPanel();
+ textPanel3 = new TextPanel2();
+ textPanel4 = new TextPanel2();
+
+
+ tabbedPane.addTab(" Console " , textPanel);
+ tabbedPane.addTab(" Errors " , textPanel2);
+ tabbedPane.addTab(" Messages " , textPanel3);
+ tabbedPane.setIconAt(0, createIcon("/images/1400444918_application_view_xp_terminal.png"));
+ tabbedPane.setIconAt(1, createIcon("/images/1400445120_Error.png"));
+ tabbedPane.setIconAt(2, createIcon("/images/1400445243_text_horizontalrule.png"));
+
+
+ tabbedPane2.addTab(" ������ ", tablePanel);
+ tabbedPane2.addTab(" ������� ", textPanel4);
+ tabbedPane2.setIconAt(0, createIcon("/images/1400446085_Table_16x16.png"));
+ tabbedPane2.setIconAt(1, createIcon("/images/notepad.gif"));
+
+ tabbedPane2.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e) {
+
+
+
+
+ if(e.getButton() == MouseEvent.BUTTON3 )
+ {
+ popup.show(tabbedPane2, e.getX(), e.getY());
+
+ }
+
+ }
+
+ });
+
+ textPanel4.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e) {
+
+
+
+
+ if(e.getButton() == MouseEvent.BUTTON3 )
+ {
+ popup.show(tabbedPane2, e.getX(), e.getY());
+
+ }
+
+ }
+
+ });
+
+
+ controller = new Controller();
+
+ tablePanel.setData(controller.getPeople());
+ tablePanel.setPersonTableListener(new PersonTableListener()
+ {
+ public void rowDeleted(int row)
+ {
+ controller.removePerson(row);
+ }
+
+ });
+
+
+ fileChooser = new JFileChooser();
+
+ fileChooser.addChoosableFileFilter(new PersonFileFilter());
+
+ setJMenuBar(createMenuBar());
+
+
+ addFormEvent();
+
+ textPanel3.AddKeyListenerRevelance(new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ if(textPanel3.getTextContains("%CLEAR%"))
+ {
+
+ textPanel3.DeleteText();
+ textPanel.appendText("Messages window is clear");
+ System.out.println("OK");
+
+
+ }
+ else
+ {
+ System.out.println("������ ����");
+ }
+ }
+ else
+ {
+
+ }
+ }
+ });
+
+ textPanel3.AddKeyListenerRevelance(new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ if(textPanel3.getTextContains("%NEW_TPANEL%"))
+ {
+
+ textPanel3.DeleteText();
+ CreateNewTable(new TextPanel2());
+
+ textPanel.appendText("New text panel created...");
+
+
+ }
+ else
+ {
+ System.out.println("������ ����");
+ }
+ }
+ else
+ {
+
+ }
+ }
+ });
+
+ toolbar.setToolbarListener(new ToolbarListener() {
+ public void saveEventOccured() {
+
+
+ connect();
+
+
+ try {
+ controller.connect();
+ } catch (Exception e) {
+
+ JOptionPane.showMessageDialog(MainFrame.this, "Can not connect to database","Database connection problems",JOptionPane.ERROR_MESSAGE);
+ }
+ try {
+ controller.save();
+ } catch (SQLException e) {
+
+ JOptionPane.showMessageDialog(MainFrame.this, "Can not connect to database","Database connection problems",JOptionPane.ERROR_MESSAGE);
+ }
+
+ textPanel.appendText("Added to database\n");
+
+
+ }
+
+ public void refreshEventOccured() {
+
+ connect();
+ try {
+ controller.load();
+ } catch (SQLException e) {
+ JOptionPane.showMessageDialog(MainFrame.this, "Are refresh", "Refreshing progress", JOptionPane.ERROR_MESSAGE);
+ }
+ tablePanel.refresh();
+ textPanel.appendText("Database is refreshed\n");
+ }
+ });
+
+ ///////////////////////////////
+
+
+ add(formPanel, BorderLayout.WEST);
+ add(toolbar, BorderLayout.NORTH);
+ add(tabbedPane2, BorderLayout.CENTER);
+ add(tabbedPane, BorderLayout.SOUTH);
+
+
+ setMinimumSize(new Dimension(600, 550));
+ setSize(800, 650);
+
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setVisible(true);
+ refresh();
+ }
+ private void connect()
+ {
+ try {
+ controller.connect();
+ } catch (Exception e) {
+
+ JOptionPane.showMessageDialog(MainFrame.this, "Can not connect to database","Database connection problems",JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ private void refresh()
+ {
+ connect();
+ try {
+ controller.load();
+ } catch (SQLException e) {
+ JOptionPane.showMessageDialog(MainFrame.this, "Are refresh", "Refreshing progress", JOptionPane.ERROR_MESSAGE);
+ }
+ tablePanel.refresh();
+ }
+
+ private JMenuBar createMenuBar() {
+ JMenuBar menuBar = new JMenuBar();
+
+ JMenu fileMenu = new JMenu("File");
+ JMenuItem exportDataItem = new JMenuItem("Export Data...");
+ JMenuItem importDataItem = new JMenuItem("Import Data...");
+ JMenuItem exitItem = new JMenuItem("Exit");
+
+ exportDataItem.setIcon(createIcon("/images/1400444602_table-export.png"));
+ importDataItem.setIcon(createIcon("/images/1400444586_import.png"));
+
+ fileMenu.add(exportDataItem);
+ fileMenu.add(importDataItem);
+ fileMenu.addSeparator();
+ fileMenu.add(exitItem);
+
+ JMenu paramMenu = new JMenu("������");
+ JMenuItem aboutItem = new JMenuItem("� ���������");
+ aboutItem.setIcon(createIcon("/images/1400445676_Help.png"));
+ JMenuItem licenseItem = new JMenuItem("License");
+
+ paramMenu.add(aboutItem);
+ paramMenu.add(licenseItem);
+
+ aboutItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+
+
+ JOptionPane.showMessageDialog(MainFrame.this, "Created by KN NTU","� ���������",1);
+
+
+
+ }
+
+ });
+
+
+
+ JMenu windowMenu = new JMenu("Window");
+
+ JMenu showMenu = new JMenu("Show");
+
+ JCheckBoxMenuItem showFormItem = new JCheckBoxMenuItem("Add detail");
+ showFormItem.setIcon(createIcon("/images/1400445557_Windows_16x16.png"));
+ JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem("Console");
+ showConsole.setIcon(createIcon("/images/1400445557_Windows_16x16.png"));
+ showFormItem.setSelected(true);
+ showConsole.setSelected(true);
+
+ showMenu.add(showFormItem);
+ showMenu.add(showConsole);
+ windowMenu.add(showMenu);
+
+ menuBar.add(fileMenu);
+ menuBar.add(windowMenu);
+ menuBar.add(paramMenu);
+
+ showFormItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ev) {
+ JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ev.getSource();
+
+ formPanel.setVisible(menuItem.isSelected());
+ }
+ });
+ showConsole.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ev) {
+ JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ev.getSource();
+
+ tabbedPane.setVisible(menuItem.isSelected());
+ }
+ });
+
+ fileMenu.setMnemonic(KeyEvent.VK_F);
+ exitItem.setMnemonic(KeyEvent.VK_X);
+
+ exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
+ ActionEvent.CTRL_MASK));
+
+ importDataItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(fileChooser.showOpenDialog(MainFrame.this) == JFileChooser.APPROVE_OPTION) {
+ try {
+ controller.loadFromFile(fileChooser.getSelectedFile());
+ tablePanel.refresh();
+ } catch (IOException e1) {
+
+ JOptionPane.showMessageDialog(MainFrame.this, "Failed load","Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+ }
+ }
+ });
+
+ exportDataItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(fileChooser.showSaveDialog(MainFrame.this) == JFileChooser.APPROVE_OPTION) {
+
+ try {
+ controller.saveToFile(fileChooser.getSelectedFile());
+ tablePanel.refresh();
+ } catch (IOException e1) {
+
+ JOptionPane.showMessageDialog(MainFrame.this, "Failed load","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ });
+
+ exitItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+
+ int action = JOptionPane.showConfirmDialog(MainFrame.this,
+ "Do you really want to exit the application?",
+ "Confirm Exit", JOptionPane.OK_CANCEL_OPTION);
+
+ if (action == JOptionPane.OK_OPTION) {
+ System.exit(0);
+ }
+ }
+ });
+
+ return menuBar;
+ }
+ private ImageIcon createIcon(String path)
+ {
+ URL url = getClass().getResource(path);
+
+ if(url == null)
+ {
+ System.err.println("Unabled to load image"+path);
+ }
+
+ ImageIcon icon = new ImageIcon(url);
+
+ return icon;
+ }
+ private void addFormEvent()
+ {
+ formPanel.setFormListener(new FormListener() {
+ public void formEventOccurred(FormEvent e) {
+ controller.addPerson(e);
+ tablePanel.refresh();
+ textPanel.appendText("Writting proccess...\n");
+ }
+ });
+ formPanel.addKeyListener(new KeyAdapter(){
+ public void keyPressed(KeyEvent e)
+ {
+
+ }
+ });
+
+ }
+ private void CreateNewTable(TextPanel2 text)
+ {
+
+
+ tabbedPane2.addTab(" ������� "+ number, text);
+ tabbedPane2.setIconAt(pos, createIcon("/images/notepad.gif"));
+ pos++;
+ number++;
+
+
+ }
+ private void CloseLastText()
+ {
+ int index = pos -1;
+ tabbedPane2.remove(index);
+ pos--;
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonFileFilter.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonFileFilter.java
new file mode 100644
index 0000000..b2f903e
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonFileFilter.java
@@ -0,0 +1,36 @@
+package gui;
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+
+public class PersonFileFilter extends FileFilter {
+
+ @Override
+ public boolean accept(File file) {
+
+ if(file.isDirectory()) {
+ return true;
+ }
+
+ String name = file.getName();
+
+ String extension = Utils.getFileExtension(name);
+
+ if(extension == null) {
+ return false;
+ }
+
+ if(extension.equals("per")) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Person database file (*.per)";
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableListener.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableListener.java
new file mode 100644
index 0000000..3d52c6f
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableListener.java
@@ -0,0 +1,7 @@
+package gui;
+
+public interface PersonTableListener
+{
+ public void rowDeleted(int row);
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableModel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableModel.java
new file mode 100644
index 0000000..0dce257
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/PersonTableModel.java
@@ -0,0 +1,150 @@
+package gui;
+
+import java.util.List;
+
+import javax.swing.ImageIcon;
+import javax.swing.table.AbstractTableModel;
+
+import model.EmploymentCategory;
+import model.Person;
+
+public class PersonTableModel extends AbstractTableModel {
+
+ private List db;
+
+ private String[] colNames = {"ID", "���", "����", "����������", "�������", "������", "���","Picture"};
+
+ private int colLength = colNames.length;
+
+
+
+
+
+
+ public PersonTableModel() {
+ }
+
+
+
+ @Override
+ public String getColumnName(int column) {
+ // TODO Auto-generated method stub
+ return colNames[column];
+ }
+
+
+
+ public void setData(List db) {
+ this.db = db;
+ }
+ @Override
+ public Class> getColumnClass(int col) {
+
+ switch(col) {
+ case 0:
+ return Integer.class;
+ case 1:
+ return String.class;
+ case 2:
+ return String.class;
+ case 3:
+ return String.class;
+ case 4:
+ return EmploymentCategory.class;
+ case 5:
+ return Boolean.class;
+ case 6:
+ return String.class;
+ case 7 :
+ return ImageIcon.class;
+
+ default:
+ return null;
+
+
+ }
+
+ }
+
+
+
+ @Override
+ public void setValueAt(Object value, int row, int col) {
+
+ if (db == null) return;
+ Person person = db.get(row);
+ switch(col)
+ {
+ case 1:
+ person.setName((String)value);
+ break;
+ case 2:
+ person.setOccupation((String)value);
+ break;
+ case 4:
+ person.setEmpCat((EmploymentCategory)value);
+ break;
+ case 5:
+ person.setUsCitizen((Boolean)value);
+ break;
+ default:
+ return ;
+ }
+ }
+ @Override
+ public boolean isCellEditable(int row, int col) {
+
+ switch(col)
+ {
+ case 1:
+ return true;
+ case 2:
+ return true;
+ case 5:
+ return true;
+ case 4:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public int getColumnCount() {
+ return colLength;
+ }
+
+ @Override
+ public int getRowCount() {
+ return db.size();
+ }
+
+ @Override
+ public Object getValueAt(int row, int col) {
+ Person person = db.get(row);
+
+ switch(col) {
+ case 0:
+ return person.getId();
+ case 1:
+ return person.getName();
+ case 2:
+ return person.getOccupation();
+ case 3:
+ return person.getAgeCategory();
+ case 4:
+ return person.getEmpCat();
+ case 5:
+ return person.isUsCitizen();
+ case 6:
+ return person.getTaxId();
+
+
+
+
+ }
+
+ return null;
+ }
+
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/TablePanel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/TablePanel.java
new file mode 100644
index 0000000..e6c760a
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/TablePanel.java
@@ -0,0 +1,117 @@
+package gui;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.List;
+
+import javax.swing.ImageIcon;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+
+import model.EmploymentCategory;
+import model.Person;
+
+public class TablePanel extends JPanel {
+
+ private JTable table;
+ private PersonTableModel tableModel;
+ private JPopupMenu popup;
+ private JPopupMenu popup2;
+ private PersonTableListener personTableListener;
+
+
+ public TablePanel() {
+
+ tableModel = new PersonTableModel();
+ table = new JTable(tableModel);
+ popup = new JPopupMenu();
+ popup2 = new JPopupMenu();
+
+ IconRenderer icRen = new IconRenderer();
+ icRen.setValue("/images/gear.png");
+
+
+
+ table.setDefaultRenderer(EmploymentCategory.class, new EmploymentCategoryRenderer());
+ table.setDefaultEditor(EmploymentCategory.class, new EmploymentCategoryEditor());
+ table.setDefaultRenderer(ImageIcon.class,icRen);
+
+ table.setRowHeight(24);
+
+
+
+
+ JMenuItem removeItem = new JMenuItem("Delete Row");
+ JMenuItem selectAllItem = new JMenuItem("Select All");
+ popup.add(removeItem);
+ popup.add(selectAllItem);
+
+ selectAllItem.addActionListener(new ActionListener() {
+
+
+ public void actionPerformed(ActionEvent e) {
+
+ table.selectAll();
+
+ }
+ });
+
+
+ removeItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+
+ int row = table.getSelectedRow();
+
+ if(personTableListener != null)
+ {
+ personTableListener.rowDeleted(row);
+ tableModel.fireTableRowsDeleted(row, row);
+ }
+
+ }
+
+ });
+
+
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e) {
+
+ int row = table.rowAtPoint(e.getPoint());
+
+ table.getSelectionModel().setSelectionInterval(row,row );
+ if(e.getButton() == MouseEvent.BUTTON3 )
+ {
+ popup.show(table, e.getX(), e.getY());
+
+ }
+
+ }
+
+ });
+
+ setLayout(new BorderLayout());
+
+ add(new JScrollPane(table), BorderLayout.CENTER);
+ }
+
+
+ public void setData(List db) {
+ tableModel.setData(db);
+ }
+
+ public void refresh() {
+ tableModel.fireTableDataChanged();
+ }
+ public void setPersonTableListener(PersonTableListener listener)
+ {
+ this.personTableListener = listener;
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel.java
new file mode 100644
index 0000000..8cf3cf1
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel.java
@@ -0,0 +1,31 @@
+package gui;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+
+public class TextPanel extends JPanel {
+
+ private JTextArea textArea;
+
+ public TextPanel() {
+
+ Dimension dim = getPreferredSize();
+ dim.height = 75;
+ setPreferredSize(dim);
+ textArea = new JTextArea();
+ textArea.enable(false);
+
+
+ setLayout(new BorderLayout());
+
+ add(new JScrollPane(textArea), BorderLayout.CENTER);
+ }
+
+ public void appendText(String text) {
+ textArea.append(text);
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel2.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel2.java
new file mode 100644
index 0000000..82bef7c
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/TextPanel2.java
@@ -0,0 +1,75 @@
+package gui;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+
+public class TextPanel2 extends JPanel {
+
+ private JTextArea textArea;
+ private JPopupMenu popup;
+
+ public TextPanel2() {
+
+ Dimension dim = getPreferredSize();
+ dim.height = 75;
+ setPreferredSize(dim);
+ textArea = new JTextArea();
+ popup = new JPopupMenu();
+
+ JMenuItem removeItem = new JMenuItem("��������");
+ popup.add(removeItem);
+
+ removeItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+
+ DeleteText();
+
+ }
+
+ });
+
+ setLayout(new BorderLayout());
+
+ add(new JScrollPane(textArea), BorderLayout.CENTER);
+ }
+
+ public void appendText(String text) {
+ textArea.append(text);
+ }
+ public boolean getTextContains(String text)
+ {
+ if(textArea.getText().contains(text))
+ {
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+ public void DeleteText()
+ {
+ textArea.setText(null);
+ }
+ public void AddKeyListenerRevelance(KeyAdapter listener)
+ {
+ textArea.addKeyListener(listener);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/Toolbar.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/Toolbar.java
new file mode 100644
index 0000000..aa38d22
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/Toolbar.java
@@ -0,0 +1,72 @@
+package gui;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+
+public class Toolbar extends JPanel implements ActionListener {
+ private JButton saveButton;
+ private JButton refreshButton;
+
+ private ToolbarListener textListener;
+
+ public Toolbar() {
+ setBorder(BorderFactory.createEtchedBorder());
+
+ saveButton = new JButton("Save");
+ saveButton.setIcon(createIcon("/images/1400444547_document-save.png"));
+
+ refreshButton = new JButton("Refresh");
+ refreshButton.setIcon(createIcon("/images/1400444569_gtk-refresh.png"));
+
+ saveButton.addActionListener(this);
+ refreshButton.addActionListener(this);
+
+ setLayout(new FlowLayout(FlowLayout.LEFT));
+
+ add(saveButton);
+ add(refreshButton);
+ }
+
+ private ImageIcon createIcon(String path)
+ {
+ URL url = getClass().getResource(path);
+
+ if(url == null)
+ {
+ System.err.println("Unabled to load image"+path);
+ }
+
+ ImageIcon icon = new ImageIcon(url);
+
+ return icon;
+ }
+
+ public void setToolbarListener(ToolbarListener listener) {
+ this.textListener = listener;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JButton clicked = (JButton)e.getSource();
+
+ if(clicked == saveButton) {
+ if(textListener != null) {
+ textListener.saveEventOccured();
+ }
+ }
+ else if(clicked == refreshButton) {
+ if(textListener != null) {
+ textListener.refreshEventOccured();
+ }
+ }
+
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/ToolbarListener.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/ToolbarListener.java
new file mode 100644
index 0000000..cb654fa
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/ToolbarListener.java
@@ -0,0 +1,6 @@
+package gui;
+
+public interface ToolbarListener {
+ public void saveEventOccured();
+ public void refreshEventOccured();
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/gui/Utils.java b/Diff_java_projects/simple-java-crud-app-master/src/gui/Utils.java
new file mode 100644
index 0000000..34a78af
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/gui/Utils.java
@@ -0,0 +1,19 @@
+package gui;
+
+public class Utils {
+
+ public static String getFileExtension(String name) {
+
+ int pointIndex = name.lastIndexOf(".");
+
+ if(pointIndex == -1) {
+ return null;
+ }
+
+ if(pointIndex == name.length()-1) {
+ return null;
+ }
+
+ return name.substring(pointIndex+1, name.length());
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444437_save_accept.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444437_save_accept.png
new file mode 100644
index 0000000..48ae6ff
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444437_save_accept.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444440_Save.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444440_Save.png
new file mode 100644
index 0000000..030a28e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444440_Save.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444542_save_16.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444542_save_16.png
new file mode 100644
index 0000000..cd0162b
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444542_save_16.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444547_document-save.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444547_document-save.png
new file mode 100644
index 0000000..bf10639
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444547_document-save.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444559_view-refresh.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444559_view-refresh.png
new file mode 100644
index 0000000..cf70ceb
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444559_view-refresh.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444563_Synchronize.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444563_Synchronize.png
new file mode 100644
index 0000000..01dc229
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444563_Synchronize.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444569_gtk-refresh.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444569_gtk-refresh.png
new file mode 100644
index 0000000..dc14406
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444569_gtk-refresh.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444586_import.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444586_import.png
new file mode 100644
index 0000000..e4703e9
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444586_import.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444602_table-export.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444602_table-export.png
new file mode 100644
index 0000000..f582fb8
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444602_table-export.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400444918_application_view_xp_terminal.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444918_application_view_xp_terminal.png
new file mode 100644
index 0000000..c98e419
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400444918_application_view_xp_terminal.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445120_Error.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445120_Error.png
new file mode 100644
index 0000000..0d6d934
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445120_Error.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445243_text_horizontalrule.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445243_text_horizontalrule.png
new file mode 100644
index 0000000..3e70c65
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445243_text_horizontalrule.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445397_accept.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445397_accept.png
new file mode 100644
index 0000000..68f638a
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445397_accept.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445557_Windows_16x16.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445557_Windows_16x16.png
new file mode 100644
index 0000000..3fd4321
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445557_Windows_16x16.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400445676_Help.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445676_Help.png
new file mode 100644
index 0000000..0bd60db
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400445676_Help.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400446085_Table_16x16.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400446085_Table_16x16.png
new file mode 100644
index 0000000..4fe7dff
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400446085_Table_16x16.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400447294_1.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400447294_1.png
new file mode 100644
index 0000000..c67d6f1
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400447294_1.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400462129_cart_add.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400462129_cart_add.png
new file mode 100644
index 0000000..bc402b1
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400462129_cart_add.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/1400956144_gear__plus.png b/Diff_java_projects/simple-java-crud-app-master/src/images/1400956144_gear__plus.png
new file mode 100644
index 0000000..bc4cd9e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/1400956144_gear__plus.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/Refresh16.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/Refresh16.gif
new file mode 100644
index 0000000..cf7cea3
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/Refresh16.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/Save16.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/Save16.gif
new file mode 100644
index 0000000..954f1ac
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/Save16.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/Server16.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/Server16.gif
new file mode 100644
index 0000000..4e76682
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/Server16.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/car.png b/Diff_java_projects/simple-java-crud-app-master/src/images/car.png
new file mode 100644
index 0000000..cb18738
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/car.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/gear.png b/Diff_java_projects/simple-java-crud-app-master/src/images/gear.png
new file mode 100644
index 0000000..bc4cd9e
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/gear.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/import1.png b/Diff_java_projects/simple-java-crud-app-master/src/images/import1.png
new file mode 100644
index 0000000..ff10bad
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/import1.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/notepad.gif b/Diff_java_projects/simple-java-crud-app-master/src/images/notepad.gif
new file mode 100644
index 0000000..074a105
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/notepad.gif differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/price.png b/Diff_java_projects/simple-java-crud-app-master/src/images/price.png
new file mode 100644
index 0000000..ff76611
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/price.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/images/ware.png b/Diff_java_projects/simple-java-crud-app-master/src/images/ware.png
new file mode 100644
index 0000000..db17c45
Binary files /dev/null and b/Diff_java_projects/simple-java-crud-app-master/src/images/ware.png differ
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/AgeCategory.java b/Diff_java_projects/simple-java-crud-app-master/src/model/AgeCategory.java
new file mode 100644
index 0000000..e063c5a
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/model/AgeCategory.java
@@ -0,0 +1,9 @@
+package model;
+
+public enum AgeCategory {
+ Nissan,
+ Mazda,
+ Land_Rover,
+ Lada,
+ Honda
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/Database.java b/Diff_java_projects/simple-java-crud-app-master/src/model/Database.java
new file mode 100644
index 0000000..d3f5a2d
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/model/Database.java
@@ -0,0 +1,231 @@
+package model;
+
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.mysql.jdbc.ResultSet;
+
+public class Database {
+
+
+ private List people;
+
+ private Connection con;
+
+
+ public Database() {
+ people = new LinkedList();
+
+ }
+ public void connect() throws Exception
+ {
+ if(con != null) return;
+ try {
+ Class.forName("com.mysql.jdbc.Driver");
+ } catch (ClassNotFoundException e) {
+ throw new Exception("Driver not found");
+ }
+
+ String url = "jdbc:mysql://localhost:3306/swingtest_oleh";
+ con = DriverManager.getConnection(url,"root","");
+
+
+
+
+
+ System.out.println("successful connected : " + con);
+
+ }
+
+
+
+ public void disconnect()
+ {
+ if(con != null)
+ {
+ try {
+ con.close();
+ } catch (SQLException e) {
+ System.out.println("Cant close");
+ }
+ }
+
+ }
+
+
+
+ public void save() throws SQLException
+ {
+ String checkSql = "select count(*) as count from people where id=?";
+ PreparedStatement checkStmt = con.prepareStatement(checkSql);
+
+ String insertSql = "insert into people (id , name , age , employment_status, tax_id , us_citizen ,gender, occupation) values (? , ? , ? , ? , ? , ? , ? ,? ) ";
+ PreparedStatement insertStatement = con.prepareStatement(insertSql);
+
+ String updateSql = "update people set name=?, age=?, employment_status=?, tax_id=?, us_citizen=?, gender=?, occupation=? where id=?";
+ PreparedStatement updateStatement = con.prepareStatement(updateSql);
+
+
+ for(Person person: people)
+ {
+ int id = person.getId();
+ String name = person.getName();
+ String occupation = person.getOccupation();
+ AgeCategory age = person.getAgeCategory();
+ EmploymentCategory emp = person.getEmpCat();
+ String tax = person.getTaxId();
+ boolean isUs = person.isUsCitizen();
+ Gender gender = person.getGender();
+
+
+ checkStmt.setInt(1, id);
+
+ ResultSet checkResult = (ResultSet) checkStmt.executeQuery();
+
+ checkResult.next();
+
+ int count = checkResult.getInt(1);
+
+ if(count == 0 )
+ {
+ System.out.println("inserting person with ID : "+id);
+
+ int col = 1;
+ insertStatement.setInt(col++, id);
+ insertStatement.setString(col++, name);
+ insertStatement.setString(col++, age.name());
+ insertStatement.setString(col++, emp.name());
+ insertStatement.setString(col++, tax);
+ insertStatement.setBoolean(col++, isUs);
+ insertStatement.setString(col++, gender.name());
+ insertStatement.setString(col++, occupation);
+
+ insertStatement.executeUpdate();
+
+
+
+
+
+ }
+ else
+ {
+ System.out.println("Updating person with ID" + id);
+
+ int col = 1;
+
+
+ updateStatement.setString(col++, name);
+ updateStatement.setString(col++, age.name());
+ updateStatement.setString(col++, emp.name());
+ updateStatement.setString(col++, tax);
+ updateStatement.setBoolean(col++, isUs);
+ updateStatement.setString(col++, gender.name());
+ updateStatement.setString(col++, occupation);
+ updateStatement.setInt(col++, id);
+
+ updateStatement.executeUpdate();
+ }
+ System.out.println("Count for person with id : "+ id + " is " + count);
+
+ }
+
+ updateStatement.close();
+ insertStatement.close();
+ checkStmt.close();
+ }
+
+ public void load() throws SQLException
+ {
+ people.clear();
+
+ String sql = "select id , name , age , employment_status, tax_id , us_citizen ,gender, occupation from people order by name ";
+
+ Statement selectStatement = con.createStatement();
+
+
+
+ ResultSet results = (ResultSet) selectStatement.executeQuery(sql);
+
+ while(results.next())
+ {
+ int id = results.getInt("id");
+ String name = results.getString("name");
+ String age = results.getString("age");
+ String emp = results.getString("employment_status");
+ String tax = results.getString("tax_id");
+ boolean isUs = results.getBoolean("us_citizen");
+ String gender = results.getString("gender");
+ String occ = results.getString("occupation");
+
+
+ Person person = new Person(id,name,occ ,AgeCategory.valueOf(age),EmploymentCategory.valueOf(emp),tax , isUs , Gender.valueOf(gender));
+ people.add(person);
+
+
+ }
+
+ results.close();
+ selectStatement.close();
+
+ }
+ public void addPerson(Person person) {
+ people.add(person);
+ }
+ public void removePerson(int index)
+ {
+ people.remove(index);
+
+ }
+
+ public List getPeople() {
+ return Collections.unmodifiableList(people);
+ }
+ public void saveToFile(File file) throws IOException
+ {
+ FileOutputStream fos = new FileOutputStream(file);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+
+ Person[] persons = people.toArray(new Person[people.size()]);
+
+ oos.writeObject(persons);
+
+ oos.close();
+ }
+ public void loadFromFile(File file) throws IOException
+ {
+ FileInputStream fis = new FileInputStream(file);
+ ObjectInputStream ois = new ObjectInputStream(fis);
+
+ try {
+ Person[] persons = (Person[]) ois.readObject();
+
+ people.clear();
+
+ people.addAll(Arrays.asList(persons));
+
+
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ ois.close();
+
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/EmploymentCategory.java b/Diff_java_projects/simple-java-crud-app-master/src/model/EmploymentCategory.java
new file mode 100644
index 0000000..7289cdf
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/model/EmploymentCategory.java
@@ -0,0 +1,19 @@
+package model;
+
+public enum EmploymentCategory {
+ yes("����"),
+ no("���"),
+ sklad("�����"),
+ other("������");
+
+ private String text;
+ private EmploymentCategory(String text)
+ {
+ this.text = text;
+
+ }
+ @Override
+ public String toString() {
+ return text;
+ }
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/Gender.java b/Diff_java_projects/simple-java-crud-app-master/src/model/Gender.java
new file mode 100644
index 0000000..908b5d9
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/model/Gender.java
@@ -0,0 +1,6 @@
+package model;
+
+public enum Gender {
+ yes,
+ no
+}
diff --git a/Diff_java_projects/simple-java-crud-app-master/src/model/Person.java b/Diff_java_projects/simple-java-crud-app-master/src/model/Person.java
new file mode 100644
index 0000000..56f869c
--- /dev/null
+++ b/Diff_java_projects/simple-java-crud-app-master/src/model/Person.java
@@ -0,0 +1,129 @@
+package model;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+import javax.swing.table.DefaultTableCellRenderer;
+
+public class Person extends DefaultTableCellRenderer implements Serializable
+{
+ private static final long serialVersionUID = 4022843652518158650L;
+
+ private static int count = 1;
+
+ private int id;
+ private String name;
+ private String occupation;
+ private AgeCategory ageCategory;
+ private EmploymentCategory empCat;
+ private String taxId;
+ private boolean usCitizen;
+ private Gender gender;
+ private ImageIcon personIcon;
+
+ public Person(String name, String occupation, AgeCategory ageCategory,
+ EmploymentCategory empCat, String taxId,
+ boolean usCitizen, Gender gender) {
+ this.name = name;
+ this.occupation = occupation;
+ this.ageCategory = ageCategory;
+ this.empCat = empCat;
+ this.taxId = taxId;
+ this.usCitizen = usCitizen;
+ this.gender = gender;
+
+ this.id = count;
+ count++;
+ }
+
+ public Person(int id, String name, String occupation, AgeCategory ageCategory,
+ EmploymentCategory empCat, String taxId,
+ boolean usCitizen, Gender gender) {
+
+ this(name, occupation, ageCategory, empCat, taxId, usCitizen, gender);
+
+ this.id = id;
+
+ }
+
+ public int getId() {
+ return id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getOccupation() {
+ return occupation;
+ }
+ public void setOccupation(String occupation) {
+ this.occupation = occupation;
+ }
+ public AgeCategory getAgeCategory() {
+ return ageCategory;
+ }
+ public void setAgeCategory(AgeCategory ageCategory) {
+ this.ageCategory = ageCategory;
+ }
+ public EmploymentCategory getEmpCat() {
+ return empCat;
+ }
+ public void setEmpCat(EmploymentCategory empCat) {
+ this.empCat = empCat;
+ }
+ public String getTaxId() {
+ return taxId;
+ }
+ public void setTaxId(String taxId) {
+ this.taxId = taxId;
+ }
+ public boolean isUsCitizen() {
+ return usCitizen;
+ }
+ public void setUsCitizen(boolean usCitizen) {
+ this.usCitizen = usCitizen;
+ }
+ public Gender getGender() {
+ return gender;
+ }
+ public void setGender(Gender gender) {
+ this.gender = gender;
+ }
+
+ public String toString()
+ {
+ return id + "Name: "+ name;
+ }
+
+ public ImageIcon getPersonIcon() {
+
+ personIcon = new ImageIcon(new String("/images/car.png"));
+ return personIcon;
+ }
+
+ public void setPersonIcon(ImageIcon personIcon) {
+ this.personIcon = personIcon;
+ }
+ private ImageIcon createIcon(String path)
+ {
+ URL url = getClass().getResource(path);
+
+ if(url == null)
+ {
+ System.err.println("Unabled to load image"+path);
+ }
+
+ ImageIcon icon = new ImageIcon(url);
+
+ return icon;
+ }
+
+
+
+}
diff --git a/projects/Billing-System-master/.classpath b/projects/Billing-System-master/.classpath
new file mode 100644
index 0000000..a1dda71
--- /dev/null
+++ b/projects/Billing-System-master/.classpath
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/projects/Billing-System-master/.project b/projects/Billing-System-master/.project
new file mode 100644
index 0000000..7a2c11b
--- /dev/null
+++ b/projects/Billing-System-master/.project
@@ -0,0 +1,17 @@
+
+
+ Billing-System-master
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/projects/Billing-System-master/Billing System.jar b/projects/Billing-System-master/Billing System.jar
new file mode 100644
index 0000000..74a9c19
Binary files /dev/null and b/projects/Billing-System-master/Billing System.jar differ
diff --git a/projects/Billing-System-master/README.md b/projects/Billing-System-master/README.md
new file mode 100644
index 0000000..63b894f
--- /dev/null
+++ b/projects/Billing-System-master/README.md
@@ -0,0 +1,10 @@
+# Billing-System
+A GUI Based Complete Store Billing System in java that generates Invoice of each sale.
+
+ Requirments
+
+This Project Requires.
+
+Wamp Server Installed (Running).
+
+Create database "caddey" and three tables "sale" , "users" and "stock".
diff --git a/projects/Billing-System-master/_invoice_.pdf b/projects/Billing-System-master/_invoice_.pdf
new file mode 100644
index 0000000..7dcefe4
Binary files /dev/null and b/projects/Billing-System-master/_invoice_.pdf differ
diff --git a/projects/Billing-System-master/bin/AdminPanel.class b/projects/Billing-System-master/bin/AdminPanel.class
new file mode 100644
index 0000000..d8252c3
Binary files /dev/null and b/projects/Billing-System-master/bin/AdminPanel.class differ
diff --git a/projects/Billing-System-master/bin/DB.class b/projects/Billing-System-master/bin/DB.class
new file mode 100644
index 0000000..accd291
Binary files /dev/null and b/projects/Billing-System-master/bin/DB.class differ
diff --git a/projects/Billing-System-master/bin/Invoice$1.class b/projects/Billing-System-master/bin/Invoice$1.class
new file mode 100644
index 0000000..8bc4c58
Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$1.class differ
diff --git a/projects/Billing-System-master/bin/Invoice$2.class b/projects/Billing-System-master/bin/Invoice$2.class
new file mode 100644
index 0000000..29762ec
Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$2.class differ
diff --git a/projects/Billing-System-master/bin/Invoice$3.class b/projects/Billing-System-master/bin/Invoice$3.class
new file mode 100644
index 0000000..3613cd1
Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$3.class differ
diff --git a/projects/Billing-System-master/bin/Invoice$4.class b/projects/Billing-System-master/bin/Invoice$4.class
new file mode 100644
index 0000000..9cfd157
Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice$4.class differ
diff --git a/projects/Billing-System-master/bin/Invoice.class b/projects/Billing-System-master/bin/Invoice.class
new file mode 100644
index 0000000..9af9ce3
Binary files /dev/null and b/projects/Billing-System-master/bin/Invoice.class differ
diff --git a/projects/Billing-System-master/bin/Login$1.class b/projects/Billing-System-master/bin/Login$1.class
new file mode 100644
index 0000000..1f93718
Binary files /dev/null and b/projects/Billing-System-master/bin/Login$1.class differ
diff --git a/projects/Billing-System-master/bin/Login$2.class b/projects/Billing-System-master/bin/Login$2.class
new file mode 100644
index 0000000..99619f2
Binary files /dev/null and b/projects/Billing-System-master/bin/Login$2.class differ
diff --git a/projects/Billing-System-master/bin/Login$3.class b/projects/Billing-System-master/bin/Login$3.class
new file mode 100644
index 0000000..66ef0b6
Binary files /dev/null and b/projects/Billing-System-master/bin/Login$3.class differ
diff --git a/projects/Billing-System-master/bin/Login.class b/projects/Billing-System-master/bin/Login.class
new file mode 100644
index 0000000..a9264ef
Binary files /dev/null and b/projects/Billing-System-master/bin/Login.class differ
diff --git a/projects/Billing-System-master/bin/Sale$1.class b/projects/Billing-System-master/bin/Sale$1.class
new file mode 100644
index 0000000..2ecc61e
Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$1.class differ
diff --git a/projects/Billing-System-master/bin/Sale$2.class b/projects/Billing-System-master/bin/Sale$2.class
new file mode 100644
index 0000000..3093ec1
Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$2.class differ
diff --git a/projects/Billing-System-master/bin/Sale$3.class b/projects/Billing-System-master/bin/Sale$3.class
new file mode 100644
index 0000000..3a49faf
Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$3.class differ
diff --git a/projects/Billing-System-master/bin/Sale$4.class b/projects/Billing-System-master/bin/Sale$4.class
new file mode 100644
index 0000000..036d016
Binary files /dev/null and b/projects/Billing-System-master/bin/Sale$4.class differ
diff --git a/projects/Billing-System-master/bin/Sale.class b/projects/Billing-System-master/bin/Sale.class
new file mode 100644
index 0000000..fc60f99
Binary files /dev/null and b/projects/Billing-System-master/bin/Sale.class differ
diff --git a/projects/Billing-System-master/bin/addCashier$1.class b/projects/Billing-System-master/bin/addCashier$1.class
new file mode 100644
index 0000000..be23167
Binary files /dev/null and b/projects/Billing-System-master/bin/addCashier$1.class differ
diff --git a/projects/Billing-System-master/bin/addCashier.class b/projects/Billing-System-master/bin/addCashier.class
new file mode 100644
index 0000000..cdfd486
Binary files /dev/null and b/projects/Billing-System-master/bin/addCashier.class differ
diff --git a/projects/Billing-System-master/bin/addProduct$1.class b/projects/Billing-System-master/bin/addProduct$1.class
new file mode 100644
index 0000000..201dba8
Binary files /dev/null and b/projects/Billing-System-master/bin/addProduct$1.class differ
diff --git a/projects/Billing-System-master/bin/addProduct.class b/projects/Billing-System-master/bin/addProduct.class
new file mode 100644
index 0000000..e59e977
Binary files /dev/null and b/projects/Billing-System-master/bin/addProduct.class differ
diff --git a/projects/Billing-System-master/bin/deleteCashier$1.class b/projects/Billing-System-master/bin/deleteCashier$1.class
new file mode 100644
index 0000000..1e0d0f0
Binary files /dev/null and b/projects/Billing-System-master/bin/deleteCashier$1.class differ
diff --git a/projects/Billing-System-master/bin/deleteCashier.class b/projects/Billing-System-master/bin/deleteCashier.class
new file mode 100644
index 0000000..c97e65c
Binary files /dev/null and b/projects/Billing-System-master/bin/deleteCashier.class differ
diff --git a/projects/Billing-System-master/bin/deleteProduct$1.class b/projects/Billing-System-master/bin/deleteProduct$1.class
new file mode 100644
index 0000000..b8d8167
Binary files /dev/null and b/projects/Billing-System-master/bin/deleteProduct$1.class differ
diff --git a/projects/Billing-System-master/bin/deleteProduct.class b/projects/Billing-System-master/bin/deleteProduct.class
new file mode 100644
index 0000000..dc2f3c2
Binary files /dev/null and b/projects/Billing-System-master/bin/deleteProduct.class differ
diff --git a/projects/Billing-System-master/bin/generateInvoice$1.class b/projects/Billing-System-master/bin/generateInvoice$1.class
new file mode 100644
index 0000000..cd38f4e
Binary files /dev/null and b/projects/Billing-System-master/bin/generateInvoice$1.class differ
diff --git a/projects/Billing-System-master/bin/generateInvoice.class b/projects/Billing-System-master/bin/generateInvoice.class
new file mode 100644
index 0000000..d47ac3a
Binary files /dev/null and b/projects/Billing-System-master/bin/generateInvoice.class differ
diff --git a/projects/Billing-System-master/bin/pdfGenerator.class b/projects/Billing-System-master/bin/pdfGenerator.class
new file mode 100644
index 0000000..cc378fd
Binary files /dev/null and b/projects/Billing-System-master/bin/pdfGenerator.class differ
diff --git a/projects/Billing-System-master/bin/searchCashier$1.class b/projects/Billing-System-master/bin/searchCashier$1.class
new file mode 100644
index 0000000..3a9a04b
Binary files /dev/null and b/projects/Billing-System-master/bin/searchCashier$1.class differ
diff --git a/projects/Billing-System-master/bin/searchCashier.class b/projects/Billing-System-master/bin/searchCashier.class
new file mode 100644
index 0000000..ccd98c3
Binary files /dev/null and b/projects/Billing-System-master/bin/searchCashier.class differ
diff --git a/projects/Billing-System-master/bin/searchProduct$1.class b/projects/Billing-System-master/bin/searchProduct$1.class
new file mode 100644
index 0000000..e7b882d
Binary files /dev/null and b/projects/Billing-System-master/bin/searchProduct$1.class differ
diff --git a/projects/Billing-System-master/bin/searchProduct.class b/projects/Billing-System-master/bin/searchProduct.class
new file mode 100644
index 0000000..444a060
Binary files /dev/null and b/projects/Billing-System-master/bin/searchProduct.class differ
diff --git a/projects/Billing-System-master/bin/showStock$1.class b/projects/Billing-System-master/bin/showStock$1.class
new file mode 100644
index 0000000..08dd11f
Binary files /dev/null and b/projects/Billing-System-master/bin/showStock$1.class differ
diff --git a/projects/Billing-System-master/bin/showStock$2.class b/projects/Billing-System-master/bin/showStock$2.class
new file mode 100644
index 0000000..2d32375
Binary files /dev/null and b/projects/Billing-System-master/bin/showStock$2.class differ
diff --git a/projects/Billing-System-master/bin/showStock$3.class b/projects/Billing-System-master/bin/showStock$3.class
new file mode 100644
index 0000000..3fcc672
Binary files /dev/null and b/projects/Billing-System-master/bin/showStock$3.class differ
diff --git a/projects/Billing-System-master/bin/showStock.class b/projects/Billing-System-master/bin/showStock.class
new file mode 100644
index 0000000..f636993
Binary files /dev/null and b/projects/Billing-System-master/bin/showStock.class differ
diff --git a/projects/Billing-System-master/bin/updateProduct$1.class b/projects/Billing-System-master/bin/updateProduct$1.class
new file mode 100644
index 0000000..eaefafc
Binary files /dev/null and b/projects/Billing-System-master/bin/updateProduct$1.class differ
diff --git a/projects/Billing-System-master/bin/updateProduct$2.class b/projects/Billing-System-master/bin/updateProduct$2.class
new file mode 100644
index 0000000..64530e3
Binary files /dev/null and b/projects/Billing-System-master/bin/updateProduct$2.class differ
diff --git a/projects/Billing-System-master/bin/updateProduct.class b/projects/Billing-System-master/bin/updateProduct.class
new file mode 100644
index 0000000..98ea32b
Binary files /dev/null and b/projects/Billing-System-master/bin/updateProduct.class differ
diff --git a/projects/Billing-System-master/images/logo.png b/projects/Billing-System-master/images/logo.png
new file mode 100644
index 0000000..cb5eb11
Binary files /dev/null and b/projects/Billing-System-master/images/logo.png differ
diff --git a/projects/Billing-System-master/jgoodies-forms-1.8.0-sources.jar b/projects/Billing-System-master/jgoodies-forms-1.8.0-sources.jar
new file mode 100644
index 0000000..822eb93
Binary files /dev/null and b/projects/Billing-System-master/jgoodies-forms-1.8.0-sources.jar differ
diff --git a/projects/Billing-System-master/jgoodies-forms-1.8.0.jar b/projects/Billing-System-master/jgoodies-forms-1.8.0.jar
new file mode 100644
index 0000000..a6a8126
Binary files /dev/null and b/projects/Billing-System-master/jgoodies-forms-1.8.0.jar differ
diff --git a/projects/Billing-System-master/logo.jpg b/projects/Billing-System-master/logo.jpg
new file mode 100644
index 0000000..df40dee
Binary files /dev/null and b/projects/Billing-System-master/logo.jpg differ
diff --git a/projects/Billing-System-master/logo.png b/projects/Billing-System-master/logo.png
new file mode 100644
index 0000000..9a4fbd5
Binary files /dev/null and b/projects/Billing-System-master/logo.png differ
diff --git a/projects/Billing-System-master/logo2.png b/projects/Billing-System-master/logo2.png
new file mode 100644
index 0000000..1ec95d3
Binary files /dev/null and b/projects/Billing-System-master/logo2.png differ
diff --git a/projects/Billing-System-master/src/AdminPanel.java b/projects/Billing-System-master/src/AdminPanel.java
new file mode 100644
index 0000000..b90be57
--- /dev/null
+++ b/projects/Billing-System-master/src/AdminPanel.java
@@ -0,0 +1,219 @@
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+
+import javax.swing.JFrame;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JMenu;
+import java.awt.Toolkit;
+
+
+public class AdminPanel extends JFrame implements ActionListener {
+ JMenuItem itmAddProduct;
+ JMenu mnProduct;
+ JMenuItem itmUpdateProduct;
+ JMenuItem itmDeleteProduct;
+ JMenu mnCashier ;
+ JMenuItem itmDeleteCashier;
+ JMenuItem itmAddCashier;
+ JMenu mnStock ;
+ JMenuItem itmShowStock;
+ JMenu mnExport;
+ ArrayList panels=new ArrayList();
+ int cPanel=0;
+ private JMenu mnSearch;
+ private JMenuItem mntmSearchProduct;
+ private JMenuItem mntmSearchCashier;
+ private JMenu mnSale;
+ private JMenuItem mntmPrintSale;
+
+
+ /**
+ * Create the frame.
+ */
+ public AdminPanel() {
+ setIconImage(Toolkit.getDefaultToolkit().getImage("F:\\Working Directory\\fianl project with sql\\Bill\\logo.png"));
+ setTitle("Admin Panel");
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ setBounds(100, 100, 840, 619);
+
+ JMenuBar menuBar = new JMenuBar();
+ setJMenuBar(menuBar);
+
+ mnProduct = new JMenu("Product");
+ menuBar.add(mnProduct);
+
+ itmAddProduct = new JMenuItem("Add Product");
+ mnProduct.add(itmAddProduct);
+ itmAddProduct.addActionListener(this);
+
+ itmUpdateProduct = new JMenuItem("Update Product");
+ mnProduct.add(itmUpdateProduct);
+ itmUpdateProduct.addActionListener(this);
+
+ itmDeleteProduct = new JMenuItem("Delete Product");
+ mnProduct.add(itmDeleteProduct);
+ itmDeleteProduct.addActionListener(this);
+
+ mnCashier = new JMenu("Cashier");
+ menuBar.add(mnCashier);
+
+ itmAddCashier = new JMenuItem("Add Cashier");
+ mnCashier.add(itmAddCashier);
+ itmAddCashier.addActionListener(this);
+
+ itmDeleteCashier = new JMenuItem("Delete Cashier");
+ mnCashier.add(itmDeleteCashier);
+ itmDeleteCashier.addActionListener(this);
+
+ mnStock = new JMenu("Stock");
+ menuBar.add(mnStock);
+
+ itmShowStock = new JMenuItem("Show Stock");
+ mnStock.add(itmShowStock);
+ itmShowStock.addActionListener(this);
+
+ mnSearch = new JMenu("Search");
+ menuBar.add(mnSearch);
+
+ mntmSearchProduct = new JMenuItem("Search Product");
+ mnSearch.add(mntmSearchProduct);
+ mntmSearchProduct.addActionListener(this);
+
+ mntmSearchCashier = new JMenuItem("Search Cashier");
+ mnSearch.add(mntmSearchCashier);
+
+ mnSale = new JMenu("Sale");
+ menuBar.add(mnSale);
+
+ mntmPrintSale = new JMenuItem("Print Sale");
+ mnSale.add(mntmPrintSale);
+ mntmPrintSale.addActionListener(this);
+
+ mnExport = new JMenu("Account");
+ menuBar.add(mnExport);
+
+ JMenuItem logout = new JMenuItem("Logout");
+ mnExport.add(logout);
+ logout.addActionListener(this);
+ mntmSearchCashier.addActionListener(this);
+
+ getContentPane().setLayout(new BorderLayout(0, 0));
+
+ panels.add(new addProduct());
+ panels.add(new updateProduct());
+ panels.add(new deleteProduct());
+ panels.add(new addCashier());
+ panels.add(new deleteCashier());
+ panels.add(new showStock());
+ panels.add(new searchProduct());
+ panels.add(new searchCashier());
+ panels.add(new Sale());
+ getContentPane().add(panels.get(0));
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ System.out.println("Selected: " + e.getActionCommand());
+ if(e.getActionCommand().equals("Add Product"))
+ {
+ System.out.println(panels.get(cPanel));
+ this.remove(panels.get(cPanel));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(0));
+ this.setVisible(true);
+ cPanel=0;
+ this.setTitle("Add Product");
+ }
+ else if(e.getActionCommand().equals("Update Product"))
+ {
+ this.remove(panels.get(cPanel));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(1));
+ this.setVisible(true);
+ cPanel=1;
+ this.setTitle("Update Product");
+ }
+ else if(e.getActionCommand().equals("Delete Product"))
+ {
+ this.remove(panels.get(cPanel));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(2));
+ this.setVisible(true);
+ cPanel=2;
+ this.setTitle("Delete Product");
+ }
+ else if(e.getActionCommand().equals("Add Cashier"))
+ {
+ this.remove(panels.get(cPanel));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(3));
+ this.setVisible(true);
+ cPanel=3;
+ this.setTitle("Add Cashier");
+ }
+ else if(e.getActionCommand().equals("Delete Cashier"))
+ {
+ this.remove(panels.get(cPanel));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(4));
+ this.setVisible(true);
+ cPanel=4;
+ this.setTitle("Delete Cashier");
+ }
+ else if(e.getActionCommand().equals("Show Stock"))
+ {
+ this.remove(panels.get(cPanel));
+ getContentPane().add(panels.get(5));
+ this.revalidate();
+ this.repaint();
+ this.setVisible(true);
+ cPanel=5;
+ this.setTitle("Show Stock");
+ }
+ else if(e.getActionCommand().equals("Search Product"))
+ {
+ this.remove(panels.get(cPanel));
+ getContentPane().add(panels.get(6));
+ this.revalidate();
+ this.repaint();
+ this.setVisible(true);
+ cPanel=6;
+ this.setTitle("Search Product");
+ }
+ else if(e.getActionCommand().equals("Search Cashier"))
+ {
+ this.remove(panels.get(cPanel));
+ getContentPane().add(panels.get(7));
+ this.revalidate();
+ this.repaint();
+ this.setVisible(true);
+ cPanel=7;
+ this.setTitle("Search Cashier");
+ }
+ else if(e.getActionCommand().equals("Print Sale"))
+ {
+ this.remove(panels.get(cPanel));
+ getContentPane().add(panels.get(8));
+ this.revalidate();
+ this.repaint();
+ this.setVisible(true);
+ cPanel=8;
+ this.setTitle("Print Sale");
+ }
+ else if(e.getActionCommand().equals("Logout"))
+ {
+ this.dispose();
+ }
+ }
+}
diff --git a/projects/Billing-System-master/src/DB.java b/projects/Billing-System-master/src/DB.java
new file mode 100644
index 0000000..a0173b9
--- /dev/null
+++ b/projects/Billing-System-master/src/DB.java
@@ -0,0 +1,358 @@
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import javax.swing.JOptionPane;
+
+public class DB {
+
+ public static Connection DBConnection()
+ {
+ Connection conn = null;
+ try
+ {
+ Class.forName("com.mysql.jdbc.Driver");
+
+ conn = DriverManager.getConnection("jdbc:mysql://localhost/caddey","root", "");
+ System.out.print("Database is connected !");
+
+ }
+ catch(Exception e)
+ {
+ JOptionPane.showMessageDialog(null, "Do not connect to DB - Error:"+e);
+
+ }
+ return conn;
+ }
+ public static void addProductToDB(String id,String detail,String comp,int quan)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ statement.executeUpdate("INSERT INTO stock VALUES ('"+id+"','"+detail+"','"+comp+"',"+quan+");");
+ JOptionPane.showMessageDialog(null, "Product added to database");
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ public static void updateProductToDB(String id,String detail,String comp,int quan)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ int status=statement.executeUpdate("UPDATE stock set Detail = '"+detail+"', Company = '"+comp+"', Quantity = "+quan+" WHERE ProductID = '"+id+"';");
+ if(status==1)
+ JOptionPane.showMessageDialog(null, "Product updted");
+ else
+ JOptionPane.showMessageDialog(null, "ProductID not found!");
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+
+ public static void deleteProductToDB(String id)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ int status=statement.executeUpdate("DELETE from stock WHERE ProductID = '"+id+"';");
+ if(status==1)
+ JOptionPane.showMessageDialog(null, "Product deleted");
+ else
+ JOptionPane.showMessageDialog(null, "ProductID not found!");
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+ public static void searchProduct(String id)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';");
+ if (!rs.next())
+ JOptionPane.showMessageDialog(null,"No product found with this id!");
+ else
+ JOptionPane.showMessageDialog(null, "ProductID: "+id+"\nQuantity: "+rs.getString("Quantity"));
+
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ public static void searchCashier(String email)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from users WHERE Email = '"+email+"';");
+ if (!rs.next())
+ JOptionPane.showMessageDialog(null,"No cashier found with this email!");
+ else
+ JOptionPane.showMessageDialog(null, "Email: "+email+"\nPassword: "+rs.getString("Password"));
+
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ public static boolean varifyLogin(String email,String pass)
+ {
+ boolean login=false;
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from users WHERE Email = '"+email+"' and Password = '"+pass+"';");
+ if (!rs.next())
+ login=false;
+ else
+ login=true;
+
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ return login;
+ }
+ public static void addCashier(String user,String pass)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ statement.executeUpdate("INSERT INTO users VALUES ('"+user+"','"+pass+"');");
+ JOptionPane.showMessageDialog(null, "Cashier added to database");
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ public static void deleteCashier(String user,String pass)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ int status=statement.executeUpdate("DELETE from users WHERE Email = '"+user+"' AND Password = '"+pass+"';");
+ if(status==1)
+ JOptionPane.showMessageDialog(null, "Cashier deleted");
+ else
+ JOptionPane.showMessageDialog(null, "Cashier not found!");
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ public static String searchPDetail(String id,int q)
+ {
+ Connection conn=DBConnection();
+ String rt="";
+ try {
+ int quan;
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';");
+ if (!rs.next())
+ rt="nill";
+ else{
+ quan=Integer.parseInt(rs.getString("Quantity"))-q;
+ if(quan<0)
+ rt="item is out of stock";
+ else
+ {
+ rt=rs.getString("Detail")+"%"+rs.getString("Company");
+ statement.executeUpdate("UPDATE stock set Quantity = "+quan+" WHERE ProductID = '"+id+"';");
+ }
+
+ }
+
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ return rt;
+ }
+ public static void addSaleToDB(Object data[],ArrayList comp,String name)
+ {
+ Connection conn=DBConnection();
+ DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
+ Date date = new Date();
+ String d=dateFormat.format(date);
+ try {
+ Statement statement = conn.createStatement();
+ for(int x=0;x getSale(String date,String comp)
+ {
+ String q;
+ ArrayList r=new ArrayList();
+
+ if(comp.equals("All"))
+ q="Select * from sale WHERE Date = '"+date+"';";
+ else
+ q="Select * from sale WHERE Date = '"+date+"' AND Company = '"+comp+"';";
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery(q);
+ while(rs.next())
+ {
+ r.add(rs.getString("Date"));
+ r.add(rs.getString("ProductID"));
+ r.add(rs.getString("Company"));
+ r.add(rs.getString("Payment"));
+ }
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ return r;
+ }
+
+ public static ArrayList showStock(String comp)
+ {
+ String q;
+ ArrayList r=new ArrayList();
+ if(comp.equals("All"))
+ q="Select * from stock;";
+ else
+ q="Select * from stock WHERE Company = '"+comp+"';";
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery(q);
+ while(rs.next())
+ {
+ r.add(rs.getString("ProductID"));
+ r.add(rs.getString("Detail"));
+ r.add(rs.getString("Company"));
+ r.add(rs.getString("Quantity"));
+ }
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ return r;
+ }
+
+ public static String getPDetail(String id,int q)
+ {
+ Connection conn=DBConnection();
+ String rt="";
+ try {
+ int quan;
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';");
+ if (!rs.next())
+ rt="nill";
+ else{
+ quan=Integer.parseInt(rs.getString("Quantity"))-q;
+ if(quan<0)
+ rt="item is out of stock";
+ else
+ {
+ rt=rs.getString("Detail")+"%"+rs.getString("Company");
+ statement.executeUpdate("UPDATE stock set Quantity = "+quan+" WHERE ProductID = '"+id+"';");
+ }
+
+ }
+
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ return rt;
+ }
+
+ public static ArrayList searchP(String id)
+ {
+ Connection conn=DBConnection();
+ ArrayList data=new ArrayList();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';");
+ if (rs.next())
+ {
+ data.add(rs.getString("Detail"));
+ data.add(rs.getString("Company"));
+ data.add(rs.getString("Quantity"));
+ }
+
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+ return data;
+ }
+
+ public static void updateProduct(String id,int quan)
+ {
+ Connection conn=DBConnection();
+ try {
+ Statement statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("Select * from stock WHERE ProductID = '"+id+"';");
+ int q=0;
+ if(rs.next())
+ {
+ q=Integer.parseInt(rs.getString("Quantity"))+quan;
+ statement.executeUpdate("UPDATE stock set Quantity = "+q+" WHERE ProductID = '"+id+"';");
+
+ }
+ conn.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+ public static void main(String args[])
+ {
+
+ }
+}
diff --git a/projects/Billing-System-master/src/Invoice.java b/projects/Billing-System-master/src/Invoice.java
new file mode 100644
index 0000000..047e7b9
--- /dev/null
+++ b/projects/Billing-System-master/src/Invoice.java
@@ -0,0 +1,249 @@
+
+
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JLabel;
+import java.awt.Font;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.JButton;
+import javax.swing.JTable;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.awt.event.ActionEvent;
+import java.awt.Color;
+
+public class Invoice extends JPanel {
+ private JTextField name;
+ private JTextField pID;
+ private JTextField pQuan;
+ private JTable items;
+ private JTextField UnitPrice;
+ JLabel lblName;
+ JLabel error ;
+ static int invo=1;
+ DefaultTableModel dtm;
+ Object data[];
+ JComboBox cType;
+ ArrayList comp=new ArrayList();
+ private JTextField dField;
+ long total=0;
+ JLabel gtotal ;
+
+ /**
+ * Create the panel.
+ */
+ public Invoice() {
+ setLayout(null);
+
+ JLabel lblCustomer = new JLabel("Customer");
+ lblCustomer.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblCustomer.setBounds(88, 59, 97, 23);
+ add(lblCustomer);
+
+ cType = new JComboBox();
+ cType.setBounds(201, 62, 89, 20);
+ add(cType);
+ cType.addItem("Walk-in customer");
+ cType.addItem("Company/customer name");
+ cType.setSelectedIndex(1);
+ cType.addItemListener(new ItemListener() {
+
+ @Override
+ public void itemStateChanged(ItemEvent arg0) {
+ // TODO Auto-generated method stub
+ if(cType.getSelectedIndex()==1)
+ {
+ lblName.setVisible(true);
+ name.setVisible(true);
+ }
+ else
+ {
+ lblName.setVisible(false);
+ name.setVisible(false);
+ }
+ }
+ });
+ lblName = new JLabel("Name");
+ lblName.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblName.setBounds(364, 59, 64, 23);
+ add(lblName);
+
+ name = new JTextField();
+ name.setBounds(438, 62, 150, 20);
+ add(name);
+ name.setColumns(10);
+
+ JLabel lblProductId = new JLabel("Product ID");
+ lblProductId.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductId.setBounds(88, 383, 80, 23);
+ add(lblProductId);
+
+ JLabel lblQuantity = new JLabel("Quantity");
+ lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblQuantity.setBounds(88, 174, 97, 23);
+ add(lblQuantity);
+
+ pID = new JTextField();
+ pID.setBounds(201, 133, 89, 20);
+ add(pID);
+ pID.setColumns(10);
+
+ pQuan = new JTextField();
+ pQuan.setColumns(10);
+ pQuan.setBounds(201, 177, 89, 20);
+ add(pQuan);
+
+ JButton btnAdd = new JButton("Add");
+ btnAdd.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ if(UnitPrice.getText().equals("")||pQuan.getText().equals("")||pID.getText().equals(""))
+ {
+ error.setText("Enter required data");
+ return;
+ }
+ else
+ error.setText("");
+
+ long up,fp,q;
+ String id,detail="";
+ up=Long.parseLong(UnitPrice.getText().trim());
+ q=Long.parseLong(pQuan.getText().trim());
+ id=pID.getText().trim();
+ UnitPrice.setText("");
+ pQuan.setText("");
+ pID.setText("");
+ fp=(up*q);
+ detail=DB.searchPDetail(id,(int)q);
+ String str[]=detail.split("%");
+ detail=str[0];
+ if(detail.equals("nill"))
+ {
+ error.setText("Invalid product id!");
+ return;
+ }
+ else if(detail.equals("item is out of stock"))
+ {
+ error.setText(detail);
+ return;
+ }
+ else
+ {
+ error.setText("");
+ comp.add(str[1]);
+ }
+ dtm.addRow(new Object[]{id,detail,up,q,fp});
+ total+=fp;
+ gtotal.setText(total+"");
+
+ }
+ });
+ btnAdd.setBounds(201, 265, 89, 23);
+ add(btnAdd);
+
+ String [] header={"Product ID","Item Details","Unit Price","Quantity","Final Price"};
+ dtm= new DefaultTableModel(header, 0);
+ items = new JTable(dtm);
+ items.setBounds(361, 135, 316, 298);
+ //add(items);
+ JScrollPane s=new JScrollPane(items);
+ s.setEnabled(false);
+ s.setBounds(361, 135, 392, 265);
+ add(s);
+
+ UnitPrice = new JTextField();
+ UnitPrice.setColumns(10);
+ UnitPrice.setBounds(201, 220, 89, 20);
+ add(UnitPrice);
+
+ JLabel lblUnitPrice = new JLabel("Unit Price");
+ lblUnitPrice.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblUnitPrice.setBounds(88, 217, 97, 23);
+ add(lblUnitPrice);
+
+ JButton btnPrint = new JButton("PRINT");
+ btnPrint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ int x=0;
+ String n="";
+ if(cType.getSelectedIndex()==1)
+ n=name.getText().trim();
+ data=new Object[dtm.getColumnCount()*dtm.getRowCount()];
+ for(int row=0;row comp ;
+ String com,dt;
+ static DefaultTableModel dtm;
+ ArrayList print=new ArrayList();
+ /**
+ * Create the panel.
+ */
+ public Sale() {
+ setLayout(null);
+
+ String [] header={"Date","Product ID","Company","Sale"};
+ dtm= new DefaultTableModel(header, 0);
+ sale = new JTable(dtm);
+ sale.setBounds(244, 69, 494, 379);
+ add(sale);
+ JScrollPane s=new JScrollPane(sale);
+ s.setBounds(244, 69, 494, 379);
+ add(s);
+
+ JButton btnPrint = new JButton("PRINT");
+ btnPrint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ Object data[]=new Object[dtm.getColumnCount()*dtm.getRowCount()];
+ int x=0;
+ long total=0;
+ for(int row=0;row();
+ comp.setBounds(62, 261, 86, 20);
+ add(comp);
+ comp.addItem("All");
+ comp.addItem("General");
+ comp.addItem("Mats & Rugs");
+ comp.addItem("N/S & Electric");
+
+
+
+ ms.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ ds.setSelected(false);
+ }
+ });
+ ds.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ ms.setSelected(false);
+ }
+ });
+ }
+
+ public static void dailySale(String dt,String com)
+ {
+ ArrayList sl=new ArrayList();
+ sl=DB.getSale(dt, com);
+ String x1,x2,x3,x4;
+ dtm.setRowCount(0);
+ int sz=sl.size()/4;
+ for(int x=0;x sl=new ArrayList();
+ String ndt;
+ dtm.setRowCount(0);
+ for(int x=1;x<=31;x++)
+ {
+ ndt=date[0]+"/"+date[1]+"/"+s[x].trim();
+ sl=DB.getSale(ndt, com);
+ String x1,x2,x3,x4;
+
+ int sz=sl.size()/4;
+ for(int i=0;i company;
+ String id,detail,comp;
+ int quan;
+ String err="Enter product id and quantity";
+ /**
+ * Create the panel.
+ */
+ public addProduct() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblAddProduct = new JLabel("ADD PRODUCT");
+ lblAddProduct.setBounds(328, 45, 115, 21);
+ lblAddProduct.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblAddProduct);
+
+ JLabel lblProductName = new JLabel("Product ID");
+ lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductName.setBounds(246, 136, 124, 21);
+ add(lblProductName);
+
+ JLabel lblProductDescription = new JLabel("Product Details\r\n");
+ lblProductDescription.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductDescription.setBounds(246, 168, 139, 21);
+ add(lblProductDescription);
+
+ idField = new JTextField();
+ idField.setBounds(449, 137, 136, 20);
+ add(idField);
+ idField.setColumns(10);
+
+ descField = new JTextArea();
+ descField.setBounds(449, 168, 136, 58);
+ add(descField);
+ JScrollPane scroll = new JScrollPane(descField);
+ scroll.setBounds(449, 168, 136, 58);
+ add(scroll);
+
+ JLabel lblCompany = new JLabel("Company");
+ lblCompany.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblCompany.setBounds(246, 241, 124, 21);
+ add(lblCompany);
+
+ JButton btnAddProduct = new JButton("Add Product");
+ btnAddProduct.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ if(quanField.getText().equals("")||idField.getText().equals(""))
+ {
+ error.setText(err);
+ }
+ else
+ {
+ error.setText("");
+ id=idField.getText().trim();
+ quan=Integer.parseInt(quanField.getText().trim());
+ detail=descField.getText().trim();
+ comp=company.getSelectedItem().toString();
+ DB.addProductToDB(id, detail, comp, quan);
+ idField.setText("");
+ quanField.setText("");
+ descField.setText("");
+ }
+ }
+ });
+ btnAddProduct.setBounds(449, 334, 136, 23);
+ add(btnAddProduct);
+
+ quanField = new JTextField();
+ quanField.setColumns(10);
+ quanField.setBounds(449, 274, 136, 20);
+ add(quanField);
+
+ JLabel lblQuantity = new JLabel("Items available");
+ lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblQuantity.setBounds(246, 273, 124, 21);
+ add(lblQuantity);
+
+ company = new JComboBox();
+ company.setBounds(449, 243, 136, 20);
+ add(company);
+
+ error = new JLabel("");
+ error.setForeground(Color.RED);
+ error.setBounds(339, 92, 265, 14);
+ add(error);
+ company.addItem("General");
+ company.addItem("Mats & Rugs");
+ company.addItem("N/S & Electric");
+
+ }
+}
diff --git a/projects/Billing-System-master/src/deleteCashier.java b/projects/Billing-System-master/src/deleteCashier.java
new file mode 100644
index 0000000..836e274
--- /dev/null
+++ b/projects/Billing-System-master/src/deleteCashier.java
@@ -0,0 +1,79 @@
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JPasswordField;
+import java.awt.Color;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class deleteCashier extends JPanel {
+
+ JTextField userField;
+ JButton btnDeleteCashier;
+ private JPasswordField passwordField;
+ private JLabel error;
+ String user,pass,err="Enter username and password";
+ /**
+ * Create the panel.
+ */
+ public deleteCashier() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblDeleteCashier = new JLabel("DELETE CASHIER");
+ lblDeleteCashier.setBounds(328, 45, 182, 21);
+ lblDeleteCashier.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblDeleteCashier);
+
+ JLabel lblUserName = new JLabel("User name");
+ lblUserName.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblUserName.setBounds(246, 104, 124, 21);
+ add(lblUserName);
+
+ JLabel lblPassword = new JLabel("Password");
+ lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblPassword.setBounds(246, 136, 124, 21);
+ add(lblPassword);
+
+ userField = new JTextField();
+ userField.setBounds(449, 106, 136, 20);
+ add(userField);
+ userField.setColumns(10);
+
+ btnDeleteCashier = new JButton("Delete Cashier");
+ btnDeleteCashier.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ user=userField.getText().trim();
+ pass=passwordField.getText().trim().toLowerCase();
+ if(user.equals("")||pass.equals(""))
+ error.setText(err);
+ else
+ {
+ error.setText("");
+ DB.deleteCashier(user,pass);
+ userField.setText("");
+ passwordField.setText("");
+ }
+ }
+ });
+ btnDeleteCashier.setBounds(449, 194, 136, 23);
+ add(btnDeleteCashier);
+
+ passwordField = new JPasswordField();
+ passwordField.setBounds(449, 138, 136, 19);
+ add(passwordField);
+
+ error = new JLabel("");
+ error.setForeground(Color.RED);
+ error.setBounds(277, 247, 248, 14);
+ add(error);
+
+ }
+
+}
diff --git a/projects/Billing-System-master/src/deleteProduct.java b/projects/Billing-System-master/src/deleteProduct.java
new file mode 100644
index 0000000..f43db81
--- /dev/null
+++ b/projects/Billing-System-master/src/deleteProduct.java
@@ -0,0 +1,68 @@
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import java.awt.Color;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class deleteProduct extends JPanel {
+
+ JTextField idField;
+ JButton btnDeleteProduct;
+ private JLabel error;
+ String id,err="Enter product id!";
+ /**
+ * Create the panel.
+ */
+ public deleteProduct() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblUpdateProduct = new JLabel("DELETE PRODUCT");
+ lblUpdateProduct.setBounds(319, 84, 182, 21);
+ lblUpdateProduct.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblUpdateProduct);
+
+ JLabel lblProductName = new JLabel("Product ID");
+ lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductName.setBounds(253, 156, 124, 21);
+ add(lblProductName);
+
+ idField = new JTextField();
+ idField.setBounds(449, 158, 136, 20);
+ add(idField);
+ idField.setColumns(10);
+
+ btnDeleteProduct = new JButton("Delete Product");
+ btnDeleteProduct.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ if(idField.getText().equals(""))
+ {
+ error.setText(err);
+ }
+ else
+ {
+ error.setText("");
+ id=idField.getText().trim();
+ DB.deleteProductToDB(id);
+ idField.setText("");
+ }
+ }
+ });
+ btnDeleteProduct.setBounds(449, 219, 136, 23);
+ add(btnDeleteProduct);
+
+ error = new JLabel("");
+ error.setForeground(Color.RED);
+ error.setBounds(349, 277, 217, 14);
+ add(error);
+
+ }
+
+}
diff --git a/projects/Billing-System-master/src/generateInvoice.java b/projects/Billing-System-master/src/generateInvoice.java
new file mode 100644
index 0000000..fe09fe0
--- /dev/null
+++ b/projects/Billing-System-master/src/generateInvoice.java
@@ -0,0 +1,108 @@
+
+
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JMenuBar;
+import java.awt.Toolkit;
+
+public class generateInvoice extends JFrame implements ActionListener{
+
+ private JPanel contentPane;
+ int jp;
+ ArrayList panels=new ArrayList();
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+ generateInvoice frame = new generateInvoice();
+ frame.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public generateInvoice() {
+ setIconImage(Toolkit.getDefaultToolkit().getImage("F:\\Working Directory\\fianl project with sql\\Bill\\logo.png"));
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ setBounds(100, 100, 850,600);
+
+ JMenuBar menuBar = new JMenuBar();
+ setJMenuBar(menuBar);
+
+ JMenu mnNewMenu = new JMenu("File");
+ menuBar.add(mnNewMenu);
+
+ JMenuItem mntmGenerateInvoice = new JMenuItem("Generate Invoice");
+ mnNewMenu.add(mntmGenerateInvoice);
+ mntmGenerateInvoice.addActionListener(this);
+
+ JMenuItem mntmSearch = new JMenuItem("Search Product");
+ mnNewMenu.add(mntmSearch);
+ mntmSearch.addActionListener(this);
+
+ JMenuItem mntmLogout = new JMenuItem("Logout");
+ mnNewMenu.add(mntmLogout);
+ mntmLogout.addActionListener(this);
+
+ contentPane = new JPanel();
+ contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+ setContentPane(contentPane);
+ contentPane.setLayout(new BorderLayout(0, 0));
+ searchProduct sp=new searchProduct();
+
+ panels.add(new Invoice());
+ panels.add(new searchProduct());
+ getContentPane().add(panels.get(0));
+ jp=0;
+ this.setTitle("Generate Invoice");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ if(e.getActionCommand().equals("Search Product"))
+ {
+ this.remove(panels.get(jp));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(1));
+ jp=1;
+ this.setVisible(true);
+ this.setTitle("Search Product");
+
+ }
+ else if(e.getActionCommand().equals("Generate Invoice"))
+ {
+ this.remove(panels.get(jp));
+ this.revalidate();
+ this.repaint();
+ getContentPane().add(panels.get(0));
+ this.setVisible(true);
+ jp=0;
+ this.setTitle("Generate Invoice");
+ }
+
+ else if(e.getActionCommand().equals("Logout"))
+ {
+ this.dispose();
+ }
+ }
+}
diff --git a/projects/Billing-System-master/src/pdfGenerator.java b/projects/Billing-System-master/src/pdfGenerator.java
new file mode 100644
index 0000000..71c1c36
--- /dev/null
+++ b/projects/Billing-System-master/src/pdfGenerator.java
@@ -0,0 +1,169 @@
+import java.awt.Desktop;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.Element;
+import com.itextpdf.text.Font;
+import com.itextpdf.text.Image;
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.Phrase;
+import com.itextpdf.text.Rectangle;
+import com.itextpdf.text.pdf.ColumnText;
+import com.itextpdf.text.pdf.PdfContentByte;
+import com.itextpdf.text.pdf.PdfPCell;
+import com.itextpdf.text.pdf.PdfPTable;
+import com.itextpdf.text.pdf.PdfWriter;
+import com.itextpdf.tool.xml.html.table.Table;
+
+public class pdfGenerator {
+
+ public static void makePdf(Object[] data,long total,int inv)
+ {
+ String invoice="_invoice_.pdf";
+ DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ Date date = new Date();
+ System.out.println(dateFormat.format(date)); //2016/11/16 12:08:43
+ Document document = new Document();
+
+ PdfWriter writer;
+
+ try {
+ writer = PdfWriter.getInstance(document, new FileOutputStream(invoice));
+
+
+ document.open();
+ Font f1 = new Font(Font.FontFamily.UNDEFINED, 18, Font.BOLD);
+ Paragraph p1= new Paragraph("CADDEY STORE",f1);
+
+ Paragraph p2= new Paragraph("Main Market Gulberg II Lahore");
+ Paragraph p3= new Paragraph("042-35712296\n\n\n");
+ Paragraph p4= new Paragraph("\n\nGrand Total: "+total,f1);
+ Paragraph p5= new Paragraph("\nThank you for visiting us�!!\nReturn/Exchange not possible with-out bill.");
+
+ p1.setAlignment(Element.ALIGN_CENTER);
+ p3.setAlignment(Element.ALIGN_CENTER);
+ p2.setAlignment(Element.ALIGN_CENTER);
+ document.add(p1);
+ document.add(p2);
+ document.add(p3);
+ Font f2 = new Font(Font.FontFamily.UNDEFINED, 8, Font.NORMAL);
+ Phrase phrase = new Phrase("Time/Date: "+dateFormat.format(date), f2);
+ PdfContentByte canvas = writer.getDirectContent();
+ ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, phrase, 40, 740, 0);
+ Phrase invNo = new Phrase("Invoice No. "+inv, f2);
+ PdfContentByte canv = writer.getDirectContent();
+ ColumnText.showTextAligned(canv, Element.ALIGN_LEFT, invNo, 510, 785, 0);
+ Image image;
+ try {
+ image = Image.getInstance("E:\\XAMPP\\htdocs\\logo.png");
+ image.setAbsolutePosition(10f, 730f);
+ document.add(image);
+
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ PdfPTable table = new PdfPTable(5);
+ float[] columnWidths = new float[] {15f, 30f, 10f, 10f,15f};
+ table.setWidths(columnWidths);
+ table.addCell("Product ID");
+
+ table.addCell("Item Detail");
+ table.addCell("Unit Price");
+ table.addCell("Quantity");
+ table.addCell("Total Price");
+ for(int aw = 0; aw < data.length; aw++){
+ table.addCell(data[aw]+"");
+ }
+ document.add(table);
+ document.add(p4);
+ document.add(p5);
+ // writer.close();
+ document.close();
+ sendIn2printer(invoice);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ public static void makePdf2(Object[] data,long total)
+ {
+ String sale="_sale_.pdf";
+ Document document = new Document();
+
+ PdfWriter writer;
+
+ try {
+ writer = PdfWriter.getInstance(document, new FileOutputStream(sale));
+
+
+ document.open();
+ Font f1 = new Font(Font.FontFamily.UNDEFINED, 18, Font.BOLD);
+ Paragraph p1= new Paragraph("CADDEY STORE",f1);
+
+ Paragraph p2= new Paragraph("Main Market Gulberg II Lahore");
+ Paragraph p3= new Paragraph("042-35712296\n\n\n");
+ Paragraph p4= new Paragraph("\n\nGrand Total: "+total,f1);
+
+ p1.setAlignment(Element.ALIGN_CENTER);
+ p3.setAlignment(Element.ALIGN_CENTER);
+ p2.setAlignment(Element.ALIGN_CENTER);
+ document.add(p1);
+ document.add(p2);
+ document.add(p3);
+
+ PdfPTable table = new PdfPTable(4);
+ table.addCell("Date");
+ table.addCell("Product ID");
+ table.addCell("Company");
+ table.addCell("Sale");
+ for(int aw = 0; aw < data.length; aw++){
+ table.addCell(data[aw]+"");
+ }
+ document.add(table);
+ document.add(p4);
+
+ // writer.close();
+ document.close();
+ sendIn2printer(sale);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public static void sendIn2printer(String file)
+ { //The desktop api can help calling other applications in our machine
+ //and also many other features...
+ Desktop desktop = Desktop.getDesktop();
+ try {
+ //desktop.print(new File("DocXfile.docx"));
+ desktop.print(new File(file));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }}
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/projects/Billing-System-master/src/searchCashier.java b/projects/Billing-System-master/src/searchCashier.java
new file mode 100644
index 0000000..04a65e0
--- /dev/null
+++ b/projects/Billing-System-master/src/searchCashier.java
@@ -0,0 +1,68 @@
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import java.awt.Color;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class searchCashier extends JPanel {
+
+ JTextField idField;
+ JButton btnUpdateProduct;
+ private JLabel error;
+ String id,err="Enter product id!";
+ /**
+ * Create the panel.
+ */
+ public searchCashier() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblsearch = new JLabel("SEARCH CASHIER");
+ lblsearch.setBounds(319, 84, 182, 21);
+ lblsearch.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblsearch);
+
+ JLabel lbluser = new JLabel("User name");
+ lbluser.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lbluser.setBounds(253, 156, 124, 21);
+ add(lbluser);
+
+ idField = new JTextField();
+ idField.setBounds(449, 158, 136, 20);
+ add(idField);
+ idField.setColumns(10);
+
+ btnUpdateProduct = new JButton("Search");
+ btnUpdateProduct.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ if(idField.getText().equals(""))
+ {
+ error.setText(err);
+ }
+ else
+ {
+ error.setText("");
+ id=idField.getText().trim();
+ DB.searchCashier(id);
+ idField.setText("");
+ }
+ }
+ });
+ btnUpdateProduct.setBounds(449, 219, 136, 23);
+ add(btnUpdateProduct);
+
+ error = new JLabel("");
+ error.setForeground(Color.RED);
+ error.setBounds(349, 277, 217, 14);
+ add(error);
+
+ }
+
+}
diff --git a/projects/Billing-System-master/src/searchProduct.java b/projects/Billing-System-master/src/searchProduct.java
new file mode 100644
index 0000000..fd788ab
--- /dev/null
+++ b/projects/Billing-System-master/src/searchProduct.java
@@ -0,0 +1,68 @@
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import java.awt.Color;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class searchProduct extends JPanel {
+
+ JTextField idField;
+ JButton btnSearch;
+ private JLabel error;
+ String id,err="Enter product id!";
+ /**
+ * Create the panel.
+ */
+ public searchProduct() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblSearchProduct = new JLabel("SEARCH PRODUCT");
+ lblSearchProduct.setBounds(319, 84, 182, 21);
+ lblSearchProduct.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblSearchProduct);
+
+ JLabel lblProductName = new JLabel("Product ID");
+ lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductName.setBounds(253, 156, 124, 21);
+ add(lblProductName);
+
+ idField = new JTextField();
+ idField.setBounds(449, 158, 136, 20);
+ add(idField);
+ idField.setColumns(10);
+
+ btnSearch = new JButton("Search");
+ btnSearch.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ if(idField.getText().equals(""))
+ {
+ error.setText(err);
+ }
+ else
+ {
+ error.setText("");
+ id=idField.getText().trim();
+ DB.searchProduct(id);
+ idField.setText("");
+ }
+ }
+ });
+ btnSearch.setBounds(449, 219, 136, 23);
+ add(btnSearch);
+
+ error = new JLabel("");
+ error.setForeground(Color.RED);
+ error.setBounds(349, 277, 217, 14);
+ add(error);
+
+ }
+
+}
diff --git a/projects/Billing-System-master/src/showStock.java b/projects/Billing-System-master/src/showStock.java
new file mode 100644
index 0000000..f238d84
--- /dev/null
+++ b/projects/Billing-System-master/src/showStock.java
@@ -0,0 +1,131 @@
+import java.awt.Font;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import javax.swing.JPasswordField;
+import javax.swing.JTable;
+import javax.swing.JComboBox;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.awt.Color;
+
+public class showStock extends JPanel {
+ private JTable stockTable;
+ JComboBox comp;
+ DefaultTableModel model;
+ /**
+ * Create the panel.
+ */
+ public showStock() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblStock = new JLabel("AVAILABLE STOCK");
+ lblStock.setBounds(328, 26, 182, 21);
+ lblStock.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblStock);
+
+ model = new DefaultTableModel();
+ stockTable = new JTable(model);
+ stockTable.setBounds(98, 112, 645, 397);
+ add(stockTable);
+ model.addColumn("Product ID");
+ model.addColumn("Product Detail");
+ model.addColumn("Company");
+ model.addColumn("Quantity");
+ JScrollPane scroll = new JScrollPane(stockTable);
+ scroll.setBounds(98, 112, 645, 397);
+ add(scroll);
+
+ comp = new JComboBox();
+ comp.setBackground(Color.WHITE);
+ comp.setBounds(583, 81, 160, 20);
+ add(comp);
+ comp.addItem("All");
+ comp.addItem("General");
+ comp.addItem("Mats & Rugs");
+ comp.addItem("N/S & Electric");
+ comp.addItemListener(new ItemListener() {
+
+ @Override
+ public void itemStateChanged(ItemEvent arg0) {
+ // TODO Auto-generated method stub
+ updateTable();
+ }
+ });
+
+ JLabel lblCompany = new JLabel("Company");
+ lblCompany.setBounds(582, 68, 161, 14);
+ add(lblCompany);
+
+ JButton btnExportToExcel = new JButton("Export to Excel");
+ btnExportToExcel.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ toExcel(stockTable, new File("availableStock.xls"));
+ JOptionPane.showMessageDialog(null, "Export file created");
+ }
+ });
+ btnExportToExcel.setBounds(605, 525, 138, 23);
+ add(btnExportToExcel);
+
+ JButton btnRefresh = new JButton("Refresh");
+ btnRefresh.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ updateTable();
+ }
+ });
+ btnRefresh.setBounds(457, 525, 138, 23);
+ add(btnRefresh);
+ updateTable();
+
+ }
+
+ public void updateTable()
+ {
+ model.setRowCount(0);
+ ArrayList stock=new ArrayList();
+ stock=DB.showStock(comp.getSelectedItem().toString());
+ for(int x=0;x company;
+ private JTextField quanField;
+ JLabel error ;
+ String id,detail,comp;
+ int quan;
+ String err="Enter product id and quantity";
+ /**
+ * Create the panel.
+ */
+ public updateProduct() {
+ setLayout(null);
+ setBounds(100, 100, 840, 619);
+ JLabel lblUpdateProduct = new JLabel("UPDATE PRODUCT");
+ lblUpdateProduct.setBounds(328, 45, 182, 21);
+ lblUpdateProduct.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ add(lblUpdateProduct);
+
+ JLabel lblProductName = new JLabel("Product ID");
+ lblProductName.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductName.setBounds(246, 136, 124, 21);
+ add(lblProductName);
+
+ JLabel lblProductDescription = new JLabel("Product detail\r\n");
+ lblProductDescription.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblProductDescription.setBounds(246, 168, 139, 21);
+ add(lblProductDescription);
+
+ idField = new JTextField();
+ idField.setBounds(449, 137, 136, 20);
+ add(idField);
+ idField.setColumns(10);
+
+ descField = new JTextArea();
+ descField.setBounds(449, 168, 136, 58);
+ add(descField);
+ JScrollPane scroll = new JScrollPane(descField);
+ scroll.setBounds(449, 168, 136, 58);
+ add(scroll);
+
+ JLabel lblCompany = new JLabel("Company");
+ lblCompany.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblCompany.setBounds(246, 241, 124, 21);
+ add(lblCompany);
+ idField.addKeyListener(new KeyListener() {
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ // TODO Auto-generated method stub
+ id=idField.getText().trim()+e.getKeyChar();
+ ArrayList data=DB.searchP(id);
+ if(data.size()==3)
+ {
+ descField.setText(data.get(0));
+ quanField.setText(data.get(2));
+ switch(data.get(1))
+ {
+ case "General":company.setSelectedIndex(0);break;
+ case "Mats & Rugs":company.setSelectedIndex(1);break;
+ case "N/S & Electric":company.setSelectedIndex(2);break;
+ }
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void keyPressed(KeyEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ btnUpdateProduct = new JButton("Update Product");
+ btnUpdateProduct.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ if(quanField.getText().equals("")||idField.getText().equals(""))
+ {
+ error.setText(err);
+ }
+ else
+ {
+ error.setText("");
+ id=idField.getText().trim();
+ quan=Integer.parseInt(quanField.getText().trim());
+ detail=descField.getText().trim();
+ comp=company.getSelectedItem().toString();
+ DB.updateProductToDB(id, detail, comp, quan);
+ idField.setText("");
+ quanField.setText("");
+ descField.setText("");
+ }
+ }
+ });
+ btnUpdateProduct.setBounds(449, 338, 136, 23);
+ add(btnUpdateProduct);
+
+ quanField = new JTextField();
+ quanField.setColumns(10);
+ quanField.setBounds(449, 278, 136, 20);
+ add(quanField);
+
+ JLabel lblQuantity = new JLabel("Items available");
+ lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ lblQuantity.setBounds(246, 276, 124, 21);
+ add(lblQuantity);
+
+ company = new JComboBox();
+ company.setBounds(449, 243, 136, 20);
+ add(company);
+
+ error = new JLabel("");
+ error.setForeground(Color.RED);
+ error.setBounds(299, 95, 286, 14);
+ add(error);
+ company.addItem("General");
+ company.addItem("Mats & Rugs");
+ company.addItem("N/S & Electric");
+
+ }
+
+}
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket1.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/Cricket1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dfg.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dfg.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dg.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/dg.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/filelist.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/filelist.txt
new file mode 100644
index 0000000..6f560b6
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/filelist.txt
@@ -0,0 +1,10 @@
+dfg
+dg
+x
+we1
+raj
+rajendra
+nepal
+nepal12
+Cricket
+Cricket1
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal12.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/nepal12.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/raj.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/raj.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/rajendra.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/rajendra.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/we1.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/we1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/x.txt b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/Files/x.txt
new file mode 100644
index 0000000..e69de29
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/bin/Debug/scoresheet.exe b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/bin/Debug/scoresheet.exe
new file mode 100644
index 0000000..1ca4b70
Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/bin/Debug/scoresheet.exe differ
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/declaration.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/declaration.h
new file mode 100644
index 0000000..c2457ed
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/declaration.h
@@ -0,0 +1,91 @@
+//Header Files used in the program//
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+FILE *fnew;
+HANDLE rHnd, wHnd;
+//int current,extrarunsA,extrarunsB,bowlingcurrent,wicketnumber,teamAtotalruns=0,teamBtotalruns=0,teamAtotalovers=0,teamBtotalovers=0;
+char input;
+
+//List of functions used//
+int initializeconsolehandles();//for initializing handles//
+void file();//for file IO//
+void locate(int,int);//for locating the cursor position//
+void tab1(); //for updating the game records//
+void tab2();//for how out input//
+void tab3();//for new bowler input//
+void tab4();//for new batsbaninput//
+void tab5();//for end of innings//
+void date();//for storing todays date//
+/*void timestart();//for timestart input//
+void timestop();//for timestop input//*/
+
+//data structures used in the program//
+struct team//for the record of batting team//
+{
+ char timein[9];
+ char timeout[9];
+ char batsmanname[50];
+ int _4s;
+ int _6s;
+ int ballsfaced;
+ char timeplayed[9];
+ char howout[20];
+ char fielder[30];
+ char bowler[30];
+ int totalruns;
+ int mtsplayed;
+} teamA[11],teamB[11];
+
+struct bowlingteam//for the record of bowling team//
+{
+ char bowler[30];
+ int ballthrownincurrentover;
+ int overs;
+ int maidens;
+ int runs;
+ int wickets;
+ int noballs;
+ int wides;
+ float average;
+} bowlingteamA[8],bowlingteamB[8];
+
+struct gamedetails//for the records of game details//
+{
+ char competition[20];
+ char playedAt[50];
+ char venue[30];
+ char matchbetween[30];
+ char versus[30];
+ char tosswonby[30];
+ char electedto[20];
+ int inningsof;
+ char date[30];
+ char input;
+ int overs;
+} gamedetailA,gamedetailB;
+
+struct wickets
+{
+ int atruns;
+ int overnumber;
+} wicketsA[8],wicketsB[8];
+
+
+struct undo
+{
+ struct team teamArecord[11];
+ struct team teamBrecord[11];
+ struct bowlingteam bowlingteamArecord[8];
+ struct bowlingteam bowlingteamBrecord[8];
+ struct wickets wicketsArecord[8];
+ struct wickets wicketsBrecord[8];
+} steps[10];
+
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/filing.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/filing.h
new file mode 100644
index 0000000..dec4a0d
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/filing.h
@@ -0,0 +1,63 @@
+void filing()
+{
+// system("cls");
+// locate(20,8);
+// FILE *newfile,*filelist;
+// char filename[20];
+// char extension[]=".dat";
+// char filenamewithdirectory[]="Files//";
+// char filenamecheck[20];
+// char filenamecheckvar;
+// int i=0,flag=1;
+// filelist=fopen("Files//filelist.txt","a+");
+// if(filelist==NULL)
+// {
+// printf(" File Listing Error...");
+// exit(1);
+// }
+// while(flag==1)
+// {
+// if (flag==1)
+// {
+// printf("\nPlease enter the new file name:");
+// scanf(" %[^\n]",filename);
+// i=0;
+// }
+// rewind(filelist);
+// while(filenamecheckvar!=EOF)
+// {
+// filenamecheckvar=fgetc(filelist);
+// filenamecheck[i]=filenamecheckvar;
+// if(filenamecheckvar=='\n')
+// {
+// filenamecheck[i]='\0';
+// i=-1;
+// if(strcmp(filenamecheck,filename)==0)
+// {
+// printf("Filename already exists.Please give new filename:");
+// flag=1;
+// break;
+// }
+// }
+// i++;
+// flag=0;
+// }
+// }
+// fseek(filelist,0,SEEK_END);
+// fprintf(filelist,"%s",filename);
+// fprintf(filelist,"\n");
+// fclose(filelist);
+// strcat(filename,extension);
+// strcat(filenamewithdirectory,filename);
+// strcpy(file,filenamewithdirectory);
+// newfile=fopen(filenamewithdirectory,"w");
+// if(newfile==NULL)
+// {
+// printf("File opening Error...");
+// exit(1);
+// }
+// printf("Creating file...\n");
+// Sleep(3000);
+// printf("File Created.");
+// Sleep(1000);
+ }
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/final.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/final.h
new file mode 100644
index 0000000..e1b472a
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/final.h
@@ -0,0 +1,589 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+HANDLE rHnd, wHnd;
+int initializeconsolehandles();
+void locate(int,int);
+void print();
+void initialize();
+int runsinoneover[50],runsinprevover=0,flagg=0;
+int position=1,undoupdatevariable=0,newbatsmancounter[11],newbatsmanincrement=0,current,extrarunsA,extrarunsB,bowlingcurrent,wicketnumber,teamAtotalruns=0,teamBtotalruns=0,teamAtotalovers=0,teamBtotalovers=0;
+
+
+void final()//Function to give the input//
+{
+ int a,key;
+ char b;
+ char lastinput;
+ input='0';
+ while(input!=27)//to end the input loop//
+ {
+ printt();
+ while(1)
+ {
+ locate(0,33);
+ printf("Enter runs made |1|2|3|4|5|6|");
+ locate(30,33);
+ // locate(40,33);
+ fflush(stdin);
+ if ((input=getche()) == -32)//for arrow key switching//
+ input = getche();
+
+ fflush(stdin);
+ if(input==75||input==77)
+ {
+ printf("\b ");
+ if(input==75);
+ //tab5();
+ else
+ tab2();
+ }
+ else if(input=='\b')
+ {
+ printf(" ");
+ continue;
+ }
+ else if (input == '\r')//processes the input only when pressed enter//
+ {
+ input=toupper(lastinput);
+ // undoupdate();//excluded in the output//
+ tab1();
+ break;
+ }
+ else if (input=='0'||input=='1'||input=='2'||input=='3'||input=='4'||input=='6'||toupper(input)=='W'||toupper(input)=='N')
+ lastinput = input;
+ else if(input==27)
+ {
+ printf("\b ");
+ break;
+ }
+ else
+ printf("\a\b ");
+ continue;
+ }
+ }
+
+}
+
+
+void tab1()
+{
+ int calledfromwide=0,T;
+ char a;
+
+start:
+ if(input=='0')
+ {
+ if(calledfromwide==1)
+ {
+ teamA[current].totalruns=0;
+ extrarunsA+=0;
+ }
+ else
+ {
+ teamA[current].ballsfaced++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover++;
+ if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6)
+ {
+ bowlingteamA[bowlingcurrent].overs++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover=0;
+ ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns);
+ }
+ }
+ }
+ if(input=='1')
+ {
+ if(calledfromwide==1)
+ {
+ bowlingteamA[bowlingcurrent].runs+=1;
+ teamA[current].totalruns++;
+ extrarunsA+=1;
+ }
+ else
+ {
+ bowlingteamA[bowlingcurrent].runs+=1;
+ teamA[current].totalruns+=1;
+ teamA[current].ballsfaced++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover++;
+ if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6)
+ {
+ bowlingteamA[bowlingcurrent].overs++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover=0;
+ ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns);
+ }
+ }
+ }
+ if(input=='2')
+ {
+ if(calledfromwide==1)
+ {
+ bowlingteamA[bowlingcurrent].runs+=2;
+ teamA[current].totalruns+=2;
+ extrarunsA+=2;
+ }
+ else
+ {
+ bowlingteamA[bowlingcurrent].runs+=2;
+ teamA[current].totalruns+=2;
+ teamA[current].ballsfaced++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover++;
+ if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6)
+ {
+ bowlingteamA[bowlingcurrent].overs++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover=0;
+ ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns);
+ }
+ }
+ }
+ if(input=='3')
+ {
+ if(calledfromwide==1)
+ {
+ bowlingteamA[bowlingcurrent].runs+=3;
+ teamA[current].totalruns+=3;
+ extrarunsA+=3;
+ }
+ else
+ {
+ bowlingteamA[bowlingcurrent].runs+=3;
+ teamA[current].totalruns+=3;
+ teamA[current].ballsfaced++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover++;
+ if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6)
+ {
+ bowlingteamA[bowlingcurrent].overs++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover=0;
+ ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns);
+ }
+ }
+ }
+ if(input=='4')
+ {
+ if(calledfromwide==1)
+ {
+ bowlingteamA[bowlingcurrent].runs+=4;
+ teamA[current].totalruns+=4;
+ extrarunsA+=4;
+ teamA[current]._4s++;
+ }
+ else
+ {
+ bowlingteamA[bowlingcurrent].runs+=4;
+ teamA[current].totalruns+=4;
+ teamA[current].ballsfaced++;
+ teamA[current]._4s++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover++;
+ if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6)
+ {
+ bowlingteamA[bowlingcurrent].overs++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover=0;
+ ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns);
+ }
+ }
+ }
+ if(input=='6')
+ {
+ if(calledfromwide==1)
+ {
+ bowlingteamA[bowlingcurrent].runs+=6;
+ teamA[current].totalruns+=6;
+ extrarunsA+=6;
+ teamA[current]._6s++;
+ }
+ else
+ {
+ bowlingteamA[bowlingcurrent].runs+=6;
+ teamA[current].totalruns+=6;
+ teamA[current].ballsfaced++;
+ teamA[current]._6s++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover++;
+ if(bowlingteamA[bowlingcurrent].ballthrownincurrentover==6)
+ {
+ bowlingteamA[bowlingcurrent].overs++;
+ bowlingteamA[bowlingcurrent].ballthrownincurrentover=0;
+ ovatglance(bowlingteamA[bowlingcurrent].overs,teamA[current].totalruns);
+ }
+ }
+ }
+ if(input=='N')//for noballs
+ {
+ bowlingteamA[bowlingcurrent].runs+=1;
+ bowlingteamA[bowlingcurrent].noballs++;
+ teamA[current].totalruns++;
+ calledfromwide=1;
+ locate(0,34);
+ printf("Enter the runs made:0/1/2/3/4/6");
+ T=0;
+ while(T==0)
+ {
+ scanf(" %c",&input);
+ if(input=='0'||input=='1'||input=='2'||input=='3'||input=='4'||input=='5'||input=='6')
+ {
+ T=1;
+ goto start;
+ }
+ else
+ {
+ T=0;
+ printf("Invalid Input.Input:0/1/2/3/4/6");
+ }
+ }
+ }
+ if(input=='W')//for noballs
+ {
+ bowlingteamA[bowlingcurrent].runs+=1;
+ bowlingteamA[bowlingcurrent].wides++;
+ teamA[current].totalruns++;
+ calledfromwide=1;
+ locate(0,34);
+ printf("Enter the runs made:0/1/2/3/4/6:");
+ T=0;
+ while(T==0)
+ {
+ scanf(" %c",&input);
+ if(input=='0'||input=='1'||input=='2'||input=='3'||input=='4'||input=='5'||input=='6')
+ {
+ T=1;
+ goto start;
+ }
+ else
+ {
+ T=0;
+ locate(0,34);
+ printf("Invalid Input.Input:0/1/2/3/4/6 :");
+ }
+ }
+ }
+
+ float overs=bowlingteamA[bowlingcurrent].overs+((bowlingteamA[bowlingcurrent].ballthrownincurrentover)/6.);
+ // if(overs==0&&bowlingteamA[bowlingcurrent].ballthrownincurrentover==0)
+ // bowlingteamA[bowlingcurrent].average=0;
+ // else
+ bowlingteamA[bowlingcurrent].average=
+ bowlingteamA[bowlingcurrent].runs/overs;
+ calledfromwide=0;
+
+}
+
+void tab2()
+{
+ int a;
+
+ while(1)
+ {
+ locate(28,34);
+ printf("How out?");
+ locate(28,35);
+ printf("Fielding='F'");
+ locate(28,36);
+ printf("Catch-Out='C'");
+ locate(28,37);
+ printf("Wicket='W'");
+ locate(28,33);
+ char temp;
+
+ fflush(stdin);
+ if ((input = getche()) == -32)
+ input = getche();
+ fflush(stdin);
+ if(input==75||input==77)
+ {
+ printf("\b ");
+ locate(28,34);
+ printf(" ");
+ locate(28,35);
+ printf(" ");
+ locate(28,36);
+ printf(" ");
+ locate(28,37);
+ printf(" ");
+ locate(28,33);
+ if(input==77)
+ {
+ tab3();
+ //return ;
+ }
+ else if(input==75)
+ {
+ fflush(stdin);
+ return;
+
+ }
+ }
+ else if(input=='\b')
+ {
+ printf(" ");
+ continue;
+ }
+ else if (input == '\r')
+ {
+ input=toupper(temp);
+ break;
+ }
+
+ else if(input=='F'||input=='C'||input=='W'||input=='f'||input=='c'||input=='w')
+ {
+ temp=input;
+ continue;
+ }
+ else
+ {
+ printf("\a\b\b \b");
+ }
+ }
+ locate(28,34);
+ printf(" ");
+ locate(28,35);
+ printf(" ");
+ locate(28,36);
+ printf(" ");
+ locate(28,37);
+ printf(" ");
+ input=toupper(input);
+ if(toupper(input)=='W')
+ {
+ strcpy(teamA[current].howout,"Wicket");
+ wicketnumber++;
+ wicketsA[wicketnumber].atruns = teamAtotalruns;
+ wicketsA[wicketnumber].overnumber = teamAtotalovers+1;
+ locate(28,34);
+ printf("Enter the fielder's name:");
+ gets(teamA[current].fielder);
+ locate(28,34);
+ printf(" ");
+ tab4();
+ }
+ if(toupper(input)=='C')
+ {
+ strcpy(teamA[current].howout,"Catchout");
+ wicketnumber++;
+ wicketsA[wicketnumber].atruns = teamAtotalruns;
+ wicketsA[wicketnumber].overnumber = teamAtotalovers+1;
+ locate(28,34);
+ printf("Enter the fielder's name:");
+ gets(teamA[current].fielder);
+ locate(28,34);
+ printf(" ");
+ tab4();
+ }
+ if(toupper(input)=='F')
+ {
+ strcpy(teamA[current].howout,"Fielding");
+ wicketnumber++;
+ tab1(input);
+ wicketsA[wicketnumber].atruns = teamAtotalruns;
+ wicketsA[wicketnumber].overnumber = teamAtotalovers+1;
+ locate(28,34);
+ printf("Enter the fielder's name:");
+ gets(teamA[current].fielder);
+ locate(28,34);
+ printf(" ");
+ tab4();
+ }
+}
+
+void tab3()
+{
+ while(1)
+ {
+
+ char temp;
+ fflush(stdin);
+ locate(37,34);
+ printf("Select the bowler no.");
+ fflush(stdin);
+ locate(37,33);
+ if ((input=getche()) ==-32)
+ input = getche();
+ fflush(stdin);
+ if(input==75||input==77)
+ {
+ printf("\b ");
+ locate(37,34);
+ printf(" ");
+ if(input==75)
+ //tab2();
+ return;
+ if (input==77)
+ tab4();
+ }
+ else if(input=='\b')
+ {
+ printf(" ");
+ continue;
+ }
+ else if (input == '\r')
+ {
+ input=temp;
+ break;
+ }
+ else if(input=='1'||input=='2'||input=='3'||input=='4'||input=='5'||input=='6'||input=='7'||input=='8')
+ {
+ temp=input;
+ continue;
+ }
+ else
+ {
+ printf("\a\b\b \b");
+ }
+ }
+ bowlingcurrent = input-49;
+ locate(37,33);
+ printf(" ");
+ locate(37,34);
+ printf(" ");
+ return;
+}
+
+void tab4()
+{
+ int currentinput = -1,number = 0;
+ fflush(stdin);
+
+ while (1){
+ locate(52,34);
+ printf("Select the new ");
+ locate(52,35);
+ printf("batsman no.from ");
+ locate(52,36);
+ printf("above list.");
+ if (currentinput == -1) locate(52,33) ; else locate (53,33);
+ if ((input=getch()) == -32)
+ input = getch();
+ fflush(stdin);
+
+ if(input==75||input==77)
+ {
+ printf("\b\b ");
+ locate(52,34);
+ printf(" ");
+ locate(52,35);
+ printf(" ");
+ locate(52,36);
+ printf(" ");
+ if(input==75)
+ //tab3();
+ return;
+ if (input==77)
+ {
+ tab5();
+ //return;
+ }
+ }
+ else if(input >= '0' && input <='9' && number !=1)
+
+ {
+ if (currentinput == -1)
+ {
+ printf ("%c",input);
+ currentinput= input - '0';
+ currentinput *= 10;
+ }
+ else{
+ if ((currentinput <10) || ( (input =='0' || input == '1') && currentinput>9))
+ {printf ("%c",input);
+ currentinput += input - '0';
+ number = 1; //Two numbers entered
+ }}
+ }
+
+
+ else if (input == '\b')
+ {
+ if (number ==1 )printf ("\b \b\b"); else printf ("\b \b");
+ currentinput = -1;
+ number = 0;
+ }
+ else if (input == '\r')
+ {current=currentinput -1;
+ //printf("%d",current);
+ fflush(stdin);
+
+ }
+ }
+}
+void tab5()
+{
+ while(1)
+ {
+
+ char ch;
+ fflush(stdin);
+ locate(68,34);
+ printf("Do you want ");
+ locate(68,35);
+ printf("to end the ");
+ locate(68,36);
+ printf("inning?");
+ locate(68,33);
+ if ((input=getch()) == -32)
+ input = getch();
+ ch=input;
+ fflush(stdin);
+ if(input==75||input==77)
+ {
+ printf("\b ");
+ locate(68,34);
+ printf(" ");
+ locate(68,35);
+ printf(" ");
+ locate(68,36);
+ printf(" ");
+ if(input==75)
+ //tab4();
+ return;
+ if (input==77)
+ {
+ fflush(stdin);
+ //tab1();
+ //return;
+ }
+ }
+ if(toupper(input)=='Y')
+ {
+ locate(68,34);
+ printf(" ");
+ locate(68,35);
+ printf(" ");
+ locate(68,36);
+ printf(" ");
+ return;
+ }
+ else
+ printf("\a\b ");
+ }
+ fflush(stdin);
+ return;
+}
+
+int initializeconsolehandles()
+{
+ rHnd = GetStdHandle(STD_INPUT_HANDLE);
+ wHnd = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (rHnd && wHnd)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+void locate(int x, int y)
+{
+ COORD pos = {x,y};
+ SetConsoleCursorPosition (wHnd,pos);
+
+}
+
+int ovatglance(int overs,int runs)
+{
+
+ int i=1;
+ runsinoneover[overs]=runs-runsinprevover;
+ runsinprevover=runs;
+ if(runsinoneover[overs]==0)
+ bowlingteamA[bowlingcurrent].maidens++;
+ return;
+}
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/main.c b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/main.c
new file mode 100644
index 0000000..8bd409c
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/main.c
@@ -0,0 +1,36 @@
+#include"declaration.h"
+#include"welcome.h"
+#include"menu.h"
+#include"newscoresheet.h"
+#include"filing.h"
+#include"final.h"
+int main()
+{
+ system("color f1");
+ int a,key;
+ char b,ch;
+ FILE *fnew;
+
+ char lastinput;
+ while (TRUE)
+ {
+ initializeconsolehandles();
+ welcome();
+ system("cls");
+ menu();
+ locate(32,9);
+ ch=getch();
+ switch(ch)
+ {
+ case '1':
+ fileopen(ch);
+ case '2':
+ fileopen(ch);
+ getch();
+ case '3':
+ system ("cls");
+ exit(0);
+ }
+ }
+}
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/menu.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/menu.h
new file mode 100644
index 0000000..f46f7dc
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/menu.h
@@ -0,0 +1,9 @@
+void menu()
+{
+ printf("\n\n\t\t\t\t\tMENU:\n");
+ printf("\n\n\n\t\t\t\t1.New scoresheet:\n");
+ printf("\t\t\t\t2.View scoresheet:\n");
+ printf("\t\t\t\t3.Exit:\n\t\t");
+}
+
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/newscoresheet.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/newscoresheet.h
new file mode 100644
index 0000000..4898f2e
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/newscoresheet.h
@@ -0,0 +1,546 @@
+void date();//to store todays date//
+void printt();//for printing the output//
+void filewrite();//for writing to the file//
+void fileread();//for accessing from the file//
+void fileopen(char);
+void limitinput(int);
+int limitedinput(int);
+FILE *newfile,*filelist;
+char filenamewithdirectory[50];//to pass the filename with its directory location//
+char output[100];
+void newscoresheet()
+{
+ system("color f4");
+ int j,ln,number;
+ char text[50],ch;
+ system("cls");
+ locate(20,8);
+ char filename[20],array[100];
+ char extension[]=".txt";
+ char filenamewithdirectory[]="Files//";
+ char filenamecheck[20];
+ char filenamecheckvar;
+ int i=0,flag=1,n=15;
+ system("cls");
+ initializeconsolehandles();
+ printt();
+ flag=0;
+ while(1)
+ {
+ if(flag==0)
+ {
+ fflush(stdin);
+ locate(13,0);
+ fflush(stdin);
+ limitinput(n);
+ strcpy(gamedetailA.competition,output);
+ flag=1;
+ n=20;
+ }
+ if (flag==1)
+ {
+ locate(42,0);
+ limitinput(n);
+ strcpy(gamedetailA.venue,output);
+ fflush(stdin);
+ flag=2;
+ n=10;
+ }
+ if(flag==2)
+ {
+ locate(15,2);
+ limitinput(n);
+ strcpy(gamedetailA.matchbetween,output);
+ fflush(stdin);
+ flag=3;
+ n=10;
+ }
+ if(flag==3)
+ {
+ locate(44,2);
+ limitinput(n);
+ strcpy(gamedetailA.versus,output);
+ fflush(stdin);
+ flag=4;
+ n=10;
+ }
+ if(flag==4)
+ {
+ locate(13,4);
+ limitinput(n);
+ strcpy(gamedetailA.tosswonby,output);
+ fflush(stdin);
+ flag=5;
+ n=7;
+ }
+ if(flag==5)
+ {
+ locate(47,4);
+ limitinput(n);
+ strcpy(gamedetailA.electedto,output);
+ fflush(stdin);
+ flag=6;
+ n=3;
+ }
+ if(flag==6)
+ {
+ locate(11,6);
+ number=limitedinput(n);
+ gamedetailA.inningsof=number;
+ fflush(stdin);
+ flag=7;
+ n=10;
+ }
+ if(flag==7)
+ {
+ locate(53,6);
+ printf(" T to enter today's date");
+ locate(43,6);
+ limitinput(n);
+ if(output[0]=='t'||output[0]=='T')
+ {
+ date();
+ locate(43,6);
+ printf(" %s ",gamedetailA.date);
+ }
+ else
+ {
+ strcpy(gamedetailA.date,output);
+ locate(43,6);
+ if(strlen(gamedetailA.date)<2)
+ printf(" ");
+ else
+ printf(" %s ",gamedetailA.date);
+
+ }
+ fflush(stdin);
+ flag=8;
+ n=15;
+ }
+ if(flag==8)
+ {
+ locate(12,10);
+ for (i=0; i<11; i++)
+ {
+ limitinput(n);
+ strcpy(teamA[i].batsmanname,output);
+ locate(12,11+i);
+ }
+ flag=9;
+ }
+ if(flag==9)
+ {
+ locate(12,24);
+ for (i=0; i<8; i++)
+ {
+ limitinput(n);
+ strcpy(teamA[i].bowler,output);
+ locate(12,25+i);
+ }
+ flag=80;
+ }
+ if (flag==80)
+ {
+ locate(36,33);
+ skip:
+ printf("Enter e to edit or c to continue");
+ ch=getch();
+ if(ch=='e'||ch=='E')
+ {
+ flag=0;
+ locate(36,33);
+ printf(" ");
+
+ }
+ else if(ch=='c'||ch=='C')
+ {
+ locate(36,33);
+ printf(" ");
+ locate(14,20);
+ final();
+ filewrite();
+ }
+ else
+ {
+ locate(36,33);
+ printf(" ");
+ flag=80;
+ }
+ }
+ }
+}
+void printt()
+{
+
+ int j,l,i;
+ locate(0,0);
+ printf("%ccompetition:%s",179,gamedetailA.competition);
+ locate(35,0);
+ printf("%cVenue:%s",179,gamedetailA.venue);
+ locate(0,1);
+ for(i=0; i<79; i++)
+ printf("%c",205);
+ locate(0,2);
+ printf("%cMatch Between:%s",179,gamedetailA.matchbetween);
+ locate(35,2);
+ printf("%cVersus:%s",179,gamedetailA.versus);
+ locate(0,3);
+ for(i=0; i<79; i++)
+ printf("%c",205);
+ locate(0,4);
+ printf("%cToss won by:%s",179,gamedetailA.tosswonby);
+ locate(35,4);
+ printf("%cElected To:%s",179,gamedetailA.electedto);
+ locate(0,5);
+ for(i=0; i<79; i++)
+ printf("%c",205);
+ locate(35,0);
+ for (i=0; i<33; i++)
+ {
+ locate(34,i);
+ printf("%c",182);
+ }
+ locate(0,6);
+ printf("%cInning Of:%d",179,gamedetailA.inningsof);
+ locate(35,6);
+ printf("%cDate:%s",179,gamedetailA.date);
+ locate(0,7);
+ for(i=0; i<79; i++)
+ printf("%c",205);
+ locate(0,21);
+ for(i=0; i<79; i++)
+ printf("%c",205);
+ locate(0,9);
+ for(i=0; i<79; i++)
+ printf("%c",205);
+ locate(5,8);
+ printf("Batsmanname");
+ locate(0,10);
+ for(i=0; i<11; i++)
+ printf("%cBatsman %d:%s\n",179,i+1,teamA[i].batsmanname);
+ locate(36,8);
+ printf("%cTotoal runs",179);
+ for(i=0; i<11; i++)
+ {
+ locate(40,9+(i+1));
+ printf("%d\n",teamA[i].totalruns);
+ }
+
+ locate(5,22);
+ printf("Bowlers");
+ locate(0,23);
+ for (i=0; i<79; i++)
+ printf("%c",205);
+ for(i=0; i<8; i++)
+ {
+ locate(0,23+(i+1));
+ printf("%cBowler %d:%s\n",179,i+1,teamA[i].bowler);
+ }
+
+ locate(35,22);
+ printf("overs");
+ locate(42,22);
+ printf("Maidens");
+ locate(50,22);
+ printf("Economy");
+ locate(58,22);
+ printf("No balls");
+ locate(68,22);
+ printf("BTICO");
+ locate(75,22);
+ printf("Runs");
+ locate(62,8);
+ printf("_4s");
+ locate(72,8);
+ printf("_6s");
+ locate(0,32);
+ for (i=0; i<79; i++)
+ printf("%c",205);
+ locate(61,10);
+ for(i=0; i<11; i++)
+ {
+ printf("%c",179);
+ locate(61,10+(i+1));
+ }
+ locate(63,9);
+ for(i=0;i<11;i++)
+ {
+ locate(63,9+(i+1));
+ printf("%d",teamA[i]._4s);
+ }
+ locate(73,9);
+ for(i=0;i<11;i++)
+ {
+ locate(73,9+(i+1));
+ printf("%d",teamA[i]._6s);
+ }
+ locate(71,10);
+ for(i=0; i<11; i++)
+ {
+ printf("%c",179);
+ locate(71,10+(i+1));
+ }
+ locate(49,10);
+ for(i=0; i<11; i++)
+ {
+ printf("%c",179);
+ locate(49,10+(i+1));
+ }
+ locate(38,23);
+ for(i=0; i<8; i++)
+ {
+ locate(38,23+(i+1));
+ printf("%d\n",bowlingteamA[i].overs);
+ }
+ locate(47,23);
+ for(i=0; i<8; i++)
+ {
+ locate(47,23+(i+1));
+ printf("%d\n",bowlingteamA[i].maidens);
+ }
+ locate(55,23);
+ for(i=0; i<8; i++)
+ {
+ locate(55,23+(i+1));
+ printf("%.2f\n",bowlingteamA[i].average);
+ }
+ locate(62,23);
+ for(i=0; i<8; i++)
+ {
+ locate(62,23+(i+1));
+ printf("%d\n",bowlingteamA[i].noballs);
+ }
+ locate(70,23);
+ for(i=0; i<8; i++)
+ {
+ locate(70,23+(i+1));
+ printf("%d\n",bowlingteamA[i].ballthrownincurrentover);
+ }
+ locate(78,23);
+ for(i=0; i<8; i++)
+ {
+ locate(78,23+(i+1));
+ printf("%d\n",bowlingteamA[i].runs);
+ }
+ locate(0,40);
+ for(i=0;i<79;i++)
+ {
+ printf("%c",205);
+ }
+ return;
+
+
+}
+void filewrite()
+{
+ fwrite(&gamedetailA,sizeof(gamedetailA),1,newfile);
+ fwrite(&teamA,sizeof(teamA),11,newfile);
+ fwrite(&bowlingteamA,sizeof(bowlingteamA),8,newfile);
+
+}
+
+void fileopen(char ch1)
+{
+ int j,ln;
+ char text[50],ch;
+ system("cls");
+ locate(20,8);
+ char filename[20],array[50];
+ char extension[]=".txt";
+ char filenamewithdirectory[]="Files//";
+ char filenamecheck[20];
+ char filenamecheckvar;
+ int i=0,flag=1,n=15;
+ if(ch1=='1')
+ {
+ filelist=fopen("Files//filelist.txt","a+");
+ if(filelist==NULL)
+ {
+ printf(" File Listing Error...");
+ exit(1);
+ }
+ while(flag==1)
+ {
+ if (flag==1)
+ {
+ printf("\nPlease enter the new file name:");
+ scanf(" %[^\n]",filename);
+ i=0;
+ }
+ rewind(filelist);
+ while(filenamecheckvar!=EOF)
+ {
+ filenamecheckvar=fgetc(filelist);
+ filenamecheck[i]=filenamecheckvar;
+ if(filenamecheckvar=='\n')
+ {
+ filenamecheck[i]='\0';
+ i=-1;
+ if(strcmp(filenamecheck,filename)==0)
+ {
+ printf("Filename already exists.Please give new filename:");
+ flag=1;
+ break;
+ }
+ }
+ i++;
+ flag=0;
+ }
+ }
+ fseek(filelist,0,SEEK_END);
+ fprintf(filelist,"%s",filename);
+ fprintf(filelist,"\n");
+ fclose(filelist);
+ strcat(filename,extension);
+ strcat(filenamewithdirectory,filename);
+ newfile=fopen(filenamewithdirectory,"w");
+ if(newfile==NULL)
+ printf("Error...");
+ printf("Creating file...\n");
+ Sleep(3000);
+ printf("File Created.");
+ Sleep(1000);
+ newscoresheet();
+ }
+ if(ch1=='2')
+ {
+ printf("Enter the name of the existing file to open");
+ scanf(" %[^\n]",filename);
+ strcat(filename,extension);
+ strcat(filenamewithdirectory,filename);
+ newfile=fopen(filenamewithdirectory,"r");
+ if(newfile==NULL)
+ {
+ system("cls");
+ printf("Error...no such existing file");
+ exit(0);
+ }
+ system("cls");
+ fread(&gamedetailA,sizeof(gamedetailA),1,newfile);
+ fread(&teamA,sizeof(teamA),11,newfile);
+ fread(&bowlingteamA,sizeof(bowlingteamA),8,newfile);
+ printt();
+ getch();
+ system("cls");
+ main();
+ }
+
+}
+
+void date ( )
+{
+ time_t now;
+ struct tm *tm_now;
+ char buff[BUFSIZ];
+ now = time ( NULL );
+ tm_now = localtime ( &now );
+ strftime ( buff, sizeof buff, "%a %d %m %Y", tm_now );
+ strcpy(gamedetailA.date,buff);
+
+}
+void limitinput(int n)
+{
+ int i,j;
+ char array[100];
+ for(i=0;; i++)
+ {
+ if(i>=n)
+ array[i]=getch();
+ else
+ array[i]=getche();
+ if(array[i]=='\b')
+ {
+ if(i>(n-1))
+ printf("\b \b");
+ else
+ printf(" \b");
+ if(i>=n)
+ i=n-1-1;
+ else
+ {
+ for(j=1;; j++)
+ {
+ if(i==n-j)
+ {
+ if(i==0)
+ i=-1;
+ else
+ i=n-(j+1)-1;
+ break;
+ }
+ }
+ }
+ }
+ if(array[i]=='\r')
+ break;
+ }
+ int number=0;
+ for(i=0; i!=n; i++)
+ {
+ if(array[i]=='\r')
+ {
+ output[i]='\0';
+ break;
+ }
+ output[i]=array[i];
+ }
+}
+int limitedinput(int n)
+{
+ int a,i,j,array[100];
+start:
+locate(11,6);
+ for(i=0;; i++)
+ {
+ if(i>=n)
+ array[i]=getch();
+ else
+ array[i]=getche();
+ if(array[i]=='\b')
+ {
+ if(i>(n-1))
+ printf("\b \b");
+ else
+ printf(" \b");
+ if(i>=n)
+ i=n-1-1;
+ else
+ {
+ for(j=1;; j++)
+ {
+ if(i==n-j)
+ {
+ if(i==0)
+ i=-1;
+ else
+ i=n-(j+1)-1;
+ break;
+ }
+ }
+ }
+ }
+ if(array[i]=='\r')
+ break;
+ }
+ int number=0;
+ for(i=0; i!=n; i++)
+ {
+ if(array[i]=='\r')
+ break;
+ if(isdigit(array[i])!=0)
+ {
+ (int) array[i];
+ number=number*10+(array[i]-48);
+ }
+ else
+ {
+ locate(15,6);
+ printf(" Invalid input.");
+ goto start;
+ }
+ }
+ locate(15,6);
+ printf(" ");
+ return number;
+}
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/obj/Debug/main.o b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/obj/Debug/main.o
new file mode 100644
index 0000000..e87c9b6
Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/obj/Debug/main.o differ
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.cbp b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.cbp
new file mode 100644
index 0000000..e557ddb
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.cbp
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.depend b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.depend
new file mode 100644
index 0000000..a6bda98
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.depend
@@ -0,0 +1,205 @@
+# depslib dependency file v1.0
+1302519416 source:g:\scoresheet\main.c
+ "declaration.h"
+ "welcome.h"
+ "menu.h"
+ "newscoresheet.h"
+ "filing.h"
+ "final.h"
+
+1302508884 g:\scoresheet\declaration.h
+
+
+
+
+
+
+
+
+1302508152 g:\scoresheet\welcome.h
+
+1302509138 g:\scoresheet\menu.h
+
+1302509142 g:\scoresheet\newscoresheet.h
+
+1302339826 g:\scoresheet\filing.h
+
+1302508790 g:\scoresheet\final.h
+
+
+
+
+
+
+
+
+1302519416 source:f:\scoresheet\main.c
+ "declaration.h"
+ "welcome.h"
+ "menu.h"
+ "newscoresheet.h"
+ "filing.h"
+ "final.h"
+
+1302508884 f:\scoresheet\declaration.h
+
+
+
+
+
+
+
+
+1302508152 f:\scoresheet\welcome.h
+
+1302509138 f:\scoresheet\menu.h
+
+1302509142 f:\scoresheet\newscoresheet.h
+
+1302339826 f:\scoresheet\filing.h
+
+1302508790 f:\scoresheet\final.h
+
+
+
+
+
+
+
+
+1302519416 source:e:\5th semester\projects\c projects\scoresheet\main.c
+ "declaration.h"
+ "welcome.h"
+ "menu.h"
+ "newscoresheet.h"
+ "filing.h"
+ "final.h"
+
+1302508884 e:\5th semester\projects\c projects\scoresheet\declaration.h
+
+
+
+
+
+
+
+
+1302508152 e:\5th semester\projects\c projects\scoresheet\welcome.h
+
+1302509138 e:\5th semester\projects\c projects\scoresheet\menu.h
+
+1302509142 e:\5th semester\projects\c projects\scoresheet\newscoresheet.h
+
+1302339826 e:\5th semester\projects\c projects\scoresheet\filing.h
+
+1302508790 e:\5th semester\projects\c projects\scoresheet\final.h
+
+
+
+
+
+
+
+
+1302469916 source:j:\c projects\scoresheet\main.c
+ "declaration.h"
+ "welcome.h"
+ "menu.h"
+ "newscoresheet.h"
+ "filing.h"
+ "final.h"
+
+1302459384 j:\c projects\scoresheet\declaration.h
+
+
+
+
+
+
+
+
+1302458652 j:\c projects\scoresheet\welcome.h
+
+1302459638 j:\c projects\scoresheet\menu.h
+
+1302459642 j:\c projects\scoresheet\newscoresheet.h
+
+1302290326 j:\c projects\scoresheet\filing.h
+
+1302459290 j:\c projects\scoresheet\final.h
+
+
+
+
+
+
+
+
+1302469916 source:e:\comproj\c projects\scoresheet\main.c
+ "declaration.h"
+ "welcome.h"
+ "menu.h"
+ "newscoresheet.h"
+ "filing.h"
+ "final.h"
+
+1400144673 e:\comproj\c projects\scoresheet\declaration.h
+
+
+
+
+
+
+
+
+1400144673 e:\comproj\c projects\scoresheet\welcome.h
+
+1302459638 e:\comproj\c projects\scoresheet\menu.h
+
+1400144673 e:\comproj\c projects\scoresheet\newscoresheet.h
+
+1302290326 e:\comproj\c projects\scoresheet\filing.h
+
+1302459290 e:\comproj\c projects\scoresheet\final.h
+
+
+
+
+
+
+
+
+1302469916 source:c:\users\rajjjj\desktop\scoresheet\main.c
+ "declaration.h"
+ "welcome.h"
+ "menu.h"
+ "newscoresheet.h"
+ "filing.h"
+ "final.h"
+
+1400144673 c:\users\rajjjj\desktop\scoresheet\declaration.h
+
+
+
+
+
+
+
+
+1400144673 c:\users\rajjjj\desktop\scoresheet\welcome.h
+
+1302459638 c:\users\rajjjj\desktop\scoresheet\menu.h
+
+1400144673 c:\users\rajjjj\desktop\scoresheet\newscoresheet.h
+
+1302290326 c:\users\rajjjj\desktop\scoresheet\filing.h
+
+1302459290 c:\users\rajjjj\desktop\scoresheet\final.h
+
+
+
+
+
+
+
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.exe b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.exe
new file mode 100644
index 0000000..1ca4b70
Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.exe differ
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.layout b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.layout
new file mode 100644
index 0000000..a79741a
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/scoresheet.layout
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/welcome.h b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/welcome.h
new file mode 100644
index 0000000..6edcae9
--- /dev/null
+++ b/projects/Cricket Score Sheet Project in C/Cricket Scoresheet/welcome.h
@@ -0,0 +1,51 @@
+void welcome()
+{
+ system("color f1");
+ int i,y;
+ locate(26,5);
+ printf(" _ _ _ _ _ _ _ _ _ _ _ _ _ _ ");
+ locate(27,7);
+ printf("*****************************");
+ locate(27,9);
+ printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c"
+ ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3);
+ locate(27,11);
+ printf(" %c%c%c!!! YOU ARE WELCOME !!!%c%c%c",2,2,2,2,2,2);
+ locate(39,13);
+ printf("TO");
+ locate(27,15);
+ printf(" %c%c%c%c Cricket score sheet %c%c%c%c",3,3,3,3,3,3,3,3);
+ locate(27,17);
+ printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%"
+ ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3);
+ locate(27,19);
+ printf("*****************************");
+ locate(27,21);
+ printf("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _");
+ Sleep(250);
+ locate(27,23);
+ printf(" @Copy righted to:-");
+ Sleep(250);
+ locate(27,25);
+ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN | FOREGROUND_INTENSITY | FOREGROUND_BLUE );
+ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN | FOREGROUND_INTENSITY | FOREGROUND_BLUE );
+ locate(27,29);
+ printf("\tcodewitc.c",16);
+
+ for(y=35;y<=58;y++)
+ {
+ {
+
+ locate(27,y);
+ Sleep(400);
+ }
+ }
+ printf("\n");
+
+system("color ff");
+ }
+
+
+
+
+
diff --git a/projects/Cricket Score Sheet Project in C/Readme.docx b/projects/Cricket Score Sheet Project in C/Readme.docx
new file mode 100644
index 0000000..cf11c06
Binary files /dev/null and b/projects/Cricket Score Sheet Project in C/Readme.docx differ
diff --git a/projects/Currency Converter Java Project/.gitignore b/projects/Currency Converter Java Project/.gitignore
new file mode 100644
index 0000000..d3bae3d
--- /dev/null
+++ b/projects/Currency Converter Java Project/.gitignore
@@ -0,0 +1,3 @@
+/build/
+/dist/
+/nbproject/private/
\ No newline at end of file
diff --git a/projects/Currency Converter Java Project/Currency Converter/README b/projects/Currency Converter Java Project/Currency Converter/README
new file mode 100644
index 0000000..d0ff720
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/README
@@ -0,0 +1,2 @@
+This is a currency exchange web application developed with ajax,jsp and servlets.
+The third version of the converter converts currencies instantly as you type.
diff --git a/projects/Currency Converter Java Project/Currency Converter/build.xml b/projects/Currency Converter Java Project/Currency Converter/build.xml
new file mode 100644
index 0000000..ab36ef1
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/build.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project CurrencyExchangeV3.
+
+
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/ant-deploy.xml b/projects/Currency Converter Java Project/Currency Converter/nbproject/ant-deploy.xml
new file mode 100644
index 0000000..cbfe67c
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/ant-deploy.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/build-impl.xml b/projects/Currency Converter Java Project/Currency Converter/nbproject/build-impl.xml
new file mode 100644
index 0000000..65c0f33
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/build-impl.xml
@@ -0,0 +1,1071 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set build.web.dir
+ Must set build.generated.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.war
+
+
+
+
+
+
+
+
+
+The Java EE server classpath is not correctly set up - server home directory is missing.
+Either open the project in the IDE and assign the server or setup the server classpath manually.
+For example like this:
+ ant -Dj2ee.server.home=<app_server_installation_directory>
+
+
+The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
+Either open the project in the IDE and assign the server or setup the server classpath manually.
+For example like this:
+ ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file)
+or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+The libs.CopyLibs.classpath property is not set up.
+This property must point to
+org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
+of NetBeans IDE installation and is usually located at
+<netbeans_installation>/java<version>/ant/extra folder.
+Either open the project in the IDE and make sure CopyLibs library
+exists or setup the property manually. For example like this:
+ ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.jsp.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select a file in the IDE or set jsp.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable.
+
+
+ Launching ${browse.url}
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/genfiles.properties b/projects/Currency Converter Java Project/Currency Converter/nbproject/genfiles.properties
new file mode 100644
index 0000000..6d6a539
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=1286d75a
+build.xml.script.CRC32=ec3d8777
+build.xml.stylesheet.CRC32=651128d4@1.33.1.1
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=1286d75a
+nbproject/build-impl.xml.script.CRC32=33e33eba
+nbproject/build-impl.xml.stylesheet.CRC32=0cbf5bb7@1.33.1.1
diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/project.properties b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.properties
new file mode 100644
index 0000000..9b3dd1b
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.properties
@@ -0,0 +1,81 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=true
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.web.dir}/WEB-INF/classes
+build.classes.excludes=**/*.java,**/*.form
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+build.web.dir=${build.dir}/web
+build.web.excludes=${build.classes.excludes}
+client.urlPart=
+compile.jsps=false
+conf.dir=${source.root}/conf
+debug.classpath=${build.classes.dir}:${javac.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+display.browser=true
+dist.dir=dist
+dist.ear.war=${dist.dir}/${war.ear.name}
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.war=${dist.dir}/${war.name}
+endorsed.classpath=\
+ ${libs.javaee-endorsed-api-6.0.classpath}
+excludes=
+file.reference.gson-2.0_1.jar=build/web/WEB-INF/lib/gson-2.0_1.jar
+includes=**
+j2ee.compile.on.save=true
+j2ee.deploy.on.save=true
+j2ee.platform=1.6-web
+j2ee.platform.classpath=${j2ee.server.home}/lib/jstl-api-1.2.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/ecj-3.7.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/jstl-impl-1.2.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/annotations-api.jar
+j2ee.server.type=Tomcat
+jar.compress=false
+javac.classpath=\
+ ${file.reference.gson-2.0_1.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.debug=true
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.preview=true
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+lib.dir=${web.docbase.dir}/WEB-INF/lib
+persistence.xml.dir=${conf.dir}
+platform.active=default_platform
+resource.dir=setup
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+# Space-separated list of JVM arguments used when running a class with a main method or a unit test
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
+runmain.jvmargs=
+source.encoding=UTF-8
+source.root=src
+src.dir=${source.root}/java
+test.src.dir=test
+war.content.additional=
+war.ear.name=CurrencyExchangeV3.war
+war.name=CurrencyExchangeV3.war
+web.docbase.dir=web
+webinf.dir=web/WEB-INF
diff --git a/projects/Currency Converter Java Project/Currency Converter/nbproject/project.xml b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.xml
new file mode 100644
index 0000000..d75be13
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/nbproject/project.xml
@@ -0,0 +1,23 @@
+
+
+ org.netbeans.modules.web.project
+
+
+ CurrencyExchangeV3
+ 1.6.5
+
+
+ ${file.reference.gson-2.0_1.jar}
+ WEB-INF/lib
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/src/conf/MANIFEST.MF b/projects/Currency Converter Java Project/Currency Converter/src/conf/MANIFEST.MF
new file mode 100644
index 0000000..59499bc
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/src/conf/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/Convert.java b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/Convert.java
new file mode 100644
index 0000000..d6435a1
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/Convert.java
@@ -0,0 +1,143 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.exchange;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import java.io.InputStream;
+import java.net.*;
+import com.google.gson.*;
+
+
+/**
+ *
+ * @author pakallis
+ */
+class Recv
+{
+ private String lhs;
+ private String rhs;
+ private String error;
+ private String icc;
+ public Recv()
+ {
+
+ }
+ public String getLhs()
+ {
+ return lhs;
+ }
+ public String getRhs()
+ {
+ return rhs;
+ }
+}
+public class Convert extends HttpServlet {
+
+ /**
+ * Processes requests for both HTTP GET
and POST
methods.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ String query = "";
+ String amount = "";
+ String curTo = "";
+ String curFrom = "";
+ String submit = "";
+ String res = "";
+ HttpSession session;
+ resp.setContentType("text/html;charset=UTF-8");
+ PrintWriter out = resp.getWriter();
+
+
+ /*Read request parameters*/
+ amount = req.getParameter("amount");
+ curTo = req.getParameter("to");
+ curFrom = req.getParameter("from");
+
+
+
+ /*Open a connection to google and read the result*/
+ try {
+
+ query = "http://www.google.com/ig/calculator?hl=en&q=" + amount + curFrom + "=?" + curTo;
+ URL url = new URL(query);
+ InputStreamReader stream = new InputStreamReader(url.openStream());
+ BufferedReader in = new BufferedReader(stream);
+ String str = "";
+ String temp = "";
+
+ while ((temp = in.readLine()) != null) {
+ str = str + temp;
+ }
+
+
+ /*Parse the result which is in json format*/
+ Gson gson = new Gson();
+ Recv st = gson.fromJson(str, Recv.class);
+ String rhs = st.getRhs();
+ rhs = rhs.replaceAll("�", "");
+
+ /*we do the check in order to print the additional word(millions,billions etc)*/
+ StringTokenizer strto = new StringTokenizer(rhs);
+ String nextToken;
+ out.write(strto.nextToken());
+ nextToken = strto.nextToken();
+ if( nextToken.equals("million") || nextToken.equals("billion") || nextToken.equals("trillion"))
+ {
+ out.println(" "+nextToken);
+ }
+
+
+ } catch (NumberFormatException e) {
+ out.println("The given amount is not a valid number");
+ }
+
+
+ }
+
+ //
+ /**
+ * Handles the HTTP GET
method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP POST
method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }//
+}
diff --git a/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/HTTPXMLTest.java b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/HTTPXMLTest.java
new file mode 100644
index 0000000..ceed5c5
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/src/java/com/exchange/HTTPXMLTest.java
@@ -0,0 +1,59 @@
+package com.exchange;
+import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+public class HTTPXMLTest
+{
+ /* public static void main(String[] args)
+ {
+ try {
+ new HTTPXMLTest().start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }*/
+ String currency[];
+ void start() throws Exception
+ {
+ URL url = new URL("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
+ URLConnection connection = url.openConnection();
+
+ Document doc = parseXML(connection.getInputStream());
+ NodeList descNodes = doc.getElementsByTagName("Cube");
+ for(int i=0; i
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/web/WEB-INF/web.xml b/projects/Currency Converter Java Project/Currency Converter/web/WEB-INF/web.xml
new file mode 100644
index 0000000..abc61f4
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/web/WEB-INF/web.xml
@@ -0,0 +1,16 @@
+
+
+
+ Convert
+ com.exchange.Convert
+
+
+ Convert
+ /Convert
+
+
+
+ 30
+
+
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/web/css/style.css b/projects/Currency Converter Java Project/Currency Converter/web/css/style.css
new file mode 100644
index 0000000..907cc85
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/web/css/style.css
@@ -0,0 +1,17 @@
+/*
+ Document : style
+ Created on : Dec 17, 2011, 4:53:06 PM
+ Author : pakallis
+ Description:
+ Purpose of the stylesheet follows.
+*/
+
+/*
+ TODO customize this sample style
+ Syntax recommendation http://www.w3.org/TR/REC-CSS2/
+*/
+
+body {
+ text-align: center;
+}
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/web/index.jsp b/projects/Currency Converter Java Project/Currency Converter/web/index.jsp
new file mode 100644
index 0000000..e8e1ca1
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/web/index.jsp
@@ -0,0 +1,187 @@
+<%--
+ Document : index
+ Created on : Dec 15, 2011, 9:56:40 PM
+ Author : pakallis
+--%>
+
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+
+
+
+
+
+
+ Currency Exchange Converter
+
+
+ Currency Exchange Converter
+
+
+
diff --git a/projects/Currency Converter Java Project/Currency Converter/web/js/ajax.js b/projects/Currency Converter Java Project/Currency Converter/web/js/ajax.js
new file mode 100644
index 0000000..d872058
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/web/js/ajax.js
@@ -0,0 +1,37 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+
+var req;
+var where;
+function convert(from,to,amount) {
+
+ var url = "/CurrencyExchangeV3/Convert?from="+from+"&to="+to+"&amount="+amount.value;
+ where = amount;
+ if (typeof XMLHttpRequest != "undefined") {
+ req = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ req = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ req.open("GET", url, true);
+ req.onreadystatechange = callback;
+ req.send(null);
+}
+
+function callback() {
+ if (req.readyState == 4) {
+ if (req.status == 200) {
+ if(where != document.getElementById("amount1"))
+ {
+ document.getElementById("amount1").value = req.responseText;
+ }
+ else
+ {
+ document.getElementById("amount2").value = req.responseText;
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/Currency Converter Java Project/Currency Converter/web/js/swap.js b/projects/Currency Converter Java Project/Currency Converter/web/js/swap.js
new file mode 100644
index 0000000..ccda419
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/web/js/swap.js
@@ -0,0 +1,17 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+
+function swapElem(from,to)
+{
+ var temp;
+ temp = from.value;
+ from.value = to.value;
+ to.value = temp;
+
+ temp = document.getElementById("amount1").value;
+ document.getElementById("amount1").value = document.getElementById("amount2").value;
+ document.getElementById("amount2").value = temp;
+}
diff --git a/projects/Currency Converter Java Project/Currency Converter/web/js/validate.js b/projects/Currency Converter Java Project/Currency Converter/web/js/validate.js
new file mode 100644
index 0000000..aed31cd
--- /dev/null
+++ b/projects/Currency Converter Java Project/Currency Converter/web/js/validate.js
@@ -0,0 +1,14 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+function validate(input)
+{
+ if(isNaN(input.value))
+ {
+ return false;
+ }
+ convert(document.getElementById('currency2').value,document.getElementById('currency1').value,document.getElementById('amount2').value);
+ return true;
+}
diff --git a/projects/Currency Converter Java Project/Readme.docx b/projects/Currency Converter Java Project/Readme.docx
new file mode 100644
index 0000000..cf11c06
Binary files /dev/null and b/projects/Currency Converter Java Project/Readme.docx differ
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.css b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.css
new file mode 100644
index 0000000..a14751c
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.css
@@ -0,0 +1,9 @@
+.node {
+ font: 10px sans-serif;
+}
+
+.link {
+ stroke: steelblue;
+ stroke-opacity: .4;
+ fill: none;
+}
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.html b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.html
new file mode 100644
index 0000000..923421a
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.html
@@ -0,0 +1,15 @@
+
+
+
+
+ Hierarchical Edge Bundling (Radial Tree)
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.js b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.js
new file mode 100644
index 0000000..94b1ea3
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/bundle-radial.js
@@ -0,0 +1,72 @@
+var radius = 960 / 2,
+ splines = [];
+
+var cluster = d3.layout.cluster()
+ .size([360, radius - 120])
+ .sort(null)
+ .value(function(d) { return d.size; });
+
+var bundle = d3.layout.bundle();
+
+var line = d3.svg.line.radial()
+ .interpolate("bundle")
+ .tension(.85)
+ .radius(function(d) { return d.y; })
+ .angle(function(d) { return d.x / 180 * Math.PI; });
+
+var vis = d3.select("#chart").append("svg")
+ .attr("width", radius * 2)
+ .attr("height", radius * 2)
+ .append("g")
+ .attr("transform", "translate(" + radius + "," + radius + ")");
+
+d3.json("flare-imports.json", function(classes) {
+ var raw_nodes = packages.root(classes);
+var nodes = cluster.nodes(raw_nodes),
+ links = packages.imports(nodes);
+});
+
+d3.json("IntlNodes.json", function(pairs) {
+ var raw_nodes = preprocess.nodes(pairs);
+
+ var nodes = cluster.nodes(raw_nodes);
+
+ var links = preprocess.links(nodes[0]);
+
+ vis.selectAll("path.link")
+ .data(splines = bundle(links))
+ .enter().append("path")
+ .attr("class", "link")
+ .attr("d", line);
+
+});
+
+/* OLD VERSION
+ d3.json("flare-imports.json", function(classes) {
+ var nodes = cluster.nodes(packages.root(classes)),
+ links = packages.imports(nodes);
+
+ vis.selectAll("path.link")
+ .data(splines = bundle(links))
+ .enter().append("path")
+ .attr("class", "link")
+ .attr("d", line);
+
+ vis.selectAll("g.node")
+ .data(nodes.filter(function(n) { return !n.children; }))
+ .enter().append("g")
+ .attr("class", "node")
+ .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; })
+ .append("text")
+ .attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
+ .attr("dy", ".31em")
+ .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
+ .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
+ .text(function(d) { return d.key; });
+});*/
+
+d3.select(window).on("mousemove", function() {
+ vis.selectAll("path.link")
+ .data(splines)
+ .attr("d", line.tension(Math.min(1, d3.event.clientX / 960)));
+});
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare-imports.json b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare-imports.json
new file mode 100644
index 0000000..7b3997f
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare-imports.json
@@ -0,0 +1,222 @@
+[
+{"name":"flare.analytics.cluster.AgglomerativeCluster","size":3938,"imports":["flare.animate.Transitioner","flare.vis.data.DataList","flare.util.math.IMatrix","flare.analytics.cluster.MergeEdge","flare.analytics.cluster.HierarchicalCluster","flare.vis.data.Data"]},
+{"name":"flare.analytics.cluster.CommunityStructure","size":3812,"imports":["flare.analytics.cluster.HierarchicalCluster","flare.animate.Transitioner","flare.vis.data.DataList","flare.analytics.cluster.MergeEdge","flare.util.math.IMatrix"]},
+{"name":"flare.analytics.cluster.HierarchicalCluster","size":6714,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.Tree","flare.util.Arrays","flare.analytics.cluster.MergeEdge","flare.util.Sort","flare.vis.operator.Operator","flare.util.Property","flare.vis.data.Data"]},
+{"name":"flare.analytics.cluster.MergeEdge","size":743,"imports":[]},
+{"name":"flare.analytics.graph.BetweennessCentrality","size":3534,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.util.Arrays","flare.vis.data.Data","flare.util.Property","flare.vis.operator.Operator"]},
+{"name":"flare.analytics.graph.LinkDistance","size":5731,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.EdgeSprite","flare.analytics.graph.ShortestPaths","flare.vis.data.Data","flare.util.Property","flare.vis.operator.Operator"]},
+{"name":"flare.analytics.graph.MaxFlowMinCut","size":7840,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.EdgeSprite","flare.vis.data.Data","flare.util.Property","flare.vis.operator.Operator"]},
+{"name":"flare.analytics.graph.ShortestPaths","size":5914,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.animate.Transitioner","flare.vis.operator.Operator","flare.util.heap.HeapNode","flare.util.heap.FibonacciHeap","flare.util.Property","flare.vis.data.Data"]},
+{"name":"flare.analytics.graph.SpanningTree","size":3416,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.operator.IOperator","flare.vis.Visualization","flare.vis.data.TreeBuilder","flare.vis.operator.Operator"]},
+{"name":"flare.analytics.optimization.AspectRatioBanker","size":7074,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.data.DataSprite","flare.scale.Scale","flare.vis.axis.CartesianAxes","flare.vis.Visualization","flare.util.Property","flare.vis.operator.Operator"]},
+{"name":"flare.animate.Easing","size":17010,"imports":["flare.animate.Transition"]},
+{"name":"flare.animate.FunctionSequence","size":5842,"imports":["flare.util.Maths","flare.animate.Transition","flare.util.Arrays","flare.animate.Sequence","flare.animate.Transitioner"]},
+{"name":"flare.animate.interpolate.ArrayInterpolator","size":1983,"imports":["flare.util.Arrays","flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.ColorInterpolator","size":2047,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.DateInterpolator","size":1375,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.Interpolator","size":8746,"imports":["flare.animate.interpolate.NumberInterpolator","flare.animate.interpolate.ColorInterpolator","flare.animate.interpolate.PointInterpolator","flare.animate.interpolate.ObjectInterpolator","flare.animate.interpolate.MatrixInterpolator","flare.animate.interpolate.RectangleInterpolator","flare.animate.interpolate.DateInterpolator","flare.util.Property","flare.animate.interpolate.ArrayInterpolator"]},
+{"name":"flare.animate.interpolate.MatrixInterpolator","size":2202,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.NumberInterpolator","size":1382,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.ObjectInterpolator","size":1629,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.PointInterpolator","size":1675,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.interpolate.RectangleInterpolator","size":2042,"imports":["flare.animate.interpolate.Interpolator"]},
+{"name":"flare.animate.ISchedulable","size":1041,"imports":["flare.animate.Scheduler"]},
+{"name":"flare.animate.Parallel","size":5176,"imports":["flare.animate.Easing","flare.animate.Transition","flare.util.Arrays"]},
+{"name":"flare.animate.Pause","size":449,"imports":["flare.animate.Transition"]},
+{"name":"flare.animate.Scheduler","size":5593,"imports":["flare.animate.ISchedulable","flare.animate.Pause","flare.animate.Transition"]},
+{"name":"flare.animate.Sequence","size":5534,"imports":["flare.animate.Easing","flare.util.Maths","flare.animate.Transition","flare.util.Arrays"]},
+{"name":"flare.animate.Transition","size":9201,"imports":["flare.animate.Transitioner","flare.animate.TransitionEvent","flare.animate.Scheduler","flare.animate.Pause","flare.animate.Parallel","flare.animate.Easing","flare.animate.Sequence","flare.animate.ISchedulable","flare.util.Maths","flare.animate.Tween"]},
+{"name":"flare.animate.Transitioner","size":19975,"imports":["flare.util.IValueProxy","flare.animate.Parallel","flare.animate.Easing","flare.animate.Sequence","flare.animate.Transition","flare.animate.Tween","flare.util.Property"]},
+{"name":"flare.animate.TransitionEvent","size":1116,"imports":["flare.animate.Transition"]},
+{"name":"flare.animate.Tween","size":6006,"imports":["flare.animate.Transitioner","flare.animate.Transition","flare.animate.interpolate.Interpolator","flare.util.Property"]},
+{"name":"flare.data.converters.Converters","size":721,"imports":["flare.data.converters.IDataConverter","flare.data.converters.GraphMLConverter","flare.data.converters.JSONConverter","flare.data.converters.DelimitedTextConverter"]},
+{"name":"flare.data.converters.DelimitedTextConverter","size":4294,"imports":["flare.data.DataSet","flare.data.DataUtil","flare.data.DataTable","flare.data.converters.IDataConverter","flare.data.DataSchema","flare.data.DataField"]},
+{"name":"flare.data.converters.GraphMLConverter","size":9800,"imports":["flare.data.DataSet","flare.data.DataUtil","flare.data.DataTable","flare.data.converters.IDataConverter","flare.data.DataSchema","flare.data.DataField"]},
+{"name":"flare.data.converters.IDataConverter","size":1314,"imports":["flare.data.DataSet","flare.data.DataSchema"]},
+{"name":"flare.data.converters.JSONConverter","size":2220,"imports":["flare.data.DataSet","flare.data.DataUtil","flare.data.DataTable","flare.data.converters.IDataConverter","flare.data.DataSchema","flare.data.DataField","flare.util.Property"]},
+{"name":"flare.data.DataField","size":1759,"imports":["flare.data.DataUtil"]},
+{"name":"flare.data.DataSchema","size":2165,"imports":["flare.data.DataField","flare.util.Arrays"]},
+{"name":"flare.data.DataSet","size":586,"imports":["flare.data.DataTable"]},
+{"name":"flare.data.DataSource","size":3331,"imports":["flare.data.converters.IDataConverter","flare.data.converters.Converters","flare.data.DataSchema"]},
+{"name":"flare.data.DataTable","size":772,"imports":["flare.data.DataSchema"]},
+{"name":"flare.data.DataUtil","size":3322,"imports":["flare.data.DataField","flare.data.DataSchema"]},
+{"name":"flare.display.DirtySprite","size":8833,"imports":[]},
+{"name":"flare.display.LineSprite","size":1732,"imports":["flare.display.DirtySprite"]},
+{"name":"flare.display.RectSprite","size":3623,"imports":["flare.util.Colors","flare.display.DirtySprite"]},
+{"name":"flare.display.TextSprite","size":10066,"imports":["flare.display.DirtySprite"]},
+{"name":"flare.flex.FlareVis","size":4116,"imports":["flare.display.DirtySprite","flare.data.DataSet","flare.vis.Visualization","flare.vis.axis.CartesianAxes","flare.vis.axis.Axes","flare.vis.data.Data"]},
+{"name":"flare.physics.DragForce","size":1082,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.IForce"]},
+{"name":"flare.physics.GravityForce","size":1336,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.IForce"]},
+{"name":"flare.physics.IForce","size":319,"imports":["flare.physics.Simulation"]},
+{"name":"flare.physics.NBodyForce","size":10498,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.IForce"]},
+{"name":"flare.physics.Particle","size":2822,"imports":[]},
+{"name":"flare.physics.Simulation","size":9983,"imports":["flare.physics.Particle","flare.physics.NBodyForce","flare.physics.DragForce","flare.physics.GravityForce","flare.physics.Spring","flare.physics.SpringForce","flare.physics.IForce"]},
+{"name":"flare.physics.Spring","size":2213,"imports":["flare.physics.Particle"]},
+{"name":"flare.physics.SpringForce","size":1681,"imports":["flare.physics.Simulation","flare.physics.Particle","flare.physics.Spring","flare.physics.IForce"]},
+{"name":"flare.query.AggregateExpression","size":1616,"imports":["flare.query.Expression"]},
+{"name":"flare.query.And","size":1027,"imports":["flare.query.CompositeExpression","flare.query.Expression"]},
+{"name":"flare.query.Arithmetic","size":3891,"imports":["flare.query.BinaryExpression","flare.query.Expression"]},
+{"name":"flare.query.Average","size":891,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.BinaryExpression","size":2893,"imports":["flare.query.Expression"]},
+{"name":"flare.query.Comparison","size":5103,"imports":["flare.query.Not","flare.query.BinaryExpression","flare.query.Expression","flare.query.Or"]},
+{"name":"flare.query.CompositeExpression","size":3677,"imports":["flare.query.Expression","flare.query.If"]},
+{"name":"flare.query.Count","size":781,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.DateUtil","size":4141,"imports":["flare.query.Fn"]},
+{"name":"flare.query.Distinct","size":933,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.Expression","size":5130,"imports":["flare.query.Variable","flare.query.IsA","flare.query.ExpressionIterator","flare.util.IPredicate","flare.query.Literal","flare.util.IEvaluable","flare.query.If"]},
+{"name":"flare.query.ExpressionIterator","size":3617,"imports":["flare.query.Expression"]},
+{"name":"flare.query.Fn","size":3240,"imports":["flare.query.DateUtil","flare.query.CompositeExpression","flare.query.Expression","flare.query.StringUtil"]},
+{"name":"flare.query.If","size":2732,"imports":["flare.query.Expression"]},
+{"name":"flare.query.IsA","size":2039,"imports":["flare.query.Expression","flare.query.If"]},
+{"name":"flare.query.Literal","size":1214,"imports":["flare.query.Expression"]},
+{"name":"flare.query.Match","size":3748,"imports":["flare.query.BinaryExpression","flare.query.Expression","flare.query.StringUtil"]},
+{"name":"flare.query.Maximum","size":843,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.methods.add","size":593,"imports":["flare.query.methods.or","flare.query.Arithmetic"]},
+{"name":"flare.query.methods.and","size":330,"imports":["flare.query.And","flare.query.methods.or"]},
+{"name":"flare.query.methods.average","size":287,"imports":["flare.query.Average","flare.query.methods.or"]},
+{"name":"flare.query.methods.count","size":277,"imports":["flare.query.Count","flare.query.methods.or"]},
+{"name":"flare.query.methods.distinct","size":292,"imports":["flare.query.Distinct","flare.query.methods.or"]},
+{"name":"flare.query.methods.div","size":595,"imports":["flare.query.methods.or","flare.query.Arithmetic"]},
+{"name":"flare.query.methods.eq","size":594,"imports":["flare.query.Comparison","flare.query.methods.or"]},
+{"name":"flare.query.methods.fn","size":460,"imports":["flare.query.methods.or","flare.query.Fn"]},
+{"name":"flare.query.methods.gt","size":603,"imports":["flare.query.Comparison","flare.query.methods.or"]},
+{"name":"flare.query.methods.gte","size":625,"imports":["flare.query.Comparison","flare.query.methods.gt","flare.query.methods.eq","flare.query.methods.or"]},
+{"name":"flare.query.methods.iff","size":748,"imports":["flare.query.methods.or","flare.query.If"]},
+{"name":"flare.query.methods.isa","size":461,"imports":["flare.query.IsA","flare.query.methods.or"]},
+{"name":"flare.query.methods.lt","size":597,"imports":["flare.query.Comparison","flare.query.methods.or"]},
+{"name":"flare.query.methods.lte","size":619,"imports":["flare.query.Comparison","flare.query.methods.lt","flare.query.methods.eq","flare.query.methods.or"]},
+{"name":"flare.query.methods.max","size":283,"imports":["flare.query.Maximum","flare.query.methods.or"]},
+{"name":"flare.query.methods.min","size":283,"imports":["flare.query.Minimum","flare.query.methods.or"]},
+{"name":"flare.query.methods.mod","size":591,"imports":["flare.query.methods.or","flare.query.Arithmetic"]},
+{"name":"flare.query.methods.mul","size":603,"imports":["flare.query.methods.lt","flare.query.methods.or","flare.query.Arithmetic"]},
+{"name":"flare.query.methods.neq","size":599,"imports":["flare.query.Comparison","flare.query.methods.eq","flare.query.methods.or"]},
+{"name":"flare.query.methods.not","size":386,"imports":["flare.query.Not","flare.query.methods.or"]},
+{"name":"flare.query.methods.or","size":323,"imports":["flare.query.Or"]},
+{"name":"flare.query.methods.orderby","size":307,"imports":["flare.query.Query","flare.query.methods.or"]},
+{"name":"flare.query.methods.range","size":772,"imports":["flare.query.methods.max","flare.query.Range","flare.query.methods.or","flare.query.methods.min"]},
+{"name":"flare.query.methods.select","size":296,"imports":["flare.query.Query"]},
+{"name":"flare.query.methods.stddev","size":363,"imports":["flare.query.methods.and","flare.query.Variance","flare.query.methods.or"]},
+{"name":"flare.query.methods.sub","size":600,"imports":["flare.query.methods.or","flare.query.Arithmetic"]},
+{"name":"flare.query.methods.sum","size":280,"imports":["flare.query.Sum","flare.query.methods.or"]},
+{"name":"flare.query.methods.update","size":307,"imports":["flare.query.Query"]},
+{"name":"flare.query.methods.variance","size":335,"imports":["flare.query.Variance","flare.query.methods.or"]},
+{"name":"flare.query.methods.where","size":299,"imports":["flare.query.Query","flare.query.methods.lt","flare.query.methods.lte"]},
+{"name":"flare.query.methods.xor","size":354,"imports":["flare.query.Xor","flare.query.methods.or"]},
+{"name":"flare.query.methods._","size":264,"imports":["flare.query.Literal","flare.query.methods.or"]},
+{"name":"flare.query.Minimum","size":843,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.Not","size":1554,"imports":["flare.query.Expression"]},
+{"name":"flare.query.Or","size":970,"imports":["flare.query.CompositeExpression","flare.query.Expression"]},
+{"name":"flare.query.Query","size":13896,"imports":["flare.query.Variable","flare.query.Sum","flare.query.Expression","flare.util.Sort","flare.query.Not","flare.query.AggregateExpression","flare.query.Literal","flare.util.Filter","flare.util.Property","flare.query.If"]},
+{"name":"flare.query.Range","size":1594,"imports":["flare.query.And","flare.query.Comparison","flare.query.Expression"]},
+{"name":"flare.query.StringUtil","size":4130,"imports":["flare.query.Fn"]},
+{"name":"flare.query.Sum","size":791,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.Variable","size":1124,"imports":["flare.query.Expression","flare.util.Property"]},
+{"name":"flare.query.Variance","size":1876,"imports":["flare.query.Expression","flare.query.AggregateExpression"]},
+{"name":"flare.query.Xor","size":1101,"imports":["flare.query.CompositeExpression","flare.query.Expression"]},
+{"name":"flare.scale.IScaleMap","size":2105,"imports":["flare.scale.Scale"]},
+{"name":"flare.scale.LinearScale","size":1316,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.QuantitativeScale","flare.scale.ScaleType"]},
+{"name":"flare.scale.LogScale","size":3151,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.QuantitativeScale","flare.scale.ScaleType"]},
+{"name":"flare.scale.OrdinalScale","size":3770,"imports":["flare.scale.ScaleType","flare.util.Arrays","flare.scale.Scale"]},
+{"name":"flare.scale.QuantileScale","size":2435,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.ScaleType"]},
+{"name":"flare.scale.QuantitativeScale","size":4839,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale"]},
+{"name":"flare.scale.RootScale","size":1756,"imports":["flare.util.Maths","flare.util.Strings","flare.scale.Scale","flare.scale.QuantitativeScale","flare.scale.ScaleType"]},
+{"name":"flare.scale.Scale","size":4268,"imports":["flare.scale.ScaleType","flare.util.Strings"]},
+{"name":"flare.scale.ScaleType","size":1821,"imports":["flare.scale.Scale"]},
+{"name":"flare.scale.TimeScale","size":5833,"imports":["flare.util.Maths","flare.util.Dates","flare.scale.Scale","flare.scale.ScaleType"]},
+{"name":"flare.util.Arrays","size":8258,"imports":["flare.util.IValueProxy","flare.util.Property","flare.util.IEvaluable"]},
+{"name":"flare.util.Colors","size":10001,"imports":["flare.util.Filter"]},
+{"name":"flare.util.Dates","size":8217,"imports":["flare.util.Maths"]},
+{"name":"flare.util.Displays","size":12555,"imports":["flare.util.IValueProxy","flare.util.Filter","flare.util.Property","flare.util.IEvaluable","flare.util.Sort"]},
+{"name":"flare.util.Filter","size":2324,"imports":["flare.util.IPredicate","flare.util.Property"]},
+{"name":"flare.util.Geometry","size":10993,"imports":[]},
+{"name":"flare.util.heap.FibonacciHeap","size":9354,"imports":["flare.util.heap.HeapNode"]},
+{"name":"flare.util.heap.HeapNode","size":1233,"imports":["flare.util.heap.FibonacciHeap"]},
+{"name":"flare.util.IEvaluable","size":335,"imports":[]},
+{"name":"flare.util.IPredicate","size":383,"imports":[]},
+{"name":"flare.util.IValueProxy","size":874,"imports":[]},
+{"name":"flare.util.math.DenseMatrix","size":3165,"imports":["flare.util.math.IMatrix"]},
+{"name":"flare.util.math.IMatrix","size":2815,"imports":[]},
+{"name":"flare.util.math.SparseMatrix","size":3366,"imports":["flare.util.math.IMatrix"]},
+{"name":"flare.util.Maths","size":17705,"imports":["flare.util.Arrays"]},
+{"name":"flare.util.Orientation","size":1486,"imports":[]},
+{"name":"flare.util.palette.ColorPalette","size":6367,"imports":["flare.util.palette.Palette","flare.util.Colors"]},
+{"name":"flare.util.palette.Palette","size":1229,"imports":[]},
+{"name":"flare.util.palette.ShapePalette","size":2059,"imports":["flare.util.palette.Palette","flare.util.Shapes"]},
+{"name":"flare.util.palette.SizePalette","size":2291,"imports":["flare.util.palette.Palette"]},
+{"name":"flare.util.Property","size":5559,"imports":["flare.util.IPredicate","flare.util.IValueProxy","flare.util.IEvaluable"]},
+{"name":"flare.util.Shapes","size":19118,"imports":["flare.util.Arrays"]},
+{"name":"flare.util.Sort","size":6887,"imports":["flare.util.Arrays","flare.util.Property"]},
+{"name":"flare.util.Stats","size":6557,"imports":["flare.util.Arrays","flare.util.Property"]},
+{"name":"flare.util.Strings","size":22026,"imports":["flare.util.Dates","flare.util.Property"]},
+{"name":"flare.vis.axis.Axes","size":1302,"imports":["flare.animate.Transitioner","flare.vis.Visualization"]},
+{"name":"flare.vis.axis.Axis","size":24593,"imports":["flare.animate.Transitioner","flare.scale.LinearScale","flare.util.Arrays","flare.scale.ScaleType","flare.util.Strings","flare.display.TextSprite","flare.scale.Scale","flare.util.Stats","flare.scale.IScaleMap","flare.vis.axis.AxisLabel","flare.vis.axis.AxisGridLine"]},
+{"name":"flare.vis.axis.AxisGridLine","size":652,"imports":["flare.vis.axis.Axis","flare.display.LineSprite"]},
+{"name":"flare.vis.axis.AxisLabel","size":636,"imports":["flare.vis.axis.Axis","flare.display.TextSprite"]},
+{"name":"flare.vis.axis.CartesianAxes","size":6703,"imports":["flare.animate.Transitioner","flare.display.RectSprite","flare.vis.axis.Axis","flare.display.TextSprite","flare.vis.axis.Axes","flare.vis.Visualization","flare.vis.axis.AxisGridLine"]},
+{"name":"flare.vis.controls.AnchorControl","size":2138,"imports":["flare.vis.controls.Control","flare.vis.Visualization","flare.vis.operator.layout.Layout"]},
+{"name":"flare.vis.controls.ClickControl","size":3824,"imports":["flare.vis.events.SelectionEvent","flare.vis.controls.Control"]},
+{"name":"flare.vis.controls.Control","size":1353,"imports":["flare.vis.controls.IControl","flare.util.Filter"]},
+{"name":"flare.vis.controls.ControlList","size":4665,"imports":["flare.vis.controls.IControl","flare.util.Arrays","flare.vis.Visualization","flare.vis.controls.Control"]},
+{"name":"flare.vis.controls.DragControl","size":2649,"imports":["flare.vis.controls.Control","flare.vis.data.DataSprite"]},
+{"name":"flare.vis.controls.ExpandControl","size":2832,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.controls.Control","flare.vis.Visualization"]},
+{"name":"flare.vis.controls.HoverControl","size":4896,"imports":["flare.vis.events.SelectionEvent","flare.vis.controls.Control"]},
+{"name":"flare.vis.controls.IControl","size":763,"imports":["flare.vis.controls.Control"]},
+{"name":"flare.vis.controls.PanZoomControl","size":5222,"imports":["flare.util.Displays","flare.vis.controls.Control"]},
+{"name":"flare.vis.controls.SelectionControl","size":7862,"imports":["flare.vis.events.SelectionEvent","flare.vis.controls.Control"]},
+{"name":"flare.vis.controls.TooltipControl","size":8435,"imports":["flare.animate.Tween","flare.display.TextSprite","flare.vis.controls.Control","flare.vis.events.TooltipEvent"]},
+{"name":"flare.vis.data.Data","size":20544,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.data.DataSprite","flare.vis.data.Tree","flare.vis.events.DataEvent","flare.data.DataSet","flare.vis.data.TreeBuilder","flare.vis.data.DataList","flare.data.DataSchema","flare.util.Sort","flare.data.DataField","flare.util.Property"]},
+{"name":"flare.vis.data.DataList","size":19788,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Arrays","flare.util.math.DenseMatrix","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.events.DataEvent","flare.util.Stats","flare.util.math.IMatrix","flare.util.Sort","flare.util.Filter","flare.util.Property","flare.util.IEvaluable","flare.vis.data.Data"]},
+{"name":"flare.vis.data.DataSprite","size":10349,"imports":["flare.util.Colors","flare.vis.data.Data","flare.display.DirtySprite","flare.vis.data.render.IRenderer","flare.vis.data.render.ShapeRenderer"]},
+{"name":"flare.vis.data.EdgeSprite","size":3301,"imports":["flare.vis.data.render.EdgeRenderer","flare.vis.data.DataSprite","flare.vis.data.NodeSprite","flare.vis.data.render.ArrowType","flare.vis.data.Data"]},
+{"name":"flare.vis.data.NodeSprite","size":19382,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.data.Tree","flare.util.Sort","flare.util.Filter","flare.util.IEvaluable","flare.vis.data.Data"]},
+{"name":"flare.vis.data.render.ArrowType","size":698,"imports":[]},
+{"name":"flare.vis.data.render.EdgeRenderer","size":5569,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.DataSprite","flare.vis.data.render.IRenderer","flare.util.Shapes","flare.util.Geometry","flare.vis.data.render.ArrowType"]},
+{"name":"flare.vis.data.render.IRenderer","size":353,"imports":["flare.vis.data.DataSprite"]},
+{"name":"flare.vis.data.render.ShapeRenderer","size":2247,"imports":["flare.util.Shapes","flare.vis.data.render.IRenderer","flare.vis.data.DataSprite"]},
+{"name":"flare.vis.data.ScaleBinding","size":11275,"imports":["flare.scale.TimeScale","flare.scale.ScaleType","flare.scale.LinearScale","flare.scale.LogScale","flare.scale.OrdinalScale","flare.scale.RootScale","flare.scale.Scale","flare.scale.QuantileScale","flare.util.Stats","flare.scale.QuantitativeScale","flare.vis.events.DataEvent","flare.vis.data.Data"]},
+{"name":"flare.vis.data.Tree","size":7147,"imports":["flare.vis.data.EdgeSprite","flare.vis.events.DataEvent","flare.vis.data.NodeSprite","flare.vis.data.Data"]},
+{"name":"flare.vis.data.TreeBuilder","size":9930,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.Tree","flare.util.heap.HeapNode","flare.util.heap.FibonacciHeap","flare.util.Property","flare.util.IEvaluable","flare.vis.data.Data"]},
+{"name":"flare.vis.events.DataEvent","size":2313,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.DataSprite"]},
+{"name":"flare.vis.events.SelectionEvent","size":1880,"imports":["flare.vis.events.DataEvent"]},
+{"name":"flare.vis.events.TooltipEvent","size":1701,"imports":["flare.vis.data.EdgeSprite","flare.vis.data.NodeSprite"]},
+{"name":"flare.vis.events.VisualizationEvent","size":1117,"imports":["flare.animate.Transitioner"]},
+{"name":"flare.vis.legend.Legend","size":20859,"imports":["flare.animate.Transitioner","flare.vis.data.ScaleBinding","flare.util.palette.SizePalette","flare.scale.ScaleType","flare.vis.legend.LegendItem","flare.display.RectSprite","flare.display.TextSprite","flare.scale.Scale","flare.vis.legend.LegendRange","flare.util.Displays","flare.util.Orientation","flare.util.palette.ShapePalette","flare.util.palette.Palette","flare.util.palette.ColorPalette"]},
+{"name":"flare.vis.legend.LegendItem","size":4614,"imports":["flare.util.Shapes","flare.display.TextSprite","flare.vis.legend.Legend","flare.display.RectSprite"]},
+{"name":"flare.vis.legend.LegendRange","size":10530,"imports":["flare.util.Colors","flare.vis.legend.Legend","flare.display.RectSprite","flare.display.TextSprite","flare.scale.Scale","flare.util.Stats","flare.scale.IScaleMap","flare.util.Orientation","flare.util.palette.ColorPalette"]},
+{"name":"flare.vis.operator.distortion.BifocalDistortion","size":4461,"imports":["flare.vis.operator.distortion.Distortion"]},
+{"name":"flare.vis.operator.distortion.Distortion","size":6314,"imports":["flare.animate.Transitioner","flare.vis.data.DataSprite","flare.vis.events.VisualizationEvent","flare.vis.axis.Axis","flare.vis.axis.CartesianAxes","flare.vis.operator.layout.Layout","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.distortion.FisheyeDistortion","size":3444,"imports":["flare.vis.operator.distortion.Distortion"]},
+{"name":"flare.vis.operator.encoder.ColorEncoder","size":3179,"imports":["flare.animate.Transitioner","flare.scale.ScaleType","flare.vis.operator.encoder.Encoder","flare.util.palette.Palette","flare.util.palette.ColorPalette","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.encoder.Encoder","size":4060,"imports":["flare.animate.Transitioner","flare.vis.data.DataSprite","flare.vis.operator.Operator","flare.vis.data.ScaleBinding","flare.util.palette.Palette","flare.util.Filter","flare.util.Property","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.encoder.PropertyEncoder","size":4138,"imports":["flare.animate.Transitioner","flare.vis.data.DataList","flare.vis.data.Data","flare.vis.operator.encoder.Encoder","flare.util.Filter","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.encoder.ShapeEncoder","size":1690,"imports":["flare.util.palette.Palette","flare.scale.ScaleType","flare.util.palette.ShapePalette","flare.vis.operator.encoder.Encoder","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.encoder.SizeEncoder","size":1830,"imports":["flare.util.palette.Palette","flare.scale.ScaleType","flare.vis.operator.encoder.Encoder","flare.util.palette.SizePalette","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.filter.FisheyeTreeFilter","size":5219,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.data.Tree","flare.vis.operator.Operator","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.filter.GraphDistanceFilter","size":3165,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.operator.Operator","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite"]},
+{"name":"flare.vis.operator.filter.VisibilityFilter","size":3509,"imports":["flare.vis.operator.Operator","flare.animate.Transitioner","flare.util.Filter","flare.vis.data.DataSprite","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.IOperator","size":1286,"imports":["flare.animate.Transitioner","flare.vis.Visualization","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.label.Labeler","size":9956,"imports":["flare.animate.Transitioner","flare.vis.data.DataSprite","flare.display.TextSprite","flare.vis.operator.Operator","flare.util.Shapes","flare.util.Filter","flare.util.Property","flare.util.IEvaluable","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.label.RadialLabeler","size":3899,"imports":["flare.vis.operator.label.Labeler","flare.util.Shapes","flare.display.TextSprite","flare.vis.data.DataSprite","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.label.StackedAreaLabeler","size":3202,"imports":["flare.vis.operator.label.Labeler","flare.display.TextSprite","flare.vis.data.DataSprite","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.AxisLayout","size":6725,"imports":["flare.scale.ScaleType","flare.vis.data.DataSprite","flare.vis.axis.CartesianAxes","flare.vis.data.ScaleBinding","flare.util.Property","flare.vis.operator.layout.Layout","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.BundledEdgeRouter","size":3727,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.util.Shapes","flare.vis.operator.layout.Layout","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.layout.CircleLayout","size":9317,"imports":["flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.ScaleBinding","flare.util.Property","flare.vis.operator.layout.Layout","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.CirclePackingLayout","size":12003,"imports":["flare.vis.data.NodeSprite","flare.vis.data.render.ShapeRenderer","flare.util.Shapes","flare.util.Sort","flare.vis.operator.layout.Layout","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.DendrogramLayout","size":4853,"imports":["flare.util.Property","flare.vis.data.NodeSprite","flare.util.Orientation","flare.vis.operator.layout.Layout","flare.vis.data.EdgeSprite"]},
+{"name":"flare.vis.operator.layout.ForceDirectedLayout","size":8411,"imports":["flare.physics.Simulation","flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataSprite","flare.physics.Particle","flare.physics.Spring","flare.vis.operator.layout.Layout","flare.vis.data.EdgeSprite","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.IcicleTreeLayout","size":4864,"imports":["flare.vis.data.NodeSprite","flare.util.Orientation","flare.vis.operator.layout.Layout"]},
+{"name":"flare.vis.operator.layout.IndentedTreeLayout","size":3174,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.operator.layout.Layout","flare.vis.data.EdgeSprite"]},
+{"name":"flare.vis.operator.layout.Layout","size":7881,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.vis.data.DataList","flare.vis.data.DataSprite","flare.vis.data.EdgeSprite","flare.vis.Visualization","flare.vis.axis.CartesianAxes","flare.vis.axis.Axes","flare.animate.TransitionEvent","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.layout.NodeLinkTreeLayout","size":12870,"imports":["flare.vis.data.NodeSprite","flare.util.Arrays","flare.util.Orientation","flare.vis.operator.layout.Layout"]},
+{"name":"flare.vis.operator.layout.PieLayout","size":2728,"imports":["flare.vis.data.DataList","flare.vis.data.DataSprite","flare.util.Shapes","flare.util.Property","flare.vis.operator.layout.Layout","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.RadialTreeLayout","size":12348,"imports":["flare.vis.data.NodeSprite","flare.util.Arrays","flare.vis.operator.layout.Layout"]},
+{"name":"flare.vis.operator.layout.RandomLayout","size":870,"imports":["flare.vis.operator.layout.Layout","flare.vis.data.DataSprite","flare.vis.data.Data"]},
+{"name":"flare.vis.operator.layout.StackedAreaLayout","size":9121,"imports":["flare.scale.TimeScale","flare.scale.LinearScale","flare.util.Arrays","flare.scale.OrdinalScale","flare.vis.data.NodeSprite","flare.scale.Scale","flare.vis.axis.CartesianAxes","flare.util.Stats","flare.util.Orientation","flare.scale.QuantitativeScale","flare.util.Maths","flare.vis.operator.layout.Layout"]},
+{"name":"flare.vis.operator.layout.TreeMapLayout","size":9191,"imports":["flare.animate.Transitioner","flare.vis.data.NodeSprite","flare.util.Property","flare.vis.operator.layout.Layout"]},
+{"name":"flare.vis.operator.Operator","size":2490,"imports":["flare.animate.Transitioner","flare.vis.operator.IOperator","flare.util.Property","flare.util.IEvaluable","flare.vis.Visualization"]},
+{"name":"flare.vis.operator.OperatorList","size":5248,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.operator.IOperator","flare.vis.Visualization","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.OperatorSequence","size":4190,"imports":["flare.animate.Transitioner","flare.util.Arrays","flare.vis.operator.IOperator","flare.vis.operator.OperatorList","flare.animate.FunctionSequence","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.OperatorSwitch","size":2581,"imports":["flare.animate.Transitioner","flare.vis.operator.OperatorList","flare.vis.operator.IOperator","flare.vis.operator.Operator"]},
+{"name":"flare.vis.operator.SortOperator","size":2023,"imports":["flare.vis.operator.Operator","flare.animate.Transitioner","flare.util.Arrays","flare.vis.data.Data"]},
+{"name":"flare.vis.Visualization","size":16540,"imports":["flare.animate.Transitioner","flare.vis.operator.IOperator","flare.animate.Scheduler","flare.vis.events.VisualizationEvent","flare.vis.data.Tree","flare.vis.events.DataEvent","flare.vis.axis.Axes","flare.vis.axis.CartesianAxes","flare.util.Displays","flare.vis.operator.OperatorList","flare.vis.controls.ControlList","flare.animate.ISchedulable","flare.vis.data.Data"]}
+]
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare.json b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare.json
new file mode 100644
index 0000000..a05a948
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/flare.json
@@ -0,0 +1,380 @@
+{
+ "name": "flare",
+ "children": [
+ {
+ "name": "analytics",
+ "children": [
+ {
+ "name": "cluster",
+ "children": [
+ {"name": "AgglomerativeCluster", "size": 3938},
+ {"name": "CommunityStructure", "size": 3812},
+ {"name": "HierarchicalCluster", "size": 6714},
+ {"name": "MergeEdge", "size": 743}
+ ]
+ },
+ {
+ "name": "graph",
+ "children": [
+ {"name": "BetweennessCentrality", "size": 3534},
+ {"name": "LinkDistance", "size": 5731},
+ {"name": "MaxFlowMinCut", "size": 7840},
+ {"name": "ShortestPaths", "size": 5914},
+ {"name": "SpanningTree", "size": 3416}
+ ]
+ },
+ {
+ "name": "optimization",
+ "children": [
+ {"name": "AspectRatioBanker", "size": 7074}
+ ]
+ }
+ ]
+ },
+ {
+ "name": "animate",
+ "children": [
+ {"name": "Easing", "size": 17010},
+ {"name": "FunctionSequence", "size": 5842},
+ {
+ "name": "interpolate",
+ "children": [
+ {"name": "ArrayInterpolator", "size": 1983},
+ {"name": "ColorInterpolator", "size": 2047},
+ {"name": "DateInterpolator", "size": 1375},
+ {"name": "Interpolator", "size": 8746},
+ {"name": "MatrixInterpolator", "size": 2202},
+ {"name": "NumberInterpolator", "size": 1382},
+ {"name": "ObjectInterpolator", "size": 1629},
+ {"name": "PointInterpolator", "size": 1675},
+ {"name": "RectangleInterpolator", "size": 2042}
+ ]
+ },
+ {"name": "ISchedulable", "size": 1041},
+ {"name": "Parallel", "size": 5176},
+ {"name": "Pause", "size": 449},
+ {"name": "Scheduler", "size": 5593},
+ {"name": "Sequence", "size": 5534},
+ {"name": "Transition", "size": 9201},
+ {"name": "Transitioner", "size": 19975},
+ {"name": "TransitionEvent", "size": 1116},
+ {"name": "Tween", "size": 6006}
+ ]
+ },
+ {
+ "name": "data",
+ "children": [
+ {
+ "name": "converters",
+ "children": [
+ {"name": "Converters", "size": 721},
+ {"name": "DelimitedTextConverter", "size": 4294},
+ {"name": "GraphMLConverter", "size": 9800},
+ {"name": "IDataConverter", "size": 1314},
+ {"name": "JSONConverter", "size": 2220}
+ ]
+ },
+ {"name": "DataField", "size": 1759},
+ {"name": "DataSchema", "size": 2165},
+ {"name": "DataSet", "size": 586},
+ {"name": "DataSource", "size": 3331},
+ {"name": "DataTable", "size": 772},
+ {"name": "DataUtil", "size": 3322}
+ ]
+ },
+ {
+ "name": "display",
+ "children": [
+ {"name": "DirtySprite", "size": 8833},
+ {"name": "LineSprite", "size": 1732},
+ {"name": "RectSprite", "size": 3623},
+ {"name": "TextSprite", "size": 10066}
+ ]
+ },
+ {
+ "name": "flex",
+ "children": [
+ {"name": "FlareVis", "size": 4116}
+ ]
+ },
+ {
+ "name": "physics",
+ "children": [
+ {"name": "DragForce", "size": 1082},
+ {"name": "GravityForce", "size": 1336},
+ {"name": "IForce", "size": 319},
+ {"name": "NBodyForce", "size": 10498},
+ {"name": "Particle", "size": 2822},
+ {"name": "Simulation", "size": 9983},
+ {"name": "Spring", "size": 2213},
+ {"name": "SpringForce", "size": 1681}
+ ]
+ },
+ {
+ "name": "query",
+ "children": [
+ {"name": "AggregateExpression", "size": 1616},
+ {"name": "And", "size": 1027},
+ {"name": "Arithmetic", "size": 3891},
+ {"name": "Average", "size": 891},
+ {"name": "BinaryExpression", "size": 2893},
+ {"name": "Comparison", "size": 5103},
+ {"name": "CompositeExpression", "size": 3677},
+ {"name": "Count", "size": 781},
+ {"name": "DateUtil", "size": 4141},
+ {"name": "Distinct", "size": 933},
+ {"name": "Expression", "size": 5130},
+ {"name": "ExpressionIterator", "size": 3617},
+ {"name": "Fn", "size": 3240},
+ {"name": "If", "size": 2732},
+ {"name": "IsA", "size": 2039},
+ {"name": "Literal", "size": 1214},
+ {"name": "Match", "size": 3748},
+ {"name": "Maximum", "size": 843},
+ {
+ "name": "methods",
+ "children": [
+ {"name": "add", "size": 593},
+ {"name": "and", "size": 330},
+ {"name": "average", "size": 287},
+ {"name": "count", "size": 277},
+ {"name": "distinct", "size": 292},
+ {"name": "div", "size": 595},
+ {"name": "eq", "size": 594},
+ {"name": "fn", "size": 460},
+ {"name": "gt", "size": 603},
+ {"name": "gte", "size": 625},
+ {"name": "iff", "size": 748},
+ {"name": "isa", "size": 461},
+ {"name": "lt", "size": 597},
+ {"name": "lte", "size": 619},
+ {"name": "max", "size": 283},
+ {"name": "min", "size": 283},
+ {"name": "mod", "size": 591},
+ {"name": "mul", "size": 603},
+ {"name": "neq", "size": 599},
+ {"name": "not", "size": 386},
+ {"name": "or", "size": 323},
+ {"name": "orderby", "size": 307},
+ {"name": "range", "size": 772},
+ {"name": "select", "size": 296},
+ {"name": "stddev", "size": 363},
+ {"name": "sub", "size": 600},
+ {"name": "sum", "size": 280},
+ {"name": "update", "size": 307},
+ {"name": "variance", "size": 335},
+ {"name": "where", "size": 299},
+ {"name": "xor", "size": 354},
+ {"name": "_", "size": 264}
+ ]
+ },
+ {"name": "Minimum", "size": 843},
+ {"name": "Not", "size": 1554},
+ {"name": "Or", "size": 970},
+ {"name": "Query", "size": 13896},
+ {"name": "Range", "size": 1594},
+ {"name": "StringUtil", "size": 4130},
+ {"name": "Sum", "size": 791},
+ {"name": "Variable", "size": 1124},
+ {"name": "Variance", "size": 1876},
+ {"name": "Xor", "size": 1101}
+ ]
+ },
+ {
+ "name": "scale",
+ "children": [
+ {"name": "IScaleMap", "size": 2105},
+ {"name": "LinearScale", "size": 1316},
+ {"name": "LogScale", "size": 3151},
+ {"name": "OrdinalScale", "size": 3770},
+ {"name": "QuantileScale", "size": 2435},
+ {"name": "QuantitativeScale", "size": 4839},
+ {"name": "RootScale", "size": 1756},
+ {"name": "Scale", "size": 4268},
+ {"name": "ScaleType", "size": 1821},
+ {"name": "TimeScale", "size": 5833}
+ ]
+ },
+ {
+ "name": "util",
+ "children": [
+ {"name": "Arrays", "size": 8258},
+ {"name": "Colors", "size": 10001},
+ {"name": "Dates", "size": 8217},
+ {"name": "Displays", "size": 12555},
+ {"name": "Filter", "size": 2324},
+ {"name": "Geometry", "size": 10993},
+ {
+ "name": "heap",
+ "children": [
+ {"name": "FibonacciHeap", "size": 9354},
+ {"name": "HeapNode", "size": 1233}
+ ]
+ },
+ {"name": "IEvaluable", "size": 335},
+ {"name": "IPredicate", "size": 383},
+ {"name": "IValueProxy", "size": 874},
+ {
+ "name": "math",
+ "children": [
+ {"name": "DenseMatrix", "size": 3165},
+ {"name": "IMatrix", "size": 2815},
+ {"name": "SparseMatrix", "size": 3366}
+ ]
+ },
+ {"name": "Maths", "size": 17705},
+ {"name": "Orientation", "size": 1486},
+ {
+ "name": "palette",
+ "children": [
+ {"name": "ColorPalette", "size": 6367},
+ {"name": "Palette", "size": 1229},
+ {"name": "ShapePalette", "size": 2059},
+ {"name": "SizePalette", "size": 2291}
+ ]
+ },
+ {"name": "Property", "size": 5559},
+ {"name": "Shapes", "size": 19118},
+ {"name": "Sort", "size": 6887},
+ {"name": "Stats", "size": 6557},
+ {"name": "Strings", "size": 22026}
+ ]
+ },
+ {
+ "name": "vis",
+ "children": [
+ {
+ "name": "axis",
+ "children": [
+ {"name": "Axes", "size": 1302},
+ {"name": "Axis", "size": 24593},
+ {"name": "AxisGridLine", "size": 652},
+ {"name": "AxisLabel", "size": 636},
+ {"name": "CartesianAxes", "size": 6703}
+ ]
+ },
+ {
+ "name": "controls",
+ "children": [
+ {"name": "AnchorControl", "size": 2138},
+ {"name": "ClickControl", "size": 3824},
+ {"name": "Control", "size": 1353},
+ {"name": "ControlList", "size": 4665},
+ {"name": "DragControl", "size": 2649},
+ {"name": "ExpandControl", "size": 2832},
+ {"name": "HoverControl", "size": 4896},
+ {"name": "IControl", "size": 763},
+ {"name": "PanZoomControl", "size": 5222},
+ {"name": "SelectionControl", "size": 7862},
+ {"name": "TooltipControl", "size": 8435}
+ ]
+ },
+ {
+ "name": "data",
+ "children": [
+ {"name": "Data", "size": 20544},
+ {"name": "DataList", "size": 19788},
+ {"name": "DataSprite", "size": 10349},
+ {"name": "EdgeSprite", "size": 3301},
+ {"name": "NodeSprite", "size": 19382},
+ {
+ "name": "render",
+ "children": [
+ {"name": "ArrowType", "size": 698},
+ {"name": "EdgeRenderer", "size": 5569},
+ {"name": "IRenderer", "size": 353},
+ {"name": "ShapeRenderer", "size": 2247}
+ ]
+ },
+ {"name": "ScaleBinding", "size": 11275},
+ {"name": "Tree", "size": 7147},
+ {"name": "TreeBuilder", "size": 9930}
+ ]
+ },
+ {
+ "name": "events",
+ "children": [
+ {"name": "DataEvent", "size": 2313},
+ {"name": "SelectionEvent", "size": 1880},
+ {"name": "TooltipEvent", "size": 1701},
+ {"name": "VisualizationEvent", "size": 1117}
+ ]
+ },
+ {
+ "name": "legend",
+ "children": [
+ {"name": "Legend", "size": 20859},
+ {"name": "LegendItem", "size": 4614},
+ {"name": "LegendRange", "size": 10530}
+ ]
+ },
+ {
+ "name": "operator",
+ "children": [
+ {
+ "name": "distortion",
+ "children": [
+ {"name": "BifocalDistortion", "size": 4461},
+ {"name": "Distortion", "size": 6314},
+ {"name": "FisheyeDistortion", "size": 3444}
+ ]
+ },
+ {
+ "name": "encoder",
+ "children": [
+ {"name": "ColorEncoder", "size": 3179},
+ {"name": "Encoder", "size": 4060},
+ {"name": "PropertyEncoder", "size": 4138},
+ {"name": "ShapeEncoder", "size": 1690},
+ {"name": "SizeEncoder", "size": 1830}
+ ]
+ },
+ {
+ "name": "filter",
+ "children": [
+ {"name": "FisheyeTreeFilter", "size": 5219},
+ {"name": "GraphDistanceFilter", "size": 3165},
+ {"name": "VisibilityFilter", "size": 3509}
+ ]
+ },
+ {"name": "IOperator", "size": 1286},
+ {
+ "name": "label",
+ "children": [
+ {"name": "Labeler", "size": 9956},
+ {"name": "RadialLabeler", "size": 3899},
+ {"name": "StackedAreaLabeler", "size": 3202}
+ ]
+ },
+ {
+ "name": "layout",
+ "children": [
+ {"name": "AxisLayout", "size": 6725},
+ {"name": "BundledEdgeRouter", "size": 3727},
+ {"name": "CircleLayout", "size": 9317},
+ {"name": "CirclePackingLayout", "size": 12003},
+ {"name": "DendrogramLayout", "size": 4853},
+ {"name": "ForceDirectedLayout", "size": 8411},
+ {"name": "IcicleTreeLayout", "size": 4864},
+ {"name": "IndentedTreeLayout", "size": 3174},
+ {"name": "Layout", "size": 7881},
+ {"name": "NodeLinkTreeLayout", "size": 12870},
+ {"name": "PieLayout", "size": 2728},
+ {"name": "RadialTreeLayout", "size": 12348},
+ {"name": "RandomLayout", "size": 870},
+ {"name": "StackedAreaLayout", "size": 9121},
+ {"name": "TreeMapLayout", "size": 9191}
+ ]
+ },
+ {"name": "Operator", "size": 2490},
+ {"name": "OperatorList", "size": 5248},
+ {"name": "OperatorSequence", "size": 4190},
+ {"name": "OperatorSwitch", "size": 2581},
+ {"name": "SortOperator", "size": 2023}
+ ]
+ },
+ {"name": "Visualization", "size": 16540}
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-bounds.html b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-bounds.html
new file mode 100644
index 0000000..d747c61
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-bounds.html
@@ -0,0 +1,151 @@
+
+
+
+ Force-Directed Layout
+
+
+
+
+
+
+
+
+
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-collapsible.html b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-collapsible.html
new file mode 100644
index 0000000..a8502e9
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/force-collapsible.html
@@ -0,0 +1,142 @@
+
+
+
+
+ Force-Directed Graph
+
+
+
+
+
+
+
+
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/miserables.json b/projects/Data Visualization Software Java Project/Data Visualization/Examples/miserables.json
new file mode 100644
index 0000000..8ac8437
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/miserables.json
@@ -0,0 +1 @@
+{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},{"name":"Woman1","group":2},{"name":"Judge","group":2},{"name":"Champmathieu","group":2},{"name":"Brevet","group":2},{"name":"Chenildieu","group":2},{"name":"Cochepaille","group":2},{"name":"Pontmercy","group":4},{"name":"Boulatruelle","group":6},{"name":"Eponine","group":4},{"name":"Anzelma","group":4},{"name":"Woman2","group":5},{"name":"MotherInnocent","group":0},{"name":"Gribier","group":0},{"name":"Jondrette","group":7},{"name":"Mme.Burgon","group":7},{"name":"Gavroche","group":8},{"name":"Gillenormand","group":5},{"name":"Magnon","group":5},{"name":"Mlle.Gillenormand","group":5},{"name":"Mme.Pontmercy","group":5},{"name":"Mlle.Vaubois","group":5},{"name":"Lt.Gillenormand","group":5},{"name":"Marius","group":8},{"name":"BaronessT","group":5},{"name":"Mabeuf","group":8},{"name":"Enjolras","group":8},{"name":"Combeferre","group":8},{"name":"Prouvaire","group":8},{"name":"Feuilly","group":8},{"name":"Courfeyrac","group":8},{"name":"Bahorel","group":8},{"name":"Bossuet","group":8},{"name":"Joly","group":8},{"name":"Grantaire","group":8},{"name":"MotherPlutarch","group":9},{"name":"Gueulemer","group":4},{"name":"Babet","group":4},{"name":"Claquesous","group":4},{"name":"Montparnasse","group":4},{"name":"Toussaint","group":5},{"name":"Child1","group":10},{"name":"Child2","group":10},{"name":"Brujon","group":4},{"name":"Mme.Hucheloup","group":8}],"links":[{"source":1,"target":0,"value":1},{"source":2,"target":0,"value":8},{"source":3,"target":0,"value":10},{"source":3,"target":2,"value":6},{"source":4,"target":0,"value":1},{"source":5,"target":0,"value":1},{"source":6,"target":0,"value":1},{"source":7,"target":0,"value":1},{"source":8,"target":0,"value":2},{"source":9,"target":0,"value":1},{"source":11,"target":10,"value":1},{"source":11,"target":3,"value":3},{"source":11,"target":2,"value":3},{"source":11,"target":0,"value":5},{"source":12,"target":11,"value":1},{"source":13,"target":11,"value":1},{"source":14,"target":11,"value":1},{"source":15,"target":11,"value":1},{"source":17,"target":16,"value":4},{"source":18,"target":16,"value":4},{"source":18,"target":17,"value":4},{"source":19,"target":16,"value":4},{"source":19,"target":17,"value":4},{"source":19,"target":18,"value":4},{"source":20,"target":16,"value":3},{"source":20,"target":17,"value":3},{"source":20,"target":18,"value":3},{"source":20,"target":19,"value":4},{"source":21,"target":16,"value":3},{"source":21,"target":17,"value":3},{"source":21,"target":18,"value":3},{"source":21,"target":19,"value":3},{"source":21,"target":20,"value":5},{"source":22,"target":16,"value":3},{"source":22,"target":17,"value":3},{"source":22,"target":18,"value":3},{"source":22,"target":19,"value":3},{"source":22,"target":20,"value":4},{"source":22,"target":21,"value":4},{"source":23,"target":16,"value":3},{"source":23,"target":17,"value":3},{"source":23,"target":18,"value":3},{"source":23,"target":19,"value":3},{"source":23,"target":20,"value":4},{"source":23,"target":21,"value":4},{"source":23,"target":22,"value":4},{"source":23,"target":12,"value":2},{"source":23,"target":11,"value":9},{"source":24,"target":23,"value":2},{"source":24,"target":11,"value":7},{"source":25,"target":24,"value":13},{"source":25,"target":23,"value":1},{"source":25,"target":11,"value":12},{"source":26,"target":24,"value":4},{"source":26,"target":11,"value":31},{"source":26,"target":16,"value":1},{"source":26,"target":25,"value":1},{"source":27,"target":11,"value":17},{"source":27,"target":23,"value":5},{"source":27,"target":25,"value":5},{"source":27,"target":24,"value":1},{"source":27,"target":26,"value":1},{"source":28,"target":11,"value":8},{"source":28,"target":27,"value":1},{"source":29,"target":23,"value":1},{"source":29,"target":27,"value":1},{"source":29,"target":11,"value":2},{"source":30,"target":23,"value":1},{"source":31,"target":30,"value":2},{"source":31,"target":11,"value":3},{"source":31,"target":23,"value":2},{"source":31,"target":27,"value":1},{"source":32,"target":11,"value":1},{"source":33,"target":11,"value":2},{"source":33,"target":27,"value":1},{"source":34,"target":11,"value":3},{"source":34,"target":29,"value":2},{"source":35,"target":11,"value":3},{"source":35,"target":34,"value":3},{"source":35,"target":29,"value":2},{"source":36,"target":34,"value":2},{"source":36,"target":35,"value":2},{"source":36,"target":11,"value":2},{"source":36,"target":29,"value":1},{"source":37,"target":34,"value":2},{"source":37,"target":35,"value":2},{"source":37,"target":36,"value":2},{"source":37,"target":11,"value":2},{"source":37,"target":29,"value":1},{"source":38,"target":34,"value":2},{"source":38,"target":35,"value":2},{"source":38,"target":36,"value":2},{"source":38,"target":37,"value":2},{"source":38,"target":11,"value":2},{"source":38,"target":29,"value":1},{"source":39,"target":25,"value":1},{"source":40,"target":25,"value":1},{"source":41,"target":24,"value":2},{"source":41,"target":25,"value":3},{"source":42,"target":41,"value":2},{"source":42,"target":25,"value":2},{"source":42,"target":24,"value":1},{"source":43,"target":11,"value":3},{"source":43,"target":26,"value":1},{"source":43,"target":27,"value":1},{"source":44,"target":28,"value":3},{"source":44,"target":11,"value":1},{"source":45,"target":28,"value":2},{"source":47,"target":46,"value":1},{"source":48,"target":47,"value":2},{"source":48,"target":25,"value":1},{"source":48,"target":27,"value":1},{"source":48,"target":11,"value":1},{"source":49,"target":26,"value":3},{"source":49,"target":11,"value":2},{"source":50,"target":49,"value":1},{"source":50,"target":24,"value":1},{"source":51,"target":49,"value":9},{"source":51,"target":26,"value":2},{"source":51,"target":11,"value":2},{"source":52,"target":51,"value":1},{"source":52,"target":39,"value":1},{"source":53,"target":51,"value":1},{"source":54,"target":51,"value":2},{"source":54,"target":49,"value":1},{"source":54,"target":26,"value":1},{"source":55,"target":51,"value":6},{"source":55,"target":49,"value":12},{"source":55,"target":39,"value":1},{"source":55,"target":54,"value":1},{"source":55,"target":26,"value":21},{"source":55,"target":11,"value":19},{"source":55,"target":16,"value":1},{"source":55,"target":25,"value":2},{"source":55,"target":41,"value":5},{"source":55,"target":48,"value":4},{"source":56,"target":49,"value":1},{"source":56,"target":55,"value":1},{"source":57,"target":55,"value":1},{"source":57,"target":41,"value":1},{"source":57,"target":48,"value":1},{"source":58,"target":55,"value":7},{"source":58,"target":48,"value":7},{"source":58,"target":27,"value":6},{"source":58,"target":57,"value":1},{"source":58,"target":11,"value":4},{"source":59,"target":58,"value":15},{"source":59,"target":55,"value":5},{"source":59,"target":48,"value":6},{"source":59,"target":57,"value":2},{"source":60,"target":48,"value":1},{"source":60,"target":58,"value":4},{"source":60,"target":59,"value":2},{"source":61,"target":48,"value":2},{"source":61,"target":58,"value":6},{"source":61,"target":60,"value":2},{"source":61,"target":59,"value":5},{"source":61,"target":57,"value":1},{"source":61,"target":55,"value":1},{"source":62,"target":55,"value":9},{"source":62,"target":58,"value":17},{"source":62,"target":59,"value":13},{"source":62,"target":48,"value":7},{"source":62,"target":57,"value":2},{"source":62,"target":41,"value":1},{"source":62,"target":61,"value":6},{"source":62,"target":60,"value":3},{"source":63,"target":59,"value":5},{"source":63,"target":48,"value":5},{"source":63,"target":62,"value":6},{"source":63,"target":57,"value":2},{"source":63,"target":58,"value":4},{"source":63,"target":61,"value":3},{"source":63,"target":60,"value":2},{"source":63,"target":55,"value":1},{"source":64,"target":55,"value":5},{"source":64,"target":62,"value":12},{"source":64,"target":48,"value":5},{"source":64,"target":63,"value":4},{"source":64,"target":58,"value":10},{"source":64,"target":61,"value":6},{"source":64,"target":60,"value":2},{"source":64,"target":59,"value":9},{"source":64,"target":57,"value":1},{"source":64,"target":11,"value":1},{"source":65,"target":63,"value":5},{"source":65,"target":64,"value":7},{"source":65,"target":48,"value":3},{"source":65,"target":62,"value":5},{"source":65,"target":58,"value":5},{"source":65,"target":61,"value":5},{"source":65,"target":60,"value":2},{"source":65,"target":59,"value":5},{"source":65,"target":57,"value":1},{"source":65,"target":55,"value":2},{"source":66,"target":64,"value":3},{"source":66,"target":58,"value":3},{"source":66,"target":59,"value":1},{"source":66,"target":62,"value":2},{"source":66,"target":65,"value":2},{"source":66,"target":48,"value":1},{"source":66,"target":63,"value":1},{"source":66,"target":61,"value":1},{"source":66,"target":60,"value":1},{"source":67,"target":57,"value":3},{"source":68,"target":25,"value":5},{"source":68,"target":11,"value":1},{"source":68,"target":24,"value":1},{"source":68,"target":27,"value":1},{"source":68,"target":48,"value":1},{"source":68,"target":41,"value":1},{"source":69,"target":25,"value":6},{"source":69,"target":68,"value":6},{"source":69,"target":11,"value":1},{"source":69,"target":24,"value":1},{"source":69,"target":27,"value":2},{"source":69,"target":48,"value":1},{"source":69,"target":41,"value":1},{"source":70,"target":25,"value":4},{"source":70,"target":69,"value":4},{"source":70,"target":68,"value":4},{"source":70,"target":11,"value":1},{"source":70,"target":24,"value":1},{"source":70,"target":27,"value":1},{"source":70,"target":41,"value":1},{"source":70,"target":58,"value":1},{"source":71,"target":27,"value":1},{"source":71,"target":69,"value":2},{"source":71,"target":68,"value":2},{"source":71,"target":70,"value":2},{"source":71,"target":11,"value":1},{"source":71,"target":48,"value":1},{"source":71,"target":41,"value":1},{"source":71,"target":25,"value":1},{"source":72,"target":26,"value":2},{"source":72,"target":27,"value":1},{"source":72,"target":11,"value":1},{"source":73,"target":48,"value":2},{"source":74,"target":48,"value":2},{"source":74,"target":73,"value":3},{"source":75,"target":69,"value":3},{"source":75,"target":68,"value":3},{"source":75,"target":25,"value":3},{"source":75,"target":48,"value":1},{"source":75,"target":41,"value":1},{"source":75,"target":70,"value":1},{"source":75,"target":71,"value":1},{"source":76,"target":64,"value":1},{"source":76,"target":65,"value":1},{"source":76,"target":66,"value":1},{"source":76,"target":63,"value":1},{"source":76,"target":62,"value":1},{"source":76,"target":48,"value":1},{"source":76,"target":58,"value":1}]}
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/Examples/packages.js b/projects/Data Visualization Software Java Project/Data Visualization/Examples/packages.js
new file mode 100644
index 0000000..4bf5c8a
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/Examples/packages.js
@@ -0,0 +1,49 @@
+(function() {
+ packages = {
+
+ // Lazily construct the package hierarchy from class names.
+ root: function(classes) {
+ var map = {};
+
+ function find(name, data) {
+ var node = map[name], i;
+ if (!node) {
+ node = map[name] = data || {name: name, children: []};
+ if (name.length) {
+ node.parent = find(name.substring(0, i = name.lastIndexOf(".")));
+ node.parent.children.push(node);
+ node.key = name.substring(i + 1);
+ }
+ }
+ return node;
+ }
+
+ classes.forEach(function(d) {
+ find(d.name, d);
+ });
+
+ return map[""];
+ },
+
+ // Return a list of imports for the given array of nodes.
+ imports: function(nodes) {
+ var map = {},
+ imports = [];
+
+ // Compute a map from name to node.
+ nodes.forEach(function(d) {
+ map[d.name] = d;
+ });
+
+ // For each import, construct a link from the source to target node.
+ nodes.forEach(function(d) {
+ if (d.imports) d.imports.forEach(function(i) {
+ imports.push({source: map[d.name], target: map[i]});
+ });
+ });
+
+ return imports;
+ }
+
+ };
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/IntlNodes.json b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodes.json
new file mode 100644
index 0000000..cea2f4e
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodes.json
@@ -0,0 +1,1994 @@
+[
+ {
+ "source": "Calit2 UCI",
+ "target": "City of Daegu, Korea",
+ "DollarValue": "$1,227,668",
+ "PartnerType": "Academic",
+ "Country": "Korea",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCI",
+ "target": "Embassy of France",
+ "DollarValue": "$240,000",
+ "PartnerType": "Government",
+ "Country": "France",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Thetis, SPA",
+ "DollarValue": "$851,850",
+ "PartnerType": "Academic",
+ "Country": "Italy",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "King Abdulaziz City for Science and Technology",
+ "DollarValue": "$3,469,803",
+ "PartnerType": "Academic",
+ "Country": "Saudi Arabia",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "King Abdullah University of Science and Technology",
+ "DollarValue": "$8,463,499",
+ "PartnerType": "Academic",
+ "Country": "Saudi Arabia",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "United Kingdom",
+ "DollarValue": "$8,339",
+ "PartnerType": "Academic",
+ "Country": "UK",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "CONACYT",
+ "DollarValue": "$184,000",
+ "PartnerType": "Government",
+ "Country": "Mexoci",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "PRAGMA",
+ "DollarValue": "$4,205,315",
+ "PartnerType": "Project",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Cybermedia Center and Research Center for Ultra-high Voltage Electron Microscopy, Osaka University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Monash University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Australia",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Center for Higher Performance Computing-Taiwan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Taiwan",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Institute of Advanced Industrial Science and Technology-Japan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "UCSD",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Center for Computational Sciences, University of Tsukuba",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "College of Computer Science and Technology, Jilin University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Canada",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Computer Network Information Center, Chinese Academy of Sciences",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "China",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "University of Hong Kong",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Hong Kong",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Kasetsart University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Thailand",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Konkuk University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Korea",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Korea Institute of Science and Technology Information",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Korea",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Electronics and Computer Technology Center-Thailand",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Thailand",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "TransPAC2, Indiana",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Universiti Sains Malaysia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Malaysia",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "University of Hyderabad",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "India",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Malaysian Institute of Microelectronic Systems (MIMOS)",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Malaysia",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Academia Sinica Grid Computing Center-Taiwan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Taiwan",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Advanced Science and Technology Institute-Phillipines",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Phillipines",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "BestGrid New Zealand",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "New Zeland",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Hanoi University of Technology",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Vietnam",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Ho Chi Minh City University of Technology",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Vietnam",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Institue for Information Technology-Vietnam",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Vietnam",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Star Tap, Translight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Asia Pacific Advanced Network-Japan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Japan",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Centro de Invertigacion Cientifica y de Educacion Superior de Ensenada (CICESE)",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "Mexico",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Global Scientific Information and Computing Center, Tokyo Institute of Technology",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Institute for High Performance Computing-Singapore",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Singapore",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Pacific Northwest Gigapop",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Bioinformatics Institute Singapore (BII",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Singapore",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Agricultural Research Center-Japan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Center for Supercomputing Applications-Illinois",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Grid Office-Singapore",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "Singapore",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Computational Science and Engineering Online, University of Utah",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "CRAY",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Korea Basic Science Institute",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Korea",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Thai National Grid Center-Thailand",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Thailand",
+ "ActivityLevel": "E"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Indiana University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "University of Florida",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "University of Wisconsin",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Lan Zhou University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "China",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "NICT",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "Kookmin University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Korea",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "CeNAT-ITCR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "CR",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "U Chile",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Chile",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "U Zurich",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Switzerland",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "National Applied Research Laboratories",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Taiwan",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "UCSD: Center for Research in Biological Systems",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "UCSD: National Biomedical Computation Resource",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "UCSD: National Center for Microscopy and Imaging Research",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "UCSD: San Diego Supercomputing Center",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "PRAGMA",
+ "target": "UCSD: Calit2",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "AAARNet-Australia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Australia",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "GLORIAD",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Pacific Northwest Gigapop",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "AMPATH",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "HEAnet-Ireland",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Ireland",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Poznan Superocmputing and Networking Center",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Poland",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "ANSP-Brazil",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Brazil",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "I2cat-Spain",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Spain",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "RIPN-Russia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Russia",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "MCS-Argonnne National Laboratory",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "iCAIR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "RNP-Brazil",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Brazil",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "International Educational Equal Access Foundation",
+ "DollarValue": "Unkown",
+ "PartnerType": "Not for Profit",
+ "Country": "",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "SARA-Norway",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Norway",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CANARIE-Canada",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Indiana University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "StarLight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CENIC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Internet 2",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "SURA",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CERN",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "JGN-II-Japan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Japan",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "SurfNet-Netherlands",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CERNET-China",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "China",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Janet-UK",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "UK",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "TeraGrid-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CESNET-Czechoslovakia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Czech",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Juniper Networks, Inc",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "TERENA-Europe",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "EU",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CIENA",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "King Abdullah University of Science and Technology",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "SA",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "TransLight-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CISCO",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "KRLight-Korea",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Korea",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "TWAREN-Taiwan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Taiwan",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CPqD-Brazil",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Brazil",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "MIT",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "University of Amsterdam",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "CSTNET-China",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "China",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "MCNC-North Carolina",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "DFN-Germany",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "Germany",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "MAX-Mid Atlantic",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "University College London",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "UK",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "E-ARENA-Russia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Russia",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "NLR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "University of Maryland",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "ESNET",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Naval Postgraduate School",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "University of Washington",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Extreme Networks",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "NorthWestern",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "UltraLight-US/CERN",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "FAST-California Institute of Technology",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "NSF-CISE",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "USLHCNet",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Fermilab",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "NetherLight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "WIDE-Japan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Japan",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "Global Netwave",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Global Lambda Integrated Facility",
+ "target": "NORDUnet",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "CENIC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "CANARIE-Canada",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Canada",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "StarLight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "Internet 2",
+ "DollarValue": "Unkown",
+ "PartnerType": "Organization",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "Indiana University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "SURA",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "NLR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "Indiana University",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "StarLight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "Internet 2",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "NLR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "TeraGrid-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Pacific Northwest Gigapop",
+ "target": "TransLight-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "NorthWestern",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "NSF-CISE",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "NorthWestern",
+ "DollarValue": "Unkown",
+ "PartnerType": "Government",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "Fermilab",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "CANARIE-Canada",
+ "target": "StarLight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "CANARIE-Canada",
+ "target": "CENIC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "CANARIE-Canada",
+ "target": "Internet 2",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "CANARIE-Canada",
+ "target": "CISCO",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "CANARIE-Canada",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "MCS-Argonnne National Laboratory",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "CANARIE-Canada",
+ "target": "CENIC",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Canada",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "SARA-Norway",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "AAARNet-Australia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Australia",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "GLORIAD",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "SurfNet-Netherlands",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "CERNET-China",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "China",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "Janet-UK",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "UK",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "TeraGrid-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "CESNET-Czechoslovakia",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Czech",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "Juniper Networks, Inc",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "TERENA-Europe",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "EU",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "CIENA",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "TransLight-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "CISCO",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "KRLight-Korea",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Korea",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "FAST-California Institute of Technology",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "NSF-CISE",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "USLHCNet",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "NetherLight",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "WIDE-Japan",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Japan",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "Global Netwave",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "StarLight",
+ "target": "NORDUnet",
+ "DollarValue": "Unkown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "NorthWestern",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "University of Maryland",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "NLR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "NorthWestern",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "TeraGrid-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "NSF-CISE",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Indiana University",
+ "target": "University of Washington",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "University of Maryland",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "NLR",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "NorthWestern",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "TeraGrid-NSF",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "NSF-CISE",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "University of Washington",
+ "DollarValue": "Unkown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Cisco",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Juniper Networks, Inc",
+ "DollarValue": "Unkown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Cinegrid",
+ "DollarValue": "Unknown",
+ "PartnerType": "Organization",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Academy of Motion Picture Arts and Science",
+ "DollarValue": "Unknown",
+ "PartnerType": "Not for Profit",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "California Academy of Sciences",
+ "DollarValue": "Unknown",
+ "PartnerType": "Not for Profit",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Calit2",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Cisco",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "CPqD-Brazil",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Brazil",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Cyberport",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Dark Strand",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Digital Domain",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "I2cat-Spain",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Spain",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "INGI-San Francisco State University",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "IntoPIX",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Japan",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "JVC America",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "KAIST",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Korea",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Keio University DMC",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "King Abdullah University of Science and Technology",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "SA",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "KTH Royal Insitute of Techology",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Sweden",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Louisiana State University",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Lucasfilm",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Lucasfilm",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "MacKenzie",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Mechdyne Corporation",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Meyer Sound Lab",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Meyer Sound Lab",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Naval Postgraduate School",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Naval Postgraduate School",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "NCSA-Illinois",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "NCSA-Illinois",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "NetApp",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "NorthWestern",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "NTT",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Japan",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Pacific Interface Inc",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Poznan Superocmputing and Networking Center",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Poland",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Renaissance Center North Carolina",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Rogers Communications Center-Ryerson University",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Canada",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "SARA-Norway",
+ "DollarValue": "Unknown",
+ "PartnerType": "Network",
+ "Country": "Netherlands",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Sharp-Japan",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Japan",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Sharp-USA",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Sony",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Japan",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Tohoku University",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Tulane University",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "University of Amsterdam",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Netherlands",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "University of Manitoba",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Canada",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "University of Southern California",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "University of Southern California",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "University of Washington",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "WAAG Society",
+ "DollarValue": "Unknown",
+ "PartnerType": "Not for Profit",
+ "Country": "Netherlands",
+ "ActivityLevel": "d"
+ },
+ {
+ "source": "Cinegrid",
+ "target": "Walt Disney Studios",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Walt Disney Studios",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Academy of Motion Picture Arts and Sciences",
+ "target": "Pacific Interface Inc",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Academy of Motion Picture Arts and Sciences",
+ "target": "California Academy of Sciences",
+ "DollarValue": "Unknown",
+ "PartnerType": "Not for Profit",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "California Academy of Sciences",
+ "target": "Pacific Interface Inc",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "NTT",
+ "target": "Cinepost-Prague",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "Czech",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Digital Domain",
+ "target": "Walt Disney Studios",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "NTT",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "EVL-UIUC",
+ "target": "Mechdyne Corporation",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "NTT",
+ "target": "Naval Postgraduate School",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "NTT",
+ "target": "Tohoku University",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Japan",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "NTT",
+ "target": "Pacific Interface Inc",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": ""
+ },
+ {
+ "source": "Sharp-Japan",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "Sharp-USA",
+ "target": "EVL-UIUC",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "NTT",
+ "target": "University of Amsterdam",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "Netherlands",
+ "ActivityLevel": "a"
+ },
+ {
+ "source": "University of Amsterdam",
+ "target": "WAAG Society",
+ "DollarValue": "Unknown",
+ "PartnerType": "Not for Profit",
+ "Country": "Netherlands",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "NTT",
+ "target": "USC",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "US",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "King Abdullah University of Science and Technology",
+ "DollarValue": "Unknown",
+ "PartnerType": "Academic",
+ "Country": "SA",
+ "ActivityLevel": "c"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Cisco",
+ "DollarValue": "Unknown",
+ "PartnerType": "Industry",
+ "Country": "US",
+ "ActivityLevel": "b"
+ },
+ {
+ "source": "Calit2 UCSD",
+ "target": "Korea Electronics Technology Institute",
+ "DollarValue": "$1,000,000",
+ "PartnerType": "Government",
+ "Country": "Korea",
+ "ActivityLevel": "a"
+ }
+]
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/IntlNodesSimple.json b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodesSimple.json
new file mode 100644
index 0000000..df4d5d4
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/IntlNodesSimple.json
@@ -0,0 +1,1247 @@
+[
+ {
+ "name": "Calit2 UCI",
+ "size": "b",
+ "imports": "City of Daegu, Korea"
+ },
+ {
+ "name": "Calit2 UCI",
+ "size": "b",
+ "imports": "Embassy of France"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "c",
+ "imports": "Thetis, SPA"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "a",
+ "imports": "King Abdulaziz City for Science and Technology"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "b",
+ "imports": "King Abdullah University of Science and Technology"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "c",
+ "imports": "United Kingdom"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "a",
+ "imports": "CONACYT"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "a",
+ "imports": "PRAGMA"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "Cybermedia Center and Research Center for Ultra-high Voltage Electron Microscopy, Osaka University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "Monash University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "National Center for Higher Performance Computing-Taiwan"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "National Institute of Advanced Industrial Science and Technology-Japan"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "UCSD"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Center for Computational Sciences, University of Tsukuba"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "College of Computer Science and Technology, Jilin University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Computer Network Information Center, Chinese Academy of Sciences"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "University of Hong Kong"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Kasetsart University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Konkuk University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Korea Institute of Science and Technology Information"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "National Electronics and Computer Technology Center-Thailand"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "TransPAC2, Indiana"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Universiti Sains Malaysia"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "University of Hyderabad"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Malaysian Institute of Microelectronic Systems (MIMOS)"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Academia Sinica Grid Computing Center-Taiwan"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Advanced Science and Technology Institute-Phillipines"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "BestGrid New Zealand"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Hanoi University of Technology"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Ho Chi Minh City University of Technology"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Institue for Information Technology-Vietnam"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Star Tap, Translight"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "d",
+ "imports": "Asia Pacific Advanced Network-Japan"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "d",
+ "imports": "Centro de Invertigacion Cientifica y de Educacion Superior de Ensenada (CICESE)"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "d",
+ "imports": "Global Scientific Information and Computing Center, Tokyo Institute of Technology"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "d",
+ "imports": "Institute for High Performance Computing-Singapore"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "d",
+ "imports": "Pacific Northwest Gigapop"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "Bioinformatics Institute Singapore (BII"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "National Agricultural Research Center-Japan"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "National Center for Supercomputing Applications-Illinois"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "National Grid Office-Singapore"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "Computational Science and Engineering Online, University of Utah"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "CRAY"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "Korea Basic Science Institute"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "E",
+ "imports": "Thai National Grid Center-Thailand"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Indiana University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "University of Florida"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "University of Wisconsin"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "Lan Zhou University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "b",
+ "imports": "NICT"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "Kookmin University"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "CeNAT-ITCR"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "U Chile"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "c",
+ "imports": "U Zurich"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "d",
+ "imports": "National Applied Research Laboratories"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "UCSD: Center for Research in Biological Systems"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "UCSD: National Biomedical Computation Resource"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "UCSD: National Center for Microscopy and Imaging Research"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "UCSD: San Diego Supercomputing Center"
+ },
+ {
+ "name": "PRAGMA",
+ "size": "a",
+ "imports": "UCSD: Calit2"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "AAARNet-Australia"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "GLORIAD"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Pacific Northwest Gigapop"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "AMPATH"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "HEAnet-Ireland"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Poznan Superocmputing and Networking Center"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "ANSP-Brazil"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "I2cat-Spain"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "RIPN-Russia"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "MCS-Argonnne National Laboratory"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "iCAIR"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "RNP-Brazil"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "International Educational Equal Access Foundation"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "SARA-Norway"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CANARIE-Canada"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Indiana University"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "StarLight"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CENIC"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Internet 2"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "SURA"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CERN"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "JGN-II-Japan"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "SurfNet-Netherlands"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CERNET-China"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Janet-UK"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "TeraGrid-NSF"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CESNET-Czechoslovakia"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Juniper Networks, Inc"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "TERENA-Europe"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CIENA"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "King Abdullah University of Science and Technology"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "TransLight-NSF"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CISCO"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "KRLight-Korea"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "TWAREN-Taiwan"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CPqD-Brazil"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "MIT"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "University of Amsterdam"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "CSTNET-China"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "MCNC-North Carolina"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "DFN-Germany"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "MAX-Mid Atlantic"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "University College London"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "E-ARENA-Russia"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "NLR"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "University of Maryland"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "ESNET"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Naval Postgraduate School"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "University of Washington"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Extreme Networks"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "UltraLight-US/CERN"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "FAST-California Institute of Technology"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "NSF-CISE"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "USLHCNet"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Fermilab"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "NetherLight"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "WIDE-Japan"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "Global Netwave"
+ },
+ {
+ "name": "Global Lambda Integrated Facility",
+ "size": "",
+ "imports": "NORDUnet"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "CENIC"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "CANARIE-Canada"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "StarLight"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "Internet 2"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "Indiana University"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "SURA"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "NLR"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "Indiana University"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "StarLight"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "Internet 2"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "NLR"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "TeraGrid-NSF"
+ },
+ {
+ "name": "Pacific Northwest Gigapop",
+ "size": "",
+ "imports": "TransLight-NSF"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "NSF-CISE"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "Fermilab"
+ },
+ {
+ "name": "CANARIE-Canada",
+ "size": "",
+ "imports": "StarLight"
+ },
+ {
+ "name": "CANARIE-Canada",
+ "size": "",
+ "imports": "CENIC"
+ },
+ {
+ "name": "CANARIE-Canada",
+ "size": "",
+ "imports": "Internet 2"
+ },
+ {
+ "name": "CANARIE-Canada",
+ "size": "",
+ "imports": "CISCO"
+ },
+ {
+ "name": "CANARIE-Canada",
+ "size": "",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "MCS-Argonnne National Laboratory",
+ "size": "",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "CANARIE-Canada",
+ "size": "",
+ "imports": "CENIC"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "SARA-Norway"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "AAARNet-Australia"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "GLORIAD"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "SurfNet-Netherlands"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "CERNET-China"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "Janet-UK"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "TeraGrid-NSF"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "CESNET-Czechoslovakia"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "Juniper Networks, Inc"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "TERENA-Europe"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "CIENA"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "TransLight-NSF"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "CISCO"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "KRLight-Korea"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "FAST-California Institute of Technology"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "NSF-CISE"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "USLHCNet"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "NetherLight"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "WIDE-Japan"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "Global Netwave"
+ },
+ {
+ "name": "StarLight",
+ "size": "",
+ "imports": "NORDUnet"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "University of Maryland"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "NLR"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "TeraGrid-NSF"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "NSF-CISE"
+ },
+ {
+ "name": "Indiana University",
+ "size": "",
+ "imports": "University of Washington"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "University of Maryland"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "NLR"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "TeraGrid-NSF"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "NSF-CISE"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "University of Washington"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "Cisco"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "Juniper Networks, Inc"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "",
+ "imports": "Cinegrid"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Academy of Motion Picture Arts and Science"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "California Academy of Sciences"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "Calit2"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Cisco"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "CPqD-Brazil"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "Cyberport"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Dark Strand"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Digital Domain"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "I2cat-Spain"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "INGI-San Francisco State University"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "IntoPIX"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "JVC America"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "KAIST"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "Keio University DMC"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "King Abdullah University of Science and Technology"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "KTH Royal Insitute of Techology"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "Louisiana State University"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Lucasfilm"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "b",
+ "imports": "Lucasfilm"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "MacKenzie"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "Mechdyne Corporation"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "Meyer Sound Lab"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "c",
+ "imports": "Meyer Sound Lab"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Naval Postgraduate School"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "b",
+ "imports": "Naval Postgraduate School"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "NCSA-Illinois"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "b",
+ "imports": "NCSA-Illinois"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "NetApp"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "NorthWestern"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "NTT"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "Pacific Interface Inc"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Poznan Superocmputing and Networking Center"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Renaissance Center North Carolina"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Rogers Communications Center-Ryerson University"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "SARA-Norway"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Sharp-Japan"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Sharp-USA"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "Sony"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Tohoku University"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "Tulane University"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "a",
+ "imports": "University of Amsterdam"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "University of Manitoba"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "University of Southern California"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "c",
+ "imports": "University of Southern California"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "c",
+ "imports": "University of Washington"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "d",
+ "imports": "WAAG Society"
+ },
+ {
+ "name": "Cinegrid",
+ "size": "b",
+ "imports": "Walt Disney Studios"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "b",
+ "imports": "Walt Disney Studios"
+ },
+ {
+ "name": "Academy of Motion Picture Arts and Sciences",
+ "size": "a",
+ "imports": "Pacific Interface Inc"
+ },
+ {
+ "name": "Academy of Motion Picture Arts and Sciences",
+ "size": "c",
+ "imports": "California Academy of Sciences"
+ },
+ {
+ "name": "California Academy of Sciences",
+ "size": "a",
+ "imports": "Pacific Interface Inc"
+ },
+ {
+ "name": "NTT",
+ "size": "",
+ "imports": "Cinepost-Prague"
+ },
+ {
+ "name": "Digital Domain",
+ "size": "",
+ "imports": "Walt Disney Studios"
+ },
+ {
+ "name": "NTT",
+ "size": "a",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "EVL-UIUC",
+ "size": "",
+ "imports": "Mechdyne Corporation"
+ },
+ {
+ "name": "NTT",
+ "size": "b",
+ "imports": "Naval Postgraduate School"
+ },
+ {
+ "name": "NTT",
+ "size": "",
+ "imports": "Tohoku University"
+ },
+ {
+ "name": "NTT",
+ "size": "",
+ "imports": "Pacific Interface Inc"
+ },
+ {
+ "name": "Sharp-Japan",
+ "size": "a",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "Sharp-USA",
+ "size": "a",
+ "imports": "EVL-UIUC"
+ },
+ {
+ "name": "NTT",
+ "size": "a",
+ "imports": "University of Amsterdam"
+ },
+ {
+ "name": "University of Amsterdam",
+ "size": "c",
+ "imports": "WAAG Society"
+ },
+ {
+ "name": "NTT",
+ "size": "c",
+ "imports": "USC"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "c",
+ "imports": "King Abdullah University of Science and Technology"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "b",
+ "imports": "Cisco"
+ },
+ {
+ "name": "Calit2 UCSD",
+ "size": "a",
+ "imports": "Korea Electronics Technology Institute"
+ }
+]
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.chart.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.chart.js
new file mode 100644
index 0000000..281d007
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.chart.js
@@ -0,0 +1,984 @@
+(function(){d3.chart = {};
+// Inspired by http://informationandvisualization.de/blog/box-plot
+d3.chart.box = function() {
+ var width = 1,
+ height = 1,
+ duration = 0,
+ domain = null,
+ value = Number,
+ whiskers = d3_chart_boxWhiskers,
+ quartiles = d3_chart_boxQuartiles,
+ tickFormat = null;
+
+ // For each small multiple…
+ function box(g) {
+ g.each(function(d, i) {
+ d = d.map(value).sort(d3.ascending);
+ var g = d3.select(this),
+ n = d.length,
+ min = d[0],
+ max = d[n - 1];
+
+ // Compute quartiles. Must return exactly 3 elements.
+ var quartileData = d.quartiles = quartiles(d);
+
+ // Compute whiskers. Must return exactly 2 elements, or null.
+ var whiskerIndices = whiskers && whiskers.call(this, d, i),
+ whiskerData = whiskerIndices && whiskerIndices.map(function(i) { return d[i]; });
+
+ // Compute outliers. If no whiskers are specified, all data are "outliers".
+ // We compute the outliers as indices, so that we can join across transitions!
+ var outlierIndices = whiskerIndices
+ ? d3.range(0, whiskerIndices[0]).concat(d3.range(whiskerIndices[1] + 1, n))
+ : d3.range(n);
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain(domain && domain.call(this, d, i) || [min, max])
+ .range([height, 0]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ // Note: the box, median, and box tick elements are fixed in number,
+ // so we only have to handle enter and update. In contrast, the outliers
+ // and other elements are variable, so we need to exit them! Variable
+ // elements also fade in and out.
+
+ // Update center line: the vertical line spanning the whiskers.
+ var center = g.selectAll("line.center")
+ .data(whiskerData ? [whiskerData] : []);
+
+ center.enter().insert("svg:line", "rect")
+ .attr("class", "center")
+ .attr("x1", width / 2)
+ .attr("y1", function(d) { return x0(d[0]); })
+ .attr("x2", width / 2)
+ .attr("y2", function(d) { return x0(d[1]); })
+ .style("opacity", 1e-6)
+ .transition()
+ .duration(duration)
+ .style("opacity", 1)
+ .attr("y1", function(d) { return x1(d[0]); })
+ .attr("y2", function(d) { return x1(d[1]); });
+
+ center.transition()
+ .duration(duration)
+ .style("opacity", 1)
+ .attr("y1", function(d) { return x1(d[0]); })
+ .attr("y2", function(d) { return x1(d[1]); });
+
+ center.exit().transition()
+ .duration(duration)
+ .style("opacity", 1e-6)
+ .attr("y1", function(d) { return x1(d[0]); })
+ .attr("y2", function(d) { return x1(d[1]); })
+ .remove();
+
+ // Update innerquartile box.
+ var box = g.selectAll("rect.box")
+ .data([quartileData]);
+
+ box.enter().append("svg:rect")
+ .attr("class", "box")
+ .attr("x", 0)
+ .attr("y", function(d) { return x0(d[2]); })
+ .attr("width", width)
+ .attr("height", function(d) { return x0(d[0]) - x0(d[2]); })
+ .transition()
+ .duration(duration)
+ .attr("y", function(d) { return x1(d[2]); })
+ .attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
+
+ box.transition()
+ .duration(duration)
+ .attr("y", function(d) { return x1(d[2]); })
+ .attr("height", function(d) { return x1(d[0]) - x1(d[2]); });
+
+ // Update median line.
+ var medianLine = g.selectAll("line.median")
+ .data([quartileData[1]]);
+
+ medianLine.enter().append("svg:line")
+ .attr("class", "median")
+ .attr("x1", 0)
+ .attr("y1", x0)
+ .attr("x2", width)
+ .attr("y2", x0)
+ .transition()
+ .duration(duration)
+ .attr("y1", x1)
+ .attr("y2", x1);
+
+ medianLine.transition()
+ .duration(duration)
+ .attr("y1", x1)
+ .attr("y2", x1);
+
+ // Update whiskers.
+ var whisker = g.selectAll("line.whisker")
+ .data(whiskerData || []);
+
+ whisker.enter().insert("svg:line", "circle, text")
+ .attr("class", "whisker")
+ .attr("x1", 0)
+ .attr("y1", x0)
+ .attr("x2", width)
+ .attr("y2", x0)
+ .style("opacity", 1e-6)
+ .transition()
+ .duration(duration)
+ .attr("y1", x1)
+ .attr("y2", x1)
+ .style("opacity", 1);
+
+ whisker.transition()
+ .duration(duration)
+ .attr("y1", x1)
+ .attr("y2", x1)
+ .style("opacity", 1);
+
+ whisker.exit().transition()
+ .duration(duration)
+ .attr("y1", x1)
+ .attr("y2", x1)
+ .style("opacity", 1e-6)
+ .remove();
+
+ // Update outliers.
+ var outlier = g.selectAll("circle.outlier")
+ .data(outlierIndices, Number);
+
+ outlier.enter().insert("svg:circle", "text")
+ .attr("class", "outlier")
+ .attr("r", 5)
+ .attr("cx", width / 2)
+ .attr("cy", function(i) { return x0(d[i]); })
+ .style("opacity", 1e-6)
+ .transition()
+ .duration(duration)
+ .attr("cy", function(i) { return x1(d[i]); })
+ .style("opacity", 1);
+
+ outlier.transition()
+ .duration(duration)
+ .attr("cy", function(i) { return x1(d[i]); })
+ .style("opacity", 1);
+
+ outlier.exit().transition()
+ .duration(duration)
+ .attr("cy", function(i) { return x1(d[i]); })
+ .style("opacity", 1e-6)
+ .remove();
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat(8);
+
+ // Update box ticks.
+ var boxTick = g.selectAll("text.box")
+ .data(quartileData);
+
+ boxTick.enter().append("svg:text")
+ .attr("class", "box")
+ .attr("dy", ".3em")
+ .attr("dx", function(d, i) { return i & 1 ? 6 : -6 })
+ .attr("x", function(d, i) { return i & 1 ? width : 0 })
+ .attr("y", x0)
+ .attr("text-anchor", function(d, i) { return i & 1 ? "start" : "end"; })
+ .text(format)
+ .transition()
+ .duration(duration)
+ .attr("y", x1);
+
+ boxTick.transition()
+ .duration(duration)
+ .text(format)
+ .attr("y", x1);
+
+ // Update whisker ticks. These are handled separately from the box
+ // ticks because they may or may not exist, and we want don't want
+ // to join box ticks pre-transition with whisker ticks post-.
+ var whiskerTick = g.selectAll("text.whisker")
+ .data(whiskerData || []);
+
+ whiskerTick.enter().append("svg:text")
+ .attr("class", "whisker")
+ .attr("dy", ".3em")
+ .attr("dx", 6)
+ .attr("x", width)
+ .attr("y", x0)
+ .text(format)
+ .style("opacity", 1e-6)
+ .transition()
+ .duration(duration)
+ .attr("y", x1)
+ .style("opacity", 1);
+
+ whiskerTick.transition()
+ .duration(duration)
+ .text(format)
+ .attr("y", x1)
+ .style("opacity", 1);
+
+ whiskerTick.exit().transition()
+ .duration(duration)
+ .attr("y", x1)
+ .style("opacity", 1e-6)
+ .remove();
+ });
+ d3.timer.flush();
+ }
+
+ box.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return box;
+ };
+
+ box.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return box;
+ };
+
+ box.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return box;
+ };
+
+ box.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = x;
+ return box;
+ };
+
+ box.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x == null ? x : d3.functor(x);
+ return box;
+ };
+
+ box.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return box;
+ };
+
+ box.whiskers = function(x) {
+ if (!arguments.length) return whiskers;
+ whiskers = x;
+ return box;
+ };
+
+ box.quartiles = function(x) {
+ if (!arguments.length) return quartiles;
+ quartiles = x;
+ return box;
+ };
+
+ return box;
+};
+
+function d3_chart_boxWhiskers(d) {
+ return [0, d.length - 1];
+}
+
+function d3_chart_boxQuartiles(d) {
+ return [
+ d3.quantile(d, .25),
+ d3.quantile(d, .5),
+ d3.quantile(d, .75)
+ ];
+}
+// Chart design based on the recommendations of Stephen Few. Implementation
+// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
+// http://projects.instantcognition.com/protovis/bulletchart/
+d3.chart.bullet = function() {
+ var orient = "left", // TODO top & bottom
+ reverse = false,
+ duration = 0,
+ ranges = d3_chart_bulletRanges,
+ markers = d3_chart_bulletMarkers,
+ measures = d3_chart_bulletMeasures,
+ width = 380,
+ height = 30,
+ tickFormat = null;
+
+ // For each small multiple…
+ function bullet(g) {
+ g.each(function(d, i) {
+ var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
+ markerz = markers.call(this, d, i).slice().sort(d3.descending),
+ measurez = measures.call(this, d, i).slice().sort(d3.descending),
+ g = d3.select(this);
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
+ .range(reverse ? [width, 0] : [0, width]);
+
+ // Retrieve the old x-scale, if this is an update.
+ var x0 = this.__chart__ || d3.scale.linear()
+ .domain([0, Infinity])
+ .range(x1.range());
+
+ // Stash the new scale.
+ this.__chart__ = x1;
+
+ // Derive width-scales from the x-scales.
+ var w0 = d3_chart_bulletWidth(x0),
+ w1 = d3_chart_bulletWidth(x1);
+
+ // Update the range rects.
+ var range = g.selectAll("rect.range")
+ .data(rangez);
+
+ range.enter().append("svg:rect")
+ .attr("class", function(d, i) { return "range s" + i; })
+ .attr("width", w0)
+ .attr("height", height)
+ .attr("x", reverse ? x0 : 0)
+ .transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("x", reverse ? x1 : 0);
+
+ range.transition()
+ .duration(duration)
+ .attr("x", reverse ? x1 : 0)
+ .attr("width", w1)
+ .attr("height", height);
+
+ // Update the measure rects.
+ var measure = g.selectAll("rect.measure")
+ .data(measurez);
+
+ measure.enter().append("svg:rect")
+ .attr("class", function(d, i) { return "measure s" + i; })
+ .attr("width", w0)
+ .attr("height", height / 3)
+ .attr("x", reverse ? x0 : 0)
+ .attr("y", height / 3)
+ .transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("x", reverse ? x1 : 0);
+
+ measure.transition()
+ .duration(duration)
+ .attr("width", w1)
+ .attr("height", height / 3)
+ .attr("x", reverse ? x1 : 0)
+ .attr("y", height / 3);
+
+ // Update the marker lines.
+ var marker = g.selectAll("line.marker")
+ .data(markerz);
+
+ marker.enter().append("svg:line")
+ .attr("class", "marker")
+ .attr("x1", x0)
+ .attr("x2", x0)
+ .attr("y1", height / 6)
+ .attr("y2", height * 5 / 6)
+ .transition()
+ .duration(duration)
+ .attr("x1", x1)
+ .attr("x2", x1);
+
+ marker.transition()
+ .duration(duration)
+ .attr("x1", x1)
+ .attr("x2", x1)
+ .attr("y1", height / 6)
+ .attr("y2", height * 5 / 6);
+
+ // Compute the tick format.
+ var format = tickFormat || x1.tickFormat(8);
+
+ // Update the tick groups.
+ var tick = g.selectAll("g.tick")
+ .data(x1.ticks(8), function(d) {
+ return this.textContent || format(d);
+ });
+
+ // Initialize the ticks with the old scale, x0.
+ var tickEnter = tick.enter().append("svg:g")
+ .attr("class", "tick")
+ .attr("transform", d3_chart_bulletTranslate(x0))
+ .style("opacity", 1e-6);
+
+ tickEnter.append("svg:line")
+ .attr("y1", height)
+ .attr("y2", height * 7 / 6);
+
+ tickEnter.append("svg:text")
+ .attr("text-anchor", "middle")
+ .attr("dy", "1em")
+ .attr("y", height * 7 / 6)
+ .text(format);
+
+ // Transition the entering ticks to the new scale, x1.
+ tickEnter.transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .style("opacity", 1);
+
+ // Transition the updating ticks to the new scale, x1.
+ var tickUpdate = tick.transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .style("opacity", 1);
+
+ tickUpdate.select("line")
+ .attr("y1", height)
+ .attr("y2", height * 7 / 6);
+
+ tickUpdate.select("text")
+ .attr("y", height * 7 / 6);
+
+ // Transition the exiting ticks to the new scale, x1.
+ tick.exit().transition()
+ .duration(duration)
+ .attr("transform", d3_chart_bulletTranslate(x1))
+ .style("opacity", 1e-6)
+ .remove();
+ });
+ d3.timer.flush();
+ }
+
+ // left, right, top, bottom
+ bullet.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ reverse = orient == "right" || orient == "bottom";
+ return bullet;
+ };
+
+ // ranges (bad, satisfactory, good)
+ bullet.ranges = function(x) {
+ if (!arguments.length) return ranges;
+ ranges = x;
+ return bullet;
+ };
+
+ // markers (previous, goal)
+ bullet.markers = function(x) {
+ if (!arguments.length) return markers;
+ markers = x;
+ return bullet;
+ };
+
+ // measures (actual, forecast)
+ bullet.measures = function(x) {
+ if (!arguments.length) return measures;
+ measures = x;
+ return bullet;
+ };
+
+ bullet.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return bullet;
+ };
+
+ bullet.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return bullet;
+ };
+
+ bullet.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return bullet;
+ };
+
+ bullet.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = x;
+ return bullet;
+ };
+
+ return bullet;
+};
+
+function d3_chart_bulletRanges(d) {
+ return d.ranges;
+}
+
+function d3_chart_bulletMarkers(d) {
+ return d.markers;
+}
+
+function d3_chart_bulletMeasures(d) {
+ return d.measures;
+}
+
+function d3_chart_bulletTranslate(x) {
+ return function(d) {
+ return "translate(" + x(d) + ",0)";
+ };
+}
+
+function d3_chart_bulletWidth(x) {
+ var x0 = x(0);
+ return function(d) {
+ return Math.abs(x(d) - x0);
+ };
+}
+// Implements a horizon layout, which is a variation of a single-series
+// area chart where the area is folded into multiple bands. Color is used to
+// encode band, allowing the size of the chart to be reduced significantly
+// without impeding readability. This layout algorithm is based on the work of
+// J. Heer, N. Kong and M. Agrawala in "Sizing the Horizon: The Effects of Chart
+// Size and Layering on the Graphical Perception of Time Series Visualizations",
+// CHI 2009. http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf
+d3.chart.horizon = function() {
+ var bands = 1, // between 1 and 5, typically
+ mode = "offset", // or mirror
+ interpolate = "linear", // or basis, monotone, step-before, etc.
+ x = d3_chart_horizonX,
+ y = d3_chart_horizonY,
+ w = 960,
+ h = 40,
+ duration = 0;
+
+ var color = d3.scale.linear()
+ .domain([-1, 0, 1])
+ .range(["#d62728", "#fff", "#1f77b4"]);
+
+ // For each small multiple…
+ function horizon(g) {
+ g.each(function(d, i) {
+ var g = d3.select(this),
+ n = 2 * bands + 1,
+ xMin = Infinity,
+ xMax = -Infinity,
+ yMax = -Infinity,
+ x0, // old x-scale
+ y0, // old y-scale
+ id; // unique id for paths
+
+ // Compute x- and y-values along with extents.
+ var data = d.map(function(d, i) {
+ var xv = x.call(this, d, i),
+ yv = y.call(this, d, i);
+ if (xv < xMin) xMin = xv;
+ if (xv > xMax) xMax = xv;
+ if (-yv > yMax) yMax = -yv;
+ if (yv > yMax) yMax = yv;
+ return [xv, yv];
+ });
+
+ // Compute the new x- and y-scales.
+ var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]),
+ y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]);
+
+ // Retrieve the old scales, if this is an update.
+ if (this.__chart__) {
+ x0 = this.__chart__.x;
+ y0 = this.__chart__.y;
+ id = this.__chart__.id;
+ } else {
+ x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range());
+ y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range());
+ id = ++d3_chart_horizonId;
+ }
+
+ // We'll use a defs to store the area path and the clip path.
+ var defs = g.selectAll("defs")
+ .data([data]);
+
+ var defsEnter = defs.enter().append("svg:defs");
+
+ // The clip path is a simple rect.
+ defsEnter.append("svg:clipPath")
+ .attr("id", "d3_chart_horizon_clip" + id)
+ .append("svg:rect")
+ .attr("width", w)
+ .attr("height", h);
+
+ defs.select("rect").transition()
+ .duration(duration)
+ .attr("width", w)
+ .attr("height", h);
+
+ // The area path is rendered with our resuable d3.svg.area.
+ defsEnter.append("svg:path")
+ .attr("id", "d3_chart_horizon_path" + id)
+ .attr("d", d3_chart_horizonArea
+ .interpolate(interpolate)
+ .x(function(d) { return x0(d[0]); })
+ .y0(h * bands)
+ .y1(function(d) { return h * bands - y0(d[1]); }))
+ .transition()
+ .duration(duration)
+ .attr("d", d3_chart_horizonArea
+ .x(function(d) { return x1(d[0]); })
+ .y1(function(d) { return h * bands - y1(d[1]); }));
+
+ defs.select("path").transition()
+ .duration(duration)
+ .attr("d", d3_chart_horizonArea);
+
+ // We'll use a container to clip all horizon layers at once.
+ g.selectAll("g")
+ .data([null])
+ .enter().append("svg:g")
+ .attr("clip-path", "url(#d3_chart_horizon_clip" + id + ")");
+
+ // Define the transform function based on the mode.
+ var transform = mode == "offset"
+ ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; }
+ : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; };
+
+ // Instantiate each copy of the path with different transforms.
+ var u = g.select("g").selectAll("use")
+ .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number);
+
+ // TODO don't fudge the enter transition
+ u.enter().append("svg:use")
+ .attr("xlink:href", "#d3_chart_horizon_path" + id)
+ .attr("transform", function(d) { return transform(d + (d > 0 ? 1 : -1)); })
+ .style("fill", color)
+ .transition()
+ .duration(duration)
+ .attr("transform", transform);
+
+ u.transition()
+ .duration(duration)
+ .attr("transform", transform)
+ .style("fill", color);
+
+ u.exit().transition()
+ .duration(duration)
+ .attr("transform", transform)
+ .remove();
+
+ // Stash the new scales.
+ this.__chart__ = {x: x1, y: y1, id: id};
+ });
+ d3.timer.flush();
+ }
+
+ horizon.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = +x;
+ return horizon;
+ };
+
+ horizon.bands = function(x) {
+ if (!arguments.length) return bands;
+ bands = +x;
+ color.domain([-bands, 0, bands]);
+ return horizon;
+ };
+
+ horizon.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return horizon;
+ };
+
+ horizon.colors = function(x) {
+ if (!arguments.length) return color.range();
+ color.range(x);
+ return horizon;
+ };
+
+ horizon.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x + "";
+ return horizon;
+ };
+
+ horizon.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return horizon;
+ };
+
+ horizon.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return horizon;
+ };
+
+ horizon.width = function(x) {
+ if (!arguments.length) return w;
+ w = +x;
+ return horizon;
+ };
+
+ horizon.height = function(x) {
+ if (!arguments.length) return h;
+ h = +x;
+ return horizon;
+ };
+
+ return horizon;
+};
+
+var d3_chart_horizonArea = d3.svg.area(),
+ d3_chart_horizonId = 0;
+
+function d3_chart_horizonX(d) {
+ return d[0];
+}
+
+function d3_chart_horizonY(d) {
+ return d[1];
+}
+// Based on http://vis.stanford.edu/protovis/ex/qqplot.html
+d3.chart.qq = function() {
+ var width = 1,
+ height = 1,
+ duration = 0,
+ domain = null,
+ tickFormat = null,
+ n = 100,
+ x = d3_chart_qqX,
+ y = d3_chart_qqY;
+
+ // For each small multiple…
+ function qq(g) {
+ g.each(function(d, i) {
+ var g = d3.select(this),
+ qx = d3_chart_qqQuantiles(n, x.call(this, d, i)),
+ qy = d3_chart_qqQuantiles(n, y.call(this, d, i)),
+ xd = domain && domain.call(this, d, i) || [d3.min(qx), d3.max(qx)], // new x-domain
+ yd = domain && domain.call(this, d, i) || [d3.min(qy), d3.max(qy)], // new y-domain
+ x0, // old x-scale
+ y0; // old y-scale
+
+ // Compute the new x-scale.
+ var x1 = d3.scale.linear()
+ .domain(xd)
+ .range([0, width]);
+
+ // Compute the new y-scale.
+ var y1 = d3.scale.linear()
+ .domain(yd)
+ .range([height, 0]);
+
+ // Retrieve the old scales, if this is an update.
+ if (this.__chart__) {
+ x0 = this.__chart__.x;
+ y0 = this.__chart__.y;
+ } else {
+ x0 = d3.scale.linear().domain([0, Infinity]).range(x1.range());
+ y0 = d3.scale.linear().domain([0, Infinity]).range(y1.range());
+ }
+
+ // Stash the new scales.
+ this.__chart__ = {x: x1, y: y1};
+
+ // Update diagonal line.
+ var diagonal = g.selectAll("line.diagonal")
+ .data([null]);
+
+ diagonal.enter().append("svg:line")
+ .attr("class", "diagonal")
+ .attr("x1", x1(yd[0]))
+ .attr("y1", y1(xd[0]))
+ .attr("x2", x1(yd[1]))
+ .attr("y2", y1(xd[1]));
+
+ diagonal.transition()
+ .duration(duration)
+ .attr("x1", x1(yd[0]))
+ .attr("y1", y1(xd[0]))
+ .attr("x2", x1(yd[1]))
+ .attr("y2", y1(xd[1]));
+
+ // Update quantile plots.
+ var circle = g.selectAll("circle")
+ .data(d3.range(n).map(function(i) {
+ return {x: qx[i], y: qy[i]};
+ }));
+
+ circle.enter().append("svg:circle")
+ .attr("class", "quantile")
+ .attr("r", 4.5)
+ .attr("cx", function(d) { return x0(d.x); })
+ .attr("cy", function(d) { return y0(d.y); })
+ .style("opacity", 1e-6)
+ .transition()
+ .duration(duration)
+ .attr("cx", function(d) { return x1(d.x); })
+ .attr("cy", function(d) { return y1(d.y); })
+ .style("opacity", 1);
+
+ circle.transition()
+ .duration(duration)
+ .attr("cx", function(d) { return x1(d.x); })
+ .attr("cy", function(d) { return y1(d.y); })
+ .style("opacity", 1);
+
+ circle.exit().transition()
+ .duration(duration)
+ .attr("cx", function(d) { return x1(d.x); })
+ .attr("cy", function(d) { return y1(d.y); })
+ .style("opacity", 1e-6)
+ .remove();
+
+ var xformat = tickFormat || x1.tickFormat(4),
+ yformat = tickFormat || y1.tickFormat(4),
+ tx = function(d) { return "translate(" + x1(d) + "," + height + ")"; },
+ ty = function(d) { return "translate(0," + y1(d) + ")"; };
+
+ // Update x-ticks.
+ var xtick = g.selectAll("g.x.tick")
+ .data(x1.ticks(4), function(d) {
+ return this.textContent || xformat(d);
+ });
+
+ var xtickEnter = xtick.enter().append("svg:g")
+ .attr("class", "x tick")
+ .attr("transform", function(d) { return "translate(" + x0(d) + "," + height + ")"; })
+ .style("opacity", 1e-6);
+
+ xtickEnter.append("svg:line")
+ .attr("y1", 0)
+ .attr("y2", -6);
+
+ xtickEnter.append("svg:text")
+ .attr("text-anchor", "middle")
+ .attr("dy", "1em")
+ .text(xformat);
+
+ // Transition the entering ticks to the new scale, x1.
+ xtickEnter.transition()
+ .duration(duration)
+ .attr("transform", tx)
+ .style("opacity", 1);
+
+ // Transition the updating ticks to the new scale, x1.
+ xtick.transition()
+ .duration(duration)
+ .attr("transform", tx)
+ .style("opacity", 1);
+
+ // Transition the exiting ticks to the new scale, x1.
+ xtick.exit().transition()
+ .duration(duration)
+ .attr("transform", tx)
+ .style("opacity", 1e-6)
+ .remove();
+
+ // Update ticks.
+ var ytick = g.selectAll("g.y.tick")
+ .data(y1.ticks(4), function(d) {
+ return this.textContent || yformat(d);
+ });
+
+ var ytickEnter = ytick.enter().append("svg:g")
+ .attr("class", "y tick")
+ .attr("transform", function(d) { return "translate(0," + y0(d) + ")"; })
+ .style("opacity", 1e-6);
+
+ ytickEnter.append("svg:line")
+ .attr("x1", 0)
+ .attr("x2", 6);
+
+ ytickEnter.append("svg:text")
+ .attr("text-anchor", "end")
+ .attr("dx", "-.5em")
+ .attr("dy", ".3em")
+ .text(yformat);
+
+ // Transition the entering ticks to the new scale, y1.
+ ytickEnter.transition()
+ .duration(duration)
+ .attr("transform", ty)
+ .style("opacity", 1);
+
+ // Transition the updating ticks to the new scale, y1.
+ ytick.transition()
+ .duration(duration)
+ .attr("transform", ty)
+ .style("opacity", 1);
+
+ // Transition the exiting ticks to the new scale, y1.
+ ytick.exit().transition()
+ .duration(duration)
+ .attr("transform", ty)
+ .style("opacity", 1e-6)
+ .remove();
+ });
+ }
+
+ qq.width = function(x) {
+ if (!arguments.length) return width;
+ width = x;
+ return qq;
+ };
+
+ qq.height = function(x) {
+ if (!arguments.length) return height;
+ height = x;
+ return qq;
+ };
+
+ qq.duration = function(x) {
+ if (!arguments.length) return duration;
+ duration = x;
+ return qq;
+ };
+
+ qq.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x == null ? x : d3.functor(x);
+ return qq;
+ };
+
+ qq.count = function(z) {
+ if (!arguments.length) return n;
+ n = z;
+ return qq;
+ };
+
+ qq.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return qq;
+ };
+
+ qq.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return qq;
+ };
+
+ qq.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat;
+ tickFormat = x;
+ return qq;
+ };
+
+ return qq;
+};
+
+function d3_chart_qqQuantiles(n, values) {
+ var m = values.length - 1;
+ values = values.slice().sort(d3.ascending);
+ return d3.range(n).map(function(i) {
+ return values[~~(i * m / n)];
+ });
+}
+
+function d3_chart_qqX(d) {
+ return d.x;
+}
+
+function d3_chart_qqY(d) {
+ return d.y;
+}
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.csv.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.csv.js
new file mode 100644
index 0000000..7565b83
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.csv.js
@@ -0,0 +1,92 @@
+(function(){d3.csv = function(url, callback) {
+ d3.text(url, "text/csv", function(text) {
+ callback(text && d3.csv.parse(text));
+ });
+};
+d3.csv.parse = function(text) {
+ var header;
+ return d3.csv.parseRows(text, function(row, i) {
+ if (i) {
+ var o = {}, j = -1, m = header.length;
+ while (++j < m) o[header[j]] = row[j];
+ return o;
+ } else {
+ header = row;
+ return null;
+ }
+ });
+};
+
+d3.csv.parseRows = function(text, f) {
+ var EOL = {}, // sentinel value for end-of-line
+ EOF = {}, // sentinel value for end-of-file
+ rows = [], // output rows
+ re = /\r\n|[,\r\n]/g, // field separator regex
+ n = 0, // the current line number
+ t, // the current token
+ eol; // is the current token followed by EOL?
+
+ re.lastIndex = 0; // work-around bug in FF 3.6
+
+ /** @private Returns the next token. */
+ function token() {
+ if (re.lastIndex >= text.length) return EOF; // special case: end of file
+ if (eol) { eol = false; return EOL; } // special case: end of line
+
+ // special case: quotes
+ var j = re.lastIndex;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < text.length) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ i++;
+ }
+ }
+ re.lastIndex = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, "\"");
+ }
+
+ // common case
+ var m = re.exec(text);
+ if (m) {
+ eol = m[0].charCodeAt(0) !== 44;
+ return text.substring(j, m.index);
+ }
+ re.lastIndex = text.length;
+ return text.substring(j);
+ }
+
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while ((t !== EOL) && (t !== EOF)) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+
+ return rows;
+};
+d3.csv.format = function(rows) {
+ return rows.map(d3_csv_formatRow).join("\n");
+};
+
+function d3_csv_formatRow(row) {
+ return row.map(d3_csv_formatValue).join(",");
+}
+
+function d3_csv_formatValue(text) {
+ return /[",\n]/.test(text)
+ ? "\"" + text.replace(/\"/g, "\"\"") + "\""
+ : text;
+}
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.geom.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.geom.js
new file mode 100644
index 0000000..d860c2b
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.geom.js
@@ -0,0 +1,835 @@
+(function(){d3.geom = {};
+/**
+ * Computes a contour for a given input grid function using the marching
+ * squares algorithm. Returns the contour polygon as an array of points.
+ *
+ * @param grid a two-input function(x, y) that returns true for values
+ * inside the contour and false for values outside the contour.
+ * @param start an optional starting point [x, y] on the grid.
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), // starting point
+ c = [], // contour polygon
+ x = s[0], // current x position
+ y = s[1], // current y position
+ dx = 0, // next x direction
+ dy = 0, // next y direction
+ pdx = NaN, // previous x direction
+ pdy = NaN, // previous y direction
+ i = 0;
+
+ do {
+ // determine marching squares index
+ i = 0;
+ if (grid(x-1, y-1)) i += 1;
+ if (grid(x, y-1)) i += 2;
+ if (grid(x-1, y )) i += 4;
+ if (grid(x, y )) i += 8;
+
+ // determine next direction
+ if (i === 6) {
+ dx = pdy === -1 ? -1 : 1;
+ dy = 0;
+ } else if (i === 9) {
+ dx = 0;
+ dy = pdx === 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+
+ // update contour polygon
+ if (dx != pdx && dy != pdy) {
+ c.push([x, y]);
+ pdx = dx;
+ pdy = dy;
+ }
+
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+
+ return c;
+};
+
+// lookup tables for marching directions
+var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
+ d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
+
+function d3_geom_contourStart(grid) {
+ var x = 0,
+ y = 0;
+
+ // search for a starting point; begin at origin
+ // and proceed along outward-expanding diagonals
+ while (true) {
+ if (grid(x,y)) {
+ return [x,y];
+ }
+ if (x === 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+}
+/**
+ * Computes the 2D convex hull of a set of points using Graham's scanning
+ * algorithm. The algorithm has been implemented as described in Cormen,
+ * Leiserson, and Rivest's Introduction to Algorithms. The running time of
+ * this algorithm is O(n log n), where n is the number of input points.
+ *
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+
+ var len = vertices.length,
+ plen = len - 1,
+ points = [],
+ stack = [],
+ i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+
+ // find the starting ref point: leftmost point with the minimum y coord
+ for (i=1; i= (x2*x2 + y2*y2)) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+
+ // initialize the stack
+ stack.push(h);
+ for (i=0, j=0; i<2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+
+ // do graham's scan
+ for (; j 0;
+}
+// Note: requires coordinates to be counterclockwise and convex!
+d3.geom.polygon = function(coordinates) {
+
+ coordinates.area = function() {
+ var i = 0,
+ n = coordinates.length,
+ a = coordinates[n - 1][0] * coordinates[0][1],
+ b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+
+ coordinates.centroid = function(k) {
+ var i = -1,
+ n = coordinates.length - 1,
+ x = 0,
+ y = 0,
+ a,
+ b,
+ c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = coordinates[i];
+ b = coordinates[i + 1];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [x * k, y * k];
+ };
+
+ // The Sutherland-Hodgman clipping algorithm.
+ coordinates.clip = function(subject) {
+ var input,
+ i = -1,
+ n = coordinates.length,
+ j,
+ m,
+ a = coordinates[n - 1],
+ b,
+ c,
+ d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+
+ return coordinates;
+};
+
+function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+}
+
+// Intersect two infinite lines cd and ab.
+function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
+ y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
+ x13 = x1 - x3,
+ x21 = x2 - x1,
+ x43 = x4 - x3,
+ y13 = y1 - y3,
+ y21 = y2 - y1,
+ y43 = y4 - y3,
+ ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [x1 + ua * x21, y1 + ua * y21];
+}
+// Adapted from Nicolas Garcia Belmonte's JIT implementation:
+// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
+// http://blog.thejit.org/assets/voronoijs/voronoi.js
+// See lib/jit/LICENSE for details.
+
+// Notes:
+//
+// This implementation does not clip the returned polygons, so if you want to
+// clip them to a particular shape you will need to do that either in SVG or by
+// post-processing with d3.geom.polygon's clip method.
+//
+// If any vertices are coincident or have NaN positions, the behavior of this
+// method is undefined. Most likely invalid polygons will be returned. You
+// should filter invalid points, and consolidate coincident points, before
+// computing the tessellation.
+
+/**
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygons [[[x1, y1], [x2, y2], …], …]
+ */
+d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() { return []; });
+
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1,
+ s2,
+ x1,
+ x2,
+ y1,
+ y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [x1, y1],
+ v2 = [x2, y2];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+
+ // Reconnect the polygon segments into counterclockwise loops.
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0],
+ cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || (d.angle - polygon[i - 1].angle > 1e-10);
+ });
+ });
+};
+
+var d3_voronoi_opposite = {"l": "r", "r": "l"};
+
+function d3_voronoi_tessellate(vertices, callback) {
+
+ var Sites = {
+ list: vertices
+ .map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ })
+ .sort(function(a, b) {
+ return a.y < b.y ? -1
+ : a.y > b.y ? 1
+ : a.x < b.x ? -1
+ : a.x > b.x ? 1
+ : 0;
+ }),
+ bottomSite: null
+ };
+
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ "l": null,
+ "r": null
+ };
+ },
+
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+
+ right: function(he) {
+ return he.r;
+ },
+
+ left: function(he) {
+ return he.l;
+ },
+
+ leftRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[he.side];
+ },
+
+ rightRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+
+ var Geom = {
+
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {"l": s1, "r": s2},
+ ep: {"l": null, "r": null}
+ };
+
+ var dx = s2.x - s1.x,
+ dy = s2.y - s1.y,
+ adx = dx > 0 ? dx : -dx,
+ ady = dy > 0 ? dy : -dy;
+
+ newEdge.c = s1.x * dx + s1.y * dy
+ + (dx * dx + dy * dy) * .5;
+
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+
+ return newEdge;
+ },
+
+ intersect: function(el1, el2) {
+ var e1 = el1.edge,
+ e2 = el2.edge;
+ if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
+ return null;
+ }
+ var d = (e1.a * e2.b) - (e1.b * e2.a);
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d,
+ yint = (e2.c * e1.a - e1.c * e2.a) / d,
+ e1r = e1.region.r,
+ e2r = e2.region.r,
+ el,
+ e;
+ if ((e1r.y < e2r.y) ||
+ (e1r.y == e2r.y && e1r.x < e2r.x)) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = (xint >= e.region.r.x);
+ if ((rightOfSite && (el.side === "l")) ||
+ (!rightOfSite && (el.side === "r"))) {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+
+ rightOf: function(he, p) {
+ var e = he.edge,
+ topsite = e.region.r,
+ rightOfSite = (p.x > topsite.x);
+
+ if (rightOfSite && (he.side === "l")) {
+ return 1;
+ }
+ if (!rightOfSite && (he.side === "r")) {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y,
+ dxp = p.x - topsite.x,
+ fast = 0,
+ above = 0;
+
+ if ((!rightOfSite && (e.b < 0)) ||
+ (rightOfSite && (e.b >= 0))) {
+ above = fast = (dyp >= e.b * dxp);
+ } else {
+ above = ((p.x + p.y * e.b) > e.c);
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = (e.b * (dxp * dxp - dyp * dyp)) <
+ (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
+
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else /* e.b == 1 */ {
+ var yl = e.c - e.a * p.x,
+ t1 = p.y - yl,
+ t2 = p.x - topsite.x,
+ t3 = yl - topsite.y;
+
+ above = (t1 * t1) > (t2 * t2 + t3 * t3);
+ }
+ return he.side === "l" ? above : !above;
+ },
+
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+
+ distance: function(s, t) {
+ var dx = s.x - t.x,
+ dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+
+ var EventQueue = {
+ list: [],
+
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i=0, list=EventQueue.list, l=list.length; i next.ystar ||
+ (he.ystar == next.ystar &&
+ site.x > next.vertex.x)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+
+ del: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }//end while
+
+ for (lbnd = EdgeList.right(EdgeList.leftEnd);
+ lbnd != EdgeList.rightEnd;
+ lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+}
+/**
+* @param vertices [[x1, y1], [x2, y2], …]
+* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …]
+ */
+d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() { return []; }),
+ triangles = [];
+
+ // Use the Voronoi tessellation to determine Delaunay edges.
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+
+ // Reconnect the edges into counterclockwise triangles.
+ edges.forEach(function(edge, i) {
+ var v = vertices[i],
+ cx = v[0],
+ cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([v, edge[j], edge[j + 1]]);
+ }
+ });
+
+ return triangles;
+};
+// Constructs a new quadtree for the specified array of points. A quadtree is a
+// two-dimensional recursive spatial subdivision. This implementation uses
+// square partitions, dividing each square into four equally-sized squares. Each
+// point exists in a unique node; if multiple points are in the same position,
+// some points may be stored on internal nodes rather than leaf nodes. Quadtrees
+// can be used to accelerate various spatial operations, such as the Barnes-Hut
+// approximation for computing n-body forces, or collision detection.
+d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ var p,
+ i = -1,
+ n = points.length;
+
+ // Type conversion for deprecated API.
+ if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
+
+ // Allow bounds to be specified explicitly.
+ if (arguments.length < 5) {
+ if (arguments.length === 3) {
+ y2 = x2 = y1;
+ y1 = x1;
+ } else {
+ x1 = y1 = Infinity;
+ x2 = y2 = -Infinity;
+
+ // Compute bounds.
+ while (++i < n) {
+ p = points[i];
+ if (p.x < x1) x1 = p.x;
+ if (p.y < y1) y1 = p.y;
+ if (p.x > x2) x2 = p.x;
+ if (p.y > y2) y2 = p.y;
+ }
+
+ // Squarify the bounds.
+ var dx = x2 - x1,
+ dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx;
+ else x2 = x1 + dy;
+ }
+ }
+
+ // Recursively inserts the specified point p at the node n or one of its
+ // descendants. The bounds are defined by [x1, x2] and [y1, y2].
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ // If the point at this leaf node is at the same position as the new
+ // point we are adding, we leave the point associated with the
+ // internal node while adding the new point to a child node. This
+ // avoids infinite recursion.
+ if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+
+ // Recursively inserts the specified point p into a descendant of node n. The
+ // bounds are defined by [x1, x2] and [y1, y2].
+ function insertChild(n, p, x1, y1, x2, y2) {
+ // Compute the split point, and the quadrant in which to insert p.
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ right = p.x >= sx,
+ bottom = p.y >= sy,
+ i = (bottom << 1) + right;
+
+ // Recursively insert into the child node.
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+
+ // Update the bounds as we recurse.
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+
+ // Create the root node.
+ var root = d3_geom_quadtreeNode();
+
+ root.add = function(p) {
+ insert(root, p, x1, y1, x2, y2);
+ };
+
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+
+ // Insert all points.
+ points.forEach(root.add);
+ return root;
+};
+
+function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+}
+
+function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+}
+
+function d3_geom_quadtreePoint(p) {
+ return {
+ x: p[0],
+ y: p[1]
+ };
+}
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.js
new file mode 100644
index 0000000..9042897
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.js
@@ -0,0 +1,4707 @@
+(function(){if (!Date.now) Date.now = function() {
+ return +new Date;
+};
+try {
+ document.createElement("div").style.setProperty("opacity", 0, "");
+} catch (error) {
+ var d3_style_prototype = CSSStyleDeclaration.prototype,
+ d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+}
+d3 = {version: "2.7.2"}; // semver
+var d3_array = d3_arraySlice; // conversion for NodeLists
+
+function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+}
+
+function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+}
+
+try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+} catch(e) {
+ d3_array = d3_arrayCopy;
+}
+
+var d3_arraySubclass = [].__proto__?
+
+// Until ECMAScript supports array subclassing, prototype injection works well.
+function(array, prototype) {
+ array.__proto__ = prototype;
+}:
+
+// And if your browser doesn't support __proto__, we'll use direct extension.
+function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+};
+function d3_this() {
+ return this;
+}
+d3.functor = function(v) {
+ return typeof v === "function" ? v : function() { return v; };
+};
+// Copies a variable number of methods from source to target.
+d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+};
+
+// Method is assumed to be a standard D3 getter-setter:
+// If passed with no arguments, gets the value.
+// If passed with arguments, sets the value and returns the target.
+function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
+ };
+}
+d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+};
+d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+};
+d3.mean = function(array, f) {
+ var n = array.length,
+ a,
+ m = 0,
+ i = -1,
+ j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+};
+d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+};
+d3.min = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+};
+d3.max = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+};
+d3.extent = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b,
+ c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [a, c];
+};
+d3.random = {
+ normal: function(mean, deviation) {
+ if (arguments.length < 2) deviation = 1;
+ if (arguments.length < 1) mean = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ }
+};
+function d3_number(x) {
+ return x != null && !isNaN(x);
+}
+d3.sum = function(array, f) {
+ var s = 0,
+ n = array.length,
+ a,
+ i = -1;
+
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+
+ return s;
+};
+// R-7 per
+d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1,
+ h = Math.floor(H),
+ v = values[h - 1],
+ e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+};
+d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+};
+d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+};
+
+function d3_zipLength(d) {
+ return d.length;
+}
+// Locate the insertion point for x in a to maintain sorted order. The
+// arguments lo and hi may be used to specify a subset of the array which should
+// be considered; by default the entire array is used. If x is already present
+// in a, the insertion point will be before (to the left of) any existing
+// entries. The return value is suitable for use as the first argument to
+// `array.splice` assuming that a is already sorted.
+//
+// The returned insertion point i partitions the array a into two halves so that
+// all v < x for v in a[lo:i] for the left side and all v >= x for v in a[i:hi]
+// for the right side.
+d3.bisectLeft = function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = (lo + hi) >> 1;
+ if (a[mid] < x) lo = mid + 1;
+ else hi = mid;
+ }
+ return lo;
+};
+
+// Similar to bisectLeft, but returns an insertion point which comes after (to
+// the right of) any existing entries of x in a.
+//
+// The returned insertion point i partitions the array into two halves so that
+// all v <= x for v in a[lo:i] for the left side and all v > x for v in a[i:hi]
+// for the right side.
+d3.bisect =
+d3.bisectRight = function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = (lo + hi) >> 1;
+ if (x < a[mid]) hi = mid;
+ else lo = mid + 1;
+ }
+ return lo;
+};
+d3.first = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) > 0) {
+ a = b;
+ }
+ }
+ return a;
+};
+d3.last = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) <= 0) {
+ a = b;
+ }
+ }
+ return a;
+};
+d3.nest = function() {
+ var nest = {},
+ keys = [],
+ sortKeys = [],
+ sortValues,
+ rollup;
+
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup
+ ? rollup.call(nest, array) : (sortValues
+ ? array.sort(sortValues)
+ : array);
+
+ var i = -1,
+ n = array.length,
+ key = keys[depth++],
+ keyValue,
+ object,
+ o = {};
+
+ while (++i < n) {
+ if ((keyValue = key(object = array[i])) in o) {
+ o[keyValue].push(object);
+ } else {
+ o[keyValue] = [object];
+ }
+ }
+
+ for (keyValue in o) {
+ o[keyValue] = map(o[keyValue], depth);
+ }
+
+ return o;
+ }
+
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+
+ var a = [],
+ sortKey = sortKeys[depth++],
+ key;
+
+ for (key in map) {
+ a.push({key: key, values: entries(map[key], depth)});
+ }
+
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+
+ return a;
+ }
+
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+
+ // Specifies the order for the most-recently specified key.
+ // Note: only applies to entries. Map keys are unordered!
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+
+ // Specifies the order for leaf values.
+ // Applies to both maps and entries array.
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+
+ return nest;
+};
+d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+};
+d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+};
+d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({key: key, value: map[key]});
+ return entries;
+};
+d3.permute = function(array, indexes) {
+ var permutes = [],
+ i = -1,
+ n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+};
+d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+};
+d3.split = function(array, f) {
+ var arrays = [],
+ values = [],
+ value,
+ i = -1,
+ n = array.length;
+ if (arguments.length < 2) f = d3_splitter;
+ while (++i < n) {
+ if (f.call(values, value = array[i], i)) {
+ values = [];
+ } else {
+ if (!values.length) arrays.push(values);
+ values.push(value);
+ }
+ }
+ return arrays;
+};
+
+function d3_splitter(d) {
+ return d == null;
+}
+function d3_collapse(s) {
+ return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
+}
+/**
+ * @param {number} start
+ * @param {number=} stop
+ * @param {number=} step
+ */
+d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step == Infinity) throw new Error("infinite range");
+ var range = [],
+ i = -1,
+ j;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j);
+ else while ((j = start + step * ++i) < stop) range.push(j);
+ return range;
+};
+d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+};
+
+var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+d3.round = function(x, n) {
+ return n
+ ? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n)
+ : Math.round(x);
+};
+d3.xhr = function(url, mime, callback) {
+ var req = new XMLHttpRequest;
+ if (arguments.length < 3) callback = mime, mime = null;
+ else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
+ req.open("GET", url, true);
+ if (mime) req.setRequestHeader("Accept", mime);
+ req.onreadystatechange = function() {
+ if (req.readyState === 4) callback(req.status < 300 ? req : null);
+ };
+ req.send(null);
+};
+d3.text = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseText);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+};
+d3.json = function(url, callback) {
+ d3.text(url, "application/json", function(text) {
+ callback(text ? JSON.parse(text) : null);
+ });
+};
+d3.html = function(url, callback) {
+ d3.text(url, "text/html", function(text) {
+ if (text != null) { // Treat empty string as valid HTML.
+ var range = document.createRange();
+ range.selectNode(document.body);
+ text = range.createContextualFragment(text);
+ }
+ callback(text);
+ });
+};
+d3.xml = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseXML);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+};
+var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+};
+
+d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":");
+ return i < 0 ? (name in d3_nsPrefix
+ ? {space: d3_nsPrefix[name], local: name} : name)
+ : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)};
+ }
+};
+d3.dispatch = function() {
+ var dispatch = new d3_dispatch(),
+ i = -1,
+ n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event();
+ return dispatch;
+};
+
+function d3_dispatch() {}
+
+d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."),
+ name = "";
+
+ // Extract optional namespace, e.g., "click.foo"
+ if (i > 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+
+ return arguments.length < 2
+ ? this[type].on(name)
+ : (this[type].on(name, listener), this);
+};
+
+function d3_dispatch_event() {
+ var listeners = [],
+ listenerByName = {};
+
+ function dispatch() {
+ var z = listeners, // defensive reference
+ i = -1,
+ n = z.length,
+ l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ }
+
+ dispatch.on = function(name, listener) {
+ var l, i;
+
+ // return the current listener, if any
+ if (arguments.length < 2) return (l = listenerByName[name]) && l.on;
+
+ // remove the old listener, if any (with copy-on-write)
+ if (l = listenerByName[name]) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ delete listenerByName[name];
+ }
+
+ // add the new listener, if any
+ if (listener) {
+ listeners.push(listenerByName[name] = {on: listener});
+ }
+
+ return dispatch;
+ };
+
+ return dispatch;
+};
+// TODO align
+d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier),
+ fill = match[1] || " ",
+ sign = match[3] || "",
+ zfill = match[5],
+ width = +match[6],
+ comma = match[7],
+ precision = match[8],
+ type = match[9],
+ scale = 1,
+ suffix = "",
+ integer = false;
+
+ if (precision) precision = +precision.substring(1);
+
+ if (zfill) {
+ fill = "0"; // TODO align = "=";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+
+ switch (type) {
+ case "n": comma = true; type = "g"; break;
+ case "%": scale = 100; suffix = "%"; type = "f"; break;
+ case "p": scale = 100; suffix = "%"; type = "r"; break;
+ case "d": integer = true; precision = 0; break;
+ case "s": scale = -1; type = "r"; break;
+ }
+
+ // If no precision is specified for r, fallback to general notation.
+ if (type == "r" && !precision) type = "g";
+
+ type = d3_format_types[type] || d3_format_typeDefault;
+
+ return function(value) {
+
+ // Return the empty string for floats formatted as ints.
+ if (integer && (value % 1)) return "";
+
+ // Convert negative to positive, and record the sign prefix.
+ var negative = (value < 0) && (value = -value) ? "\u2212" : sign;
+
+ // Apply the scale, computing it from the value's exponent for si format.
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value *= prefix.scale;
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+
+ // Convert to the desired precision.
+ value = type(value, precision);
+
+ // If the fill character is 0, the sign and group is applied after the fill.
+ if (zfill) {
+ var length = value.length + negative.length;
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ }
+
+ // Otherwise (e.g., space-filling), the sign and group is applied before.
+ else {
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ var length = value.length;
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
+ }
+
+ return value + suffix;
+ };
+};
+
+// [[fill]align][sign][#][0][width][,][.precision][type]
+var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+
+var d3_format_types = {
+ g: function(x, p) { return x.toPrecision(p); },
+ e: function(x, p) { return x.toExponential(p); },
+ f: function(x, p) { return x.toFixed(p); },
+ r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); }
+};
+
+function d3_format_precision(x, p) {
+ return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
+}
+
+function d3_format_typeDefault(x) {
+ return x + "";
+}
+
+// Apply comma grouping for thousands.
+function d3_format_group(value) {
+ var i = value.lastIndexOf("."),
+ f = i >= 0 ? value.substring(i) : (i = value.length, ""),
+ t = [];
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
+ return t.reverse().join(",") + f;
+}
+var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
+
+d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+};
+
+function d3_formatPrefix(d, i) {
+ return {
+ scale: Math.pow(10, (8 - i) * 3),
+ symbol: d
+ };
+}
+
+/*
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of contributors may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var d3_ease_quad = d3_ease_poly(2),
+ d3_ease_cubic = d3_ease_poly(3);
+
+var d3_ease = {
+ linear: function() { return d3_ease_linear; },
+ poly: d3_ease_poly,
+ quad: function() { return d3_ease_quad; },
+ cubic: function() { return d3_ease_cubic; },
+ sin: function() { return d3_ease_sin; },
+ exp: function() { return d3_ease_exp; },
+ circle: function() { return d3_ease_circle; },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() { return d3_ease_bounce; }
+};
+
+var d3_ease_mode = {
+ "in": function(f) { return f; },
+ "out": d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
+};
+
+d3.ease = function(name) {
+ var i = name.indexOf("-"),
+ t = i >= 0 ? name.substring(0, i) : name,
+ m = i >= 0 ? name.substring(i + 1) : "in";
+ return d3_ease_clamp(d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1))));
+};
+
+function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+}
+
+function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+}
+
+function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
+ };
+}
+
+function d3_ease_linear(t) {
+ return t;
+}
+
+function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ }
+}
+
+function d3_ease_sin(t) {
+ return 1 - Math.cos(t * Math.PI / 2);
+}
+
+function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+}
+
+function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+}
+
+function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = 0.45;
+ if (arguments.length < 1) { a = 1; s = p / 4; }
+ else s = p / (2 * Math.PI) * Math.asin(1 / a);
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
+ };
+}
+
+function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+}
+
+function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t
+ : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75
+ : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375
+ : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+}
+d3.event = null;
+
+function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+}
+d3.interpolate = function(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b)));
+ return f;
+};
+
+d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) { return a + b * t; };
+};
+
+d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) { return Math.round(a + b * t); };
+};
+
+d3.interpolateString = function(a, b) {
+ var m, // current match
+ i, // current index
+ j, // current index (for coallescing)
+ s0 = 0, // start index of current string prefix
+ s1 = 0, // end index of current string prefix
+ s = [], // string constants and placeholders
+ q = [], // number interpolators
+ n, // q.length
+ o;
+
+ // Reset our regular expression!
+ d3_interpolate_number.lastIndex = 0;
+
+ // Find all numbers in b.
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({i: s.length, x: m[0]});
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+
+ // Find all numbers in a.
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) { // The numbers match, so coallesce.
+ if (o.i) {
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i] = o.x;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+
+ // Remove any numbers in b not found in a.
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i] = o.x;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+
+ // Special optimization for only a single match.
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() { return b; };
+ }
+
+ // Otherwise, interpolate each of the numbers and rejoin the string.
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+};
+
+d3.interpolateTransform = function(a, b) {
+ return d3.interpolateString(d3.transform(a) + "", d3.transform(b) + "");
+};
+
+d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r,
+ ag = a.g,
+ ab = a.b,
+ br = b.r - ar,
+ bg = b.g - ag,
+ bb = b.b - ab;
+ return function(t) {
+ return "#"
+ + d3_rgb_hex(Math.round(ar + br * t))
+ + d3_rgb_hex(Math.round(ag + bg * t))
+ + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+};
+
+// interpolates HSL space, but outputs RGB string (for compatibility)
+d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h,
+ s0 = a.s,
+ l0 = a.l,
+ h1 = b.h - h0,
+ s1 = b.s - s0,
+ l1 = b.l - l0;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();
+ };
+};
+
+d3.interpolateArray = function(a, b) {
+ var x = [],
+ c = [],
+ na = a.length,
+ nb = b.length,
+ n0 = Math.min(a.length, b.length),
+ i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (; i < na; ++i) c[i] = a[i];
+ for (; i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+};
+
+d3.interpolateObject = function(a, b) {
+ var i = {},
+ c = {},
+ k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+}
+
+var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;
+
+function d3_interpolateByName(n) {
+ return n == "transform"
+ ? d3.interpolateTransform
+ : d3.interpolate;
+}
+
+d3.interpolators = [
+ d3.interpolateObject,
+ function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); },
+ function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); },
+ function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); },
+ function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); }
+];
+function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) { return (x - a) * b; };
+}
+
+function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); };
+}
+d3.rgb = function(r, g, b) {
+ return arguments.length === 1
+ ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b)
+ : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
+ : d3_rgb(~~r, ~~g, ~~b);
+};
+
+function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+}
+
+function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+}
+
+d3_Rgb.prototype.brighter = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ var r = this.r,
+ g = this.g,
+ b = this.b,
+ i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(
+ Math.min(255, Math.floor(r / k)),
+ Math.min(255, Math.floor(g / k)),
+ Math.min(255, Math.floor(b / k)));
+};
+
+d3_Rgb.prototype.darker = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ return d3_rgb(
+ Math.floor(k * this.r),
+ Math.floor(k * this.g),
+ Math.floor(k * this.b));
+};
+
+d3_Rgb.prototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+};
+
+d3_Rgb.prototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+};
+
+function d3_rgb_hex(v) {
+ return v < 0x10
+ ? "0" + Math.max(0, v).toString(16)
+ : Math.min(255, v).toString(16);
+}
+
+function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, // red channel; int in [0, 255]
+ g = 0, // green channel; int in [0, 255]
+ b = 0, // blue channel; int in [0, 255]
+ m1, // CSS color specification match
+ m2, // CSS color specification type (e.g., rgb)
+ name;
+
+ /* Handle hsl, rgb. */
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl": {
+ return hsl(
+ parseFloat(m2[0]), // degrees
+ parseFloat(m2[1]) / 100, // percentage
+ parseFloat(m2[2]) / 100 // percentage
+ );
+ }
+ case "rgb": {
+ return rgb(
+ d3_rgb_parseNumber(m2[0]),
+ d3_rgb_parseNumber(m2[1]),
+ d3_rgb_parseNumber(m2[2])
+ );
+ }
+ }
+ }
+
+ /* Named colors. */
+ if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b);
+
+ /* Hexadecimal colors: #rgb and #rrggbb. */
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1); r += r;
+ g = format.charAt(2); g += g;
+ b = format.charAt(3); b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+
+ return rgb(r, g, b);
+}
+
+function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255),
+ max = Math.max(r, g, b),
+ d = max - min,
+ h,
+ s,
+ l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
+ else if (g == max) h = (b - r) / d + 2;
+ else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+}
+
+function d3_rgb_parseNumber(c) { // either integer or percentage
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+}
+
+var d3_rgb_names = {
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+};
+
+for (var d3_rgb_name in d3_rgb_names) {
+ d3_rgb_names[d3_rgb_name] = d3_rgb_parse(
+ d3_rgb_names[d3_rgb_name],
+ d3_rgb,
+ d3_hsl_rgb);
+}
+d3.hsl = function(h, s, l) {
+ return arguments.length === 1
+ ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l)
+ : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
+ : d3_hsl(+h, +s, +l);
+};
+
+function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+}
+
+function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+}
+
+d3_Hsl.prototype.brighter = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+};
+
+d3_Hsl.prototype.darker = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+};
+
+d3_Hsl.prototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+};
+
+d3_Hsl.prototype.toString = function() {
+ return this.rgb().toString();
+};
+
+function d3_hsl_rgb(h, s, l) {
+ var m1,
+ m2;
+
+ /* Some simple corrections for h, s and l. */
+ h = h % 360; if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+
+ /* From FvD 13.37, CSS Color Module Level 3 */
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+
+ function v(h) {
+ if (h > 360) h -= 360;
+ else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+}
+function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+}
+
+var d3_select = function(s, n) { return n.querySelector(s); },
+ d3_selectAll = function(s, n) { return n.querySelectorAll(s); },
+ d3_selectRoot = document.documentElement,
+ d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector,
+ d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); };
+
+// Prefer Sizzle, if available.
+if (typeof Sizzle === "function") {
+ d3_select = function(s, n) { return Sizzle(s, n)[0]; };
+ d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
+ d3_selectMatches = Sizzle.matchesSelector;
+}
+
+var d3_selectionPrototype = [];
+
+d3.selection = function() {
+ return d3_selectionRoot;
+};
+
+d3.selection.prototype = d3_selectionPrototype;
+d3_selectionPrototype.select = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ group,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+
+function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+}
+d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [],
+ subgroup,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+
+function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+}
+d3_selectionPrototype.attr = function(name, value) {
+ name = d3.ns.qualify(name);
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ var node = this.node();
+ return name.local
+ ? node.getAttributeNS(name.space, name.local)
+ : node.getAttribute(name);
+ }
+
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name);
+ else this.setAttribute(name, x);
+ }
+
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local);
+ else this.setAttributeNS(name.space, name.local, x);
+ }
+
+ return this.each(value == null
+ ? (name.local ? attrNullNS : attrNull) : (typeof value === "function"
+ ? (name.local ? attrFunctionNS : attrFunction)
+ : (name.local ? attrConstantNS : attrConstant)));
+};
+d3_selectionPrototype.classed = function(name, value) {
+ var names = name.split(d3_selection_classedWhitespace),
+ n = names.length,
+ i = -1;
+ if (arguments.length > 1) {
+ while (++i < n) d3_selection_classed.call(this, names[i], value);
+ return this;
+ } else {
+ while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false;
+ return true;
+ }
+};
+
+var d3_selection_classedWhitespace = /\s+/g;
+
+function d3_selection_classed(name, value) {
+ var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ var node = this.node();
+ if (c = node.classList) return c.contains(name);
+ var c = node.className;
+ re.lastIndex = 0;
+ return re.test(c.baseVal != null ? c.baseVal : c);
+ }
+
+ function classedAdd() {
+ if (c = this.classList) return c.add(name);
+ var c = this.className,
+ cb = c.baseVal != null,
+ cv = cb ? c.baseVal : c;
+ re.lastIndex = 0;
+ if (!re.test(cv)) {
+ cv = d3_collapse(cv + " " + name);
+ if (cb) c.baseVal = cv;
+ else this.className = cv;
+ }
+ }
+
+ function classedRemove() {
+ if (c = this.classList) return c.remove(name);
+ var c = this.className,
+ cb = c.baseVal != null,
+ cv = cb ? c.baseVal : c;
+ cv = d3_collapse(cv.replace(re, " "));
+ if (cb) c.baseVal = cv;
+ else this.className = cv;
+ }
+
+ function classedFunction() {
+ (value.apply(this, arguments)
+ ? classedAdd
+ : classedRemove).call(this);
+ }
+
+ return this.each(typeof value === "function"
+ ? classedFunction : value
+ ? classedAdd
+ : classedRemove);
+}
+d3_selectionPrototype.style = function(name, value, priority) {
+ if (arguments.length < 3) priority = "";
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) return window
+ .getComputedStyle(this.node(), null)
+ .getPropertyValue(name);
+
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name);
+ else this.style.setProperty(name, x, priority);
+ }
+
+ return this.each(value == null
+ ? styleNull : (typeof value === "function"
+ ? styleFunction : styleConstant));
+};
+d3_selectionPrototype.property = function(name, value) {
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) return this.node()[name];
+
+ function propertyNull() {
+ delete this[name];
+ }
+
+ function propertyConstant() {
+ this[name] = value;
+ }
+
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name];
+ else this[name] = x;
+ }
+
+ return this.each(value == null
+ ? propertyNull : (typeof value === "function"
+ ? propertyFunction : propertyConstant));
+};
+d3_selectionPrototype.text = function(value) {
+ return arguments.length < 1
+ ? this.node().textContent : this.each(typeof value === "function"
+ ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
+ ? function() { this.textContent = ""; }
+ : function() { this.textContent = value; });
+};
+d3_selectionPrototype.html = function(value) {
+ return arguments.length < 1
+ ? this.node().innerHTML : this.each(typeof value === "function"
+ ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
+ ? function() { this.innerHTML = ""; }
+ : function() { this.innerHTML = value; });
+};
+// TODO append(node)?
+// TODO append(function)?
+d3_selectionPrototype.append = function(name) {
+ name = d3.ns.qualify(name);
+
+ function append() {
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
+ }
+
+ function appendNS() {
+ return this.appendChild(document.createElementNS(name.space, name.local));
+ }
+
+ return this.select(name.local ? appendNS : append);
+};
+// TODO insert(node, function)?
+// TODO insert(function, string)?
+// TODO insert(function, function)?
+d3_selectionPrototype.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+
+ function insert() {
+ return this.insertBefore(
+ document.createElementNS(this.namespaceURI, name),
+ d3_select(before, this));
+ }
+
+ function insertNS() {
+ return this.insertBefore(
+ document.createElementNS(name.space, name.local),
+ d3_select(before, this));
+ }
+
+ return this.select(name.local ? insertNS : insert);
+};
+// TODO remove(selector)?
+// TODO remove(node)?
+// TODO remove(function)?
+d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+};
+// TODO data(null) for clearing data?
+d3_selectionPrototype.data = function(data, join) {
+ var enter = [],
+ update = [],
+ exit = [];
+
+ function bind(group, groupData) {
+ var i,
+ n = group.length,
+ m = groupData.length,
+ n0 = Math.min(n, m),
+ n1 = Math.max(n, m),
+ updateNodes = [],
+ enterNodes = [],
+ exitNodes = [],
+ node,
+ nodeData;
+
+ if (join) {
+ var nodeByKey = {},
+ keys = [],
+ key,
+ j = groupData.length;
+
+ for (i = -1; ++i < n;) {
+ key = join.call(node = group[i], node.__data__, i);
+ if (key in nodeByKey) {
+ exitNodes[j++] = node; // duplicate key
+ } else {
+ nodeByKey[key] = node;
+ }
+ keys.push(key);
+ }
+
+ for (i = -1; ++i < m;) {
+ node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ delete nodeByKey[key];
+ }
+
+ for (i = -1; ++i < n;) {
+ if (keys[i] in nodeByKey) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0;) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ }
+ for (; i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ for (; i < n1; ++i) {
+ exitNodes[i] = group[i];
+ enterNodes[i] = updateNodes[i] = null;
+ }
+ }
+
+ enterNodes.update
+ = updateNodes;
+
+ enterNodes.parentNode
+ = updateNodes.parentNode
+ = exitNodes.parentNode
+ = group.parentNode;
+
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+
+ var i = -1,
+ n = this.length,
+ group;
+ if (typeof data === "function") {
+ while (++i < n) {
+ bind(group = this[i], data.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], data);
+ }
+ }
+
+ var selection = d3_selection(update);
+ selection.enter = function() { return d3_selection_enter(enter); };
+ selection.exit = function() { return d3_selection(exit); };
+ return selection;
+};
+
+function d3_selection_dataNode(data) {
+ return {__data__: data};
+}
+d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [],
+ subgroup,
+ group,
+ node;
+
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+
+function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+}
+d3_selectionPrototype.map = function(map) {
+ return this.each(function() {
+ this.__data__ = map.apply(this, arguments);
+ });
+};
+d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+};
+d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator);
+ return this.order();
+};
+
+function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return comparator(a && a.__data__, b && b.__data__);
+ };
+}
+// type can be namespaced, e.g., "click.foo"
+// listener can be null for removal
+d3_selectionPrototype.on = function(type, listener, capture) {
+ if (arguments.length < 3) capture = false;
+
+ // parse the type specifier
+ var name = "__on" + type, i = type.indexOf(".");
+ if (i > 0) type = type.substring(0, i);
+
+ // if called with only one argument, return the current listener
+ if (arguments.length < 2) return (i = this.node()[name]) && i._;
+
+ // remove the old event listener, and add the new event listener
+ return this.each(function(d, i) {
+ var node = this;
+
+ if (node[name]) node.removeEventListener(type, node[name], capture);
+ if (listener) node.addEventListener(type, node[name] = l, capture);
+
+ // wrapped event listener that preserves i
+ function l(e) {
+ var o = d3.event; // Events can be reentrant (e.g., focus).
+ d3.event = e;
+ try {
+ listener.call(node, node.__data__, i);
+ } finally {
+ d3.event = o;
+ }
+ }
+
+ // stash the unwrapped listener for retrieval
+ l._ = listener;
+ });
+};
+d3_selectionPrototype.each = function(callback) {
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ var node = group[i];
+ if (node) callback.call(node, node.__data__, i, j);
+ }
+ }
+ return this;
+};
+//
+// Note: assigning to the arguments array simultaneously changes the value of
+// the corresponding argument!
+//
+// TODO The `this` argument probably shouldn't be the first argument to the
+// callback, anyway, since it's redundant. However, that will require a major
+// version bump due to backwards compatibility, so I'm not changing it right
+// away.
+//
+d3_selectionPrototype.call = function(callback) {
+ callback.apply(this, (arguments[0] = this, arguments));
+ return this;
+};
+d3_selectionPrototype.empty = function() {
+ return !this.node();
+};
+d3_selectionPrototype.node = function(callback) {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+};
+d3_selectionPrototype.transition = function() {
+ var subgroups = [],
+ subgroup,
+ node;
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ subgroup.push((node = group[i]) ? {node: node, delay: 0, duration: 250} : null);
+ }
+ }
+
+ return d3_transition(subgroups, d3_transitionInheritId || ++d3_transitionId, Date.now());
+};
+var d3_selectionRoot = d3_selection([[document]]);
+
+d3_selectionRoot[0].parentNode = d3_selectRoot;
+
+// TODO fast singleton implementation!
+// TODO select(function)
+d3.select = function(selector) {
+ return typeof selector === "string"
+ ? d3_selectionRoot.select(selector)
+ : d3_selection([[selector]]); // assume node
+};
+
+// TODO selectAll(function)
+d3.selectAll = function(selector) {
+ return typeof selector === "string"
+ ? d3_selectionRoot.selectAll(selector)
+ : d3_selection([d3_array(selector)]); // assume node[]
+};
+function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+}
+
+var d3_selection_enterPrototype = [];
+
+d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ upgroup,
+ group,
+ node;
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+function d3_transition(groups, id, time) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+
+ var tweens = {},
+ event = d3.dispatch("start", "end"),
+ ease = d3_transitionEase;
+
+ groups.id = id;
+
+ groups.time = time;
+
+ groups.tween = function(name, tween) {
+ if (arguments.length < 2) return tweens[name];
+ if (tween == null) delete tweens[name];
+ else tweens[name] = tween;
+ return groups;
+ };
+
+ groups.ease = function(value) {
+ if (!arguments.length) return ease;
+ ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
+ return groups;
+ };
+
+ groups.each = function(type, listener) {
+ if (arguments.length < 2) return d3_transition_each.call(groups, type);
+ event.on(type, listener);
+ return groups;
+ };
+
+ d3.timer(function(elapsed) {
+ groups.each(function(d, i, j) {
+ var tweened = [],
+ node = this,
+ delay = groups[j][i].delay,
+ duration = groups[j][i].duration,
+ lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0});
+
+ ++lock.count;
+
+ delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
+
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+
+ for (var tween in tweens) {
+ if (tween = tweens[tween].call(node, d, i)) {
+ tweened.push(tween);
+ }
+ }
+
+ event.start.call(node, d, i);
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+
+ var t = (elapsed - delay) / duration,
+ e = ease(t),
+ n = tweened.length;
+
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+
+ if (t >= 1) {
+ stop();
+ d3_transitionInheritId = id;
+ event.end.call(node, d, i);
+ d3_transitionInheritId = 0;
+ return 1;
+ }
+ }
+
+ function stop() {
+ if (!--lock.count) delete node.__transition__;
+ return 1;
+ }
+ });
+ return 1;
+ }, 0, time);
+
+ return groups;
+}
+
+var d3_transitionRemove = {};
+
+function d3_transitionNull(d, i, a) {
+ return a != "" && d3_transitionRemove;
+}
+
+function d3_transitionTween(name, b) {
+ var interpolate = d3_interpolateByName(name);
+
+ function transitionFunction(d, i, a) {
+ var v = b.call(this, d, i);
+ return v == null
+ ? a != "" && d3_transitionRemove
+ : a != v && interpolate(a, v);
+ }
+
+ function transitionString(d, i, a) {
+ return a != b && interpolate(a, b);
+ }
+
+ return typeof b === "function" ? transitionFunction
+ : b == null ? d3_transitionNull
+ : (b += "", transitionString);
+}
+
+var d3_transitionPrototype = [],
+ d3_transitionId = 0,
+ d3_transitionInheritId = 0,
+ d3_transitionEase = d3.ease("cubic-in-out");
+
+d3_transitionPrototype.call = d3_selectionPrototype.call;
+
+d3.transition = function() {
+ return d3_selectionRoot.transition();
+};
+
+d3.transition.prototype = d3_transitionPrototype;
+d3_transitionPrototype.select = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
+ if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
+ subgroup.push({node: subnode, delay: node.delay, duration: node.duration});
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+};
+d3_transitionPrototype.selectAll = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnodes,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subnodes = selector.call(node.node, node.node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o;) {
+ subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration});
+ }
+ }
+ }
+ }
+
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+};
+d3_transitionPrototype.attr = function(name, value) {
+ return this.attrTween(name, d3_transitionTween(name, value));
+};
+
+d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ var name = d3.ns.qualify(nameNS);
+
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f === d3_transitionRemove
+ ? (this.removeAttribute(name), null)
+ : f && function(t) { this.setAttribute(name, f(t)); };
+ }
+
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f === d3_transitionRemove
+ ? (this.removeAttributeNS(name.space, name.local), null)
+ : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); };
+ }
+
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+};
+d3_transitionPrototype.style = function(name, value, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.styleTween(name, d3_transitionTween(name, value), priority);
+};
+
+d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+ return f === d3_transitionRemove
+ ? (this.style.removeProperty(name), null)
+ : f && function(t) { this.style.setProperty(name, f(t), priority); };
+ });
+};
+d3_transitionPrototype.text = function(value) {
+ return this.tween("text", function(d, i) {
+ this.textContent = typeof value === "function"
+ ? value.call(this, d, i)
+ : value;
+ });
+};
+d3_transitionPrototype.remove = function() {
+ return this.each("end", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+};
+d3_transitionPrototype.delay = function(value) {
+ var groups = this;
+ return groups.each(typeof value === "function"
+ ? function(d, i, j) { groups[j][i].delay = +value.apply(this, arguments); }
+ : (value = +value, function(d, i, j) { groups[j][i].delay = value; }));
+};
+d3_transitionPrototype.duration = function(value) {
+ var groups = this;
+ return groups.each(typeof value === "function"
+ ? function(d, i, j) { groups[j][i].duration = +value.apply(this, arguments); }
+ : (value = +value, function(d, i, j) { groups[j][i].duration = value; }));
+};
+function d3_transition_each(callback) {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) callback.call(node = node.node, node.__data__, i, j);
+ }
+ }
+ return this;
+}
+d3_transitionPrototype.transition = function() {
+ return this.select(d3_this);
+};
+var d3_timer_queue = null,
+ d3_timer_interval, // is an interval (or frame) active?
+ d3_timer_timeout; // is a timeout active?
+
+// The timer will continue to fire until callback returns true.
+d3.timer = function(callback, delay, then) {
+ var found = false,
+ t0,
+ t1 = d3_timer_queue;
+
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0;
+ else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+
+ // See if the callback's already in the queue.
+ while (t1) {
+ if (t1.callback === callback) {
+ t1.then = then;
+ t1.delay = delay;
+ found = true;
+ break;
+ }
+ t0 = t1;
+ t1 = t1.next;
+ }
+
+ // Otherwise, add the callback to the queue.
+ if (!found) d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+
+ // Start animatin'!
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+}
+
+function d3_timer_step() {
+ var elapsed,
+ now = Date.now(),
+ t1 = d3_timer_queue;
+
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+}
+
+d3.timer.flush = function() {
+ var elapsed,
+ now = Date.now(),
+ t1 = d3_timer_queue;
+
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+
+ d3_timer_flush();
+};
+
+// Flush after callbacks, to avoid concurrent queue modification.
+function d3_timer_flush() {
+ var t0 = null,
+ t1 = d3_timer_queue,
+ then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+}
+
+var d3_timer_frame = window.requestAnimationFrame
+ || window.webkitRequestAnimationFrame
+ || window.mozRequestAnimationFrame
+ || window.oRequestAnimationFrame
+ || window.msRequestAnimationFrame
+ || function(callback) { setTimeout(callback, 17); };
+d3.transform = function(string) {
+ var g = document.createElementNS(d3.ns.prefix.svg, "g"),
+ identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : identity);
+ })(string);
+};
+
+// Compute x-scale and normalize the first row.
+// Compute shear and make second row orthogonal to first.
+// Compute y-scale and normalize the second row.
+// Finally, compute the rotation.
+function d3_transform(m) {
+ var r0 = [m.a, m.b],
+ r1 = [m.c, m.d],
+ kx = d3_transformNormalize(r0),
+ kz = d3_transformDot(r0, r1),
+ ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
+ this.translate = [m.e, m.f];
+ this.scale = [kx, ky];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
+};
+
+d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate
+ + ")rotate(" + this.rotate
+ + ")skewX(" + this.skew
+ + ")scale(" + this.scale
+ + ")";
+};
+
+function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+}
+
+function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+}
+
+var d3_transformDegrees = 180 / Math.PI;
+function d3_noop() {}
+d3.scale = {};
+
+function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [start, stop] : [stop, start];
+}
+
+function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+}
+function d3_scale_nice(domain, nice) {
+ var i0 = 0,
+ i1 = domain.length - 1,
+ x0 = domain[i0],
+ x1 = domain[i1],
+ dx;
+
+ if (x1 < x0) {
+ dx = i0; i0 = i1; i1 = dx;
+ dx = x0; x0 = x1; x1 = dx;
+ }
+
+ if (dx = x1 - x0) {
+ nice = nice(dx);
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+
+ return domain;
+}
+
+function d3_scale_niceDefault() {
+ return Math;
+}
+d3.scale.linear = function() {
+ return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false);
+};
+
+function d3_scale_linear(domain, range, interpolate, clamp) {
+ var output,
+ input;
+
+ function rescale() {
+ var linear = domain.length == 2 ? d3_scale_bilinear : d3_scale_polylinear,
+ uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3.interpolate);
+ return scale;
+ }
+
+ function scale(x) {
+ return output(x);
+ }
+
+ // Note: requires range is coercible to number!
+ scale.invert = function(y) {
+ return input(y);
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+
+ return rescale();
+};
+
+function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+}
+
+function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return {
+ floor: function(x) { return Math.floor(x / dx) * dx; },
+ ceil: function(x) { return Math.ceil(x / dx) * dx; }
+ };
+}
+
+// TODO Dates? Ugh.
+function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain),
+ span = extent[1] - extent[0],
+ step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
+ err = m / span * step;
+
+ // Filter ticks to get closer to the desired count.
+ if (err <= .15) step *= 10;
+ else if (err <= .35) step *= 5;
+ else if (err <= .75) step *= 2;
+
+ // Round start and stop values to step interval.
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive
+ extent[2] = step;
+ return extent;
+}
+
+function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+}
+
+function d3_scale_linearTickFormat(domain, m) {
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
+}
+function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]),
+ i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+}
+function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [],
+ i = [],
+ j = 0,
+ n = domain.length;
+
+ while (++j < n) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, domain.length - 1) - 1;
+ return i[j](u[j](x));
+ };
+}
+d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
+};
+
+function d3_scale_log(linear, log) {
+ var pow = log.pow;
+
+ function scale(x) {
+ return linear(log(x));
+ }
+
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
+ return scale;
+ };
+
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()),
+ ticks = [];
+ if (extent.every(isFinite)) {
+ var i = Math.floor(extent[0]),
+ j = Math.ceil(extent[1]),
+ u = pow(extent[0]),
+ v = pow(extent[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {} // strip small values
+ for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (arguments.length < 1) return format;
+ var k = n / scale.ticks().length,
+ f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
+ e;
+ return function(d) {
+ return d / pow(f(log(d) + e)) < k ? format(d) : "";
+ };
+ };
+
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), log);
+ };
+
+ return d3_scale_linearRebind(scale, linear);
+};
+
+var d3_scale_logFormat = d3.format(".0e");
+
+function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
+}
+
+function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
+}
+
+d3_scale_logp.pow = function(x) {
+ return Math.pow(10, x);
+};
+
+d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+};
+d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+};
+
+function d3_scale_pow(linear, exponent) {
+ var powp = d3_scale_powPow(exponent),
+ powb = d3_scale_powPow(1 / exponent);
+
+ function scale(x) {
+ return linear(powp(x));
+ }
+
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(scale.domain(), m);
+ };
+
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+
+ return d3_scale_linearRebind(scale, linear);
+};
+
+function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+}
+d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+};
+d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {t: "range", x: []});
+};
+
+function d3_scale_ordinal(domain, ranger) {
+ var index,
+ range,
+ rangeBand;
+
+ function scale(x) {
+ return range[((index[x] || (index[x] = domain.push(x))) - 1) % range.length];
+ }
+
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) { return start + step * i; });
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = {};
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index[xi = x[i]]) index[xi] = domain.push(xi);
+ return scale[ranger.t](ranger.x, ranger.p);
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {t: "range", x: x};
+ return scale;
+ };
+
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ step = (stop - start) / (domain.length - 1 + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {t: "rangePoints", x: x, p: padding};
+ return scale;
+ };
+
+ scale.rangeBands = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ step = (stop - start) / (domain.length + padding);
+ range = steps(start + step * padding, step);
+ rangeBand = step * (1 - padding);
+ ranger = {t: "rangeBands", x: x, p: padding};
+ return scale;
+ };
+
+ scale.rangeRoundBands = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ step = Math.floor((stop - start) / (domain.length + padding));
+ range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {t: "rangeRoundBands", x: x, p: padding};
+ return scale;
+ };
+
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+
+ scale.rangeExtent = function() {
+ return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x;
+ };
+
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+
+ return scale.domain(domain);
+};
+/*
+ * This product includes color specifications and designs developed by Cynthia
+ * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
+ */
+
+d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+};
+
+d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+};
+
+d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+};
+
+d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+};
+
+var d3_category10 = [
+ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
+ "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
+];
+
+var d3_category20 = [
+ "#1f77b4", "#aec7e8",
+ "#ff7f0e", "#ffbb78",
+ "#2ca02c", "#98df8a",
+ "#d62728", "#ff9896",
+ "#9467bd", "#c5b0d5",
+ "#8c564b", "#c49c94",
+ "#e377c2", "#f7b6d2",
+ "#7f7f7f", "#c7c7c7",
+ "#bcbd22", "#dbdb8d",
+ "#17becf", "#9edae5"
+];
+
+var d3_category20b = [
+ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
+ "#637939", "#8ca252", "#b5cf6b", "#cedb9c",
+ "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
+ "#843c39", "#ad494a", "#d6616b", "#e7969c",
+ "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
+];
+
+var d3_category20c = [
+ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef",
+ "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2",
+ "#31a354", "#74c476", "#a1d99b", "#c7e9c0",
+ "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb",
+ "#636363", "#969696", "#bdbdbd", "#d9d9d9"
+];
+d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+};
+
+function d3_scale_quantile(domain, range) {
+ var thresholds;
+
+ function rescale() {
+ var k = 0,
+ n = domain.length,
+ q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending);
+ return rescale();
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+
+ scale.quantiles = function() {
+ return thresholds;
+ };
+
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range); // copy on write!
+ };
+
+ return rescale();
+};
+d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [0, 1]);
+};
+
+function d3_scale_quantize(x0, x1, range) {
+ var kx, i;
+
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return [x0, x1];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range); // copy on write
+ };
+
+ return rescale();
+};
+d3.svg = {};
+d3.svg.arc = function() {
+ var innerRadius = d3_svg_arcInnerRadius,
+ outerRadius = d3_svg_arcOuterRadius,
+ startAngle = d3_svg_arcStartAngle,
+ endAngle = d3_svg_arcEndAngle;
+
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments),
+ r1 = outerRadius.apply(this, arguments),
+ a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset,
+ a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset,
+ da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0),
+ df = da < Math.PI ? "0" : "1",
+ c0 = Math.cos(a0),
+ s0 = Math.sin(a0),
+ c1 = Math.cos(a1),
+ s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax
+ ? (r0
+ ? "M0," + r1
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
+ + "M0," + r0
+ + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0)
+ + "A" + r0 + "," + r0 + " 0 1,0 0," + r0
+ + "Z"
+ : "M0," + r1
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
+ + "Z")
+ : (r0
+ ? "M" + r1 * c0 + "," + r1 * s0
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
+ + "L" + r0 * c1 + "," + r0 * s1
+ + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0
+ + "Z"
+ : "M" + r1 * c0 + "," + r1 * s0
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
+ + "L0,0"
+ + "Z");
+ }
+
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3.functor(v);
+ return arc;
+ };
+
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3.functor(v);
+ return arc;
+ };
+
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3.functor(v);
+ return arc;
+ };
+
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3.functor(v);
+ return arc;
+ };
+
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments)
+ + outerRadius.apply(this, arguments)) / 2,
+ a = (startAngle.apply(this, arguments)
+ + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [Math.cos(a) * r, Math.sin(a) * r];
+ };
+
+ return arc;
+};
+
+var d3_svg_arcOffset = -Math.PI / 2,
+ d3_svg_arcMax = 2 * Math.PI - 1e-6;
+
+function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+}
+
+function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+}
+
+function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+}
+
+function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+}
+function d3_svg_line(projection) {
+ var x = d3_svg_lineX,
+ y = d3_svg_lineY,
+ interpolate = "linear",
+ interpolator = d3_svg_lineInterpolators[interpolate],
+ tension = .7;
+
+ function line(d) {
+ return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension);
+ }
+
+ line.x = function(v) {
+ if (!arguments.length) return x;
+ x = v;
+ return line;
+ };
+
+ line.y = function(v) {
+ if (!arguments.length) return y;
+ y = v;
+ return line;
+ };
+
+ line.interpolate = function(v) {
+ if (!arguments.length) return interpolate;
+ interpolator = d3_svg_lineInterpolators[interpolate = v];
+ return line;
+ };
+
+ line.tension = function(v) {
+ if (!arguments.length) return tension;
+ tension = v;
+ return line;
+ };
+
+ return line;
+}
+
+d3.svg.line = function() {
+ return d3_svg_line(Object);
+};
+
+// Converts the specified array of data into an array of points
+// (x-y tuples), by evaluating the specified `x` and `y` functions on each
+// data point. The `this` context of the evaluated functions is the specified
+// "self" object; each function is passed the current datum and index.
+function d3_svg_linePoints(self, d, x, y) {
+ var points = [],
+ i = -1,
+ n = d.length,
+ fx = typeof x === "function",
+ fy = typeof y === "function",
+ value;
+ if (fx && fy) {
+ while (++i < n) points.push([
+ x.call(self, value = d[i], i),
+ y.call(self, value, i)
+ ]);
+ } else if (fx) {
+ while (++i < n) points.push([x.call(self, d[i], i), y]);
+ } else if (fy) {
+ while (++i < n) points.push([x, y.call(self, d[i], i)]);
+ } else {
+ while (++i < n) points.push([x, y]);
+ }
+ return points;
+}
+
+// The default `x` property, which references d[0].
+function d3_svg_lineX(d) {
+ return d[0];
+}
+
+// The default `y` property, which references d[1].
+function d3_svg_lineY(d) {
+ return d[1];
+}
+
+// The various interpolators supported by the `line` class.
+var d3_svg_lineInterpolators = {
+ "linear": d3_svg_lineLinear,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ "basis": d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ "bundle": d3_svg_lineBundle,
+ "cardinal": d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ "monotone": d3_svg_lineMonotone
+};
+
+// Linear interpolation; generates "L" commands.
+function d3_svg_lineLinear(points) {
+ var i = 0,
+ n = points.length,
+ p = points[0],
+ path = [p[0], ",", p[1]];
+ while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]);
+ return path.join("");
+}
+
+// Step interpolation; generates "H" and "V" commands.
+function d3_svg_lineStepBefore(points) {
+ var i = 0,
+ n = points.length,
+ p = points[0],
+ path = [p[0], ",", p[1]];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+}
+
+// Step interpolation; generates "H" and "V" commands.
+function d3_svg_lineStepAfter(points) {
+ var i = 0,
+ n = points.length,
+ p = points[0],
+ path = [p[0], ",", p[1]];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+}
+
+// Open cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4
+ ? d3_svg_lineLinear(points)
+ : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1),
+ d3_svg_lineCardinalTangents(points, tension));
+}
+
+// Closed cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite((points.push(points[0]), points),
+ d3_svg_lineCardinalTangents([points[points.length - 2]]
+ .concat(points, [points[1]]), tension));
+}
+
+// Cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinal(points, tension, closed) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite(points,
+ d3_svg_lineCardinalTangents(points, tension));
+}
+
+// Hermite spline construction; generates "C" commands.
+function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1
+ || (points.length != tangents.length
+ && points.length != tangents.length + 2)) {
+ return d3_svg_lineLinear(points);
+ }
+
+ var quad = points.length != tangents.length,
+ path = "",
+ p0 = points[0],
+ p = points[1],
+ t0 = tangents[0],
+ t = t0,
+ pi = 1;
+
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3)
+ + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1])
+ + "," + (p[0] - t[0]) + "," + (p[1] - t[1])
+ + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1])
+ + "," + p[0] + "," + p[1];
+ }
+ }
+
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3)
+ + "," + lp[0] + "," + lp[1];
+ }
+
+ return path;
+}
+
+// Generates tangents for a cardinal spline.
+function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [],
+ a = (1 - tension) / 2,
+ p0,
+ p1 = points[0],
+ p2 = points[1],
+ i = 1,
+ n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
+ }
+ return tangents;
+}
+
+// B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1,
+ n = points.length,
+ pi = points[0],
+ x0 = pi[0],
+ y0 = pi[1],
+ px = [x0, x0, x0, (pi = points[1])[0]],
+ py = [y0, y0, y0, pi[1]],
+ path = [x0, ",", y0];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+// Open B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [],
+ i = -1,
+ n = points.length,
+ pi,
+ px = [0],
+ py = [0];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px)
+ + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i; while (++i < n) {
+ pi = points[i];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+// Closed B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasisClosed(points) {
+ var path,
+ i = -1,
+ n = points.length,
+ m = n + 4,
+ pi,
+ px = [],
+ py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",",
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)
+ ];
+ --i; while (++i < m) {
+ pi = points[i % n];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1,
+ x0 = points[0][0],
+ y0 = points[0][1],
+ dx = points[n][0] - x0,
+ dy = points[n][1] - y0,
+ i = -1,
+ p,
+ t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ return d3_svg_lineBasis(points);
+}
+
+// Returns the dot product of the given four-element vectors.
+function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+}
+
+// Matrix to transform basis (b-spline) control points to bezier
+// control points. Derived from FvD 11.2.8.
+var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0],
+ d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0],
+ d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6];
+
+// Pushes a "C" Bézier curve onto the specified path array, given the
+// two specified four-element arrays which define the control points.
+function d3_svg_lineBasisBezier(path, x, y) {
+ path.push(
+ "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+}
+
+// Computes the slope from points p0 to p1.
+function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+}
+
+// Compute three-point differences for the given points.
+// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference
+function d3_svg_lineFiniteDifferences(points) {
+ var i = 0,
+ j = points.length - 1,
+ m = [],
+ p0 = points[0],
+ p1 = points[1],
+ d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]));
+ }
+ m[i] = d;
+ return m;
+}
+
+// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite
+// interpolation. Returns an array of tangent vectors. For details, see
+// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation
+function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [],
+ d,
+ a,
+ b,
+ s,
+ m = d3_svg_lineFiniteDifferences(points),
+ i = -1,
+ j = points.length - 1;
+
+ // The first two steps are done by computing finite-differences:
+ // 1. Compute the slopes of the secant lines between successive points.
+ // 2. Initialize the tangents at every point as the average of the secants.
+
+ // Then, for each segment…
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+
+ // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set
+ // mk = m{k + 1} = 0 as the spline connecting these points must be flat to
+ // preserve monotonicity. Ignore step 4 and 5 for those k.
+
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ // 4. Let ak = mk / dk and bk = m{k + 1} / dk.
+ a = m[i] / d;
+ b = m[i + 1] / d;
+
+ // 5. Prevent overshoot and ensure monotonicity by restricting the
+ // magnitude of vector to a circle of radius 3.
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+
+ // Compute the normalized tangent vector from the slopes. Note that if x is
+ // not monotonic, it's possible that the slope will be infinite, so we protect
+ // against NaN by setting the coordinate to zero.
+ i = -1; while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0])
+ / (6 * (1 + m[i] * m[i]));
+ tangents.push([s || 0, m[i] * s || 0]);
+ }
+
+ return tangents;
+}
+
+function d3_svg_lineMonotone(points) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] +
+ d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+}
+d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+};
+
+function d3_svg_lineRadial(points) {
+ var point,
+ i = -1,
+ n = points.length,
+ r,
+ a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+}
+function d3_svg_area(projection) {
+ var x0 = d3_svg_lineX,
+ x1 = d3_svg_lineX,
+ y0 = 0,
+ y1 = d3_svg_lineY,
+ interpolate,
+ i0,
+ i1,
+ tension = .7;
+
+ function area(d) {
+ if (d.length < 1) return null;
+ var points0 = d3_svg_linePoints(this, d, x0, y0),
+ points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1);
+ return "M" + i0(projection(points1), tension)
+ + "L" + i1(projection(points0.reverse()), tension)
+ + "Z";
+ }
+
+ area.x = function(x) {
+ if (!arguments.length) return x1;
+ x0 = x1 = x;
+ return area;
+ };
+
+ area.x0 = function(x) {
+ if (!arguments.length) return x0;
+ x0 = x;
+ return area;
+ };
+
+ area.x1 = function(x) {
+ if (!arguments.length) return x1;
+ x1 = x;
+ return area;
+ };
+
+ area.y = function(y) {
+ if (!arguments.length) return y1;
+ y0 = y1 = y;
+ return area;
+ };
+
+ area.y0 = function(y) {
+ if (!arguments.length) return y0;
+ y0 = y;
+ return area;
+ };
+
+ area.y1 = function(y) {
+ if (!arguments.length) return y1;
+ y1 = y;
+ return area;
+ };
+
+ area.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ i0 = d3_svg_lineInterpolators[interpolate = x];
+ i1 = i0.reverse || i0;
+ return area;
+ };
+
+ area.tension = function(x) {
+ if (!arguments.length) return tension;
+ tension = x;
+ return area;
+ };
+
+ return area.interpolate("linear");
+}
+
+d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+
+d3.svg.area = function() {
+ return d3_svg_area(Object);
+};
+
+function d3_svg_areaX(points) {
+ return function(d, i) {
+ return points[i][0];
+ };
+}
+
+function d3_svg_areaY(points) {
+ return function(d, i) {
+ return points[i][1];
+ };
+}
+d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+};
+d3.svg.chord = function() {
+ var source = d3_svg_chordSource,
+ target = d3_svg_chordTarget,
+ radius = d3_svg_chordRadius,
+ startAngle = d3_svg_arcStartAngle,
+ endAngle = d3_svg_arcEndAngle;
+
+ // TODO Allow control point to be customized.
+
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i),
+ t = subgroup(this, target, d, i);
+ return "M" + s.p0
+ + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
+ ? curve(s.r, s.p1, s.r, s.p0)
+ : curve(s.r, s.p1, t.r, t.p0)
+ + arc(t.r, t.p1, t.a1 - t.a0)
+ + curve(t.r, t.p1, s.r, s.p0))
+ + "Z";
+ }
+
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i),
+ r = radius.call(self, subgroup, i),
+ a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset,
+ a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [r * Math.cos(a0), r * Math.sin(a0)],
+ p1: [r * Math.cos(a1), r * Math.sin(a1)]
+ };
+ }
+
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
+ }
+
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3.functor(v);
+ return chord;
+ };
+
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3.functor(v);
+ return chord;
+ };
+
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3.functor(v);
+ return chord;
+ };
+
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3.functor(v);
+ return chord;
+ };
+
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3.functor(v);
+ return chord;
+ };
+
+ return chord;
+};
+
+function d3_svg_chordSource(d) {
+ return d.source;
+}
+
+function d3_svg_chordTarget(d) {
+ return d.target;
+}
+
+function d3_svg_chordRadius(d) {
+ return d.radius;
+}
+
+function d3_svg_chordStartAngle(d) {
+ return d.startAngle;
+}
+
+function d3_svg_chordEndAngle(d) {
+ return d.endAngle;
+}
+d3.svg.diagonal = function() {
+ var source = d3_svg_chordSource,
+ target = d3_svg_chordTarget,
+ projection = d3_svg_diagonalProjection;
+
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i),
+ p3 = target.call(this, d, i),
+ m = (p0.y + p3.y) / 2,
+ p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3.functor(x);
+ return diagonal;
+ };
+
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3.functor(x);
+ return diagonal;
+ };
+
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+
+ return diagonal;
+};
+
+function d3_svg_diagonalProjection(d) {
+ return [d.x, d.y];
+}
+d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(),
+ projection = d3_svg_diagonalProjection,
+ projection_ = diagonal.projection;
+
+ diagonal.projection = function(x) {
+ return arguments.length
+ ? projection_(d3_svg_diagonalRadialProjection(projection = x))
+ : projection;
+ };
+
+ return diagonal;
+};
+
+function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments),
+ r = d[0],
+ a = d[1] + d3_svg_arcOffset;
+ return [r * Math.cos(a), r * Math.sin(a)];
+ };
+}
+d3.svg.mouse = function(container) {
+ return d3_svg_mousePoint(container, d3.event);
+};
+
+// https://bugs.webkit.org/show_bug.cgi?id=44083
+var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
+
+function d3_svg_mousePoint(container, e) {
+ var point = (container.ownerSVGElement || container).createSVGPoint();
+ if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
+ var svg = d3.select(document.body)
+ .append("svg")
+ .style("position", "absolute")
+ .style("top", 0)
+ .style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [point.x, point.y];
+};
+d3.svg.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3.event.touches;
+
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_svg_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+};
+d3.svg.symbol = function() {
+ var type = d3_svg_symbolType,
+ size = d3_svg_symbolSize;
+
+ function symbol(d, i) {
+ return (d3_svg_symbols[type.call(this, d, i)]
+ || d3_svg_symbols.circle)
+ (size.call(this, d, i));
+ }
+
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3.functor(x);
+ return symbol;
+ };
+
+ // size of symbol in square pixels
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3.functor(x);
+ return symbol;
+ };
+
+ return symbol;
+};
+
+function d3_svg_symbolSize() {
+ return 64;
+}
+
+function d3_svg_symbolType() {
+ return "circle";
+}
+
+// TODO cross-diagonal?
+var d3_svg_symbols = {
+ "circle": function(size) {
+ var r = Math.sqrt(size / Math.PI);
+ return "M0," + r
+ + "A" + r + "," + r + " 0 1,1 0," + (-r)
+ + "A" + r + "," + r + " 0 1,1 0," + r
+ + "Z";
+ },
+ "cross": function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r
+ + "H" + -r
+ + "V" + -3 * r
+ + "H" + r
+ + "V" + -r
+ + "H" + 3 * r
+ + "V" + r
+ + "H" + r
+ + "V" + 3 * r
+ + "H" + -r
+ + "V" + r
+ + "H" + -3 * r
+ + "Z";
+ },
+ "diamond": function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)),
+ rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry
+ + "L" + rx + ",0"
+ + " 0," + ry
+ + " " + -rx + ",0"
+ + "Z";
+ },
+ "square": function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r
+ + "L" + r + "," + -r
+ + " " + r + "," + r
+ + " " + -r + "," + r
+ + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
+ ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry
+ + "L" + rx +"," + -ry
+ + " " + -rx + "," + -ry
+ + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
+ ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry
+ + "L" + rx +"," + ry
+ + " " + -rx + "," + ry
+ + "Z";
+ }
+};
+
+d3.svg.symbolTypes = d3.keys(d3_svg_symbols);
+
+var d3_svg_symbolSqrt3 = Math.sqrt(3),
+ d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
+d3.svg.axis = function() {
+ var scale = d3.scale.linear(),
+ orient = "bottom",
+ tickMajorSize = 6,
+ tickMinorSize = 6,
+ tickEndSize = 6,
+ tickPadding = 3,
+ tickArguments_ = [10],
+ tickFormat_,
+ tickSubdivide = 0;
+
+ function axis(selection) {
+ selection.each(function(d, i, j) {
+ var g = d3.select(this);
+
+ // If selection is a transition, create subtransitions.
+ var transition = selection.delay ? function(o) {
+ var id = d3_transitionInheritId;
+ try {
+ d3_transitionInheritId = selection.id;
+ return o.transition()
+ .delay(selection[j][i].delay)
+ .duration(selection[j][i].duration)
+ .ease(selection.ease());
+ } finally {
+ d3_transitionInheritId = id;
+ }
+ } : Object;
+
+ // Ticks, or domain values for ordinal scales.
+ var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(),
+ tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
+
+ // Minor ticks.
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
+ subtick = g.selectAll(".minor").data(subticks, String),
+ subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
+ subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(),
+ subtickUpdate = transition(subtick).style("opacity", 1);
+
+ // Major ticks.
+ var tick = g.selectAll("g").data(ticks, String),
+ tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
+ tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(),
+ tickUpdate = transition(tick).style("opacity", 1),
+ tickTransform;
+
+ // Domain.
+ var range = d3_scaleRange(scale),
+ path = g.selectAll(".domain").data([0]),
+ pathEnter = path.enter().append("path").attr("class", "domain"),
+ pathUpdate = transition(path);
+
+ // Stash a snapshot of the new scale, and retrieve the old snapshot.
+ var scale1 = scale.copy(),
+ scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+
+ tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("text");
+ tickUpdate.select("text").text(tickFormat);
+
+ switch (orient) {
+ case "bottom": {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ tickEnter.select("line").attr("y2", tickMajorSize);
+ tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
+ tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+ case "top": {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ tickEnter.select("line").attr("y2", -tickMajorSize);
+ tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
+ tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+ case "left": {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ tickEnter.select("line").attr("x2", -tickMajorSize);
+ tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
+ tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+ case "right": {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ tickEnter.select("line").attr("x2", tickMajorSize);
+ tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
+ tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+
+ // For quantitative scales:
+ // - enter new ticks from the old scale
+ // - exit old ticks to the new scale
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ }
+
+ // For ordinal scales:
+ // - any entering ticks are undefined in the old scale
+ // - any exiting ticks are undefined in the new scale
+ // Therefore, we only need to transition updating ticks.
+ else {
+ var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ return axis;
+ };
+
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+
+ axis.tickSize = function(x, y, z) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+
+ return axis;
+};
+
+function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; });
+}
+
+function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; });
+}
+
+function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()),
+ subticks,
+ i = -1,
+ n = ticks.length,
+ d = (ticks[1] - ticks[0]) / ++m,
+ j,
+ v;
+ while (++i < n) {
+ for (j = m; --j > 0;) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+}
+d3.svg.brush = function() {
+ var event = d3.dispatch("brushstart", "brush", "brushend"),
+ x, // x-scale, optional
+ y, // y-scale, optional
+ extent = [[0, 0], [0, 0]]; // [x0, y0], [x1, y1]
+
+ function brush(g) {
+ var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"]
+ : x ? ["e", "w"]
+ : y ? ["n", "s"]
+ : [];
+
+ g.each(function() {
+ var g = d3.select(this).on("mousedown.brush", down),
+ bg = g.selectAll(".background").data([,]),
+ fg = g.selectAll(".extent").data([,]),
+ tz = g.selectAll(".resize").data(resizes, String),
+ e;
+
+ // An invisible, mouseable area for starting a new brush.
+ bg.enter().append("rect")
+ .attr("class", "background")
+ .style("visibility", "hidden")
+ .style("pointer-events", "all")
+ .style("cursor", "crosshair");
+
+ // The visible brush extent; style this as you like!
+ fg.enter().append("rect")
+ .attr("class", "extent")
+ .style("cursor", "move");
+
+ // More invisible rects for resizing the extent.
+ tz.enter().append("rect")
+ .attr("class", function(d) { return "resize " + d; })
+ .attr("width", 6)
+ .attr("height", 6)
+ .style("visibility", "hidden")
+ .style("pointer-events", brush.empty() ? "none" : "all")
+ .style("cursor", function(d) { return d3_svg_brushCursor[d]; });
+
+ // Remove any superfluous resizers.
+ tz.exit().remove();
+
+ // Initialize the background to fill the defined range.
+ // If the range isn't defined, you can post-process.
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ d3_svg_brushRedrawX(g, extent);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ d3_svg_brushRedrawY(g, extent);
+ }
+ });
+ }
+
+ function down() {
+ var target = d3.select(d3.event.target);
+
+ // Store some global state for the duration of the brush gesture.
+ d3_svg_brush = brush;
+ d3_svg_brushTarget = this;
+ d3_svg_brushExtent = extent;
+ d3_svg_brushOffset = d3.svg.mouse(d3_svg_brushTarget);
+
+ // If the extent was clicked on, drag rather than brush;
+ // store the offset between the mouse and extent origin instead.
+ if (d3_svg_brushDrag = target.classed("extent")) {
+ d3_svg_brushOffset[0] = extent[0][0] - d3_svg_brushOffset[0];
+ d3_svg_brushOffset[1] = extent[0][1] - d3_svg_brushOffset[1];
+ }
+
+ // If a resizer was clicked on, record which side is to be resized.
+ // Also, set the offset to the opposite side.
+ else if (target.classed("resize")) {
+ d3_svg_brushResize = d3.event.target.__data__;
+ d3_svg_brushOffset[0] = extent[+/w$/.test(d3_svg_brushResize)][0];
+ d3_svg_brushOffset[1] = extent[+/^n/.test(d3_svg_brushResize)][1];
+ }
+
+ // If the ALT key is down when starting a brush, the center is at the mouse.
+ else if (d3.event.altKey) {
+ d3_svg_brushCenter = d3_svg_brushOffset.slice();
+ }
+
+ // Restrict which dimensions are resized.
+ d3_svg_brushX = !/^(n|s)$/.test(d3_svg_brushResize) && x;
+ d3_svg_brushY = !/^(e|w)$/.test(d3_svg_brushResize) && y;
+
+ // Notify listeners.
+ d3_svg_brushDispatch = dispatcher(this, arguments);
+ d3_svg_brushDispatch("brushstart");
+ d3_svg_brushMove();
+ d3_eventCancel();
+ }
+
+ function dispatcher(that, argumentz) {
+ return function(type) {
+ var e = d3.event;
+ try {
+ d3.event = {type: type, target: brush};
+ event[type].apply(that, argumentz);
+ } finally {
+ d3.event = e;
+ }
+ };
+ }
+
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return brush;
+ };
+
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return brush;
+ };
+
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+
+ // Invert the pixel extent to data-space.
+ if (!arguments.length) {
+ if (x) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ if (y) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
+ }
+
+ // Scale the data-space extent to pixels.
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0, extent[1][0] = x1;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0, extent[1][1] = y1;
+ }
+
+ return brush;
+ };
+
+ brush.clear = function() {
+ extent[0][0] =
+ extent[0][1] =
+ extent[1][0] =
+ extent[1][1] = 0;
+ return brush;
+ };
+
+ brush.empty = function() {
+ return (x && extent[0][0] === extent[1][0])
+ || (y && extent[0][1] === extent[1][1]);
+ };
+
+ d3.select(window)
+ .on("mousemove.brush", d3_svg_brushMove)
+ .on("mouseup.brush", d3_svg_brushUp)
+ .on("keydown.brush", d3_svg_brushKeydown)
+ .on("keyup.brush", d3_svg_brushKeyup);
+
+ return d3.rebind(brush, event, "on");
+};
+
+var d3_svg_brush,
+ d3_svg_brushDispatch,
+ d3_svg_brushTarget,
+ d3_svg_brushX,
+ d3_svg_brushY,
+ d3_svg_brushExtent,
+ d3_svg_brushDrag,
+ d3_svg_brushResize,
+ d3_svg_brushCenter,
+ d3_svg_brushOffset;
+
+function d3_svg_brushRedrawX(g, extent) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".n,.s,.w,.nw,.sw").attr("x", extent[0][0] - 2);
+ g.selectAll(".e,.ne,.se").attr("x", extent[1][0] - 3);
+ g.selectAll(".extent,.n,.s").attr("width", extent[1][0] - extent[0][0]);
+}
+
+function d3_svg_brushRedrawY(g, extent) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".n,.e,.w,.nw,.ne").attr("y", extent[0][1] - 3);
+ g.selectAll(".s,.se,.sw").attr("y", extent[1][1] - 4);
+ g.selectAll(".extent,.e,.w").attr("height", extent[1][1] - extent[0][1]);
+}
+
+function d3_svg_brushKeydown() {
+ if (d3.event.keyCode == 32 && d3_svg_brushTarget && !d3_svg_brushDrag) {
+ d3_svg_brushCenter = null;
+ d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0];
+ d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1];
+ d3_svg_brushDrag = 2;
+ d3_eventCancel();
+ }
+}
+
+function d3_svg_brushKeyup() {
+ if (d3.event.keyCode == 32 && d3_svg_brushDrag == 2) {
+ d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0];
+ d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1];
+ d3_svg_brushDrag = 0;
+ d3_eventCancel();
+ }
+}
+
+function d3_svg_brushMove() {
+ if (d3_svg_brushOffset) {
+ var mouse = d3.svg.mouse(d3_svg_brushTarget),
+ g = d3.select(d3_svg_brushTarget);
+
+ if (!d3_svg_brushDrag) {
+
+ // If needed, determine the center from the current extent.
+ if (d3.event.altKey) {
+ if (!d3_svg_brushCenter) {
+ d3_svg_brushCenter = [
+ (d3_svg_brushExtent[0][0] + d3_svg_brushExtent[1][0]) / 2,
+ (d3_svg_brushExtent[0][1] + d3_svg_brushExtent[1][1]) / 2
+ ];
+ }
+
+ // Update the offset, for when the ALT key is released.
+ d3_svg_brushOffset[0] = d3_svg_brushExtent[+(mouse[0] < d3_svg_brushCenter[0])][0];
+ d3_svg_brushOffset[1] = d3_svg_brushExtent[+(mouse[1] < d3_svg_brushCenter[1])][1];
+ }
+
+ // When the ALT key is released, we clear the center.
+ else d3_svg_brushCenter = null;
+ }
+
+ // Update the brush extent for each dimension.
+ if (d3_svg_brushX) {
+ d3_svg_brushMove1(mouse, d3_svg_brushX, 0);
+ d3_svg_brushRedrawX(g, d3_svg_brushExtent);
+ }
+ if (d3_svg_brushY) {
+ d3_svg_brushMove1(mouse, d3_svg_brushY, 1);
+ d3_svg_brushRedrawY(g, d3_svg_brushExtent);
+ }
+
+ // Notify listeners.
+ d3_svg_brushDispatch("brush");
+ }
+}
+
+function d3_svg_brushMove1(mouse, scale, i) {
+ var range = d3_scaleRange(scale),
+ r0 = range[0],
+ r1 = range[1],
+ offset = d3_svg_brushOffset[i],
+ size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i],
+ min,
+ max;
+
+ // When dragging, reduce the range by the extent size and offset.
+ if (d3_svg_brushDrag) {
+ r0 -= offset;
+ r1 -= size + offset;
+ }
+
+ // Clamp the mouse so that the extent fits within the range extent.
+ min = Math.max(r0, Math.min(r1, mouse[i]));
+
+ // Compute the new extent bounds.
+ if (d3_svg_brushDrag) {
+ max = (min += offset) + size;
+ } else {
+
+ // If the ALT key is pressed, then preserve the center of the extent.
+ if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min));
+
+ // Compute the min and max of the offset and mouse.
+ if (offset < min) {
+ max = min;
+ min = offset;
+ } else {
+ max = offset;
+ }
+ }
+
+ // Update the stored bounds.
+ d3_svg_brushExtent[0][i] = min;
+ d3_svg_brushExtent[1][i] = max;
+}
+
+function d3_svg_brushUp() {
+ if (d3_svg_brushOffset) {
+ d3_svg_brushMove();
+ d3.select(d3_svg_brushTarget).selectAll(".resize").style("pointer-events", d3_svg_brush.empty() ? "none" : "all");
+ d3_svg_brushDispatch("brushend");
+ d3_svg_brush =
+ d3_svg_brushDispatch =
+ d3_svg_brushTarget =
+ d3_svg_brushX =
+ d3_svg_brushY =
+ d3_svg_brushExtent =
+ d3_svg_brushDrag =
+ d3_svg_brushResize =
+ d3_svg_brushCenter =
+ d3_svg_brushOffset = null;
+ d3_eventCancel();
+ }
+}
+
+var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+};
+d3.behavior = {};
+// TODO Track touch points by identifier.
+
+d3.behavior.drag = function() {
+ var event = d3.dispatch("drag", "dragstart", "dragend"),
+ origin = null;
+
+ function drag() {
+ this
+ .on("mousedown.drag", mousedown)
+ .on("touchstart.drag", mousedown);
+
+ d3.select(window)
+ .on("mousemove.drag", d3_behavior_dragMove)
+ .on("touchmove.drag", d3_behavior_dragMove)
+ .on("mouseup.drag", d3_behavior_dragUp, true)
+ .on("touchend.drag", d3_behavior_dragUp, true)
+ .on("click.drag", d3_behavior_dragClick, true);
+ }
+
+ // snapshot the local context for subsequent dispatch
+ function start() {
+ d3_behavior_dragEvent = event;
+ d3_behavior_dragEventTarget = d3.event.target;
+ d3_behavior_dragTarget = this;
+ d3_behavior_dragArguments = arguments;
+ d3_behavior_dragOrigin = d3_behavior_dragPoint();
+ if (origin) {
+ d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments);
+ d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]];
+ } else {
+ d3_behavior_dragOffset = [0, 0];
+ }
+ d3_behavior_dragMoved = 0;
+ }
+
+ function mousedown() {
+ start.apply(this, arguments);
+ d3_behavior_dragDispatch("dragstart");
+ }
+
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+
+ return d3.rebind(drag, event, "on");
+};
+
+var d3_behavior_dragEvent,
+ d3_behavior_dragEventTarget,
+ d3_behavior_dragTarget,
+ d3_behavior_dragArguments,
+ d3_behavior_dragOffset,
+ d3_behavior_dragOrigin,
+ d3_behavior_dragMoved;
+
+function d3_behavior_dragDispatch(type) {
+ var p = d3_behavior_dragPoint(),
+ o = d3.event,
+ e = d3.event = {type: type};
+
+ if (p) {
+ e.x = p[0] + d3_behavior_dragOffset[0];
+ e.y = p[1] + d3_behavior_dragOffset[1];
+ e.dx = p[0] - d3_behavior_dragOrigin[0];
+ e.dy = p[1] - d3_behavior_dragOrigin[1];
+ d3_behavior_dragMoved |= e.dx | e.dy;
+ d3_behavior_dragOrigin = p;
+ }
+
+ try {
+ d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments);
+ } finally {
+ d3.event = o;
+ }
+
+ o.stopPropagation();
+ o.preventDefault();
+}
+
+function d3_behavior_dragPoint() {
+ var p = d3_behavior_dragTarget.parentNode,
+ t = d3.event.changedTouches;
+ return p && (t
+ ? d3.svg.touches(p, t)[0]
+ : d3.svg.mouse(p));
+}
+
+function d3_behavior_dragMove() {
+ if (!d3_behavior_dragTarget) return;
+ var parent = d3_behavior_dragTarget.parentNode;
+
+ // O NOES! The drag element was removed from the DOM.
+ if (!parent) return d3_behavior_dragUp();
+
+ d3_behavior_dragDispatch("drag");
+ d3_eventCancel();
+}
+
+function d3_behavior_dragUp() {
+ if (!d3_behavior_dragTarget) return;
+ d3_behavior_dragDispatch("dragend");
+
+ // If the node was moved, prevent the mouseup from propagating.
+ // Also prevent the subsequent click from propagating (e.g., for anchors).
+ if (d3_behavior_dragMoved) {
+ d3_eventCancel();
+ d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget;
+ }
+
+ d3_behavior_dragEvent =
+ d3_behavior_dragEventTarget =
+ d3_behavior_dragTarget =
+ d3_behavior_dragArguments =
+ d3_behavior_dragOffset =
+ d3_behavior_dragOrigin = null;
+}
+
+function d3_behavior_dragClick() {
+ if (d3_behavior_dragMoved) {
+ d3_eventCancel();
+ d3_behavior_dragMoved = 0;
+ }
+}
+// TODO unbind zoom behavior?
+d3.behavior.zoom = function() {
+ var xyz = [0, 0, 0],
+ event = d3.dispatch("zoom"),
+ extent = d3_behavior_zoomInfiniteExtent;
+
+ function zoom() {
+ this
+ .on("mousedown.zoom", mousedown)
+ .on("mousewheel.zoom", mousewheel)
+ .on("DOMMouseScroll.zoom", mousewheel)
+ .on("dblclick.zoom", dblclick)
+ .on("touchstart.zoom", touchstart);
+
+ d3.select(window)
+ .on("mousemove.zoom", d3_behavior_zoomMousemove)
+ .on("mouseup.zoom", d3_behavior_zoomMouseup)
+ .on("touchmove.zoom", d3_behavior_zoomTouchmove)
+ .on("touchend.zoom", d3_behavior_zoomTouchup)
+ .on("click.zoom", d3_behavior_zoomClick, true);
+ }
+
+ // snapshot the local context for subsequent dispatch
+ function start() {
+ d3_behavior_zoomXyz = xyz;
+ d3_behavior_zoomExtent = extent;
+ d3_behavior_zoomDispatch = event.zoom;
+ d3_behavior_zoomEventTarget = d3.event.target;
+ d3_behavior_zoomTarget = this;
+ d3_behavior_zoomArguments = arguments;
+ }
+
+ function mousedown() {
+ start.apply(this, arguments);
+ d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
+ d3_behavior_zoomMoved = 0;
+ d3.event.preventDefault();
+ window.focus();
+ }
+
+ // store starting mouse location
+ function mousewheel() {
+ start.apply(this, arguments);
+ if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
+ d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming);
+ }
+
+ function dblclick() {
+ start.apply(this, arguments);
+ var mouse = d3.svg.mouse(d3_behavior_zoomTarget);
+ d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse));
+ }
+
+ // doubletap detection
+ function touchstart() {
+ start.apply(this, arguments);
+ var touches = d3_behavior_zoomTouchup(),
+ touch,
+ now = Date.now();
+ if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) {
+ d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]);
+ }
+ d3_behavior_zoomLast = now;
+ }
+
+ zoom.extent = function(x) {
+ if (!arguments.length) return extent;
+ extent = x == null ? d3_behavior_zoomInfiniteExtent : x;
+ return zoom;
+ };
+
+ return d3.rebind(zoom, event, "on");
+};
+
+var d3_behavior_zoomDiv,
+ d3_behavior_zoomPanning,
+ d3_behavior_zoomZooming,
+ d3_behavior_zoomLocations = {}, // identifier -> location
+ d3_behavior_zoomLast = 0,
+ d3_behavior_zoomXyz,
+ d3_behavior_zoomExtent,
+ d3_behavior_zoomDispatch,
+ d3_behavior_zoomEventTarget,
+ d3_behavior_zoomTarget,
+ d3_behavior_zoomArguments,
+ d3_behavior_zoomMoved;
+
+function d3_behavior_zoomLocation(point) {
+ return [
+ point[0] - d3_behavior_zoomXyz[0],
+ point[1] - d3_behavior_zoomXyz[1],
+ d3_behavior_zoomXyz[2]
+ ];
+}
+
+// detect the pixels that would be scrolled by this wheel event
+function d3_behavior_zoomDelta() {
+
+ // mousewheel events are totally broken!
+ // https://bugs.webkit.org/show_bug.cgi?id=40441
+ // not only that, but Chrome and Safari differ in re. to acceleration!
+ if (!d3_behavior_zoomDiv) {
+ d3_behavior_zoomDiv = d3.select("body").append("div")
+ .style("visibility", "hidden")
+ .style("top", 0)
+ .style("height", 0)
+ .style("width", 0)
+ .style("overflow-y", "scroll")
+ .append("div")
+ .style("height", "2000px")
+ .node().parentNode;
+ }
+
+ var e = d3.event, delta;
+ try {
+ d3_behavior_zoomDiv.scrollTop = 1000;
+ d3_behavior_zoomDiv.dispatchEvent(e);
+ delta = 1000 - d3_behavior_zoomDiv.scrollTop;
+ } catch (error) {
+ delta = e.wheelDelta || (-e.detail * 5);
+ }
+
+ return delta * .005;
+}
+
+// Note: Since we don't rotate, it's possible for the touches to become
+// slightly detached from their original positions. Thus, we recompute the
+// touch points on touchend as well as touchstart!
+function d3_behavior_zoomTouchup() {
+ var touches = d3.svg.touches(d3_behavior_zoomTarget),
+ i = -1,
+ n = touches.length,
+ touch;
+ while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch);
+ return touches;
+}
+
+function d3_behavior_zoomTouchmove() {
+ var touches = d3.svg.touches(d3_behavior_zoomTarget);
+ switch (touches.length) {
+
+ // single-touch pan
+ case 1: {
+ var touch = touches[0];
+ d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]);
+ break;
+ }
+
+ // double-touch pan + zoom
+ case 2: {
+ var p0 = touches[0],
+ p1 = touches[1],
+ p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2],
+ l0 = d3_behavior_zoomLocations[p0.identifier],
+ l1 = d3_behavior_zoomLocations[p1.identifier],
+ l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]];
+ d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2);
+ break;
+ }
+ }
+}
+
+function d3_behavior_zoomMousemove() {
+ d3_behavior_zoomZooming = null;
+ if (d3_behavior_zoomPanning) {
+ d3_behavior_zoomMoved = 1;
+ d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning);
+ }
+}
+
+function d3_behavior_zoomMouseup() {
+ if (d3_behavior_zoomPanning) {
+ if (d3_behavior_zoomMoved) {
+ d3_eventCancel();
+ d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target;
+ }
+
+ d3_behavior_zoomXyz =
+ d3_behavior_zoomExtent =
+ d3_behavior_zoomDispatch =
+ d3_behavior_zoomEventTarget =
+ d3_behavior_zoomTarget =
+ d3_behavior_zoomArguments =
+ d3_behavior_zoomPanning = null;
+ }
+}
+
+function d3_behavior_zoomClick() {
+ if (d3_behavior_zoomMoved) {
+ d3_eventCancel();
+ d3_behavior_zoomMoved = 0;
+ }
+}
+
+function d3_behavior_zoomTo(z, x0, x1) {
+ z = d3_behavior_zoomExtentClamp(z, 2);
+ var j = Math.pow(2, d3_behavior_zoomXyz[2]),
+ k = Math.pow(2, z),
+ K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]),
+ x_ = d3_behavior_zoomXyz[0],
+ y_ = d3_behavior_zoomXyz[1],
+ x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k),
+ y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k),
+ o = d3.event; // Events can be reentrant (e.g., focus).
+
+ d3.event = {
+ scale: k,
+ translate: [x, y],
+ transform: function(sx, sy) {
+ if (sx) transform(sx, x_, x);
+ if (sy) transform(sy, y_, y);
+ }
+ };
+
+ function transform(scale, a, b) {
+ scale.domain(scale.range().map(function(v) { return scale.invert(((v - b) * j) / k + a); }));
+ }
+
+ try {
+ d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments);
+ } finally {
+ d3.event = o;
+ }
+
+ o.preventDefault();
+}
+
+var d3_behavior_zoomInfiniteExtent = [
+ [-Infinity, Infinity],
+ [-Infinity, Infinity],
+ [-Infinity, Infinity]
+];
+
+function d3_behavior_zoomExtentClamp(x, i, k) {
+ var range = d3_behavior_zoomExtent[i],
+ r0 = range[0],
+ r1 = range[1];
+ return arguments.length === 3
+ ? Math.max(r1 * (r1 === Infinity ? -Infinity : 1 / k - 1),
+ Math.min(r0 === -Infinity ? Infinity : r0, x / k)) * k
+ : Math.max(r0, Math.min(r1, x));
+}
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.layout.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.layout.js
new file mode 100644
index 0000000..d93fbe5
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.layout.js
@@ -0,0 +1,1881 @@
+(function(){d3.layout = {};
+// Implements hierarchical edge bundling using Holten's algorithm. For each
+// input link, a path is computed that travels through the tree, up the parent
+// hierarchy to the least common ancestor, and then back down to the destination
+// node. Each path is simply an array of nodes.
+d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [],
+ i = -1,
+ n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+};
+
+function d3_layout_bundlePath(link) {
+ var start = link.source,
+ end = link.target,
+ lca = d3_layout_bundleLeastCommonAncestor(start, end),
+ points = [start];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+}
+
+function d3_layout_bundleAncestors(node) {
+ var ancestors = [],
+ parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+}
+
+function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a),
+ bNodes = d3_layout_bundleAncestors(b),
+ aNode = aNodes.pop(),
+ bNode = bNodes.pop(),
+ sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+}
+d3.layout.chord = function() {
+ var chord = {},
+ chords,
+ groups,
+ matrix,
+ n,
+ padding = 0,
+ sortGroups,
+ sortSubgroups,
+ sortChords;
+
+ function relayout() {
+ var subgroups = {},
+ groupSums = [],
+ groupIndex = d3.range(n),
+ subgroupIndex = [],
+ k,
+ x,
+ x0,
+ i,
+ j;
+
+ chords = [];
+ groups = [];
+
+ // Compute the sum.
+ k = 0, i = -1; while (++i < n) {
+ x = 0, j = -1; while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+
+ // Sort groups…
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+
+ // Sort subgroups…
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+
+ // Convert the sum to scaling factor for [0, 2pi].
+ // TODO Allow start and end angle to be specified.
+ // TODO Allow padding to be specified as percentage?
+ k = (2 * Math.PI - padding * n) / k;
+
+ // Compute the start and end angle for each group and subgroup.
+ // Note: Opera has a bug reordering object literal properties!
+ x = 0, i = -1; while (++i < n) {
+ x0 = x, j = -1; while (++j < n) {
+ var di = groupIndex[i],
+ dj = subgroupIndex[di][j],
+ v = matrix[di][dj],
+ a0 = x,
+ a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups.push({
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ });
+ x += padding;
+ }
+
+ // Generate chords for each (non-empty) subgroup-subgroup link.
+ i = -1; while (++i < n) {
+ j = i - 1; while (++j < n) {
+ var source = subgroups[i + "-" + j],
+ target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value
+ ? {source: target, target: source}
+ : {source: source, target: target});
+ }
+ }
+ }
+
+ if (sortChords) resort();
+ }
+
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords(
+ (a.source.value + a.target.value) / 2,
+ (b.source.value + b.target.value) / 2);
+ });
+ }
+
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+
+ return chord;
+};
+// A rudimentary force layout using Gauss-Seidel.
+d3.layout.force = function() {
+ var force = {},
+ event = d3.dispatch("tick"),
+ size = [1, 1],
+ drag,
+ alpha,
+ friction = .9,
+ linkDistance = d3_layout_forceLinkDistance,
+ linkStrength = d3_layout_forceLinkStrength,
+ charge = -30,
+ gravity = .1,
+ theta = .8,
+ interval,
+ nodes = [],
+ links = [],
+ distances,
+ strengths,
+ charges;
+
+ function repulse(node) {
+ return function(quad, x1, y1, x2, y2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x,
+ dy = quad.cy - node.y,
+ dn = 1 / Math.sqrt(dx * dx + dy * dy);
+
+ /* Barnes-Hut criterion. */
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+
+ function tick() {
+ var n = nodes.length,
+ m = links.length,
+ q,
+ i, // current index
+ o, // current object
+ s, // current source
+ t, // current target
+ l, // current distance
+ k, // current force
+ x, // x-distance
+ y; // y-distance
+
+ // gauss-seidel relaxation for links
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = (x * x + y * y)) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+
+ // apply gravity forces
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1; if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+
+ // compute quadtree center of mass and apply charge forces
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1; while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+
+ // position verlet integration
+ i = -1; while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+
+ event.tick({type: "tick", alpha: alpha});
+
+ // simulated annealing, basically
+ return (alpha *= .99) < .005;
+ }
+
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = d3.functor(x);
+ return force;
+ };
+
+ // For backwards-compatibility.
+ force.distance = force.linkDistance;
+
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = d3.functor(x);
+ return force;
+ };
+
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = x;
+ return force;
+ };
+
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = x;
+ return force;
+ };
+
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = x;
+ return force;
+ };
+
+ force.start = function() {
+ var i,
+ j,
+ n = nodes.length,
+ m = links.length,
+ w = size[0],
+ h = size[1],
+ neighbors,
+ o;
+
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+
+ distances = [];
+ strengths = [];
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ distances[i] = linkDistance.call(this, o, i);
+ strengths[i] = linkStrength.call(this, o, i);
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+
+ charges = [];
+ if (typeof charge === "function") {
+ for (i = 0; i < n; ++i) {
+ charges[i] = +charge.call(this, nodes[i], i);
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ charges[i] = charge;
+ }
+ }
+
+ // initialize node position based on first neighbor
+ function position(dimension, size) {
+ var neighbors = neighbor(i),
+ j = -1,
+ m = neighbors.length,
+ x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+
+ // initialize neighbors lazily
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+
+ return force.resume();
+ };
+
+ force.resume = function() {
+ alpha = .1;
+ d3.timer(tick);
+ return force;
+ };
+
+ force.stop = function() {
+ alpha = 0;
+ return force;
+ };
+
+ // use `node.call(force.drag)` to make nodes draggable
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag()
+ .origin(Object)
+ .on("dragstart", dragstart)
+ .on("drag", d3_layout_forceDrag)
+ .on("dragend", d3_layout_forceDragEnd);
+
+ this.on("mouseover.force", d3_layout_forceDragOver)
+ .on("mouseout.force", d3_layout_forceDragOut)
+ .call(drag);
+ };
+
+ function dragstart(d) {
+ d3_layout_forceDragOver(d3_layout_forceDragNode = d);
+ d3_layout_forceDragForce = force;
+ }
+
+ return d3.rebind(force, event, "on");
+};
+
+var d3_layout_forceDragForce,
+ d3_layout_forceDragNode;
+
+function d3_layout_forceDragOver(d) {
+ d.fixed |= 2;
+}
+
+function d3_layout_forceDragOut(d) {
+ if (d !== d3_layout_forceDragNode) d.fixed &= 1;
+}
+
+function d3_layout_forceDragEnd() {
+ d3_layout_forceDrag();
+ d3_layout_forceDragNode.fixed &= 1;
+ d3_layout_forceDragForce = d3_layout_forceDragNode = null;
+}
+
+function d3_layout_forceDrag() {
+ d3_layout_forceDragNode.px = d3.event.x;
+ d3_layout_forceDragNode.py = d3.event.y;
+ d3_layout_forceDragForce.resume(); // restart annealing
+}
+
+function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0,
+ cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes,
+ n = nodes.length,
+ i = -1,
+ c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ // jitter internal nodes that are coincident
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+}
+
+function d3_layout_forceLinkDistance(link) {
+ return 20;
+}
+
+function d3_layout_forceLinkStrength(link) {
+ return 1;
+}
+d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ size = [1, 1]; // width, height
+
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n,
+ c,
+ d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+
+ function depth(node) {
+ var children = node.children,
+ d = 0;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+};
+d3.layout.pie = function() {
+ var value = Number,
+ sort = d3_layout_pieSortByValue,
+ startAngle = 0,
+ endAngle = 2 * Math.PI;
+
+ function pie(data, i) {
+
+ // Compute the numeric values for each data element.
+ var values = data.map(function(d, i) { return +value.call(pie, d, i); });
+
+ // Compute the start angle.
+ var a = +(typeof startAngle === "function"
+ ? startAngle.apply(this, arguments)
+ : startAngle);
+
+ // Compute the angular scale factor: from value to radians.
+ var k = ((typeof endAngle === "function"
+ ? endAngle.apply(this, arguments)
+ : endAngle) - startAngle)
+ / d3.sum(values);
+
+ // Optionally sort the data.
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue
+ ? function(i, j) { return values[j] - values[i]; }
+ : function(i, j) { return sort(data[i], data[j]); });
+
+ // Compute the arcs!
+ // They are stored in the original data's order.
+ var arcs = [];
+ index.forEach(function(i) {
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+
+ /**
+ * Specifies the value function *x*, which returns a nonnegative numeric value
+ * for each datum. The default value function is `Number`. The value function
+ * is passed two arguments: the current datum and the current index.
+ */
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+
+ /**
+ * Specifies a sort comparison operator *x*. The comparator is passed two data
+ * elements from the data array, a and b; it returns a negative value if a is
+ * less than b, a positive value if a is greater than b, and zero if a equals
+ * b.
+ */
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall start angle of the pie chart. Defaults to 0. The
+ * start angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall end angle of the pie chart. Defaults to 2π. The
+ * end angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+
+ return pie;
+};
+
+var d3_layout_pieSortByValue = {};
+// data is two-dimensional array of x,y; we populate y0
+d3.layout.stack = function() {
+ var values = Object,
+ order = d3_layout_stackOrders["default"],
+ offset = d3_layout_stackOffsets["zero"],
+ out = d3_layout_stackOut,
+ x = d3_layout_stackX,
+ y = d3_layout_stackY;
+
+ function stack(data, index) {
+
+ // Convert series to canonical two-dimensional representation.
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+
+ // Convert each series to canonical [[x,y]] representation.
+ var points = series.map(function(d, i) {
+ return d.map(function(v, i) {
+ return [x.call(stack, v, i), y.call(stack, v, i)];
+ });
+ });
+
+ // Compute the order of series, and permute them.
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+
+ // Compute the baseline…
+ var offsets = offset.call(stack, points, index);
+
+ // And propagate it to other series.
+ var n = series.length,
+ m = series[0].length,
+ i,
+ j,
+ o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+
+ return data;
+ }
+
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders[x];
+ return stack;
+ };
+
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets[x];
+ return stack;
+ };
+
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+
+ return stack;
+}
+
+function d3_layout_stackX(d) {
+ return d.x;
+}
+
+function d3_layout_stackY(d) {
+ return d.y;
+}
+
+function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+}
+
+var d3_layout_stackOrders = {
+
+ "inside-out": function(data) {
+ var n = data.length,
+ i,
+ j,
+ max = data.map(d3_layout_stackMaxIndex),
+ sums = data.map(d3_layout_stackReduceSum),
+ index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
+ top = 0,
+ bottom = 0,
+ tops = [],
+ bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+
+ "reverse": function(data) {
+ return d3.range(data.length).reverse();
+ },
+
+ "default": function(data) {
+ return d3.range(data.length);
+ }
+
+};
+
+var d3_layout_stackOffsets = {
+
+ "silhouette": function(data) {
+ var n = data.length,
+ m = data[0].length,
+ sums = [],
+ max = 0,
+ i,
+ j,
+ o,
+ y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+
+ "wiggle": function(data) {
+ var n = data.length,
+ x = data[0],
+ m = x.length,
+ max = 0,
+ i,
+ j,
+ k,
+ s1,
+ s2,
+ s3,
+ dx,
+ o,
+ o0,
+ y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+
+ "expand": function(data) {
+ var n = data.length,
+ m = data[0].length,
+ k = 1 / n,
+ i,
+ j,
+ o,
+ y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o;
+ else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+
+ "zero": function(data) {
+ var j = -1,
+ m = data[0].length,
+ y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+ }
+
+};
+
+function d3_layout_stackMaxIndex(array) {
+ var i = 1,
+ j = 0,
+ v = array[0][1],
+ k,
+ n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+}
+
+function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+}
+
+function d3_layout_stackSum(p, d) {
+ return p + d[1];
+}
+d3.layout.histogram = function() {
+ var frequency = true,
+ valuer = Number,
+ ranger = d3_layout_histogramRange,
+ binner = d3_layout_histogramBinSturges;
+
+ function histogram(data, i) {
+ var bins = [],
+ values = data.map(valuer, this),
+ range = ranger.call(this, values, i),
+ thresholds = binner.call(this, range, values, i),
+ bin,
+ i = -1,
+ n = values.length,
+ m = thresholds.length - 1,
+ k = frequency ? 1 : 1 / n,
+ x;
+
+ // Initialize the bins.
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+
+ // Fill the bins, ignoring values outside the range.
+ i = -1; while(++i < n) {
+ x = values[i];
+ if ((x >= range[0]) && (x <= range[1])) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+
+ return bins;
+ }
+
+ // Specifies how to extract a value from the associated data. The default
+ // value function is `Number`, which is equivalent to the identity function.
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+
+ // Specifies the range of the histogram. Values outside the specified range
+ // will be ignored. The argument `x` may be specified either as a two-element
+ // array representing the minimum and maximum value of the range, or as a
+ // function that returns the range given the array of values and the current
+ // index `i`. The default range is the extent (minimum and maximum) of the
+ // values.
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3.functor(x);
+ return histogram;
+ };
+
+ // Specifies how to bin values in the histogram. The argument `x` may be
+ // specified as a number, in which case the range of values will be split
+ // uniformly into the given number of bins. Or, `x` may be an array of
+ // threshold values, defining the bins; the specified array must contain the
+ // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x`
+ // may be a function which is evaluated, being passed the range, the array of
+ // values, and the current index `i`, returning an array of thresholds. The
+ // default bin function will divide the values into uniform bins using
+ // Sturges' formula.
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number"
+ ? function(range) { return d3_layout_histogramBinFixed(range, x); }
+ : d3.functor(x);
+ return histogram;
+ };
+
+ // Specifies whether the histogram's `y` value is a count (frequency) or a
+ // probability (density). The default value is true.
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+
+ return histogram;
+};
+
+function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+}
+
+function d3_layout_histogramBinFixed(range, n) {
+ var x = -1,
+ b = +range[0],
+ m = (range[1] - b) / n,
+ f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+}
+
+function d3_layout_histogramRange(values) {
+ return [d3.min(values), d3.max(values)];
+}
+d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort,
+ children = d3_layout_hierarchyChildren,
+ value = d3_layout_hierarchyValue;
+
+ // Recursively compute the node depth and value.
+ // Also converts the data representation into a standard hierarchy structure.
+ function recurse(data, depth, nodes) {
+ var childs = children.call(hierarchy, data, depth),
+ node = d3_layout_hierarchyInline ? data : {data: data};
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1,
+ n,
+ c = node.children = [],
+ v = 0,
+ j = depth + 1;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, data, depth) || 0;
+ }
+ return node;
+ }
+
+ // Recursively re-evaluates the node value.
+ function revalue(node, depth) {
+ var children = node.children,
+ v = 0;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n,
+ j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+
+ // Re-evaluates the `value` property for the specified hierarchy.
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+
+ return hierarchy;
+};
+
+// A method assignment helper for hierarchy subclasses.
+function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+
+ // Add an alias for links, for convenience.
+ object.links = d3_layout_hierarchyLinks;
+
+ // If the new API is used, enabling inlining.
+ object.nodes = function(d) {
+ d3_layout_hierarchyInline = true;
+ return (object.nodes = object)(d);
+ };
+
+ return object;
+}
+
+function d3_layout_hierarchyChildren(d) {
+ return d.children;
+}
+
+function d3_layout_hierarchyValue(d) {
+ return d.value;
+}
+
+function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+}
+
+// Returns an array source+target objects for the specified nodes.
+function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {source: parent, target: child};
+ });
+ }));
+}
+
+// For backwards-compatibility, don't enable inlining by default.
+var d3_layout_hierarchyInline = false;
+d3.layout.pack = function() {
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort),
+ size = [1, 1];
+
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i),
+ root = nodes[0];
+
+ // Recursively compute the layout.
+ root.x = 0;
+ root.y = 0;
+ d3_layout_packTree(root);
+
+ // Scale the layout to fit the requested size.
+ var w = size[0],
+ h = size[1],
+ k = 1 / Math.max(2 * root.r / w, 2 * root.r / h);
+ d3_layout_packTransform(root, w / 2, h / 2, k);
+
+ return nodes;
+ }
+
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+};
+
+function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+}
+
+function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+}
+
+function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+}
+
+function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x,
+ dy = b.y - a.y,
+ dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001; // within epsilon
+}
+
+function d3_layout_packCircle(nodes) {
+ var xMin = Infinity,
+ xMax = -Infinity,
+ yMin = Infinity,
+ yMax = -Infinity,
+ n = nodes.length,
+ a, b, c, j, k;
+
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+
+ // Create node links.
+ nodes.forEach(d3_layout_packLink);
+
+ // Create first node.
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+
+ // Create second node.
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+
+ // Create third node and build chain.
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+
+ // Now iterate through the rest.
+ for (var i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+
+ // Search for the closest intersection.
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+
+ // Update node chain.
+ if (isect) {
+ if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j);
+ else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+
+ // Re-center the circles and return the encompassing radius.
+ var cx = (xMin + xMax) / 2,
+ cy = (yMin + yMax) / 2,
+ cr = 0;
+ for (var i = 0; i < n; i++) {
+ var node = nodes[i];
+ node.x -= cx;
+ node.y -= cy;
+ cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y));
+ }
+
+ // Remove node links.
+ nodes.forEach(d3_layout_packUnlink);
+
+ return cr;
+}
+
+function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+}
+
+function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+}
+
+function d3_layout_packTree(node) {
+ var children = node.children;
+ if (children && children.length) {
+ children.forEach(d3_layout_packTree);
+ node.r = d3_layout_packCircle(children);
+ } else {
+ node.r = Math.sqrt(node.value);
+ }
+}
+
+function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = (x += k * node.x);
+ node.y = (y += k * node.y);
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+}
+
+function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r,
+ dx = b.x - a.x,
+ dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r,
+ dc = Math.sqrt(dx * dx + dy * dy),
+ cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))),
+ theta = Math.acos(cos),
+ x = cos * (db /= dc),
+ y = Math.sin(theta) * db;
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+}
+// Implements a hierarchical layout using the cluster (or dendogram) algorithm.
+d3.layout.cluster = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null),
+ separation = d3_layout_treeSeparation,
+ size = [1, 1]; // width, height
+
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i),
+ root = nodes[0],
+ previousNode,
+ x = 0,
+ kx,
+ ky;
+
+ // First walk, computing the initial x & y values.
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+
+ // Compute the left-most, right-most, and depth-most nodes for extents.
+ var left = d3_layout_clusterLeft(root),
+ right = d3_layout_clusterRight(root),
+ x0 = left.x - separation(left, right) / 2,
+ x1 = right.x + separation(right, left) / 2;
+
+ // Second walk, normalizing x & y to the desired size.
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+
+ return nodes;
+ }
+
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+};
+
+function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+}
+
+function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+}
+
+function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+}
+
+function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+}
+// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
+d3.layout.tree = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null),
+ separation = d3_layout_treeSeparation,
+ size = [1, 1]; // width, height
+
+ function tree(d, i) {
+ var nodes = hierarchy.call(this, d, i),
+ root = nodes[0];
+
+ function firstWalk(node, previousSibling) {
+ var children = node.children,
+ layout = node._tree;
+ if (children && (n = children.length)) {
+ var n,
+ firstChild = children[0],
+ previousChild,
+ ancestor = firstChild,
+ child,
+ i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node,
+ vop = node,
+ vim = previousSibling,
+ vom = node.parent.children[0],
+ sip = vip._tree.mod,
+ sop = vop._tree.mod,
+ sim = vim._tree.mod,
+ som = vom._tree.mod,
+ shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+
+ // Initialize temporary layout variables.
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+
+ // Compute the layout using Buchheim et al.'s algorithm.
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+
+ // Compute the left-most, right-most, and depth-most nodes for extents.
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost),
+ right = d3_layout_treeSearch(root, d3_layout_treeRightmost),
+ deep = d3_layout_treeSearch(root, d3_layout_treeDeepest),
+ x0 = left.x - separation(left, right) / 2,
+ x1 = right.x + separation(right, left) / 2,
+ y1 = deep.depth || 1;
+
+ // Clear temporary layout variables; transform x and y.
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+
+ return nodes;
+ }
+
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+};
+
+function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+}
+
+// function d3_layout_treeSeparationRadial(a, b) {
+// return (a.parent == b.parent ? 1 : 2) / a.depth;
+// }
+
+function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+}
+
+function d3_layout_treeRight(node) {
+ var children = node.children,
+ n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+}
+
+function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child,
+ n,
+ i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+}
+
+function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+}
+
+function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+}
+
+function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+}
+
+function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child,
+ previousChild = null,
+ i = -1,
+ n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+}
+
+function d3_layout_treeShift(node) {
+ var shift = 0,
+ change = 0,
+ children = node.children,
+ i = children.length,
+ child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+}
+
+function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+}
+
+function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent
+ ? vim._tree.ancestor
+ : ancestor;
+}
+// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
+// Modified to support a target aspect ratio by Jeff Heer
+d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ round = Math.round,
+ size = [1, 1], // width, height
+ padding = null,
+ pad = d3_layout_treemapPadNull,
+ sticky = false,
+ stickies,
+ ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio
+
+ // Compute the area for each child based on value & scale.
+ function scale(children, k) {
+ var i = -1,
+ n = children.length,
+ child,
+ area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+
+ // Recursively arranges the specified node's children into squarified rows.
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node),
+ row = [],
+ remaining = children.slice(), // copy-on-write
+ child,
+ best = Infinity, // the best row score so far
+ score, // the current row score
+ u = Math.min(rect.dx, rect.dy), // initial orientation
+ n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) { // continue with this orientation
+ remaining.pop();
+ best = score;
+ } else { // abort, and try a different orientation
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+
+ // Recursively resizes the specified node's children into existing rows.
+ // Preserves the existing layout!
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node),
+ remaining = children.slice(), // copy-on-write
+ child,
+ row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+
+ // Computes the score for the specified row, as the worst aspect ratio.
+ function worst(row, u) {
+ var s = row.area,
+ r,
+ rmax = 0,
+ rmin = Infinity,
+ i = -1,
+ n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s
+ ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio))
+ : Infinity;
+ }
+
+ // Positions the specified row of nodes. Modifies `rect`.
+ function position(row, u, rect, flush) {
+ var i = -1,
+ n = row.length,
+ x = rect.x,
+ y = rect.y,
+ v = u ? round(row.area / u) : 0,
+ o;
+ if (u == rect.dx) { // horizontal subdivision
+ if (flush || v > rect.dy) v = v ? rect.dy : 0; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = v ? round(o.area / v) : 0;
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x; // rounding error
+ rect.y += v;
+ rect.dy -= v;
+ } else { // vertical subdivision
+ if (flush || v > rect.dx) v = v ? rect.dx : 0; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = v ? round(o.area / v) : 0;
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y; // rounding error
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d),
+ root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([root], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+
+ treemap.padding = function(x) {
+ if (!arguments.length) return padding;
+
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null
+ ? d3_layout_treemapPadNull(node)
+ : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p);
+ }
+
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull
+ : (type = typeof x) === "function" ? padFunction
+ : type === "number" ? (x = [x, x, x, x], padConstant)
+ : padConstant;
+ return treemap;
+ };
+
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+};
+
+function d3_layout_treemapPadNull(node) {
+ return {x: node.x, y: node.y, dx: node.dx, dy: node.dy};
+}
+
+function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3],
+ y = node.y + padding[0],
+ dx = node.dx - padding[1] - padding[3],
+ dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) { x += dx / 2; dx = 0; }
+ if (dy < 0) { y += dy / 2; dy = 0; }
+ return {x: x, y: y, dx: dx, dy: dy};
+}
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.time.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.time.js
new file mode 100644
index 0000000..4c1cda4
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.time.js
@@ -0,0 +1,687 @@
+(function(){d3.time = {};
+
+var d3_time = Date;
+d3.time.format = function(template) {
+ var n = template.length;
+
+ function format(date) {
+ var string = [],
+ i = -1,
+ j = 0,
+ c,
+ f;
+ while (++i < n) {
+ if (template.charCodeAt(i) == 37) {
+ string.push(
+ template.substring(j, i),
+ (f = d3_time_formats[c = template.charAt(++i)])
+ ? f(date) : c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+
+ format.parse = function(string) {
+ var date = new d3_time(1900, 0, 1),
+ i = d3_time_parse(date, template, string, 0);
+ if (i != string.length) return null;
+ if (date.hour12) {
+ var hours = date.getHours() % 12;
+ date.setHours(date.hour12pm ? hours + 12 : hours);
+ }
+ delete date.hour12;
+ delete date.hour12pm;
+ return date;
+ };
+
+ format.toString = function() {
+ return template;
+ };
+
+ return format;
+};
+
+function d3_time_parse(date, template, string, j) {
+ var c,
+ p,
+ i = 0,
+ n = template.length,
+ m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c == 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || ((j = p(date, string, j)) < 0)) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+}
+
+var d3_time_zfill2 = d3.format("02d"),
+ d3_time_zfill3 = d3.format("03d"),
+ d3_time_zfill4 = d3.format("04d"),
+ d3_time_sfill2 = d3.format("2d");
+
+var d3_time_formats = {
+ a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); },
+ A: function(d) { return d3_time_weekdays[d.getDay()]; },
+ b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); },
+ B: function(d) { return d3_time_months[d.getMonth()]; },
+ c: d3.time.format("%a %b %e %H:%M:%S %Y"),
+ d: function(d) { return d3_time_zfill2(d.getDate()); },
+ e: function(d) { return d3_time_sfill2(d.getDate()); },
+ H: function(d) { return d3_time_zfill2(d.getHours()); },
+ I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); },
+ j: d3_time_dayOfYear,
+ L: function(d) { return d3_time_zfill3(d.getMilliseconds()); },
+ m: function(d) { return d3_time_zfill2(d.getMonth() + 1); },
+ M: function(d) { return d3_time_zfill2(d.getMinutes()); },
+ p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; },
+ S: function(d) { return d3_time_zfill2(d.getSeconds()); },
+ U: d3_time_weekNumberSunday,
+ w: function(d) { return d.getDay(); },
+ W: d3_time_weekNumberMonday,
+ x: d3.time.format("%m/%d/%y"),
+ X: d3.time.format("%H:%M:%S"),
+ y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); },
+ Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); },
+ Z: d3_time_zone,
+ "%": function(d) { return "%"; }
+};
+
+var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour12,
+ // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; },
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; },
+ // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; },
+ // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; },
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ // ,
+ // Z: function(d, s, i) { /*TODO time zone */ return i; },
+ // "%": function(d, s, i) { /*TODO literal % */ return i; }
+};
+
+// Note: weekday is validated, but does not set the date.
+function d3_time_parseWeekdayAbbrev(date, string, i) {
+ return string.substring(i, i += 3).toLowerCase() in d3_time_weekdayAbbrevLookup ? i : -1;
+}
+
+var d3_time_weekdayAbbrevLookup = {
+ sun: 3,
+ mon: 3,
+ tue: 3,
+ wed: 3,
+ thu: 3,
+ fri: 3,
+ sat: 3
+};
+
+// Note: weekday is validated, but does not set the date.
+function d3_time_parseWeekday(date, string, i) {
+ d3_time_weekdayRe.lastIndex = 0;
+ var n = d3_time_weekdayRe.exec(string.substring(i, i + 10));
+ return n ? i += n[0].length : -1;
+}
+
+var d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig;
+
+var d3_time_weekdays = [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+];
+
+function d3_time_parseMonthAbbrev(date, string, i) {
+ var n = d3_time_monthAbbrevLookup[string.substring(i, i += 3).toLowerCase()];
+ return n == null ? -1 : (date.setMonth(n), i);
+}
+
+var d3_time_monthAbbrevLookup = {
+ jan: 0,
+ feb: 1,
+ mar: 2,
+ apr: 3,
+ may: 4,
+ jun: 5,
+ jul: 6,
+ aug: 7,
+ sep: 8,
+ oct: 9,
+ nov: 10,
+ dec: 11
+};
+
+function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i, i + 12));
+ return n ? (date.setMonth(d3_time_monthLookup[n[0].toLowerCase()]), i += n[0].length) : -1;
+}
+
+var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;
+
+var d3_time_monthLookup = {
+ january: 0,
+ february: 1,
+ march: 2,
+ april: 3,
+ may: 4,
+ june: 5,
+ july: 6,
+ august: 7,
+ september: 8,
+ october: 9,
+ november: 10,
+ december: 11
+};
+
+var d3_time_months = [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+];
+
+function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+}
+
+function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+}
+
+function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+}
+
+function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.setFullYear(n[0]), i += n[0].length) : -1;
+}
+
+function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.setFullYear(d3_time_century() + +n[0]), i += n[0].length) : -1;
+}
+
+function d3_time_century() {
+ return ~~(new Date().getFullYear() / 1000) * 1000;
+}
+
+function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.setMonth(n[0] - 1), i += n[0].length) : -1;
+}
+
+function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.setDate(+n[0]), i += n[0].length) : -1;
+}
+
+// Note: we don't validate that the hour is in the range [0,23].
+function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.setHours(+n[0]), i += n[0].length) : -1;
+}
+
+// Note: we don't validate that the hour is in the range [1,12].
+function d3_time_parseHour12(date, string, i) {
+ date.hour12 = true;
+ return d3_time_parseHour24(date, string, i);
+}
+
+function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.setMinutes(+n[0]), i += n[0].length) : -1;
+}
+
+function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.setSeconds(+n[0]), i += n[0].length) : -1;
+}
+
+function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.setMilliseconds(+n[0]), i += n[0].length) : -1;
+}
+
+// Note: we don't look at the next directive.
+var d3_time_numberRe = /\s*\d+/;
+
+function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup[string.substring(i, i += 2).toLowerCase()];
+ return n == null ? -1 : (date.hour12pm = n, i);
+}
+
+var d3_time_amPmLookup = {
+ am: 0,
+ pm: 1
+};
+
+function d3_time_year(d) {
+ return new d3_time(d.getFullYear(), 0, 1);
+}
+
+function d3_time_daysElapsed(d0, d1) {
+ return ~~((d1 - d0) / 864e5 - (d1.getTimezoneOffset() - d0.getTimezoneOffset()) / 1440);
+}
+
+function d3_time_dayOfYear(d) {
+ return d3_time_zfill3(1 + d3_time_daysElapsed(d3_time_year(d), d));
+}
+
+function d3_time_weekNumberSunday(d) {
+ var d0 = d3_time_year(d);
+ return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + d0.getDay()) / 7));
+}
+
+function d3_time_weekNumberMonday(d) {
+ var d0 = d3_time_year(d);
+ return d3_time_zfill2(~~((d3_time_daysElapsed(d0, d) + (d0.getDay() + 6) % 7) / 7));
+}
+
+// TODO table of time zone offset names?
+function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(),
+ zs = z > 0 ? "-" : "+",
+ zh = ~~(Math.abs(z) / 60),
+ zm = Math.abs(z) % 60;
+ return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
+}
+d3.time.format.utc = function(template) {
+ var local = d3.time.format(template);
+
+ function format(date) {
+ try {
+ d3_time = d3_time_format_utc;
+ var utc = new d3_time();
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_format_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+
+ format.toString = local.toString;
+
+ return format;
+};
+
+function d3_time_format_utc() {
+ this._ = new Date(Date.UTC.apply(this, arguments));
+}
+
+d3_time_format_utc.prototype = {
+ getDate: function() { return this._.getUTCDate(); },
+ getDay: function() { return this._.getUTCDay(); },
+ getFullYear: function() { return this._.getUTCFullYear(); },
+ getHours: function() { return this._.getUTCHours(); },
+ getMilliseconds: function() { return this._.getUTCMilliseconds(); },
+ getMinutes: function() { return this._.getUTCMinutes(); },
+ getMonth: function() { return this._.getUTCMonth(); },
+ getSeconds: function() { return this._.getUTCSeconds(); },
+ getTimezoneOffset: function() { return 0; },
+ valueOf: function() { return this._.getTime(); },
+ setDate: function(x) { this._.setUTCDate(x); },
+ setDay: function(x) { this._.setUTCDay(x); },
+ setFullYear: function(x) { this._.setUTCFullYear(x); },
+ setHours: function(x) { this._.setUTCHours(x); },
+ setMilliseconds: function(x) { this._.setUTCMilliseconds(x); },
+ setMinutes: function(x) { this._.setUTCMinutes(x); },
+ setMonth: function(x) { this._.setUTCMonth(x); },
+ setSeconds: function(x) { this._.setUTCSeconds(x); }
+};
+var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+
+d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
+
+function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+}
+
+d3_time_formatIsoNative.parse = function(string) {
+ return new Date(string);
+};
+
+d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+function d3_time_range(floor, step, number) {
+ return function(t0, t1, dt) {
+ var time = floor(t0), times = [];
+ if (time < t0) step(time);
+ if (dt > 1) {
+ while (time < t1) {
+ var date = new Date(+time);
+ if (!(number(date) % dt)) times.push(date);
+ step(time);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time);
+ }
+ return times;
+ };
+}
+d3.time.second = function(date) {
+ return new Date(~~(date / 1e3) * 1e3);
+};
+
+d3.time.second.utc = d3.time.second;
+d3.time.seconds = d3_time_range(d3.time.second, function(date) {
+ date.setTime(date.getTime() + 1e3);
+}, function(date) {
+ return date.getSeconds();
+});
+
+d3.time.seconds.utc = d3.time.seconds;
+d3.time.minute = function(date) {
+ return new Date(~~(date / 6e4) * 6e4);
+};
+
+d3.time.minute.utc = d3.time.minute;d3.time.minutes = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) {
+ return date.getMinutes();
+});
+
+d3.time.minutes.utc = d3_time_range(d3.time.minute, d3_time_minutesStep, function(date) {
+ return date.getUTCMinutes();
+});
+
+function d3_time_minutesStep(date) {
+ date.setTime(date.getTime() + 6e4); // assumes no leap seconds
+}
+d3.time.hour = function(date) {
+ var offset = date.getTimezoneOffset() / 60;
+ return new Date((~~(date / 36e5 - offset) + offset) * 36e5);
+};
+
+d3.time.hour.utc = function(date) {
+ return new Date(~~(date / 36e5) * 36e5);
+};
+d3.time.hours = d3_time_range(d3.time.hour, d3_time_hoursStep, function(date) {
+ return date.getHours();
+});
+
+d3.time.hours.utc = d3_time_range(d3.time.hour.utc, d3_time_hoursStep, function(date) {
+ return date.getUTCHours();
+});
+
+function d3_time_hoursStep(date) {
+ date.setTime(date.getTime() + 36e5);
+}
+d3.time.day = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
+};
+
+d3.time.day.utc = function(date) {
+ return new Date(~~(date / 864e5) * 864e5);
+};
+d3.time.days = d3_time_range(d3.time.day, function(date) {
+ date.setDate(date.getDate() + 1);
+}, function(date) {
+ return date.getDate() - 1;
+});
+
+d3.time.days.utc = d3_time_range(d3.time.day.utc, function(date) {
+ date.setUTCDate(date.getUTCDate() + 1);
+}, function(date) {
+ return date.getUTCDate() - 1;
+});
+d3.time.week = function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - date.getDay());
+ return date;
+};
+
+d3.time.week.utc = function(date) {
+ (date = d3.time.day.utc(date)).setUTCDate(date.getUTCDate() - date.getUTCDay());
+ return date;
+};
+d3.time.weeks = d3_time_range(d3.time.week, function(date) {
+ date.setDate(date.getDate() + 7);
+}, function(date) {
+ return ~~((date - new Date(date.getFullYear(), 0, 1)) / 6048e5);
+});
+
+d3.time.weeks.utc = d3_time_range(d3.time.week.utc, function(date) {
+ date.setUTCDate(date.getUTCDate() + 7);
+}, function(date) {
+ return ~~((date - Date.UTC(date.getUTCFullYear(), 0, 1)) / 6048e5);
+});
+d3.time.month = function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 1);
+};
+
+d3.time.month.utc = function(date) {
+ return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
+};
+d3.time.months = d3_time_range(d3.time.month, function(date) {
+ date.setMonth(date.getMonth() + 1);
+}, function(date) {
+ return date.getMonth();
+});
+
+d3.time.months.utc = d3_time_range(d3.time.month.utc, function(date) {
+ date.setUTCMonth(date.getUTCMonth() + 1);
+}, function(date) {
+ return date.getUTCMonth();
+});
+d3.time.year = function(date) {
+ return new Date(date.getFullYear(), 0, 1);
+};
+
+d3.time.year.utc = function(date) {
+ return new Date(Date.UTC(date.getUTCFullYear(), 0, 1));
+};
+d3.time.years = d3_time_range(d3.time.year, function(date) {
+ date.setFullYear(date.getFullYear() + 1);
+}, function(date) {
+ return date.getFullYear();
+});
+
+d3.time.years.utc = d3_time_range(d3.time.year.utc, function(date) {
+ date.setUTCFullYear(date.getUTCFullYear() + 1);
+}, function(date) {
+ return date.getUTCFullYear();
+});
+// TODO nice
+function d3_time_scale(linear, methods, format) {
+
+ function scale(x) {
+ return linear(x);
+ }
+
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0],
+ target = span / m,
+ i = d3.bisect(d3_time_scaleSteps, target, 1, d3_time_scaleSteps.length - 1);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0];
+ }
+ return m(extent[0], extent[1], k);
+ };
+
+ scale.tickFormat = function() {
+ return format;
+ };
+
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+
+ // TOOD expose d3_scale_linear_rebind?
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+}
+
+// TODO expose d3_scaleExtent?
+function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [start, stop] : [stop, start];
+}
+
+function d3_time_scaleDate(t) {
+ return new Date(t);
+}
+
+function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+}
+
+var d3_time_scaleSteps = [
+ 1e3, // 1-second
+ 5e3, // 5-second
+ 15e3, // 15-second
+ 3e4, // 30-second
+ 6e4, // 1-minute
+ 3e5, // 5-minute
+ 9e5, // 15-minute
+ 18e5, // 30-minute
+ 36e5, // 1-hour
+ 108e5, // 3-hour
+ 216e5, // 6-hour
+ 432e5, // 12-hour
+ 864e5, // 1-day
+ 1728e5, // 2-day
+ 6048e5, // 1-week
+ 1728e6, // 1-month
+ 7776e6, // 3-month
+ 31536e6 // 1-year
+];
+
+var d3_time_scaleLocalMethods = [
+ [d3.time.seconds, 1],
+ [d3.time.seconds, 5],
+ [d3.time.seconds, 15],
+ [d3.time.seconds, 30],
+ [d3.time.minutes, 1],
+ [d3.time.minutes, 5],
+ [d3.time.minutes, 15],
+ [d3.time.minutes, 30],
+ [d3.time.hours, 1],
+ [d3.time.hours, 3],
+ [d3.time.hours, 6],
+ [d3.time.hours, 12],
+ [d3.time.days, 1],
+ [d3.time.days, 2],
+ [d3.time.weeks, 1],
+ [d3.time.months, 1],
+ [d3.time.months, 3],
+ [d3.time.years, 1]
+];
+
+var d3_time_scaleLocalFormats = [
+ [d3.time.format("%Y"), function(d) { return true; }],
+ [d3.time.format("%B"), function(d) { return d.getMonth(); }],
+ [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }],
+ [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }],
+ [d3.time.format("%I %p"), function(d) { return d.getHours(); }],
+ [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }],
+ [d3.time.format(":%S"), function(d) { return d.getSeconds() || d.getMilliseconds(); }]
+];
+
+var d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+
+d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+};
+var d3_time_scaleUTCMethods = [
+ [d3.time.seconds.utc, 1],
+ [d3.time.seconds.utc, 5],
+ [d3.time.seconds.utc, 15],
+ [d3.time.seconds.utc, 30],
+ [d3.time.minutes.utc, 1],
+ [d3.time.minutes.utc, 5],
+ [d3.time.minutes.utc, 15],
+ [d3.time.minutes.utc, 30],
+ [d3.time.hours.utc, 1],
+ [d3.time.hours.utc, 3],
+ [d3.time.hours.utc, 6],
+ [d3.time.hours.utc, 12],
+ [d3.time.days.utc, 1],
+ [d3.time.days.utc, 2],
+ [d3.time.weeks.utc, 1],
+ [d3.time.months.utc, 1],
+ [d3.time.months.utc, 3],
+ [d3.time.years.utc, 1]
+];
+
+var d3_time_scaleUTCFormats = [
+ [d3.time.format.utc("%Y"), function(d) { return true; }],
+ [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }],
+ [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }],
+ [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }],
+ [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }],
+ [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }],
+ [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds() || d.getUTCMilliseconds(); }]
+];
+
+var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+
+d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+};
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/d3.v2.js b/projects/Data Visualization Software Java Project/Data Visualization/d3.v2.js
new file mode 100644
index 0000000..c12d412
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/d3.v2.js
@@ -0,0 +1,9387 @@
+(function(){if (!Date.now) Date.now = function() {
+ return +new Date;
+};
+try {
+ document.createElement("div").style.setProperty("opacity", 0, "");
+} catch (error) {
+ var d3_style_prototype = CSSStyleDeclaration.prototype,
+ d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+}
+d3 = {version: "2.9.4"}; // semver
+function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+}
+var d3_array = d3_arraySlice; // conversion for NodeLists
+
+function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+}
+
+function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+}
+
+try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+} catch(e) {
+ d3_array = d3_arrayCopy;
+}
+
+var d3_arraySubclass = [].__proto__?
+
+// Until ECMAScript supports array subclassing, prototype injection works well.
+function(array, prototype) {
+ array.__proto__ = prototype;
+}:
+
+// And if your browser doesn't support __proto__, we'll use direct extension.
+function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+};
+d3.map = function(object) {
+ var map = new d3_Map;
+ for (var key in object) map.set(key, object[key]);
+ return map;
+};
+
+function d3_Map() {}
+
+d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) { keys.push(key); });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) { values.push(value); });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) { entries.push({key: key, value: value}); });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+});
+
+var d3_map_prefix = "\0", // prevent collision with built-ins
+ d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+function d3_identity(d) {
+ return d;
+}
+function d3_this() {
+ return this;
+}
+function d3_true() {
+ return true;
+}
+function d3_functor(v) {
+ return typeof v === "function" ? v : function() { return v; };
+}
+
+d3.functor = d3_functor;
+// Copies a variable number of methods from source to target.
+d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+};
+
+// Method is assumed to be a standard D3 getter-setter:
+// If passed with no arguments, gets the value.
+// If passed with arguments, sets the value and returns the target.
+function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
+ };
+}
+d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+};
+d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+};
+d3.mean = function(array, f) {
+ var n = array.length,
+ a,
+ m = 0,
+ i = -1,
+ j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+};
+d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+};
+d3.min = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+};
+d3.max = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+};
+d3.extent = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b,
+ c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [a, c];
+};
+d3.random = {
+ normal: function(mean, deviation) {
+ if (arguments.length < 2) deviation = 1;
+ if (arguments.length < 1) mean = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ }
+};
+function d3_number(x) {
+ return x != null && !isNaN(x);
+}
+d3.sum = function(array, f) {
+ var s = 0,
+ n = array.length,
+ a,
+ i = -1;
+
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+
+ return s;
+};
+// R-7 per
+d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1,
+ h = Math.floor(H),
+ v = values[h - 1],
+ e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+};
+d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+};
+d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+};
+
+function d3_zipLength(d) {
+ return d.length;
+}
+d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1;
+ else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid;
+ else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+};
+
+var d3_bisector = d3.bisector(function(d) { return d; });
+d3.bisectLeft = d3_bisector.left;
+d3.bisect = d3.bisectRight = d3_bisector.right;
+d3.first = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) > 0) {
+ a = b;
+ }
+ }
+ return a;
+};
+d3.last = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) <= 0) {
+ a = b;
+ }
+ }
+ return a;
+};
+d3.nest = function() {
+ var nest = {},
+ keys = [],
+ sortKeys = [],
+ sortValues,
+ rollup;
+
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup
+ ? rollup.call(nest, array) : (sortValues
+ ? array.sort(sortValues)
+ : array);
+
+ var i = -1,
+ n = array.length,
+ key = keys[depth++],
+ keyValue,
+ object,
+ valuesByKey = new d3_Map,
+ values,
+ o = {};
+
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
+ values.push(object);
+ } else {
+ valuesByKey.set(keyValue, [object]);
+ }
+ }
+
+ valuesByKey.forEach(function(keyValue) {
+ o[keyValue] = map(valuesByKey.get(keyValue), depth);
+ });
+
+ return o;
+ }
+
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+
+ var a = [],
+ sortKey = sortKeys[depth++],
+ key;
+
+ for (key in map) {
+ a.push({key: key, values: entries(map[key], depth)});
+ }
+
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+
+ return a;
+ }
+
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+
+ // Specifies the order for the most-recently specified key.
+ // Note: only applies to entries. Map keys are unordered!
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+
+ // Specifies the order for leaf values.
+ // Applies to both maps and entries array.
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+
+ return nest;
+};
+d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+};
+d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+};
+d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({key: key, value: map[key]});
+ return entries;
+};
+d3.permute = function(array, indexes) {
+ var permutes = [],
+ i = -1,
+ n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+};
+d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+};
+d3.split = function(array, f) {
+ var arrays = [],
+ values = [],
+ value,
+ i = -1,
+ n = array.length;
+ if (arguments.length < 2) f = d3_splitter;
+ while (++i < n) {
+ if (f.call(values, value = array[i], i)) {
+ values = [];
+ } else {
+ if (!values.length) arrays.push(values);
+ values.push(value);
+ }
+ }
+ return arrays;
+};
+
+function d3_splitter(d) {
+ return d == null;
+}
+function d3_collapse(s) {
+ return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
+}
+d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step === Infinity) throw new Error("infinite range");
+ var range = [],
+ k = d3_range_integerScale(Math.abs(step)),
+ i = -1,
+ j;
+ start *= k, stop *= k, step *= k;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
+ else while ((j = start + step * ++i) < stop) range.push(j / k);
+ return range;
+};
+
+function d3_range_integerScale(x) {
+ var k = 1;
+ while (x * k % 1) k *= 10;
+ return k;
+}
+d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+};
+
+var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+d3.round = function(x, n) {
+ return n
+ ? Math.round(x * (n = Math.pow(10, n))) / n
+ : Math.round(x);
+};
+d3.xhr = function(url, mime, callback) {
+ var req = new XMLHttpRequest;
+ if (arguments.length < 3) callback = mime, mime = null;
+ else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
+ req.open("GET", url, true);
+ if (mime) req.setRequestHeader("Accept", mime);
+ req.onreadystatechange = function() {
+ if (req.readyState === 4) {
+ var s = req.status;
+ callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);
+ }
+ };
+ req.send(null);
+};
+d3.text = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseText);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+};
+d3.json = function(url, callback) {
+ d3.text(url, "application/json", function(text) {
+ callback(text ? JSON.parse(text) : null);
+ });
+};
+d3.html = function(url, callback) {
+ d3.text(url, "text/html", function(text) {
+ if (text != null) { // Treat empty string as valid HTML.
+ var range = document.createRange();
+ range.selectNode(document.body);
+ text = range.createContextualFragment(text);
+ }
+ callback(text);
+ });
+};
+d3.xml = function(url, mime, callback) {
+ function ready(req) {
+ callback(req && req.responseXML);
+ }
+ if (arguments.length < 3) {
+ callback = mime;
+ mime = null;
+ }
+ d3.xhr(url, mime, ready);
+};
+var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+};
+
+d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":"),
+ prefix = name;
+ if (i >= 0) {
+ prefix = name.substring(0, i);
+ name = name.substring(i + 1);
+ }
+ return d3_nsPrefix.hasOwnProperty(prefix)
+ ? {space: d3_nsPrefix[prefix], local: name}
+ : name;
+ }
+};
+d3.dispatch = function() {
+ var dispatch = new d3_dispatch,
+ i = -1,
+ n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ return dispatch;
+};
+
+function d3_dispatch() {}
+
+d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."),
+ name = "";
+
+ // Extract optional namespace, e.g., "click.foo"
+ if (i > 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+
+ return arguments.length < 2
+ ? this[type].on(name)
+ : this[type].on(name, listener);
+};
+
+function d3_dispatch_event(dispatch) {
+ var listeners = [],
+ listenerByName = new d3_Map;
+
+ function event() {
+ var z = listeners, // defensive reference
+ i = -1,
+ n = z.length,
+ l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ return dispatch;
+ }
+
+ event.on = function(name, listener) {
+ var l = listenerByName.get(name),
+ i;
+
+ // return the current listener, if any
+ if (arguments.length < 2) return l && l.on;
+
+ // remove the old listener, if any (with copy-on-write)
+ if (l) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ listenerByName.remove(name);
+ }
+
+ // add the new listener, if any
+ if (listener) listeners.push(listenerByName.set(name, {on: listener}));
+
+ return dispatch;
+ };
+
+ return event;
+}
+// TODO align
+d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier),
+ fill = match[1] || " ",
+ sign = match[3] || "",
+ zfill = match[5],
+ width = +match[6],
+ comma = match[7],
+ precision = match[8],
+ type = match[9],
+ scale = 1,
+ suffix = "",
+ integer = false;
+
+ if (precision) precision = +precision.substring(1);
+
+ if (zfill) {
+ fill = "0"; // TODO align = "=";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+
+ switch (type) {
+ case "n": comma = true; type = "g"; break;
+ case "%": scale = 100; suffix = "%"; type = "f"; break;
+ case "p": scale = 100; suffix = "%"; type = "r"; break;
+ case "d": integer = true; precision = 0; break;
+ case "s": scale = -1; type = "r"; break;
+ }
+
+ // If no precision is specified for r, fallback to general notation.
+ if (type == "r" && !precision) type = "g";
+
+ type = d3_format_types.get(type) || d3_format_typeDefault;
+
+ return function(value) {
+
+ // Return the empty string for floats formatted as ints.
+ if (integer && (value % 1)) return "";
+
+ // Convert negative to positive, and record the sign prefix.
+ var negative = (value < 0) && (value = -value) ? "\u2212" : sign;
+
+ // Apply the scale, computing it from the value's exponent for si format.
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value = prefix.scale(value);
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+
+ // Convert to the desired precision.
+ value = type(value, precision);
+
+ // If the fill character is 0, the sign and group is applied after the fill.
+ if (zfill) {
+ var length = value.length + negative.length;
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ }
+
+ // Otherwise (e.g., space-filling), the sign and group is applied before.
+ else {
+ if (comma) value = d3_format_group(value);
+ value = negative + value;
+ var length = value.length;
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
+ }
+
+ return value + suffix;
+ };
+};
+
+// [[fill]align][sign][#][0][width][,][.precision][type]
+var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+
+var d3_format_types = d3.map({
+ g: function(x, p) { return x.toPrecision(p); },
+ e: function(x, p) { return x.toExponential(p); },
+ f: function(x, p) { return x.toFixed(p); },
+ r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); }
+});
+
+function d3_format_precision(x, p) {
+ return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
+}
+
+function d3_format_typeDefault(x) {
+ return x + "";
+}
+
+// Apply comma grouping for thousands.
+function d3_format_group(value) {
+ var i = value.lastIndexOf("."),
+ f = i >= 0 ? value.substring(i) : (i = value.length, ""),
+ t = [];
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
+ return t.reverse().join(",") + f;
+}
+var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
+
+d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+};
+
+function d3_formatPrefix(d, i) {
+ var k = Math.pow(10, Math.abs(8 - i) * 3);
+ return {
+ scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; },
+ symbol: d
+ };
+}
+/*
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of contributors may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var d3_ease_quad = d3_ease_poly(2),
+ d3_ease_cubic = d3_ease_poly(3),
+ d3_ease_default = function() { return d3_ease_identity; };
+
+var d3_ease = d3.map({
+ linear: d3_ease_default,
+ poly: d3_ease_poly,
+ quad: function() { return d3_ease_quad; },
+ cubic: function() { return d3_ease_cubic; },
+ sin: function() { return d3_ease_sin; },
+ exp: function() { return d3_ease_exp; },
+ circle: function() { return d3_ease_circle; },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() { return d3_ease_bounce; }
+});
+
+var d3_ease_mode = d3.map({
+ "in": d3_ease_identity,
+ "out": d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
+});
+
+d3.ease = function(name) {
+ var i = name.indexOf("-"),
+ t = i >= 0 ? name.substring(0, i) : name,
+ m = i >= 0 ? name.substring(i + 1) : "in";
+ t = d3_ease.get(t) || d3_ease_default;
+ m = d3_ease_mode.get(m) || d3_ease_identity;
+ return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
+};
+
+function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+}
+
+function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+}
+
+function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
+ };
+}
+
+function d3_ease_identity(t) {
+ return t;
+}
+
+function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ };
+}
+
+function d3_ease_sin(t) {
+ return 1 - Math.cos(t * Math.PI / 2);
+}
+
+function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+}
+
+function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+}
+
+function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = 0.45;
+ if (arguments.length < 1) { a = 1; s = p / 4; }
+ else s = p / (2 * Math.PI) * Math.asin(1 / a);
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
+ };
+}
+
+function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+}
+
+function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t
+ : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75
+ : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375
+ : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+}
+d3.event = null;
+
+function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+}
+
+function d3_eventSource() {
+ var e = d3.event, s;
+ while (s = e.sourceEvent) e = s;
+ return e;
+}
+
+// Like d3.dispatch, but for custom events abstracting native UI events. These
+// events have a target component (such as a brush), a target element (such as
+// the svg:g element containing the brush) and the standard arguments `d` (the
+// target element's data) and `i` (the selection index of the target element).
+function d3_eventDispatch(target) {
+ var dispatch = new d3_dispatch,
+ i = 0,
+ n = arguments.length;
+
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+
+ // Creates a dispatch context for the specified `thiz` (typically, the target
+ // DOM element that received the source event) and `argumentz` (typically, the
+ // data `d` and index `i` of the target element). The returned function can be
+ // used to dispatch an event to any registered listeners; the function takes a
+ // single argument as input, being the event to dispatch. The event must have
+ // a "type" attribute which corresponds to a type registered in the
+ // constructor. This context will automatically populate the "sourceEvent" and
+ // "target" attributes of the event, as well as setting the `d3.event` global
+ // for the duration of the notification.
+ dispatch.of = function(thiz, argumentz) {
+ return function(e1) {
+ try {
+ var e0 =
+ e1.sourceEvent = d3.event;
+ e1.target = target;
+ d3.event = e1;
+ dispatch[e1.type].apply(thiz, argumentz);
+ } finally {
+ d3.event = e0;
+ }
+ };
+ };
+
+ return dispatch;
+}
+d3.interpolate = function(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b)));
+ return f;
+};
+
+d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) { return a + b * t; };
+};
+
+d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) { return Math.round(a + b * t); };
+};
+
+d3.interpolateString = function(a, b) {
+ var m, // current match
+ i, // current index
+ j, // current index (for coallescing)
+ s0 = 0, // start index of current string prefix
+ s1 = 0, // end index of current string prefix
+ s = [], // string constants and placeholders
+ q = [], // number interpolators
+ n, // q.length
+ o;
+
+ // Reset our regular expression!
+ d3_interpolate_number.lastIndex = 0;
+
+ // Find all numbers in b.
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({i: s.length, x: m[0]});
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+
+ // Find all numbers in a.
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) { // The numbers match, so coallesce.
+ if (o.i) {
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i] = o.x;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+
+ // Remove any numbers in b not found in a.
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) { // This match is followed by another number.
+ s[o.i] = o.x;
+ } else { // This match is followed by a string, so coallesce twice.
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+
+ // Special optimization for only a single match.
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() { return b; };
+ }
+
+ // Otherwise, interpolate each of the numbers and rejoin the string.
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+};
+
+d3.interpolateTransform = function(a, b) {
+ var s = [], // string constants and placeholders
+ q = [], // number interpolators
+ n,
+ A = d3.transform(a),
+ B = d3.transform(b),
+ ta = A.translate,
+ tb = B.translate,
+ ra = A.rotate,
+ rb = B.rotate,
+ wa = A.skew,
+ wb = B.skew,
+ ka = A.scale,
+ kb = B.scale;
+
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
+ s.push("translate(", null, ",", null, ")");
+ q.push({i: 1, x: d3.interpolateNumber(ta[0], tb[0])}, {i: 3, x: d3.interpolateNumber(ta[1], tb[1])});
+ } else if (tb[0] || tb[1]) {
+ s.push("translate(" + tb + ")");
+ } else {
+ s.push("");
+ }
+
+ if (ra != rb) {
+ q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb)});
+ } else if (rb) {
+ s.push(s.pop() + "rotate(" + rb + ")");
+ }
+
+ if (wa != wb) {
+ q.push({i: s.push(s.pop() + "skewX(", null, ")") - 2, x: d3.interpolateNumber(wa, wb)});
+ } else if (wb) {
+ s.push(s.pop() + "skewX(" + wb + ")");
+ }
+
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
+ q.push({i: n - 4, x: d3.interpolateNumber(ka[0], kb[0])}, {i: n - 2, x: d3.interpolateNumber(ka[1], kb[1])});
+ } else if (kb[0] != 1 || kb[1] != 1) {
+ s.push(s.pop() + "scale(" + kb + ")");
+ }
+
+ n = q.length;
+ return function(t) {
+ var i = -1, o;
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+};
+
+d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r,
+ ag = a.g,
+ ab = a.b,
+ br = b.r - ar,
+ bg = b.g - ag,
+ bb = b.b - ab;
+ return function(t) {
+ return "#"
+ + d3_rgb_hex(Math.round(ar + br * t))
+ + d3_rgb_hex(Math.round(ag + bg * t))
+ + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+};
+
+// interpolates HSL space, but outputs RGB string (for compatibility)
+d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h,
+ s0 = a.s,
+ l0 = a.l,
+ h1 = b.h - h0,
+ s1 = b.s - s0,
+ l1 = b.l - l0;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();
+ };
+};
+
+d3.interpolateArray = function(a, b) {
+ var x = [],
+ c = [],
+ na = a.length,
+ nb = b.length,
+ n0 = Math.min(a.length, b.length),
+ i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (; i < na; ++i) c[i] = a[i];
+ for (; i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+};
+
+d3.interpolateObject = function(a, b) {
+ var i = {},
+ c = {},
+ k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+}
+
+var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
+
+function d3_interpolateByName(n) {
+ return n == "transform"
+ ? d3.interpolateTransform
+ : d3.interpolate;
+}
+
+d3.interpolators = [
+ d3.interpolateObject,
+ function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); },
+ function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); },
+ function(a, b) { return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); },
+ function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); }
+];
+function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) { return (x - a) * b; };
+}
+
+function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); };
+}
+d3.rgb = function(r, g, b) {
+ return arguments.length === 1
+ ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b)
+ : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
+ : d3_rgb(~~r, ~~g, ~~b);
+};
+
+function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+}
+
+function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+}
+
+d3_Rgb.prototype.brighter = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ var r = this.r,
+ g = this.g,
+ b = this.b,
+ i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(
+ Math.min(255, Math.floor(r / k)),
+ Math.min(255, Math.floor(g / k)),
+ Math.min(255, Math.floor(b / k)));
+};
+
+d3_Rgb.prototype.darker = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ return d3_rgb(
+ Math.floor(k * this.r),
+ Math.floor(k * this.g),
+ Math.floor(k * this.b));
+};
+
+d3_Rgb.prototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+};
+
+d3_Rgb.prototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+};
+
+function d3_rgb_hex(v) {
+ return v < 0x10
+ ? "0" + Math.max(0, v).toString(16)
+ : Math.min(255, v).toString(16);
+}
+
+function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, // red channel; int in [0, 255]
+ g = 0, // green channel; int in [0, 255]
+ b = 0, // blue channel; int in [0, 255]
+ m1, // CSS color specification match
+ m2, // CSS color specification type (e.g., rgb)
+ name;
+
+ /* Handle hsl, rgb. */
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl": {
+ return hsl(
+ parseFloat(m2[0]), // degrees
+ parseFloat(m2[1]) / 100, // percentage
+ parseFloat(m2[2]) / 100 // percentage
+ );
+ }
+ case "rgb": {
+ return rgb(
+ d3_rgb_parseNumber(m2[0]),
+ d3_rgb_parseNumber(m2[1]),
+ d3_rgb_parseNumber(m2[2])
+ );
+ }
+ }
+ }
+
+ /* Named colors. */
+ if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
+
+ /* Hexadecimal colors: #rgb and #rrggbb. */
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1); r += r;
+ g = format.charAt(2); g += g;
+ b = format.charAt(3); b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+
+ return rgb(r, g, b);
+}
+
+function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255),
+ max = Math.max(r, g, b),
+ d = max - min,
+ h,
+ s,
+ l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
+ else if (g == max) h = (b - r) / d + 2;
+ else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+}
+
+function d3_rgb_parseNumber(c) { // either integer or percentage
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+}
+
+var d3_rgb_names = d3.map({
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+});
+
+d3_rgb_names.forEach(function(key, value) {
+ d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
+});
+d3.hsl = function(h, s, l) {
+ return arguments.length === 1
+ ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l)
+ : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
+ : d3_hsl(+h, +s, +l);
+};
+
+function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+}
+
+function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+}
+
+d3_Hsl.prototype.brighter = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+};
+
+d3_Hsl.prototype.darker = function(k) {
+ k = Math.pow(0.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+};
+
+d3_Hsl.prototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+};
+
+d3_Hsl.prototype.toString = function() {
+ return this.rgb().toString();
+};
+
+function d3_hsl_rgb(h, s, l) {
+ var m1,
+ m2;
+
+ /* Some simple corrections for h, s and l. */
+ h = h % 360; if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+
+ /* From FvD 13.37, CSS Color Module Level 3 */
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+
+ function v(h) {
+ if (h > 360) h -= 360;
+ else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+}
+function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+}
+
+var d3_select = function(s, n) { return n.querySelector(s); },
+ d3_selectAll = function(s, n) { return n.querySelectorAll(s); },
+ d3_selectRoot = document.documentElement,
+ d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector,
+ d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); };
+
+// Prefer Sizzle, if available.
+if (typeof Sizzle === "function") {
+ d3_select = function(s, n) { return Sizzle(s, n)[0] || null; };
+ d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
+ d3_selectMatches = Sizzle.matchesSelector;
+}
+
+var d3_selectionPrototype = [];
+
+d3.selection = function() {
+ return d3_selectionRoot;
+};
+
+d3.selection.prototype = d3_selectionPrototype;
+d3_selectionPrototype.select = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ group,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+
+function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+}
+d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [],
+ subgroup,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+
+function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+}
+d3_selectionPrototype.attr = function(name, value) {
+ name = d3.ns.qualify(name);
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ var node = this.node();
+ return name.local
+ ? node.getAttributeNS(name.space, name.local)
+ : node.getAttribute(name);
+ }
+
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name);
+ else this.setAttribute(name, x);
+ }
+
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local);
+ else this.setAttributeNS(name.space, name.local, x);
+ }
+
+ return this.each(value == null
+ ? (name.local ? attrNullNS : attrNull) : (typeof value === "function"
+ ? (name.local ? attrFunctionNS : attrFunction)
+ : (name.local ? attrConstantNS : attrConstant)));
+};
+d3_selectionPrototype.classed = function(name, value) {
+ var names = name.split(d3_selection_classedWhitespace),
+ n = names.length,
+ i = -1;
+ if (arguments.length > 1) {
+ while (++i < n) d3_selection_classed.call(this, names[i], value);
+ return this;
+ } else {
+ while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false;
+ return true;
+ }
+};
+
+var d3_selection_classedWhitespace = /\s+/g;
+
+function d3_selection_classed(name, value) {
+ var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) {
+ var node = this.node();
+ if (c = node.classList) return c.contains(name);
+ var c = node.className;
+ re.lastIndex = 0;
+ return re.test(c.baseVal != null ? c.baseVal : c);
+ }
+
+ function classedAdd() {
+ if (c = this.classList) return c.add(name);
+ var c = this.className,
+ cb = c.baseVal != null,
+ cv = cb ? c.baseVal : c;
+ re.lastIndex = 0;
+ if (!re.test(cv)) {
+ cv = d3_collapse(cv + " " + name);
+ if (cb) c.baseVal = cv;
+ else this.className = cv;
+ }
+ }
+
+ function classedRemove() {
+ if (c = this.classList) return c.remove(name);
+ var c = this.className,
+ cb = c.baseVal != null,
+ cv = cb ? c.baseVal : c;
+ cv = d3_collapse(cv.replace(re, " "));
+ if (cb) c.baseVal = cv;
+ else this.className = cv;
+ }
+
+ function classedFunction() {
+ (value.apply(this, arguments)
+ ? classedAdd
+ : classedRemove).call(this);
+ }
+
+ return this.each(typeof value === "function"
+ ? classedFunction : value
+ ? classedAdd
+ : classedRemove);
+}
+d3_selectionPrototype.style = function(name, value, priority) {
+ if (arguments.length < 3) priority = "";
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) return window
+ .getComputedStyle(this.node(), null)
+ .getPropertyValue(name);
+
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name);
+ else this.style.setProperty(name, x, priority);
+ }
+
+ return this.each(value == null
+ ? styleNull : (typeof value === "function"
+ ? styleFunction : styleConstant));
+};
+d3_selectionPrototype.property = function(name, value) {
+
+ // If no value is specified, return the first value.
+ if (arguments.length < 2) return this.node()[name];
+
+ function propertyNull() {
+ delete this[name];
+ }
+
+ function propertyConstant() {
+ this[name] = value;
+ }
+
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name];
+ else this[name] = x;
+ }
+
+ return this.each(value == null
+ ? propertyNull : (typeof value === "function"
+ ? propertyFunction : propertyConstant));
+};
+d3_selectionPrototype.text = function(value) {
+ return arguments.length < 1
+ ? this.node().textContent : this.each(typeof value === "function"
+ ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
+ ? function() { this.textContent = ""; }
+ : function() { this.textContent = value; });
+};
+d3_selectionPrototype.html = function(value) {
+ return arguments.length < 1
+ ? this.node().innerHTML : this.each(typeof value === "function"
+ ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
+ ? function() { this.innerHTML = ""; }
+ : function() { this.innerHTML = value; });
+};
+// TODO append(node)?
+// TODO append(function)?
+d3_selectionPrototype.append = function(name) {
+ name = d3.ns.qualify(name);
+
+ function append() {
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
+ }
+
+ function appendNS() {
+ return this.appendChild(document.createElementNS(name.space, name.local));
+ }
+
+ return this.select(name.local ? appendNS : append);
+};
+// TODO insert(node, function)?
+// TODO insert(function, string)?
+// TODO insert(function, function)?
+d3_selectionPrototype.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+
+ function insert() {
+ return this.insertBefore(
+ document.createElementNS(this.namespaceURI, name),
+ d3_select(before, this));
+ }
+
+ function insertNS() {
+ return this.insertBefore(
+ document.createElementNS(name.space, name.local),
+ d3_select(before, this));
+ }
+
+ return this.select(name.local ? insertNS : insert);
+};
+// TODO remove(selector)?
+// TODO remove(node)?
+// TODO remove(function)?
+d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+};
+d3_selectionPrototype.data = function(value, key) {
+ var i = -1,
+ n = this.length,
+ group,
+ node;
+
+ // If no value is specified, return the first value.
+ if (!arguments.length) {
+ value = new Array(n = (group = this[0]).length);
+ while (++i < n) {
+ if (node = group[i]) {
+ value[i] = node.__data__;
+ }
+ }
+ return value;
+ }
+
+ function bind(group, groupData) {
+ var i,
+ n = group.length,
+ m = groupData.length,
+ n0 = Math.min(n, m),
+ n1 = Math.max(n, m),
+ updateNodes = [],
+ enterNodes = [],
+ exitNodes = [],
+ node,
+ nodeData;
+
+ if (key) {
+ var nodeByKeyValue = new d3_Map,
+ keyValues = [],
+ keyValue,
+ j = groupData.length;
+
+ for (i = -1; ++i < n;) {
+ keyValue = key.call(node = group[i], node.__data__, i);
+ if (nodeByKeyValue.has(keyValue)) {
+ exitNodes[j++] = node; // duplicate key
+ } else {
+ nodeByKeyValue.set(keyValue, node);
+ }
+ keyValues.push(keyValue);
+ }
+
+ for (i = -1; ++i < m;) {
+ keyValue = key.call(groupData, nodeData = groupData[i], i)
+ if (nodeByKeyValue.has(keyValue)) {
+ updateNodes[i] = node = nodeByKeyValue.get(keyValue);
+ node.__data__ = nodeData;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ nodeByKeyValue.remove(keyValue);
+ }
+
+ for (i = -1; ++i < n;) {
+ if (nodeByKeyValue.has(keyValues[i])) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0;) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ enterNodes[i] = exitNodes[i] = null;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ }
+ for (; i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ updateNodes[i] = exitNodes[i] = null;
+ }
+ for (; i < n1; ++i) {
+ exitNodes[i] = group[i];
+ enterNodes[i] = updateNodes[i] = null;
+ }
+ }
+
+ enterNodes.update
+ = updateNodes;
+
+ enterNodes.parentNode
+ = updateNodes.parentNode
+ = exitNodes.parentNode
+ = group.parentNode;
+
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+
+ var enter = d3_selection_enter([]),
+ update = d3_selection([]),
+ exit = d3_selection([]);
+
+ if (typeof value === "function") {
+ while (++i < n) {
+ bind(group = this[i], value.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], value);
+ }
+ }
+
+ update.enter = function() { return enter; };
+ update.exit = function() { return exit; };
+ return update;
+};
+
+function d3_selection_dataNode(data) {
+ return {__data__: data};
+}
+d3_selectionPrototype.datum =
+d3_selectionPrototype.map = function(value) {
+ return arguments.length < 1
+ ? this.property("__data__")
+ : this.property("__data__", value);
+};
+d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [],
+ subgroup,
+ group,
+ node;
+
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+
+function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+}
+d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+};
+d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator);
+ return this.order();
+};
+
+function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return comparator(a && a.__data__, b && b.__data__);
+ };
+}
+// type can be namespaced, e.g., "click.foo"
+// listener can be null for removal
+d3_selectionPrototype.on = function(type, listener, capture) {
+ if (arguments.length < 3) capture = false;
+
+ // parse the type specifier
+ var name = "__on" + type, i = type.indexOf(".");
+ if (i > 0) type = type.substring(0, i);
+
+ // if called with only one argument, return the current listener
+ if (arguments.length < 2) return (i = this.node()[name]) && i._;
+
+ // remove the old event listener, and add the new event listener
+ return this.each(function(d, i) {
+ var node = this,
+ o = node[name];
+
+ // remove the old listener, if any (using the previously-set capture)
+ if (o) {
+ node.removeEventListener(type, o, o.$);
+ delete node[name];
+ }
+
+ // add the new listener, if any (remembering the capture flag)
+ if (listener) {
+ node.addEventListener(type, node[name] = l, l.$ = capture);
+ l._ = listener; // stash the unwrapped listener for get
+ }
+
+ // wrapped event listener that preserves i
+ function l(e) {
+ var o = d3.event; // Events can be reentrant (e.g., focus).
+ d3.event = e;
+ try {
+ listener.call(node, node.__data__, i);
+ } finally {
+ d3.event = o;
+ }
+ }
+ });
+};
+d3_selectionPrototype.each = function(callback) {
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ var node = group[i];
+ if (node) callback.call(node, node.__data__, i, j);
+ }
+ }
+ return this;
+};
+//
+// Note: assigning to the arguments array simultaneously changes the value of
+// the corresponding argument!
+//
+// TODO The `this` argument probably shouldn't be the first argument to the
+// callback, anyway, since it's redundant. However, that will require a major
+// version bump due to backwards compatibility, so I'm not changing it right
+// away.
+//
+d3_selectionPrototype.call = function(callback) {
+ callback.apply(this, (arguments[0] = this, arguments));
+ return this;
+};
+d3_selectionPrototype.empty = function() {
+ return !this.node();
+};
+d3_selectionPrototype.node = function(callback) {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+};
+d3_selectionPrototype.transition = function() {
+ var subgroups = [],
+ subgroup,
+ node;
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ subgroup.push((node = group[i]) ? {node: node, delay: d3_transitionDelay, duration: d3_transitionDuration} : null);
+ }
+ }
+
+ return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
+};
+var d3_selectionRoot = d3_selection([[document]]);
+
+d3_selectionRoot[0].parentNode = d3_selectRoot;
+
+// TODO fast singleton implementation!
+// TODO select(function)
+d3.select = function(selector) {
+ return typeof selector === "string"
+ ? d3_selectionRoot.select(selector)
+ : d3_selection([[selector]]); // assume node
+};
+
+// TODO selectAll(function)
+d3.selectAll = function(selector) {
+ return typeof selector === "string"
+ ? d3_selectionRoot.selectAll(selector)
+ : d3_selection([d3_array(selector)]); // assume node[]
+};
+function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+}
+
+var d3_selection_enterPrototype = [];
+
+d3.selection.enter = d3_selection_enter;
+d3.selection.enter.prototype = d3_selection_enterPrototype;
+
+d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ upgroup,
+ group,
+ node;
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+
+ return d3_selection(subgroups);
+};
+function d3_transition(groups, id, time) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+
+ var tweens = new d3_Map,
+ event = d3.dispatch("start", "end"),
+ ease = d3_transitionEase;
+
+ groups.id = id;
+
+ groups.time = time;
+
+ groups.tween = function(name, tween) {
+ if (arguments.length < 2) return tweens.get(name);
+ if (tween == null) tweens.remove(name);
+ else tweens.set(name, tween);
+ return groups;
+ };
+
+ groups.ease = function(value) {
+ if (!arguments.length) return ease;
+ ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
+ return groups;
+ };
+
+ groups.each = function(type, listener) {
+ if (arguments.length < 2) return d3_transition_each.call(groups, type);
+ event.on(type, listener);
+ return groups;
+ };
+
+ d3.timer(function(elapsed) {
+ groups.each(function(d, i, j) {
+ var tweened = [],
+ node = this,
+ delay = groups[j][i].delay,
+ duration = groups[j][i].duration,
+ lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0});
+
+ ++lock.count;
+
+ delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
+
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+
+ tweens.forEach(function(key, value) {
+ if (value = value.call(node, d, i)) {
+ tweened.push(value);
+ }
+ });
+
+ event.start.call(node, d, i);
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+
+ var t = (elapsed - delay) / duration,
+ e = ease(t),
+ n = tweened.length;
+
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+
+ if (t >= 1) {
+ stop();
+ d3_transitionId = id;
+ event.end.call(node, d, i);
+ d3_transitionId = 0;
+ return 1;
+ }
+ }
+
+ function stop() {
+ if (!--lock.count) delete node.__transition__;
+ return 1;
+ }
+ });
+ return 1;
+ }, 0, time);
+
+ return groups;
+}
+
+var d3_transitionRemove = {};
+
+function d3_transitionNull(d, i, a) {
+ return a != "" && d3_transitionRemove;
+}
+
+function d3_transitionTween(name, b) {
+ var interpolate = d3_interpolateByName(name);
+
+ function transitionFunction(d, i, a) {
+ var v = b.call(this, d, i);
+ return v == null
+ ? a != "" && d3_transitionRemove
+ : a != v && interpolate(a, v);
+ }
+
+ function transitionString(d, i, a) {
+ return a != b && interpolate(a, b);
+ }
+
+ return typeof b === "function" ? transitionFunction
+ : b == null ? d3_transitionNull
+ : (b += "", transitionString);
+}
+
+var d3_transitionPrototype = [],
+ d3_transitionNextId = 0,
+ d3_transitionId = 0,
+ d3_transitionDefaultDelay = 0,
+ d3_transitionDefaultDuration = 250,
+ d3_transitionDefaultEase = d3.ease("cubic-in-out"),
+ d3_transitionDelay = d3_transitionDefaultDelay,
+ d3_transitionDuration = d3_transitionDefaultDuration,
+ d3_transitionEase = d3_transitionDefaultEase;
+
+d3_transitionPrototype.call = d3_selectionPrototype.call;
+
+d3.transition = function(selection) {
+ return arguments.length
+ ? (d3_transitionId ? selection.transition() : selection)
+ : d3_selectionRoot.transition();
+};
+
+d3.transition.prototype = d3_transitionPrototype;
+d3_transitionPrototype.select = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
+ if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
+ subgroup.push({node: subnode, delay: node.delay, duration: node.duration});
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+};
+d3_transitionPrototype.selectAll = function(selector) {
+ var subgroups = [],
+ subgroup,
+ subnodes,
+ node;
+
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+
+ for (var j = -1, m = this.length; ++j < m;) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
+ if (node = group[i]) {
+ subnodes = selector.call(node.node, node.node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o;) {
+ subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration});
+ }
+ }
+ }
+ }
+
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+};
+d3_transitionPrototype.attr = function(name, value) {
+ return this.attrTween(name, d3_transitionTween(name, value));
+};
+
+d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ var name = d3.ns.qualify(nameNS);
+
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f === d3_transitionRemove
+ ? (this.removeAttribute(name), null)
+ : f && function(t) { this.setAttribute(name, f(t)); };
+ }
+
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f === d3_transitionRemove
+ ? (this.removeAttributeNS(name.space, name.local), null)
+ : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); };
+ }
+
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+};
+d3_transitionPrototype.style = function(name, value, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.styleTween(name, d3_transitionTween(name, value), priority);
+};
+
+d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+ return f === d3_transitionRemove
+ ? (this.style.removeProperty(name), null)
+ : f && function(t) { this.style.setProperty(name, f(t), priority); };
+ });
+};
+d3_transitionPrototype.text = function(value) {
+ return this.tween("text", function(d, i) {
+ this.textContent = typeof value === "function"
+ ? value.call(this, d, i)
+ : value;
+ });
+};
+d3_transitionPrototype.remove = function() {
+ return this.each("end.transition", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+};
+d3_transitionPrototype.delay = function(value) {
+ var groups = this;
+ return groups.each(typeof value === "function"
+ ? function(d, i, j) { groups[j][i].delay = value.apply(this, arguments) | 0; }
+ : (value = value | 0, function(d, i, j) { groups[j][i].delay = value; }));
+};
+d3_transitionPrototype.duration = function(value) {
+ var groups = this;
+ return groups.each(typeof value === "function"
+ ? function(d, i, j) { groups[j][i].duration = Math.max(1, value.apply(this, arguments) | 0); }
+ : (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; }));
+};
+function d3_transition_each(callback) {
+ var id = d3_transitionId,
+ ease = d3_transitionEase,
+ delay = d3_transitionDelay,
+ duration = d3_transitionDuration;
+
+ d3_transitionId = this.id;
+ d3_transitionEase = this.ease();
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) {
+ d3_transitionDelay = this[j][i].delay;
+ d3_transitionDuration = this[j][i].duration;
+ callback.call(node = node.node, node.__data__, i, j);
+ }
+ }
+ }
+
+ d3_transitionId = id;
+ d3_transitionEase = ease;
+ d3_transitionDelay = delay;
+ d3_transitionDuration = duration;
+ return this;
+}
+d3_transitionPrototype.transition = function() {
+ return this.select(d3_this);
+};
+var d3_timer_queue = null,
+ d3_timer_interval, // is an interval (or frame) active?
+ d3_timer_timeout; // is a timeout active?
+
+// The timer will continue to fire until callback returns true.
+d3.timer = function(callback, delay, then) {
+ var found = false,
+ t0,
+ t1 = d3_timer_queue;
+
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0;
+ else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+
+ // See if the callback's already in the queue.
+ while (t1) {
+ if (t1.callback === callback) {
+ t1.then = then;
+ t1.delay = delay;
+ found = true;
+ break;
+ }
+ t0 = t1;
+ t1 = t1.next;
+ }
+
+ // Otherwise, add the callback to the queue.
+ if (!found) d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+
+ // Start animatin'!
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+}
+
+function d3_timer_step() {
+ var elapsed,
+ now = Date.now(),
+ t1 = d3_timer_queue;
+
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+}
+
+d3.timer.flush = function() {
+ var elapsed,
+ now = Date.now(),
+ t1 = d3_timer_queue;
+
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+
+ d3_timer_flush();
+};
+
+// Flush after callbacks, to avoid concurrent queue modification.
+function d3_timer_flush() {
+ var t0 = null,
+ t1 = d3_timer_queue,
+ then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+}
+
+var d3_timer_frame = window.requestAnimationFrame
+ || window.webkitRequestAnimationFrame
+ || window.mozRequestAnimationFrame
+ || window.oRequestAnimationFrame
+ || window.msRequestAnimationFrame
+ || function(callback) { setTimeout(callback, 17); };
+d3.transform = function(string) {
+ var g = document.createElementNS(d3.ns.prefix.svg, "g"),
+ identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : identity);
+ })(string);
+};
+
+// Compute x-scale and normalize the first row.
+// Compute shear and make second row orthogonal to first.
+// Compute y-scale and normalize the second row.
+// Finally, compute the rotation.
+function d3_transform(m) {
+ var r0 = [m.a, m.b],
+ r1 = [m.c, m.d],
+ kx = d3_transformNormalize(r0),
+ kz = d3_transformDot(r0, r1),
+ ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
+ this.translate = [m.e, m.f];
+ this.scale = [kx, ky];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
+};
+
+d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate
+ + ")rotate(" + this.rotate
+ + ")skewX(" + this.skew
+ + ")scale(" + this.scale
+ + ")";
+};
+
+function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+}
+
+function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+}
+
+var d3_transformDegrees = 180 / Math.PI;
+d3.mouse = function(container) {
+ return d3_mousePoint(container, d3_eventSource());
+};
+
+// https://bugs.webkit.org/show_bug.cgi?id=44083
+var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
+
+function d3_mousePoint(container, e) {
+ var svg = container.ownerSVGElement || container;
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
+ svg = d3.select(document.body)
+ .append("svg")
+ .style("position", "absolute")
+ .style("top", 0)
+ .style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [point.x, point.y];
+ }
+ var rect = container.getBoundingClientRect();
+ return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];
+};
+d3.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3_eventSource().touches;
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+};
+function d3_noop() {}
+d3.scale = {};
+
+function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [start, stop] : [stop, start];
+}
+
+function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+}
+function d3_scale_nice(domain, nice) {
+ var i0 = 0,
+ i1 = domain.length - 1,
+ x0 = domain[i0],
+ x1 = domain[i1],
+ dx;
+
+ if (x1 < x0) {
+ dx = i0; i0 = i1; i1 = dx;
+ dx = x0; x0 = x1; x1 = dx;
+ }
+
+ if (dx = x1 - x0) {
+ nice = nice(dx);
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+
+ return domain;
+}
+
+function d3_scale_niceDefault() {
+ return Math;
+}
+d3.scale.linear = function() {
+ return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false);
+};
+
+function d3_scale_linear(domain, range, interpolate, clamp) {
+ var output,
+ input;
+
+ function rescale() {
+ var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear,
+ uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3.interpolate);
+ return scale;
+ }
+
+ function scale(x) {
+ return output(x);
+ }
+
+ // Note: requires range is coercible to number!
+ scale.invert = function(y) {
+ return input(y);
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+
+ return rescale();
+}
+
+function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+}
+
+function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return {
+ floor: function(x) { return Math.floor(x / dx) * dx; },
+ ceil: function(x) { return Math.ceil(x / dx) * dx; }
+ };
+}
+
+function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain),
+ span = extent[1] - extent[0],
+ step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
+ err = m / span * step;
+
+ // Filter ticks to get closer to the desired count.
+ if (err <= .15) step *= 10;
+ else if (err <= .35) step *= 5;
+ else if (err <= .75) step *= 2;
+
+ // Round start and stop values to step interval.
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive
+ extent[2] = step;
+ return extent;
+}
+
+function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+}
+
+function d3_scale_linearTickFormat(domain, m) {
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
+}
+function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]),
+ i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+}
+function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [],
+ i = [],
+ j = 0,
+ k = Math.min(domain.length, range.length) - 1;
+
+ // Handle descending domains.
+ if (domain[k] < domain[0]) {
+ domain = domain.slice().reverse();
+ range = range.slice().reverse();
+ }
+
+ while (++j <= k) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, k) - 1;
+ return i[j](u[j](x));
+ };
+}
+d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
+};
+
+function d3_scale_log(linear, log) {
+ var pow = log.pow;
+
+ function scale(x) {
+ return linear(log(x));
+ }
+
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
+ return scale;
+ };
+
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()),
+ ticks = [];
+ if (extent.every(isFinite)) {
+ var i = Math.floor(extent[0]),
+ j = Math.ceil(extent[1]),
+ u = pow(extent[0]),
+ v = pow(extent[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {} // strip small values
+ for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (arguments.length < 1) return format;
+ var k = Math.max(.1, n / scale.ticks().length),
+ f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
+ e;
+ return function(d) {
+ return d / pow(f(log(d) + e)) <= k ? format(d) : "";
+ };
+ };
+
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), log);
+ };
+
+ return d3_scale_linearRebind(scale, linear);
+}
+
+var d3_scale_logFormat = d3.format(".0e");
+
+function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
+}
+
+function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
+}
+
+d3_scale_logp.pow = function(x) {
+ return Math.pow(10, x);
+};
+
+d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+};
+d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+};
+
+function d3_scale_pow(linear, exponent) {
+ var powp = d3_scale_powPow(exponent),
+ powb = d3_scale_powPow(1 / exponent);
+
+ function scale(x) {
+ return linear(powp(x));
+ }
+
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(scale.domain(), m);
+ };
+
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+
+ return d3_scale_linearRebind(scale, linear);
+}
+
+function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+}
+d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+};
+d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {t: "range", x: []});
+};
+
+function d3_scale_ordinal(domain, ranger) {
+ var index,
+ range,
+ rangeBand;
+
+ function scale(x) {
+ return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
+ }
+
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) { return start + step * i; });
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = new d3_Map;
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
+ return scale[ranger.t](ranger.x, ranger.p);
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {t: "range", x: x};
+ return scale;
+ };
+
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0],
+ stop = x[1],
+ step = (stop - start) / (domain.length - 1 + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {t: "rangePoints", x: x, p: padding};
+ return scale;
+ };
+
+ scale.rangeBands = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var reverse = x[1] < x[0],
+ start = x[reverse - 0],
+ stop = x[1 - reverse],
+ step = (stop - start) / (domain.length + padding);
+ range = steps(start + step * padding, step);
+ if (reverse) range.reverse();
+ rangeBand = step * (1 - padding);
+ ranger = {t: "rangeBands", x: x, p: padding};
+ return scale;
+ };
+
+ scale.rangeRoundBands = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var reverse = x[1] < x[0],
+ start = x[reverse - 0],
+ stop = x[1 - reverse],
+ step = Math.floor((stop - start) / (domain.length + padding)),
+ error = stop - start - (domain.length - padding) * step;
+ range = steps(start + Math.round(error / 2), step);
+ if (reverse) range.reverse();
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {t: "rangeRoundBands", x: x, p: padding};
+ return scale;
+ };
+
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+
+ scale.rangeExtent = function() {
+ return d3_scaleExtent(ranger.x);
+ };
+
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+
+ return scale.domain(domain);
+}
+/*
+ * This product includes color specifications and designs developed by Cynthia
+ * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
+ */
+
+d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+};
+
+d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+};
+
+d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+};
+
+d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+};
+
+var d3_category10 = [
+ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
+ "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
+];
+
+var d3_category20 = [
+ "#1f77b4", "#aec7e8",
+ "#ff7f0e", "#ffbb78",
+ "#2ca02c", "#98df8a",
+ "#d62728", "#ff9896",
+ "#9467bd", "#c5b0d5",
+ "#8c564b", "#c49c94",
+ "#e377c2", "#f7b6d2",
+ "#7f7f7f", "#c7c7c7",
+ "#bcbd22", "#dbdb8d",
+ "#17becf", "#9edae5"
+];
+
+var d3_category20b = [
+ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
+ "#637939", "#8ca252", "#b5cf6b", "#cedb9c",
+ "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
+ "#843c39", "#ad494a", "#d6616b", "#e7969c",
+ "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
+];
+
+var d3_category20c = [
+ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef",
+ "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2",
+ "#31a354", "#74c476", "#a1d99b", "#c7e9c0",
+ "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb",
+ "#636363", "#969696", "#bdbdbd", "#d9d9d9"
+];
+d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+};
+
+function d3_scale_quantile(domain, range) {
+ var thresholds;
+
+ function rescale() {
+ var k = 0,
+ n = domain.length,
+ q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending);
+ return rescale();
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+
+ scale.quantiles = function() {
+ return thresholds;
+ };
+
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range); // copy on write!
+ };
+
+ return rescale();
+}
+d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [0, 1]);
+};
+
+function d3_scale_quantize(x0, x1, range) {
+ var kx, i;
+
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+
+ scale.domain = function(x) {
+ if (!arguments.length) return [x0, x1];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range); // copy on write
+ };
+
+ return rescale();
+}
+d3.scale.identity = function() {
+ return d3_scale_identity([0, 1]);
+};
+
+function d3_scale_identity(domain) {
+
+ function identity(x) { return +x; }
+
+ identity.invert = identity;
+
+ identity.domain = identity.range = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(identity);
+ return identity;
+ };
+
+ identity.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+
+ identity.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+
+ identity.copy = function() {
+ return d3_scale_identity(domain);
+ };
+
+ return identity;
+}
+d3.svg = {};
+d3.svg.arc = function() {
+ var innerRadius = d3_svg_arcInnerRadius,
+ outerRadius = d3_svg_arcOuterRadius,
+ startAngle = d3_svg_arcStartAngle,
+ endAngle = d3_svg_arcEndAngle;
+
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments),
+ r1 = outerRadius.apply(this, arguments),
+ a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset,
+ a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset,
+ da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0),
+ df = da < Math.PI ? "0" : "1",
+ c0 = Math.cos(a0),
+ s0 = Math.sin(a0),
+ c1 = Math.cos(a1),
+ s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax
+ ? (r0
+ ? "M0," + r1
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
+ + "M0," + r0
+ + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0)
+ + "A" + r0 + "," + r0 + " 0 1,0 0," + r0
+ + "Z"
+ : "M0," + r1
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
+ + "Z")
+ : (r0
+ ? "M" + r1 * c0 + "," + r1 * s0
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
+ + "L" + r0 * c1 + "," + r0 * s1
+ + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0
+ + "Z"
+ : "M" + r1 * c0 + "," + r1 * s0
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
+ + "L0,0"
+ + "Z");
+ }
+
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments)
+ + outerRadius.apply(this, arguments)) / 2,
+ a = (startAngle.apply(this, arguments)
+ + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [Math.cos(a) * r, Math.sin(a) * r];
+ };
+
+ return arc;
+};
+
+var d3_svg_arcOffset = -Math.PI / 2,
+ d3_svg_arcMax = 2 * Math.PI - 1e-6;
+
+function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+}
+
+function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+}
+
+function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+}
+
+function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+}
+function d3_svg_line(projection) {
+ var x = d3_svg_lineX,
+ y = d3_svg_lineY,
+ defined = d3_true,
+ interpolate = d3_svg_lineInterpolatorDefault,
+ interpolator = d3_svg_lineLinear,
+ tension = .7;
+
+ function line(data) {
+ var segments = [],
+ points = [],
+ i = -1,
+ n = data.length,
+ d,
+ fx = d3_functor(x),
+ fy = d3_functor(y);
+
+ function segment() {
+ segments.push("M", interpolator(projection(points), tension));
+ }
+
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points.push([+fx.call(this, d, i), +fy.call(this, d, i)]);
+ } else if (points.length) {
+ segment();
+ points = [];
+ }
+ }
+
+ if (points.length) segment();
+
+ return segments.length ? segments.join("") : null;
+ }
+
+ line.x = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return line;
+ };
+
+ line.y = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return line;
+ };
+
+ line.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return line;
+ };
+
+ line.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ if (!d3_svg_lineInterpolators.has(_ += "")) _ = d3_svg_lineInterpolatorDefault;
+ interpolator = d3_svg_lineInterpolators.get(interpolate = _);
+ return line;
+ };
+
+ line.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return line;
+ };
+
+ return line;
+}
+
+d3.svg.line = function() {
+ return d3_svg_line(d3_identity);
+};
+
+// The default `x` property, which references d[0].
+function d3_svg_lineX(d) {
+ return d[0];
+}
+
+// The default `y` property, which references d[1].
+function d3_svg_lineY(d) {
+ return d[1];
+}
+
+var d3_svg_lineInterpolatorDefault = "linear";
+
+// The various interpolators supported by the `line` class.
+var d3_svg_lineInterpolators = d3.map({
+ "linear": d3_svg_lineLinear,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ "basis": d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ "bundle": d3_svg_lineBundle,
+ "cardinal": d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ "monotone": d3_svg_lineMonotone
+});
+
+// Linear interpolation; generates "L" commands.
+function d3_svg_lineLinear(points) {
+ var i = 0,
+ n = points.length,
+ p = points[0],
+ path = [p[0], ",", p[1]];
+ while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]);
+ return path.join("");
+}
+
+// Step interpolation; generates "H" and "V" commands.
+function d3_svg_lineStepBefore(points) {
+ var i = 0,
+ n = points.length,
+ p = points[0],
+ path = [p[0], ",", p[1]];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+}
+
+// Step interpolation; generates "H" and "V" commands.
+function d3_svg_lineStepAfter(points) {
+ var i = 0,
+ n = points.length,
+ p = points[0],
+ path = [p[0], ",", p[1]];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+}
+
+// Open cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4
+ ? d3_svg_lineLinear(points)
+ : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1),
+ d3_svg_lineCardinalTangents(points, tension));
+}
+
+// Closed cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite((points.push(points[0]), points),
+ d3_svg_lineCardinalTangents([points[points.length - 2]]
+ .concat(points, [points[1]]), tension));
+}
+
+// Cardinal spline interpolation; generates "C" commands.
+function d3_svg_lineCardinal(points, tension, closed) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite(points,
+ d3_svg_lineCardinalTangents(points, tension));
+}
+
+// Hermite spline construction; generates "C" commands.
+function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1
+ || (points.length != tangents.length
+ && points.length != tangents.length + 2)) {
+ return d3_svg_lineLinear(points);
+ }
+
+ var quad = points.length != tangents.length,
+ path = "",
+ p0 = points[0],
+ p = points[1],
+ t0 = tangents[0],
+ t = t0,
+ pi = 1;
+
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3)
+ + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1])
+ + "," + (p[0] - t[0]) + "," + (p[1] - t[1])
+ + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1])
+ + "," + p[0] + "," + p[1];
+ }
+ }
+
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3)
+ + "," + lp[0] + "," + lp[1];
+ }
+
+ return path;
+}
+
+// Generates tangents for a cardinal spline.
+function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [],
+ a = (1 - tension) / 2,
+ p0,
+ p1 = points[0],
+ p2 = points[1],
+ i = 1,
+ n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
+ }
+ return tangents;
+}
+
+// B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1,
+ n = points.length,
+ pi = points[0],
+ x0 = pi[0],
+ y0 = pi[1],
+ px = [x0, x0, x0, (pi = points[1])[0]],
+ py = [y0, y0, y0, pi[1]],
+ path = [x0, ",", y0];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+// Open B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [],
+ i = -1,
+ n = points.length,
+ pi,
+ px = [0],
+ py = [0];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px)
+ + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i; while (++i < n) {
+ pi = points[i];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+// Closed B-spline interpolation; generates "C" commands.
+function d3_svg_lineBasisClosed(points) {
+ var path,
+ i = -1,
+ n = points.length,
+ m = n + 4,
+ pi,
+ px = [],
+ py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",",
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)
+ ];
+ --i; while (++i < m) {
+ pi = points[i % n];
+ px.shift(); px.push(pi[0]);
+ py.shift(); py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+}
+
+function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1;
+ if (n) {
+ var x0 = points[0][0],
+ y0 = points[0][1],
+ dx = points[n][0] - x0,
+ dy = points[n][1] - y0,
+ i = -1,
+ p,
+ t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ }
+ return d3_svg_lineBasis(points);
+}
+
+// Returns the dot product of the given four-element vectors.
+function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+}
+
+// Matrix to transform basis (b-spline) control points to bezier
+// control points. Derived from FvD 11.2.8.
+var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0],
+ d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0],
+ d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6];
+
+// Pushes a "C" Bézier curve onto the specified path array, given the
+// two specified four-element arrays which define the control points.
+function d3_svg_lineBasisBezier(path, x, y) {
+ path.push(
+ "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x),
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+}
+
+// Computes the slope from points p0 to p1.
+function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+}
+
+// Compute three-point differences for the given points.
+// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference
+function d3_svg_lineFiniteDifferences(points) {
+ var i = 0,
+ j = points.length - 1,
+ m = [],
+ p0 = points[0],
+ p1 = points[1],
+ d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]));
+ }
+ m[i] = d;
+ return m;
+}
+
+// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite
+// interpolation. Returns an array of tangent vectors. For details, see
+// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation
+function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [],
+ d,
+ a,
+ b,
+ s,
+ m = d3_svg_lineFiniteDifferences(points),
+ i = -1,
+ j = points.length - 1;
+
+ // The first two steps are done by computing finite-differences:
+ // 1. Compute the slopes of the secant lines between successive points.
+ // 2. Initialize the tangents at every point as the average of the secants.
+
+ // Then, for each segment…
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+
+ // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set
+ // mk = m{k + 1} = 0 as the spline connecting these points must be flat to
+ // preserve monotonicity. Ignore step 4 and 5 for those k.
+
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ // 4. Let ak = mk / dk and bk = m{k + 1} / dk.
+ a = m[i] / d;
+ b = m[i + 1] / d;
+
+ // 5. Prevent overshoot and ensure monotonicity by restricting the
+ // magnitude of vector to a circle of radius 3.
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+
+ // Compute the normalized tangent vector from the slopes. Note that if x is
+ // not monotonic, it's possible that the slope will be infinite, so we protect
+ // against NaN by setting the coordinate to zero.
+ i = -1; while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
+ tangents.push([s || 0, m[i] * s || 0]);
+ }
+
+ return tangents;
+}
+
+function d3_svg_lineMonotone(points) {
+ return points.length < 3
+ ? d3_svg_lineLinear(points)
+ : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+}
+d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+};
+
+function d3_svg_lineRadial(points) {
+ var point,
+ i = -1,
+ n = points.length,
+ r,
+ a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+}
+function d3_svg_area(projection) {
+ var x0 = d3_svg_lineX,
+ x1 = d3_svg_lineX,
+ y0 = 0,
+ y1 = d3_svg_lineY,
+ defined = d3_true,
+ interpolate = d3_svg_lineInterpolatorDefault,
+ i0 = d3_svg_lineLinear,
+ i1 = d3_svg_lineLinear,
+ L = "L",
+ tension = .7;
+
+ function area(data) {
+ var segments = [],
+ points0 = [],
+ points1 = [],
+ i = -1,
+ n = data.length,
+ d,
+ fx0 = d3_functor(x0),
+ fy0 = d3_functor(y0),
+ fx1 = x0 === x1 ? function() { return x; } : d3_functor(x1),
+ fy1 = y0 === y1 ? function() { return y; } : d3_functor(y1),
+ x,
+ y;
+
+ function segment() {
+ segments.push("M", i0(projection(points1), tension),
+ L, i1(projection(points0.reverse()), tension),
+ "Z");
+ }
+
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points0.push([x = +fx0.call(this, d, i), y = +fy0.call(this, d, i)]);
+ points1.push([+fx1.call(this, d, i), +fy1.call(this, d, i)]);
+ } else if (points0.length) {
+ segment();
+ points0 = [];
+ points1 = [];
+ }
+ }
+
+ if (points0.length) segment();
+
+ return segments.length ? segments.join("") : null;
+ }
+
+ area.x = function(_) {
+ if (!arguments.length) return x1;
+ x0 = x1 = _;
+ return area;
+ };
+
+ area.x0 = function(_) {
+ if (!arguments.length) return x0;
+ x0 = _;
+ return area;
+ };
+
+ area.x1 = function(_) {
+ if (!arguments.length) return x1;
+ x1 = _;
+ return area;
+ };
+
+ area.y = function(_) {
+ if (!arguments.length) return y1;
+ y0 = y1 = _;
+ return area;
+ };
+
+ area.y0 = function(_) {
+ if (!arguments.length) return y0;
+ y0 = _;
+ return area;
+ };
+
+ area.y1 = function(_) {
+ if (!arguments.length) return y1;
+ y1 = _;
+ return area;
+ };
+
+ area.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return area;
+ };
+
+ area.interpolate = function(_) {
+ if (!arguments.length) return interpolate;
+ if (!d3_svg_lineInterpolators.has(_ += "")) _ = d3_svg_lineInterpolatorDefault;
+ i0 = d3_svg_lineInterpolators.get(interpolate = _);
+ i1 = i0.reverse || i0;
+ L = /-closed$/.test(_) ? "M" : "L";
+ return area;
+ };
+
+ area.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return area;
+ };
+
+ return area;
+}
+
+d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+
+d3.svg.area = function() {
+ return d3_svg_area(Object);
+};
+d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+};
+d3.svg.chord = function() {
+ var source = d3_svg_chordSource,
+ target = d3_svg_chordTarget,
+ radius = d3_svg_chordRadius,
+ startAngle = d3_svg_arcStartAngle,
+ endAngle = d3_svg_arcEndAngle;
+
+ // TODO Allow control point to be customized.
+
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i),
+ t = subgroup(this, target, d, i);
+ return "M" + s.p0
+ + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
+ ? curve(s.r, s.p1, s.r, s.p0)
+ : curve(s.r, s.p1, t.r, t.p0)
+ + arc(t.r, t.p1, t.a1 - t.a0)
+ + curve(t.r, t.p1, s.r, s.p0))
+ + "Z";
+ }
+
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i),
+ r = radius.call(self, subgroup, i),
+ a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset,
+ a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [r * Math.cos(a0), r * Math.sin(a0)],
+ p1: [r * Math.cos(a1), r * Math.sin(a1)]
+ };
+ }
+
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
+ }
+
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+
+ return chord;
+};
+
+function d3_svg_chordSource(d) {
+ return d.source;
+}
+
+function d3_svg_chordTarget(d) {
+ return d.target;
+}
+
+function d3_svg_chordRadius(d) {
+ return d.radius;
+}
+
+function d3_svg_chordStartAngle(d) {
+ return d.startAngle;
+}
+
+function d3_svg_chordEndAngle(d) {
+ return d.endAngle;
+}
+d3.svg.diagonal = function() {
+ var source = d3_svg_chordSource,
+ target = d3_svg_chordTarget,
+ projection = d3_svg_diagonalProjection;
+
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i),
+ p3 = target.call(this, d, i),
+ m = (p0.y + p3.y) / 2,
+ p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3_functor(x);
+ return diagonal;
+ };
+
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3_functor(x);
+ return diagonal;
+ };
+
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+
+ return diagonal;
+};
+
+function d3_svg_diagonalProjection(d) {
+ return [d.x, d.y];
+}
+d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(),
+ projection = d3_svg_diagonalProjection,
+ projection_ = diagonal.projection;
+
+ diagonal.projection = function(x) {
+ return arguments.length
+ ? projection_(d3_svg_diagonalRadialProjection(projection = x))
+ : projection;
+ };
+
+ return diagonal;
+};
+
+function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments),
+ r = d[0],
+ a = d[1] + d3_svg_arcOffset;
+ return [r * Math.cos(a), r * Math.sin(a)];
+ };
+}
+d3.svg.mouse = d3.mouse;
+d3.svg.touches = d3.touches;
+d3.svg.symbol = function() {
+ var type = d3_svg_symbolType,
+ size = d3_svg_symbolSize;
+
+ function symbol(d, i) {
+ return (d3_svg_symbols.get(type.call(this, d, i))
+ || d3_svg_symbolCircle)
+ (size.call(this, d, i));
+ }
+
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+
+ // size of symbol in square pixels
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+
+ return symbol;
+};
+
+function d3_svg_symbolSize() {
+ return 64;
+}
+
+function d3_svg_symbolType() {
+ return "circle";
+}
+
+function d3_svg_symbolCircle(size) {
+ var r = Math.sqrt(size / Math.PI);
+ return "M0," + r
+ + "A" + r + "," + r + " 0 1,1 0," + (-r)
+ + "A" + r + "," + r + " 0 1,1 0," + r
+ + "Z";
+}
+
+// TODO cross-diagonal?
+var d3_svg_symbols = d3.map({
+ "circle": d3_svg_symbolCircle,
+ "cross": function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r
+ + "H" + -r
+ + "V" + -3 * r
+ + "H" + r
+ + "V" + -r
+ + "H" + 3 * r
+ + "V" + r
+ + "H" + r
+ + "V" + 3 * r
+ + "H" + -r
+ + "V" + r
+ + "H" + -3 * r
+ + "Z";
+ },
+ "diamond": function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)),
+ rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry
+ + "L" + rx + ",0"
+ + " 0," + ry
+ + " " + -rx + ",0"
+ + "Z";
+ },
+ "square": function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r
+ + "L" + r + "," + -r
+ + " " + r + "," + r
+ + " " + -r + "," + r
+ + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
+ ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry
+ + "L" + rx +"," + -ry
+ + " " + -rx + "," + -ry
+ + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
+ ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry
+ + "L" + rx +"," + ry
+ + " " + -rx + "," + ry
+ + "Z";
+ }
+});
+
+d3.svg.symbolTypes = d3_svg_symbols.keys();
+
+var d3_svg_symbolSqrt3 = Math.sqrt(3),
+ d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
+d3.svg.axis = function() {
+ var scale = d3.scale.linear(),
+ orient = "bottom",
+ tickMajorSize = 6,
+ tickMinorSize = 6,
+ tickEndSize = 6,
+ tickPadding = 3,
+ tickArguments_ = [10],
+ tickValues = null,
+ tickFormat_,
+ tickSubdivide = 0;
+
+ function axis(g) {
+ g.each(function() {
+ var g = d3.select(this);
+
+ // Ticks, or domain values for ordinal scales.
+ var ticks = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain()) : tickValues,
+ tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
+
+ // Minor ticks.
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
+ subtick = g.selectAll(".minor").data(subticks, String),
+ subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
+ subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(),
+ subtickUpdate = d3.transition(subtick).style("opacity", 1);
+
+ // Major ticks.
+ var tick = g.selectAll("g").data(ticks, String),
+ tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
+ tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(),
+ tickUpdate = d3.transition(tick).style("opacity", 1),
+ tickTransform;
+
+ // Domain.
+ var range = d3_scaleRange(scale),
+ path = g.selectAll(".domain").data([0]),
+ pathEnter = path.enter().append("path").attr("class", "domain"),
+ pathUpdate = d3.transition(path);
+
+ // Stash a snapshot of the new scale, and retrieve the old snapshot.
+ var scale1 = scale.copy(),
+ scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+
+ tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("text");
+ tickUpdate.select("text").text(tickFormat);
+
+ switch (orient) {
+ case "bottom": {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ tickEnter.select("line").attr("y2", tickMajorSize);
+ tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
+ tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+ case "top": {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ tickEnter.select("line").attr("y2", -tickMajorSize);
+ tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
+ tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+ case "left": {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ tickEnter.select("line").attr("x2", -tickMajorSize);
+ tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
+ tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+ case "right": {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ tickEnter.select("line").attr("x2", tickMajorSize);
+ tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
+ tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+
+ // For quantitative scales:
+ // - enter new ticks from the old scale
+ // - exit old ticks to the new scale
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ }
+
+ // For ordinal scales:
+ // - any entering ticks are undefined in the old scale
+ // - any exiting ticks are undefined in the new scale
+ // Therefore, we only need to transition updating ticks.
+ else {
+ var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x;
+ return axis;
+ };
+
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+
+ axis.tickValues = function(x) {
+ if (!arguments.length) return tickValues;
+ tickValues = x;
+ return axis;
+ };
+
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+
+ axis.tickSize = function(x, y, z) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+
+ return axis;
+};
+
+function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; });
+}
+
+function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; });
+}
+
+function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()),
+ subticks,
+ i = -1,
+ n = ticks.length,
+ d = (ticks[1] - ticks[0]) / ++m,
+ j,
+ v;
+ while (++i < n) {
+ for (j = m; --j > 0;) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+}
+d3.svg.brush = function() {
+ var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"),
+ x = null, // x-scale, optional
+ y = null, // y-scale, optional
+ resizes = d3_svg_brushResizes[0],
+ extent = [[0, 0], [0, 0]], // [x0, y0], [x1, y1], in pixels (integers)
+ extentDomain; // the extent in data space, lazily created
+
+ function brush(g) {
+ g.each(function() {
+ var g = d3.select(this),
+ bg = g.selectAll(".background").data([0]),
+ fg = g.selectAll(".extent").data([0]),
+ tz = g.selectAll(".resize").data(resizes, String),
+ e;
+
+ // Prepare the brush container for events.
+ g
+ .style("pointer-events", "all")
+ .on("mousedown.brush", brushstart)
+ .on("touchstart.brush", brushstart);
+
+ // An invisible, mouseable area for starting a new brush.
+ bg.enter().append("rect")
+ .attr("class", "background")
+ .style("visibility", "hidden")
+ .style("cursor", "crosshair");
+
+ // The visible brush extent; style this as you like!
+ fg.enter().append("rect")
+ .attr("class", "extent")
+ .style("cursor", "move");
+
+ // More invisible rects for resizing the extent.
+ tz.enter().append("g")
+ .attr("class", function(d) { return "resize " + d; })
+ .style("cursor", function(d) { return d3_svg_brushCursor[d]; })
+ .append("rect")
+ .attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; })
+ .attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; })
+ .attr("width", 6)
+ .attr("height", 6)
+ .style("visibility", "hidden");
+
+ // Show or hide the resizers.
+ tz.style("display", brush.empty() ? "none" : null);
+
+ // Remove any superfluous resizers.
+ tz.exit().remove();
+
+ // Initialize the background to fill the defined range.
+ // If the range isn't defined, you can post-process.
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ redrawX(g);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ redrawY(g);
+ }
+ redraw(g);
+ });
+ }
+
+ function redraw(g) {
+ g.selectAll(".resize").attr("transform", function(d) {
+ return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
+ });
+ }
+
+ function redrawX(g) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
+ }
+
+ function redrawY(g) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
+ }
+
+ function brushstart() {
+ var target = this,
+ eventTarget = d3.select(d3.event.target),
+ event_ = event.of(target, arguments),
+ g = d3.select(target),
+ resizing = eventTarget.datum(),
+ resizingX = !/^(n|s)$/.test(resizing) && x,
+ resizingY = !/^(e|w)$/.test(resizing) && y,
+ dragging = eventTarget.classed("extent"),
+ center,
+ origin = mouse(),
+ offset;
+
+ var w = d3.select(window)
+ .on("mousemove.brush", brushmove)
+ .on("mouseup.brush", brushend)
+ .on("touchmove.brush", brushmove)
+ .on("touchend.brush", brushend)
+ .on("keydown.brush", keydown)
+ .on("keyup.brush", keyup);
+
+ // If the extent was clicked on, drag rather than brush;
+ // store the point between the mouse and extent origin instead.
+ if (dragging) {
+ origin[0] = extent[0][0] - origin[0];
+ origin[1] = extent[0][1] - origin[1];
+ }
+
+ // If a resizer was clicked on, record which side is to be resized.
+ // Also, set the origin to the opposite side.
+ else if (resizing) {
+ var ex = +/w$/.test(resizing),
+ ey = +/^n/.test(resizing);
+ offset = [extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1]];
+ origin[0] = extent[ex][0];
+ origin[1] = extent[ey][1];
+ }
+
+ // If the ALT key is down when starting a brush, the center is at the mouse.
+ else if (d3.event.altKey) center = origin.slice();
+
+ // Propagate the active cursor to the body for the drag duration.
+ g.style("pointer-events", "none").selectAll(".resize").style("display", null);
+ d3.select("body").style("cursor", eventTarget.style("cursor"));
+
+ // Notify listeners.
+ event_({type: "brushstart"});
+ brushmove();
+ d3_eventCancel();
+
+ function mouse() {
+ var touches = d3.event.changedTouches;
+ return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
+ }
+
+ function keydown() {
+ if (d3.event.keyCode == 32) {
+ if (!dragging) {
+ center = null;
+ origin[0] -= extent[1][0];
+ origin[1] -= extent[1][1];
+ dragging = 2;
+ }
+ d3_eventCancel();
+ }
+ }
+
+ function keyup() {
+ if (d3.event.keyCode == 32 && dragging == 2) {
+ origin[0] += extent[1][0];
+ origin[1] += extent[1][1];
+ dragging = 0;
+ d3_eventCancel();
+ }
+ }
+
+ function brushmove() {
+ var point = mouse(),
+ moved = false;
+
+ // Preserve the offset for thick resizers.
+ if (offset) {
+ point[0] += offset[0];
+ point[1] += offset[1];
+ }
+
+ if (!dragging) {
+
+ // If needed, determine the center from the current extent.
+ if (d3.event.altKey) {
+ if (!center) center = [(extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2];
+
+ // Update the origin, for when the ALT key is released.
+ origin[0] = extent[+(point[0] < center[0])][0];
+ origin[1] = extent[+(point[1] < center[1])][1];
+ }
+
+ // When the ALT key is released, we clear the center.
+ else center = null;
+ }
+
+ // Update the brush extent for each dimension.
+ if (resizingX && move1(point, x, 0)) {
+ redrawX(g);
+ moved = true;
+ }
+ if (resizingY && move1(point, y, 1)) {
+ redrawY(g);
+ moved = true;
+ }
+
+ // Final redraw and notify listeners.
+ if (moved) {
+ redraw(g);
+ event_({type: "brush", mode: dragging ? "move" : "resize"});
+ }
+ }
+
+ function move1(point, scale, i) {
+ var range = d3_scaleRange(scale),
+ r0 = range[0],
+ r1 = range[1],
+ position = origin[i],
+ size = extent[1][i] - extent[0][i],
+ min,
+ max;
+
+ // When dragging, reduce the range by the extent size and position.
+ if (dragging) {
+ r0 -= position;
+ r1 -= size + position;
+ }
+
+ // Clamp the point so that the extent fits within the range extent.
+ min = Math.max(r0, Math.min(r1, point[i]));
+
+ // Compute the new extent bounds.
+ if (dragging) {
+ max = (min += position) + size;
+ } else {
+
+ // If the ALT key is pressed, then preserve the center of the extent.
+ if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
+
+ // Compute the min and max of the position and point.
+ if (position < min) {
+ max = min;
+ min = position;
+ } else {
+ max = position;
+ }
+ }
+
+ // Update the stored bounds.
+ if (extent[0][i] !== min || extent[1][i] !== max) {
+ extentDomain = null;
+ extent[0][i] = min;
+ extent[1][i] = max;
+ return true;
+ }
+ }
+
+ function brushend() {
+ brushmove();
+
+ // reset the cursor styles
+ g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
+ d3.select("body").style("cursor", null);
+
+ w .on("mousemove.brush", null)
+ .on("mouseup.brush", null)
+ .on("touchmove.brush", null)
+ .on("touchend.brush", null)
+ .on("keydown.brush", null)
+ .on("keyup.brush", null);
+
+ event_({type: "brushend"});
+ d3_eventCancel();
+ }
+ }
+
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
+ return brush;
+ };
+
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
+ return brush;
+ };
+
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+
+ // Invert the pixel extent to data-space.
+ if (!arguments.length) {
+ z = extentDomain || extent;
+ if (x) {
+ x0 = z[0][0], x1 = z[1][0];
+ if (!extentDomain) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ }
+ if (y) {
+ y0 = z[0][1], y1 = z[1][1];
+ if (!extentDomain) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ }
+ return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
+ }
+
+ // Scale the data-space extent to pixels.
+ extentDomain = [[0, 0], [0, 0]];
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ extentDomain[0][0] = x0, extentDomain[1][0] = x1;
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ extentDomain[0][1] = y0, extentDomain[1][1] = y1;
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
+ }
+
+ return brush;
+ };
+
+ brush.clear = function() {
+ extentDomain = null;
+ extent[0][0] =
+ extent[0][1] =
+ extent[1][0] =
+ extent[1][1] = 0;
+ return brush;
+ };
+
+ brush.empty = function() {
+ return (x && extent[0][0] === extent[1][0])
+ || (y && extent[0][1] === extent[1][1]);
+ };
+
+ return d3.rebind(brush, event, "on");
+};
+
+var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+};
+
+var d3_svg_brushResizes = [
+ ["n", "e", "s", "w", "nw", "ne", "se", "sw"],
+ ["e", "w"],
+ ["n", "s"],
+ []
+];
+d3.behavior = {};
+// TODO Track touch points by identifier.
+
+d3.behavior.drag = function() {
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"),
+ origin = null;
+
+ function drag() {
+ this.on("mousedown.drag", mousedown)
+ .on("touchstart.drag", mousedown);
+ }
+
+ function mousedown() {
+ var target = this,
+ event_ = event.of(target, arguments),
+ eventTarget = d3.event.target,
+ offset,
+ origin_ = point(),
+ moved = 0;
+
+ var w = d3.select(window)
+ .on("mousemove.drag", dragmove)
+ .on("touchmove.drag", dragmove)
+ .on("mouseup.drag", dragend, true)
+ .on("touchend.drag", dragend, true);
+
+ if (origin) {
+ offset = origin.apply(target, arguments);
+ offset = [offset.x - origin_[0], offset.y - origin_[1]];
+ } else {
+ offset = [0, 0];
+ }
+
+ d3_eventCancel();
+ event_({type: "dragstart"});
+
+ function point() {
+ var p = target.parentNode,
+ t = d3.event.changedTouches;
+ return t ? d3.touches(p, t)[0] : d3.mouse(p);
+ }
+
+ function dragmove() {
+ if (!target.parentNode) return dragend(); // target removed from DOM
+
+ var p = point(),
+ dx = p[0] - origin_[0],
+ dy = p[1] - origin_[1];
+
+ moved |= dx | dy;
+ origin_ = p;
+ d3_eventCancel();
+
+ event_({type: "drag", x: p[0] + offset[0], y: p[1] + offset[1], dx: dx, dy: dy});
+ }
+
+ function dragend() {
+ event_({type: "dragend"});
+
+ // if moved, prevent the mouseup (and possibly click) from propagating
+ if (moved) {
+ d3_eventCancel();
+ if (d3.event.target === eventTarget) w.on("click.drag", click, true);
+ }
+
+ w .on("mousemove.drag", null)
+ .on("touchmove.drag", null)
+ .on("mouseup.drag", null)
+ .on("touchend.drag", null);
+ }
+
+ // prevent the subsequent click from propagating (e.g., for anchors)
+ function click() {
+ d3_eventCancel();
+ w.on("click.drag", null);
+ }
+ }
+
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+
+ return d3.rebind(drag, event, "on");
+};
+d3.behavior.zoom = function() {
+ var translate = [0, 0],
+ translate0, // translate when we started zooming (to avoid drift)
+ scale = 1,
+ scale0, // scale when we started touching
+ scaleExtent = d3_behavior_zoomInfinity,
+ event = d3_eventDispatch(zoom, "zoom"),
+ x0,
+ x1,
+ y0,
+ y1,
+ touchtime; // time of last touchstart (to detect double-tap)
+
+ function zoom() {
+ this
+ .on("mousedown.zoom", mousedown)
+ .on("mousewheel.zoom", mousewheel)
+ .on("mousemove.zoom", mousemove)
+ .on("DOMMouseScroll.zoom", mousewheel)
+ .on("dblclick.zoom", dblclick)
+ .on("touchstart.zoom", touchstart)
+ .on("touchmove.zoom", touchmove)
+ .on("touchend.zoom", touchstart);
+ }
+
+ zoom.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = x.map(Number);
+ return zoom;
+ };
+
+ zoom.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return zoom;
+ };
+
+ zoom.scaleExtent = function(x) {
+ if (!arguments.length) return scaleExtent;
+ scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
+ return zoom;
+ };
+
+ zoom.x = function(z) {
+ if (!arguments.length) return x1;
+ x1 = z;
+ x0 = z.copy();
+ return zoom;
+ };
+
+ zoom.y = function(z) {
+ if (!arguments.length) return y1;
+ y1 = z;
+ y0 = z.copy();
+ return zoom;
+ };
+
+ function location(p) {
+ return [(p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale];
+ }
+
+ function point(l) {
+ return [l[0] * scale + translate[0], l[1] * scale + translate[1]];
+ }
+
+ function scaleTo(s) {
+ scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
+ }
+
+ function translateTo(p, l) {
+ l = point(l);
+ translate[0] += p[0] - l[0];
+ translate[1] += p[1] - l[1];
+ }
+
+ function dispatch(event) {
+ if (x1) x1.domain(x0.range().map(function(x) { return (x - translate[0]) / scale; }).map(x0.invert));
+ if (y1) y1.domain(y0.range().map(function(y) { return (y - translate[1]) / scale; }).map(y0.invert));
+ d3.event.preventDefault();
+ event({type: "zoom", scale: scale, translate: translate});
+ }
+
+ function mousedown() {
+ var target = this,
+ event_ = event.of(target, arguments),
+ eventTarget = d3.event.target,
+ moved = 0,
+ w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup),
+ l = location(d3.mouse(target));
+
+ window.focus();
+ d3_eventCancel();
+
+ function mousemove() {
+ moved = 1;
+ translateTo(d3.mouse(target), l);
+ dispatch(event_);
+ }
+
+ function mouseup() {
+ if (moved) d3_eventCancel();
+ w.on("mousemove.zoom", null).on("mouseup.zoom", null);
+ if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
+ }
+
+ function click() {
+ d3_eventCancel();
+ w.on("click.zoom", null);
+ }
+ }
+
+ function mousewheel() {
+ if (!translate0) translate0 = location(d3.mouse(this));
+ scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
+ translateTo(d3.mouse(this), translate0);
+ dispatch(event.of(this, arguments));
+ }
+
+ function mousemove() {
+ translate0 = null;
+ }
+
+ function dblclick() {
+ var p = d3.mouse(this), l = location(p);
+ scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+
+ function touchstart() {
+ var touches = d3.touches(this),
+ now = Date.now();
+
+ scale0 = scale;
+ translate0 = {};
+ touches.forEach(function(t) { translate0[t.identifier] = location(t); });
+ d3_eventCancel();
+
+ if ((touches.length === 1) && (now - touchtime < 500)) { // dbltap
+ var p = touches[0], l = location(touches[0]);
+ scaleTo(scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ touchtime = now;
+ }
+
+ function touchmove() {
+ var touches = d3.touches(this),
+ p0 = touches[0],
+ l0 = translate0[p0.identifier];
+ if (p1 = touches[1]) {
+ var p1, l1 = translate0[p1.identifier];
+ p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
+ l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
+ scaleTo(d3.event.scale * scale0);
+ }
+ translateTo(p0, l0);
+ dispatch(event.of(this, arguments));
+ }
+
+ return d3.rebind(zoom, event, "on");
+};
+
+var d3_behavior_zoomDiv, // for interpreting mousewheel events
+ d3_behavior_zoomInfinity = [0, Infinity]; // default scale extent
+
+function d3_behavior_zoomDelta() {
+
+ // mousewheel events are totally broken!
+ // https://bugs.webkit.org/show_bug.cgi?id=40441
+ // not only that, but Chrome and Safari differ in re. to acceleration!
+ if (!d3_behavior_zoomDiv) {
+ d3_behavior_zoomDiv = d3.select("body").append("div")
+ .style("visibility", "hidden")
+ .style("top", 0)
+ .style("height", 0)
+ .style("width", 0)
+ .style("overflow-y", "scroll")
+ .append("div")
+ .style("height", "2000px")
+ .node().parentNode;
+ }
+
+ var e = d3.event, delta;
+ try {
+ d3_behavior_zoomDiv.scrollTop = 1000;
+ d3_behavior_zoomDiv.dispatchEvent(e);
+ delta = 1000 - d3_behavior_zoomDiv.scrollTop;
+ } catch (error) {
+ delta = e.wheelDelta || (-e.detail * 5);
+ }
+
+ return delta;
+}
+d3.layout = {};
+// Implements hierarchical edge bundling using Holten's algorithm. For each
+// input link, a path is computed that travels through the tree, up the parent
+// hierarchy to the least common ancestor, and then back down to the destination
+// node. Each path is simply an array of nodes.
+d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [],
+ i = -1,
+ n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+};
+
+function d3_layout_bundlePath(link) {
+ var start = link.source,
+ end = link.target,
+ lca = d3_layout_bundleLeastCommonAncestor(start, end),
+ points = [start];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+}
+
+function d3_layout_bundleAncestors(node) {
+ var ancestors = [],
+ parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+}
+
+function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a),
+ bNodes = d3_layout_bundleAncestors(b),
+ aNode = aNodes.pop(),
+ bNode = bNodes.pop(),
+ sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+}
+d3.layout.chord = function() {
+ var chord = {},
+ chords,
+ groups,
+ matrix,
+ n,
+ padding = 0,
+ sortGroups,
+ sortSubgroups,
+ sortChords;
+
+ function relayout() {
+ var subgroups = {},
+ groupSums = [],
+ groupIndex = d3.range(n),
+ subgroupIndex = [],
+ k,
+ x,
+ x0,
+ i,
+ j;
+
+ chords = [];
+ groups = [];
+
+ // Compute the sum.
+ k = 0, i = -1; while (++i < n) {
+ x = 0, j = -1; while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+
+ // Sort groups…
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+
+ // Sort subgroups…
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+
+ // Convert the sum to scaling factor for [0, 2pi].
+ // TODO Allow start and end angle to be specified.
+ // TODO Allow padding to be specified as percentage?
+ k = (2 * Math.PI - padding * n) / k;
+
+ // Compute the start and end angle for each group and subgroup.
+ // Note: Opera has a bug reordering object literal properties!
+ x = 0, i = -1; while (++i < n) {
+ x0 = x, j = -1; while (++j < n) {
+ var di = groupIndex[i],
+ dj = subgroupIndex[di][j],
+ v = matrix[di][dj],
+ a0 = x,
+ a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups[di] = {
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ };
+ x += padding;
+ }
+
+ // Generate chords for each (non-empty) subgroup-subgroup link.
+ i = -1; while (++i < n) {
+ j = i - 1; while (++j < n) {
+ var source = subgroups[i + "-" + j],
+ target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value
+ ? {source: target, target: source}
+ : {source: source, target: target});
+ }
+ }
+ }
+
+ if (sortChords) resort();
+ }
+
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords(
+ (a.source.value + a.target.value) / 2,
+ (b.source.value + b.target.value) / 2);
+ });
+ }
+
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+
+ return chord;
+};
+// A rudimentary force layout using Gauss-Seidel.
+d3.layout.force = function() {
+ var force = {},
+ event = d3.dispatch("start", "tick", "end"),
+ size = [1, 1],
+ drag,
+ alpha,
+ friction = .9,
+ linkDistance = d3_layout_forceLinkDistance,
+ linkStrength = d3_layout_forceLinkStrength,
+ charge = -30,
+ gravity = .1,
+ theta = .8,
+ interval,
+ nodes = [],
+ links = [],
+ distances,
+ strengths,
+ charges;
+
+ function repulse(node) {
+ return function(quad, x1, y1, x2, y2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x,
+ dy = quad.cy - node.y,
+ dn = 1 / Math.sqrt(dx * dx + dy * dy);
+
+ /* Barnes-Hut criterion. */
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+
+ force.tick = function() {
+ // simulated annealing, basically
+ if ((alpha *= .99) < .005) {
+ event.end({type: "end", alpha: alpha = 0});
+ return true;
+ }
+
+ var n = nodes.length,
+ m = links.length,
+ q,
+ i, // current index
+ o, // current object
+ s, // current source
+ t, // current target
+ l, // current distance
+ k, // current force
+ x, // x-distance
+ y; // y-distance
+
+ // gauss-seidel relaxation for links
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = (x * x + y * y)) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+
+ // apply gravity forces
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1; if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+
+ // compute quadtree center of mass and apply charge forces
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1; while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+
+ // position verlet integration
+ i = -1; while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+
+ event.tick({type: "tick", alpha: alpha});
+ };
+
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = d3_functor(x);
+ return force;
+ };
+
+ // For backwards-compatibility.
+ force.distance = force.linkDistance;
+
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = d3_functor(x);
+ return force;
+ };
+
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = x;
+ return force;
+ };
+
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = x;
+ return force;
+ };
+
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = x;
+ return force;
+ };
+
+ force.alpha = function(x) {
+ if (!arguments.length) return alpha;
+
+ if (alpha) { // if we're already running
+ if (x > 0) alpha = x; // we might keep it hot
+ else alpha = 0; // or, next tick will dispatch "end"
+ } else if (x > 0) { // otherwise, fire it up!
+ event.start({type: "start", alpha: alpha = x});
+ d3.timer(force.tick);
+ }
+
+ return force;
+ };
+
+ force.start = function() {
+ var i,
+ j,
+ n = nodes.length,
+ m = links.length,
+ w = size[0],
+ h = size[1],
+ neighbors,
+ o;
+
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+
+ distances = [];
+ strengths = [];
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ distances[i] = linkDistance.call(this, o, i);
+ strengths[i] = linkStrength.call(this, o, i);
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+
+ charges = [];
+ if (typeof charge === "function") {
+ for (i = 0; i < n; ++i) {
+ charges[i] = +charge.call(this, nodes[i], i);
+ }
+ } else {
+ for (i = 0; i < n; ++i) {
+ charges[i] = charge;
+ }
+ }
+
+ // initialize node position based on first neighbor
+ function position(dimension, size) {
+ var neighbors = neighbor(i),
+ j = -1,
+ m = neighbors.length,
+ x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+
+ // initialize neighbors lazily
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+
+ return force.resume();
+ };
+
+ force.resume = function() {
+ return force.alpha(.1);
+ };
+
+ force.stop = function() {
+ return force.alpha(0);
+ };
+
+ // use `node.call(force.drag)` to make nodes draggable
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag()
+ .origin(d3_identity)
+ .on("dragstart", dragstart)
+ .on("drag", d3_layout_forceDrag)
+ .on("dragend", d3_layout_forceDragEnd);
+
+ this.on("mouseover.force", d3_layout_forceDragOver)
+ .on("mouseout.force", d3_layout_forceDragOut)
+ .call(drag);
+ };
+
+ function dragstart(d) {
+ d3_layout_forceDragOver(d3_layout_forceDragNode = d);
+ d3_layout_forceDragForce = force;
+ }
+
+ return d3.rebind(force, event, "on");
+};
+
+var d3_layout_forceDragForce,
+ d3_layout_forceDragNode;
+
+function d3_layout_forceDragOver(d) {
+ d.fixed |= 2;
+}
+
+function d3_layout_forceDragOut(d) {
+ if (d !== d3_layout_forceDragNode) d.fixed &= 1;
+}
+
+function d3_layout_forceDragEnd() {
+ d3_layout_forceDragNode.fixed &= 1;
+ d3_layout_forceDragForce = d3_layout_forceDragNode = null;
+}
+
+function d3_layout_forceDrag() {
+ d3_layout_forceDragNode.px = d3.event.x;
+ d3_layout_forceDragNode.py = d3.event.y;
+ d3_layout_forceDragForce.resume(); // restart annealing
+}
+
+function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0,
+ cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes,
+ n = nodes.length,
+ i = -1,
+ c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ // jitter internal nodes that are coincident
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+}
+
+function d3_layout_forceLinkDistance(link) {
+ return 20;
+}
+
+function d3_layout_forceLinkStrength(link) {
+ return 1;
+}
+d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ size = [1, 1]; // width, height
+
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n,
+ c,
+ d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+
+ function depth(node) {
+ var children = node.children,
+ d = 0;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+};
+d3.layout.pie = function() {
+ var value = Number,
+ sort = d3_layout_pieSortByValue,
+ startAngle = 0,
+ endAngle = 2 * Math.PI;
+
+ function pie(data, i) {
+
+ // Compute the numeric values for each data element.
+ var values = data.map(function(d, i) { return +value.call(pie, d, i); });
+
+ // Compute the start angle.
+ var a = +(typeof startAngle === "function"
+ ? startAngle.apply(this, arguments)
+ : startAngle);
+
+ // Compute the angular scale factor: from value to radians.
+ var k = ((typeof endAngle === "function"
+ ? endAngle.apply(this, arguments)
+ : endAngle) - startAngle)
+ / d3.sum(values);
+
+ // Optionally sort the data.
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue
+ ? function(i, j) { return values[j] - values[i]; }
+ : function(i, j) { return sort(data[i], data[j]); });
+
+ // Compute the arcs!
+ // They are stored in the original data's order.
+ var arcs = [];
+ index.forEach(function(i) {
+ var d;
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+
+ /**
+ * Specifies the value function *x*, which returns a nonnegative numeric value
+ * for each datum. The default value function is `Number`. The value function
+ * is passed two arguments: the current datum and the current index.
+ */
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+
+ /**
+ * Specifies a sort comparison operator *x*. The comparator is passed two data
+ * elements from the data array, a and b; it returns a negative value if a is
+ * less than b, a positive value if a is greater than b, and zero if a equals
+ * b.
+ */
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall start angle of the pie chart. Defaults to 0. The
+ * start angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+
+ /**
+ * Specifies the overall end angle of the pie chart. Defaults to 2π. The
+ * end angle can be specified either as a constant or as a function; in the
+ * case of a function, it is evaluated once per array (as opposed to per
+ * element).
+ */
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+
+ return pie;
+};
+
+var d3_layout_pieSortByValue = {};
+// data is two-dimensional array of x,y; we populate y0
+d3.layout.stack = function() {
+ var values = d3_identity,
+ order = d3_layout_stackOrderDefault,
+ offset = d3_layout_stackOffsetZero,
+ out = d3_layout_stackOut,
+ x = d3_layout_stackX,
+ y = d3_layout_stackY;
+
+ function stack(data, index) {
+
+ // Convert series to canonical two-dimensional representation.
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+
+ // Convert each series to canonical [[x,y]] representation.
+ var points = series.map(function(d, i) {
+ return d.map(function(v, i) {
+ return [x.call(stack, v, i), y.call(stack, v, i)];
+ });
+ });
+
+ // Compute the order of series, and permute them.
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+
+ // Compute the baseline…
+ var offsets = offset.call(stack, points, index);
+
+ // And propagate it to other series.
+ var n = series.length,
+ m = series[0].length,
+ i,
+ j,
+ o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+
+ return data;
+ }
+
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
+ return stack;
+ };
+
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
+ return stack;
+ };
+
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+
+ return stack;
+}
+
+function d3_layout_stackX(d) {
+ return d.x;
+}
+
+function d3_layout_stackY(d) {
+ return d.y;
+}
+
+function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+}
+
+var d3_layout_stackOrders = d3.map({
+
+ "inside-out": function(data) {
+ var n = data.length,
+ i,
+ j,
+ max = data.map(d3_layout_stackMaxIndex),
+ sums = data.map(d3_layout_stackReduceSum),
+ index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
+ top = 0,
+ bottom = 0,
+ tops = [],
+ bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+
+ "reverse": function(data) {
+ return d3.range(data.length).reverse();
+ },
+
+ "default": d3_layout_stackOrderDefault
+
+});
+
+var d3_layout_stackOffsets = d3.map({
+
+ "silhouette": function(data) {
+ var n = data.length,
+ m = data[0].length,
+ sums = [],
+ max = 0,
+ i,
+ j,
+ o,
+ y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+
+ "wiggle": function(data) {
+ var n = data.length,
+ x = data[0],
+ m = x.length,
+ max = 0,
+ i,
+ j,
+ k,
+ s1,
+ s2,
+ s3,
+ dx,
+ o,
+ o0,
+ y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+
+ "expand": function(data) {
+ var n = data.length,
+ m = data[0].length,
+ k = 1 / n,
+ i,
+ j,
+ o,
+ y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o;
+ else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+
+ "zero": d3_layout_stackOffsetZero
+
+});
+
+function d3_layout_stackOrderDefault(data) {
+ return d3.range(data.length);
+}
+
+function d3_layout_stackOffsetZero(data) {
+ var j = -1,
+ m = data[0].length,
+ y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+}
+
+function d3_layout_stackMaxIndex(array) {
+ var i = 1,
+ j = 0,
+ v = array[0][1],
+ k,
+ n = array.length;
+ for (; i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+}
+
+function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+}
+
+function d3_layout_stackSum(p, d) {
+ return p + d[1];
+}
+d3.layout.histogram = function() {
+ var frequency = true,
+ valuer = Number,
+ ranger = d3_layout_histogramRange,
+ binner = d3_layout_histogramBinSturges;
+
+ function histogram(data, i) {
+ var bins = [],
+ values = data.map(valuer, this),
+ range = ranger.call(this, values, i),
+ thresholds = binner.call(this, range, values, i),
+ bin,
+ i = -1,
+ n = values.length,
+ m = thresholds.length - 1,
+ k = frequency ? 1 : 1 / n,
+ x;
+
+ // Initialize the bins.
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+
+ // Fill the bins, ignoring values outside the range.
+ if (m > 0) {
+ i = -1; while(++i < n) {
+ x = values[i];
+ if ((x >= range[0]) && (x <= range[1])) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+ }
+
+ return bins;
+ }
+
+ // Specifies how to extract a value from the associated data. The default
+ // value function is `Number`, which is equivalent to the identity function.
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+
+ // Specifies the range of the histogram. Values outside the specified range
+ // will be ignored. The argument `x` may be specified either as a two-element
+ // array representing the minimum and maximum value of the range, or as a
+ // function that returns the range given the array of values and the current
+ // index `i`. The default range is the extent (minimum and maximum) of the
+ // values.
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3_functor(x);
+ return histogram;
+ };
+
+ // Specifies how to bin values in the histogram. The argument `x` may be
+ // specified as a number, in which case the range of values will be split
+ // uniformly into the given number of bins. Or, `x` may be an array of
+ // threshold values, defining the bins; the specified array must contain the
+ // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x`
+ // may be a function which is evaluated, being passed the range, the array of
+ // values, and the current index `i`, returning an array of thresholds. The
+ // default bin function will divide the values into uniform bins using
+ // Sturges' formula.
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number"
+ ? function(range) { return d3_layout_histogramBinFixed(range, x); }
+ : d3_functor(x);
+ return histogram;
+ };
+
+ // Specifies whether the histogram's `y` value is a count (frequency) or a
+ // probability (density). The default value is true.
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+
+ return histogram;
+};
+
+function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+}
+
+function d3_layout_histogramBinFixed(range, n) {
+ var x = -1,
+ b = +range[0],
+ m = (range[1] - b) / n,
+ f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+}
+
+function d3_layout_histogramRange(values) {
+ return [d3.min(values), d3.max(values)];
+}
+d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort,
+ children = d3_layout_hierarchyChildren,
+ value = d3_layout_hierarchyValue;
+
+ // Recursively compute the node depth and value.
+ // Also converts the data representation into a standard hierarchy structure.
+ function recurse(data, depth, nodes) {
+ var childs = children.call(hierarchy, data, depth),
+ node = d3_layout_hierarchyInline ? data : {data: data};
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1,
+ n,
+ c = node.children = [],
+ v = 0,
+ j = depth + 1,
+ d;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, data, depth) || 0;
+ }
+ return node;
+ }
+
+ // Recursively re-evaluates the node value.
+ function revalue(node, depth) {
+ var children = node.children,
+ v = 0;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n,
+ j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+
+ // Re-evaluates the `value` property for the specified hierarchy.
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+
+ return hierarchy;
+};
+
+// A method assignment helper for hierarchy subclasses.
+function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+
+ // Add an alias for links, for convenience.
+ object.links = d3_layout_hierarchyLinks;
+
+ // If the new API is used, enabling inlining.
+ object.nodes = function(d) {
+ d3_layout_hierarchyInline = true;
+ return (object.nodes = object)(d);
+ };
+
+ return object;
+}
+
+function d3_layout_hierarchyChildren(d) {
+ return d.children;
+}
+
+function d3_layout_hierarchyValue(d) {
+ return d.value;
+}
+
+function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+}
+
+// Returns an array source+target objects for the specified nodes.
+function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {source: parent, target: child};
+ });
+ }));
+}
+
+// For backwards-compatibility, don't enable inlining by default.
+var d3_layout_hierarchyInline = false;
+d3.layout.pack = function() {
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort),
+ size = [1, 1];
+
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i),
+ root = nodes[0];
+
+ // Recursively compute the layout.
+ root.x = 0;
+ root.y = 0;
+ d3_layout_packTree(root);
+
+ // Scale the layout to fit the requested size.
+ var w = size[0],
+ h = size[1],
+ k = 1 / Math.max(2 * root.r / w, 2 * root.r / h);
+ d3_layout_packTransform(root, w / 2, h / 2, k);
+
+ return nodes;
+ }
+
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+};
+
+function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+}
+
+function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+}
+
+function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+}
+
+function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x,
+ dy = b.y - a.y,
+ dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001; // within epsilon
+}
+
+function d3_layout_packCircle(nodes) {
+ var xMin = Infinity,
+ xMax = -Infinity,
+ yMin = Infinity,
+ yMax = -Infinity,
+ n = nodes.length,
+ a, b, c, j, k;
+
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+
+ // Create node links.
+ nodes.forEach(d3_layout_packLink);
+
+ // Create first node.
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+
+ // Create second node.
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+
+ // Create third node and build chain.
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+
+ // Now iterate through the rest.
+ for (var i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+
+ // Search for the closest intersection.
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+
+ // Update node chain.
+ if (isect) {
+ if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j);
+ else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+
+ // Re-center the circles and return the encompassing radius.
+ var cx = (xMin + xMax) / 2,
+ cy = (yMin + yMax) / 2,
+ cr = 0;
+ for (var i = 0; i < n; i++) {
+ var node = nodes[i];
+ node.x -= cx;
+ node.y -= cy;
+ cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y));
+ }
+
+ // Remove node links.
+ nodes.forEach(d3_layout_packUnlink);
+
+ return cr;
+}
+
+function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+}
+
+function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+}
+
+function d3_layout_packTree(node) {
+ var children = node.children;
+ if (children && children.length) {
+ children.forEach(d3_layout_packTree);
+ node.r = d3_layout_packCircle(children);
+ } else {
+ node.r = Math.sqrt(node.value);
+ }
+}
+
+function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = (x += k * node.x);
+ node.y = (y += k * node.y);
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+}
+
+function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r,
+ dx = b.x - a.x,
+ dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r,
+ dc = Math.sqrt(dx * dx + dy * dy),
+ cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))),
+ theta = Math.acos(cos),
+ x = cos * (db /= dc),
+ y = Math.sin(theta) * db;
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+}
+// Implements a hierarchical layout using the cluster (or dendrogram)
+// algorithm.
+d3.layout.cluster = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null),
+ separation = d3_layout_treeSeparation,
+ size = [1, 1]; // width, height
+
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i),
+ root = nodes[0],
+ previousNode,
+ x = 0,
+ kx,
+ ky;
+
+ // First walk, computing the initial x & y values.
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+
+ // Compute the left-most, right-most, and depth-most nodes for extents.
+ var left = d3_layout_clusterLeft(root),
+ right = d3_layout_clusterRight(root),
+ x0 = left.x - separation(left, right) / 2,
+ x1 = right.x + separation(right, left) / 2;
+
+ // Second walk, normalizing x & y to the desired size.
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+
+ return nodes;
+ }
+
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+};
+
+function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+}
+
+function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+}
+
+function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+}
+
+function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+}
+// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
+d3.layout.tree = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null),
+ separation = d3_layout_treeSeparation,
+ size = [1, 1]; // width, height
+
+ function tree(d, i) {
+ var nodes = hierarchy.call(this, d, i),
+ root = nodes[0];
+
+ function firstWalk(node, previousSibling) {
+ var children = node.children,
+ layout = node._tree;
+ if (children && (n = children.length)) {
+ var n,
+ firstChild = children[0],
+ previousChild,
+ ancestor = firstChild,
+ child,
+ i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1,
+ n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node,
+ vop = node,
+ vim = previousSibling,
+ vom = node.parent.children[0],
+ sip = vip._tree.mod,
+ sop = vop._tree.mod,
+ sim = vim._tree.mod,
+ som = vom._tree.mod,
+ shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+
+ // Initialize temporary layout variables.
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+
+ // Compute the layout using Buchheim et al.'s algorithm.
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+
+ // Compute the left-most, right-most, and depth-most nodes for extents.
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost),
+ right = d3_layout_treeSearch(root, d3_layout_treeRightmost),
+ deep = d3_layout_treeSearch(root, d3_layout_treeDeepest),
+ x0 = left.x - separation(left, right) / 2,
+ x1 = right.x + separation(right, left) / 2,
+ y1 = deep.depth || 1;
+
+ // Clear temporary layout variables; transform x and y.
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+
+ return nodes;
+ }
+
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+};
+
+function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+}
+
+// function d3_layout_treeSeparationRadial(a, b) {
+// return (a.parent == b.parent ? 1 : 2) / a.depth;
+// }
+
+function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+}
+
+function d3_layout_treeRight(node) {
+ var children = node.children,
+ n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+}
+
+function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child,
+ n,
+ i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+}
+
+function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+}
+
+function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+}
+
+function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+}
+
+function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child,
+ previousChild = null,
+ i = -1,
+ n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+}
+
+function d3_layout_treeShift(node) {
+ var shift = 0,
+ change = 0,
+ children = node.children,
+ i = children.length,
+ child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+}
+
+function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+}
+
+function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent
+ ? vim._tree.ancestor
+ : ancestor;
+}
+// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
+// Modified to support a target aspect ratio by Jeff Heer
+d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(),
+ round = Math.round,
+ size = [1, 1], // width, height
+ padding = null,
+ pad = d3_layout_treemapPadNull,
+ sticky = false,
+ stickies,
+ ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio
+
+ // Compute the area for each child based on value & scale.
+ function scale(children, k) {
+ var i = -1,
+ n = children.length,
+ child,
+ area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+
+ // Recursively arranges the specified node's children into squarified rows.
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node),
+ row = [],
+ remaining = children.slice(), // copy-on-write
+ child,
+ best = Infinity, // the best row score so far
+ score, // the current row score
+ u = Math.min(rect.dx, rect.dy), // initial orientation
+ n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if ((score = worst(row, u)) <= best) { // continue with this orientation
+ remaining.pop();
+ best = score;
+ } else { // abort, and try a different orientation
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+
+ // Recursively resizes the specified node's children into existing rows.
+ // Preserves the existing layout!
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node),
+ remaining = children.slice(), // copy-on-write
+ child,
+ row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+
+ // Computes the score for the specified row, as the worst aspect ratio.
+ function worst(row, u) {
+ var s = row.area,
+ r,
+ rmax = 0,
+ rmin = Infinity,
+ i = -1,
+ n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s
+ ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio))
+ : Infinity;
+ }
+
+ // Positions the specified row of nodes. Modifies `rect`.
+ function position(row, u, rect, flush) {
+ var i = -1,
+ n = row.length,
+ x = rect.x,
+ y = rect.y,
+ v = u ? round(row.area / u) : 0,
+ o;
+ if (u == rect.dx) { // horizontal subdivision
+ if (flush || v > rect.dy) v = rect.dy; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x; // rounding error
+ rect.y += v;
+ rect.dy -= v;
+ } else { // vertical subdivision
+ if (flush || v > rect.dx) v = rect.dx; // over+underflow
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y; // rounding error
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d),
+ root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([root], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+
+ treemap.padding = function(x) {
+ if (!arguments.length) return padding;
+
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null
+ ? d3_layout_treemapPadNull(node)
+ : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p);
+ }
+
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull
+ : (type = typeof x) === "function" ? padFunction
+ : type === "number" ? (x = [x, x, x, x], padConstant)
+ : padConstant;
+ return treemap;
+ };
+
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+};
+
+function d3_layout_treemapPadNull(node) {
+ return {x: node.x, y: node.y, dx: node.dx, dy: node.dy};
+}
+
+function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3],
+ y = node.y + padding[0],
+ dx = node.dx - padding[1] - padding[3],
+ dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) { x += dx / 2; dx = 0; }
+ if (dy < 0) { y += dy / 2; dy = 0; }
+ return {x: x, y: y, dx: dx, dy: dy};
+}
+d3.csv = function(url, callback) {
+ d3.text(url, "text/csv", function(text) {
+ callback(text && d3.csv.parse(text));
+ });
+};
+d3.csv.parse = function(text) {
+ var header;
+ return d3.csv.parseRows(text, function(row, i) {
+ if (i) {
+ var o = {}, j = -1, m = header.length;
+ while (++j < m) o[header[j]] = row[j];
+ return o;
+ } else {
+ header = row;
+ return null;
+ }
+ });
+};
+
+d3.csv.parseRows = function(text, f) {
+ var EOL = {}, // sentinel value for end-of-line
+ EOF = {}, // sentinel value for end-of-file
+ rows = [], // output rows
+ re = /\r\n|[,\r\n]/g, // field separator regex
+ n = 0, // the current line number
+ t, // the current token
+ eol; // is the current token followed by EOL?
+
+ re.lastIndex = 0; // work-around bug in FF 3.6
+
+ /** @private Returns the next token. */
+ function token() {
+ if (re.lastIndex >= text.length) return EOF; // special case: end of file
+ if (eol) { eol = false; return EOL; } // special case: end of line
+
+ // special case: quotes
+ var j = re.lastIndex;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < text.length) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ i++;
+ }
+ }
+ re.lastIndex = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, "\"");
+ }
+
+ // common case
+ var m = re.exec(text);
+ if (m) {
+ eol = m[0].charCodeAt(0) !== 44;
+ return text.substring(j, m.index);
+ }
+ re.lastIndex = text.length;
+ return text.substring(j);
+ }
+
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while ((t !== EOL) && (t !== EOF)) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+
+ return rows;
+};
+d3.csv.format = function(rows) {
+ return rows.map(d3_csv_formatRow).join("\n");
+};
+
+function d3_csv_formatRow(row) {
+ return row.map(d3_csv_formatValue).join(",");
+}
+
+function d3_csv_formatValue(text) {
+ return /[",\n]/.test(text)
+ ? "\"" + text.replace(/\"/g, "\"\"") + "\""
+ : text;
+}
+d3.geo = {};
+
+var d3_geo_radians = Math.PI / 180;
+// TODO clip input coordinates on opposite hemisphere
+d3.geo.azimuthal = function() {
+ var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea
+ origin,
+ scale = 200,
+ translate = [480, 250],
+ x0,
+ y0,
+ cy0,
+ sy0;
+
+ function azimuthal(coordinates) {
+ var x1 = coordinates[0] * d3_geo_radians - x0,
+ y1 = coordinates[1] * d3_geo_radians,
+ cx1 = Math.cos(x1),
+ sx1 = Math.sin(x1),
+ cy1 = Math.cos(y1),
+ sy1 = Math.sin(y1),
+ cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null,
+ c,
+ k = mode === "stereographic" ? 1 / (1 + cc)
+ : mode === "gnomonic" ? 1 / cc
+ : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0)
+ : mode === "equalarea" ? Math.sqrt(2 / (1 + cc))
+ : 1,
+ x = k * cy1 * sx1,
+ y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
+ return [
+ scale * x + translate[0],
+ scale * y + translate[1]
+ ];
+ }
+
+ azimuthal.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale,
+ y = (coordinates[1] - translate[1]) / scale,
+ p = Math.sqrt(x * x + y * y),
+ c = mode === "stereographic" ? 2 * Math.atan(p)
+ : mode === "gnomonic" ? Math.atan(p)
+ : mode === "equidistant" ? p
+ : mode === "equalarea" ? 2 * Math.asin(.5 * p)
+ : Math.asin(p),
+ sc = Math.sin(c),
+ cc = Math.cos(c);
+ return [
+ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians,
+ Math.asin(cc * sy0 - (p ? (y * sc * cy0) / p : 0)) / d3_geo_radians
+ ];
+ };
+
+ azimuthal.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return azimuthal;
+ };
+
+ azimuthal.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ x0 = origin[0] * d3_geo_radians;
+ y0 = origin[1] * d3_geo_radians;
+ cy0 = Math.cos(y0);
+ sy0 = Math.sin(y0);
+ return azimuthal;
+ };
+
+ azimuthal.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return azimuthal;
+ };
+
+ azimuthal.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [+x[0], +x[1]];
+ return azimuthal;
+ };
+
+ return azimuthal.origin([0, 0]);
+};
+// Derived from Tom Carden's Albers implementation for Protovis.
+// http://gist.github.com/476238
+// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html
+
+d3.geo.albers = function() {
+ var origin = [-98, 38],
+ parallels = [29.5, 45.5],
+ scale = 1000,
+ translate = [480, 250],
+ lng0, // d3_geo_radians * origin[0]
+ n,
+ C,
+ p0;
+
+ function albers(coordinates) {
+ var t = n * (d3_geo_radians * coordinates[0] - lng0),
+ p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
+ return [
+ scale * p * Math.sin(t) + translate[0],
+ scale * (p * Math.cos(t) - p0) + translate[1]
+ ];
+ }
+
+ albers.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale,
+ y = (coordinates[1] - translate[1]) / scale,
+ p0y = p0 + y,
+ t = Math.atan2(x, p0y),
+ p = Math.sqrt(x * x + p0y * p0y);
+ return [
+ (lng0 + t / n) / d3_geo_radians,
+ Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians
+ ];
+ };
+
+ function reload() {
+ var phi1 = d3_geo_radians * parallels[0],
+ phi2 = d3_geo_radians * parallels[1],
+ lat0 = d3_geo_radians * origin[1],
+ s = Math.sin(phi1),
+ c = Math.cos(phi1);
+ lng0 = d3_geo_radians * origin[0];
+ n = .5 * (s + Math.sin(phi2));
+ C = c * c + 2 * n * s;
+ p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
+ return albers;
+ }
+
+ albers.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = [+x[0], +x[1]];
+ return reload();
+ };
+
+ albers.parallels = function(x) {
+ if (!arguments.length) return parallels;
+ parallels = [+x[0], +x[1]];
+ return reload();
+ };
+
+ albers.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return albers;
+ };
+
+ albers.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [+x[0], +x[1]];
+ return albers;
+ };
+
+ return reload();
+};
+
+// A composite projection for the United States, 960x500. The set of standard
+// parallels for each region comes from USGS, which is published here:
+// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
+// TODO allow the composite projection to be rescaled?
+d3.geo.albersUsa = function() {
+ var lower48 = d3.geo.albers();
+
+ var alaska = d3.geo.albers()
+ .origin([-160, 60])
+ .parallels([55, 65]);
+
+ var hawaii = d3.geo.albers()
+ .origin([-160, 20])
+ .parallels([8, 18]);
+
+ var puertoRico = d3.geo.albers()
+ .origin([-60, 10])
+ .parallels([8, 18]);
+
+ function albersUsa(coordinates) {
+ var lon = coordinates[0],
+ lat = coordinates[1];
+ return (lat > 50 ? alaska
+ : lon < -140 ? hawaii
+ : lat < 21 ? puertoRico
+ : lower48)(coordinates);
+ }
+
+ albersUsa.scale = function(x) {
+ if (!arguments.length) return lower48.scale();
+ lower48.scale(x);
+ alaska.scale(x * .6);
+ hawaii.scale(x);
+ puertoRico.scale(x * 1.5);
+ return albersUsa.translate(lower48.translate());
+ };
+
+ albersUsa.translate = function(x) {
+ if (!arguments.length) return lower48.translate();
+ var dz = lower48.scale() / 1000,
+ dx = x[0],
+ dy = x[1];
+ lower48.translate(x);
+ alaska.translate([dx - 400 * dz, dy + 170 * dz]);
+ hawaii.translate([dx - 190 * dz, dy + 200 * dz]);
+ puertoRico.translate([dx + 580 * dz, dy + 430 * dz]);
+ return albersUsa;
+ };
+
+ return albersUsa.scale(lower48.scale());
+};
+d3.geo.bonne = function() {
+ var scale = 200,
+ translate = [480, 250],
+ x0, // origin longitude in radians
+ y0, // origin latitude in radians
+ y1, // parallel latitude in radians
+ c1; // cot(y1)
+
+ function bonne(coordinates) {
+ var x = coordinates[0] * d3_geo_radians - x0,
+ y = coordinates[1] * d3_geo_radians - y0;
+ if (y1) {
+ var p = c1 + y1 - y, E = x * Math.cos(y) / p;
+ x = p * Math.sin(E);
+ y = p * Math.cos(E) - c1;
+ } else {
+ x *= Math.cos(y);
+ y *= -1;
+ }
+ return [
+ scale * x + translate[0],
+ scale * y + translate[1]
+ ];
+ }
+
+ bonne.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale,
+ y = (coordinates[1] - translate[1]) / scale;
+ if (y1) {
+ var c = c1 + y, p = Math.sqrt(x * x + c * c);
+ y = c1 + y1 - p;
+ x = x0 + p * Math.atan2(x, c) / Math.cos(y);
+ } else {
+ y *= -1;
+ x /= Math.cos(y);
+ }
+ return [
+ x / d3_geo_radians,
+ y / d3_geo_radians
+ ];
+ };
+
+ // 90° for Werner, 0° for Sinusoidal
+ bonne.parallel = function(x) {
+ if (!arguments.length) return y1 / d3_geo_radians;
+ c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
+ return bonne;
+ };
+
+ bonne.origin = function(x) {
+ if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians];
+ x0 = x[0] * d3_geo_radians;
+ y0 = x[1] * d3_geo_radians;
+ return bonne;
+ };
+
+ bonne.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return bonne;
+ };
+
+ bonne.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [+x[0], +x[1]];
+ return bonne;
+ };
+
+ return bonne.origin([0, 0]).parallel(45);
+};
+d3.geo.equirectangular = function() {
+ var scale = 500,
+ translate = [480, 250];
+
+ function equirectangular(coordinates) {
+ var x = coordinates[0] / 360,
+ y = -coordinates[1] / 360;
+ return [
+ scale * x + translate[0],
+ scale * y + translate[1]
+ ];
+ }
+
+ equirectangular.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale,
+ y = (coordinates[1] - translate[1]) / scale;
+ return [
+ 360 * x,
+ -360 * y
+ ];
+ };
+
+ equirectangular.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return equirectangular;
+ };
+
+ equirectangular.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [+x[0], +x[1]];
+ return equirectangular;
+ };
+
+ return equirectangular;
+};
+d3.geo.mercator = function() {
+ var scale = 500,
+ translate = [480, 250];
+
+ function mercator(coordinates) {
+ var x = coordinates[0] / 360,
+ y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
+ return [
+ scale * x + translate[0],
+ scale * Math.max(-.5, Math.min(.5, y)) + translate[1]
+ ];
+ }
+
+ mercator.invert = function(coordinates) {
+ var x = (coordinates[0] - translate[0]) / scale,
+ y = (coordinates[1] - translate[1]) / scale;
+ return [
+ 360 * x,
+ 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90
+ ];
+ };
+
+ mercator.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ return mercator;
+ };
+
+ mercator.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = [+x[0], +x[1]];
+ return mercator;
+ };
+
+ return mercator;
+};
+function d3_geo_type(types, defaultValue) {
+ return function(object) {
+ return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
+ };
+}
+/**
+ * Returns a function that, given a GeoJSON object (e.g., a feature), returns
+ * the corresponding SVG path. The function can be customized by overriding the
+ * projection. Point features are mapped to circles with a default radius of
+ * 4.5px; the radius can be specified either as a constant or a function that
+ * is evaluated per object.
+ */
+d3.geo.path = function() {
+ var pointRadius = 4.5,
+ pointCircle = d3_path_circle(pointRadius),
+ projection = d3.geo.albersUsa();
+
+ function path(d, i) {
+ if (typeof pointRadius === "function") {
+ pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
+ }
+ return pathType(d) || null;
+ }
+
+ function project(coordinates) {
+ return projection(coordinates).join(",");
+ }
+
+ var pathType = d3_geo_type({
+
+ FeatureCollection: function(o) {
+ var path = [],
+ features = o.features,
+ i = -1, // features.index
+ n = features.length;
+ while (++i < n) path.push(pathType(features[i].geometry));
+ return path.join("");
+ },
+
+ Feature: function(o) {
+ return pathType(o.geometry);
+ },
+
+ Point: function(o) {
+ return "M" + project(o.coordinates) + pointCircle;
+ },
+
+ MultiPoint: function(o) {
+ var path = [],
+ coordinates = o.coordinates,
+ i = -1, // coordinates.index
+ n = coordinates.length;
+ while (++i < n) path.push("M", project(coordinates[i]), pointCircle);
+ return path.join("");
+ },
+
+ LineString: function(o) {
+ var path = ["M"],
+ coordinates = o.coordinates,
+ i = -1, // coordinates.index
+ n = coordinates.length;
+ while (++i < n) path.push(project(coordinates[i]), "L");
+ path.pop();
+ return path.join("");
+ },
+
+ MultiLineString: function(o) {
+ var path = [],
+ coordinates = o.coordinates,
+ i = -1, // coordinates.index
+ n = coordinates.length,
+ subcoordinates, // coordinates[i]
+ j, // subcoordinates.index
+ m; // subcoordinates.length
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ path.push("M");
+ while (++j < m) path.push(project(subcoordinates[j]), "L");
+ path.pop();
+ }
+ return path.join("");
+ },
+
+ Polygon: function(o) {
+ var path = [],
+ coordinates = o.coordinates,
+ i = -1, // coordinates.index
+ n = coordinates.length,
+ subcoordinates, // coordinates[i]
+ j, // subcoordinates.index
+ m; // subcoordinates.length
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ if ((m = subcoordinates.length - 1) > 0) {
+ path.push("M");
+ while (++j < m) path.push(project(subcoordinates[j]), "L");
+ path[path.length - 1] = "Z";
+ }
+ }
+ return path.join("");
+ },
+
+ MultiPolygon: function(o) {
+ var path = [],
+ coordinates = o.coordinates,
+ i = -1, // coordinates index
+ n = coordinates.length,
+ subcoordinates, // coordinates[i]
+ j, // subcoordinates index
+ m, // subcoordinates.length
+ subsubcoordinates, // subcoordinates[j]
+ k, // subsubcoordinates index
+ p; // subsubcoordinates.length
+ while (++i < n) {
+ subcoordinates = coordinates[i];
+ j = -1;
+ m = subcoordinates.length;
+ while (++j < m) {
+ subsubcoordinates = subcoordinates[j];
+ k = -1;
+ if ((p = subsubcoordinates.length - 1) > 0) {
+ path.push("M");
+ while (++k < p) path.push(project(subsubcoordinates[k]), "L");
+ path[path.length - 1] = "Z";
+ }
+ }
+ }
+ return path.join("");
+ },
+
+ GeometryCollection: function(o) {
+ var path = [],
+ geometries = o.geometries,
+ i = -1, // geometries index
+ n = geometries.length;
+ while (++i < n) path.push(pathType(geometries[i]));
+ return path.join("");
+ }
+
+ });
+
+ var areaType = path.area = d3_geo_type({
+
+ FeatureCollection: function(o) {
+ var area = 0,
+ features = o.features,
+ i = -1, // features.index
+ n = features.length;
+ while (++i < n) area += areaType(features[i]);
+ return area;
+ },
+
+ Feature: function(o) {
+ return areaType(o.geometry);
+ },
+
+ Polygon: function(o) {
+ return polygonArea(o.coordinates);
+ },
+
+ MultiPolygon: function(o) {
+ var sum = 0,
+ coordinates = o.coordinates,
+ i = -1, // coordinates index
+ n = coordinates.length;
+ while (++i < n) sum += polygonArea(coordinates[i]);
+ return sum;
+ },
+
+ GeometryCollection: function(o) {
+ var sum = 0,
+ geometries = o.geometries,
+ i = -1, // geometries index
+ n = geometries.length;
+ while (++i < n) sum += areaType(geometries[i]);
+ return sum;
+ }
+
+ }, 0);
+
+ function polygonArea(coordinates) {
+ var sum = area(coordinates[0]), // exterior ring
+ i = 0, // coordinates.index
+ n = coordinates.length;
+ while (++i < n) sum -= area(coordinates[i]); // holes
+ return sum;
+ }
+
+ function polygonCentroid(coordinates) {
+ var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring
+ area = polygon.area(),
+ centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1),
+ x = centroid[0],
+ y = centroid[1],
+ z = area,
+ i = 0, // coordinates index
+ n = coordinates.length;
+ while (++i < n) {
+ polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes
+ area = polygon.area();
+ centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
+ x -= centroid[0];
+ y -= centroid[1];
+ z -= area;
+ }
+ return [x, y, 6 * z]; // weighted centroid
+ }
+
+ var centroidType = path.centroid = d3_geo_type({
+
+ // TODO FeatureCollection
+ // TODO Point
+ // TODO MultiPoint
+ // TODO LineString
+ // TODO MultiLineString
+ // TODO GeometryCollection
+
+ Feature: function(o) {
+ return centroidType(o.geometry);
+ },
+
+ Polygon: function(o) {
+ var centroid = polygonCentroid(o.coordinates);
+ return [centroid[0] / centroid[2], centroid[1] / centroid[2]];
+ },
+
+ MultiPolygon: function(o) {
+ var area = 0,
+ coordinates = o.coordinates,
+ centroid,
+ x = 0,
+ y = 0,
+ z = 0,
+ i = -1, // coordinates index
+ n = coordinates.length;
+ while (++i < n) {
+ centroid = polygonCentroid(coordinates[i]);
+ x += centroid[0];
+ y += centroid[1];
+ z += centroid[2];
+ }
+ return [x / z, y / z];
+ }
+
+ });
+
+ function area(coordinates) {
+ return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
+ }
+
+ path.projection = function(x) {
+ projection = x;
+ return path;
+ };
+
+ path.pointRadius = function(x) {
+ if (typeof x === "function") pointRadius = x;
+ else {
+ pointRadius = +x;
+ pointCircle = d3_path_circle(pointRadius);
+ }
+ return path;
+ };
+
+ return path;
+};
+
+function d3_path_circle(radius) {
+ return "m0," + radius
+ + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius)
+ + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius)
+ + "z";
+}
+/**
+ * Given a GeoJSON object, returns the corresponding bounding box. The bounding
+ * box is represented by a two-dimensional array: [[left, bottom], [right,
+ * top]], where left is the minimum longitude, bottom is the minimum latitude,
+ * right is maximum longitude, and top is the maximum latitude.
+ */
+d3.geo.bounds = function(feature) {
+ var left = Infinity,
+ bottom = Infinity,
+ right = -Infinity,
+ top = -Infinity;
+ d3_geo_bounds(feature, function(x, y) {
+ if (x < left) left = x;
+ if (x > right) right = x;
+ if (y < bottom) bottom = y;
+ if (y > top) top = y;
+ });
+ return [[left, bottom], [right, top]];
+};
+
+function d3_geo_bounds(o, f) {
+ if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
+}
+
+var d3_geo_boundsTypes = {
+ Feature: d3_geo_boundsFeature,
+ FeatureCollection: d3_geo_boundsFeatureCollection,
+ GeometryCollection: d3_geo_boundsGeometryCollection,
+ LineString: d3_geo_boundsLineString,
+ MultiLineString: d3_geo_boundsMultiLineString,
+ MultiPoint: d3_geo_boundsLineString,
+ MultiPolygon: d3_geo_boundsMultiPolygon,
+ Point: d3_geo_boundsPoint,
+ Polygon: d3_geo_boundsPolygon
+};
+
+function d3_geo_boundsFeature(o, f) {
+ d3_geo_bounds(o.geometry, f);
+}
+
+function d3_geo_boundsFeatureCollection(o, f) {
+ for (var a = o.features, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i].geometry, f);
+ }
+}
+
+function d3_geo_boundsGeometryCollection(o, f) {
+ for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i], f);
+ }
+}
+
+function d3_geo_boundsLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+}
+
+function d3_geo_boundsMultiLineString(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+}
+
+function d3_geo_boundsMultiPolygon(o, f) {
+ for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
+ for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
+ f.apply(null, b[j]);
+ }
+ }
+}
+
+function d3_geo_boundsPoint(o, f) {
+ f.apply(null, o.coordinates);
+}
+
+function d3_geo_boundsPolygon(o, f) {
+ for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
+ f.apply(null, a[i]);
+ }
+}
+// TODO breakAtDateLine?
+
+d3.geo.circle = function() {
+ var origin = [0, 0],
+ degrees = 90 - 1e-2,
+ radians = degrees * d3_geo_radians,
+ arc = d3.geo.greatArc().target(d3_identity);
+
+ function circle() {
+ // TODO render a circle as a Polygon
+ }
+
+ function visible(point) {
+ return arc.distance(point) < radians;
+ }
+
+ circle.clip = function(d) {
+ arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin);
+ return clipType(d);
+ };
+
+ var clipType = d3_geo_type({
+
+ FeatureCollection: function(o) {
+ var features = o.features.map(clipType).filter(d3_identity);
+ return features && (o = Object.create(o), o.features = features, o);
+ },
+
+ Feature: function(o) {
+ var geometry = clipType(o.geometry);
+ return geometry && (o = Object.create(o), o.geometry = geometry, o);
+ },
+
+ Point: function(o) {
+ return visible(o.coordinates) && o;
+ },
+
+ MultiPoint: function(o) {
+ var coordinates = o.coordinates.filter(visible);
+ return coordinates.length && {
+ type: o.type,
+ coordinates: coordinates
+ };
+ },
+
+ LineString: function(o) {
+ var coordinates = clip(o.coordinates);
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+
+ MultiLineString: function(o) {
+ var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+
+ Polygon: function(o) {
+ var coordinates = o.coordinates.map(clip);
+ return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+
+ MultiPolygon: function(o) {
+ var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; });
+ return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
+ },
+
+ GeometryCollection: function(o) {
+ var geometries = o.geometries.map(clipType).filter(d3_identity);
+ return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
+ }
+
+ });
+
+ function clip(coordinates) {
+ var i = -1,
+ n = coordinates.length,
+ clipped = [],
+ p0,
+ p1,
+ p2,
+ d0,
+ d1;
+
+ while (++i < n) {
+ d1 = arc.distance(p2 = coordinates[i]);
+ if (d1 < radians) {
+ if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
+ clipped.push(p2);
+ p0 = p1 = null;
+ } else {
+ p1 = p2;
+ if (!p0 && clipped.length) {
+ clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
+ p0 = p1;
+ }
+ }
+ d0 = d1;
+ }
+
+ if (p1 && clipped.length) {
+ d1 = arc.distance(p2 = clipped[0]);
+ clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
+ }
+
+ return resample(clipped);
+ }
+
+ // Resample coordinates, creating great arcs between each.
+ function resample(coordinates) {
+ var i = 0,
+ n = coordinates.length,
+ j,
+ m,
+ resampled = n ? [coordinates[0]] : coordinates,
+ resamples,
+ origin = arc.source();
+
+ while (++i < n) {
+ resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
+ for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]);
+ }
+
+ arc.source(origin);
+ return resampled;
+ }
+
+ circle.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return circle;
+ };
+
+ circle.angle = function(x) {
+ if (!arguments.length) return degrees;
+ radians = (degrees = +x) * d3_geo_radians;
+ return circle;
+ };
+
+ // Precision is specified in degrees.
+ circle.precision = function(x) {
+ if (!arguments.length) return arc.precision();
+ arc.precision(x);
+ return circle;
+ };
+
+ return circle;
+}
+d3.geo.greatArc = function() {
+ var source = d3_geo_greatArcSource,
+ target = d3_geo_greatArcTarget,
+ precision = 6 * d3_geo_radians;
+
+ function greatArc() {
+ var a = typeof source === "function" ? source.apply(this, arguments) : source,
+ b = typeof target === "function" ? target.apply(this, arguments) : target,
+ i = d3_geo_greatArcInterpolate(a, b),
+ dt = precision / i.d,
+ t = 0,
+ coordinates = [a];
+ while ((t += dt) < 1) coordinates.push(i(t));
+ coordinates.push(b);
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ }
+
+ // Length returned in radians; multiply by radius for distance.
+ greatArc.distance = function() {
+ var a = typeof source === "function" ? source.apply(this, arguments) : source,
+ b = typeof target === "function" ? target.apply(this, arguments) : target;
+ return d3_geo_greatArcInterpolate(a, b).d;
+ };
+
+ greatArc.source = function(x) {
+ if (!arguments.length) return source;
+ source = x;
+ return greatArc;
+ };
+
+ greatArc.target = function(x) {
+ if (!arguments.length) return target;
+ target = x;
+ return greatArc;
+ };
+
+ // Precision is specified in degrees.
+ greatArc.precision = function(x) {
+ if (!arguments.length) return precision / d3_geo_radians;
+ precision = x * d3_geo_radians;
+ return greatArc;
+ };
+
+ return greatArc;
+};
+
+function d3_geo_greatArcSource(d) {
+ return d.source;
+}
+
+function d3_geo_greatArcTarget(d) {
+ return d.target;
+}
+
+function d3_geo_greatArcInterpolate(a, b) {
+ var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0),
+ y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0),
+ x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1),
+ y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1),
+ d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))),
+ sd = Math.sin(d);
+
+ // From http://williams.best.vwh.net/avform.htm#Intermediate
+ function interpolate(t) {
+ var A = Math.sin(d - (t *= d)) / sd,
+ B = Math.sin(t) / sd,
+ x = A * cy0 * cx0 + B * cy1 * cx1,
+ y = A * cy0 * sx0 + B * cy1 * sx1,
+ z = A * sy0 + B * sy1;
+ return [
+ Math.atan2(y, x) / d3_geo_radians,
+ Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians
+ ];
+ }
+
+ return interpolate;
+}
+d3.geo.greatCircle = d3.geo.circle;
+d3.geom = {};
+/**
+ * Computes a contour for a given input grid function using the marching
+ * squares algorithm. Returns the contour polygon as an array of points.
+ *
+ * @param grid a two-input function(x, y) that returns true for values
+ * inside the contour and false for values outside the contour.
+ * @param start an optional starting point [x, y] on the grid.
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.contour = function(grid, start) {
+ var s = start || d3_geom_contourStart(grid), // starting point
+ c = [], // contour polygon
+ x = s[0], // current x position
+ y = s[1], // current y position
+ dx = 0, // next x direction
+ dy = 0, // next y direction
+ pdx = NaN, // previous x direction
+ pdy = NaN, // previous y direction
+ i = 0;
+
+ do {
+ // determine marching squares index
+ i = 0;
+ if (grid(x-1, y-1)) i += 1;
+ if (grid(x, y-1)) i += 2;
+ if (grid(x-1, y )) i += 4;
+ if (grid(x, y )) i += 8;
+
+ // determine next direction
+ if (i === 6) {
+ dx = pdy === -1 ? -1 : 1;
+ dy = 0;
+ } else if (i === 9) {
+ dx = 0;
+ dy = pdx === 1 ? -1 : 1;
+ } else {
+ dx = d3_geom_contourDx[i];
+ dy = d3_geom_contourDy[i];
+ }
+
+ // update contour polygon
+ if (dx != pdx && dy != pdy) {
+ c.push([x, y]);
+ pdx = dx;
+ pdy = dy;
+ }
+
+ x += dx;
+ y += dy;
+ } while (s[0] != x || s[1] != y);
+
+ return c;
+};
+
+// lookup tables for marching directions
+var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
+ d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
+
+function d3_geom_contourStart(grid) {
+ var x = 0,
+ y = 0;
+
+ // search for a starting point; begin at origin
+ // and proceed along outward-expanding diagonals
+ while (true) {
+ if (grid(x,y)) {
+ return [x,y];
+ }
+ if (x === 0) {
+ x = y + 1;
+ y = 0;
+ } else {
+ x = x - 1;
+ y = y + 1;
+ }
+ }
+}
+/**
+ * Computes the 2D convex hull of a set of points using Graham's scanning
+ * algorithm. The algorithm has been implemented as described in Cormen,
+ * Leiserson, and Rivest's Introduction to Algorithms. The running time of
+ * this algorithm is O(n log n), where n is the number of input points.
+ *
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygon [[x1, y1], [x2, y2], …]
+ */
+d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+
+ var len = vertices.length,
+ plen = len - 1,
+ points = [],
+ stack = [],
+ i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+
+ // find the starting ref point: leftmost point with the minimum y coord
+ for (i=1; i= (x2*x2 + y2*y2)) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+
+ // initialize the stack
+ stack.push(h);
+ for (i=0, j=0; i<2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+
+ // do graham's scan
+ for (; j 0;
+}
+// Note: requires coordinates to be counterclockwise and convex!
+d3.geom.polygon = function(coordinates) {
+
+ coordinates.area = function() {
+ var i = 0,
+ n = coordinates.length,
+ a = coordinates[n - 1][0] * coordinates[0][1],
+ b = coordinates[n - 1][1] * coordinates[0][0];
+ while (++i < n) {
+ a += coordinates[i - 1][0] * coordinates[i][1];
+ b += coordinates[i - 1][1] * coordinates[i][0];
+ }
+ return (b - a) * .5;
+ };
+
+ coordinates.centroid = function(k) {
+ var i = -1,
+ n = coordinates.length,
+ x = 0,
+ y = 0,
+ a,
+ b = coordinates[n - 1],
+ c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = b;
+ b = coordinates[i];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [x * k, y * k];
+ };
+
+ // The Sutherland-Hodgman clipping algorithm.
+ coordinates.clip = function(subject) {
+ var input,
+ i = -1,
+ n = coordinates.length,
+ j,
+ m,
+ a = coordinates[n - 1],
+ b,
+ c,
+ d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+
+ return coordinates;
+};
+
+function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+}
+
+// Intersect two infinite lines cd and ab.
+function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
+ y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
+ x13 = x1 - x3,
+ x21 = x2 - x1,
+ x43 = x4 - x3,
+ y13 = y1 - y3,
+ y21 = y2 - y1,
+ y43 = y4 - y3,
+ ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
+ return [x1 + ua * x21, y1 + ua * y21];
+}
+// Adapted from Nicolas Garcia Belmonte's JIT implementation:
+// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
+// http://blog.thejit.org/assets/voronoijs/voronoi.js
+// See lib/jit/LICENSE for details.
+
+// Notes:
+//
+// This implementation does not clip the returned polygons, so if you want to
+// clip them to a particular shape you will need to do that either in SVG or by
+// post-processing with d3.geom.polygon's clip method.
+//
+// If any vertices are coincident or have NaN positions, the behavior of this
+// method is undefined. Most likely invalid polygons will be returned. You
+// should filter invalid points, and consolidate coincident points, before
+// computing the tessellation.
+
+/**
+ * @param vertices [[x1, y1], [x2, y2], …]
+ * @returns polygons [[[x1, y1], [x2, y2], …], …]
+ */
+d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() { return []; });
+
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1,
+ s2,
+ x1,
+ x2,
+ y1,
+ y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -1e6;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : 1e6;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -1e6;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : 1e6;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [x1, y1],
+ v2 = [x2, y2];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+
+ // Reconnect the polygon segments into counterclockwise loops.
+ return polygons.map(function(polygon, i) {
+ var cx = vertices[i][0],
+ cy = vertices[i][1];
+ polygon.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ return polygon.sort(function(a, b) {
+ return a.angle - b.angle;
+ }).filter(function(d, i) {
+ return !i || (d.angle - polygon[i - 1].angle > 1e-10);
+ });
+ });
+};
+
+var d3_voronoi_opposite = {"l": "r", "r": "l"};
+
+function d3_voronoi_tessellate(vertices, callback) {
+
+ var Sites = {
+ list: vertices
+ .map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ })
+ .sort(function(a, b) {
+ return a.y < b.y ? -1
+ : a.y > b.y ? 1
+ : a.x < b.x ? -1
+ : a.x > b.x ? 1
+ : 0;
+ }),
+ bottomSite: null
+ };
+
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ "l": null,
+ "r": null
+ };
+ },
+
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+
+ right: function(he) {
+ return he.r;
+ },
+
+ left: function(he) {
+ return he.l;
+ },
+
+ leftRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[he.side];
+ },
+
+ rightRegion: function(he) {
+ return he.edge == null
+ ? Sites.bottomSite
+ : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+
+ var Geom = {
+
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {"l": s1, "r": s2},
+ ep: {"l": null, "r": null}
+ };
+
+ var dx = s2.x - s1.x,
+ dy = s2.y - s1.y,
+ adx = dx > 0 ? dx : -dx,
+ ady = dy > 0 ? dy : -dy;
+
+ newEdge.c = s1.x * dx + s1.y * dy
+ + (dx * dx + dy * dy) * .5;
+
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+
+ return newEdge;
+ },
+
+ intersect: function(el1, el2) {
+ var e1 = el1.edge,
+ e2 = el2.edge;
+ if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
+ return null;
+ }
+ var d = (e1.a * e2.b) - (e1.b * e2.a);
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d,
+ yint = (e2.c * e1.a - e1.c * e2.a) / d,
+ e1r = e1.region.r,
+ e2r = e2.region.r,
+ el,
+ e;
+ if ((e1r.y < e2r.y) ||
+ (e1r.y == e2r.y && e1r.x < e2r.x)) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = (xint >= e.region.r.x);
+ if ((rightOfSite && (el.side === "l")) ||
+ (!rightOfSite && (el.side === "r"))) {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+
+ rightOf: function(he, p) {
+ var e = he.edge,
+ topsite = e.region.r,
+ rightOfSite = (p.x > topsite.x);
+
+ if (rightOfSite && (he.side === "l")) {
+ return 1;
+ }
+ if (!rightOfSite && (he.side === "r")) {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y,
+ dxp = p.x - topsite.x,
+ fast = 0,
+ above = 0;
+
+ if ((!rightOfSite && (e.b < 0)) ||
+ (rightOfSite && (e.b >= 0))) {
+ above = fast = (dyp >= e.b * dxp);
+ } else {
+ above = ((p.x + p.y * e.b) > e.c);
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = (e.b * (dxp * dxp - dyp * dyp)) <
+ (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
+
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else /* e.b == 1 */ {
+ var yl = e.c - e.a * p.x,
+ t1 = p.y - yl,
+ t2 = p.x - topsite.x,
+ t3 = yl - topsite.y;
+
+ above = (t1 * t1) > (t2 * t2 + t3 * t3);
+ }
+ return he.side === "l" ? above : !above;
+ },
+
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+
+ distance: function(s, t) {
+ var dx = s.x - t.x,
+ dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+
+ var EventQueue = {
+ list: [],
+
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i=0, list=EventQueue.list, l=list.length; i next.ystar ||
+ (he.ystar == next.ystar &&
+ site.x > next.vertex.x)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+
+ del: function(he) {
+ for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }//end while
+
+ for (lbnd = EdgeList.right(EdgeList.leftEnd);
+ lbnd != EdgeList.rightEnd;
+ lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+}
+/**
+* @param vertices [[x1, y1], [x2, y2], …]
+* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …]
+ */
+d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() { return []; }),
+ triangles = [];
+
+ // Use the Voronoi tessellation to determine Delaunay edges.
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+
+ // Reconnect the edges into counterclockwise triangles.
+ edges.forEach(function(edge, i) {
+ var v = vertices[i],
+ cx = v[0],
+ cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([v, edge[j], edge[j + 1]]);
+ }
+ });
+
+ return triangles;
+};
+// Constructs a new quadtree for the specified array of points. A quadtree is a
+// two-dimensional recursive spatial subdivision. This implementation uses
+// square partitions, dividing each square into four equally-sized squares. Each
+// point exists in a unique node; if multiple points are in the same position,
+// some points may be stored on internal nodes rather than leaf nodes. Quadtrees
+// can be used to accelerate various spatial operations, such as the Barnes-Hut
+// approximation for computing n-body forces, or collision detection.
+d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ var p,
+ i = -1,
+ n = points.length;
+
+ // Type conversion for deprecated API.
+ if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
+
+ // Allow bounds to be specified explicitly.
+ if (arguments.length < 5) {
+ if (arguments.length === 3) {
+ y2 = x2 = y1;
+ y1 = x1;
+ } else {
+ x1 = y1 = Infinity;
+ x2 = y2 = -Infinity;
+
+ // Compute bounds.
+ while (++i < n) {
+ p = points[i];
+ if (p.x < x1) x1 = p.x;
+ if (p.y < y1) y1 = p.y;
+ if (p.x > x2) x2 = p.x;
+ if (p.y > y2) y2 = p.y;
+ }
+
+ // Squarify the bounds.
+ var dx = x2 - x1,
+ dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx;
+ else x2 = x1 + dy;
+ }
+ }
+
+ // Recursively inserts the specified point p at the node n or one of its
+ // descendants. The bounds are defined by [x1, x2] and [y1, y2].
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ // If the point at this leaf node is at the same position as the new
+ // point we are adding, we leave the point associated with the
+ // internal node while adding the new point to a child node. This
+ // avoids infinite recursion.
+ if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+
+ // Recursively inserts the specified point p into a descendant of node n. The
+ // bounds are defined by [x1, x2] and [y1, y2].
+ function insertChild(n, p, x1, y1, x2, y2) {
+ // Compute the split point, and the quadrant in which to insert p.
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ right = p.x >= sx,
+ bottom = p.y >= sy,
+ i = (bottom << 1) + right;
+
+ // Recursively insert into the child node.
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+
+ // Update the bounds as we recurse.
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+
+ // Create the root node.
+ var root = d3_geom_quadtreeNode();
+
+ root.add = function(p) {
+ insert(root, p, x1, y1, x2, y2);
+ };
+
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+
+ // Insert all points.
+ points.forEach(root.add);
+ return root;
+};
+
+function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+}
+
+function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5,
+ sy = (y1 + y2) * .5,
+ children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+}
+
+function d3_geom_quadtreePoint(p) {
+ return {
+ x: p[0],
+ y: p[1]
+ };
+}
+d3.time = {};
+
+var d3_time = Date;
+
+function d3_time_utc() {
+ this._ = new Date(arguments.length > 1
+ ? Date.UTC.apply(this, arguments)
+ : arguments[0]);
+}
+
+d3_time_utc.prototype = {
+ getDate: function() { return this._.getUTCDate(); },
+ getDay: function() { return this._.getUTCDay(); },
+ getFullYear: function() { return this._.getUTCFullYear(); },
+ getHours: function() { return this._.getUTCHours(); },
+ getMilliseconds: function() { return this._.getUTCMilliseconds(); },
+ getMinutes: function() { return this._.getUTCMinutes(); },
+ getMonth: function() { return this._.getUTCMonth(); },
+ getSeconds: function() { return this._.getUTCSeconds(); },
+ getTime: function() { return this._.getTime(); },
+ getTimezoneOffset: function() { return 0; },
+ valueOf: function() { return this._.valueOf(); },
+ setDate: function() { d3_time_prototype.setUTCDate.apply(this._, arguments); },
+ setDay: function() { d3_time_prototype.setUTCDay.apply(this._, arguments); },
+ setFullYear: function() { d3_time_prototype.setUTCFullYear.apply(this._, arguments); },
+ setHours: function() { d3_time_prototype.setUTCHours.apply(this._, arguments); },
+ setMilliseconds: function() { d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); },
+ setMinutes: function() { d3_time_prototype.setUTCMinutes.apply(this._, arguments); },
+ setMonth: function() { d3_time_prototype.setUTCMonth.apply(this._, arguments); },
+ setSeconds: function() { d3_time_prototype.setUTCSeconds.apply(this._, arguments); },
+ setTime: function() { d3_time_prototype.setTime.apply(this._, arguments); }
+};
+
+var d3_time_prototype = Date.prototype;
+d3.time.format = function(template) {
+ var n = template.length;
+
+ function format(date) {
+ var string = [],
+ i = -1,
+ j = 0,
+ c,
+ f;
+ while (++i < n) {
+ if (template.charCodeAt(i) == 37) {
+ string.push(
+ template.substring(j, i),
+ (f = d3_time_formats[c = template.charAt(++i)])
+ ? f(date) : c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+
+ format.parse = function(string) {
+ var d = {y: 1900, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0},
+ i = d3_time_parse(d, template, string, 0);
+ if (i != string.length) return null;
+
+ // The am-pm flag is 0 for AM, and 1 for PM.
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
+
+ var date = new d3_time();
+ date.setFullYear(d.y, d.m, d.d);
+ date.setHours(d.H, d.M, d.S, d.L);
+ return date;
+ };
+
+ format.toString = function() {
+ return template;
+ };
+
+ return format;
+};
+
+function d3_time_parse(date, template, string, j) {
+ var c,
+ p,
+ i = 0,
+ n = template.length,
+ m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c == 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || ((j = p(date, string, j)) < 0)) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+}
+
+var d3_time_zfill2 = d3.format("02d"),
+ d3_time_zfill3 = d3.format("03d"),
+ d3_time_zfill4 = d3.format("04d"),
+ d3_time_sfill2 = d3.format("2d");
+
+var d3_time_formats = {
+ a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); },
+ A: function(d) { return d3_time_weekdays[d.getDay()]; },
+ b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); },
+ B: function(d) { return d3_time_months[d.getMonth()]; },
+ c: d3.time.format("%a %b %e %H:%M:%S %Y"),
+ d: function(d) { return d3_time_zfill2(d.getDate()); },
+ e: function(d) { return d3_time_sfill2(d.getDate()); },
+ H: function(d) { return d3_time_zfill2(d.getHours()); },
+ I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); },
+ j: function(d) { return d3_time_zfill3(1 + d3.time.dayOfYear(d)); },
+ L: function(d) { return d3_time_zfill3(d.getMilliseconds()); },
+ m: function(d) { return d3_time_zfill2(d.getMonth() + 1); },
+ M: function(d) { return d3_time_zfill2(d.getMinutes()); },
+ p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; },
+ S: function(d) { return d3_time_zfill2(d.getSeconds()); },
+ U: function(d) { return d3_time_zfill2(d3.time.sundayOfYear(d)); },
+ w: function(d) { return d.getDay(); },
+ W: function(d) { return d3_time_zfill2(d3.time.mondayOfYear(d)); },
+ x: d3.time.format("%m/%d/%y"),
+ X: d3.time.format("%H:%M:%S"),
+ y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); },
+ Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); },
+ Z: d3_time_zone,
+ "%": function(d) { return "%"; }
+};
+
+var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour24,
+ // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; },
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; },
+ // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; },
+ // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; },
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ // ,
+ // Z: function(d, s, i) { /*TODO time zone */ return i; },
+ // "%": function(d, s, i) { /*TODO literal % */ return i; }
+};
+
+// Note: weekday is validated, but does not set the date.
+function d3_time_parseWeekdayAbbrev(date, string, i) {
+ return d3_time_weekdayAbbrevRe.test(string.substring(i, i += 3)) ? i : -1;
+}
+
+// Note: weekday is validated, but does not set the date.
+function d3_time_parseWeekday(date, string, i) {
+ d3_time_weekdayRe.lastIndex = 0;
+ var n = d3_time_weekdayRe.exec(string.substring(i, i + 10));
+ return n ? i += n[0].length : -1;
+}
+
+var d3_time_weekdayAbbrevRe = /^(?:sun|mon|tue|wed|thu|fri|sat)/i,
+ d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i,
+ d3_time_weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
+
+function d3_time_parseMonthAbbrev(date, string, i) {
+ var n = d3_time_monthAbbrevLookup.get(string.substring(i, i += 3).toLowerCase());
+ return n == null ? -1 : (date.m = n, i);
+}
+
+var d3_time_monthAbbrevLookup = d3.map({
+ jan: 0,
+ feb: 1,
+ mar: 2,
+ apr: 3,
+ may: 4,
+ jun: 5,
+ jul: 6,
+ aug: 7,
+ sep: 8,
+ oct: 9,
+ nov: 10,
+ dec: 11
+});
+
+function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i, i + 12));
+ return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+}
+
+var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;
+
+var d3_time_monthLookup = d3.map({
+ january: 0,
+ february: 1,
+ march: 2,
+ april: 3,
+ may: 4,
+ june: 5,
+ july: 6,
+ august: 7,
+ september: 8,
+ october: 9,
+ november: 10,
+ december: 11
+});
+
+var d3_time_months = [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+];
+
+function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+}
+
+function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+}
+
+function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+}
+
+function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.y = +n[0], i += n[0].length) : -1;
+}
+
+function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.y = d3_time_century() + +n[0], i += n[0].length) : -1;
+}
+
+function d3_time_century() {
+ return ~~(new Date().getFullYear() / 1000) * 1000;
+}
+
+function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
+}
+
+function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.d = +n[0], i += n[0].length) : -1;
+}
+
+// Note: we don't validate that the hour is in the range [0,23] or [1,12].
+function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.H = +n[0], i += n[0].length) : -1;
+}
+
+function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.M = +n[0], i += n[0].length) : -1;
+}
+
+function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.S = +n[0], i += n[0].length) : -1;
+}
+
+function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.L = +n[0], i += n[0].length) : -1;
+}
+
+// Note: we don't look at the next directive.
+var d3_time_numberRe = /\s*\d+/;
+
+function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
+ return n == null ? -1 : (date.p = n, i);
+}
+
+var d3_time_amPmLookup = d3.map({
+ am: 0,
+ pm: 1
+});
+
+// TODO table of time zone offset names?
+function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(),
+ zs = z > 0 ? "-" : "+",
+ zh = ~~(Math.abs(z) / 60),
+ zm = Math.abs(z) % 60;
+ return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
+}
+d3.time.format.utc = function(template) {
+ var local = d3.time.format(template);
+
+ function format(date) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time();
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+
+ format.toString = local.toString;
+
+ return format;
+};
+var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+
+d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
+
+function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+}
+
+d3_time_formatIsoNative.parse = function(string) {
+ var date = new Date(string);
+ return isNaN(date) ? null : date;
+};
+
+d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+function d3_time_interval(local, step, number) {
+
+ function round(date) {
+ var d0 = local(date), d1 = offset(d0, 1);
+ return date - d0 < d1 - date ? d0 : d1;
+ }
+
+ function ceil(date) {
+ step(date = local(new d3_time(date - 1)), 1);
+ return date;
+ }
+
+ function offset(date, k) {
+ step(date = new d3_time(+date), k);
+ return date;
+ }
+
+ function range(t0, t1, dt) {
+ var time = ceil(t0), times = [];
+ if (dt > 1) {
+ while (time < t1) {
+ if (!(number(time) % dt)) times.push(new Date(+time));
+ step(time, 1);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time, 1);
+ }
+ return times;
+ }
+
+ function range_utc(t0, t1, dt) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc();
+ utc._ = t0;
+ return range(utc, t1, dt);
+ } finally {
+ d3_time = Date;
+ }
+ }
+
+ local.floor = local;
+ local.round = round;
+ local.ceil = ceil;
+ local.offset = offset;
+ local.range = range;
+
+ var utc = local.utc = d3_time_interval_utc(local);
+ utc.floor = utc;
+ utc.round = d3_time_interval_utc(round);
+ utc.ceil = d3_time_interval_utc(ceil);
+ utc.offset = d3_time_interval_utc(offset);
+ utc.range = range_utc;
+
+ return local;
+}
+
+function d3_time_interval_utc(method) {
+ return function(date, k) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc();
+ utc._ = date;
+ return method(utc, k)._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+}
+d3.time.second = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 1e3) * 1e3);
+}, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 1e3); // DST breaks setSeconds
+}, function(date) {
+ return date.getSeconds();
+});
+
+d3.time.seconds = d3.time.second.range;
+d3.time.seconds.utc = d3.time.second.utc.range;
+d3.time.minute = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 6e4) * 6e4);
+}, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 6e4); // DST breaks setMinutes
+}, function(date) {
+ return date.getMinutes();
+});
+
+d3.time.minutes = d3.time.minute.range;
+d3.time.minutes.utc = d3.time.minute.utc.range;
+d3.time.hour = d3_time_interval(function(date) {
+ var timezone = date.getTimezoneOffset() / 60;
+ return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
+}, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 36e5); // DST breaks setHours
+}, function(date) {
+ return date.getHours();
+});
+
+d3.time.hours = d3.time.hour.range;
+d3.time.hours.utc = d3.time.hour.utc.range;
+d3.time.day = d3_time_interval(function(date) {
+ return new d3_time(date.getFullYear(), date.getMonth(), date.getDate());
+}, function(date, offset) {
+ date.setDate(date.getDate() + offset);
+}, function(date) {
+ return date.getDate() - 1;
+});
+
+d3.time.days = d3.time.day.range;
+d3.time.days.utc = d3.time.day.utc.range;
+
+d3.time.dayOfYear = function(date) {
+ var year = d3.time.year(date);
+ return Math.floor((date - year) / 864e5 - (date.getTimezoneOffset() - year.getTimezoneOffset()) / 1440);
+};
+d3_time_weekdays.forEach(function(day, i) {
+ day = day.toLowerCase();
+ i = 7 - i;
+
+ var interval = d3.time[day] = d3_time_interval(function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
+ return date;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + Math.floor(offset) * 7);
+ }, function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
+ });
+
+ d3.time[day + "s"] = interval.range;
+ d3.time[day + "s"].utc = interval.utc.range;
+
+ d3.time[day + "OfYear"] = function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
+ };
+});
+
+d3.time.week = d3.time.sunday;
+d3.time.weeks = d3.time.sunday.range;
+d3.time.weeks.utc = d3.time.sunday.utc.range;
+d3.time.weekOfYear = d3.time.sundayOfYear;
+d3.time.month = d3_time_interval(function(date) {
+ return new d3_time(date.getFullYear(), date.getMonth(), 1);
+}, function(date, offset) {
+ date.setMonth(date.getMonth() + offset);
+}, function(date) {
+ return date.getMonth();
+});
+
+d3.time.months = d3.time.month.range;
+d3.time.months.utc = d3.time.month.utc.range;
+d3.time.year = d3_time_interval(function(date) {
+ return new d3_time(date.getFullYear(), 0, 1);
+}, function(date, offset) {
+ date.setFullYear(date.getFullYear() + offset);
+}, function(date) {
+ return date.getFullYear();
+});
+
+d3.time.years = d3.time.year.range;
+d3.time.years.utc = d3.time.year.utc.range;
+function d3_time_scale(linear, methods, format) {
+
+ function scale(x) {
+ return linear(x);
+ }
+
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+
+ scale.nice = function(m) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ return scale.domain([m.floor(extent[0]), m.ceil(extent[1])]);
+ };
+
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0],
+ target = span / m,
+ i = d3.bisect(d3_time_scaleSteps, target);
+ if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
+ if (!i) return linear.ticks(m).map(d3_time_scaleDate);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0].range;
+ }
+ return m(extent[0], new Date(+extent[1] + 1), k); // inclusive upper bound
+ };
+
+ scale.tickFormat = function() {
+ return format;
+ };
+
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+
+ // TOOD expose d3_scale_linear_rebind?
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+}
+
+// TODO expose d3_scaleExtent?
+function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [start, stop] : [stop, start];
+}
+
+function d3_time_scaleDate(t) {
+ return new Date(t);
+}
+
+function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+}
+
+function d3_time_scaleSetYear(y) {
+ var d = new Date(y, 0, 1);
+ d.setFullYear(y); // Y2K fail
+ return d;
+}
+
+function d3_time_scaleGetYear(d) {
+ var y = d.getFullYear(),
+ d0 = d3_time_scaleSetYear(y),
+ d1 = d3_time_scaleSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+}
+
+var d3_time_scaleSteps = [
+ 1e3, // 1-second
+ 5e3, // 5-second
+ 15e3, // 15-second
+ 3e4, // 30-second
+ 6e4, // 1-minute
+ 3e5, // 5-minute
+ 9e5, // 15-minute
+ 18e5, // 30-minute
+ 36e5, // 1-hour
+ 108e5, // 3-hour
+ 216e5, // 6-hour
+ 432e5, // 12-hour
+ 864e5, // 1-day
+ 1728e5, // 2-day
+ 6048e5, // 1-week
+ 2592e6, // 1-month
+ 7776e6, // 3-month
+ 31536e6 // 1-year
+];
+
+var d3_time_scaleLocalMethods = [
+ [d3.time.second, 1],
+ [d3.time.second, 5],
+ [d3.time.second, 15],
+ [d3.time.second, 30],
+ [d3.time.minute, 1],
+ [d3.time.minute, 5],
+ [d3.time.minute, 15],
+ [d3.time.minute, 30],
+ [d3.time.hour, 1],
+ [d3.time.hour, 3],
+ [d3.time.hour, 6],
+ [d3.time.hour, 12],
+ [d3.time.day, 1],
+ [d3.time.day, 2],
+ [d3.time.week, 1],
+ [d3.time.month, 1],
+ [d3.time.month, 3],
+ [d3.time.year, 1]
+];
+
+var d3_time_scaleLocalFormats = [
+ [d3.time.format("%Y"), function(d) { return true; }],
+ [d3.time.format("%B"), function(d) { return d.getMonth(); }],
+ [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }],
+ [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }],
+ [d3.time.format("%I %p"), function(d) { return d.getHours(); }],
+ [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }],
+ [d3.time.format(":%S"), function(d) { return d.getSeconds(); }],
+ [d3.time.format(".%L"), function(d) { return d.getMilliseconds(); }]
+];
+
+var d3_time_scaleLinear = d3.scale.linear(),
+ d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+
+d3_time_scaleLocalMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
+};
+
+d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+};
+var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
+ return [m[0].utc, m[1]];
+});
+
+var d3_time_scaleUTCFormats = [
+ [d3.time.format.utc("%Y"), function(d) { return true; }],
+ [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }],
+ [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }],
+ [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }],
+ [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }],
+ [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }],
+ [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds(); }],
+ [d3.time.format.utc(".%L"), function(d) { return d.getUTCMilliseconds(); }]
+];
+
+var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+
+function d3_time_scaleUTCSetYear(y) {
+ var d = new Date(Date.UTC(y, 0, 1));
+ d.setUTCFullYear(y); // Y2K fail
+ return d;
+}
+
+function d3_time_scaleUTCGetYear(d) {
+ var y = d.getUTCFullYear(),
+ d0 = d3_time_scaleUTCSetYear(y),
+ d1 = d3_time_scaleUTCSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+}
+
+d3_time_scaleUTCMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
+};
+
+d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+};
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/jquery.min.js b/projects/Data Visualization Software Java Project/Data Visualization/jquery.min.js
new file mode 100644
index 0000000..c941a5f
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/jquery.min.js
@@ -0,0 +1,166 @@
+/*!
+ * jQuery JavaScript Library v1.4.3
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Oct 14 23:10:06 2010 -0400
+ */
+(function(E,A){function U(){return false}function ba(){return true}function ja(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ga(a){var b,d,e=[],f=[],h,k,l,n,s,v,B,D;k=c.data(this,this.nodeType?"events":"__events__");if(typeof k==="function")k=k.events;if(!(a.liveFired===this||!k||!k.live||a.button&&a.type==="click")){if(a.namespace)D=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var H=k.live.slice(0);for(n=0;nd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;
+a.handleObj=f.handleObj;D=f.handleObj.origHandler.apply(f.elem,arguments);if(D===false||a.isPropagationStopped()){d=f.level;if(D===false)b=false}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(Ia,"&")}function ka(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Ja.test(b))return c.filter(b,
+e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function la(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Ka(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}
+function ma(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?La:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ca(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Na.test(a)?e(a,h):ca(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?
+e(a,""):c.each(b,function(f,h){ca(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(na.concat.apply([],na.slice(0,b)),function(){d[this]=a});return d}function oa(a){if(!da[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";da[a]=d}return da[a]}function ea(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var u=E.document,c=function(){function a(){if(!b.isReady){try{u.documentElement.doScroll("left")}catch(i){setTimeout(a,
+1);return}b.ready()}}var b=function(i,r){return new b.fn.init(i,r)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,s=/\W/,v=/\d/,B=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,D=/^[\],:{}\s]*$/,H=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,G=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,j=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,
+q=[],t,x=Object.prototype.toString,C=Object.prototype.hasOwnProperty,P=Array.prototype.push,N=Array.prototype.slice,R=String.prototype.trim,Q=Array.prototype.indexOf,L={};b.fn=b.prototype={init:function(i,r){var y,z,F;if(!i)return this;if(i.nodeType){this.context=this[0]=i;this.length=1;return this}if(i==="body"&&!r&&u.body){this.context=u;this[0]=u.body;this.selector="body";this.length=1;return this}if(typeof i==="string")if((y=h.exec(i))&&(y[1]||!r))if(y[1]){F=r?r.ownerDocument||r:u;if(z=B.exec(i))if(b.isPlainObject(r)){i=
+[u.createElement(z[1])];b.fn.attr.call(i,r,true)}else i=[F.createElement(z[1])];else{z=b.buildFragment([y[1]],[F]);i=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,i)}else{if((z=u.getElementById(y[2]))&&z.parentNode){if(z.id!==y[2])return f.find(i);this.length=1;this[0]=z}this.context=u;this.selector=i;return this}else if(!r&&!s.test(i)){this.selector=i;this.context=u;i=u.getElementsByTagName(i);return b.merge(this,i)}else return!r||r.jquery?(r||f).find(i):b(r).find(i);
+else if(b.isFunction(i))return f.ready(i);if(i.selector!==A){this.selector=i.selector;this.context=i.context}return b.makeArray(i,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(i){return i==null?this.toArray():i<0?this.slice(i)[0]:this[i]},pushStack:function(i,r,y){var z=b();b.isArray(i)?P.apply(z,i):b.merge(z,i);z.prevObject=this;z.context=this.context;if(r==="find")z.selector=this.selector+(this.selector?" ":
+"")+y;else if(r)z.selector=this.selector+"."+r+"("+y+")";return z},each:function(i,r){return b.each(this,i,r)},ready:function(i){b.bindReady();if(b.isReady)i.call(u,b);else q&&q.push(i);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(i){return this.pushStack(b.map(this,function(r,y){return i.call(r,
+y,r)}))},end:function(){return this.prevObject||b(null)},push:P,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var i=arguments[0]||{},r=1,y=arguments.length,z=false,F,I,K,J,fa;if(typeof i==="boolean"){z=i;i=arguments[1]||{};r=2}if(typeof i!=="object"&&!b.isFunction(i))i={};if(y===r){i=this;--r}for(;r0)){if(q){for(var r=0;i=q[r++];)i.call(u,b);q=null}b.fn.triggerHandler&&b(u).triggerHandler("ready")}}},bindReady:function(){if(!p){p=true;if(u.readyState==="complete")return setTimeout(b.ready,
+1);if(u.addEventListener){u.addEventListener("DOMContentLoaded",t,false);E.addEventListener("load",b.ready,false)}else if(u.attachEvent){u.attachEvent("onreadystatechange",t);E.attachEvent("onload",b.ready);var i=false;try{i=E.frameElement==null}catch(r){}u.documentElement.doScroll&&i&&a()}}},isFunction:function(i){return b.type(i)==="function"},isArray:Array.isArray||function(i){return b.type(i)==="array"},isWindow:function(i){return i&&typeof i==="object"&&"setInterval"in i},isNaN:function(i){return i==
+null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i);
+if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
+r.toUpperCase()},each:function(i,r,y){var z,F=0,I=i.length,K=I===A||b.isFunction(i);if(y)if(K)for(z in i){if(r.apply(i[z],y)===false)break}else for(;Fa";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],k=u.createElement("select"),l=k.appendChild(u.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),
+hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:l.selected,optDisabled:false,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};k.disabled=true;c.support.optDisabled=!l.disabled;b.type="text/javascript";try{b.appendChild(u.createTextNode("window."+e+"=1;"))}catch(n){}a.insertBefore(b,
+a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function s(){c.support.noCloneEvent=false;d.detachEvent("onclick",s)});d.cloneNode(true).fireEvent("onclick")}d=u.createElement("div");d.innerHTML="";a=u.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var s=u.createElement("div");
+s.style.width=s.style.paddingLeft="1px";u.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="";var v=s.getElementsByTagName("td");c.support.reliableHiddenOffsets=v[0].offsetHeight===
+0;v[0].style.display="";v[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&v[0].offsetHeight===0;s.innerHTML="";u.body.removeChild(s).style.display="none"});a=function(s){var v=u.createElement("div");s="on"+s;var B=s in v;if(!B){v.setAttribute(s,"return;");B=typeof v[s]==="function"}return B};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",
+cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var pa={},Oa=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?pa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=
+c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?pa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b=
+c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===A&&this.length){e=c.data(this[0],a);if(e===A&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e===
+"string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Oa.test(e)?c.parseJSON(e):e}catch(f){}else e=A}}return e===A&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this),k=[d[0],b];h.triggerHandler("setData"+d[1]+"!",k);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",k)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e||
+[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
+a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var qa=/[\n\t]/g,ga=/\s+/,Pa=/\r/g,Qa=/^(?:href|src|style)$/,Ra=/^(?:button|input)$/i,Sa=/^(?:button|input|object|select|textarea)$/i,Ta=/^a(?:rea)?$/i,ra=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,
+a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(s){var v=c(this);v.addClass(a.call(this,s,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ga),d=0,e=this.length;d-1)return true;return false},
+val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var B=c.makeArray(v);c("option",this).each(function(){this.selected=
+c.inArray(c(this).val(),B)>=0});if(!B.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Qa.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Ra.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
+if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Sa.test(a.nodeName)||Ta.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&&
+h?a.getAttribute(b,2):a.getAttribute(b);return a===null?A:a}}});var X=/\.(.*)$/,ha=/^(?:textarea|input|select)$/i,Ha=/\./g,Ia=/ /g,Ua=/[^\w\s.|`]/g,Va=function(a){return a.replace(Ua,"\\$&")},sa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l===
+"function"){n=l.handle;l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var s=0,v;k=b[s++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){v=k.split(".");k=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var B=l[k],D=c.event.special[k]||{};if(!B){B=l[k]=[];
+if(!D.setup||D.setup.call(a,e,v,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(D.add){D.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}B.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,s,v,B,D,H=a.nodeType?"events":"__events__",w=c.data(a),G=w&&w[H];if(w&&G){if(typeof G==="function"){w=G;G=G.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||
+typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in G)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){v=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();s=RegExp("(^|\\.)"+c.map(n.slice(0).sort(),Va).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(B=G[f])if(d){v=c.event.special[f]||{};for(h=e||0;h=0){a.type=
+f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===
+false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target;var k,l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",s=c.event.special[l]||{};if((!s._default||s._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e;
+d=[];var f,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ha.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=va(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired=
+A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",va(a))}},setup:function(){if(this.type===
+"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ha.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ha.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}u.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){sa[b]++===0&&u.addEventListener(a,d,true)},teardown:function(){--sa[b]===
+0&&u.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(g,j,o,m,p,q){p=0;for(var t=m.length;p0){C=x;break}}x=x[g]}m[p]=C}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,j,o,m){o=o||[];var p=j=j||u;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var q=[],t,x,C,P,N=true,R=l.isXML(j),Q=g,L;do{d.exec("");if(t=d.exec(Q)){Q=t[3];q.push(t[1]);if(t[2]){P=t[3];
+break}}}while(t);if(q.length>1&&s.exec(g))if(q.length===2&&n.relative[q[0]])x=M(q[0]+q[1],j);else for(x=n.relative[q[0]]?[j]:l(q.shift(),j);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();x=M(g,x)}else{if(!m&&q.length>1&&j.nodeType===9&&!R&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){t=l.find(q.shift(),j,R);j=t.expr?l.filter(t.expr,t.set)[0]:t.set[0]}if(j){t=m?{expr:q.pop(),set:D(m)}:l.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&j.parentNode?j.parentNode:j,R);x=t.expr?l.filter(t.expr,
+t.set):t.set;if(q.length>0)C=D(x);else N=false;for(;q.length;){t=L=q.pop();if(n.relative[L])t=q.pop();else L="";if(t==null)t=j;n.relative[L](C,t,R)}}else C=[]}C||(C=x);C||l.error(L||g);if(f.call(C)==="[object Array]")if(N)if(j&&j.nodeType===1)for(g=0;C[g]!=null;g++){if(C[g]&&(C[g]===true||C[g].nodeType===1&&l.contains(j,C[g])))o.push(x[g])}else for(g=0;C[g]!=null;g++)C[g]&&C[g].nodeType===1&&o.push(x[g]);else o.push.apply(o,C);else D(C,o);if(P){l(P,p,o,m);l.uniqueSort(o)}return o};l.uniqueSort=function(g){if(w){h=
+k;g.sort(w);if(h)for(var j=1;j0};l.find=function(g,j,o){var m;if(!g)return[];for(var p=0,q=n.order.length;p":function(g,j){var o=typeof j==="string",m,p=0,q=g.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();p=0))o||m.push(t);else if(o)j[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=j[1]+(j[2]||1)-0;g[3]=j[3]-0}g[0]=e++;return g},ATTR:function(g,j,o,
+m,p,q){j=g[1].replace(/\\/g,"");if(!q&&n.attrMap[j])g[1]=n.attrMap[j];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,j,o,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,j);else{g=l.filter(g[3],j,o,true^p);o||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
+true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,j,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
+g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,j){return j===0},last:function(g,j,o,m){return j===m.length-1},even:function(g,j){return j%2===0},odd:function(g,j){return j%2===1},lt:function(g,j,o){return jo[3]-0},nth:function(g,j,o){return o[3]-
+0===j},eq:function(g,j,o){return o[3]-0===j}},filter:{PSEUDO:function(g,j,o,m){var p=j[1],q=n.filters[p];if(q)return q(g,o,j,m);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(j[3])>=0;else if(p==="not"){j=j[3];o=0;for(m=j.length;o=0}},ID:function(g,j){return g.nodeType===1&&g.getAttribute("id")===j},TAG:function(g,j){return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
+j},CLASS:function(g,j){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(g,j){var o=j[1];o=n.attrHandle[o]?n.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);var m=o+"",p=j[2],q=j[4];return o==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&o!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,j,o,m){var p=n.setFilters[j[2]];
+if(p)return p(g,o,j,m)}}},s=n.match.POS,v=function(g,j){return"\\"+(j-0+1)},B;for(B in n.match){n.match[B]=RegExp(n.match[B].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[B]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[B].source.replace(/\\(\d+)/g,v))}var D=function(g,j){g=Array.prototype.slice.call(g,0);if(j){j.push.apply(j,g);return j}return g};try{Array.prototype.slice.call(u.documentElement.childNodes,0)}catch(H){D=function(g,j){var o=j||[],m=0;if(f.call(g)==="[object Array]")Array.prototype.push.apply(o,
+g);else if(typeof g.length==="number")for(var p=g.length;m";var o=u.documentElement;o.insertBefore(g,o.firstChild);if(u.getElementById(j)){n.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:A:[]};n.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}o.removeChild(g);
+o=g=null})();(function(){var g=u.createElement("div");g.appendChild(u.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(j,o){var m=o.getElementsByTagName(j[1]);if(j[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};g=null})();u.querySelectorAll&&
+function(){var g=l,j=u.createElement("div");j.innerHTML="";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===0)){l=function(m,p,q,t){p=p||u;if(!t&&!l.isXML(p))if(p.nodeType===9)try{return D(p.querySelectorAll(m),q)}catch(x){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var C=p.id,P=p.id="__sizzle__";try{return D(p.querySelectorAll("#"+P+" "+m),q)}catch(N){}finally{if(C)p.id=C;else p.removeAttribute("id")}}return g(m,p,q,t)};for(var o in g)l[o]=g[o];
+j=null}}();(function(){var g=u.documentElement,j=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{j.call(u.documentElement,":sizzle")}catch(m){o=true}if(j)l.matchesSelector=function(p,q){try{if(o||!n.match.PSEUDO.test(q))return j.call(p,q)}catch(t){}return l(q,null,null,[p]).length>0}})();(function(){var g=u.createElement("div");g.innerHTML="";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
+0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,m){if(typeof o.getElementsByClassName!=="undefined"&&!m)return o.getElementsByClassName(j[1])};g=null}}})();l.contains=u.documentElement.contains?function(g,j){return g!==j&&(g.contains?g.contains(j):true)}:function(g,j){return!!(g.compareDocumentPosition(j)&16)};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g,
+j){for(var o=[],m="",p,q=j.nodeType?[j]:j;p=n.match.PSEUDO.exec(g);){m+=p[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;p=0;for(var t=q.length;p0)for(var h=d;h0},closest:function(a,
+b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k={},l,n=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:n})}h=h.parentNode;n++}}return d}k=$a.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||
+!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});
+c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",
+d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Wa.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||Ya.test(e))&&Xa.test(a))f=f.reverse();return this.pushStack(f,a,Za.call(arguments).join(","))}});
+c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var xa=/ jQuery\d+="(?:\d+|null)"/g,
+$=/^\s+/,ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,za=/<([\w:]+)/,ab=/\s]+\/)>/g,O={option:[1,""],legend:[1,""],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],
+area:[1,""],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,
+d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},
+unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=
+c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));
+c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(xa,"").replace(cb,'="$1">').replace($,
+"")],e)[0]}else return this.cloneNode(true)});if(a===true){la(this,b);la(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(xa,""):null;else if(typeof a==="string"&&!Aa.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!O[(za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ya,"<$1>$2>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?l.cloneNode(true):l)}k.length&&c.each(k,Ka)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:u;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===u&&!Aa.test(a[0])&&(c.support.checkClone||
+!Ba.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=
+d.length;f0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||u;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||u;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!bb.test(k))k=b.createTextNode(k);else if(typeof k==="string"){k=k.replace(ya,"<$1>$2>");var l=(za.exec(k)||["",""])[1].toLowerCase(),n=O[l]||O._default,
+s=n[0],v=b.createElement("div");for(v.innerHTML=n[1]+k+n[2];s--;)v=v.lastChild;if(!c.support.tbody){s=ab.test(k);l=l==="table"&&!s?v.firstChild&&v.firstChild.childNodes:n[1]===""&&!s?v.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&v.insertBefore(b.createTextNode($.exec(k)[0]),v.firstChild);k=v.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&&
+c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]?
+c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,db=/opacity=([^)]*)/,eb=/-([a-z])/ig,fb=/([A-Z])/g,Da=/^-?\d+(?:px)?$/i,gb=/^-?\d/,hb={position:"absolute",visibility:"hidden",display:"block"},La=["Left","Right"],Ma=["Top","Bottom"],W,ib=u.defaultView&&u.defaultView.getComputedStyle,jb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this;
+return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]||
+h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=
+e[f]},camelCase:function(a){return a.replace(eb,jb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=ma(d,b,f);else c.swap(d,hb,function(){h=ma(d,b,f)});return h+"px"}},set:function(d,e){if(Da.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return db.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":
+b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d.filter||"";d.filter=Ca.test(f)?f.replace(Ca,e):d.filter+" "+e}};if(ib)W=function(a,b,d){var e;d=d.replace(fb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(u.documentElement.currentStyle)W=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],
+h=a.style;if(!Da.test(f)&&gb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var kb=c.now(),lb=/
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/label-test2.html b/projects/Data Visualization Software Java Project/Data Visualization/label-test2.html
new file mode 100644
index 0000000..ebb3760
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/label-test2.html
@@ -0,0 +1,133 @@
+
+
+
+
+ Force based label placement
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/label-test3.html b/projects/Data Visualization Software Java Project/Data Visualization/label-test3.html
new file mode 100644
index 0000000..6d90fa3
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/label-test3.html
@@ -0,0 +1,162 @@
+
+
+
+
+ Force based label placement
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/preprocess.js b/projects/Data Visualization Software Java Project/Data Visualization/preprocess.js
new file mode 100644
index 0000000..cdc404c
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/preprocess.js
@@ -0,0 +1,61 @@
+(function() {
+ preprocess = {
+
+ // Lazily construct the package hierarchy from class names.
+ nodes: function(pairs) {
+ var map = {};
+
+ function find(name, data) {
+ var node = map[name];
+ if (!node) {
+ node = map[name] = {name: name, children: []};
+ if (name.length){
+ node.parent = find("");
+ node.parent.children.push(node);
+ }
+ }
+ if (data != undefined && data.target.length) {
+ node.children.push({name: data.target, children: [], country: data.Country, dvalue: data.DollarValue, parent: node})
+ }
+ return node;
+ }
+
+ pairs.forEach(function(d) {
+ find(d.source, d);
+ });
+
+ return map[""].children;
+ },
+
+ // Return a list of imports for the given array of nodes.
+ links: function(nodes) {
+ var map = {},
+ link = [];
+
+ // Compute a map from name to node.
+ nodes.forEach(function(d) {
+ map[d.name] = d;
+ });
+
+ // For each import, construct a link from the source to target node.
+ nodes.forEach(function(d) {
+ console.log("inspecting: ");
+ console.log(d);
+ if (d.children.length) {
+ console.log("found children: "+d.children.length);
+ d.children.forEach(function(i) {
+ console.log("pushing link:");
+ console.log(" map[d.name] = map["+d.name+"]:");
+ console.log(map[d.name]);
+ console.log(" to:");
+ console.log(i);
+ link.push({source: map[d.name], target: i});
+ });
+ }
+ });
+
+ return link;
+ }
+
+ };
+})();
diff --git a/projects/Data Visualization Software Java Project/Data Visualization/preprocess_force.js b/projects/Data Visualization Software Java Project/Data Visualization/preprocess_force.js
new file mode 100644
index 0000000..8debdb1
--- /dev/null
+++ b/projects/Data Visualization Software Java Project/Data Visualization/preprocess_force.js
@@ -0,0 +1,54 @@
+(function() {
+ preprocess = {
+
+ links: function(nodes) {
+ var map = {},
+ node_arr = [],
+ country_map = {},
+ country_array = [],
+ link = [],
+ i = 0,
+ j = 0;
+
+ function makeMap(name, data){
+ var node = map[name];
+ if(!node){
+ node = map[name] = {name: name, key: i, links: 0, dvalue: 0};
+ node_arr[i] = node;
+ i++;
+ }
+ if(node.country == undefined && data.Country != undefined){
+ if(country_map[data.Country] == undefined){
+ country_map[data.Country] = {name: data.Country, key: j};
+ country_array[j] = country_map[data.Country];
+ j++;
+ }
+ node.country = data.Country;
+ node.country_code = country_map[data.Country].key;
+
+ if(data.DollarValue.charAt(0) == "$"){
+ var re = new RegExp("[$,]", "g");
+ node.dvalue = data.DollarValue.replace(re, "");
+ }
+ node_arr[node.key] = node
+ }
+ }
+
+ nodes.forEach(function(d) {
+ makeMap(d.source, {});
+ makeMap(d.target, d)
+ });
+
+ nodes.forEach(function(d) {
+ if (d.target.length && d.source.length) {
+ map[d.target].links++;
+ map[d.source].links++;
+ link.push({source: map[d.source].key, target: map[d.target].key});
+ }
+ });
+
+ return {nodes: node_arr, links: link, countries: country_array};
+ }
+
+ };
+})();
diff --git a/projects/Data Visualization Software Java Project/Readme.docx b/projects/Data Visualization Software Java Project/Readme.docx
new file mode 100644
index 0000000..cf11c06
Binary files /dev/null and b/projects/Data Visualization Software Java Project/Readme.docx differ
diff --git a/projects/Digital Steganography Java Project/Readme.docx b/projects/Digital Steganography Java Project/Readme.docx
new file mode 100644
index 0000000..cf11c06
Binary files /dev/null and b/projects/Digital Steganography Java Project/Readme.docx differ
diff --git a/projects/Digital Steganography Java Project/Report/Digital Steganography.doc b/projects/Digital Steganography Java Project/Report/Digital Steganography.doc
new file mode 100644
index 0000000..61522b3
Binary files /dev/null and b/projects/Digital Steganography Java Project/Report/Digital Steganography.doc differ
diff --git a/projects/Digital Steganography Java Project/coding/BreakPage.class b/projects/Digital Steganography Java Project/coding/BreakPage.class
new file mode 100644
index 0000000..1ae6cad
Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/BreakPage.class differ
diff --git a/projects/Digital Steganography Java Project/coding/BreakPage.java b/projects/Digital Steganography Java Project/coding/BreakPage.java
new file mode 100644
index 0000000..6f2118d
--- /dev/null
+++ b/projects/Digital Steganography Java Project/coding/BreakPage.java
@@ -0,0 +1,196 @@
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.io.*;
+import java.awt.image.*;
+//import javax.imageio.stream.*;
+
+public class BreakPage extends JFrame implements ActionListener
+{
+ private JLabel code_label,picture_label;
+ private JTextField code_text,picture_text;
+ private JButton picture_load_button,break_button,home_button;
+ String filepath="",secret_code="",secret_info="";
+ Container con=null;
+ JLabel jl;
+ byte img_byte[]=new byte[6000];
+ FileDialog fd;
+
+
+ //////// Variables for creating an image from an integer array ///////////////////////////
+
+ Image img;
+ Dimension d;
+ int iw,ih;
+ int w=10,h=10;
+ int pix[];
+ int hist[]=new int[256];
+ int t[];
+ int max_hist=0;
+ boolean ok;
+ Image newimg;
+ int key,k;
+ String user_key="";
+
+ BreakPage()
+ {
+ super("Break");
+ con=getContentPane();
+ con.setLayout(null);
+
+ code_label=new JLabel("Security Code");
+ code_label.setBounds(230,200,150,50);
+ code_text=new JTextField(200);
+ code_text.setBounds(400,200,250,40);
+
+ picture_label=new JLabel("Picture");
+ picture_label.setBounds(230,300,250,40);
+ picture_text=new JTextField(200);
+ picture_text.setBounds(400,300,250,50);
+ picture_load_button=new JButton("Load");
+ picture_load_button.setBounds(700,300,150,30);
+ picture_load_button.addActionListener(this);
+
+ break_button=new JButton("Break");
+ break_button.setBounds(400,400,150,30);
+ break_button.addActionListener(this);
+ home_button=new JButton("Home");
+ home_button.setBounds(700,400,150,30);
+ home_button.addActionListener(this);
+
+ jl=new JLabel();
+ jl.setBounds(700,500,150,30);
+
+ fd=new FileDialog(new JFrame());
+
+ con.add(code_label);
+ con.add(code_text);
+ con.add(picture_label);
+ con.add(picture_text);
+ con.add(picture_load_button);
+ con.add(break_button);
+ con.add(home_button);
+ con.add(jl);
+ }
+
+ public void actionPerformed(ActionEvent ae)
+ {
+ if(ae.getSource()==picture_load_button)
+ {
+ fd.setVisible(true);
+ filepath=fd.getDirectory()+fd.getFile();
+ picture_text.setText(filepath);
+ }else if(ae.getSource()==break_button)
+ {
+ String sc=code_text.getText();
+ int star_flag=0;
+ String star_value="";
+ for(int i=0;i0 && flag==0)
+ {
+
+ System.out.println("one");
+
+ if(loop=1)
+ {
+ System.out.println("else if");
+ secret_info[j]=pix[i];
+ b[j]=(byte)pix[i];
+ System.out.println("secrect pix :"+new String(""+(char)b[j])+"");
+ j++;
+ k--;
+ }
+ else
+ {
+ System.out.println("star flag :"+star2_flag);
+ System.out.println("else");
+ flag=1;
+ }
+ }
+ }
+ if(flag==0)
+ {
+ String s=new String(b);
+ s=new String(s.substring(1));
+
+ System.out.println("secret information :"+s);
+ System.out.println("key :"+key);
+ JOptionPane.showMessageDialog(null,"Secret Information is : "+s);
+ }
+ else
+ JOptionPane.showMessageDialog(null,"code you entered is not valid");
+ newimg =con.createImage(new MemoryImageSource(ww,hh,cm,pix, 0, ww));
+ }catch(Exception e)
+ {
+ System.out.println(e);
+ }
+ }else
+ {
+ this.dispose();
+ Home h=new Home();
+ h.setSize(1035,790);
+ h.setVisible(true);
+ }
+ }
+ public static void main(String args[])
+ {
+ BreakPage bp=new BreakPage();
+ bp.setSize(1035,740);
+ bp.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/projects/Digital Steganography Java Project/coding/ComposePage.class b/projects/Digital Steganography Java Project/coding/ComposePage.class
new file mode 100644
index 0000000..5fc668e
Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/ComposePage.class differ
diff --git a/projects/Digital Steganography Java Project/coding/ComposePage.java b/projects/Digital Steganography Java Project/coding/ComposePage.java
new file mode 100644
index 0000000..2c124f1
--- /dev/null
+++ b/projects/Digital Steganography Java Project/coding/ComposePage.java
@@ -0,0 +1,214 @@
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.io.*;
+import java.awt.image.*;
+import com.sun.image.codec.jpeg.*;
+
+public class ComposePage extends JFrame implements ActionListener
+{
+ private JLabel code_label,secret_label,picture_label;
+ private JTextField code_text,secret_text,picture_text;
+ private JButton picture_load_button,hide_button,home_button;
+ String filepath="",secret_code="",secret_info="",user_key="";
+ Container con=null;
+ JLabel jl;
+ byte img_byte[]=new byte[6000];
+ FileDialog fd;
+
+ //////// Variables for creating an image from an integer array ///////////////////////////
+
+ Image img;
+ Dimension d;
+ int iw,ih;
+ int w=10,h=10;
+ int pix[];
+ int hist[]=new int[256];
+ int t[];
+ int max_hist=0;
+ boolean ok;
+ static Image newimg;
+ int key,k;
+
+ ComposePage()
+ {
+ super("Compose");
+ con=getContentPane();
+ con.setLayout(null);
+
+ code_label=new JLabel("Security Code");
+ code_label.setBounds(230,100,150,50);
+ code_text=new JTextField(200);
+ code_text.setBounds(400,100,250,40);
+ secret_label=new JLabel("Secret Information");
+ secret_label.setBounds(230,200,150,50);
+ secret_text=new JTextField(200);
+ secret_text.setBounds(400,200,250,40);
+
+ picture_label=new JLabel("Picture");
+ picture_label.setBounds(230,300,250,40);
+ picture_text=new JTextField(200);
+ picture_text.setBounds(400,300,250,50);
+ picture_load_button=new JButton("Load");
+ picture_load_button.setBounds(700,300,150,30);
+ picture_load_button.addActionListener(this);
+
+ hide_button=new JButton("Hide");
+ hide_button.setBounds(400,400,150,30);
+ hide_button.addActionListener(this);
+ home_button=new JButton("Home");
+ home_button.setBounds(700,400,150,30);
+ home_button.addActionListener(this);
+
+ jl=new JLabel();
+ jl.setBounds(700,500,150,30);
+
+ fd=new FileDialog(new JFrame());
+
+ con.add(code_label);
+ con.add(code_text);
+ con.add(secret_label);
+ con.add(secret_text);
+ con.add(picture_label);
+ con.add(picture_text);
+ con.add(picture_load_button);
+ con.add(hide_button);
+ con.add(home_button);
+ //con.add(jl);
+ }
+
+ public void actionPerformed(ActionEvent ae)
+ {
+ if(ae.getSource()==picture_load_button)
+ {
+ fd.setVisible(true);
+ filepath=fd.getDirectory()+fd.getFile();
+ picture_text.setText(filepath);
+ }else if(ae.getSource()==hide_button)
+ {
+ int starflag=0;
+ secret_code=code_text.getText();
+ for(int i=0;i0)
+ JOptionPane.showMessageDialog(null,"enter secret info");
+ else if(filepath.length()==0 && (secret_text.getText()).length()>0)
+ JOptionPane.showMessageDialog(null,"load an image");
+ else
+ {
+ ImageIcon ic=new ImageIcon(filepath);
+ img=ic.getImage();
+ iw=img.getWidth(null);
+ ih=img.getHeight(null);
+ pix=new int[iw*ih];
+ t=new int[iw*ih];
+ PixelGrabber pg=new PixelGrabber(img,0,0,iw,ih,pix,0,iw);
+ ColorModel cm=pg.getColorModel();
+ int ww=pg.getWidth();
+ int hh=pg.getHeight();
+ pg.grabPixels();
+
+ key=secret_byte_array.length;
+ int k=key;
+ int j=0;
+
+ for(int i=0;i0)
+ {
+ secret_int_array[j]=(int)secret_byte_array[j];
+ System.out.println("user key :"+secret_int_array[j]);
+ pix[i]=secret_int_array[j];
+ j++;
+ k--;
+ }
+ }
+ newimg =con.createImage(new MemoryImageSource(ww,hh,cm,pix, 0, ww));
+ jl.setIcon(new ImageIcon(newimg));
+ JOptionPane.showMessageDialog(null,"your secret code: "+user_key+"");
+
+ MediaTracker mediaTracker = new MediaTracker(new Container());
+ mediaTracker.addImage(newimg, 0);
+ mediaTracker.waitForID(0);
+
+ int thumbWidth = 400;//Integer.parseInt(400);
+ int thumbHeight = 400;//Integer.parseInt(400);
+ double thumbRatio = (double)thumbWidth / (double)thumbHeight;
+ int imageWidth = newimg.getWidth(null);
+ int imageHeight = newimg.getHeight(null);
+ double imageRatio = (double)imageWidth / (double)imageHeight;
+
+ if (thumbRatio < imageRatio)
+ {
+ thumbHeight = (int)(thumbWidth / imageRatio);
+ }
+ else
+ {
+ thumbWidth = (int)(thumbHeight * imageRatio);
+ }
+
+ // draw original image to thumbnail image object and
+ // scale it to the new size on-the-fly
+ BufferedImage thumbImage = new BufferedImage(newimg.getWidth(null), newimg.getHeight(null), BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics2D = thumbImage.createGraphics();
+ graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+ graphics2D.drawImage(newimg, 0, 0, newimg.getWidth(null), newimg.getHeight(null), null);
+ // save thumbnail image to OUTFILE
+ File f=new File("secpic.jpg");
+ BufferedOutputStream out = new BufferedOutputStream(new
+ FileOutputStream(f));
+ JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
+ JPEGEncodeParam param = encoder.
+ getDefaultJPEGEncodeParam(thumbImage);
+ int quality = 80;//Integer.parseInt(args[4]);
+ quality = Math.max(0, Math.min(quality, 100));
+ param.setQuality((float)quality / 100.0f, false);
+ encoder.setJPEGEncodeParam(param);
+ encoder.encode(thumbImage);
+ out.close();
+ System.out.println("Done.");
+
+ test t=new test(newimg);
+ t.setSize(1035,790);
+ t.setVisible(true);
+ }
+ }catch(Exception e)
+ {
+ System.out.println(e);
+ }
+ }else
+ JOptionPane.showMessageDialog(null,"Do not enter '*' in secrect code");
+ }else
+ {
+ this.dispose();
+ Home h=new Home();
+ h.setSize(1035,790);
+ h.setVisible(true);
+ }
+ }
+
+ public static void main(String args[])
+ {
+ ComposePage cp=new ComposePage();
+ cp.setSize(1035,740);
+ cp.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/projects/Digital Steganography Java Project/coding/Home.class b/projects/Digital Steganography Java Project/coding/Home.class
new file mode 100644
index 0000000..f29698d
Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/Home.class differ
diff --git a/projects/Digital Steganography Java Project/coding/Home.java b/projects/Digital Steganography Java Project/coding/Home.java
new file mode 100644
index 0000000..3c15580
--- /dev/null
+++ b/projects/Digital Steganography Java Project/coding/Home.java
@@ -0,0 +1,49 @@
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+
+public class Home extends JFrame implements ActionListener
+{
+ private JButton compose,breakmsg;
+
+ Home()
+ {
+ super("Steganography");
+ Container con=getContentPane();
+ con.setLayout(null);
+ compose=new JButton("Compose");
+ compose.addActionListener(this);
+ compose.setBounds(300,350,150,50);
+ breakmsg=new JButton("Break");
+ breakmsg.addActionListener(this);
+ breakmsg.setBounds(550,350,150,50);
+ con.add(compose);
+ con.add(breakmsg);
+ }
+
+ public void actionPerformed(ActionEvent ae)
+ {
+ if(ae.getSource()==compose)
+ {
+ this.dispose();
+ ComposePage cp=new ComposePage();
+ cp.setSize(1035,790);
+ cp.setVisible(true);
+ }
+
+ if(ae.getSource()==breakmsg)
+ {
+ this.dispose();
+ BreakPage bp=new BreakPage();
+ bp.setSize(1035,790);
+ bp.setVisible(true);
+ }
+ }
+
+ public static void main(String args[])
+ {
+ Home h=new Home();
+ h.setSize(1035,790);
+ h.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/projects/Digital Steganography Java Project/coding/Sunset.jpg b/projects/Digital Steganography Java Project/coding/Sunset.jpg
new file mode 100644
index 0000000..c43212b
Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/Sunset.jpg differ
diff --git a/projects/Digital Steganography Java Project/coding/test.class b/projects/Digital Steganography Java Project/coding/test.class
new file mode 100644
index 0000000..8fbd2eb
Binary files /dev/null and b/projects/Digital Steganography Java Project/coding/test.class differ
diff --git a/projects/Digital Steganography Java Project/coding/test.java b/projects/Digital Steganography Java Project/coding/test.java
new file mode 100644
index 0000000..74d8e12
--- /dev/null
+++ b/projects/Digital Steganography Java Project/coding/test.java
@@ -0,0 +1,28 @@
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import java.io.*;
+import java.awt.image.*;
+
+public class test extends JFrame
+{
+ Image newimg;
+ test()
+ {
+ }
+ test(Image m)
+ {
+ newimg=m;
+ }
+ public void paint(Graphics g)
+ {
+ g.drawImage(newimg,100,100,null);
+ }
+
+ public static void main(String args[])
+ {
+ test bp=new test();
+ bp.setSize(1035,740);
+ bp.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/projects/Email Client Software Project Java/FetchMail/.classpath b/projects/Email Client Software Project Java/FetchMail/.classpath
new file mode 100644
index 0000000..c600383
--- /dev/null
+++ b/projects/Email Client Software Project Java/FetchMail/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Email Client Software Project Java/FetchMail/.project b/projects/Email Client Software Project Java/FetchMail/.project
new file mode 100644
index 0000000..82889cf
--- /dev/null
+++ b/projects/Email Client Software Project Java/FetchMail/.project
@@ -0,0 +1,26 @@
+
+
+ FetchMail
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ com.tssap.selena.model.modeling_nature
+ com.borland.selena.uml20.uml20_nature
+
+
+
+ Suspended Root
+ 2
+ SuspendedRootVariable
+
+
+
diff --git a/projects/Email Client Software Project Java/FetchMail/Model Folder/default.txvClassDiagram20 b/projects/Email Client Software Project Java/FetchMail/Model Folder/default.txvClassDiagram20
new file mode 100644
index 0000000..14fedfa
--- /dev/null
+++ b/projects/Email Client Software Project Java/FetchMail/Model Folder/default.txvClassDiagram20
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/projects/Email Client Software Project Java/FetchMail/bin/mail2.class b/projects/Email Client Software Project Java/FetchMail/bin/mail2.class
new file mode 100644
index 0000000..a2f6d53
Binary files /dev/null and b/projects/Email Client Software Project Java/FetchMail/bin/mail2.class differ
diff --git a/projects/Email Client Software Project Java/FetchMail/bin/mailframe$1.class b/projects/Email Client Software Project Java/FetchMail/bin/mailframe$1.class
new file mode 100644
index 0000000..e716043
Binary files /dev/null and b/projects/Email Client Software Project Java/FetchMail/bin/mailframe$1.class differ
diff --git a/projects/Email Client Software Project Java/FetchMail/bin/mailframe.class b/projects/Email Client Software Project Java/FetchMail/bin/mailframe.class
new file mode 100644
index 0000000..7cc9ae4
Binary files /dev/null and b/projects/Email Client Software Project Java/FetchMail/bin/mailframe.class differ
diff --git a/projects/Email Client Software Project Java/FetchMail/manifest b/projects/Email Client Software Project Java/FetchMail/manifest
new file mode 100644
index 0000000..8dda92d
--- /dev/null
+++ b/projects/Email Client Software Project Java/FetchMail/manifest
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: mail2
+
diff --git a/projects/Email Client Software Project Java/FetchMail/src/mail2.java b/projects/Email Client Software Project Java/FetchMail/src/mail2.java
new file mode 100644
index 0000000..5fb165e
--- /dev/null
+++ b/projects/Email Client Software Project Java/FetchMail/src/mail2.java
@@ -0,0 +1,200 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+import javax.mail.*;
+
+@SuppressWarnings("serial")
+public class mail2 extends JFrame
+{
+ static String popServer;
+ static String popUser;
+ static String popPassword;
+ public static void main(String args[])
+ {
+ //popServer=args[0];
+ //popUser=args[1];
+ //popPassword=args[2];
+ JFrame frame = new mailframe();
+ frame.setVisible(true);
+ }
+ }
+
+@SuppressWarnings("serial")
+class mailframe extends JFrame implements ActionListener
+{
+ JLabel lserver =new JLabel("SMTP Server");
+ static JTextField tserver = new JTextField(15);
+ JLabel luname =new JLabel("UserName");
+ static JTextField tuname = new JTextField(15);
+ JLabel lpass =new JLabel("Password");
+ static JPasswordField tpass = new JPasswordField(15);
+ static JTextArea message = new JTextArea(30,72);
+
+ public mailframe()
+ {
+ this.setSize(850,500);
+ this.setLayout(new FlowLayout(FlowLayout.LEFT));
+
+ addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ }
+ );
+
+ tpass.setEchoChar('*');
+
+ this.add(lserver);
+ this.add(tserver);
+ this.add(luname);
+ this.add(tuname);
+ this.add(lpass);
+ this.add(tpass);
+
+ JButton b1 =new JButton("Fetch");
+ b1.addActionListener(this);
+ this.add(b1);
+
+ message.setEditable(false);
+ JScrollPane sp = new JScrollPane();
+ message.add(sp);
+ this.add(message);
+
+
+ }
+ public void actionPerformed(ActionEvent e)
+ {
+ System.out.println("debug button");
+ fetchmail();
+ }
+ @SuppressWarnings("deprecation")
+ private void fetchmail()
+ {
+
+ String popServer;
+ String popUser;
+ String popPassword;
+
+ popServer = mailframe.tserver.getText();
+ popUser = mailframe.tuname.getText();
+ popPassword = mailframe.tpass.getText();
+
+ System.out.println(popServer);
+ try
+ {
+ receive(popServer, popUser, popPassword);
+ //receive("mail.imparttechnologies.com","testproject@imparttechnologies.com", "password123");
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Usage: java jmail"+" smtpServer address password ");
+ }
+
+ //System.exit(0);
+
+ }
+ public static void receive(String popServer, String popUser, String popPassword){
+ Store store=null;
+ Folder folder=null;
+ try
+ {
+ Properties props = System.getProperties();
+ Session session = Session.getDefaultInstance(props, null);
+ store = session.getStore("pop3");
+ store.connect(popServer, popUser, popPassword);
+
+ folder = store.getDefaultFolder();
+ if (folder == null) throw new Exception("No default folder");
+
+ folder = folder.getFolder("INBOX");
+ if (folder == null) throw new Exception("No POP3 INBOX");
+
+ folder.open(Folder.READ_ONLY);
+ Message msgs[] = folder.getMessages();
+ BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
+
+ mailframe.message.setText("");
+ int msgNum;
+ for (msgNum = 0; msgNum < msgs.length; msgNum++)
+ {
+ System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject());
+ System.out.println("Do you want to read message? [YES to read/QUIT to end]");
+ String line = reader.readLine();
+ String y = "yes";
+ int j = line.compareTo(y);
+ if (j == 0)
+ {
+ //System.out.println(((Message)msgs[msgNum].getContent()).toString());
+ //System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject());
+ msgs[msgNum].writeTo(System.out);
+ //test run start -------->
+ Object content = msgs[msgNum].getContent();
+
+ if (content instanceof Multipart)
+ {
+ StringBuffer messageContent = new StringBuffer();
+ StringBuffer msg = new StringBuffer();
+ Multipart multipart = (Multipart) content;
+ for (int i = 0; i < multipart.getCount(); i++)
+ {
+ Part part = (Part) multipart.getBodyPart(i);
+ if (part.isMimeType("text/plain"))
+ {
+ msg = messageContent.append(part.getContent().toString());
+ String msg1 = new String();
+ String from = new String();
+ String subj = new String();
+ int k ;
+ k = msgNum;
+
+ msg1 = msg.toString();
+ subj = msgs[msgNum].getSubject();
+ from = msgs[msgNum].getFrom()[0].toString();
+
+ mailframe.message.append("Message No:"+(k+1)+"\n");
+ mailframe.message.append("Message From:"+from+"\n");
+ mailframe.message.append("Message Subject:"+subj+"\n");
+ mailframe.message.append("\n"+msg1+"\n");
+
+ }
+ }
+ //return messageContent.toString();
+
+ } else
+ {
+ //return content.toString();
+ }
+
+
+ //System.out.println("Debug 1 -> for 1 -> if yes");
+ }
+ else
+ {
+ System.out.println("Closing Previous Message. Going For Next.");
+ //break;
+ }
+ //msgs[msgNum].writeTo(System.out);
+ }
+
+ //System.exit(0);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ if (folder!=null) folder.close(false);
+ if (store!=null) store.close();
+ }
+ catch (Exception ex2) {ex2.printStackTrace();}
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/Email Client Software Project Java/Jar Files/Classifier4J-0.6.jar b/projects/Email Client Software Project Java/Jar Files/Classifier4J-0.6.jar
new file mode 100644
index 0000000..6168172
Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/Classifier4J-0.6.jar differ
diff --git a/projects/Email Client Software Project Java/Jar Files/Classifier4J-Optional-0.6.jar b/projects/Email Client Software Project Java/Jar Files/Classifier4J-Optional-0.6.jar
new file mode 100644
index 0000000..d88ee82
Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/Classifier4J-Optional-0.6.jar differ
diff --git a/projects/Email Client Software Project Java/Jar Files/activation.jar b/projects/Email Client Software Project Java/Jar Files/activation.jar
new file mode 100644
index 0000000..29a59a9
Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/activation.jar differ
diff --git a/projects/Email Client Software Project Java/Jar Files/mail.jar b/projects/Email Client Software Project Java/Jar Files/mail.jar
new file mode 100644
index 0000000..0922295
Binary files /dev/null and b/projects/Email Client Software Project Java/Jar Files/mail.jar differ
diff --git a/projects/Email Client Software Project Java/Project Report and ppt/documentation/INDEX.doc b/projects/Email Client Software Project Java/Project Report and ppt/documentation/INDEX.doc
new file mode 100644
index 0000000..cca955c
Binary files /dev/null and b/projects/Email Client Software Project Java/Project Report and ppt/documentation/INDEX.doc differ
diff --git a/projects/Email Client Software Project Java/Project Report and ppt/documentation/Project Report.doc b/projects/Email Client Software Project Java/Project Report and ppt/documentation/Project Report.doc
new file mode 100644
index 0000000..599cff5
Binary files /dev/null and b/projects/Email Client Software Project Java/Project Report and ppt/documentation/Project Report.doc differ
diff --git a/projects/Email Client Software Project Java/Project Report and ppt/ppt.pptx b/projects/Email Client Software Project Java/Project Report and ppt/ppt.pptx
new file mode 100644
index 0000000..26112c3
Binary files /dev/null and b/projects/Email Client Software Project Java/Project Report and ppt/ppt.pptx differ
diff --git a/projects/Email Client Software Project Java/Project/CODE.java b/projects/Email Client Software Project Java/Project/CODE.java
new file mode 100644
index 0000000..5fb165e
--- /dev/null
+++ b/projects/Email Client Software Project Java/Project/CODE.java
@@ -0,0 +1,200 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+import javax.mail.*;
+
+@SuppressWarnings("serial")
+public class mail2 extends JFrame
+{
+ static String popServer;
+ static String popUser;
+ static String popPassword;
+ public static void main(String args[])
+ {
+ //popServer=args[0];
+ //popUser=args[1];
+ //popPassword=args[2];
+ JFrame frame = new mailframe();
+ frame.setVisible(true);
+ }
+ }
+
+@SuppressWarnings("serial")
+class mailframe extends JFrame implements ActionListener
+{
+ JLabel lserver =new JLabel("SMTP Server");
+ static JTextField tserver = new JTextField(15);
+ JLabel luname =new JLabel("UserName");
+ static JTextField tuname = new JTextField(15);
+ JLabel lpass =new JLabel("Password");
+ static JPasswordField tpass = new JPasswordField(15);
+ static JTextArea message = new JTextArea(30,72);
+
+ public mailframe()
+ {
+ this.setSize(850,500);
+ this.setLayout(new FlowLayout(FlowLayout.LEFT));
+
+ addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ }
+ );
+
+ tpass.setEchoChar('*');
+
+ this.add(lserver);
+ this.add(tserver);
+ this.add(luname);
+ this.add(tuname);
+ this.add(lpass);
+ this.add(tpass);
+
+ JButton b1 =new JButton("Fetch");
+ b1.addActionListener(this);
+ this.add(b1);
+
+ message.setEditable(false);
+ JScrollPane sp = new JScrollPane();
+ message.add(sp);
+ this.add(message);
+
+
+ }
+ public void actionPerformed(ActionEvent e)
+ {
+ System.out.println("debug button");
+ fetchmail();
+ }
+ @SuppressWarnings("deprecation")
+ private void fetchmail()
+ {
+
+ String popServer;
+ String popUser;
+ String popPassword;
+
+ popServer = mailframe.tserver.getText();
+ popUser = mailframe.tuname.getText();
+ popPassword = mailframe.tpass.getText();
+
+ System.out.println(popServer);
+ try
+ {
+ receive(popServer, popUser, popPassword);
+ //receive("mail.imparttechnologies.com","testproject@imparttechnologies.com", "password123");
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Usage: java jmail"+" smtpServer address password ");
+ }
+
+ //System.exit(0);
+
+ }
+ public static void receive(String popServer, String popUser, String popPassword){
+ Store store=null;
+ Folder folder=null;
+ try
+ {
+ Properties props = System.getProperties();
+ Session session = Session.getDefaultInstance(props, null);
+ store = session.getStore("pop3");
+ store.connect(popServer, popUser, popPassword);
+
+ folder = store.getDefaultFolder();
+ if (folder == null) throw new Exception("No default folder");
+
+ folder = folder.getFolder("INBOX");
+ if (folder == null) throw new Exception("No POP3 INBOX");
+
+ folder.open(Folder.READ_ONLY);
+ Message msgs[] = folder.getMessages();
+ BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
+
+ mailframe.message.setText("");
+ int msgNum;
+ for (msgNum = 0; msgNum < msgs.length; msgNum++)
+ {
+ System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject());
+ System.out.println("Do you want to read message? [YES to read/QUIT to end]");
+ String line = reader.readLine();
+ String y = "yes";
+ int j = line.compareTo(y);
+ if (j == 0)
+ {
+ //System.out.println(((Message)msgs[msgNum].getContent()).toString());
+ //System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject());
+ msgs[msgNum].writeTo(System.out);
+ //test run start -------->
+ Object content = msgs[msgNum].getContent();
+
+ if (content instanceof Multipart)
+ {
+ StringBuffer messageContent = new StringBuffer();
+ StringBuffer msg = new StringBuffer();
+ Multipart multipart = (Multipart) content;
+ for (int i = 0; i < multipart.getCount(); i++)
+ {
+ Part part = (Part) multipart.getBodyPart(i);
+ if (part.isMimeType("text/plain"))
+ {
+ msg = messageContent.append(part.getContent().toString());
+ String msg1 = new String();
+ String from = new String();
+ String subj = new String();
+ int k ;
+ k = msgNum;
+
+ msg1 = msg.toString();
+ subj = msgs[msgNum].getSubject();
+ from = msgs[msgNum].getFrom()[0].toString();
+
+ mailframe.message.append("Message No:"+(k+1)+"\n");
+ mailframe.message.append("Message From:"+from+"\n");
+ mailframe.message.append("Message Subject:"+subj+"\n");
+ mailframe.message.append("\n"+msg1+"\n");
+
+ }
+ }
+ //return messageContent.toString();
+
+ } else
+ {
+ //return content.toString();
+ }
+
+
+ //System.out.println("Debug 1 -> for 1 -> if yes");
+ }
+ else
+ {
+ System.out.println("Closing Previous Message. Going For Next.");
+ //break;
+ }
+ //msgs[msgNum].writeTo(System.out);
+ }
+
+ //System.exit(0);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ if (folder!=null) folder.close(false);
+ if (store!=null) store.close();
+ }
+ catch (Exception ex2) {ex2.printStackTrace();}
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/Email Client Software Project Java/Project/Read The Text.txt b/projects/Email Client Software Project Java/Project/Read The Text.txt
new file mode 100644
index 0000000..e7eadbe
--- /dev/null
+++ b/projects/Email Client Software Project Java/Project/Read The Text.txt
@@ -0,0 +1,21 @@
+Procedure for running the project
+
+1.Install NetBeans Software in your System
+
+2.Create new project called FetchMail
+
+3.Create File name called mail2.java.
+
+4.Add the jar files into the library.
+
+5.Run the Project by holding Shift-F6.
+
+6.In the login form enter smtpserver ,login name, password.
+
+7.It display debug window.
+
+8.Read the messages by pressing YES,NO to diacard.
+
+9.It shows the messages in a panel specifying sender,site.
+
+10.This is our project.....
diff --git a/projects/Email Client Software Project Java/Readme.docx b/projects/Email Client Software Project Java/Readme.docx
new file mode 100644
index 0000000..cf11c06
Binary files /dev/null and b/projects/Email Client Software Project Java/Readme.docx differ
diff --git a/projects/JAVA-PROJECTS-master/.classpath b/projects/JAVA-PROJECTS-master/.classpath
new file mode 100644
index 0000000..ac37fb2
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/.classpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/projects/JAVA-PROJECTS-master/.project b/projects/JAVA-PROJECTS-master/.project
new file mode 100644
index 0000000..05b0c7f
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/.project
@@ -0,0 +1,17 @@
+
+
+ JAVA-PROJECTS-master
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/beans/Associate.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/beans/Associate.class
new file mode 100644
index 0000000..52b67fd
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/beans/Associate.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/client/Client.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/client/Client.class
new file mode 100644
index 0000000..6447fa5
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/client/Client.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class
new file mode 100644
index 0000000..7f6c0f7
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class
new file mode 100644
index 0000000..73fc3c0
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class
new file mode 100644
index 0000000..b30902d
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class
new file mode 100644
index 0000000..41e77bc
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/InValidAssociateIDException.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class
new file mode 100644
index 0000000..816a8ba
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/provider/Provider.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/provider/Provider.class
new file mode 100644
index 0000000..eca7576
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/provider/Provider.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServices.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServices.class
new file mode 100644
index 0000000..4ccd9d5
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServicesImpl.class b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServicesImpl.class
new file mode 100644
index 0000000..588d82f
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/com/zensar/payroll/services/PayrollServicesImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/data.properties
new file mode 100644
index 0000000..a5cab98
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/data.properties
@@ -0,0 +1,2 @@
+serviceProvider =com.zensar.payroll.services.PayrollServicesImpl
+repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/storeAssociates.txt b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/storeAssociates.txt
new file mode 100644
index 0000000..95671e1
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/bin/resources/storeAssociates.txt differ
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/beans/Associate.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/beans/Associate.java
new file mode 100644
index 0000000..a625655
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/beans/Associate.java
@@ -0,0 +1,179 @@
+package com.zensar.payroll.beans;
+
+import java.io.Serializable;
+
+public class Associate implements Serializable{
+
+ private int associateId, basicSalary, hra, ta, da, grossSalary, pf,
+ companyPf, monthlyTax, netSalary, investment;
+ private String associateName, emailID, panCard;
+
+ public Associate() {
+
+ }
+
+ public Associate(int associateId, int basicSalary, int hra, int ta, int da,
+ int grossSalary, int pf, int companyPf, int monthlyTax,
+ int netSalary, int investment, String associateName,
+ String emailID, String panCard) {
+ super();
+ this.associateId = associateId;
+ this.basicSalary = basicSalary;
+ this.hra = hra;
+ this.ta = ta;
+ this.da = da;
+ this.grossSalary = grossSalary;
+ this.pf = pf;
+ this.companyPf = companyPf;
+ this.monthlyTax = monthlyTax;
+ this.netSalary = netSalary;
+ this.investment = investment;
+ this.associateName = associateName;
+ this.emailID = emailID;
+ this.panCard = panCard;
+ }
+
+ public Associate(String associateName, String emailId, String panCard,
+ int basicSalary, int pf, int comapnyPf, int investment) {
+ super();
+ this.associateName = associateName;
+ this.emailID = emailId;
+ this.panCard = panCard;
+ this.basicSalary = basicSalary;
+ this.pf = pf;
+ this.companyPf = comapnyPf;
+ this.investment = investment;
+ }
+
+ public Associate(int hra, int ta, int da, int monthlyTax, int netSalary) {
+ this.hra = hra;
+ this.ta = ta;
+ this.da = da;
+ this.monthlyTax = monthlyTax;
+ this.netSalary = netSalary;
+ }
+
+ public int getAssociateId() {
+ return associateId;
+ }
+
+ public void setAssociateId(int associateId) {
+ this.associateId = associateId;
+ }
+
+ public int getBasicSalary() {
+ return basicSalary;
+ }
+
+ public void setBasicSalary(int basicSalary) {
+ this.basicSalary = basicSalary;
+ }
+
+ public int getHra() {
+ return hra;
+ }
+
+ public void setHra(int hra) {
+ this.hra = hra;
+ }
+
+ public int getTa() {
+ return ta;
+ }
+
+ public void setTa(int ta) {
+ this.ta = ta;
+ }
+
+ public int getDa() {
+ return da;
+ }
+
+ public void setDa(int da) {
+ this.da = da;
+ }
+
+ public int getGrossSalary() {
+ return grossSalary;
+ }
+
+ public void setGrossSalary(int grossSalary) {
+ this.grossSalary = grossSalary;
+ }
+
+ public int getPf() {
+ return pf;
+ }
+
+ public void setPf(int pf) {
+ this.pf = pf;
+ }
+
+ public int getCompanyPf() {
+ return companyPf;
+ }
+
+ public void setCompanyPf(int companyPf) {
+ this.companyPf = companyPf;
+ }
+
+ public int getMonthlyTax() {
+ return monthlyTax;
+ }
+
+ public void setMonthlyTax(int monthlyTax) {
+ this.monthlyTax = monthlyTax;
+ }
+
+ public int getNetSalary() {
+ return netSalary;
+ }
+
+ public void setNetSalary(int netSalary) {
+ this.netSalary = netSalary;
+ }
+
+ public String getAssociateName() {
+ return associateName;
+ }
+
+ public void setAssociateName(String associateName) {
+ this.associateName = associateName;
+ }
+
+ public String getEmailID() {
+ return emailID;
+ }
+
+ public void setEmailID(String emailID) {
+ this.emailID = emailID;
+ }
+
+ public String getPanCard() {
+ return panCard;
+ }
+
+ public void setPanCard(String panCard) {
+ this.panCard = panCard;
+ }
+
+ public int getInvestment() {
+ return investment;
+ }
+
+ public void setInvestment(int investment) {
+ this.investment = investment;
+ }
+
+ @Override
+ public String toString() {
+ return "Associate [associateId=" + associateId + ", basicSalary="
+ + basicSalary + ", hra=" + hra + ", ta=" + ta + ", da=" + da
+ + ", grossSalary=" + grossSalary + ", pf=" + pf
+ + ", companyPf=" + companyPf + ", monthlyTax=" + monthlyTax
+ + ", netSalary=" + netSalary + ", investment=" + investment
+ + ", associateName=" + associateName + ", emailID=" + emailID
+ + ", panCard=" + panCard + "]";
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/client/Client.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/client/Client.java
new file mode 100644
index 0000000..c41c387
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/client/Client.java
@@ -0,0 +1,249 @@
+package com.zensar.payroll.client;
+
+import java.util.ArrayList;
+import java.util.InputMismatchException;
+import java.util.Scanner;
+
+import com.zensar.payroll.beans.Associate;
+import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException;
+import com.zensar.payroll.exceptions.InValidAssociateIDException;
+import com.zensar.payroll.exceptions.PayRollServicesNotFoundException;
+import com.zensar.payroll.provider.Provider;
+import com.zensar.payroll.services.PayrollServices;
+
+public class Client {
+
+ public static void main(String[] args) {
+
+ PayrollServices services = null;
+ Scanner scanner = null;
+ String decision;
+ String associateName, emailId, panCard;
+ int basicSalary, pf, comapnyPf, investment, associateId, choice = 0;
+ scanner = new Scanner(System.in);
+
+ try {
+ services = Provider.getPayrollServices("serviceProvider");
+ } catch (PayRollServicesNotFoundException e1) {
+ // e1.printStackTrace();
+ System.out.println("Sorry service is unavailable currently");
+ System.exit(0);
+ }
+
+ do {
+ String menuAlignFormat = "| %-101s |%n";
+ printLine2();
+ System.out.format(menuAlignFormat,
+ "Welcome to Zensar Payroll System");
+ printLine2();
+ System.out.format(menuAlignFormat, "1. Registration");
+ System.out.format(menuAlignFormat,
+ "2. Calculate Monthly Net Salary");
+ System.out.format(menuAlignFormat, "3. Get Associate Details");
+ System.out.format(menuAlignFormat, "4. Get All Associate Details");
+ System.out.format(menuAlignFormat, "5. Close payroll services");
+ printLine2();
+ System.out.format(menuAlignFormat, "Please enter your choice");
+ printLine2();
+
+ try {
+
+ choice = scanner.nextInt();
+ switch (choice) {
+ case 1:
+ scanner.nextLine();
+ System.out.println("Enter your name");
+ associateName = scanner.nextLine();
+ System.out.println("Enter your email Id");
+ emailId = scanner.next();
+ System.out.println("Enter your pan card");
+ panCard = scanner.next();
+ System.out.println("Enter your basic salary");
+ basicSalary = scanner.nextInt();
+ System.out.println("Enter your pf");
+ pf = scanner.nextInt();
+ System.out.println("Enter your Company pf");
+ comapnyPf = scanner.nextInt();
+ System.out.println("Enter your investment");
+ investment = scanner.nextInt();
+
+ System.out
+ .println("Successfully registered with associate Id "
+ + services.acceptCustomerDetails(
+ associateName, emailId, panCard,
+ basicSalary, pf, comapnyPf,
+ investment));
+ break;
+ case 2:
+ System.out.println("Enter your associate Id");
+
+ associateId = scanner.nextInt();
+
+ int monthlyNetSalary = services
+ .calculateMonthlyNetSalary(associateId);
+ System.out.println("Monthly Net Salary: "
+ + monthlyNetSalary);
+ break;
+
+ case 3:
+
+ System.out.println("Enter your associate Id");
+ associateId = scanner.nextInt();
+
+ Associate associate = services
+ .getAssociateDetails(associateId);
+
+ printLine2();
+ System.out.format("| %50s %-50s |%n", "PAY SLIP", " ");
+ printLine2();
+ printPayRoll(associate);
+
+ break;
+ case 4:
+
+ ArrayList associates = services
+ .getAllAssociateDetails();
+
+ printLine2();
+ System.out
+ .format("| %60s %-40s |%n", "ZENSAR PAYROLL", " ");
+ printLine2();
+
+ for (Associate a : associates) {
+
+ String leftAlignFormat = "|%-50s |%-50s |%n";
+
+ System.out.format(leftAlignFormat, "Associate Id",
+ a.getAssociateId());
+ System.out.format(leftAlignFormat, "Associate Name",
+ a.getAssociateName());
+ System.out.format(leftAlignFormat,
+ "Associate Email Id", a.getEmailID());
+ System.out.format(leftAlignFormat,
+ "Associate PAN Card", a.getPanCard());
+
+ printLine2();
+
+ System.out.format(leftAlignFormat, "Basic Salary",
+ a.getBasicSalary());
+ System.out.format(leftAlignFormat, "HRA", a.getHra());
+ System.out.format(leftAlignFormat, "TA", a.getTa());
+ System.out.format(leftAlignFormat, "DA", a.getDa());
+ System.out.format(leftAlignFormat, "PF", a.getPf());
+ System.out.format(leftAlignFormat, "Company PF",
+ a.getCompanyPf());
+ System.out.format(leftAlignFormat, "Monthly Tax",
+ a.getMonthlyTax());
+ System.out.format(leftAlignFormat, "Net Salary",
+ a.getNetSalary());
+
+ printLine2();
+ printLine2();
+ }
+
+ break;
+ case 5:
+
+ if (services.closePayrollServices() == true) {
+ System.out
+ .println("Thank you for using the payroll system");
+ System.exit(0);
+ }
+ break;
+ default:
+ System.out.println("Invalid choice");
+ break;
+ }
+ } catch (PayRollServicesNotFoundException e) {
+ // e.printStackTrace();
+ System.out.println("Sorry service is unavailable currently");
+ System.exit(0);
+ } catch (InValidAssociateIDException e) {
+ e.printStackTrace();
+ System.out.println("Please enter a valid assoicate ID");
+ } catch (AssociateDetailsNotFoundException e) {
+ // e.printStackTrace();
+ System.out.println("Sorry you have not registered");
+ } catch (InputMismatchException e) {
+ System.out.println("Please enter a valid input");
+ scanner.next();
+ } catch (Exception e) {
+ System.out.println("Something went wrong, Please try again");
+ }
+
+ System.out.println("Do you wish to continue?(Y/N)");
+ do {
+ decision = scanner.next();
+ if (decision.equalsIgnoreCase("n")) {
+ System.out
+ .println("Thank you for using the payroll system");
+ scanner.close();
+ System.exit(0);
+ } else if (!decision.equalsIgnoreCase("y")) {
+ System.out.println("Please enter a valid input (Y/N)");
+ }
+ } while (!decision.equalsIgnoreCase("y"));
+
+ } while (decision.equalsIgnoreCase("y"));
+
+ }
+
+ public static void printPayRoll(Associate associate) {
+ String leftAlignFormat = "|%-50s |%-50s |%n";
+ String leftAlignFormat2 = "|%-25s|%25s|%-25s|%25s|%n";
+ String leftAlignFormat3 = "|%25s|%25s|%25s|%25s|%n";
+
+ System.out.format(leftAlignFormat, "Associate Id",
+ associate.getAssociateId());
+ System.out.format(leftAlignFormat, "Associate Name",
+ associate.getAssociateName());
+ System.out.format(leftAlignFormat, "Associate Email Id",
+ associate.getEmailID());
+ System.out.format(leftAlignFormat, "Associate PAN Card",
+ associate.getPanCard());
+ printLine2();
+ printLine2();
+ System.out.format(leftAlignFormat3, "Earnings", "Amount", "Deductions",
+ "Amount");
+ printLine();
+ System.out.format(leftAlignFormat2, "Basic Salary",
+ associate.getBasicSalary(), "Company PF",
+ associate.getCompanyPf());
+ System.out.format(leftAlignFormat2, "HRA", associate.getHra(), "PF",
+ associate.getPf());
+ System.out.format(leftAlignFormat2, "DA", associate.getDa(),
+ "Monthly Tax", associate.getMonthlyTax());
+ System.out.format(leftAlignFormat2, "TA", associate.getTa(), " ", " ");
+ System.out.format(leftAlignFormat2, "Company PF",
+ associate.getCompanyPf(), " ", " ");
+ printLine();
+ System.out.format(leftAlignFormat2, "Gross Salary",
+ associate.getGrossSalary(), "Total Deductions",
+ associate.getMonthlyTax() + associate.getCompanyPf()
+ + associate.getPf());
+ printLine();
+ System.out.format(leftAlignFormat2, " ", " ", "Net Salary",
+ associate.getNetSalary());
+ printLine2();
+ }
+
+ public static void printLine() {
+ System.out.print("|");
+ for (int i = 1; i <= 104; i++) {
+ if (i == 26 || i == 52 || i == 78 || i == 104)
+ System.out.print("|");
+ else
+ System.out.print("-");
+ }
+ System.out.println();
+ }
+
+ public static void printLine2() {
+ System.out.print("|");
+ for (int i = 1; i <= 103; i++) {
+ System.out.print("-");
+ }
+ System.out.println("|");
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServices.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServices.java
new file mode 100644
index 0000000..6cbb643
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServices.java
@@ -0,0 +1,18 @@
+package com.zensar.payroll.daoservices;
+
+import java.util.ArrayList;
+
+import com.zensar.payroll.beans.Associate;
+
+public interface PayrollDAOServices {
+
+ int insertAssociate(Associate associate);
+
+ boolean updateAssociate(Associate associate);
+
+ Associate getAssociate(int associateId);
+
+ ArrayList getAssociates();
+
+ boolean closePayrollDAOServices();
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java
new file mode 100644
index 0000000..8d22ada
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/daoservices/PayrollDAOServicesImpl.java
@@ -0,0 +1,101 @@
+package com.zensar.payroll.daoservices;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import com.zensar.payroll.beans.Associate;
+
+public class PayrollDAOServicesImpl implements PayrollDAOServices {
+
+ static int associateId=1000;
+ Map map = new HashMap();
+
+ public PayrollDAOServicesImpl() {
+ ObjectInputStream objectInputStream = null;
+ try {
+ FileInputStream fos = new FileInputStream(".\\src\\resources\\storeAssociates.txt");
+ objectInputStream = new ObjectInputStream(fos);
+ map = (Map) objectInputStream.readObject();
+ associateId = 1000 + map.size();
+ } catch (FileNotFoundException e) {
+ //e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ //e.printStackTrace();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }finally{
+ if(objectInputStream!=null)
+ try {
+ objectInputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public int insertAssociate(Associate associate) {
+ associate.setAssociateId(associateId);
+ map.put(associateId, associate);
+ System.out.println(associateId);
+ associateId++;
+ return associate.getAssociateId();
+ }
+
+ @Override
+ public boolean updateAssociate(Associate associate) {
+ if(map.put(associate.getAssociateId(), associate)!=null)
+ return true;
+ else
+ return false;
+ }
+
+ @Override
+ public Associate getAssociate(int associateId) {
+ if(map.get(associateId)!=null)
+ return map.get(associateId);
+ else
+ return null;
+ }
+
+ @Override
+ public ArrayList getAssociates() {
+ ArrayList associates = new ArrayList(map.values());
+ if(associates.isEmpty())
+ return null;
+ else
+ return associates;
+ }
+
+ @Override
+ public boolean closePayrollDAOServices() {
+ ObjectOutputStream objectOutputStream = null;
+ try {
+ FileOutputStream fos = new FileOutputStream(".\\src\\resources\\storeAssociates.txt");
+ objectOutputStream = new ObjectOutputStream(fos);
+ objectOutputStream.writeObject(map);
+ return true;
+ } catch (FileNotFoundException e) {
+ //e.printStackTrace();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ finally{
+ if(objectOutputStream!=null)
+ try {
+ objectOutputStream.close();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ }
+ return false;
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java
new file mode 100644
index 0000000..fb58298
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/AssociateDetailsNotFoundException.java
@@ -0,0 +1,32 @@
+package com.zensar.payroll.exceptions;
+
+@SuppressWarnings("serial")
+public class AssociateDetailsNotFoundException extends Exception {
+
+ public AssociateDetailsNotFoundException() {
+ super();
+ }
+
+ public AssociateDetailsNotFoundException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public AssociateDetailsNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public AssociateDetailsNotFoundException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public AssociateDetailsNotFoundException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java
new file mode 100644
index 0000000..14926a4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/InValidAssociateIDException.java
@@ -0,0 +1,32 @@
+package com.zensar.payroll.exceptions;
+
+@SuppressWarnings("serial")
+public class InValidAssociateIDException extends Exception{
+
+ public InValidAssociateIDException() {
+ super();
+ }
+
+ public InValidAssociateIDException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InValidAssociateIDException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InValidAssociateIDException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InValidAssociateIDException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java
new file mode 100644
index 0000000..807820e
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/exceptions/PayRollServicesNotFoundException.java
@@ -0,0 +1,32 @@
+package com.zensar.payroll.exceptions;
+
+@SuppressWarnings("serial")
+public class PayRollServicesNotFoundException extends Exception {
+
+ public PayRollServicesNotFoundException() {
+ super();
+ }
+
+ public PayRollServicesNotFoundException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public PayRollServicesNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public PayRollServicesNotFoundException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public PayRollServicesNotFoundException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/provider/Provider.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/provider/Provider.java
new file mode 100644
index 0000000..bbf22f4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/provider/Provider.java
@@ -0,0 +1,37 @@
+package com.zensar.payroll.provider;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import com.zensar.payroll.exceptions.PayRollServicesNotFoundException;
+
+public class Provider {
+ static Properties properties = null;
+
+ public static T getPayrollServices(String key)
+ throws PayRollServicesNotFoundException {
+ try {
+ properties = new Properties();
+ properties
+ .load(new FileReader(".\\src\\resources\\data.properties"));
+ String provider = (String) properties.get(key);
+ Class> c = Class.forName(provider);
+ return (T) c.newInstance();
+ } catch (FileNotFoundException e) {
+ throw new PayRollServicesNotFoundException(e);
+ } catch (ClassNotFoundException e) {
+ throw new PayRollServicesNotFoundException(e);
+ } catch (InstantiationException e) {
+ throw new PayRollServicesNotFoundException(e);
+ } catch (IllegalAccessException e) {
+ throw new PayRollServicesNotFoundException(e);
+ } catch (IOException e) {
+ throw new PayRollServicesNotFoundException(e);
+ } catch (Exception e) {
+ throw new PayRollServicesNotFoundException(e);
+ }
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServices.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServices.java
new file mode 100644
index 0000000..8c9e85b
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServices.java
@@ -0,0 +1,29 @@
+package com.zensar.payroll.services;
+
+import java.util.ArrayList;
+
+import com.zensar.payroll.beans.Associate;
+import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException;
+import com.zensar.payroll.exceptions.InValidAssociateIDException;
+import com.zensar.payroll.exceptions.PayRollServicesNotFoundException;
+
+public interface PayrollServices {
+
+ int acceptCustomerDetails(String associateName, String emailId,
+ String panCard, int basicSalary, int pf, int comapnyPf,
+ int investment) throws PayRollServicesNotFoundException;
+
+ int calculateMonthlyNetSalary(int associateId)
+ throws InValidAssociateIDException,
+ AssociateDetailsNotFoundException, PayRollServicesNotFoundException;
+
+ Associate getAssociateDetails(int associateId)
+ throws InValidAssociateIDException,
+ AssociateDetailsNotFoundException;
+
+ ArrayList getAllAssociateDetails()
+ throws PayRollServicesNotFoundException;
+
+ boolean closePayrollServices() throws PayRollServicesNotFoundException;
+
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServicesImpl.java b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServicesImpl.java
new file mode 100644
index 0000000..269275d
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/com/zensar/payroll/services/PayrollServicesImpl.java
@@ -0,0 +1,140 @@
+package com.zensar.payroll.services;
+
+import java.util.ArrayList;
+
+import com.zensar.payroll.beans.Associate;
+import com.zensar.payroll.daoservices.PayrollDAOServices;
+import com.zensar.payroll.exceptions.AssociateDetailsNotFoundException;
+import com.zensar.payroll.exceptions.InValidAssociateIDException;
+import com.zensar.payroll.exceptions.PayRollServicesNotFoundException;
+import com.zensar.payroll.provider.Provider;
+
+public class PayrollServicesImpl implements PayrollServices {
+
+ private PayrollDAOServices dao = null;
+ private static final int SLAB_ONE_UPPER_LIMIT = 250000;
+ private static final int SLAB_TWO_UPPER_LIMIT = 500000;
+ private static final int SLAB_THREE_UPPER_LIMIT = 800000;
+ private static final int INVESTMENT_EXEMPTION_LIMIT = 150000;
+ private static final int SLAB_TWO_AMOUNT = 250000;
+ private static final int SLAB_THREE_AMOUNT = 300000;
+ private static final float SLAB_TWO_TAX_RATE = 0.1f;
+ private static final float SLAB_THREE_TAX_RATE = 0.2f;
+ private static final float SLAB_THREE_ABOVE_TAX_RATE = 0.3f;
+ private static final int MONTHS = 12;
+ private static final float RATE = 0.1f;
+
+ public PayrollServicesImpl() throws PayRollServicesNotFoundException {
+ try {
+ dao = Provider.getPayrollServices("repoProvider");
+ } catch (Exception e) {
+ throw new PayRollServicesNotFoundException(e);
+ }
+ }
+
+ @Override
+ public int acceptCustomerDetails(String associateName, String emailId,
+ String panCard, int basicSalary, int pf, int comapnyPf,
+ int investment) throws PayRollServicesNotFoundException {
+
+ int associateId = dao.insertAssociate(new Associate(associateName,
+ emailId, panCard, basicSalary, pf, comapnyPf, investment));
+ return associateId;
+ }
+
+ @Override
+ public int calculateMonthlyNetSalary(int associateId)
+ throws InValidAssociateIDException,
+ AssociateDetailsNotFoundException, PayRollServicesNotFoundException {
+ Associate associate = null;
+ int grossAnnualSalary;
+ int annualTax = 0, taxableAmount, annualInvestment, slabTwoTax, slabThreeTax;
+
+ if (associateId < 100) {
+ throw new InValidAssociateIDException();
+ } else {
+ associate = dao.getAssociate(associateId);
+ if (associate == null) {
+ throw new AssociateDetailsNotFoundException();
+ } else {
+ associate.setHra((int) (RATE * associate.getBasicSalary()));
+ associate.setTa((int) (RATE * associate.getBasicSalary()));
+ associate.setDa((int) (RATE * associate.getBasicSalary()));
+ associate.setGrossSalary(associate.getBasicSalary()
+ + associate.getHra() + associate.getTa()
+ + associate.getDa() + associate.getCompanyPf());
+
+ annualInvestment = (associate.getPf() * MONTHS)
+ + (associate.getCompanyPf() * MONTHS)
+ + associate.getInvestment();
+
+ if (annualInvestment > INVESTMENT_EXEMPTION_LIMIT)
+ annualInvestment = INVESTMENT_EXEMPTION_LIMIT;
+
+ grossAnnualSalary = associate.getGrossSalary() * MONTHS;
+ taxableAmount = grossAnnualSalary;
+ slabTwoTax = (int) ((SLAB_TWO_AMOUNT - annualInvestment) * SLAB_TWO_TAX_RATE);
+ slabThreeTax = (int) (SLAB_THREE_AMOUNT * SLAB_THREE_TAX_RATE);
+
+ if (grossAnnualSalary < SLAB_ONE_UPPER_LIMIT) {
+ annualTax = 0;
+ } else if (grossAnnualSalary >= SLAB_ONE_UPPER_LIMIT
+ && grossAnnualSalary < SLAB_TWO_UPPER_LIMIT) {
+ taxableAmount = taxableAmount - SLAB_ONE_UPPER_LIMIT;
+ if ((taxableAmount - annualInvestment) < 0) {
+ annualTax = 0;
+ } else {
+ annualTax = (int) ((taxableAmount - annualInvestment) * SLAB_TWO_TAX_RATE);
+ }
+ } else if (grossAnnualSalary >= SLAB_TWO_UPPER_LIMIT
+ && grossAnnualSalary < SLAB_THREE_UPPER_LIMIT) {
+ taxableAmount = taxableAmount - SLAB_TWO_UPPER_LIMIT;
+ annualTax = (int) (taxableAmount * SLAB_THREE_TAX_RATE)
+ + slabTwoTax;
+ } else {
+ taxableAmount = taxableAmount - SLAB_THREE_UPPER_LIMIT;
+ annualTax = (int) (taxableAmount * SLAB_THREE_ABOVE_TAX_RATE)
+ + slabTwoTax + slabThreeTax;
+ }
+ associate.setMonthlyTax(annualTax / MONTHS);
+ associate.setNetSalary(associate.getGrossSalary()
+ - associate.getPf() - associate.getCompanyPf()
+ - associate.getMonthlyTax());
+ dao.updateAssociate(associate);
+ }
+ }
+ return associate.getNetSalary();
+ }
+
+ @Override
+ public Associate getAssociateDetails(int associateId)
+ throws InValidAssociateIDException,
+ AssociateDetailsNotFoundException {
+ if (associateId < 100) {
+ throw new InValidAssociateIDException();
+ } else if (dao.getAssociate(associateId) == null) {
+ throw new AssociateDetailsNotFoundException();
+ } else {
+ return dao.getAssociate(associateId);
+ }
+ }
+
+ @Override
+ public boolean closePayrollServices()
+ throws PayRollServicesNotFoundException {
+ if (dao.closePayrollDAOServices() == true)
+ return true;
+ else
+ return false;
+ }
+
+ @Override
+ public ArrayList getAllAssociateDetails()
+ throws PayRollServicesNotFoundException {
+ if (dao.getAssociates() == null) {
+ throw new PayRollServicesNotFoundException();
+ } else {
+ return dao.getAssociates();
+ }
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/data.properties b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/data.properties
new file mode 100644
index 0000000..a5cab98
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/data.properties
@@ -0,0 +1,2 @@
+serviceProvider =com.zensar.payroll.services.PayrollServicesImpl
+repoProvider = com.zensar.payroll.daoservices.PayrollDAOServicesImpl
diff --git a/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/storeAssociates.txt b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/storeAssociates.txt
new file mode 100644
index 0000000..95671e1
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/47178 AKASH PAL Payroll/src/resources/storeAssociates.txt differ
diff --git a/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Account.class
new file mode 100644
index 0000000..5498b41
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Account.class differ
diff --git a/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Address.class
new file mode 100644
index 0000000..0d83f39
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/Banking/bin/com/zensar/bankingsystem/beans/Address.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Account.class
new file mode 100644
index 0000000..9cf39ce
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Account.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Address.class
new file mode 100644
index 0000000..0d83f39
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Address.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Customer.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Customer.class
new file mode 100644
index 0000000..43e995e
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Customer.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/MyDate.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/MyDate.class
new file mode 100644
index 0000000..3c1847a
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/MyDate.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Transaction.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Transaction.class
new file mode 100644
index 0000000..c127dbb
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/beans/Transaction.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/client/ClientCode.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/client/ClientCode.class
new file mode 100644
index 0000000..d466fce
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/client/ClientCode.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class
new file mode 100644
index 0000000..62be6cd
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class
new file mode 100644
index 0000000..fd3ccd9
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/BankServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/BankServices.class
new file mode 100644
index 0000000..22740e6
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/BankServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class
new file mode 100644
index 0000000..26278e2
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class
new file mode 100644
index 0000000..16c41d2
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class
new file mode 100644
index 0000000..7549841
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class
new file mode 100644
index 0000000..4bec9f3
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class
new file mode 100644
index 0000000..2514556
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class
new file mode 100644
index 0000000..d90f258
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class
new file mode 100644
index 0000000..528cad7
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/BankServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/BankServices.class
new file mode 100644
index 0000000..4fdcfd2
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/BankServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class
new file mode 100644
index 0000000..1157bd8
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServices.class b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServices.class
new file mode 100644
index 0000000..96dbf36
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithException/bin/com/zensar/bankingsystem/services/ZensarBankingServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Account.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Account.java
new file mode 100644
index 0000000..a3d8080
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Account.java
@@ -0,0 +1,59 @@
+package com.zensar.bankingsystem.beans;
+
+public class Account {
+
+ private int accountId;
+ private String accountType;
+ private int balance;
+ private int pin;
+
+ public Account() {
+ super();
+ }
+
+ public Account(int accountId, String accountType, int balance) {
+ super();
+ this.accountId = accountId;
+ this.accountType = accountType;
+ this.balance = balance;
+ }
+
+ public Account(String accountType, int balance) {
+ super();
+ this.accountType = accountType;
+ this.balance = balance;
+ }
+
+ public int getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(int accountId) {
+ this.accountId = accountId;
+ }
+
+ public String getAccountType() {
+ return accountType;
+ }
+
+ public void setAccountType(String accountType) {
+ this.accountType = accountType;
+ }
+
+ public int getBalance() {
+ return balance;
+ }
+
+ public void setBalance(int balance) {
+ this.balance = balance;
+ }
+
+ public int getPin() {
+ return pin;
+ }
+
+ public void setPin(int pin) {
+ this.pin = pin;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Address.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Address.java
new file mode 100644
index 0000000..1400f16
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Address.java
@@ -0,0 +1,50 @@
+package com.zensar.bankingsystem.beans;
+
+public class Address {
+
+ private String city;
+ private String state;
+ private int pinCode;
+
+ public Address() {
+ super();
+ }
+
+ public Address(String city, String state, int pinCode) {
+ super();
+ this.city = city;
+ this.state = state;
+ this.pinCode = pinCode;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public int getPinCode() {
+ return pinCode;
+ }
+
+ public void setPinCode(int pinCode) {
+ this.pinCode = pinCode;
+ }
+
+ @Override
+ public String toString() {
+ return "Address [city=" + city + ", state=" + state + ", pinCode="
+ + pinCode + "]";
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Customer.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Customer.java
new file mode 100644
index 0000000..fcab67a
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Customer.java
@@ -0,0 +1,89 @@
+package com.zensar.bankingsystem.beans;
+
+public class Customer {
+
+ private int customerId;
+ private String customerName;
+ private Address laddress;
+ private Address haddress;
+ private MyDate dob;
+ private Account[] account = new Account[3];
+
+ public Customer() {
+ super();
+ }
+
+ public Customer(int customerId, String customerName, Address laddress,
+ Address haddress) {
+ super();
+ this.customerId = customerId;
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ }
+
+ public Customer(String customerName, Address laddress, Address haddress) {
+ super();
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ }
+
+ public Customer(String customerName, Address laddress, Address haddress,
+ MyDate dob) {
+ super();
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ this.dob = dob;
+ }
+
+ public int getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(int customerId) {
+ this.customerId = customerId;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public Address getLaddress() {
+ return laddress;
+ }
+
+ public void setLaddress(Address laddress) {
+ this.laddress = laddress;
+ }
+
+ public Address getHaddress() {
+ return haddress;
+ }
+
+ public void setHaddress(Address haddress) {
+ this.haddress = haddress;
+ }
+
+ public Account[] getAccount() {
+ return account;
+ }
+
+ public void setAccount(Account[] account) {
+ this.account = account;
+ }
+
+ public MyDate getDob() {
+ return dob;
+ }
+
+ public void setDob(MyDate dob) {
+ this.dob = dob;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/MyDate.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/MyDate.java
new file mode 100644
index 0000000..4e75da6
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/MyDate.java
@@ -0,0 +1,65 @@
+package com.zensar.bankingsystem.beans;
+
+public class MyDate {
+
+ private int day;
+ private int month;
+ private int year;
+
+ public MyDate() {
+ super();
+ day = 0;
+ month = 0;
+ year = 0;
+ }
+
+ public MyDate(int day, int month, int year) {
+ super();
+ this.day = day;
+ this.month = month;
+ this.year = year;
+ }
+
+ public int getDay() {
+ return day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
+ public int getMonth() {
+ return month;
+ }
+
+ public void setMonth(int month) {
+ this.month = month;
+ }
+
+ public int getYear() {
+ return year;
+ }
+
+ public void setYear(int year) {
+ this.year = year;
+ }
+
+ @Override
+ public String toString() {
+ return "MyDate [day=" + day + ", month=" + month + ", year=" + year
+ + "]";
+ }
+
+ @Override
+ public boolean equals(Object arg) {
+ System.out.println(this);
+ MyDate date = (MyDate) arg;
+ if (this.day == date.day && this.month == date.month
+ && this.year == date.year) {
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Transaction.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Transaction.java
new file mode 100644
index 0000000..b84c4e8
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/beans/Transaction.java
@@ -0,0 +1,5 @@
+package com.zensar.bankingsystem.beans;
+
+public class Transaction {
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/client/ClientCode.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/client/ClientCode.java
new file mode 100644
index 0000000..016a406
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/client/ClientCode.java
@@ -0,0 +1,255 @@
+package com.zensar.bankingsystem.client;
+
+import java.util.Scanner;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.services.ZensarBankingServiceImpl;
+
+public class ClientCode {
+
+ public static void main(String[] args) {
+ String name = null;
+ String localAdrressCity = null;
+ String localAdrressState = null;
+ int localAdrressPinCode = 0;
+ String homeAdrressCity = null;
+ String homeAdrressState = null;
+ int homeAdrressPinCode = 0;
+ int customerId = 0;
+ String accountType = null;
+ int initialBalance = 0;
+ char decision;
+ int choice = 0;
+ int amount = 0, balance = 0;
+ int day, month, year = 0;
+ int oldPin, newPin = 0, pin = 0;
+
+ Scanner scanner = new Scanner(System.in);
+
+ ZensarBankingServiceImpl zensarBankingService = new ZensarBankingServiceImpl();
+
+ System.out.println("Welcome to Zensar Banking Service");
+
+ do {
+
+ System.out.println("1. Customer Registration");
+ System.out.println("2. Open Account");
+ System.out.println("3. Withdraw");
+ System.out.println("4. Deposit");
+ System.out.println("5. Transfer");
+ System.out.println("6. Check balance");
+ System.out.println("7. Change pin");
+ System.out.println("8. Get Account details");
+ System.out.println("9. Get all account details");
+ System.out.println("Enter your option");
+ choice = scanner.nextInt();
+
+ switch (choice) {
+ case 1:
+ // Registration
+ System.out.println("Enter your name");
+ name = scanner.next();
+
+ System.out.println("Enter your local address");
+ System.out.println("Enter your city");
+ localAdrressCity = scanner.next();
+ System.out.println("Enter your state");
+ localAdrressState = scanner.next();
+ System.out.println("Enter your pin code");
+ localAdrressPinCode = scanner.nextInt();
+
+ System.out.println("Enter your home address");
+ System.out.println("Enter your city");
+ homeAdrressCity = scanner.next();
+ System.out.println("Enter your state");
+ homeAdrressState = scanner.next();
+ System.out.println("Enter your pin code");
+ homeAdrressPinCode = scanner.nextInt();
+
+ System.out.println("Enter your date of birth");
+ System.out.println("Enter the day");
+ day = scanner.nextInt();
+ System.out.println("Enter the month");
+ month = scanner.nextInt();
+ System.out.println("Enter the year");
+ year = scanner.nextInt();
+
+ int id = zensarBankingService.acceptCustomerDetails(name,
+ localAdrressCity, localAdrressState,
+ localAdrressPinCode, homeAdrressCity, homeAdrressState,
+ homeAdrressPinCode, day, month, year);
+
+ if (id > 0) {
+ System.out
+ .println("You were successfully registered with customer ID "
+ + id);
+
+ } else
+ System.out.println("Sorry could not register");
+
+ break;
+
+ case 2:
+ // open an account
+ System.out.println("Enter your customer Id to open an account");
+ customerId = scanner.nextInt();
+
+ System.out.println("Enter your account type ");
+ accountType = scanner.next();
+
+ System.out.println("Enter your initial balance ");
+ initialBalance = scanner.nextInt();
+ int accountId = zensarBankingService.openAccount(customerId,
+ initialBalance, accountType);
+
+ if (accountId == 0) {
+ System.out.println("Sorry account could not be created");
+ } else {
+ System.out.println("Account created with account Id "
+ + accountId);
+ pin = zensarBankingService.generatePin(customerId,
+ accountId);
+ System.out.println("Your pin is " + pin);
+ }
+
+ break;
+ case 3:
+ // withdraw
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter the amount to withdraw");
+ amount = scanner.nextInt();
+ System.out.println("Enter your pin");
+ pin = scanner.nextInt();
+
+ balance = zensarBankingService.withdraw(customerId, accountId,
+ amount, pin);
+
+ if (balance > 0) {
+ System.out
+ .println("Amount withdrawn successfully with remaining balance "
+ + balance);
+ } else if (balance < 0) {
+ System.out.println("Cannot withdraw,negative balance");
+ } else {
+ System.out.println("Sorry you have not registered");
+ }
+
+ break;
+ case 4:
+ // deposit
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter the amount to deposit");
+ amount = scanner.nextInt();
+
+ balance = zensarBankingService.deposit(customerId, accountId,
+ amount);
+ System.out
+ .println("Amount successfully deposited, balance is "
+ + balance);
+
+ break;
+ case 5:
+ // transfer fund
+ System.out.println("Enter your customer Id");
+ int custIdFrom = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ int accNoFrom = scanner.nextInt();
+ System.out.println("Enter your pin");
+ pin = scanner.nextInt();
+ System.out.println("Enter the customer Id to transfer to");
+ int custIdTo = scanner.nextInt();
+ System.out.println("Enter the account Id to transfer to");
+ int accNoTo = scanner.nextInt();
+ System.out.println("Enter the amount to tansfer");
+ int amt = scanner.nextInt();
+
+ boolean result = zensarBankingService.fundTransfer(custIdFrom,
+ accNoFrom, custIdTo, accNoTo, amt, pin);
+ if (result == true) {
+ System.out.println("Fund transfer successful");
+ } else {
+ System.out.println("Fund transfer not successful");
+ }
+ break;
+ case 6:
+ // get balance
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter your pin");
+ pin = scanner.nextInt();
+ System.out.println(zensarBankingService.getAccountBalance(
+ customerId, accountId, pin));
+ break;
+ case 7:
+ // change pin
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter your current pin");
+ oldPin = scanner.nextInt();
+ System.out.println("Enter new pin");
+ newPin = scanner.nextInt();
+ result = zensarBankingService.changePin(customerId, accountId,
+ oldPin, newPin);
+ if (result == true) {
+ System.out.println("Pin changed successfully");
+ } else {
+
+ System.out.println("Pin change not successful");
+ }
+ break;
+ case 8:
+ // get account details
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ Account acc = zensarBankingService.getAccountDetails(
+ customerId, accountId);
+ System.out.println("Account No " + acc.getAccountId());
+ System.out.println("Account Type " + acc.getAccountType());
+ System.out.println("Account Balance " + acc.getBalance());
+ break;
+ case 9:
+ // get all account details
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ Account[] a = zensarBankingService
+ .getAllAccountsDetails(customerId);
+ System.out.println("Account deatils are:");
+ for (int i = 0; i < a.length; i++) {
+ if (a[i] != null) {
+ System.out.println("Account No " + a[i].getAccountId());
+ System.out.println("Account Type "
+ + a[i].getAccountType());
+ System.out.println("Account Balance "
+ + a[i].getBalance());
+ }
+
+ }
+ break;
+ default:
+ System.out.println("Invalid choice");
+ break;
+ }
+
+ System.out.println("Do you wish to continue?(Y/N)");
+ decision = scanner.next().charAt(0);
+ if (decision == 'n' || decision == 'N') {
+ System.out.println("Thank you for using the banking system");
+ System.exit(0);
+ }
+ } while (decision == 'y' || decision == 'Y');
+
+ scanner.close();
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java
new file mode 100644
index 0000000..1af196e
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.dao;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+
+public interface BankingRepositoryServices {
+ int insertCustomer(Customer customer);
+
+ boolean updateCustomer(Customer customer);
+
+ boolean updateTransaction(int custId, int accNo, Transaction transaction);
+
+ Account getAccount(int custId, int accNo);
+
+ Account[] getAccountList(int custId);
+
+ Customer getCustomer(int custId);
+
+ Transaction[] getTransactions(int custId, int accNo);
+
+ boolean deleteCustomer(int custId);
+
+ boolean deleteAccount(int custId, int accNo);
+
+ int insertAccount(Account account, int custId);
+
+ boolean updateAccount(int custId, Account account);
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java
new file mode 100644
index 0000000..02c6681
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java
@@ -0,0 +1,96 @@
+package com.zensar.bankingsystem.dao;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+
+public class ZensarBankingSystemArrayImpl implements BankingRepositoryServices{
+
+ Customer[] customers = new Customer[10];
+
+ static int i = 0, j = 0, custId = 100, accId = 50;
+
+ public int insertCustomer(Customer customer) {
+ customers[i++] = customer;
+ customer.setCustomerId(custId);
+ custId++;
+ return customer.getCustomerId();
+ }
+
+ public Customer getCustomer(int custId) {
+ for (Customer c : customers) {
+ if (c != null && c.getCustomerId() == custId)
+ return c;
+ }
+ return null;
+ }
+
+ public boolean updateCustomer(Customer customer) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean updateTransaction(int custId, int accNo,
+ Transaction transaction) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Account getAccount(int custId, int accNo) {
+
+ Account[] acc = getCustomer(custId).getAccount();
+ for (int k = 0; k < 3; k++) {
+ if (acc[k].getAccountId() == accNo)
+ return acc[k];
+ }
+ return null;
+ }
+
+ public Account[] getAccountList(int custId) {
+ return getCustomer(custId).getAccount();
+ }
+
+ public Transaction[] getTransactions(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean deleteCustomer(int custId) {
+ // customers[]
+ return false;
+ }
+
+ public boolean deleteAccount(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean updateAccount(int custId, Account account) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public int insertAccount(Account account, int custId) {
+ Account[] acc = getCustomer(custId).getAccount();
+
+ for (int k = 0; k < 3; k++) {
+
+ if (acc[k] == null) {
+ acc[k] = new Account(accId++, account.getAccountType(),
+ account.getBalance());
+ return acc[k].getAccountId();
+ }
+ }
+ return 0;
+ }
+
+ public int generateRandomNumber() {
+
+ int pin = (int) (Math.random() * 9999);
+ if (pin < 1000) {
+ pin += 1000;
+ }
+ return pin;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/BankServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/BankServices.java
new file mode 100644
index 0000000..5bdda74
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/BankServices.java
@@ -0,0 +1,57 @@
+package com.zensar.bankingsystem.exceptions;
+
+import javax.security.auth.login.AccountNotFoundException;
+
+import com.zensar.bankingsystem.beans.*;
+import com.zensar.bankingsystem.exceptions.CustomerNotFoundException;
+import com.zensar.bankingsystem.exceptions.InsufficientBalanceException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountNoException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException;
+import com.zensar.bankingsystem.exceptions.InvalidAmountException;
+import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException;
+import com.zensar.bankingsystem.exceptions.InvalidPincodeException;
+
+public interface BankServices {
+ int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode) throws InvalidPincodeException;
+
+ int openAccount(int custId, int balance, String accType)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAmountException, InvalidAccountTypeException;
+
+ int getAccountBalance(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+
+ int withdraw(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException;
+
+ boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt) throws InvalidCustomerIdException,
+ CustomerNotFoundException, InvalidAccountNoException,
+ AccountNotFoundException, InvalidAmountException,
+ InsufficientBalanceException;
+
+ int deposit(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException;
+
+ Customer getCustomerDetails(int custId) throws InvalidCustomerIdException,
+ CustomerNotFoundException;
+
+ Account getAccountDetails(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+
+ Account[] getAllAccountsDetails(int custId)
+ throws InvalidCustomerIdException, CustomerNotFoundException;
+
+ Transaction[] getAllTransactionDetails(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java
new file mode 100644
index 0000000..49528b4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class CustomerNotFoundException extends Exception {
+
+ public CustomerNotFoundException() {
+ this("Sorry you have not registered");
+ }
+
+ public CustomerNotFoundException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public CustomerNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public CustomerNotFoundException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public CustomerNotFoundException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java
new file mode 100644
index 0000000..7fd072f
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InsufficientBalanceException extends Exception {
+
+ public InsufficientBalanceException() {
+ this("Insufficient Balance");
+ }
+
+ public InsufficientBalanceException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InsufficientBalanceException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InsufficientBalanceException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InsufficientBalanceException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java
new file mode 100644
index 0000000..726281d
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidAccountNoException extends Exception {
+
+ public InvalidAccountNoException() {
+ this("Please enter a valid account no");
+ }
+
+ public InvalidAccountNoException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountNoException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountNoException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountNoException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java
new file mode 100644
index 0000000..f1d6ae5
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidAccountTypeException extends Exception {
+
+ public InvalidAccountTypeException() {
+ this("Please enter a valid account type");
+ }
+
+ public InvalidAccountTypeException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountTypeException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountTypeException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountTypeException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java
new file mode 100644
index 0000000..3131ff4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidAmountException extends Exception {
+
+ public InvalidAmountException() {
+ this("Please enter a valid amount");
+ }
+
+ public InvalidAmountException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAmountException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAmountException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAmountException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java
new file mode 100644
index 0000000..794a12a
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java
@@ -0,0 +1,31 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidCustomerIdException extends Exception {
+
+ public InvalidCustomerIdException() {
+ // TODO Auto-generated constructor stub
+ this("Invalid customer Id,please enter a valid customer Id");
+ }
+
+ public InvalidCustomerIdException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidCustomerIdException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidCustomerIdException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidCustomerIdException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java
new file mode 100644
index 0000000..7806d55
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java
@@ -0,0 +1,32 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidPincodeException extends Exception {
+
+ public InvalidPincodeException() {
+ // TODO Auto-generated constructor stub
+ this("Invalid Pin");
+ }
+
+ public InvalidPincodeException(String message) {
+ super(message);
+
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidPincodeException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidPincodeException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidPincodeException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/BankServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/BankServices.java
new file mode 100644
index 0000000..984f44a
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/BankServices.java
@@ -0,0 +1,57 @@
+package com.zensar.bankingsystem.services;
+
+import javax.security.auth.login.AccountNotFoundException;
+
+import com.zensar.bankingsystem.beans.*;
+import com.zensar.bankingsystem.exceptions.CustomerNotFoundException;
+import com.zensar.bankingsystem.exceptions.InsufficientBalanceException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountNoException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException;
+import com.zensar.bankingsystem.exceptions.InvalidAmountException;
+import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException;
+import com.zensar.bankingsystem.exceptions.InvalidPincodeException;
+
+public interface BankServices {
+ int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode) throws InvalidPincodeException;
+
+ int openAccount(int custId, int balance, String accType)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAmountException, InvalidAccountTypeException;
+
+ int getAccountBalance(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+
+ int withdraw(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException;
+
+ boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt) throws InvalidCustomerIdException,
+ CustomerNotFoundException, InvalidAccountNoException,
+ AccountNotFoundException, InvalidAmountException,
+ InsufficientBalanceException;
+
+ int deposit(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException;
+
+ Customer getCustomerDetails(int custId) throws InvalidCustomerIdException,
+ CustomerNotFoundException;
+
+ Account getAccountDetails(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+
+ Account[] getAllAccountsDetails(int custId)
+ throws InvalidCustomerIdException, CustomerNotFoundException;
+
+ Transaction[] getAllTransactionDetails(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java
new file mode 100644
index 0000000..fd82072
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java
@@ -0,0 +1,232 @@
+ package com.zensar.bankingsystem.services;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Address;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.MyDate;
+import com.zensar.bankingsystem.beans.Transaction;
+import com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl;
+
+public class ZensarBankingServiceImpl implements ZensarBankingServices{
+
+ ZensarBankingSystemArrayImpl zensarBankingSystemArray;
+
+ public ZensarBankingServiceImpl() {
+ zensarBankingSystemArray = new ZensarBankingSystemArrayImpl();
+
+ }
+
+ /*
+ * public void transfer(int accountId, int tansferAccountId, double amount)
+ * { double a = zensarBankingSystemArray.getAccount(accountId).getBalance()
+ * - amount; System.out.println(a);
+ * zensarBankingSystemArray.getAccount(accountId).setBalance(a); double b =
+ * zensarBankingSystemArray.getAccount(accountId).getBalance() + amount;
+ * zensarBankingSystemArray.getAccount(tansferAccountId).setBalance(b);
+ *
+ * }
+ */
+
+ public int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode, int day, int month, int year) {
+
+ if ((day > 0 && day <= 31) && (month >= 1 && month <= 12)
+ && (year <= 2015)) {
+ return zensarBankingSystemArray.insertCustomer(new Customer(
+ custName, new Address(LocalAddressCity, LocalAddressState,
+ LocalAddressPincode), new Address(HomeAddressCity,
+ HomeAddressState, HomeAddressPincode), new MyDate(
+ day, month, year)));
+ } else
+ return 0;
+
+ }
+
+ public int openAccount(int custId, int balance, String accType) {
+
+ int accountId = 0;
+
+ if (custId < 99) {
+ System.out
+ .println("Invalid customer Id,please enter a valid customer Id");
+ } else if (!(accType.equalsIgnoreCase("savings")
+ || accType.equalsIgnoreCase("current") || accType
+ .equalsIgnoreCase("salary"))) {
+ System.out
+ .println("Invalid account type, please enter a valid account type");
+ } else if (balance < 0) {
+ System.out.println("Invalid amount, please amount a valid amount");
+ }
+
+ else {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+
+ if (customer == null) {
+ System.out.println("Sorry you have not registered");
+ return 0;
+ } else {
+ Account account = new Account(accType, balance);
+ accountId = zensarBankingSystemArray.insertAccount(account,
+ custId);
+ }
+ }
+
+ return accountId;
+
+ }
+
+ public int getAccountBalance(int custId, int accNo, int pin) {
+
+ if (checkPin(custId, accNo, pin)) {
+ return zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance();
+ } else {
+ System.out.println("Invalid pin");
+ return 0;
+ }
+
+ }
+
+ public int withdraw(int custId, int accNo, int amt, int pin) {
+ int balance = 0;
+ if (amt < 0) {
+ System.out.println("Invalid amount, please enter a valid amount");
+ } else {
+
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+
+ if (customer == null) {
+ return 0;
+ } else {
+ Account account = zensarBankingSystemArray.getAccount(custId,
+ accNo);
+ if (account == null) {
+ System.out.println("Sorry your account does not exist");
+ } else if (account.getPin()!=pin) {
+ System.out.println("Invalid pin");
+ return 0;
+ } else {
+ if ((account.getBalance() - amt) > 0) {
+ account.setBalance(account.getBalance() - amt);
+ balance = account.getBalance();
+ }
+ }
+ }
+ }
+ return balance;
+ }
+
+ public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt, int pin) {
+ if (withdraw(custIdFrom, accNoFrom, amt, pin) > 0) {
+ deposit(custIdTo, accNoTo, amt);
+ return true;
+ }
+ return false;
+ }
+
+ public int deposit(int custId, int accNo, int amt) {
+ if (amt < 0) {
+ System.out.println("Invalid amount, please enter a valid amount");
+ } else {
+
+ zensarBankingSystemArray.getAccount(custId, accNo).setBalance(
+ zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance() + amt);
+
+ return zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance();
+ }
+ return 0;
+ }
+
+ public Customer getCustomerDetails(int custId) {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+ if (customer != null) {
+ return customer;
+ }
+ return null;
+ }
+
+ public Account getAccountDetails(int custId, int accNo) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ if (account != null) {
+ return account;
+ }
+ return null;
+ }
+
+ public Account[] getAllAccountsDetails(int custId) {
+ Account[] account = zensarBankingSystemArray.getAccountList(custId);
+ if (account != null) {
+ return account;
+ }
+ return null;
+ }
+
+ public Transaction[] getAllTransactionDetails(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int generatePin(int custId, int accNo) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ int pin = zensarBankingSystemArray.generateRandomNumber();
+ account.setPin(pin);
+ return account.getPin();
+ }
+
+ public boolean changePin(int custId, int accNo, int oldPin, int newPin) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ if (account != null) {
+ if (account.getPin() == oldPin) {
+ account.setPin(newPin);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean checkPin(int custId, int accNo, int pin) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ if (account != null) {
+ if (account.getPin() == pin) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ @Override
+ public int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getAccountBalance(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int withdraw(int custId, int accNo, int amt) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServices.java b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServices.java
new file mode 100644
index 0000000..e17b61a
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithException/src/com/zensar/bankingsystem/services/ZensarBankingServices.java
@@ -0,0 +1,32 @@
+package com.zensar.bankingsystem.services;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+
+public interface ZensarBankingServices {
+ int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode);
+
+ int openAccount(int custId, int balance, String accType);
+
+ int getAccountBalance(int custId, int accNo);
+
+ int withdraw(int custId, int accNo, int amt);
+
+ boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt);
+
+ int deposit(int custId, int accNo, int amt);
+
+ Customer getCustomerDetails(int custId);
+
+ Account getAccountDetails(int custId, int accNo);
+
+ Account[] getAllAccountsDetails(int custId);
+
+ Transaction[] getAllTransactionDetails(int custId, int accNo);
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Account.class
new file mode 100644
index 0000000..268b955
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Account.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Address.class
new file mode 100644
index 0000000..0d83f39
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Address.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Customer.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Customer.class
new file mode 100644
index 0000000..bf016f7
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Customer.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Transaction.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Transaction.class
new file mode 100644
index 0000000..5971020
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/beans/Transaction.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/client/ClientCode.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/client/ClientCode.class
new file mode 100644
index 0000000..9b73a14
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/client/ClientCode.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class
new file mode 100644
index 0000000..37bfbdb
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/BankingRepositoryServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class
new file mode 100644
index 0000000..1c402f0
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class
new file mode 100644
index 0000000..26278e2
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class
new file mode 100644
index 0000000..16c41d2
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class
new file mode 100644
index 0000000..7549841
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class
new file mode 100644
index 0000000..4bec9f3
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class
new file mode 100644
index 0000000..2514556
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidAmountException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class
new file mode 100644
index 0000000..d90f258
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class
new file mode 100644
index 0000000..528cad7
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/exceptions/InvalidPincodeException.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/ConnectionProvider.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/ConnectionProvider.class
new file mode 100644
index 0000000..5462d3a
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/ConnectionProvider.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/RepositoryProvider.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/RepositoryProvider.class
new file mode 100644
index 0000000..a25494d
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/repoprovider/RepositoryProvider.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/serviceprovider/ServiceProvider.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/serviceprovider/ServiceProvider.class
new file mode 100644
index 0000000..24971bb
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/serviceprovider/ServiceProvider.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/BankServices.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/BankServices.class
new file mode 100644
index 0000000..3e2ce4a
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/BankServices.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class
new file mode 100644
index 0000000..021839f
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/data.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/data.properties
new file mode 100644
index 0000000..fe849f7
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/data.properties
@@ -0,0 +1,2 @@
+provider=com.zensar.bankingsystem.services.ZensarBankingServiceImpl
+repoprovider=com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl
\ No newline at end of file
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/oracle.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/oracle.properties
new file mode 100644
index 0000000..0139adb
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/resources/oracle.properties
@@ -0,0 +1,4 @@
+Driver=oracle.jdbc.driver.OracleDriver
+url=jdbc:oracle:thin:@localhost:1521/XE
+username=system
+password=zensar
\ No newline at end of file
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/sql.txt b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/sql.txt
new file mode 100644
index 0000000..6542008
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/bin/sql.txt
@@ -0,0 +1,74 @@
+CREATE TABLE CUSTOMER
+(
+customerId NUMBER,
+customerName VARCHAR(20),
+PRIMARY KEY(customerId)
+)
+
+CREATE TABLE ACCOUNT
+(
+accountId NUMBER,
+customerId NUMBER,
+accountType VARCHAR(20),
+balance NUMBER(10,3),
+PRIMARY KEY(accountId),
+FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId)
+)
+
+CREATE TABLE TRANSACTION
+(
+transactionId NUMBER,
+accountId NUMBER,
+transactionType VARCHAR(20),
+transactionAmount NUMBER(10,3),
+PRIMARY KEY(transactionId),
+FOREIGN KEY(accountId) REFERENCES ACCOUNT(accountId)
+)
+
+CREATE TABLE ADDRESS
+(
+customerId NUMBER,
+localCity VARCHAR(20),
+localState VARCHAR(20),
+localPincode VARCHAR(20),
+homeCity VARCHAR(20),
+homeState VARCHAR(20),
+homePincode VARCHAR(20),
+FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId)
+)
+
+DESCRIBE CUSTOMER
+DESCRIBE ACCOUNT
+DESCRIBE TRANSACTION
+DESCRIBE ADDRESS
+
+
+SELECT * FROM CUSTOMER
+SELECT * FROM ADDRESS
+SELECT * FROM ACCOUNT
+SELECT * FROM TRANSACTION
+DELETE FROM CUSTOMER
+
+CREATE SEQUENCE CUSTID
+INCREMENT BY 1
+START WITH 100
+
+CREATE SEQUENCE TRANID
+INCREMENT BY 1
+START WITH 1
+
+CREATE SEQUENCE ACCID
+INCREMENT BY 1
+START WITH 50
+
+DROP SEQUENCE CUSTID
+
+SELECT CUSTID.CURRVAL FROM DUAL
+ select CUSTID.nextval from dual;
+
+ALTER SESSION SET CURRENT_SCHEMA =AKASH
+
+DROP TABLE CUSTOMER
+DROP TABLE ADDRESS
+DROP TABLE TRANSACTION
+DROP TABLE ACCOUNT
\ No newline at end of file
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Account.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Account.java
new file mode 100644
index 0000000..fe60813
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Account.java
@@ -0,0 +1,68 @@
+package com.zensar.bankingsystem.beans;
+
+import java.util.ArrayList;
+
+public class Account {
+
+ private int accountId;
+ private String accountType;
+ private int balance;
+ private ArrayList transactions = new ArrayList();
+
+ public Account() {
+ super();
+ }
+
+ public Account(int accountId, String accountType, int balance) {
+ super();
+ this.accountId = accountId;
+ this.accountType = accountType;
+ this.balance = balance;
+ }
+
+ public Account(String accountType, int balance) {
+ super();
+ this.accountType = accountType;
+ this.balance = balance;
+ }
+
+ public int getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(int accountId) {
+ this.accountId = accountId;
+ }
+
+ public String getAccountType() {
+ return accountType;
+ }
+
+ public void setAccountType(String accountType) {
+ this.accountType = accountType;
+ }
+
+ public int getBalance() {
+ return balance;
+ }
+
+ public void setBalance(int balance) {
+ this.balance = balance;
+ }
+
+ public ArrayList getTransactions() {
+ return transactions;
+ }
+
+ public void setTransactions(ArrayList transactions) {
+ this.transactions = transactions;
+ }
+
+ @Override
+ public String toString() {
+ return "Account [accountId=" + accountId + ", accountType="
+ + accountType + ", balance=" + balance + ", transactions="
+ + transactions + "]";
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Address.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Address.java
new file mode 100644
index 0000000..1400f16
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Address.java
@@ -0,0 +1,50 @@
+package com.zensar.bankingsystem.beans;
+
+public class Address {
+
+ private String city;
+ private String state;
+ private int pinCode;
+
+ public Address() {
+ super();
+ }
+
+ public Address(String city, String state, int pinCode) {
+ super();
+ this.city = city;
+ this.state = state;
+ this.pinCode = pinCode;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public int getPinCode() {
+ return pinCode;
+ }
+
+ public void setPinCode(int pinCode) {
+ this.pinCode = pinCode;
+ }
+
+ @Override
+ public String toString() {
+ return "Address [city=" + city + ", state=" + state + ", pinCode="
+ + pinCode + "]";
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Customer.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Customer.java
new file mode 100644
index 0000000..732feb2
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Customer.java
@@ -0,0 +1,75 @@
+package com.zensar.bankingsystem.beans;
+
+import java.util.ArrayList;
+
+public class Customer {
+
+ private int customerId;
+ private String customerName;
+ private Address laddress;
+ private Address haddress;
+ private ArrayList account = new ArrayList(3);
+
+ public Customer() {
+ super();
+ }
+
+ public Customer(int customerId, String customerName, Address laddress,
+ Address haddress) {
+ super();
+ this.customerId = customerId;
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ }
+
+ public Customer(String customerName, Address laddress, Address haddress) {
+ super();
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ }
+
+ public int getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(int customerId) {
+ this.customerId = customerId;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public Address getLaddress() {
+ return laddress;
+ }
+
+ public void setLaddress(Address laddress) {
+ this.laddress = laddress;
+ }
+
+ public Address getHaddress() {
+ return haddress;
+ }
+
+ public void setHaddress(Address haddress) {
+ this.haddress = haddress;
+ }
+
+ public ArrayList getAccount() {
+ return account;
+ }
+
+ public void setAccount(ArrayList account) {
+ this.account = account;
+ }
+
+
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Transaction.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Transaction.java
new file mode 100644
index 0000000..25ab440
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/beans/Transaction.java
@@ -0,0 +1,51 @@
+package com.zensar.bankingsystem.beans;
+
+public class Transaction {
+
+ private int transactionID;
+ private String transactionType;
+ private int transactionAmount;
+
+ public Transaction() {
+ }
+
+ public Transaction(int transactionID, String transactionType,
+ int transactionAmount) {
+ super();
+ this.transactionID = transactionID;
+ this.transactionType = transactionType;
+ this.transactionAmount = transactionAmount;
+ }
+
+ public int getTransactionID() {
+ return transactionID;
+ }
+
+ public void setTransactionID(int transactionID) {
+ this.transactionID = transactionID;
+ }
+
+ public String getTransactionType() {
+ return transactionType;
+ }
+
+ public void setTransactionType(String transactionType) {
+ this.transactionType = transactionType;
+ }
+
+ public int getTransactionAmount() {
+ return transactionAmount;
+ }
+
+ public void setTransactionAmount(int transactionAmount) {
+ this.transactionAmount = transactionAmount;
+ }
+
+ @Override
+ public String toString() {
+ return "Transaction [transactionID=" + transactionID
+ + ", transactionType=" + transactionType
+ + ", transactionAmount=" + transactionAmount + "]";
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/client/ClientCode.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/client/ClientCode.java
new file mode 100644
index 0000000..f65a80b
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/client/ClientCode.java
@@ -0,0 +1,294 @@
+package com.zensar.bankingsystem.client;
+
+import java.util.ArrayList;
+import java.util.Scanner;
+
+import javax.security.auth.login.AccountNotFoundException;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Transaction;
+import com.zensar.bankingsystem.exceptions.CustomerNotFoundException;
+import com.zensar.bankingsystem.exceptions.InsufficientBalanceException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountNoException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException;
+import com.zensar.bankingsystem.exceptions.InvalidAmountException;
+import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException;
+import com.zensar.bankingsystem.exceptions.InvalidPincodeException;
+import com.zensar.bankingsystem.serviceprovider.ServiceProvider;
+import com.zensar.bankingsystem.services.BankServices;
+
+public class ClientCode {
+
+ public static void main(String[] args) {
+ String name = null;
+ String localAdrressCity = null;
+ String localAdrressState = null;
+ int localAdrressPinCode = 0;
+ String homeAdrressCity = null;
+ String homeAdrressState = null;
+ int homeAdrressPinCode = 0;
+ int customerId = 0;
+ String accountType = null;
+ int initialBalance = 0;
+ char decision;
+ int choice = 0;
+ int amount = 0, balance = 0;
+
+ Scanner scanner = new Scanner(System.in);
+
+ BankServices zensarBankingService = ServiceProvider.getProvider();
+
+ System.out.println("Welcome to Zensar Banking Service");
+
+ do {
+
+ System.out.println("1. Customer Registration");
+ System.out.println("2. Open Account");
+ System.out.println("3. Withdraw");
+ System.out.println("4. Deposit");
+ System.out.println("5. Transfer");
+ System.out.println("6. Check balance");
+ System.out.println("8. Get Account details");
+ System.out.println("9. Get all account details");
+ System.out.println("10. Delete customer");
+ System.out.println("Enter your option");
+
+ try {
+ choice = scanner.nextInt();
+
+ switch (choice) {
+ case 1:
+ // Registration
+ System.out.println("Enter your name");
+ name = scanner.next();
+
+ System.out.println("Enter your local address");
+ System.out.println("Enter your city");
+ localAdrressCity = scanner.next();
+ System.out.println("Enter your state");
+ localAdrressState = scanner.next();
+ System.out.println("Enter your pin code");
+ localAdrressPinCode = scanner.nextInt();
+
+ System.out.println("Enter your home address");
+ System.out.println("Enter your city");
+ homeAdrressCity = scanner.next();
+ System.out.println("Enter your state");
+ homeAdrressState = scanner.next();
+ System.out.println("Enter your pin code");
+ homeAdrressPinCode = scanner.nextInt();
+
+ int id;
+
+ id = zensarBankingService.acceptCustomerDetails(name,
+ localAdrressCity, localAdrressState,
+ localAdrressPinCode, homeAdrressCity,
+ homeAdrressState, homeAdrressPinCode);
+ System.out
+ .println("You were successfully registered with customer ID "
+ + id);
+
+ break;
+
+ case 2:
+ // open an account
+ System.out
+ .println("Enter your customer Id to open an account");
+ customerId = scanner.nextInt();
+
+ System.out.println("Enter your account type ");
+ accountType = scanner.next();
+
+ System.out.println("Enter your initial balance ");
+ initialBalance = scanner.nextInt();
+ int accountId;
+ accountId = zensarBankingService.openAccount(customerId,
+ initialBalance, accountType);
+
+ System.out.println("Account created with account Id "
+ + accountId);
+
+ break;
+ case 3:
+ // withdraw
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter the amount to withdraw");
+ amount = scanner.nextInt();
+
+ balance = zensarBankingService.withdraw(customerId,
+ accountId, amount);
+ System.out
+ .println("Amount withdrawn successfully with remaining balance "
+ + balance);
+
+ break;
+ case 4:
+ // deposit
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter the amount to deposit");
+ amount = scanner.nextInt();
+
+ balance = zensarBankingService.deposit(customerId,
+ accountId, amount);
+ System.out
+ .println("Amount successfully deposited, balance is "
+ + balance);
+
+ break;
+ case 5:
+ System.out.println("Enter your customer Id");
+ int custIdFrom = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ int accNoFrom = scanner.nextInt();
+ System.out.println("Enter the customer Id to transfer to");
+ int custIdTo = scanner.nextInt();
+ System.out.println("Enter the account Id to transfer to");
+ int accNoTo = scanner.nextInt();
+ System.out.println("Enter the amount to tansfer");
+ int amt = scanner.nextInt();
+
+ boolean result = zensarBankingService.fundTransfer(
+ custIdFrom, accNoFrom, custIdTo, accNoTo, amt);
+ if (result == true) {
+ System.out.println("Fund transfer successful");
+ } else {
+ System.out.println("Fund transfer not successful");
+ }
+ break;
+ case 6:
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ int b = zensarBankingService.getAccountBalance(customerId,
+ accountId);
+ System.out.println(b);
+
+ break;
+ case 8:
+ // get account details
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ Account acc;
+ acc = zensarBankingService.getAccountDetails(customerId,
+ accountId);
+
+ System.out.println("Account No " + acc.getAccountId());
+ System.out.println("Account Type " + acc.getAccountType());
+ System.out.println("Account Balance " + acc.getBalance());
+
+ System.out.println("Transactions:");
+ ArrayList transactions = zensarBankingService
+ .getAllTransactionDetails(customerId, accountId);
+ if (transactions == null) {
+ System.out.println("No transactions yet");
+ } else {
+ for (Transaction transaction : transactions) {
+ System.out.println("\nID: "
+ + transaction.getTransactionID());
+ System.out.println("Type: "
+ + transaction.getTransactionType());
+ System.out
+ .println("Amount: "
+ + transaction
+ .getTransactionAmount()
+ + "\n");
+ }
+ }
+
+ break;
+ case 9:
+ // get all account details
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ ArrayList a;
+ a = zensarBankingService.getAllAccountsDetails(customerId);
+ System.out.println("Account deatils are:");
+ for (Account account : a) {
+ if (account != null) {
+ System.out.println("Account No: "
+ + account.getAccountId());
+ System.out.println("Account Type: "
+ + account.getAccountType());
+ System.out.println("Account Balance: "
+ + account.getBalance());
+
+ System.out.println("Transactions:");
+
+ ArrayList transactions1 = zensarBankingService
+ .getAllTransactionDetails(customerId,
+ account.getAccountId());
+ if (transactions1 == null) {
+ System.out.println("No transactions yet");
+ } else {
+ for (Transaction transaction : transactions1) {
+ System.out.println("\nID: "
+ + transaction.getTransactionID());
+ System.out.println("Type: "
+ + transaction.getTransactionType());
+ System.out.println("Amount: "
+ + transaction
+ .getTransactionAmount()
+ + "\n");
+ }
+
+ System.out.println("****************");
+ }
+
+ }
+ }
+
+ break;
+ case 10:
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ break;
+ default:
+ System.out.println("Invalid choice");
+ break;
+ }
+ } catch (AccountNotFoundException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (InvalidPincodeException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (InvalidCustomerIdException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (CustomerNotFoundException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (InvalidAmountException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (InvalidAccountTypeException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (InvalidAccountNoException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ } catch (InsufficientBalanceException e) {
+ // e.printStackTrace();
+ System.out.println(e.getMessage());
+ }
+
+ System.out.println("Do you wish to continue?(Y/N)");
+ decision = scanner.next().charAt(0);
+ if (decision == 'n' || decision == 'N') {
+ System.out.println("Thank you for using the banking system");
+ System.exit(0);
+ }
+ } while (decision == 'y' || decision == 'Y');
+
+ scanner.close();
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java
new file mode 100644
index 0000000..86faba6
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/BankingRepositoryServices.java
@@ -0,0 +1,32 @@
+package com.zensar.bankingsystem.dao;
+
+import java.util.ArrayList;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+
+public interface BankingRepositoryServices {
+ int insertCustomer(Customer customer);
+
+ boolean updateCustomer(Customer customer);
+
+ boolean updateTransaction(int custId, int accNo, Transaction transaction);
+
+ Account getAccount(int custId, int accNo);
+
+ ArrayList getAccountList(int custId);
+
+ Customer getCustomer(int custId);
+
+ ArrayList getTransactions(int custId, int accNo);
+
+ boolean deleteCustomer(int custId);
+
+ boolean deleteAccount(int custId, int accNo);
+
+ int insertAccount(Account account, int custId);
+
+ boolean updateAccount(int custId, Account account);
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java
new file mode 100644
index 0000000..50d758d
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java
@@ -0,0 +1,284 @@
+package com.zensar.bankingsystem.dao;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+import com.zensar.bankingsystem.repoprovider.ConnectionProvider;
+
+public class ZensarBankingSystemArrayImpl implements BankingRepositoryServices {
+
+ static int custId = 100, accId = 50, tranId = 1;
+ private Connection con = null;
+ private PreparedStatement psmt = null;
+ java.sql.Statement smt = null;
+ ResultSet rs = null;
+ int result = 0;
+ int customerId = 0;
+
+ public int count(String sql) {
+ try {
+ smt = con.createStatement();
+ rs = smt.executeQuery(sql);
+ rs.next();
+ System.out.println(rs.getInt(1));
+ return rs.getInt(1);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return 0;
+ }
+
+ public ZensarBankingSystemArrayImpl() {
+ con = ConnectionProvider.getConnection();
+ }
+
+ @Override
+ public int insertCustomer(Customer customer) {
+
+ String customerTableQuery = "INSERT INTO HR.CUSTOMER VALUES(HR.CUSTID.NEXTVAL,?)";
+ String addressTableQuery = "INSERT INTO HR.ADDRESS VALUES(HR.CUSTID.CURRVAL,?,?,?,?,?,?)";
+ String customerIdQuery = "SELECT HR.CUSTID.CURRVAL FROM DUAL";
+ try {
+
+ psmt = con.prepareStatement(customerTableQuery);
+ psmt.setString(1, customer.getCustomerName());
+ result = psmt.executeUpdate();
+
+ psmt = con.prepareStatement(addressTableQuery);
+ psmt.setString(1, customer.getLaddress().getCity());
+ psmt.setString(2, customer.getLaddress().getState());
+ psmt.setInt(3, customer.getLaddress().getPinCode());
+ psmt.setString(4, customer.getHaddress().getCity());
+ psmt.setString(5, customer.getHaddress().getState());
+ psmt.setInt(6, customer.getHaddress().getPinCode());
+ result = psmt.executeUpdate();
+
+ if (result > 0) {
+ customer.setCustomerId(count(customerIdQuery));
+ return customer.getCustomerId();
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return 0;
+ }
+
+ @Override
+ public Customer getCustomer(int custId) {
+
+ Customer customer = new Customer();
+ customer.setCustomerId(custId);
+
+ String sql = "SELECT * from HR.CUSTOMER WHERE customerId=?";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, custId);
+ rs = psmt.executeQuery();
+
+ if (rs.isBeforeFirst() == false) {
+ return null;
+ }
+ while (rs.next()) {
+ customer.setCustomerName(rs.getString(1));
+ }
+ return customer;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean updateCustomer(Customer customer) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean updateTransaction(int custId, int accNo,
+ Transaction transaction) {
+
+ String sql = "INSERT INTO HR.TRANSACTION VALUES(HR.TRANID.NEXTVAL,?,?,?)";
+ String transactionIdQuery = "SELECT HR.CUSTID.CURRVAL FROM DUAL";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, accNo);
+ psmt.setString(2, transaction.getTransactionType());
+ psmt.setInt(3, transaction.getTransactionAmount());
+ result = psmt.executeUpdate();
+ if (result > 0) {
+ transaction.setTransactionID(count(transactionIdQuery));
+ return true;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ public Account getAccount(int custId, int accNo) {
+
+ Account account = new Account();
+ account.setAccountId(accNo);
+
+ String sql = "SELECT * FROM HR.ACCOUNT WHERE accountId=? AND customerId=?";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, accNo);
+ psmt.setInt(2, custId);
+ rs = psmt.executeQuery();
+ if (rs.isBeforeFirst() == false) {
+ return null;
+ }
+
+ while (rs.next()) {
+ account.setAccountType(rs.getString(3));
+ account.setBalance(rs.getInt(4));
+ }
+ return account;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ @Override
+ public ArrayList getAccountList(int custId) {
+
+ Account account = null;
+ ArrayList acc = new ArrayList();
+ String sql = "SELECT * FROM HR.ACCOUNT WHERE customerId=?";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, custId);
+ rs = psmt.executeQuery();
+ if (rs.isBeforeFirst() == false) {
+ return null;
+ }
+ while (rs.next()) {
+ account = new Account();
+ account.setAccountId(rs.getInt(1));
+ account.setAccountType(rs.getString(3));
+ account.setBalance(rs.getInt(4));
+ acc.add(account);
+ }
+ return acc;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public ArrayList getTransactions(int custId, int accNo) {
+
+ Transaction transaction = null;
+ ArrayList transactions = new ArrayList();
+ String sql = "SELECT * FROM HR.TRANSACTION WHERE accountId="
+ + "(SELECT accountId FROM HR.ACCOUNT WHERE customerId=? AND accountId=?)";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, custId);
+ psmt.setInt(2, accNo);
+ rs = psmt.executeQuery();
+ if (rs.isBeforeFirst() == false) {
+ return null;
+ }
+ while (rs.next()) {
+ transaction = new Transaction();
+ transaction.setTransactionID(rs.getInt(1));
+ transaction.setTransactionType(rs.getString(3));
+ transaction.setTransactionAmount(rs.getInt(4));
+ transactions.add(transaction);
+ }
+ return transactions;
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return transactions;
+ }
+
+ @Override
+ public boolean deleteCustomer(int custId) {
+ String sql = "DELETE FROM HR.CUSTOMER WHERE customerId=? CASCADE";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, custId);
+ result = psmt.executeUpdate();
+ if (result > 0) {
+ return true;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ public boolean deleteAccount(int custId, int accNo) {
+ String sql = "DELETE FROM HR.ACCOUNT WHERE customerId=? AND accountId=?";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, custId);
+ psmt.setInt(2, accNo);
+ result = psmt.executeUpdate();
+ if (result > 0) {
+ return true;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ public int insertAccount(Account account, int custId) {
+
+ String accountTableQuery = "INSERT INTO HR.ACCOUNT VALUES(HR.ACCID.NEXTVAL,?,?,?)";
+ try {
+ psmt = con.prepareStatement(accountTableQuery);
+ // psmt.setInt(1, accId);
+ psmt.setInt(1, custId);
+ psmt.setString(2, account.getAccountType());
+ psmt.setInt(3, account.getBalance());
+ result = psmt.executeUpdate();
+ if (result > 0) {
+ return accId++;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return 0;
+ }
+
+ @Override
+ public boolean updateAccount(int custId, Account account) {
+ String sql = "UPDATE HR.ACCOUNT SET balance=? WHERE customerId=? AND accountId=?";
+ try {
+ psmt = con.prepareStatement(sql);
+ psmt.setInt(1, account.getBalance());
+ psmt.setInt(2, custId);
+ psmt.setInt(3, account.getAccountId());
+ result = psmt.executeUpdate();
+ if (result > 0) {
+ return true;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java
new file mode 100644
index 0000000..49528b4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/CustomerNotFoundException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class CustomerNotFoundException extends Exception {
+
+ public CustomerNotFoundException() {
+ this("Sorry you have not registered");
+ }
+
+ public CustomerNotFoundException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public CustomerNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public CustomerNotFoundException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public CustomerNotFoundException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java
new file mode 100644
index 0000000..7fd072f
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InsufficientBalanceException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InsufficientBalanceException extends Exception {
+
+ public InsufficientBalanceException() {
+ this("Insufficient Balance");
+ }
+
+ public InsufficientBalanceException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InsufficientBalanceException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InsufficientBalanceException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InsufficientBalanceException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java
new file mode 100644
index 0000000..726281d
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountNoException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidAccountNoException extends Exception {
+
+ public InvalidAccountNoException() {
+ this("Please enter a valid account no");
+ }
+
+ public InvalidAccountNoException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountNoException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountNoException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountNoException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java
new file mode 100644
index 0000000..f1d6ae5
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAccountTypeException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidAccountTypeException extends Exception {
+
+ public InvalidAccountTypeException() {
+ this("Please enter a valid account type");
+ }
+
+ public InvalidAccountTypeException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountTypeException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountTypeException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAccountTypeException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java
new file mode 100644
index 0000000..3131ff4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidAmountException.java
@@ -0,0 +1,30 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidAmountException extends Exception {
+
+ public InvalidAmountException() {
+ this("Please enter a valid amount");
+ }
+
+ public InvalidAmountException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAmountException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAmountException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidAmountException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java
new file mode 100644
index 0000000..794a12a
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidCustomerIdException.java
@@ -0,0 +1,31 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidCustomerIdException extends Exception {
+
+ public InvalidCustomerIdException() {
+ // TODO Auto-generated constructor stub
+ this("Invalid customer Id,please enter a valid customer Id");
+ }
+
+ public InvalidCustomerIdException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidCustomerIdException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidCustomerIdException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidCustomerIdException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java
new file mode 100644
index 0000000..7806d55
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/exceptions/InvalidPincodeException.java
@@ -0,0 +1,32 @@
+package com.zensar.bankingsystem.exceptions;
+
+public class InvalidPincodeException extends Exception {
+
+ public InvalidPincodeException() {
+ // TODO Auto-generated constructor stub
+ this("Invalid Pin");
+ }
+
+ public InvalidPincodeException(String message) {
+ super(message);
+
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidPincodeException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidPincodeException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public InvalidPincodeException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/ConnectionProvider.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/ConnectionProvider.java
new file mode 100644
index 0000000..4113ef5
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/ConnectionProvider.java
@@ -0,0 +1,40 @@
+package com.zensar.bankingsystem.repoprovider;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
+public class ConnectionProvider {
+
+ private static Connection con = null;
+ private static Properties properties = null;
+
+ public static Connection getConnection() {
+
+ try {
+ properties= new Properties();
+ properties.load(new FileReader(".\\src\\resources\\oracle.properties"));
+
+ String Driver = properties.getProperty("Driver");
+ String url = properties.getProperty("url");
+ String username = properties.getProperty("username");
+ String password = properties.getProperty("password");
+
+ Class.forName(Driver);
+ con = DriverManager.getConnection(url,username,password);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return con;
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/RepositoryProvider.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/RepositoryProvider.java
new file mode 100644
index 0000000..38d7c01
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/repoprovider/RepositoryProvider.java
@@ -0,0 +1,42 @@
+package com.zensar.bankingsystem.repoprovider;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import com.zensar.bankingsystem.dao.BankingRepositoryServices;
+
+public class RepositoryProvider {
+
+ static Properties properties = null;
+
+ public static BankingRepositoryServices getProvider() {
+
+ try {
+ properties = new Properties();
+ properties
+ .load(new FileReader(".\\src\\resources\\data.properties"));
+ String provider = (String) properties.get("repoprovider");
+ Class c = Class.forName(provider);
+ return (BankingRepositoryServices) c.newInstance();
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/serviceprovider/ServiceProvider.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/serviceprovider/ServiceProvider.java
new file mode 100644
index 0000000..e5de879
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/serviceprovider/ServiceProvider.java
@@ -0,0 +1,43 @@
+package com.zensar.bankingsystem.serviceprovider;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import com.zensar.bankingsystem.services.BankServices;
+
+public class ServiceProvider {
+
+ static Properties properties = null;
+
+ public static BankServices getProvider() {
+
+ try {
+ properties = new Properties();
+ properties
+ .load(new FileReader(".\\src\\resources\\data.properties"));
+ String provider = (String) properties.get("provider");
+ Class c = Class.forName(provider);
+ return (BankServices) c.newInstance();
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/BankServices.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/BankServices.java
new file mode 100644
index 0000000..0ddc6b9
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/BankServices.java
@@ -0,0 +1,61 @@
+package com.zensar.bankingsystem.services;
+
+import java.util.ArrayList;
+
+import javax.security.auth.login.AccountNotFoundException;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+import com.zensar.bankingsystem.exceptions.CustomerNotFoundException;
+import com.zensar.bankingsystem.exceptions.InsufficientBalanceException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountNoException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException;
+import com.zensar.bankingsystem.exceptions.InvalidAmountException;
+import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException;
+import com.zensar.bankingsystem.exceptions.InvalidPincodeException;
+
+public interface BankServices {
+ int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode) throws InvalidPincodeException;
+
+ int openAccount(int custId, int balance, String accType)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAmountException, InvalidAccountTypeException;
+
+ int getAccountBalance(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+
+ int withdraw(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException;
+
+ boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt) throws InvalidCustomerIdException,
+ CustomerNotFoundException, InvalidAccountNoException,
+ AccountNotFoundException, InvalidAmountException,
+ InsufficientBalanceException;
+
+ int deposit(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException;
+
+ Customer getCustomerDetails(int custId) throws InvalidCustomerIdException,
+ CustomerNotFoundException;
+
+ Account getAccountDetails(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+
+ ArrayList getAllAccountsDetails(int custId)
+ throws InvalidCustomerIdException, CustomerNotFoundException;
+
+ ArrayList getAllTransactionDetails(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException;
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java
new file mode 100644
index 0000000..14e631d
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java
@@ -0,0 +1,244 @@
+package com.zensar.bankingsystem.services;
+
+import java.util.ArrayList;
+
+import javax.security.auth.login.AccountNotFoundException;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Address;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+import com.zensar.bankingsystem.dao.BankingRepositoryServices;
+import com.zensar.bankingsystem.exceptions.CustomerNotFoundException;
+import com.zensar.bankingsystem.exceptions.InsufficientBalanceException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountNoException;
+import com.zensar.bankingsystem.exceptions.InvalidAccountTypeException;
+import com.zensar.bankingsystem.exceptions.InvalidAmountException;
+import com.zensar.bankingsystem.exceptions.InvalidCustomerIdException;
+import com.zensar.bankingsystem.exceptions.InvalidPincodeException;
+import com.zensar.bankingsystem.repoprovider.RepositoryProvider;
+
+public class ZensarBankingServiceImpl implements BankServices {
+
+ BankingRepositoryServices zensarBankingSystemArray;
+
+ public ZensarBankingServiceImpl() {
+ zensarBankingSystemArray = RepositoryProvider.getProvider();
+
+ }
+
+ @Override
+ public int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode) throws InvalidPincodeException {
+
+ if (Integer.toString(LocalAddressPincode).length() != 6
+ || Integer.toString(HomeAddressPincode).length() != 6) {
+ throw new InvalidPincodeException();
+ } else {
+ return zensarBankingSystemArray.insertCustomer(new Customer(
+ custName, new Address(LocalAddressCity, LocalAddressState,
+ LocalAddressPincode), new Address(HomeAddressCity,
+ HomeAddressState, HomeAddressPincode)));
+ }
+
+ }
+
+ @Override
+ public int openAccount(int custId, int balance, String accType)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAmountException, InvalidAccountTypeException {
+
+ int accountId = 0;
+
+ if (custId < 99) {
+ throw new InvalidCustomerIdException();
+ } else if (!(accType.equalsIgnoreCase("savings")
+ || accType.equalsIgnoreCase("current") || accType
+ .equalsIgnoreCase("salary"))) {
+ throw new InvalidAccountTypeException();
+ } else if (balance < 0) {
+ throw new InvalidAmountException();
+ } else {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+
+ if (customer == null) {
+ throw new CustomerNotFoundException();
+ } else {
+ Account account = new Account(accType, balance);
+ accountId = zensarBankingSystemArray.insertAccount(account,
+ custId);
+ }
+ }
+
+ return accountId;
+
+ }
+
+ @Override
+ public int getAccountBalance(int custId, int accNo)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException {
+
+ if (custId < 99) {
+ throw new InvalidCustomerIdException();
+ } else if (accNo < 50) {
+ throw new InvalidAccountNoException();
+ } else {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+ if (customer == null) {
+ throw new CustomerNotFoundException();
+ } else if (zensarBankingSystemArray.getAccount(custId, accNo) == null) {
+ throw new AccountNotFoundException("Account Not found");
+ } else {
+ return zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance();
+ }
+ }
+
+ }
+
+ @Override
+ public int withdraw(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException {
+ int balance = 0;
+ if (custId < 99) {
+ throw new InvalidCustomerIdException();
+ } else if (accNo < 50) {
+ throw new InvalidAccountNoException();
+ } else if (amt < 0) {
+ throw new InvalidAmountException();
+ } else {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+ if (customer == null) {
+ throw new CustomerNotFoundException();
+ } else {
+ Account account = zensarBankingSystemArray.getAccount(custId,
+ accNo);
+ if (account == null) {
+ throw new AccountNotFoundException("Account Not found");
+ } else {
+
+ System.out.println(account);
+ if ((account.getBalance() - amt) > 0) {
+ account.setBalance(account.getBalance() - amt);
+ balance = account.getBalance();
+ zensarBankingSystemArray.updateAccount(custId, account);
+
+ // transaction
+ Transaction transaction = new Transaction();
+ transaction.setTransactionType("withdraw");
+ transaction.setTransactionAmount(amt);
+ zensarBankingSystemArray.updateTransaction(custId,
+ accNo, transaction);
+ } else {
+ throw new InsufficientBalanceException();
+ }
+ }
+ }
+ }
+ return balance;
+ }
+
+ @Override
+ public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt) throws AccountNotFoundException,
+ InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, InvalidAmountException,
+ InsufficientBalanceException {
+
+ if (withdraw(custIdFrom, accNoFrom, amt) > 0) {
+ deposit(custIdTo, accNoTo, amt);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int deposit(int custId, int accNo, int amt)
+ throws InvalidCustomerIdException, CustomerNotFoundException,
+ InvalidAccountNoException, AccountNotFoundException,
+ InvalidAmountException, InsufficientBalanceException {
+
+ if (custId < 99) {
+ throw new InvalidCustomerIdException();
+ } else if (accNo < 50) {
+ throw new InvalidAccountNoException();
+ } else if (amt < 0) {
+ throw new InvalidAmountException();
+ } else {
+
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+ if (customer == null) {
+ throw new CustomerNotFoundException();
+ } else {
+ Account account = zensarBankingSystemArray.getAccount(custId,
+ accNo);
+ if (account == null) {
+ throw new AccountNotFoundException("Account Not found");
+ } else {
+ System.out.println(account);
+ account.setBalance(account.getBalance() + amt);
+ zensarBankingSystemArray.updateAccount(custId, account);
+
+ // transaction
+ Transaction transaction = new Transaction();
+ transaction.setTransactionType("deposit");
+ transaction.setTransactionAmount(amt);
+ zensarBankingSystemArray.updateTransaction(custId, accNo,
+ transaction);
+
+ return zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance();
+ }
+ }
+ }
+ }
+
+ @Override
+ public Customer getCustomerDetails(int custId) {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+ if (customer != null) {
+ return customer;
+ }
+ return null;
+ }
+
+ @Override
+ public Account getAccountDetails(int custId, int accNo)
+ throws AccountNotFoundException, CustomerNotFoundException {
+
+ if (getCustomerDetails(custId) == null) {
+ throw new CustomerNotFoundException();
+ } else {
+ Account account = zensarBankingSystemArray
+ .getAccount(custId, accNo);
+ if (account != null) {
+ return account;
+ } else {
+ throw new AccountNotFoundException("Account Not Found");
+ }
+ }
+
+ }
+
+ @Override
+ public ArrayList getAllAccountsDetails(int custId) {
+ ArrayList account = zensarBankingSystemArray
+ .getAccountList(custId);
+ if (account != null) {
+ return account;
+ }
+ return null;
+ }
+
+ @Override
+ public ArrayList getAllTransactionDetails(int custId, int accNo) {
+ return zensarBankingSystemArray.getTransactions(custId, accNo);
+
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/data.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/data.properties
new file mode 100644
index 0000000..fe849f7
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/data.properties
@@ -0,0 +1,2 @@
+provider=com.zensar.bankingsystem.services.ZensarBankingServiceImpl
+repoprovider=com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl
\ No newline at end of file
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/oracle.properties b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/oracle.properties
new file mode 100644
index 0000000..0139adb
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/resources/oracle.properties
@@ -0,0 +1,4 @@
+Driver=oracle.jdbc.driver.OracleDriver
+url=jdbc:oracle:thin:@localhost:1521/XE
+username=system
+password=zensar
\ No newline at end of file
diff --git a/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/sql.txt b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/sql.txt
new file mode 100644
index 0000000..6542008
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithJDBC 29-1-16/src/sql.txt
@@ -0,0 +1,74 @@
+CREATE TABLE CUSTOMER
+(
+customerId NUMBER,
+customerName VARCHAR(20),
+PRIMARY KEY(customerId)
+)
+
+CREATE TABLE ACCOUNT
+(
+accountId NUMBER,
+customerId NUMBER,
+accountType VARCHAR(20),
+balance NUMBER(10,3),
+PRIMARY KEY(accountId),
+FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId)
+)
+
+CREATE TABLE TRANSACTION
+(
+transactionId NUMBER,
+accountId NUMBER,
+transactionType VARCHAR(20),
+transactionAmount NUMBER(10,3),
+PRIMARY KEY(transactionId),
+FOREIGN KEY(accountId) REFERENCES ACCOUNT(accountId)
+)
+
+CREATE TABLE ADDRESS
+(
+customerId NUMBER,
+localCity VARCHAR(20),
+localState VARCHAR(20),
+localPincode VARCHAR(20),
+homeCity VARCHAR(20),
+homeState VARCHAR(20),
+homePincode VARCHAR(20),
+FOREIGN KEY(customerId) REFERENCES CUSTOMER(customerId)
+)
+
+DESCRIBE CUSTOMER
+DESCRIBE ACCOUNT
+DESCRIBE TRANSACTION
+DESCRIBE ADDRESS
+
+
+SELECT * FROM CUSTOMER
+SELECT * FROM ADDRESS
+SELECT * FROM ACCOUNT
+SELECT * FROM TRANSACTION
+DELETE FROM CUSTOMER
+
+CREATE SEQUENCE CUSTID
+INCREMENT BY 1
+START WITH 100
+
+CREATE SEQUENCE TRANID
+INCREMENT BY 1
+START WITH 1
+
+CREATE SEQUENCE ACCID
+INCREMENT BY 1
+START WITH 50
+
+DROP SEQUENCE CUSTID
+
+SELECT CUSTID.CURRVAL FROM DUAL
+ select CUSTID.nextval from dual;
+
+ALTER SESSION SET CURRENT_SCHEMA =AKASH
+
+DROP TABLE CUSTOMER
+DROP TABLE ADDRESS
+DROP TABLE TRANSACTION
+DROP TABLE ACCOUNT
\ No newline at end of file
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Account.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Account.class
new file mode 100644
index 0000000..9cf39ce
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Account.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Address.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Address.class
new file mode 100644
index 0000000..0d83f39
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Address.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Customer.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Customer.class
new file mode 100644
index 0000000..1e98eea
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Customer.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/MyDate.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/MyDate.class
new file mode 100644
index 0000000..3c1847a
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/MyDate.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Transaction.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Transaction.class
new file mode 100644
index 0000000..c127dbb
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/beans/Transaction.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/client/ClientCode.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/client/ClientCode.class
new file mode 100644
index 0000000..d466fce
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/client/ClientCode.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class
new file mode 100644
index 0000000..bfc5cfd
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class
new file mode 100644
index 0000000..bbb611f
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/bin/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.class differ
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Account.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Account.java
new file mode 100644
index 0000000..a3d8080
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Account.java
@@ -0,0 +1,59 @@
+package com.zensar.bankingsystem.beans;
+
+public class Account {
+
+ private int accountId;
+ private String accountType;
+ private int balance;
+ private int pin;
+
+ public Account() {
+ super();
+ }
+
+ public Account(int accountId, String accountType, int balance) {
+ super();
+ this.accountId = accountId;
+ this.accountType = accountType;
+ this.balance = balance;
+ }
+
+ public Account(String accountType, int balance) {
+ super();
+ this.accountType = accountType;
+ this.balance = balance;
+ }
+
+ public int getAccountId() {
+ return accountId;
+ }
+
+ public void setAccountId(int accountId) {
+ this.accountId = accountId;
+ }
+
+ public String getAccountType() {
+ return accountType;
+ }
+
+ public void setAccountType(String accountType) {
+ this.accountType = accountType;
+ }
+
+ public int getBalance() {
+ return balance;
+ }
+
+ public void setBalance(int balance) {
+ this.balance = balance;
+ }
+
+ public int getPin() {
+ return pin;
+ }
+
+ public void setPin(int pin) {
+ this.pin = pin;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Address.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Address.java
new file mode 100644
index 0000000..1400f16
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Address.java
@@ -0,0 +1,50 @@
+package com.zensar.bankingsystem.beans;
+
+public class Address {
+
+ private String city;
+ private String state;
+ private int pinCode;
+
+ public Address() {
+ super();
+ }
+
+ public Address(String city, String state, int pinCode) {
+ super();
+ this.city = city;
+ this.state = state;
+ this.pinCode = pinCode;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public int getPinCode() {
+ return pinCode;
+ }
+
+ public void setPinCode(int pinCode) {
+ this.pinCode = pinCode;
+ }
+
+ @Override
+ public String toString() {
+ return "Address [city=" + city + ", state=" + state + ", pinCode="
+ + pinCode + "]";
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Customer.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Customer.java
new file mode 100644
index 0000000..bcb0ee4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Customer.java
@@ -0,0 +1,143 @@
+package com.zensar.bankingsystem.beans;
+
+import java.util.Arrays;
+
+public class Customer {
+
+ private int customerId;
+ private String customerName;
+ private Address laddress;
+ private Address haddress;
+ private MyDate dob;
+ private Account[] account = new Account[3];
+
+ public Customer() {
+ super();
+ }
+
+ public Customer(int customerId, String customerName, Address laddress,
+ Address haddress) {
+ super();
+ this.customerId = customerId;
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ }
+
+ public Customer(String customerName, Address laddress, Address haddress) {
+ super();
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ }
+
+ public Customer(String customerName, Address laddress, Address haddress,
+ MyDate dob) {
+ super();
+ this.customerName = customerName;
+ this.laddress = laddress;
+ this.haddress = haddress;
+ this.dob = dob;
+ }
+
+ public int getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(int customerId) {
+ this.customerId = customerId;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public Address getLaddress() {
+ return laddress;
+ }
+
+ public void setLaddress(Address laddress) {
+ this.laddress = laddress;
+ }
+
+ public Address getHaddress() {
+ return haddress;
+ }
+
+ public void setHaddress(Address haddress) {
+ this.haddress = haddress;
+ }
+
+ public Account[] getAccount() {
+ return account;
+ }
+
+ public void setAccount(Account[] account) {
+ this.account = account;
+ }
+
+ public MyDate getDob() {
+ return dob;
+ }
+
+ public void setDob(MyDate dob) {
+ this.dob = dob;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(account);
+ result = prime * result + customerId;
+ result = prime * result
+ + ((customerName == null) ? 0 : customerName.hashCode());
+ result = prime * result + ((dob == null) ? 0 : dob.hashCode());
+ result = prime * result
+ + ((haddress == null) ? 0 : haddress.hashCode());
+ result = prime * result
+ + ((laddress == null) ? 0 : laddress.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Customer other = (Customer) obj;
+ if (!Arrays.equals(account, other.account))
+ return false;
+ if (customerId != other.customerId)
+ return false;
+ if (customerName == null) {
+ if (other.customerName != null)
+ return false;
+ } else if (!customerName.equals(other.customerName))
+ return false;
+ if (dob == null) {
+ if (other.dob != null)
+ return false;
+ } else if (!dob.equals(other.dob))
+ return false;
+ if (haddress == null) {
+ if (other.haddress != null)
+ return false;
+ } else if (!haddress.equals(other.haddress))
+ return false;
+ if (laddress == null) {
+ if (other.laddress != null)
+ return false;
+ } else if (!laddress.equals(other.laddress))
+ return false;
+ return true;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/MyDate.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/MyDate.java
new file mode 100644
index 0000000..4e75da6
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/MyDate.java
@@ -0,0 +1,65 @@
+package com.zensar.bankingsystem.beans;
+
+public class MyDate {
+
+ private int day;
+ private int month;
+ private int year;
+
+ public MyDate() {
+ super();
+ day = 0;
+ month = 0;
+ year = 0;
+ }
+
+ public MyDate(int day, int month, int year) {
+ super();
+ this.day = day;
+ this.month = month;
+ this.year = year;
+ }
+
+ public int getDay() {
+ return day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
+ public int getMonth() {
+ return month;
+ }
+
+ public void setMonth(int month) {
+ this.month = month;
+ }
+
+ public int getYear() {
+ return year;
+ }
+
+ public void setYear(int year) {
+ this.year = year;
+ }
+
+ @Override
+ public String toString() {
+ return "MyDate [day=" + day + ", month=" + month + ", year=" + year
+ + "]";
+ }
+
+ @Override
+ public boolean equals(Object arg) {
+ System.out.println(this);
+ MyDate date = (MyDate) arg;
+ if (this.day == date.day && this.month == date.month
+ && this.year == date.year) {
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Transaction.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Transaction.java
new file mode 100644
index 0000000..b84c4e8
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/beans/Transaction.java
@@ -0,0 +1,5 @@
+package com.zensar.bankingsystem.beans;
+
+public class Transaction {
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/client/ClientCode.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/client/ClientCode.java
new file mode 100644
index 0000000..016a406
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/client/ClientCode.java
@@ -0,0 +1,255 @@
+package com.zensar.bankingsystem.client;
+
+import java.util.Scanner;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.services.ZensarBankingServiceImpl;
+
+public class ClientCode {
+
+ public static void main(String[] args) {
+ String name = null;
+ String localAdrressCity = null;
+ String localAdrressState = null;
+ int localAdrressPinCode = 0;
+ String homeAdrressCity = null;
+ String homeAdrressState = null;
+ int homeAdrressPinCode = 0;
+ int customerId = 0;
+ String accountType = null;
+ int initialBalance = 0;
+ char decision;
+ int choice = 0;
+ int amount = 0, balance = 0;
+ int day, month, year = 0;
+ int oldPin, newPin = 0, pin = 0;
+
+ Scanner scanner = new Scanner(System.in);
+
+ ZensarBankingServiceImpl zensarBankingService = new ZensarBankingServiceImpl();
+
+ System.out.println("Welcome to Zensar Banking Service");
+
+ do {
+
+ System.out.println("1. Customer Registration");
+ System.out.println("2. Open Account");
+ System.out.println("3. Withdraw");
+ System.out.println("4. Deposit");
+ System.out.println("5. Transfer");
+ System.out.println("6. Check balance");
+ System.out.println("7. Change pin");
+ System.out.println("8. Get Account details");
+ System.out.println("9. Get all account details");
+ System.out.println("Enter your option");
+ choice = scanner.nextInt();
+
+ switch (choice) {
+ case 1:
+ // Registration
+ System.out.println("Enter your name");
+ name = scanner.next();
+
+ System.out.println("Enter your local address");
+ System.out.println("Enter your city");
+ localAdrressCity = scanner.next();
+ System.out.println("Enter your state");
+ localAdrressState = scanner.next();
+ System.out.println("Enter your pin code");
+ localAdrressPinCode = scanner.nextInt();
+
+ System.out.println("Enter your home address");
+ System.out.println("Enter your city");
+ homeAdrressCity = scanner.next();
+ System.out.println("Enter your state");
+ homeAdrressState = scanner.next();
+ System.out.println("Enter your pin code");
+ homeAdrressPinCode = scanner.nextInt();
+
+ System.out.println("Enter your date of birth");
+ System.out.println("Enter the day");
+ day = scanner.nextInt();
+ System.out.println("Enter the month");
+ month = scanner.nextInt();
+ System.out.println("Enter the year");
+ year = scanner.nextInt();
+
+ int id = zensarBankingService.acceptCustomerDetails(name,
+ localAdrressCity, localAdrressState,
+ localAdrressPinCode, homeAdrressCity, homeAdrressState,
+ homeAdrressPinCode, day, month, year);
+
+ if (id > 0) {
+ System.out
+ .println("You were successfully registered with customer ID "
+ + id);
+
+ } else
+ System.out.println("Sorry could not register");
+
+ break;
+
+ case 2:
+ // open an account
+ System.out.println("Enter your customer Id to open an account");
+ customerId = scanner.nextInt();
+
+ System.out.println("Enter your account type ");
+ accountType = scanner.next();
+
+ System.out.println("Enter your initial balance ");
+ initialBalance = scanner.nextInt();
+ int accountId = zensarBankingService.openAccount(customerId,
+ initialBalance, accountType);
+
+ if (accountId == 0) {
+ System.out.println("Sorry account could not be created");
+ } else {
+ System.out.println("Account created with account Id "
+ + accountId);
+ pin = zensarBankingService.generatePin(customerId,
+ accountId);
+ System.out.println("Your pin is " + pin);
+ }
+
+ break;
+ case 3:
+ // withdraw
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter the amount to withdraw");
+ amount = scanner.nextInt();
+ System.out.println("Enter your pin");
+ pin = scanner.nextInt();
+
+ balance = zensarBankingService.withdraw(customerId, accountId,
+ amount, pin);
+
+ if (balance > 0) {
+ System.out
+ .println("Amount withdrawn successfully with remaining balance "
+ + balance);
+ } else if (balance < 0) {
+ System.out.println("Cannot withdraw,negative balance");
+ } else {
+ System.out.println("Sorry you have not registered");
+ }
+
+ break;
+ case 4:
+ // deposit
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter the amount to deposit");
+ amount = scanner.nextInt();
+
+ balance = zensarBankingService.deposit(customerId, accountId,
+ amount);
+ System.out
+ .println("Amount successfully deposited, balance is "
+ + balance);
+
+ break;
+ case 5:
+ // transfer fund
+ System.out.println("Enter your customer Id");
+ int custIdFrom = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ int accNoFrom = scanner.nextInt();
+ System.out.println("Enter your pin");
+ pin = scanner.nextInt();
+ System.out.println("Enter the customer Id to transfer to");
+ int custIdTo = scanner.nextInt();
+ System.out.println("Enter the account Id to transfer to");
+ int accNoTo = scanner.nextInt();
+ System.out.println("Enter the amount to tansfer");
+ int amt = scanner.nextInt();
+
+ boolean result = zensarBankingService.fundTransfer(custIdFrom,
+ accNoFrom, custIdTo, accNoTo, amt, pin);
+ if (result == true) {
+ System.out.println("Fund transfer successful");
+ } else {
+ System.out.println("Fund transfer not successful");
+ }
+ break;
+ case 6:
+ // get balance
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter your pin");
+ pin = scanner.nextInt();
+ System.out.println(zensarBankingService.getAccountBalance(
+ customerId, accountId, pin));
+ break;
+ case 7:
+ // change pin
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ System.out.println("Enter your current pin");
+ oldPin = scanner.nextInt();
+ System.out.println("Enter new pin");
+ newPin = scanner.nextInt();
+ result = zensarBankingService.changePin(customerId, accountId,
+ oldPin, newPin);
+ if (result == true) {
+ System.out.println("Pin changed successfully");
+ } else {
+
+ System.out.println("Pin change not successful");
+ }
+ break;
+ case 8:
+ // get account details
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ System.out.println("Enter your account Id");
+ accountId = scanner.nextInt();
+ Account acc = zensarBankingService.getAccountDetails(
+ customerId, accountId);
+ System.out.println("Account No " + acc.getAccountId());
+ System.out.println("Account Type " + acc.getAccountType());
+ System.out.println("Account Balance " + acc.getBalance());
+ break;
+ case 9:
+ // get all account details
+ System.out.println("Enter your customer Id");
+ customerId = scanner.nextInt();
+ Account[] a = zensarBankingService
+ .getAllAccountsDetails(customerId);
+ System.out.println("Account deatils are:");
+ for (int i = 0; i < a.length; i++) {
+ if (a[i] != null) {
+ System.out.println("Account No " + a[i].getAccountId());
+ System.out.println("Account Type "
+ + a[i].getAccountType());
+ System.out.println("Account Balance "
+ + a[i].getBalance());
+ }
+
+ }
+ break;
+ default:
+ System.out.println("Invalid choice");
+ break;
+ }
+
+ System.out.println("Do you wish to continue?(Y/N)");
+ decision = scanner.next().charAt(0);
+ if (decision == 'n' || decision == 'N') {
+ System.out.println("Thank you for using the banking system");
+ System.exit(0);
+ }
+ } while (decision == 'y' || decision == 'Y');
+
+ scanner.close();
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java
new file mode 100644
index 0000000..16d0cd7
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/dao/ZensarBankingSystemArrayImpl.java
@@ -0,0 +1,98 @@
+package com.zensar.bankingsystem.dao;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.Transaction;
+
+public class ZensarBankingSystemArrayImpl {
+
+ Customer[] customers = new Customer[10];
+
+ static int i = 0, j = 0, custId = 100, accId = 50;
+
+ public int insertCustomer(Customer customer) {
+
+ customers[i++] = customer;
+ customer.setCustomerId(custId);
+ custId++;
+ return customer.getCustomerId();
+ }
+
+ public Customer getCustomer(int custId) {
+
+ for (Customer c : customers) {
+ if (c != null && c.getCustomerId() == custId)
+ return c;
+ }
+ return null;
+ }
+
+ public boolean updateCustomer(Customer customer) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean updateTransaction(int custId, int accNo,
+ Transaction transaction) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Account getAccount(int custId, int accNo) {
+
+ Account[] acc = getCustomer(custId).getAccount();
+ for (int k = 0; k < 3; k++) {
+ if (acc[k].getAccountId() == accNo)
+ return acc[k];
+ }
+ return null;
+ }
+
+ public Account[] getAccountList(int custId) {
+ return getCustomer(custId).getAccount();
+ }
+
+ public Transaction[] getTransactions(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean deleteCustomer(int custId) {
+ // customers[]
+ return false;
+ }
+
+ public boolean deleteAccount(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean updateAccount(int custId, Account account) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public int insertAccount(Account account, int custId) {
+ Account[] acc = getCustomer(custId).getAccount();
+
+ for (int k = 0; k < 3; k++) {
+
+ if (acc[k] == null) {
+ acc[k] = new Account(accId++, account.getAccountType(),
+ account.getBalance());
+ return acc[k].getAccountId();
+ }
+ }
+ return 0;
+ }
+
+ public int generateRandomNumber() {
+
+ int pin = (int) (Math.random() * 9999);
+ if (pin < 1000) {
+ pin += 1000;
+ }
+ return pin;
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java
new file mode 100644
index 0000000..974fdb4
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/BankingWithoutInterface/src/com/zensar/bankingsystem/services/ZensarBankingServiceImpl.java
@@ -0,0 +1,204 @@
+package com.zensar.bankingsystem.services;
+
+import com.zensar.bankingsystem.beans.Account;
+import com.zensar.bankingsystem.beans.Address;
+import com.zensar.bankingsystem.beans.Customer;
+import com.zensar.bankingsystem.beans.MyDate;
+import com.zensar.bankingsystem.beans.Transaction;
+import com.zensar.bankingsystem.dao.ZensarBankingSystemArrayImpl;
+
+public class ZensarBankingServiceImpl {
+
+ ZensarBankingSystemArrayImpl zensarBankingSystemArray;
+
+ public ZensarBankingServiceImpl() {
+ zensarBankingSystemArray = new ZensarBankingSystemArrayImpl();
+
+ }
+
+ /*
+ * public void transfer(int accountId, int tansferAccountId, double amount)
+ * { double a = zensarBankingSystemArray.getAccount(accountId).getBalance()
+ * - amount; System.out.println(a);
+ * zensarBankingSystemArray.getAccount(accountId).setBalance(a); double b =
+ * zensarBankingSystemArray.getAccount(accountId).getBalance() + amount;
+ * zensarBankingSystemArray.getAccount(tansferAccountId).setBalance(b);
+ *
+ * }
+ */
+
+ public int acceptCustomerDetails(String custName, String HomeAddressCity,
+ String HomeAddressState, int HomeAddressPincode,
+ String LocalAddressCity, String LocalAddressState,
+ int LocalAddressPincode, int day, int month, int year) {
+
+ if ((day > 0 && day <= 31) && (month >= 1 && month <= 12)
+ && (year <= 2015)) {
+ return zensarBankingSystemArray.insertCustomer(new Customer(
+ custName, new Address(LocalAddressCity, LocalAddressState,
+ LocalAddressPincode), new Address(HomeAddressCity,
+ HomeAddressState, HomeAddressPincode), new MyDate(
+ day, month, year)));
+ } else
+ return 0;
+
+ }
+
+ public int openAccount(int custId, int balance, String accType) {
+
+ int accountId = 0;
+
+ if (custId < 99) {
+ System.out
+ .println("Invalid customer Id,please enter a valid customer Id");
+ } else if (!(accType.equalsIgnoreCase("savings")
+ || accType.equalsIgnoreCase("current") || accType
+ .equalsIgnoreCase("salary"))) {
+ System.out
+ .println("Invalid account type, please enter a valid account type");
+ } else if (balance < 0) {
+ System.out.println("Invalid amount, please amount a valid amount");
+ }
+
+ else {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+
+ if (customer == null) {
+ System.out.println("Sorry you have not registered");
+ return 0;
+ } else {
+ Account account = new Account(accType, balance);
+ accountId = zensarBankingSystemArray.insertAccount(account,
+ custId);
+ }
+ }
+
+ return accountId;
+
+ }
+
+ public int getAccountBalance(int custId, int accNo, int pin) {
+
+ if (checkPin(custId, accNo, pin)) {
+ return zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance();
+ } else {
+ System.out.println("Invalid pin");
+ return 0;
+ }
+
+ }
+
+ public int withdraw(int custId, int accNo, int amt, int pin) {
+ int balance = 0;
+ if (amt < 0) {
+ System.out.println("Invalid amount, please enter a valid amount");
+ } else {
+
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+
+ if (customer == null) {
+ return 0;
+ } else {
+ Account account = zensarBankingSystemArray.getAccount(custId,
+ accNo);
+ if (account == null) {
+ System.out.println("Sorry your account does not exist");
+ } else if (account.getPin()!=pin) {
+ System.out.println("Invalid pin");
+ return 0;
+ } else {
+ if ((account.getBalance() - amt) > 0) {
+ account.setBalance(account.getBalance() - amt);
+ balance = account.getBalance();
+ }
+ }
+ }
+ }
+ return balance;
+ }
+
+ public boolean fundTransfer(int custIdFrom, int accNoFrom, int custIdTo,
+ int accNoTo, int amt, int pin) {
+ if (withdraw(custIdFrom, accNoFrom, amt, pin) > 0) {
+ deposit(custIdTo, accNoTo, amt);
+ return true;
+ }
+ return false;
+ }
+
+ public int deposit(int custId, int accNo, int amt) {
+ if (amt < 0) {
+ System.out.println("Invalid amount, please enter a valid amount");
+ } else {
+
+ zensarBankingSystemArray.getAccount(custId, accNo).setBalance(
+ zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance() + amt);
+
+ return zensarBankingSystemArray.getAccount(custId, accNo)
+ .getBalance();
+ }
+ return 0;
+ }
+
+ public Customer getCustomerDetails(int custId) {
+ Customer customer = zensarBankingSystemArray.getCustomer(custId);
+ if (customer != null) {
+ return customer;
+ }
+ return null;
+ }
+
+ public Account getAccountDetails(int custId, int accNo) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ if (account != null) {
+ return account;
+ }
+ return null;
+ }
+
+ public Account[] getAllAccountsDetails(int custId) {
+ Account[] account = zensarBankingSystemArray.getAccountList(custId);
+ if (account != null) {
+ return account;
+ }
+ return null;
+ }
+
+ public Transaction[] getAllTransactionDetails(int custId, int accNo) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int generatePin(int custId, int accNo) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ int pin = zensarBankingSystemArray.generateRandomNumber();
+ account.setPin(pin);
+ return account.getPin();
+ }
+
+ public boolean changePin(int custId, int accNo, int oldPin, int newPin) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ if (account != null) {
+ if (account.getPin() == oldPin) {
+ account.setPin(newPin);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean checkPin(int custId, int accNo, int pin) {
+ Account account = zensarBankingSystemArray.getAccount(custId, accNo);
+ if (account != null) {
+ if (account.getPin() == pin) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+}
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.classpath b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.classpath
new file mode 100644
index 0000000..c5f82df
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.classpath
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.project b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.project
new file mode 100644
index 0000000..fdaf927
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/.project
@@ -0,0 +1,17 @@
+
+
+ CONTACT LIST MANAGEMENT APPLICATION
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.class
new file mode 100644
index 0000000..3115ff8
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.java
new file mode 100644
index 0000000..1c717de
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Casual_acquaintances.java
@@ -0,0 +1,181 @@
+import java.io.Serializable;
+
+/**
+ * Write a description of class Casual_acquaintances here.
+ *
+ * @author (your name)
+ * @version (a version number or a date)
+ */
+@SuppressWarnings("serial")
+public class Casual_acquaintances extends Contacts
+{
+ private String met_when;
+ private String met_where;
+ private String meeting_circumstances;
+ private String other_info;
+
+ Casual_acquaintances(){
+
+ super();
+ met_when = null;
+ met_where = null;
+ meeting_circumstances = null;
+ other_info = null;
+ }
+
+
+
+ public void setmetwhen(String when){
+ // try{
+ if (when.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else {
+ //try{
+ if (met_when != null && met_when.length() >= 0){
+ String appended1 = met_when + when;
+ if (appended1.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else met_when = appended1;
+ }else
+ this.met_when = when;
+ }
+ /* catch (IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length());
+ //this.meetingcontext = met;
+ //}
+ /*}catch(IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ }
+
+
+ public void setmetwhere(String where){
+ // try{
+ if (where.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else {
+ // try{
+ if (met_where != null && met_where.length() >= 0){
+ String appended2 = met_where + where;
+ if (appended2.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else met_where = appended2;
+ }else
+ this.met_where = where;
+ }
+ /* catch (IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length());
+ //this.meetingcontext = met;
+ //}
+ /* }catch(IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ }
+
+ public void setcircumstance(String circum){
+ // try{
+ if (circum.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else {
+ // try{
+ if (meeting_circumstances != null && meeting_circumstances.length() >= 0){
+ String appended3 = meeting_circumstances + circum;
+ if (appended3.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else meeting_circumstances = appended3;
+ }else
+ this.meeting_circumstances = circum;
+ /* }
+ catch (IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length());
+ //this.meetingcontext = met;
+ }
+ /* }catch(IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ }
+
+ public void setinfo(String information){
+ //try{
+ if (information.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else {
+ // try{
+ if (other_info != null && other_info.length() >= 0){
+ String appended4 = other_info + information;
+ if (appended4.length() > 100){
+ throw new IndexOutOfBoundsException();
+ }
+ else other_info = appended4;
+ }else
+ this.other_info = information;
+ /* }
+ catch (IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ //System.arraycopy(met.toCharArray(),0,meetingcontext,0,met.length());
+ //this.meetingcontext = met;
+ }
+ /* }catch(IndexOutOfBoundsException e){
+ System.out.println("Error: You cannot add more than 100 characters ");
+ //System.exit(0);
+ }*/
+ }
+
+
+ public String getmetwhen(){
+ if (this.met_when == null){
+ // System.out.println("Nothing to show! ");
+ return null;
+ }
+ else
+ return this.met_when;
+ }
+
+ public String getmetwhere(){
+ if (this.met_where == null){
+ //System.out.println("Nothing to show! ");
+ return null;
+ }
+ else
+ return this.met_where;
+ }
+
+ public String getcircumstance(){
+ if (this.meeting_circumstances == null){
+ // System.out.println("Nothing to show! ");
+ return null;
+ }
+ else
+ return this.meeting_circumstances;
+ }
+
+ public String getinfo(){
+ if (this.other_info == null){
+ // System.out.println("Nothing to show! ");
+ return null;
+ }
+ else
+ return this.other_info;
+ }
+}
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.class
new file mode 100644
index 0000000..7a3f0d7
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.java
new file mode 100644
index 0000000..7a335a2
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Combine.java
@@ -0,0 +1,772 @@
+
+
+
+
+/**
+ * Write a description of class Combine here.
+ *
+ * @author (your name)
+ * @version (a version number or a date)
+ */
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.*;
+
+public class Combine
+{
+
+ @SuppressWarnings("unchecked")
+ public static void main(String[] args){
+
+ /*ArrayList relatives = new ArrayList();
+ ArrayList personalfriends = new ArrayList();
+ ArrayList professionalfriends = new ArrayList();
+ ArrayList casualacquaintances = new ArrayList();
+ */
+
+ ArrayList relatives = new ArrayList();
+ ArrayList personalfriends = new ArrayList();
+ ArrayList professionalfriends = new ArrayList();
+ ArrayList casualacquaintances = new ArrayList();
+
+
+
+ File file = new File("save.ser");
+ try{
+ if (!file.exists()){//if file did not exist create new file
+ file.createNewFile();
+ }
+ else{//else read from already existing file
+ try{
+ FileInputStream fout = new FileInputStream(file);
+ ObjectInputStream oos = new ObjectInputStream(fout);
+ try{
+ //FileInputStream fout = new FileInputStream(file);
+ //ObjectInputStream oos = new ObjectInputStream(fout);
+ relatives = (ArrayList)oos.readObject();
+ personalfriends = (ArrayList)oos.readObject();
+ professionalfriends = (ArrayList)oos.readObject();
+ casualacquaintances = (ArrayList)oos.readObject();
+ // System.out.println("Finished Reading! ");
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(IOException e){
+ e.printStackTrace();
+ }
+ }
+ }catch(FileNotFoundException e){
+ e.printStackTrace();
+ }catch(IOException e){
+ e.printStackTrace();
+ }
+ }
+ }
+ catch(IOException e){
+ e.printStackTrace();
+ }
+
+
+ while (true){
+ System.out.println("-----------------------------------------------------------------------");
+ System.out.println("1.Create Acquaintance");
+ System.out.println("2.Delete Acquaintance");
+ System.out.println("3.Display Acquaintance List");
+ System.out.println("4.Search Acquaintance");
+ System.out.println("5.Exit");
+
+ Scanner scan = new Scanner(System.in);
+ String opt = scan.nextLine();
+
+ switch(opt){
+ case ("1"):{//create acquaintance
+ System.out.println("1.Relative 2.Personal friend 3.Professional friend 4.Casual acquaintance");
+ String opt1 = scan.nextLine();
+ switch (opt1){
+ case ("1"):{//create relative object
+
+
+ Relatives newrel = new Relatives();
+ System.out.println(" Name: ");
+ newrel.setname(scan.nextLine());
+ System.out.println(" Mobile Number: ");
+ newrel.setmobnum(scan.nextLine());
+ System.out.println(" Email id: ");
+ newrel.setemailid(scan.nextLine());
+ System.out.println(" Birthday: ");
+ newrel.setbirthday(scan.nextLine());
+ System.out.println(" Date on which you met the latest time: ");
+ newrel.setdate(scan.nextLine());
+
+ relatives.add(newrel);
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Added successfully! ");
+
+ break;
+ }
+ case ("2"):{//create personal_friend object
+
+ Personal_friends newperfr = new Personal_friends();
+
+ System.out.println("Name:");
+ newperfr.setname(scan.nextLine());
+ System.out.println("Mobile number: ");
+ newperfr.setmobnum(scan.nextLine());
+ System.out.println("Email id:");
+ newperfr.setemailid(scan.nextLine());
+ System.out.println("Date of acquaintance:");
+ newperfr.setmetdate(scan.nextLine());
+ while (true){
+ System.out.println("How you met:");
+ try{
+ newperfr.setmeetcontext(scan.nextLine());
+ }catch (IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+ while (true){
+ System.out.println("Any notable events?");
+ try{
+ newperfr.setevents(scan.nextLine());
+ }catch(IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+
+ personalfriends.add(newperfr);
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Added successfully! ");
+
+ break;
+ }
+ case ("3"):{//create professional_friend object
+
+ Professional_friends newproffr = new Professional_friends();
+
+ System.out.println("Name: ");
+ newproffr.setname(scan.nextLine());
+ System.out.println("Mobile number: ");
+ newproffr.setmobnum(scan.nextLine());
+ System.out.println("Email id: ");
+ newproffr.setemailid(scan.nextLine());
+ while (true){
+ System.out.println("Common interests: ");
+ try{
+ newproffr.setinterests(scan.nextLine());
+ }catch(IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+
+
+ professionalfriends.add(newproffr);
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Added succesfully!");
+
+ break;
+ }
+ case ("4"):{//create casual_acquaintance object
+
+
+ Casual_acquaintances newcasacq = new Casual_acquaintances();
+
+ System.out.println("Name: ");
+ newcasacq.setname(scan.nextLine());
+ System.out.println("Mobile number: ");
+ newcasacq.setmobnum(scan.nextLine());
+ System.out.println("Email id: ");
+ newcasacq.setemailid(scan.nextLine());
+ while (true){
+ System.out.println("When did you meet? ");
+ try{
+ newcasacq.setmetwhen(scan.nextLine());
+ }catch(IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+ while(true){
+ System.out.println("Where did you meet? ");
+ try{
+ newcasacq.setmetwhere(scan.nextLine());
+ }catch(IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+ while(true){
+ System.out.println("Under what circumstances did you meet? ");
+ try{
+ newcasacq.setcircumstance(scan.nextLine());
+ }catch(IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+ while(true){
+ System.out.println("Any other information?");
+ try{
+ newcasacq.setinfo(scan.nextLine());
+ }catch(IndexOutOfBoundsException e){
+ System.out.println("You cannot add more than 100 characters..Try again..");
+ continue;
+ }
+ break;
+ }
+
+ casualacquaintances.add(newcasacq);
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close() ;
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Added successfully! ");
+
+ break;
+ }
+ }
+ break;
+ }
+ case ("2"):{//delete acquaintance
+ System.out.println("1.Relative 2.Personal friend 3.Professional friend 4.Casual acquaintance");
+ String opt2 = scan.nextLine();
+ switch (opt2){
+ case ("1"):{//delete relative_object
+ System.out.println("Name: ");
+ String name = scan.nextLine();
+
+ boolean delflag = false;
+ ListIterator it = relatives.listIterator();
+ while (it.hasNext()){
+ Relatives temprel = (Relatives) it.next();
+ if (temprel.getname().equals(name)){
+ relatives.remove(temprel);
+ System.out.println("Deleted successfully! ");
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ delflag = true;
+ break;
+ }
+ }
+ if (!delflag){
+ System.out.println("No relative's record is available with this name.");
+ }
+
+ break;
+ }
+ case ("2"):{//delete personal_friend object
+ System.out.println("Name:");
+ String name = scan.nextLine();
+
+
+ boolean delflag = false;
+ ListIterator it = personalfriends.listIterator();
+ while (it.hasNext()){
+ Personal_friends temp = (Personal_friends) it.next();
+ if (temp.getname().equals(name)){
+ personalfriends.remove(temp);
+ System.out.println("Deleted successfully! ");
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ delflag = true;
+ break;
+ }
+ }
+ if (!delflag){
+ System.out.println("No personal friend's record is available with this name.");
+ }
+
+ break;
+ }
+ case ("3"):{//delete professional_friend object
+ System.out.println("Name:");
+ String name = scan.nextLine();
+
+ boolean delflag = false;
+ ListIterator it = professionalfriends.listIterator();
+ while (it.hasNext()){
+ Professional_friends temp = (Professional_friends) it.next();
+ if (temp.getname().equals(name)){
+ professionalfriends.remove(temp);
+ System.out.println("Deleted successfully! ");
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ delflag = true;
+ break;
+ }
+ }
+ if (!delflag){
+ System.out.println("No professional friend's record is available with this name.");
+ }
+
+ break;
+ }
+ case ("4"):{// delete casual_acquaintance object
+ System.out.println("Name:");
+ String name = scan.nextLine();
+
+ boolean delflag = false;
+ ListIterator it = casualacquaintances.listIterator();
+ while (it.hasNext()){
+ Casual_acquaintances temp = (Casual_acquaintances) it.next();
+ if (temp.getname().equals(name)){
+ casualacquaintances.remove(temp);
+ System.out.println("Deleted successfully! ");
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ delflag = true;
+ break;
+ }
+ }
+ if (!delflag){
+ System.out.println("No casual acquaintance's record is available with this name.");
+ }
+
+ break;
+ }
+ }
+
+ break;
+ }
+ case ("3"):{//display list
+ System.out.println("1.Relative 2.Personal friend 3.Professional friend 4.Casual acquaintance 5.Entire list");
+ String opt3 = scan.nextLine();
+
+ switch (opt3){
+ case ("1"):{//display list of relatives
+ System.out.println("\t------------------Relatives------------------------");
+
+ ListIterator it1 = relatives.listIterator();
+ while (it1.hasNext()){
+ Relatives temp1 = (Relatives) it1.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp1.getname());
+ System.out.println("Date of Birth: "+temp1.getbirthday());
+ System.out.println("Mobile Number: "+temp1.getmobnum());
+ System.out.println("Email id: "+temp1.getemailid());
+ System.out.println("Last met on: "+temp1.getdate());
+ System.out.println("------------------------------------------------------------");
+ }
+
+ break;
+ }
+ case ("2"):{//display list of personal friends
+ System.out.println("\t-------------------Personal friends------------------------");
+
+ ListIterator it2 = personalfriends.listIterator();
+ while (it2.hasNext()){
+ Personal_friends temp2 = (Personal_friends) it2.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp2.getname());
+ System.out.println("Mobile number: "+temp2.getmobnum());
+ System.out.println("Email id: "+temp2.getemailid());
+ System.out.println("Meeting Date: "+temp2.getmetdate());
+ System.out.println("Meeting context: "+temp2.getmeetcontext());
+ System.out.println("Notable events: "+temp2.getevents());
+ System.out.println("------------------------------------------------------------");
+ }
+
+ break;
+ }
+ case ("3"):{//display list of professional friends
+ System.out.println("\t-------------------Professional friends------------------------");
+
+ ListIterator it3 = professionalfriends.listIterator();
+ while (it3.hasNext()){
+ Professional_friends temp3 = (Professional_friends) it3.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp3.getname());
+ System.out.println("Mobile number: "+temp3.getmobnum());
+ System.out.println("Email id: "+temp3.getemailid());
+ System.out.println("Common interests: "+temp3.getinterests());
+ System.out.println("------------------------------------------------------------");
+
+ }
+
+ break;
+ }
+ case ("4"):{//display list of casual acquaintances
+ System.out.println("\t-------------------Casual Acquaintances------------------------");
+
+ ListIterator it4 = casualacquaintances.listIterator();
+ while (it4.hasNext()){
+ Casual_acquaintances temp4 = (Casual_acquaintances) it4.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp4.getname());
+ System.out.println("Mobile number: "+temp4.getmobnum());
+ System.out.println("Email id: "+temp4.getemailid());
+ System.out.println("Met when: "+temp4.getmetwhen());
+ System.out.println("Met where: "+temp4.getmetwhere());
+ System.out.println("Meeting circumstances: "+temp4.getcircumstance());
+ System.out.println("Other information: "+temp4.getinfo());
+ System.out.println("------------------------------------------------------------");
+
+ }
+
+ break;
+ }
+ case ("5"):{//display list of entire list
+ System.out.println("\t------------------Relatives------------------------");
+
+ ListIterator it1 = relatives.listIterator();
+ while (it1.hasNext()){
+ Relatives temp1 = (Relatives) it1.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp1.getname());
+ System.out.println("Date of Birth: "+temp1.getbirthday());
+ System.out.println("Mobile Number: "+temp1.getmobnum());
+ System.out.println("Email id: "+temp1.getemailid());
+ System.out.println("Last met on: "+temp1.getdate());
+ System.out.println("------------------------------------------------------------");
+ }
+
+ System.out.println("\t-------------------Personal friends------------------------");
+
+ ListIterator it2 = personalfriends.listIterator();
+ while (it2.hasNext()){
+ Personal_friends temp2 = (Personal_friends) it2.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp2.getname());
+ System.out.println("Mobile number: "+temp2.getmobnum());
+ System.out.println("Email id: "+temp2.getemailid());
+ System.out.println("Meeting Date: "+temp2.getmetdate());
+ System.out.println("Meeting context: "+temp2.getmeetcontext());
+ System.out.println("Notable events: "+temp2.getevents());
+ System.out.println("------------------------------------------------------------");
+ }
+
+ System.out.println("\t-------------------Professional friends------------------------");
+
+ ListIterator it3 = professionalfriends.listIterator();
+ while (it3.hasNext()){
+ Professional_friends temp3 = (Professional_friends) it3.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp3.getname());
+ System.out.println("Mobile number: "+temp3.getmobnum());
+ System.out.println("Email id: "+temp3.getemailid());
+ System.out.println("Common interests: "+temp3.getinterests());
+ System.out.println("------------------------------------------------------------");
+
+ }
+
+ System.out.println("\t-------------------Casual Acquaintances------------------------");
+
+ ListIterator it4 = casualacquaintances.listIterator();
+ while (it4.hasNext()){
+ Casual_acquaintances temp4 = (Casual_acquaintances) it4.next();
+ System.out.println("------------------------------------------------------------");
+ System.out.println("Name: "+temp4.getname());
+ System.out.println("Mobile number: "+temp4.getmobnum());
+ System.out.println("Email id: "+temp4.getemailid());
+ System.out.println("Met when: "+temp4.getmetwhen());
+ System.out.println("Met where: "+temp4.getmetwhere());
+ System.out.println("Meeting circumstances: "+temp4.getcircumstance());
+ System.out.println("Other information: "+temp4.getinfo());
+ System.out.println("------------------------------------------------------------");
+
+ }
+
+ break;
+ }
+
+ }
+
+ break;
+ }
+ case ("4"):{//search acquaintance by name
+ System.out.println("Name to search for: ");
+ String searchname = scan.nextLine();
+
+ boolean searchflag = false;
+
+ ListIterator it1 = relatives.listIterator();
+ while (it1.hasNext()){
+ Relatives temp1 = (Relatives) it1.next();
+ if (temp1.getname().equals(searchname)){
+ System.out.println("Relative: ");
+ System.out.println("Name: "+temp1.getname());
+ System.out.println("Date of Birth: "+temp1.getbirthday());
+ System.out.println("Mobile Number: "+temp1.getmobnum());
+ System.out.println("Email id: "+temp1.getemailid());
+ System.out.println("Last met on: "+temp1.getdate());
+ System.out.println("------------------------------------------------------------");
+ searchflag = true;
+ }
+ }
+
+ ListIterator it2 = personalfriends.listIterator();
+ while (it2.hasNext()){
+ Personal_friends temp2 = (Personal_friends) it2.next();
+ if (temp2.getname().equals(searchname)){
+ System.out.println("Personal friend:");
+ System.out.println("Name: "+temp2.getname());
+ System.out.println("Mobile number: "+temp2.getmobnum());
+ System.out.println("Email id: "+temp2.getemailid());
+ System.out.println("Meeting Date: "+temp2.getmetdate());
+ System.out.println("Meeting context: "+temp2.getmeetcontext());
+ System.out.println("Notable events: "+temp2.getevents());
+ System.out.println("------------------------------------------------------------");
+ searchflag = true;
+ }
+ }
+
+ ListIterator it3 = professionalfriends.listIterator();
+ while (it3.hasNext()){
+ Professional_friends temp3 = (Professional_friends) it3.next();
+ if (temp3.getname().equals(searchname)){
+
+ System.out.println("Professional friend:");
+ System.out.println("Name: "+temp3.getname());
+ System.out.println("Mobile number: "+temp3.getmobnum());
+ System.out.println("Email id: "+temp3.getemailid());
+ System.out.println("Common interests: "+temp3.getinterests());
+ System.out.println("------------------------------------------------------------");
+ searchflag = true;
+ }
+ }
+
+ ListIterator it4 = casualacquaintances.listIterator();
+ while (it4.hasNext()){
+ Casual_acquaintances temp4 = (Casual_acquaintances) it4.next();
+ if(temp4.getname().equals(searchname)){
+ System.out.println("Casual acquaintance:");
+ System.out.println("Name: "+temp4.getname());
+ System.out.println("Mobile number: "+temp4.getmobnum());
+ System.out.println("Email id: "+temp4.getemailid());
+ System.out.println("Met when: "+temp4.getmetwhen());
+ System.out.println("Met where: "+temp4.getmetwhere());
+ System.out.println("Meeting circumstances: "+temp4.getcircumstance());
+ System.out.println("Other information: "+temp4.getinfo());
+ System.out.println("------------------------------------------------------------");
+ searchflag = true;
+ }
+ }
+
+
+
+
+ if (searchflag == false)
+ System.out.println("No such record exists! ");
+ break;
+ }
+ case("5"):{//exit
+ System.out.println("Thank you! ");
+
+ FileOutputStream fout = null;
+ ObjectOutputStream oos = null;
+ try{
+ fout = new FileOutputStream("save.ser");
+ oos = new ObjectOutputStream(fout);
+ oos.writeObject(relatives);
+ oos.writeObject(personalfriends);
+ oos.writeObject(professionalfriends);
+ oos.writeObject(casualacquaintances);
+ }catch(Exception e){
+ e.printStackTrace();
+ }finally{
+ try{
+ if (oos != null){
+ oos.close();
+ fout.close();
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ System.exit(0);
+ }
+ }
+
+ }
+
+}
+}
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$1.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$1.class
new file mode 100644
index 0000000..67c2c94
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$1.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$10.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$10.class
new file mode 100644
index 0000000..ed0b779
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$10.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$11.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$11.class
new file mode 100644
index 0000000..3de41c3
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$11.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$12.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$12.class
new file mode 100644
index 0000000..fa27729
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$12.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$13.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$13.class
new file mode 100644
index 0000000..5015ed1
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$13.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$14.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$14.class
new file mode 100644
index 0000000..43e492a
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$14.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$15.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$15.class
new file mode 100644
index 0000000..850e9f4
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$15.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$16.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$16.class
new file mode 100644
index 0000000..0f32ef6
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$16.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$17.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$17.class
new file mode 100644
index 0000000..bcb6e74
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$17.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$18.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$18.class
new file mode 100644
index 0000000..2dea0cc
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$18.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$19.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$19.class
new file mode 100644
index 0000000..613debc
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$19.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$2.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$2.class
new file mode 100644
index 0000000..7592301
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$2.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$20.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$20.class
new file mode 100644
index 0000000..5dca105
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$20.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$21.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$21.class
new file mode 100644
index 0000000..3a00dbb
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$21.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$22.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$22.class
new file mode 100644
index 0000000..9a30b71
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$22.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$3.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$3.class
new file mode 100644
index 0000000..12fe0d6
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$3.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$4.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$4.class
new file mode 100644
index 0000000..8d02d0d
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$4.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$5.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$5.class
new file mode 100644
index 0000000..fe85fb1
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$5.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$6.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$6.class
new file mode 100644
index 0000000..991c9c2
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$6.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$7.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$7.class
new file mode 100644
index 0000000..4047d6c
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$7.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$8.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$8.class
new file mode 100644
index 0000000..c9e7486
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$8.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$9.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$9.class
new file mode 100644
index 0000000..03bfd28
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list$9.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.class b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.class
new file mode 100644
index 0000000..263e3e7
Binary files /dev/null and b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.class differ
diff --git a/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.java b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.java
new file mode 100644
index 0000000..f2eb5bf
--- /dev/null
+++ b/projects/JAVA-PROJECTS-master/CONTACT LIST MANAGEMENT APPLICATION/Contact_list.java
@@ -0,0 +1,1856 @@
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+
+import javax.swing.JFrame;
+import java.awt.FlowLayout;
+import javax.swing.UIManager;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableModel;
+
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.ListIterator;
+
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.SwingConstants;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import java.awt.Component;
+
+public class Contact_list {
+
+ private static File file = new File("save.ser");
+
+ private static ArrayList relatives = new ArrayList();
+ private static ArrayList personalfriends = new ArrayList();
+ private static ArrayList professionalfriends = new ArrayList