(クラス)
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 inline | {CPAMetrics.without-target}:{this-class} |
binding: | The binding of the target, if any. |
アクセサ public abstract CPAMetrics.binding:#
CPABinding
binding?: | Indicates whether target is a non-class binding. |
アクセサ public CPAMetrics.binding?:
bool
アクセサ public abstract CPAMetrics.can-have-children?:
bool
class: | The class containing the target, if any. |
class?: | Indicates whether target type is class. |
アクセサ public CPAMetrics.class?:
bool
アクセサ public CPAMetrics.efficient-size:
int セッター public CPAMetrics.efficient-size:
int
file: | The file containing the target, if any. |
file?: | Indicates whether target type is file. |
アクセサ public CPAMetrics.file?:
bool
アクセサ public CPAMetrics.full-name:
String
function?: | Indicate whether target is a binding for a function. |
アクセサ public inline CPAMetrics.function?:
bool
library: | The library containing the target. |
library?: | Indicates whether target type is a library. |
アクセサ public CPAMetrics.library?:
bool
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
package: | The package containing the target, if any. |
package?: | Indicates whether target type is a package. |
アクセサ public CPAMetrics.package?:
bool
profile: | Profile of metrics that may be set in this object. |
アクセサ public CPAMetrics.size:
int
target: | The target for which the metrics were measured. |
target-type: | Identifies the type of the target of the metrics. |
url: | URL associated with target, if known |
アクセサ public CPAMetrics.url:#
Url
public | {CPAMetrics.add-incoming-dependency}:void |
public | {CPAMetrics.add-outgoing-dependency}:void |
clear: | Removes all metrics |
public | {CPAMetrics.clear}:void |
public abstract | {CPAMetrics.clear-children}:void |
computing?: | Indicate if value is in the process of being computed. |
public final | {CPAMetrics.create-metrics-for-subtarget}:#CPAMetrics |
filter: | フィルタ操作内で要素を使って要素自体をフィルタリングします。 |
public | {CPAMetrics.filter-keys}:void |
get: | Get value of metric with given id. |
public | {CPAMetrics.get-if-exists}:(value:double, found?:bool) |
public abstract | {CPAMetrics.get-metrics-for-child}:#CPAMetrics |
public abstract | {CPAMetrics.get-metrics-for-child-name}:#CPAMetrics |
public final | {CPAMetrics.get-metrics-for-subtarget}:#CPAMetrics |
public | {CPAMetrics.get-metrics-for-subtarget-attributes}:#CPAMetrics |
public | {CPAMetrics.get-or-compute-by-name}:double |
public | {CPAMetrics.keys-to-Iterator}:{Iterator-of CPAMetricID} |
public abstract | {CPAMetrics.release-child-metrics-iterator}:void |
public | {CPAMetrics.remove}:void |
set: | Sets given metric value. |
public abstract | {CPAMetrics.set-metrics-for-child}:void |
visit-all: | Invoke function on all metrics in tree rooted at this object. |
(コンストラクタ)
Constructs a clone of another metrics object.
(コンストラクタ)
protected | {CPAMetrics.default} |
Construct a new metrics object.
説明
This asserts that
profile is
frozen.
(ファクトリ)
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.
(ファクトリ)
public inline | {CPAMetrics.without-target}:{this-class} |
Construct metrics for given target type, name and URL.
説明
(アクセサ)
アクセサ public abstract CPAMetrics.binding:#
CPABinding The binding of the target, if any.
説明
(アクセサ)
Type of binding, if applicable
説明
(アクセサ)
アクセサ public CPAMetrics.binding?:
bool Indicates whether target is a non-class binding.
説明
(アクセサ)
アクセサ public abstract CPAMetrics.can-have-children?:
bool Indicates whether object is capable of containing child metrics.
(アクセサ)
The class containing the target, if any.
説明
(アクセサ)
アクセサ public CPAMetrics.class?:
bool Indicates whether target type is class.
説明
(アクセサ)
アクセサ public CPAMetrics.efficient-size:
int セッター public CPAMetrics.efficient-size:
int self の efficient-size を取得または設定します。
説明
コレクションに設定される efficient-size は、コレクションを拡張可能なサイズで、なお 効率的に
機能するサイズです。このアクセッサは実装ごとに定義されますが、一般に下位のデータ構造のサイズを反映します。割り当てサイズを超えて拡張する場合、下位のデータ構造を新しく割り当て、古いデータ構造からデータをコピーする必要があります。ただし、この処理は 効率的でない
と見なされます。
requested-size: requested-size は、コレクション型およびコレクションの中に格納されたタイプが与えられると、システムによって評価され、また変更される場合もあります。ゲッターから獲得した際、結果の efficient-size は、requested-size 以上の値になります。
注意事項
Association-of で定義された既定の実装では、セッターは無視され、ゲッターは max-int を返します。
(アクセサ)
The file containing the target, if any.
説明
(アクセサ)
アクセサ public CPAMetrics.file?:
bool Indicates whether target type is file.
説明
(アクセサ)
アクセサ public CPAMetrics.full-name:
String
(アクセサ)
アクセサ 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.
(アクセサ)
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.
(アクセサ)
The library containing the target.
説明
(アクセサ)
アクセサ public CPAMetrics.library?:
bool Indicates whether target type is a library.
説明
(アクセサ)
Describes the type of match.
説明
(アクセサ)
アクセサ public abstract CPAMetrics.n-children:
int The number of child CPAMetrics contained by this object.
説明
(アクセサ)
アクセサ public CPAMetrics.name:
String Short name for target
説明
By default this simply returns the
name of the
target.
(アクセサ)
Option holder for target.
説明
(アクセサ)
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.
(アクセサ)
The package containing the target, if any.
説明
(アクセサ)
アクセサ public CPAMetrics.package?:
bool Indicates whether target type is a package.
説明
(フィールド)
Profile of metrics that may be set in this object.
(アクセサ)
アクセサ 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.}
}
| |
注意事項
(アクセサ)
The target for which the metrics were measured.
(アクセサ)
Identifies the type of the target of the metrics.
説明
(アクセサ)
アクセサ public CPAMetrics.url:#
Url URL associated with target, if known
説明
By default, this simply returns the
url of the
target.
(メソッド)
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.
(メソッド)
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.
(メソッド)
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.
(メソッド)
public | {CPAMetrics.clear}:void |
Removes all metrics
説明
Note that this does not remove any child
CPAMetrics nor does it remove values from children.
(メソッド)
public abstract | {CPAMetrics.clear-children}:void |
Removes all child metrics.
説明
(メソッド)
コレクションのクローンを返します。
戻り値
説明
クローンは、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
}
| |
注意事項
注意事項
クローンの詳細については、『Curl 開発者ガイド』の「
コレクション」で、使用しているコレクションのクローンに関するセクションを参照してください。
(メソッド)
Indicate if value is in the process of being computed.
説明
This is needed to detect and prevent recursive computation.
(メソッド)
public final | {CPAMetrics.create-metrics-for-subtarget}:#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.
(メソッド)
フィルタ操作内で要素を使って要素自体をフィルタリングします。
p: 要素をフィルタリングするプロシージャ。このメソッドは、self の各要素に対して p を呼び出します。プロシージャには、self の要素と同じデータ型を持つ 1 つの引数を指定する必要があります。プロシージャは、このメソッドが要素をフィルタリングするかどうかを示す bool 値を返す必要があります。p が false を返す場合、このメソッドは self からその要素をフィルタリング (削除) します。p が true を返す場合、要素は、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.
}
| |
(メソッド)
public | {CPAMetrics.filter-keys}:void |
フィルタ操作でキーを使って要素をフィルタリングします。
p: 要素をフィルタリングするプロシージャ。このメソッドは、self の各キーに対して p を呼び出します。プロシージャには、self のキーと同じデータ型を持つ 1 つの引数を指定する必要があります。プロシージャは、関連付けられた要素をこのメソッドがフィルタリングするかどうかを示す bool 値を返す必要があります。p が false を返す場合、このメソッドは self からその要素をフィルタリング (削除) します。p が true を返す場合、要素は、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 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).
(メソッド)
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).
(メソッド)
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.
(メソッド)
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.
(メソッド)
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.
(メソッド)
Returns an iterator over metrics values.
説明
(メソッド)
public abstract | {CPAMetrics.get-metrics-for-child}:#CPAMetrics |
Return child CPAMetrics associated with target.
説明
(メソッド)
public abstract | {CPAMetrics.get-metrics-for-child-name}:#CPAMetrics |
Return child CPAMetrics with given name.
説明
(メソッド)
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.
(メソッド)
public | {CPAMetrics.get-metrics-for-subtarget-attributes}:#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.
(メソッド)
public | {CPAMetrics.get-or-compute-by-name}:double |
Gets value of metric with given name, computing if necessary.
(メソッド)
キーが存在するかどうかを調べます。
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.}
}
}
| |
(メソッド)
public | {CPAMetrics.keys-to-Iterator}:{Iterator-of CPAMetricID} |
コレクションの各キーを含む Iterator-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 ループを使用してください。
注意事項
(メソッド)
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.
(メソッド)
public | {CPAMetrics.remove}: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 のサブクラス内で実装されます。
(メソッド)
Sets given metric value.
説明
(メソッド)
public abstract | {CPAMetrics.set-metrics-for-child}: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.
(メソッド)
コレクションの各要素を含む Iterator-of を返します。
戻り値
説明
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 ループを使用してください。
注意事項
(メソッド)
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)