commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1066664 [1/6] - in /commons/sandbox/bsp: branches/ tags/ trunk/ trunk/src/ trunk/src/main/ trunk/src/main/java/ trunk/src/main/java/org/ trunk/src/main/java/org/apache/ trunk/src/main/java/org/apache/commons/ trunk/src/main/java/org/apache...
Date Wed, 02 Feb 2011 22:21:07 GMT
Author: luc
Date: Wed Feb  2 22:21:05 2011
New Revision: 1066664

URL: http://svn.apache.org/viewvc?rev=1066664&view=rev
Log:
initial commit for Commons BSP

Added:
    commons/sandbox/bsp/branches/
    commons/sandbox/bsp/tags/
    commons/sandbox/bsp/trunk/   (with props)
    commons/sandbox/bsp/trunk/LICENSE.txt   (with props)
    commons/sandbox/bsp/trunk/NOTICE.txt   (with props)
    commons/sandbox/bsp/trunk/PROPOSAL.html   (with props)
    commons/sandbox/bsp/trunk/checkstyle.xml   (with props)
    commons/sandbox/bsp/trunk/license-header.txt   (with props)
    commons/sandbox/bsp/trunk/pom.xml   (with props)
    commons/sandbox/bsp/trunk/src/
    commons/sandbox/bsp/trunk/src/main/
    commons/sandbox/bsp/trunk/src/main/java/
    commons/sandbox/bsp/trunk/src/main/java/org/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/threeD/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/threeD/Line.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/threeD/OutlineExtractor.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/threeD/Plane.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/threeD/Point3D.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/threeD/PolyhedronsSet.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/Edge.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/Line.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/NestedLoops.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/Point2D.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/PolygonsSet.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/Segment.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/SegmentBuilder.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/twoD/Vertex.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/BSPTree.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/BSPTreeVisitor.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/Characterization.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/Hyperplane.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/Point.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/Region.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/SubHyperplane.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/SubSpace.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/Transform.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/partitioning/package.html   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/utilities/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/utilities/AVLTree.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/utilities/OrderedTuple.java   (with props)
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/utilities/doc-files/
    commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/utilities/doc-files/OrderedTuple.png   (with props)
    commons/sandbox/bsp/trunk/src/main/resources/
    commons/sandbox/bsp/trunk/src/main/resources/META-INF/
    commons/sandbox/bsp/trunk/src/main/resources/META-INF/localization/
    commons/sandbox/bsp/trunk/src/main/resources/META-INF/localization/BSPMessages_en.properties   (with props)
    commons/sandbox/bsp/trunk/src/main/resources/META-INF/localization/BSPMessages_fr.properties   (with props)
    commons/sandbox/bsp/trunk/src/test/
    commons/sandbox/bsp/trunk/src/test/java/
    commons/sandbox/bsp/trunk/src/test/java/org/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/oneD/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSetTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/threeD/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/threeD/LineTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/threeD/PlaneTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/threeD/PolyhedronsSetTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/twoD/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/twoD/EdgeTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/twoD/LineTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/euclidean/twoD/PolygonsSetTest.java   (with props)
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/utilities/
    commons/sandbox/bsp/trunk/src/test/java/org/apache/commons/bsp/utilities/AVLTreeTest.java   (with props)

Propchange: commons/sandbox/bsp/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Feb  2 22:21:05 2011
@@ -0,0 +1,7 @@
+target
+cobertura.ser
+.settings
+.classpath
+.project
+.checkstyle
+

