CPAMetrics (クラス)
public abstract CPAMetrics {inherits {Association-of CPAMetricID, double}, CPAQueryMatch}
パッケージ: CURL.IDE.CPA.METRICS
直接継承しているサブクラス: CPAMetricsWithChildren, CPABindingMetrics

A collection of metrics results associated with a given element.


コンストラクタ
clone-from:Constructs a clone of another metrics object.
コンストラクタ public {CPAMetrics.clone-from other:{this-class}}
default:Construct a new metrics object.
コンストラクタ protected {CPAMetrics.default}
default:Construct metrics for given target.
ファクトリ public {CPAMetrics.default
profile:CPAMetricsProfile,
target:CPAMetricsTarget,
create-children?:bool = false,
...:CPAMetric
}:{this-class}
without-target:Construct metrics for given target type, name and URL.
ファクトリ public inline {CPAMetrics.without-target
profile:CPAMetricsProfile,
target-type:CPAMetricsTargetType,
full-name:String,
binding-kind:CPABindingKind = no-metric-kind,
url:#Url = null,
...:CPAMetric
}:{this-class}

プロパティ
binding:The binding of the target, if any.
アクセサ public abstract CPAMetrics.binding:#CPABinding
binding-kind:Type of binding, if applicable
アクセサ public CPAMetrics.binding-kind:CPABindingKind
binding?:Indicates whether target is a non-class binding.
アクセサ public CPAMetrics.binding?:bool
can-have-children?:Indicates whether object is capable of containing child metrics.
アクセサ public abstract CPAMetrics.can-have-children?:bool
class:The class containing the target, if any.
アクセサ public abstract CPAMetrics.class:#CPASourceClassEnvBinding
class?:Indicates whether target type is class.
アクセサ public CPAMetrics.class?:bool
efficient-size:selfefficient-size を取得または設定します。
アクセサ public CPAMetrics.efficient-size:int
セッター public CPAMetrics.efficient-size:int
file:The file containing the target, if any.
アクセサ public abstract CPAMetrics.file:#CPABaseFile
file?:Indicates whether target type is file.
アクセサ public CPAMetrics.file?:bool
full-name:Long name for target
アクセサ public CPAMetrics.full-name:String
function?:Indicate whether target is a binding for a function.
アクセサ public inline CPAMetrics.function?:bool
incoming-dependencies:Table of external targets depending on this target, if known.
アクセサ public CPAMetrics.incoming-dependencies:#CPAMetricsTargetMappings
library:The library containing the target.
アクセサ public abstract CPAMetrics.library:#CPABaseSourceLibrary
library?:Indicates whether target type is a library.
アクセサ public CPAMetrics.library?:bool
match-type:Describes the type of match.
アクセサ public final CPAMetrics.match-type:CPAQueryMatchType
n-children:The number of child CPAMetrics contained by this object.
アクセサ public abstract CPAMetrics.n-children:int
name:Short name for target
アクセサ public CPAMetrics.name:String
optionable:Option holder for target.
アクセサ public abstract CPAMetrics.optionable:#CPAOptionable
outgoing-dependencies:Table of dependencies from target to external targets, if known.
アクセサ public CPAMetrics.outgoing-dependencies:#CPAMetricsTargetMappings
package:The package containing the target, if any.
アクセサ public abstract CPAMetrics.package:#CPABaseSourcePackage
package?:Indicates whether target type is a package.
アクセサ public CPAMetrics.package?:bool
profile:Profile of metrics that may be set in this object.
フィールド public constant CPAMetrics.profile:CPAMetricsProfile
size:コレクションの要素数を返します。
アクセサ public CPAMetrics.size:int
target:The target for which the metrics were measured.
アクセサ public abstract CPAMetrics.target:CPAMetricsTarget
target-type:Identifies the type of the target of the metrics.
アクセサ public abstract CPAMetrics.target-type:CPAMetricsTargetType
url:URL associated with target, if known
アクセサ public CPAMetrics.url:#Url
プロパティ 継承 Association-of: empty?, key-type
プロパティ 継承 Aggregate-of: element-type

