Sindbad~EG File Manager
3
x?ag" � @ sX d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd� de�ZG dd � d e�Zd
S )z�
LabeledValue - A sampled statistic with a label. Used for formatting stats
output.
$Id: //eng/vdo-releases/aluminum/src/python/vdo/statistics/LabeledValue.py#2 $
� )�absolute_import)�division)�print_function)�unicode_literalsc @ sN e Zd ZdZedd� �Zdd� Zdd� Zdd � Zd
d� Z dd
� Z
ddd�ZdS )�LabeledValuezl
An object which represents a labeled statistic value or a labeled collection
of other LabeledValues.
c C s t |t�rt| |�S t| |�S )a
Create a new labeled value.
:param label: The label
:param value: The value
:return: The new labeled value. If the supplied value is a list, the
returned object will be a LabeledValueList, otherwise it
will be a LabeledValue.
)�
isinstance�list�LabeledValueListr )�label�value� r �"/usr/lib/python3.6/LabeledValue.py�make% s
zLabeledValue.makec C s || _ || _dS )z^
Create a new labeled value.
:param label: The label
:param value: The value
N)r
r )�selfr
r r r r
�__init__5 s zLabeledValue.__init__c C s dS )zt
Check whether this is a collection or a single value.
:return: True if this is a collection of values
Fr )r r r r
�
isMultiValued? s zLabeledValue.isMultiValuedc C s
t | j�S )zY
Get the width of the label for this value.
:return: The width of the label
)�lenr
)r r r r
�widthG s zLabeledValue.widthc C s | j � S )aX
Get the maximum width of the labels of this value and/or all of
its sub-values.
:param hierarchical: Whether the format mode is hierarchical or not
:return: The width of this value or its immediate sub-values if
hierarchical, otherwise, the width of this value or its full tree
of sub-values.
)r )r �hierarchicalr r r
�subWidthO s zLabeledValue.subWidthc C s dS )z�
Check whether this value has a subvalue for the given index.
:param index: The index into the subvalue list to check
:return: True if the indexed subvalue exists
Fr )r �indexr r r
�hasSubValue\ s zLabeledValue.hasSubValueNc C s"