Added: commons/sandbox/bsp/trunk/LICENSE.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/LICENSE.txt?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/LICENSE.txt (added)
+++ commons/sandbox/bsp/trunk/LICENSE.txt Wed Feb  2 22:21:05 2011
@@ -0,0 +1,376 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+APACHE COMMONS MATH DERIVATIVE WORKS: 
+
+The Apache commons-math library includes a number of subcomponents
+whose implementation is derived from original sources written
+in C or Fortran.  License terms of the original sources
+are reproduced below.
+
+===============================================================================
+For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in
+the LevenbergMarquardtOptimizer class in package
+org.apache.commons.math.optimization.general 
+Original source copyright and license statement:
+
+Minpack Copyright Notice (1999) University of Chicago.  All rights reserved
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above
+copyright notice, this list of conditions and the following
+disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the
+redistribution, if any, must include the following
+acknowledgment:
+
+   "This product includes software developed by the
+   University of Chicago, as Operator of Argonne National
+   Laboratory.
+
+Alternately, this acknowledgment may appear in the software
+itself, if and wherever such third-party acknowledgments
+normally appear.
+
+4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
+WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
+UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
+THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
+OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
+OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
+USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
+THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
+DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
+UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
+BE CORRECTED.
+
+5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
+HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
+ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
+INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
+ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
+PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
+SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
+(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
+EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
+POSSIBILITY OF SUCH LOSS OR DAMAGES.
+===============================================================================
+
+Copyright and license statement for the odex Fortran routine developed by
+E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class
+in package org.apache.commons.math.ode.nonstiff:
+
+
+Copyright (c) 2004, Ernst Hairer
+
+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.
+
+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 REGENTS 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.
+===============================================================================
+
+Copyright and license statement for the original lapack fortran routines
+translated in EigenDecompositionImpl class in package
+org.apache.commons.math.linear:
+
+Copyright (c) 1992-2008 The University of Tennessee.  All rights reserved.
+
+$COPYRIGHT$
+
+Additional copyrights may follow
+
+$HEADER$
+
+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 listed
+  in this license in the documentation and/or other materials
+  provided with the distribution.
+  
+- Neither the name of the copyright holders nor the names of its
+  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. 
+===============================================================================
+
+Copyright and license statement for the original Mersenne twister C
+routines translated in MersenneTwister class in package 
+org.apache.commons.math.random:
+
+   Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+   All rights reserved.                          
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     1. Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+
+     2. 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.
+
+     3. The names of its contributors may not 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.
+

Propchange: commons/sandbox/bsp/trunk/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/NOTICE.txt?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/NOTICE.txt (added)
+++ commons/sandbox/bsp/trunk/NOTICE.txt Wed Feb  2 22:21:05 2011
@@ -0,0 +1,9 @@
+Apache Commons BSP
+Copyright 2011 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+The complete text of licenses and disclaimers associated with the the original
+sources enumerated above at the time of code translation are in the LICENSE.txt
+file.

Propchange: commons/sandbox/bsp/trunk/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/NOTICE.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/PROPOSAL.html
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/PROPOSAL.html?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/PROPOSAL.html (added)
+++ commons/sandbox/bsp/trunk/PROPOSAL.html Wed Feb  2 22:21:05 2011
@@ -0,0 +1,135 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<html>
+<head>
+<title>Proposal for BSP Package</title>
+</head>
+<body bgcolor="white">
+
+<div align="center">
+<h1>Proposal for <em>BSP</em> Package</h1>
+</div>
+
+<h3>(0) Rationale</h3>
+
+<p>
+  Geometry modeling involves representing complex shapes in several dimensions.
+  Use cases include for example:
+  <ul>
+    <li>solid modeling in dimension 3 for
+      <ul>
+        <li>display in almost all fields of activities</li>
+        <li>collision detection in robotics</li>
+        <li>mass, center of gravity, inertia computation in manufacturing</li>
+        <li>constructive solid geometry for design</li>
+      </ul>
+    </li>
+    <li>polygons modeling in cartography or games</li>
+    <li>intervals sets in time scheduling</li>
+    <li>complex shapes modeling on the unit sphere in cartography or antenna mapping</li>
+  </ul>
+</p>
+
+<p>
+  Geometry modeling can be done using different methods, like boundary representation (BRep),
+  quadtrees, binary space partitioning (BSP) or constructive solid geometry.
+</p>
+
+<h3>(1) Scope of the Package</h3>
+
+<p>
+  The bsp package is intended to be a general-purpose implementation of BSP trees suitable
+  for geometry modeling in low dimensions, either in Euclidean space or on unit sphere
+  topologies. It is <em>not</em> intended for direct 3D rendering which is better done using
+  triangulated boundaries by specialized hardware and software, however it can be used to build
+  such triangulated models.
+</p>
+
+<p>
+  The BSP project shall create and maintain a library providing Binary
+  Space Partitioning trees
+  <ul>
+    <li>it must support at least dimensions 1, 2 and 3 in euclidean space</li>
+    <li>it should support the 2D unit sphere immersed in 3D euclidean space</li>
+    <li>it must support both convex and non-convex shapes</li>
+    <li>it must support both simply connected and non-connected shapes</li>
+    <li>it must support empty shapes and shapes corresponding to the whole space</li>
+    <li>it must provide the basic set operations
+        (union, intersection, complement, disjunction)</li>
+    <li>it must support the basic predicates operations
+        (point is inside/outside, shape is empty/full space)</li>
+    <li>it must support simple transforms like translation or rotation</li>
+    <li>it should allow to convert from/to boundary representation</li>
+    <li>it should support attaching any user-defined property to parts
+        of shapes (for example density, color, material, temperature ...)</li>
+    <li>it should support doing simple computations on shapes (at least in
+        Euclidean spaces) like length/surface/volume, center of gravity,
+        inertia</li>
+  </ul>
+</p>
+
+<h3>(1.5) Interaction With Other Packages</h3>
+
+<p>BSP should rely on standard Java 1.5 and on an Apache Commons Math.
+For development, it utilizes the JUnit unit testing framework,
+either ant or maven 2 and general quality checking tools (coding style, test coverage,
+classical error patterns monitoring).</p>
+
+<p>No external configuration files are utilized.</p>
+
+
+<h3>(2) Initial Source of the Package</h3>
+
+<p>
+The initial codebase will be imported from an unpublished proof of concept
+developed by the proposal creator. This codebase already separates the BSP
+tree engine from the vectorial space implementation and provides implementations
+for Euclidean spaces in dimension 1, 2 and 3.</p>
+
+<p>The proposed package name for the new component is
+<code>org.apache.commons.bsp</code>.</p>
+
+
+<h3>(3)  Required Commons Resources</h3>
+
+<ul>
+<li>Subversion Repository - New directory <code>bsp</code> in the
+    <code>commons</code> subversion repository.</li>
+<li>Mailing List - Discussions will take place on the general
+    <em>dev@commons.apache.org</em> mailing list.  To help
+    list subscribers identify messages of interest, it is suggested that
+    the message subject of messages about this component be prefixed with
+    [bsp].</li>
+<li>Jira - New component "bsp" under the "Commons" product
+    category, with appropriate version identifiers as needed.</li>
+</ul>
+
+
+<h3>(4) Initial Committers</h3>
+
+<p>The initial committers on the bsp component shall be:
+<ul>
+  <li><a href="mailto:luc@apache.org">Luc Maisonobe</a></li>
+</ul>
+<ul>
+  <li><a href="mailto:simonetripodi@apache.org">Simone Tripodi</a></li>
+</ul>
+</p>
+
+</body>
+</html>

Propchange: commons/sandbox/bsp/trunk/PROPOSAL.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/PROPOSAL.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/checkstyle.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/checkstyle.xml?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/checkstyle.xml (added)
+++ commons/sandbox/bsp/trunk/checkstyle.xml Wed Feb  2 22:21:05 2011
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+                        "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<module name="Checker">
+    <module name="TreeWalker">
+        <module name="AvoidStarImport"/>
+        <module name="ConstantName"/>
+        <module name="DeclarationOrder"/>
+        <module name="EqualsHashCode"/>
+        <module name="FallThrough"/>
+        <module name="FinalLocalVariable"/>
+        <module name="FinalParameters"/>
+        <module name="Regexp">
+            <property name="format" value="[ \t]+$"/>
+            <property name="illegalPattern" value="true"/>
+            <property name="message" value="Trailing whitespace"/>
+        </module>
+        <module name="Regexp">
+            <property name="format" value="System\.out\.println"/>
+            <property name="illegalPattern" value="true"/>
+            <property name="ignoreComments" value="true"/>
+        </module>
+        <module name="HiddenField">
+            <property name="ignoreConstructorParameter" value="true"/>
+            <property name="ignoreSetter" value="true"/>
+        </module>
+        <module name="HideUtilityClassConstructor"/>
+        <module name="IllegalCatch"/>
+        <module name="IllegalImport"/>
+        <module name="Indentation">
+            <property name="basicOffset" value="4"/>
+            <property name="caseIndent" value="0"/>
+        </module>
+        <module name="JavadocMethod">
+            <property name="allowUndeclaredRTE" value="true"/>
+            <property name="allowMissingPropertyJavadoc" value="true"/>
+        </module>
+        <module name="JavadocStyle"/>
+        <module name="JavadocType">
+            <property name="versionFormat" value="\$Revision.*\$ \$Date.*\$"/>
+        </module>
+        <module name="JavadocVariable"/>
+        <module name="MissingSwitchDefault"/>
+        <module name="ModifierOrder"/>
+        <module name="MultipleStringLiterals">
+            <property name="ignoreStringsRegexp" value='^(("")|("."))$'/>
+        </module>
+        <module name="MultipleVariableDeclarations"/>
+        <module name="NoWhitespaceAfter"/>
+        <module name="NoWhitespaceBefore"/>
+        <module name="OperatorWrap">
+            <property name="option" value="eol"/>
+        </module>
+        <module name="RedundantModifier"/>
+        <module name="StringLiteralEquality"/>
+        <module name="TodoComment"/>
+        <module name="UnnecessaryParentheses"/>
+        <module name="UnusedImports"/>
+        <module name="VisibilityModifier"/>
+        <module name="WhitespaceAfter"/>
+        <module name="WhitespaceAround">
+            <property name="tokens"
+                      value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN,
+                             BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT,
+                             LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
+                             LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
+                             LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT,
+                             MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS,
+                             PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
+                             SR_ASSIGN, STAR, STAR_ASSIGN"/>
+        </module>
+        <module name="FileContentsHolder"/>
+    </module>
+    <module name="Header">
+      <property name="headerFile" value="license-header.txt" />
+      <property name="fileExtensions" value="java"/>
+    </module>
+    <module name="FileTabCharacter"/>
+    <module name="NewlineAtEndOfFile"/>
+    <module name="SuppressionCommentFilter">
+        <property name="offCommentFormat" value="CHECKSTYLE\: stop JavadocVariable check"/>
+        <property name="onCommentFormat"  value="CHECKSTYLE\: resume JavadocVariable check"/>
+        <property name="checkFormat"      value="JavadocVariable"/>
+    </module>
+    <module name="SuppressionCommentFilter">
+        <property name="offCommentFormat" value="CHECKSTYLE\: stop VisibilityModifierCheck"/>
+        <property name="onCommentFormat"  value="CHECKSTYLE\: resume VisibilityModifierCheck"/>
+        <property name="checkFormat"      value="VisibilityModifierCheck"/>
+    </module>
+</module>

Propchange: commons/sandbox/bsp/trunk/checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/checkstyle.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/license-header.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/license-header.txt?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/license-header.txt (added)
+++ commons/sandbox/bsp/trunk/license-header.txt Wed Feb  2 22:21:05 2011
@@ -0,0 +1,16 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */

Propchange: commons/sandbox/bsp/trunk/license-header.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/license-header.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/pom.xml?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/pom.xml (added)
+++ commons/sandbox/bsp/trunk/pom.xml Wed Feb  2 22:21:05 2011
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-sandbox-parent</artifactId>
+        <version>9</version>
+    </parent>
+
+    <artifactId>commons-bsp</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>Commons BSP (Sandbox)</name>
+    <inceptionYear>2011</inceptionYear>
+    <description>
+        The BSP project provides a general-purpose implementation of BSP trees suitable
+        for geometry modeling in low dimensions, either in Euclidean space or on unit sphere
+        topologies.
+    </description>
+
+    <url>http://commons.apache.org/sandbox/bsp/</url>
+
+    <scm>
+        <connection>
+            scm:svn:http://svn.apache.org/repos/asf/commons/sandbox/bsp/trunk/
+        </connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/commons/sandbox/bsp/trunk/
+        </developerConnection>
+        <url>
+            http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/
+        </url>
+    </scm>
+
+    <distributionManagement>
+        <site>
+            <id>people.apache.org</id>
+            <name>Commons BSP</name>
+            <url>
+                ${commons.deployment.protocol}://people.apache.org/www/commons.apache.org/sandbox/bsp
+            </url>
+        </site>
+    </distributionManagement>
+
+    <developers>
+        <developer>
+            <name>Luc Maisonobe</name>
+            <id>luc</id>
+            <email>luc at apache dot org</email>
+        </developer>
+        <developer>
+            <name>Simone Tripodi</name>
+            <id>simonetripodi</id>
+            <email>simonetripodi at apache dot org</email>
+        </developer>
+    </developers>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-math</artifactId>
+            <version>2.2-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${basedir}/src/main/resources</directory>
+            </resource>
+            <resource>
+                <directory>${basedir}</directory>
+                <targetPath>META-INF</targetPath>
+                <includes>
+                    <include>NOTICE.txt</include>
+                    <include>LICENSE.txt</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <version>2.5</version>
+                <configuration>
+                    <linkXref>true</linkXref>
+                    <targetJdk>1.5</targetJdk>
+                </configuration>
+             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <version>2.4</version>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <version>2.3.1</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <version>2.6</version>
+                <configuration>
+                    <configLocation>${basedir}/checkstyle.xml</configLocation>
+                    <enableRulesSummary>false</enableRulesSummary>
+                    <headerFile>${basedir}/license-header.txt</headerFile>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-changes-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <xmlPath>
+                        ${basedir}/src/site/xdoc/changes.xml
+                    </xmlPath>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>changes-report</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+ 
+    <properties>
+        <maven.compile.source>1.5</maven.compile.source>
+        <maven.compile.target>1.5</maven.compile.target>
+        <commons.componentid>bsp</commons.componentid>
+        <commons.jira.componentid>00000000</commons.jira.componentid>
+    </properties>
+
+</project>

Propchange: commons/sandbox/bsp/trunk/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java (added)
+++ commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java Wed Feb  2 22:21:05 2011
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.bsp;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+
+import org.apache.commons.math.exception.util.Localizable;
+
+/** This class is the base class for all specific exceptions thrown by
+ * the Apache Commons BSP classes.
+
+ * <p>When the Apache Commons BSP classes throw exceptions that are
+ * specific to the package, these exceptions are always subclasses of
+ * BSPException. When exceptions that are already covered by the
+ * standard java API should be thrown, like
+ * ArrayIndexOutOfBoundsException or IllegalArgumentException, these
+ * standard exceptions are thrown rather than the BSP specific ones.</p>
+
+ * @version $Revision$ $Date$
+
+ */
+
+public class BSPException extends RuntimeException {
+
+    /** Serializable UID. */
+    private static final long serialVersionUID = -1660751706613867577L;
+
+    /** Format specifier (to be translated). */
+    private final Localizable specifier;
+
+    /** Parts to insert in the format (no translation). */
+    private final Object[] parts;
+
+    /** Simple constructor.
+     * Build an exception with a translated and formatted message
+     * @param specifier format specifier (to be translated)
+     * @param parts parts to insert in the format (no translation)
+     */
+    public BSPException(final Localizable specifier, final Object ... parts) {
+        this.specifier   = specifier;
+        this.parts = (parts == null) ? new Object[0] : parts.clone();
+    }
+
+    /** Copy constructor.
+     * @param exception exception to copy from
+     * @since 5.1
+     */
+    public BSPException(final BSPException exception) {
+        super(exception);
+        this.specifier = exception.specifier;
+        this.parts = exception.parts.clone();
+    }
+
+    /** Simple constructor.
+     * Build an exception from a cause and with a specified message
+     * @param message descriptive message
+     * @param cause underlying cause
+     */
+    public BSPException(final Localizable message, final Throwable cause) {
+        super(cause);
+        this.specifier = message;
+        this.parts = new Object[0];
+    }
+
+    /** Simple constructor.
+     * Build an exception from a cause and with a translated and formatted message
+     * @param cause underlying cause
+     * @param specifier format specifier (to be translated)
+     * @param parts parts to insert in the format (no translation)
+     */
+    public BSPException(final Throwable cause, final Localizable specifier,
+                           final Object ... parts) {
+        super(cause);
+        this.specifier = specifier;
+        this.parts = (parts == null) ? new Object[0] : parts.clone();
+    }
+
+    /** Gets the message in a specified locale.
+     * @param locale Locale in which the message should be translated
+     * @return localized message
+     */
+    public String getMessage(final Locale locale) {
+        return buildMessage(locale, specifier, parts);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getMessage() {
+        return getMessage(Locale.US);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getLocalizedMessage() {
+        return getMessage(Locale.getDefault());
+    }
+
+    /** Get the localizable specifier of the error message.
+     * @return localizable specifier of the error message
+     */
+    public Localizable getSpecifier() {
+        return specifier;
+    }
+
+    /** Get the variable parts of the error message.
+     * @return a copy of the variable parts of the error message
+     */
+    public Object[] getParts() {
+        return parts.clone();
+    }
+
+    /**
+     * Builds a message string by from a pattern and its arguments.
+     * @param locale Locale in which the message should be translated
+     * @param specifier format specifier (to be translated)
+     * @param parts parts to insert in the format (no translation)
+     * @return a message string
+     */
+    private static String buildMessage(final Locale locale, final Localizable specifier,
+                                       final Object ... parts) {
+        return (specifier == null) ? "" : new MessageFormat(specifier.getLocalizedString(locale), locale).format(parts);
+    }
+
+}

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java (added)
+++ commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java Wed Feb  2 22:21:05 2011
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.bsp;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.commons.math.exception.util.Localizable;
+
+/**
+ * Enumeration for localized messages formats.
+ * <p>
+ * The constants in this enumeration represent the available
+ * formats as localized strings. These formats are intended to be
+ * localized using simple properties files, using the constant
+ * name as the key and the property value as the message format.
+ * The source English format is provided in the constants themselves
+ * to serve both as a reminder for developers to understand the parameters
+ * needed by each format, as a basis for translators to create
+ * localized properties files, and as a default format if some
+ * translation is missing.
+ * </p>
+ * @version $Revision$ $Date$
+ */
+public enum BSPMessages implements Localizable {
+
+    // CHECKSTYLE: stop JavadocVariable check
+
+    NOT_SUPPORTED_IN_DIMENSION_N("method not supported in dimension {0}"),
+    OUTLINE_BOUNDARY_LOOP_OPEN("an outline boundary loop is open"),
+    CROSSING_BOUNDARY_LOOPS("some outline boundary loops cross each other"),
+    NON_INVERTIBLE_TRANSFORM("non-invertible affine transform collapses some lines into single points");
+
+    // CHECKSTYLE: resume JavadocVariable check
+
+    /** Base name of the resource bundle in classpath. */
+    private static final String RESOURCE_BASE_NAME = "META-INF/localization/BSPMessages";
+
+    /** Source English format. */
+    private final String sourceFormat;
+
+    /** Simple constructor.
+     * @param sourceFormat source English format to use when no
+     * localized version is available
+     */
+    private BSPMessages(final String sourceFormat) {
+        this.sourceFormat = sourceFormat;
+    }
+
+    /** {@inheritDoc} */
+    public String getSourceString() {
+        return sourceFormat;
+    }
+
+    /** {@inheritDoc} */
+    public String getLocalizedString(final Locale locale) {
+        try {
+            final ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BASE_NAME, locale);
+            if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
+                final String translated = bundle.getString(name());
+                if ((translated != null) &&
+                    (translated.length() > 0) &&
+                    (!translated.toLowerCase().contains("missing translation"))) {
+                    // the value of the resource is the translated format
+                    return translated;
+                }
+            }
+
+            return sourceFormat;
+
+        } catch (MissingResourceException mre) {
+            return sourceFormat;
+        }
+    }
+
+}

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/BSPMessages.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java (added)
+++ commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java Wed Feb  2 22:21:05 2011
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.bsp.euclidean.oneD;
+
+
+/** This class represents a 1D interval.
+ * @see IntervalsSet
+ * @version $Revision$ $Date$
+ */
+public class Interval {
+
+    /** The lower bound of the interval. */
+    private final double lower;
+
+    /** The upper bound of the interval. */
+    private final double upper;
+
+    /** Simple constructor.
+     * @param lower lower bound of the interval
+     * @param upper upper bound of the interval
+     */
+    public Interval(final double lower, final double upper) {
+        this.lower = lower;
+        this.upper = upper;
+    }
+
+    /** Get the lower bound of the interval.
+     * @return lower bound of the interval
+     */
+    public double getLower() {
+        return lower;
+    }
+
+    /** Get the upper bound of the interval.
+     * @return upper bound of the interval
+     */
+    public double getUpper() {
+        return upper;
+    }
+
+    /** Get the length of the interval.
+     * @return length of the interval
+     */
+    public double getLength() {
+        return upper - lower;
+    }
+
+    /** Get the midpoint of the interval.
+     * @return midpoint of the interval
+     */
+    public double getMidPoint() {
+        return 0.5 * (lower + upper);
+    }
+
+}

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Interval.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java (added)
+++ commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java Wed Feb  2 22:21:05 2011
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.bsp.euclidean.oneD;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.bsp.partitioning.BSPTree;
+import org.apache.commons.bsp.partitioning.Region;
+import org.apache.commons.bsp.partitioning.SubHyperplane;
+
+/** This class represents a 1D region: a set of intervals.
+ * @version $Revision$ $Date$
+ */
+public class IntervalsSet extends Region {
+
+    /** Build an intervals set representing the whole real line.
+     */
+    public IntervalsSet() {
+        super();
+    }
+
+    /** Build an intervals set corresponding to a single interval.
+     * @param lower lower bound of the interval, must be lesser or equal
+     * to {@code upper} (may be {@code Double.NEGATIVE_INFINITY})
+     * @param upper upper bound of the interval, must be greater or equal
+     * to {@code lower} (may be {@code Double.POSITIVE_INFINITY})
+     */
+    public IntervalsSet(final double lower, final double upper) {
+        super(buildTree(lower, upper));
+    }
+
+    /** Build an intervals set from an inside/outside BSP tree.
+     * <p>The leaf nodes of the BSP tree <em>must</em> have a
+     * {@code Boolean} attribute representing the inside status of
+     * the corresponding cell (true for inside cells, false for outside
+     * cells). In order to avoid building too many small objects, it is
+     * recommended to use the predefined constants
+     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
+     * @param tree inside/outside BSP tree representing the intervals set
+     */
+    public IntervalsSet(final BSPTree tree) {
+        super(tree);
+    }
+
+    /** Build an intervals set from a Boundary REPresentation (B-rep).
+     * <p>The boundary is provided as a collection of {@link
+     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
+     * interior part of the region on its minus side and the exterior on
+     * its plus side.</p>
+     * <p>The boundary elements can be in any order, and can form
+     * several non-connected sets (like for example polygons with holes
+     * or a set of disjoints polyhedrons considered as a whole). In
+     * fact, the elements do not even need to be connected together
+     * (their topological connections are not used here). However, if the
+     * boundary does not really separate an inside open from an outside
+     * open (open having here its topological meaning), then subsequent
+     * calls to the {@link
+     * Region#checkPoint(org.apache.commons.bsp.partitioning.Point)
+     * checkPoint} method will not be meaningful anymore.</p>
+     * <p>If the boundary is empty, the region will represent the whole
+     * space.</p>
+     * @param boundary collection of boundary elements
+     */
+    public IntervalsSet(final Collection<SubHyperplane> boundary) {
+        super(boundary);
+    }
+
+    /** Build an inside/outside tree representing a single interval.
+     * @param lower lower bound of the interval, must be lesser or equal
+     * to {@code upper} (may be {@code Double.NEGATIVE_INFINITY})
+     * @param upper upper bound of the interval, must be greater or equal
+     * to {@code lower} (may be {@code Double.POSITIVE_INFINITY})
+     * @return the built tree
+     */
+    private static BSPTree buildTree(final double lower, final double upper) {
+        if (Double.isInfinite(lower) && (lower < 0)) {
+            if (Double.isInfinite(upper) && (upper > 0)) {
+                // the tree must cover the whole real line
+                return new BSPTree(Boolean.TRUE);
+            }
+            // the tree must be open on the negative infinity side
+            final SubHyperplane upperCut =
+                new SubHyperplane(new OrientedPoint(new Point1D(upper), true));
+            return new BSPTree(upperCut,
+                               new BSPTree(Boolean.FALSE),
+                               new BSPTree(Boolean.TRUE),
+                               null);
+        }
+        final SubHyperplane lowerCut =
+            new SubHyperplane(new OrientedPoint(new Point1D(lower), false));
+        if (Double.isInfinite(upper) && (upper > 0)) {
+            // the tree must be open on the positive infinity side
+            return new BSPTree(lowerCut,
+                               new BSPTree(Boolean.FALSE),
+                               new BSPTree(Boolean.TRUE),
+                               null);
+        }
+
+        // the tree must be bounded on the two sides
+        final SubHyperplane upperCut =
+            new SubHyperplane(new OrientedPoint(new Point1D(upper), true));
+        return new BSPTree(lowerCut,
+                           new BSPTree(Boolean.FALSE),
+                           new BSPTree(upperCut,
+                                       new BSPTree(Boolean.FALSE),
+                                       new BSPTree(Boolean.TRUE),
+                                       null),
+                                       null);
+
+    }
+
+    /** {@inheritDoc} */
+    public Region buildNew(final BSPTree tree) {
+        return new IntervalsSet(tree);
+    }
+
+    /** {@inheritDoc} */
+    protected void computeGeometricalProperties() {
+        if (getTree(false).getCut() == null) {
+            setBarycenter(Point1D.UNDEFINED);
+            setSize(((Boolean) getTree(false).getAttribute()) ? Double.POSITIVE_INFINITY : 0);
+        } else {
+            double size = 0.0;
+            double sum = 0.0;
+            for (final Interval interval : asList()) {
+                size += interval.getLength();
+                sum  += interval.getLength() * interval.getMidPoint();
+            }
+            setSize(size);
+            setBarycenter(Double.isInfinite(size) ? Point1D.UNDEFINED : new Point1D(sum / size));
+        }
+    }
+
+    /** Get the lowest value belonging to the instance.
+     * @return lowest value belonging to the instance
+     * ({@code Double.NEGATIVE_INFINITY} if the instance doesn't
+     * have any low bound, {@code Double.POSITIVE_INFINITY} if the
+     * instance is empty)
+     */
+    public double getInf() {
+        BSPTree node = getTree(false);
+        double  inf  = Double.POSITIVE_INFINITY;
+        while (node.getCut() != null) {
+            final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane();
+            inf  = op.getLocation().getAbscissa();
+            node = op.isDirect() ? node.getMinus() : node.getPlus();
+        }
+        return ((Boolean) node.getAttribute()) ? Double.NEGATIVE_INFINITY : inf;
+    }
+
+    /** Get the highest value belonging to the instance.
+     * @return highest value belonging to the instance
+     * ({@code Double.POSITIVE_INFINITY} if the instance doesn't
+     * have any high bound, {@code Double.NEGATIVE_INFINITY} if the
+     * instance is empty)
+     */
+    public double getSup() {
+        BSPTree node = getTree(false);
+        double  sup  = Double.NEGATIVE_INFINITY;
+        while (node.getCut() != null) {
+            final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane();
+            sup  = op.getLocation().getAbscissa();
+            node = op.isDirect() ? node.getPlus() : node.getMinus();
+        }
+        return ((Boolean) node.getAttribute()) ? Double.POSITIVE_INFINITY : sup;
+    }
+
+    /** Build an ordered list of intervals representing the instance.
+     * <p>This method builds this intervals set as an ordered list of
+     * {@link Interval Interval} elements. If the intervals set has no
+     * lower limit, the first interval will have its low bound equal to
+     * {@code Double.NEGATIVE_INFINITY}. If the intervals set has
+     * no upper limit, the last interval will have its upper bound equal
+     * to {@code Double.POSITIVE_INFINITY}. An empty tree will
+     * build an empty list while a tree representing the whole real line
+     * will build a one element list with both bounds beeing
+     * infinite.</p>
+     * @return a new ordered list containing {@link Interval Interval}
+     * elements
+     */
+    public List<Interval> asList() {
+        final List<Interval> list = new ArrayList<Interval>();
+        recurseList(getTree(false), list,
+                    Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
+        return list;
+    }
+
+    /** Update an intervals list.
+     * @param node current node
+     * @param list list to update
+     * @param lower lower bound of the current convex cell
+     * @param upper upper bound of the current convex cell
+     */
+    private void recurseList(final BSPTree node, final List<Interval> list,
+                             final double lower, final double upper) {
+
+        if (node.getCut() == null) {
+            if ((Boolean) node.getAttribute()) {
+                // this leaf cell is an inside cell: an interval
+                list.add(new Interval(lower, upper));
+            }
+        } else {
+            final OrientedPoint op  = (OrientedPoint) node.getCut().getHyperplane();
+            final Point1D       loc = op.getLocation();
+            double        x   = loc.getAbscissa();
+
+            // make sure we explore the tree in increasing order
+            final BSPTree low       = op.isDirect() ? node.getMinus() : node.getPlus();
+            final BSPTree high      = op.isDirect() ? node.getPlus()  : node.getMinus();
+
+            recurseList(low, list, lower, x);
+            if ((checkPoint(low,  loc) == Location.INSIDE) &&
+                (checkPoint(high, loc) == Location.INSIDE)) {
+                // merge the last interval added and the first one of the high sub-tree
+                x = ((Interval) list.remove(list.size() - 1)).getLower();
+            }
+            recurseList(high, list, x, upper);
+
+        }
+
+    }
+
+}

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/IntervalsSet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java (added)
+++ commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java Wed Feb  2 22:21:05 2011
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.bsp.euclidean.oneD;
+
+import org.apache.commons.bsp.BSPException;
+import org.apache.commons.bsp.BSPMessages;
+import org.apache.commons.bsp.partitioning.BSPTree;
+import org.apache.commons.bsp.partitioning.Hyperplane;
+import org.apache.commons.bsp.partitioning.Point;
+import org.apache.commons.bsp.partitioning.Region;
+import org.apache.commons.bsp.partitioning.SubHyperplane;
+import org.apache.commons.bsp.partitioning.SubSpace;
+
+/** This class represents a 1D oriented hyperplane.
+ * <p>An hyperplane in 1D is a simple point, its orientation being a
+ * boolean.</p>
+ * <p>Instances of this class are guaranteed to be immutable.</p>
+ * @version $Revision$ $Date$
+ */
+public class OrientedPoint implements Hyperplane {
+
+    /** Dummy region returned by the {@link #wholeHyperplane} method. */
+    private static final Region DUMMY_REGION = new DummyRegion();
+
+    /** Point location. */
+    private Point1D location;
+
+    /** Orientation. */
+    private boolean direct;
+
+    /** Simple constructor.
+     * @param location location of the hyperplane
+     * @param direct if true, the plus side of the hyperplane is towards
+     * abscissae greater than {@code location}
+     */
+    public OrientedPoint(final Point1D location, final boolean direct) {
+        this.location = location;
+        this.direct   = direct;
+    }
+
+    /** Copy the instance.
+     * <p>Since instances are immutable, this method directly returns
+     * the instance.</p>
+     * @return the instance itself
+     */
+    public Hyperplane copySelf() {
+        return this;
+    }
+
+    /** Get the offset (oriented distance) of a point to the hyperplane.
+     * @param point point to check
+     * @return offset of the point
+     */
+    public double getOffset(final Point point) {
+        final double delta = ((Point1D) point).getAbscissa() - location.getAbscissa();
+        return direct ? delta : -delta;
+    }
+
+    /** Transform a space point into a sub-space point.
+     * <p>Since this class represent zero dimension spaces which does
+     * not have lower dimension sub-spaces, this method cannot be
+     * supported here. It always throws a {@code RuntimeException}
+     * when called.</p>
+     * @param point n-dimension point of the space
+     * @return (n-1)-dimension point of the sub-space corresponding to
+     * the specified space point
+     * @see #toSpace
+     */
+    public Point toSubSpace(final Point point) {
+        throw new BSPException(BSPMessages.NOT_SUPPORTED_IN_DIMENSION_N, 1);
+    }
+
+    /** Transform a sub-space point into a space point.
+     * <p>Since this class represent zero dimension spaces which does
+     * not have lower dimension sub-spaces, this method cannot be
+     * supported here. It always throws a {@code RuntimeException}
+     * when called.</p>
+     * @param point (n-1)-dimension point of the sub-space
+     * @return n-dimension point of the space corresponding to the
+     * specified sub-space point
+     * @see #toSubSpace
+     */
+    public Point toSpace(final Point point) {
+        throw new BSPException(BSPMessages.NOT_SUPPORTED_IN_DIMENSION_N, 1);
+    }
+
+    /** Build the sub-space shared by the instance and another hyperplane.
+     * <p>Since this class represent zero dimension spaces which does
+     * not have lower dimension sub-spaces, this method cannot be
+     * supported here. It always throws a {@code RuntimeException}
+     * when called.</p>
+     * @param other other sub-space (must have the same dimension as the
+     * instance)
+     * @return a sub-space at the intersection of the instance and the
+     * other sub-space (it has a dimension one unit less than the
+     * instance)
+     */
+    public SubSpace intersection(final Hyperplane other) {
+        throw new BSPException(BSPMessages.NOT_SUPPORTED_IN_DIMENSION_N, 1);
+    }
+
+    /** Build a region covering the whole hyperplane.
+     * <p>Since this class represent zero dimension spaces which does
+     * not have lower dimension sub-spaces, this method returns a dummy
+     * implementation of a {@link Region Region} (always the same
+     * instance). This implementation is only used to allow the {@link
+     * SubHyperplane SubHyperplane} class implementation to work
+     * properly, it should <em>not</em> be used otherwise.</p>
+     * @return a dummy region
+     */
+    public Region wholeHyperplane() {
+        return DUMMY_REGION;
+    }
+
+    /** Build a region covering the whole space.
+     * @return a region containing the instance (really an {@link
+     * IntervalsSet IntervalsSet} instance)
+     */
+    public Region wholeSpace() {
+        return new IntervalsSet();
+    }
+
+    /** Check if the instance has the same orientation as another hyperplane.
+     * <p>This method is expected to be called on parallel hyperplanes
+     * (i.e. when the {@link #side side} method would return {@link
+     * org.apache.commons.bsp.partitioning.Hyperplane.Side#HYPER}
+     * for some sub-hyperplane having the specified hyperplane
+     * as its underlying hyperplane). The method should <em>not</em>
+     * re-check for parallelism, only for orientation, typically by
+     * testing something like the sign of the dot-products of
+     * normals.</p>
+     * @param other other hyperplane to check against the instance
+     * @return true if the instance and the other hyperplane have
+     * the same orientation
+     */
+    public boolean sameOrientationAs(final Hyperplane other) {
+        return !(direct ^ ((OrientedPoint) other).direct);
+    }
+
+    /** Compute the relative position of a sub-hyperplane with respect
+     * to the instance.
+     * @param sub sub-hyperplane to check
+     * @return one of {@link org.apache.commons.bsp.partitioning.Hyperplane.Side#PLUS PLUS},
+     * {@link org.apache.commons.bsp.partitioning.Hyperplane.Side#MINUS MINUS}
+     * or {@link org.apache.commons.bsp.partitioning.Hyperplane.Side#HYPER HYPER}
+     * (in dimension 1, this method <em>never</em> returns {@link
+     * org.apache.commons.bsp.partitioning.Hyperplane.Side#BOTH BOTH})
+     *
+     */
+    public Side side(final SubHyperplane sub) {
+        final double global = getOffset(((OrientedPoint) sub.getHyperplane()).location);
+        return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
+    }
+
+    /** Split a sub-hyperplane in two parts by the instance.
+     * @param sub sub-hyperplane to split
+     * @return an object containing both the part of the sub-hyperplane
+     * on the plus side of the instance and the part of the
+     * sub-hyperplane on the minus side of the instance
+     */
+    public SplitSubHyperplane split(final SubHyperplane sub) {
+        final double global = getOffset(((OrientedPoint) sub.getHyperplane()).location);
+        return (global < -1.0e-10) ? new SplitSubHyperplane(null, sub) : new SplitSubHyperplane(sub, null);
+    }
+
+    /** Get the hyperplane location on the real line.
+     * @return the hyperplane location
+     */
+    public Point1D getLocation() {
+        return location;
+    }
+
+    /** Check if the hyperplane orientation is direct.
+     * @return true if the plus side of the hyperplane is towards
+     * abscissae greater than hyperplane location
+     */
+    public boolean isDirect() {
+        return direct;
+    }
+
+    /** Revert the instance.
+     */
+    public void revertSelf() {
+        direct = !direct;
+    }
+
+    /** Dummy region representing the whole set of reals. */
+    private static class DummyRegion extends Region {
+
+        /** Simple constructor.
+         */
+        public DummyRegion() {
+            super();
+        }
+
+        /** {@inheritDoc} */
+        public Region buildNew(final BSPTree tree) {
+            return this;
+        }
+
+        /** {@inheritDoc} */
+        protected void computeGeometricalProperties() {
+            setSize(0);
+            setBarycenter(Point1D.ZERO);
+        }
+    }
+
+}

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/OrientedPoint.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java
URL: http://svn.apache.org/viewvc/commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java?rev=1066664&view=auto
==============================================================================
--- commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java (added)
+++ commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java Wed Feb  2 22:21:05 2011
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.bsp.euclidean.oneD;
+
+import org.apache.commons.bsp.partitioning.Point;
+
+/** This class represents a 1D point.
+ * <p>Instances of this class are guaranteed to be immutable.</p>
+ * @version $Revision$ $Date$
+ */
+public class Point1D implements Point {
+
+    /** Point at 0.0 abscissa. */
+    public static final Point1D ZERO = new Point1D(0.0);
+
+    /** Point at 1.0 abscissa. */
+    public static final Point1D ONE = new Point1D(1.0);
+
+    /** Point at undefined (NaN) abscissa. */
+    public static final Point1D UNDEFINED = new Point1D(Double.NaN);
+
+    /** Abscissa of the point. */
+    private double x;
+
+    /** Simple constructor.
+     * @param x abscissa of the point
+     */
+    public Point1D(final double x) {
+        this.x = x;
+    }
+
+    /** Get the abscissa of the point.
+     * @return abscissa of the point
+     */
+    public double getAbscissa() {
+        return x;
+    }
+
+}

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/bsp/trunk/src/main/java/org/apache/commons/bsp/euclidean/oneD/Point1D.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message