メソッド
add-from-children:Computes sum of a metric from all children.
public {CPAMetrics.add-from-children id:CPAMetricID}:double
add-incoming-dependency:Adds dependency from external to internal target.
public {CPAMetrics.add-incoming-dependency}:void
add-outgoing-dependency:Adds dependency from external to internal target.
public {CPAMetrics.add-outgoing-dependency}:void
clear:Removes all metrics
public {CPAMetrics.clear}:void
clear-children:Removes all child metrics.
public abstract {CPAMetrics.clear-children}:void
clone:コレクションのクローンを返します。
public abstract {CPAMetrics.clone}:{this-class}
computing?:Indicate if value is in the process of being computed.
public {CPAMetrics.computing? id:CPAMetricID}:bool
create-metrics-for-subtarget:Creates submetrics for given target.
public final {CPAMetrics.create-metrics-for-subtarget
subtarget:CPAMetricsTarget,
create-children?:bool = false
}:#CPAMetrics
filter:フィルタ操作内で要素を使って要素自体をフィルタリングします。
public {CPAMetrics.filter keep?:{proc-type {val:double}:bool}}:void
filter-keys:フィルタ操作でキーを使って要素をフィルタリングします。
public {CPAMetrics.filter-keys
keep?:{proc-type {id:CPAMetricID}:bool}
}:void
get:Get value of metric with given id.
public {CPAMetrics.get id:CPAMetricID}:double
get-by-name:Gets value of metric with given name.
public {CPAMetrics.get-by-name name:String}:double
get-child-for-subtarget:Return the child target attribute for a subtarget.
protected abstract {CPAMetrics.get-child-for-subtarget
subtarget:CPAMetricsTarget
}:CPAMetricsTarget
get-child-metrics-iterator:Returns iterator over child CPAMetrics contained by this object.
public abstract {CPAMetrics.get-child-metrics-iterator
}:#CPAMetricsIterator
get-if-exists:Get value of metric with given id, if it exists.
public {CPAMetrics.get-if-exists}:(value:double, found?:bool)
get-metrics:Returns an iterator over metrics values.
public {CPAMetrics.get-metrics}:CPAMetricIterator
get-metrics-for-child:Return child CPAMetrics associated with target.
public abstract {CPAMetrics.get-metrics-for-child
child-target:CPAMetricsTarget
}:#CPAMetrics
get-metrics-for-child-name:Return child CPAMetrics with given name.
public abstract {CPAMetrics.get-metrics-for-child-name
name:String,
binding-kind:CPABindingKind = CPABindingKind.expanded
}:#CPAMetrics
get-metrics-for-subtarget:Returns CPAMetrics associated with sub-target.
public final {CPAMetrics.get-metrics-for-subtarget}:#CPAMetrics
get-metrics-for-subtarget-attributes:Returns CPAMetrics associated with sub-target with given attributes.
public {CPAMetrics.get-metrics-for-subtarget-attributes
full-name:String,
target-type:CPAMetricsTargetType,
binding-kind:CPABindingKind = no-metric-kind,
url:#Url = null
}:#CPAMetrics
get-or-compute-by-name:Gets value of metric with given name, computing if necessary.
public {CPAMetrics.get-or-compute-by-name
name:String,
state:#CPACompilerState,
root:CPAMetrics = self
}:double
key-exists?:キーが存在するかどうかを調べます。
public {CPAMetrics.key-exists? id:CPAMetricID}:bool
keys-to-Iterator:コレクションの各キーを含む Iterator-of を返します。
public {CPAMetrics.keys-to-Iterator}:{Iterator-of CPAMetricID}
release-child-metrics-iterator:Releases iterator for reuse.
public abstract {CPAMetrics.release-child-metrics-iterator}:void
remove:要素を削除します。
public {CPAMetrics.remove
id:CPAMetricID,
length:int = 1,
error-if-missing?:bool = false
}:void
set:Sets given metric value.
public {CPAMetrics.set id:CPAMetricID, value:double}:void
set-metrics-for-child:Set value of metrics for a child of the target.
public abstract {CPAMetrics.set-metrics-for-child
metrics:CPAMetrics
}:void
to-Iterator:コレクションの各要素を含む Iterator-of を返します。
public {CPAMetrics.to-Iterator}:{Iterator-of double}
visit-all:Invoke function on all metrics in tree rooted at this object.
public {CPAMetrics.visit-all func:{proc-type {CPAMetrics}:bool}}:bool
メソッド 継承 Association-of: filter-clone, filter-keys-clone, get-key, get-key-if-exists
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
clone-from (コンストラクタ)
public {CPAMetrics.clone-from other:{this-class}}

