B
    âêõb±  ã               @   sX   d Z ddlmZmZ dZdZG dd„ deƒZedkrTddl	Z	ddl
Z
e	 e
je ¡ dS )	a!  
Module simtk.unit.basedimension

BaseDimension class for use by units and quantities.
BaseDimensions are things like "length" and "mass".

This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.

Portions copyright (c) 2012 Stanford University and the Authors.
Authors: Christopher M. Bruns
Contributors: Peter Eastman

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
é    )Úprint_functionÚdivisionzChristopher M. Brunsz0.6c            	   @   sZ   e Zd ZdZdddddddd	d
œZdZdd„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dd„ ZdS )ÚBaseDimensionz
    A physical dimension such as length, mass, or temperature.

    It is unlikely the user will need to create new ones.
    é   é   é   é   é   é   é   é   )ZmassÚlengthZtimeZtemperatureZamountZchargezluminous intensityZangleé	   c             C   s@   || _ | j tj ¡ kr0tjtj|< t jd7  _tj| | _dS )zßCreate a new BaseDimension.

        Each new BaseDimension is assumed to be independent of all other BaseDimensions.
        Use the existing BaseDimensions in simtk.dimension instead of creating
        new ones.
        r   N)Únamer   Ú_index_by_nameÚkeysÚ_next_unused_indexÚ_index)Úselfr   © r   ú8lib/python3.7/site-packages/parmed/unit/basedimension.pyÚ__init__<   s
    zBaseDimension.__init__c             C   s   | j |j k S )a4  
        The implicit order of BaseDimensions is the order in which they were created.
        This method is used for using BaseDimensions as hash keys, and also affects
        the order in which units appear in multi-dimensional Quantities.

        Returns True if self < other, False otherwise.
        )r   )r   Úotherr   r   r   Ú__lt__I   s    zBaseDimension.__lt__c             C   s   | j S )z?
        Needed for using BaseDimensions as hash keys.
        )r   )r   r   r   r   Ú__hash__S   s    zBaseDimension.__hash__c             C   s
   d| j  S )NzBaseDimension("%s"))r   )r   r   r   r   Ú__repr__Y   s    zBaseDimension.__repr__c             C   s   t |tƒr| j|jkS dS )NF)Ú
isinstancer   r   )r   r   r   r   r   Ú__eq__\   s    
zBaseDimension.__eq__c             C   s   t |tƒr| j|jkS dS )NF)r   r   r   )r   r   r   r   r   Ú__ne__a   s    
zBaseDimension.__ne__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r   r   r   r   )   s    
r   Ú__main__N)r"   Z
__future__r   r   Ú
__author__Ú__version__Úobjectr   r   ZdoctestÚsysZtestmodÚmodulesr   r   r   r   Ú<module>"   s   ?