HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/fm-agent/dependencies/linux/python3.9/jpype/__pycache__/_jarray.cpython-39.pyc
a

��i/�@s�ddlZddlmZdgZGdd�dejdd�ZGdd	�d	e�Zd
d�ZGdd
�d
e�Z	e�
d�e�
d�Gdd�de���Ze�ej
e�ee_dS)�N�)�_jcustomizer�JArrayc@s(eZdZdZddd�Zed	dd��ZdS)
ra� Creates a Java array class for a Java type of a given dimension.

    This serves as a base type and factory for all Java array classes.
    The resulting Java array class can be used to construct a new
    array with a given size or specified members.

    JPype arrays support Python operators for iterating, length, equals, 
    not equals, subscripting, and slicing. They also support Java
    object methods, clone, and length property. Java arrays may not
    be resized, and as such elements cannot be added nor deleted. Currently,
    applying the slice operator produces a new Python sequence.

    Example:
        .. code-block:: python

          # Define a new array class for ``int[]``
          IntArrayCls = JArray(JInt)

          # Create an array holding 10 elements
          #   equivalent to Java ``int[] x=new int[10]``
          x = IntArrayCls(10)

          # Create a length 3 array initialized with [1,2,3]
          #   equivalent to Java ``int[] x = new int[]{1,2,3};``
          x = IntArrayCls([1,2,3])

          # Operate on an array
          print(len(x))
          print(x[0])
          print(x[:-2])
          x[1:]=(5,6)

          if isinstance(x, JArray):
               print("object is a java array")

          if issubclass(IntArrayCls, JArray):
               print("class is a java array type.")

    Args:
      javaClass (str,type): Is the type of element to hold in
        the array.
      ndims (Optional,int): the number of dimensions of the array
        (default=1)

    Returns:
      A new Python class that representing a Java array class.

    Raises:
      TypeError: if the component class is invalid or could not be found.

    Note:
      javaClass can be specified in three ways:

        - as a string with the name of a java class.
        - as a Java primitive type such as ``jpype.JInt``.
        - as a Java class type such as ``java.lang.String``.


    rcCs$|tkrtd��t|�}t�||�S)Nz$Arrays factory can't be used as type)r�	TypeError�_toJavaClass�_jpype�
_newArrayType)�cls�tpZdims�jc�r�?/usr/lib/fm-agent/dependencies/linux/python3.9/jpype/_jarray.py�__new__UszJArray.__new__NcCst�||�S�N)r�arrayFromBuffer)r	�arrayZdtyperrr
�of[sz	JArray.of)r)N)�__name__�
__module__�__qualname__�__doc__r�classmethodrrrrr
rs;
T)�internalc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_JArrayProtocCstt|��Sr)�str�list��selfrrr
�__str__bsz_JArrayProto.__str__cCst|�Sr)�_JavaArrayIterrrrr
�__iter__esz_JArrayProto.__iter__ccs|ddd�D]
}|VqdS�N���r)r�elemrrr
�__reversed__hsz_JArrayProto.__reversed__cCst�d��|t|��S)af Clone the Java array.

        Create a "shallow" copy of a Java array. For a
        single dimensional array of primitives, the cloned array is
        complete independent copy of the original. For objects or
        multidimensional arrays, the new array is a copy which points
        to the same members as the original.

        To obtain a deep copy of a Java array, use Java serialize and
        deserialize operations to duplicate the entire array and
        contents. In order to deep copy, the objects must be
        Serializable.

        Returns:
            A shallow copy of the array.
        zjava.util.Arrays)r�JClassZcopyOf�lenrrrr
�clonelsz_JArrayProto.cloneN)rrrrr r$r'rrrr
r`srcCsvt|t�rtj�|�St|tj�r&|Sztj|jWStyFYn0z|jWSt	ybYn0t
d|j��dS)a0(internal) Converts a class type in python into a internal java class.

    Used mainly to support JArray.

    The type argument will operate on:
     - (str) lookup by class name or fail if not found.
     - (JClass) just returns the java type.
     - (type) uses a lookup table to find the class.
    zUnable to find class for '%s'N)�
isinstancerr�_java_lang_Class�forName�_JClass�
_type_classes�class_�KeyError�AttributeErrorrr)r
rrr
r�s
rc@s(eZdZdd�Zdd�Zdd�ZeZdS)rcCs||_d|_dSr!)�_array�_ndx)r�arrr
�__init__�sz_JavaArrayIter.__init__cCs|Srrrrrr
r �sz_JavaArrayIter.__iter__cCs.|jd7_|jt|j�kr"t�|j|jS)Nr)r1r&r0�
StopIterationrrrr
�__next__�sz_JavaArrayIter.__next__N)rrrr3r r5�nextrrrr
r�srzbyte[]zchar[]c@s$eZdZdd�Zdd�ZejjZdS)�_JCharArraycCstt�|��Sr)rr�JStringrrrr
r�sz_JCharArray.__str__cCsBt|t�rt|�|kSz|�|�|��WSty<YdS0dS)NF)r(r�equals�	__class__r)r�otherrrr
�__eq__�s
z_JCharArray.__eq__N)rrrrr<r�_JObject�__hash__rrrr
r7�sr7)r�r�__all__r=r�objectrrr�JImplementationForr7�_applyCustomizerPost�_JArrayrrrr
�<module>sG (