Constructs a clone of another metrics object.



default (コンストラクタ)
protected {CPAMetrics.default}

Construct a new metrics object.

説明

This asserts that profile is frozen.


default (ファクトリ)
public {CPAMetrics.default
profile:CPAMetricsProfile,
target:CPAMetricsTarget,
create-children?:bool = false,
...:CPAMetric
}:{this-class}

Construct metrics for given target.

説明

If create-children? is true, then CPAMetrics objects will be created for all of the children of the target (and so on recursively).

This asserts that profile is frozen.


without-target (ファクトリ)
public inline {CPAMetrics.without-target
profile:CPAMetricsProfile,
target-type:CPAMetricsTargetType,
full-name:String,
binding-kind:CPABindingKind = no-metric-kind,
url:#Url = null,
...:CPAMetric
}:{this-class}

Construct metrics for given target type, name and URL.

説明

See CPATargetlessMetrics.default.



プロパティ詳細
binding (アクセサ)
アクセサ public abstract CPAMetrics.binding:#CPABinding

The binding of the target, if any.

説明

See CPAMetricsTarget.binding.


binding-kind (アクセサ)
アクセサ public CPAMetrics.binding-kind:CPABindingKind

Type of binding, if applicable

説明

If binding is non-null, this is its binding-kind, otherwise its value is not meaningful (it will be the value specified by the constant no-metric-kind).


binding? (アクセサ)
アクセサ public CPAMetrics.binding?:bool

Indicates whether target is a non-class binding.

説明

True if target-type is binding.


can-have-children? (アクセサ)
アクセサ public abstract CPAMetrics.can-have-children?:bool

Indicates whether object is capable of containing child metrics.



class (アクセサ)
アクセサ public abstract CPAMetrics.class:#CPASourceClassEnvBinding

The class containing the target, if any.

説明

See CPAMetricsTarget.class.


class? (アクセサ)
アクセサ public CPAMetrics.class?:bool

Indicates whether target type is class.

説明

True if target-type is class.


efficient-size (アクセサ)
アクセサ public CPAMetrics.efficient-size:int
セッター public CPAMetrics.efficient-size:int

selfefficient-size を取得または設定します。

説明

コレクションに設定される efficient-size は、コレクションを拡張可能なサイズで、なお 効率的に機能するサイズです。このアクセッサは実装ごとに定義されますが、一般に下位のデータ構造のサイズを反映します。割り当てサイズを超えて拡張する場合、下位のデータ構造を新しく割り当て、古いデータ構造からデータをコピーする必要があります。ただし、この処理は 効率的でない と見なされます。
requested-size: requested-size は、コレクション型およびコレクションの中に格納されたタイプが与えられると、システムによって評価され、また変更される場合もあります。ゲッターから獲得した際、結果の efficient-size は、requested-size 以上の値になります。

注意事項

Association-of で定義された既定の実装では、セッターは無視され、ゲッターは max-int を返します。


file (アクセサ)
アクセサ public abstract CPAMetrics.file:#CPABaseFile

The file containing the target, if any.

説明

See CPAMetricsTarget.file.


file? (アクセサ)
アクセサ public CPAMetrics.file?:bool

Indicates whether target type is file.

説明

True if target-type is file.


full-name (アクセサ)
アクセサ public CPAMetrics.full-name:String

Long name for target

説明

By default this simply returns the full-name of the target.


function? (アクセサ)
アクセサ public inline CPAMetrics.function?:bool

Indicate whether target is a binding for a function.

説明

True if target is a CPABinding for any kind of procedural/functional definition including macros.


incoming-dependencies (アクセサ)
アクセサ public CPAMetrics.incoming-dependencies:#CPAMetricsTargetMappings

Table of external targets depending on this target, if known.

説明

If computed, this will hold a mapping of dependencies from external elements to internal elements within the target.

Also see outgoing-dependencies.


library (アクセサ)
アクセサ public abstract CPAMetrics.library:#CPABaseSourceLibrary

The library containing the target.

説明

See CPAMetricsTarget.library.


library? (アクセサ)
アクセサ public CPAMetrics.library?:bool

Indicates whether target type is a library.

説明

True if target-type is library.


match-type (アクセサ)
アクセサ public final CPAMetrics.match-type:CPAQueryMatchType

Describes the type of match.

説明

See CPAQueryMatch.


n-children (アクセサ)
アクセサ public abstract CPAMetrics.n-children:int

The number of child CPAMetrics contained by this object.

説明

Returns the number of child CPAMetric objects that will be returned by the get-child-metrics-iterator method.


name (アクセサ)
アクセサ public CPAMetrics.name:String

Short name for target

説明

By default this simply returns the name of the target.


optionable (アクセサ)
アクセサ public abstract CPAMetrics.optionable:#CPAOptionable

Option holder for target.

説明

The CPAOptionable object with the smallest scope containing target. This will be non-null if target-type is not none.


outgoing-dependencies (アクセサ)
アクセサ public CPAMetrics.outgoing-dependencies:#CPAMetricsTargetMappings

Table of dependencies from target to external targets, if known.

説明

If computed, this will hold a mapping of dependencies from internal elements within the target to external elements.

Also see incoming-dependencies.


package (アクセサ)
アクセサ public abstract CPAMetrics.package:#CPABaseSourcePackage

The package containing the target, if any.

説明

See CPAMetricsTarget.package.


package? (アクセサ)
アクセサ public CPAMetrics.package?:bool

Indicates whether target type is a package.

説明

True if target-type is package.


profile (フィールド)
public constant CPAMetrics.profile:CPAMetricsProfile

Profile of metrics that may be set in this object.



size (アクセサ)
アクセサ public CPAMetrics.size:int

コレクションの要素数を返します。

戻り値

self の要素数を示すint


{value
    || Declare and initialize a hash table with
    || String keys and int elements.
    let price:{HashTable-of String, int} =
        {new {HashTable-of String, int},
             "apple", 56,
             "banana", 87,
             "cherry", 34
        }

    || Display a message indicating the size of
    || the hash table.
    {text There are {value price.size} elements in
        the hash table.}
}

注意事項

これは Association-of の抽象メソッドで、Association-of のサブクラス内で実装されます。


target (アクセサ)
アクセサ public abstract CPAMetrics.target:CPAMetricsTarget

The target for which the metrics were measured.



target-type (アクセサ)
アクセサ public abstract CPAMetrics.target-type:CPAMetricsTargetType

Identifies the type of the target of the metrics.

説明

Identifies the type of the target. See CPAMetricsTargetType.


url (アクセサ)
アクセサ public CPAMetrics.url:#Url

URL associated with target, if known

説明

By default, this simply returns the url of the target.





メソッド詳細
add-from-children (メソッド)
public {CPAMetrics.add-from-children id:CPAMetricID}:double

Computes sum of a metric from all children.

説明

Returns the sum of the metric specified by id across all child metrics of this object.

Returns zero if there are no children. Returns nan if all children metrics produce nan, otherwise nan values in children will be ignored.


add-incoming-dependency (メソッド)
public {CPAMetrics.add-incoming-dependency}:void

Adds dependency from external to internal target.

説明

Adds a dependency from external target to internal target, which will appear in the incoming-dependencies table.

It is expected that internal will be contained in target and external will not.

This also will update the value of the afferent-coupling metric.

Also see add-outgoing-dependency.


add-outgoing-dependency (メソッド)
public {CPAMetrics.add-outgoing-dependency}:void

Adds dependency from external to internal target.

説明

Adds a dependency from internal target to external target, which will appear in the outgoing-dependencies table.

It is expected that internal will be contained in target and external will not.

This also will update the value of the efferent-coupling metric.

Also see add-outgoing-dependency.


clear (メソッド)
public {CPAMetrics.clear}:void

Removes all metrics

説明

Note that this does not remove any child CPAMetrics nor does it remove values from children.


clear-children (メソッド)
public abstract {CPAMetrics.clear-children}:void

Removes all child metrics.

説明

After invoking this n-children will be zero.


clone (メソッド)
public abstract {CPAMetrics.clone}:{this-class}

コレクションのクローンを返します。

戻り値

Aggregate-of のサブクラスのインスタンス。オブジェクトは、self と同じデータ型およびデータを持ちます。

説明

クローンは、self と同じデータ型を持つ新しいオブジェクトです。クローンには、self の要素の簡易コピー(shallow copy) が含まれます。つまり、どちらかのコレクションの要素に新しいオブジェクトを代入すると、もう一方の一致した要素は元のオブジェクトを参照します。ただし、要素のオブジェクトを変更すると、両方のコレクションは変更したオブジェクトを参照します。


{value
    || Declare and initialize set-1 (the original set).
    let set-1:{Set-of String} =
        {new {Set-of String}, "apple", "banana", "cherry"}

    || Initialize set-2 with a clone of the contents of
    || set-1.
    let set-2:{Set-of String} = {set-1.clone}

    || Use a VBox to display the contents of set-2.
    || Iterate over the contents of set-2, adding them
    || to the VBox.  Then display the VBox.
    let message:VBox = {VBox}
    {for each-element:String in set-2 do
        {message.add each-element}
    }
    message
}

注意事項

これは Aggregate-of の抽象メソッドで、Aggregate-of のサブクラス内で実装されます。

注意事項

クローンの詳細については、『Curl 開発者ガイド』の「コレクション」で、使用しているコレクションのクローンに関するセクションを参照してください。


computing? (メソッド)
public {CPAMetrics.computing? id:CPAMetricID}:bool

Indicate if value is in the process of being computed.

説明

This is needed to detect and prevent recursive computation.


create-metrics-for-subtarget (メソッド)
public final {CPAMetrics.create-metrics-for-subtarget
subtarget:CPAMetricsTarget,
create-children?:bool = false
}:#CPAMetrics

Creates submetrics for given target.

subtarget: must be a subtarget contaied by metric's target.
create-children?: indicates whether all children of metrics for target should be created implicitly. This is ignored if metrics for target did not need to be created.

説明

Returns CPAMetrics object for subtarget within this metrics object, creating it if necessary. If submetrics had already been created for subtarget, calling this should return the same value as get-metrics-for-subtarget.

Returns null if subtarget is null? or is not contained by target.


filter (メソッド)
public {CPAMetrics.filter keep?:{proc-type {val:double}:bool}}:void

フィルタ操作内で要素を使って要素自体をフィルタリングします。

p: 要素をフィルタリングするプロシージャ。このメソッドは、self の各要素に対して p を呼び出します。プロシージャには、self の要素と同じデータ型を持つ 1 つの引数を指定する必要があります。プロシージャは、このメソッドが要素をフィルタリングするかどうかを示す bool 値を返す必要があります。pfalse を返す場合、このメソッドは self からその要素をフィルタリング (削除) します。ptrue を返す場合、要素は、self 内に残ります。

戻り値

このメソッドは値を返しません。

説明

p への呼び出しが false を返すコレクションの要素を削除します。

次の例では、ハッシュ テーブルから要素をフィルタリングします。


{value
    || Declare and initialize a hash table with
    || int keys and String elements.
    let my-table:{HashTable-of int, String} =
        {new {HashTable-of int, String},
             162094, "tom",
             439853, "dick",
             098627, "harry"
        }

    || Filter elements that begin with the
    || letter 'd'.
    {my-table.filter
        {proc {str:String}:bool
            {return str[0] != 'd'}
        }
    }

    || Use a VBox to display the contents of my-table.
    || Add each element to the VBox and then display it.
    let message:VBox = {VBox}
    {for each-element:String in my-table do
        {message.add each-element}
    }
    message

    || Note that the order of the elements in a hash
    || table is arbitrary.
}


filter-keys (メソッド)
public {CPAMetrics.filter-keys
keep?:{proc-type {id:CPAMetricID}:bool}
}:void

フィルタ操作でキーを使って要素をフィルタリングします。

p: 要素をフィルタリングするプロシージャ。このメソッドは、self の各キーに対して p を呼び出します。プロシージャには、self のキーと同じデータ型を持つ 1 つの引数を指定する必要があります。プロシージャは、関連付けられた要素をこのメソッドがフィルタリングするかどうかを示す bool 値を返す必要があります。pfalse を返す場合、このメソッドは self からその要素をフィルタリング (削除) します。ptrue を返す場合、要素は、self 内に残ります。

説明

関連付けられたキーを持つ p への呼び出しが false を返す self の要素を削除します。


{value
    || Declare and initialize a hash table with
    || String keys and int elements.
    let quantity:{HashTable-of String, int} =
        {new {HashTable-of String, int},
             "apple", 3,
             "banana", 0,
             "cherry", 8
        }

    || Filter elements whose keys begin with 'a'.
    {quantity.filter-keys
        {proc {str:String}:bool
            {return str[0] != 'a'}
        }
    }

    || Use a VBox to display the contents of quantity.
    || For each key in quantity, add the key to the VBox.
    || Then display the VBox.
    let message:VBox = {VBox}
    {for key each-element:String in quantity do
        {message.add each-element}
    }
    message

    || Note that the order of the elements in a hash
    || table is arbitrary.
}


get (メソッド)
public {CPAMetrics.get id:CPAMetricID}:double

Get value of metric with given id.

説明

If there is no such metric, this will return a metric with the value nan (instead of throwing an exception).


get-by-name (メソッド)
public {CPAMetrics.get-by-name name:String}:double

Gets value of metric with given name.

説明

If there is no such metric, this will return a metric with the value nan (instead of throwing an exception).


get-child-for-subtarget (メソッド)
protected abstract {CPAMetrics.get-child-for-subtarget
subtarget:CPAMetricsTarget
}:CPAMetricsTarget

Return the child target attribute for a subtarget.

説明

This should return the attribute of subtarget that could be a child of this object's target.

For instance, if this object contains metrics for a package, then its children will be for the package's files, and this method should then return the file attribute of subtarget.

This should return null? target if subtarget is not contained by target.


get-child-metrics-iterator (メソッド)
public abstract {CPAMetrics.get-child-metrics-iterator
}:#CPAMetricsIterator

Returns iterator over child CPAMetrics contained by this object.

説明

The n-children attribute indicates how many children will be visited by this returned iterator. May return null if n-children is zero.

The iterator should be released for reuse when no longer needed by using release-child-metrics-iterator.


get-if-exists (メソッド)
public {CPAMetrics.get-if-exists}:(value:double, found?:bool)

Get value of metric with given id, if it exists.

説明

Returns the value for the given id and true if it exists, otherwise returns nan and false.


get-metrics (メソッド)
public {CPAMetrics.get-metrics}:CPAMetricIterator

Returns an iterator over metrics values.

説明

Returns an iterator of CPAMetric containing the metrics values associated with target. This does not include values associated with child targets (see get-child-metrics-iterator for that).


get-metrics-for-child (メソッド)
public abstract {CPAMetrics.get-metrics-for-child
child-target:CPAMetricsTarget
}:#CPAMetrics

Return child CPAMetrics associated with target.

説明

Returns the CPAMetrics child object contained by this object whose target is child-target.

Also see get-metrics-for-subtarget and get-metrics-for-child-name.


get-metrics-for-child-name (メソッド)
public abstract {CPAMetrics.get-metrics-for-child-name
name:String,
binding-kind:CPABindingKind = CPABindingKind.expanded
}:#CPAMetrics

Return child CPAMetrics with given name.

説明

Returns the CPAMetrics child object contained by this object whose name is name.

Also see get-metrics-for-child.


get-metrics-for-subtarget (メソッド)
public final {CPAMetrics.get-metrics-for-subtarget}:#CPAMetrics

Returns CPAMetrics associated with sub-target.

説明

Returns the CPAMetrics object contained directly or indirectly by this object whose target is target.

This is a more general version of get-metrics-for-child, which can be used to search for metrics anywhere in the tree of metrics rooted at this object.

Returns null if no match is found.


get-metrics-for-subtarget-attributes (メソッド)
public {CPAMetrics.get-metrics-for-subtarget-attributes
full-name:String,
target-type:CPAMetricsTargetType,
binding-kind:CPABindingKind = no-metric-kind,
url:#Url = null
}:#CPAMetrics

Returns CPAMetrics associated with sub-target with given attributes.

説明

Returns the CPAMetrics object contained directly or indirectly by this object whose full-name, target-type, url, and binding-kind attributes match the specified parameter values (where default keyword values will match anything).

Returns null if no match is found.

注意事項

The current implementation simply does a linear search over the entire tree. A smarter implementation should be able to parse the full-name to walk the tree.


get-or-compute-by-name (メソッド)
public {CPAMetrics.get-or-compute-by-name
name:String,
state:#CPACompilerState,
root:CPAMetrics = self
}:double

Gets value of metric with given name, computing if necessary.



key-exists? (メソッド)
public {CPAMetrics.key-exists? id:CPAMetricID}:bool

キーが存在するかどうかを調べます。

key: 調べるキーの値。値は、self のキーと同じデータ型を持つ必要があります。

戻り値

bool 値。値が self のキーである場合、このメソッドは true を返します。それ以外の場合は、false を返します。


{value
    || Declare and initialize a hash table with
    || String keys and int elements.
    let price:{HashTable-of String, int} =
        {new {HashTable-of String, int},
             "apple", 56,
             "banana", 87,
             "cherry", 34
        }

    || Check if there is an element with the
    || key "banana" in the collection "price".
    {if {price.key-exists? "banana"} then
        {text It is there!}
     else
        {text It is not there.}
    }
}


keys-to-Iterator (メソッド)
public {CPAMetrics.keys-to-Iterator}:{Iterator-of CPAMetricID}

コレクションの各キーを含む Iterator-of を返します。

戻り値

self の要素と同じパラメータ化データ型を持つ Iterator-of。つまり、self{Association-of int, String} の場合、このメソッドは {Iterator-of int} を返します。

説明

Iterator-of のキーの順序は、任意に指定できます (Association-of のインスタンスが、順序付けられたコレクションでない場合もあるからです)。


{value
    || Declare and initialize a hash table with
    || int keys and String elements.
    let my-table:{HashTable-of int, String} =
        {new {HashTable-of int, String},
             162094, "tom",
             439853, "dick",
             098627, "harry"
        }

    || Create an Iterator-of from the set.
    let my-iterator:{Iterator-of int} =
        {my-table.keys-to-Iterator}

    || Use a VBox to display the contents of my-iterator.
    || Iterate over the contents of my-iterator, adding
    || them to the VBox.  Then display the VBox.
    let message:VBox = {VBox}
    {for each-element:int in my-iterator do
        {message.add each-element}
    }
    message

    || Note that the order of the elements in a hash
    || table is arbitrary.
}

注意事項

for コンテナ ループを使って同じ結果を得ることもできます。ただし、この反復処理メカニズムをオーバーライドすると、予期外の結果が生じる可能性があるので、可能な限り for ループを使用してください。

注意事項

これは Association-of の抽象メソッドで、Association-of のサブクラス内で実装されます。


release-child-metrics-iterator (メソッド)
public abstract {CPAMetrics.release-child-metrics-iterator}:void

Releases iterator for reuse.

説明

Releases the iterator, which must have previously been returned by a call to get-child-metrics-iterator on the same object, so that it may be reused. The caller must not use the iterator after passing it to this method.


remove (メソッド)
public {CPAMetrics.remove
id:CPAMetricID,
length:int = 1,
error-if-missing?:bool = false
}:void

要素を削除します。

key: 削除する要素のキーの値。この値は、self のキーと同じデータ型を持つ必要があります。
length: このパラメータを指定するとエラーになります。

length コレクションから削除する連続する要素の数を示す int。ただし、このメソッドでは、ハッシュ テーブルは順序付けられたコレクションではないので、このパラメータには意味がありません。このパラメータは、順序付けられたコレクションを実装する Sequence-of のサブクラスにのみ適用されます。

このメソッドでは、length は既定値の 1 に設定されています。
error-if-missing?: ユーザーが存在しない要素を削除しようとしたときにこのメソッドがエラーを生成するかどうかを示すブール値のフラグ。error-if-missing?true に設定した場合、存在しない要素を削除しようとするとエラーがスローされます。エラーが発生するとプログラムの実行が停止し、エラー メッセージが表示されます。既定では、error-if-missing?true です。error-if-missing?false の場合、このメソッドはエラーを生成しません。error-if-missing? キーワード引数。error-if-missing?を指定するには、メソッド呼び出し内のキーワードに必要な値 (例:error-if-missing?=false) を指定します。

説明

{self.key-exists? key}true を返す場合、このメソッドは self から適切なキーおよび要素を削除します。

{self.key-exists? key}false で、 error-if-missing?true の場合、このメソッドはエラーをスローします。ただし、 error-if-missing?false の場合、このメソッドは何のアクションも実行しません。


{value
    || Declare and initialize a hash table with
    || String keys and int elements.
    let price:{HashTable-of String, int} =
        {new {HashTable-of String, int},
             "apple", 56,
             "banana", 87,
             "cherry", 34
        }

    || Remove the element at key "banana".
    {price.remove "banana"}

    || Use a VBox to display the contents of price.
    || For each key in price, add a string to the VBox.
    || The string contains the relevant key and element.
    || Then display the VBox.
    let message:VBox = {VBox}
    {for key each-element:String in price do
        {message.add each-element & " " & {price.get each-element}}
    }
    message

    || Note that the order of the elements in a hash
    || table is arbitrary.
}

注意事項

これは Association-of の抽象メソッドで、Association-of のサブクラス内で実装されます。


set (メソッド)
public {CPAMetrics.set id:CPAMetricID, value:double}:void

Sets given metric value.

説明

Sets value of metric identified by id to value.

IMPORTANT: this will have no effect if id does not refer to a definition in get-definitions-for-target for the target-type in the profile.


set-metrics-for-child (メソッド)
public abstract {CPAMetrics.set-metrics-for-child
metrics:CPAMetrics
}:void

Set value of metrics for a child of the target.

説明

The target of the metrics must be a child of this object's target.


to-Iterator (メソッド)
public {CPAMetrics.to-Iterator}:{Iterator-of double}

コレクションの各要素を含む Iterator-of を返します。

戻り値

self 内の要素と同じパラメータ化データ型を持つ Iterator-of。つまり、self{Aggregate-of int} の場合、このメソッドは {Iterator-of int} を返します。

説明

Iterator-of の要素の順序は、コレクション型に依存します。配列などの順序付けられたコレクションの場合、このメソッドはその順序を保存します。ハッシュ テーブルやセットなどの順序づけられていないコレクションの場合、要素の順序は任意に指定できます。


{value
    || Create a new set.
    let my-set:{Set-of String} =
        {new {Set-of String}, "apple", "banana", "cherry"}

    || Create an Iterator-of from the set.
    let my-iterator:{Iterator-of String} = {my-set.to-Iterator}

    || Use a VBox to display the contents of my-iterator.
    || Iterate over the contents of my-iterator, adding
    || them to the VBox.  Then display the VBox.
    let message:VBox = {VBox}
    {for each-element:String in my-iterator do
        {message.add each-element}
    }
    message
}

注意事項

for コンテナ ループを使って同じ結果を得ることもできます。ただし、この反復処理メカニズムをオーバーライドすると、予期外の結果が生じる可能性があるので、可能な限り for ループを使用してください。

注意事項

これは Aggregate-of の抽象メソッドで、Aggregate-of のサブクラス内で実装されます。


visit-all (メソッド)
public {CPAMetrics.visit-all func:{proc-type {CPAMetrics}:bool}}:bool

Invoke function on all metrics in tree rooted at this object.

説明

Invokes the function func on the tree of CPAMetrics objects rooted at this object until func returns false.

Returns true if all metrics were visited (i.e. func never returned false)