Class: Interval

mapray.animation~ Interval

アニメーション時刻の区間を表現するクラスである。

このクラスのインスタンスはイミュータブルである。


new Interval(lower, upper [, l_open] [, u_open])

アニメーション時刻の区間

下限 lower と上限 upper の時刻区間を生成する。

端点である lower と upper が区間に含まれるかどうかは l_open と u_open により指定する。

 interval       | l_open  u_open
----------------+----------------
 [lower, upper] | false   false
 [lower, upper) | false   true
 (lower, upper] | true    false
 (lower, upper) | true    true
Parameters:
Name Type Argument Default Description
lower mapray.animation.Time

区間の下限時刻

upper mapray.animation.Time

区間の上限時刻

l_open boolean <optional>
false

lower が区間にが含まれるとき false, 含まれないとき true

u_open boolean <optional>
false

upper が区間にが含まれるとき false, 含まれないとき true

Source:

Members


<static, readonly> UNIVERSAL :mapray.animation.Interval

全時刻区間

Type:
Source:

<readonly> l_open :boolean

下限時刻は除外されるか?

Type:
  • boolean
Source:

<readonly> lower :mapray.animation.Time

下限時刻

Type:
Source:

<readonly> u_open :boolean

上限時刻は除外されるか?

Type:
  • boolean
Source:

<readonly> upper :mapray.animation.Time

上限時刻

Type:
Source:

Methods


getComplement()

補時刻区間を取得

全時刻区間 から this を差し引いた時刻集合を時刻区間の配列として返す。

0 から 2 個の時刻区間を含む配列を返す。配列の要素に空時刻区間は含まれない。

2 要素の配列 v が返されたとき、v[0] と v[1] の間に時刻が存在し、さらに v[0].precedes( v[1] ) は true となる。

Source:
Returns:

補時刻区間

Type
Array.<mapray.animation.Interval>

getDifference(rhs)

時刻区間の差を取得

this から rhs を差し引いた時刻集合 (this - rhs) を時刻区間の配列として返す。

0 から 2 個の時刻区間を含む配列を返す。配列の要素に空時刻区間は含まれない。

2 要素の配列 v が返されたとき、v[0] と v[1] の間に時刻が存在し、さらに v[0].precedes( v[1] ) は true となる。

Parameters:
Name Type Description
rhs mapray.animation.Interval

時刻区間

Source:
Returns:

時刻区間の差

Type
Array.<mapray.animation.Interval>

getFollowings()

後続時刻区間を取得

this のすべての時刻に対して、後の時刻となるすべての時刻を含む後続時刻区間を返す。

this が空時刻区間のときは全時刻区間を返し、this に表現可能な最後の時刻が含まれるときは空時刻区間を返す。

this.precedes( this.getFollowings() ) は常に true を返す。

Source:
Returns:

後続時刻区間

Type
mapray.animation.Interval

getIntersection(rhs)

共通時刻区間を取得

this と rhs の共通時刻区間 (this ∩ rhs) を返す。

this と rhs に共通の時刻が存在しなければ空時刻区間を返す。

Parameters:
Name Type Description
rhs mapray.animation.Interval

時刻区間

Source:
See:
Returns:

共通時刻区間

Type
mapray.animation.Interval

getPrecedings()

先行時刻区間を取得

this のすべての時刻に対して、先の時刻となるすべての時刻を含む先行時刻区間を返す。

this が空時刻区間のときは全時刻区間を返し、this に表現可能な最初の時刻が含まれるときは空時刻区間を返す。

this.getPrecedings().precedes( this ) は常に true を返す。

Source:
Returns:

先行時刻区間

Type
mapray.animation.Interval

getUnion(rhs)

合併時刻区間を取得

this と rhs を合併した時刻集合 (this ∪ rhs) を時刻区間の配列として返す。

0 から 2 個の時刻区間を含む配列を返す。配列の要素に空時刻区間は含まれない。

2 要素の配列 v が返されたとき、v[0] と v[1] の間に時刻が存在し、さらに v[0].precedes( v[1] ) は true となる。

Parameters:
Name Type Description
rhs mapray.animation.Interval

時刻区間

Source:
Returns:

合併時刻区間

Type
Array.<mapray.animation.Interval>

hasIntersection(rhs)

共通時刻区間は存在するか?

!this.getIntersection( rhs ).isEmpty() と同じである。

Parameters:
Name Type Description
rhs mapray.animation.Interval

時刻区間

Source:
See:
Returns:

共通時刻区間

Type
boolean

includes(rhs)

包含しているか?

rhs のすべての時刻が this に含まれるとき true, それ以外のときは false を返す。

rhs が空時刻区間のときは true を返す。

これは rhs ⊆ this と等価である。

Parameters:
Name Type Description
rhs mapray.animation.Interval

時刻区間

Source:
Returns:

this が rhs を包含しているとき true, それ以外のとき false

Type
boolean

includesTime(rhs)

時刻を包含しているか?

rhs の時刻が this に含まれるとき true, それ以外のときは false を返す。

このメソッドは this.includes( new Interval( rhs, rhs ) ) と同等である。

Parameters:
Name Type Description
rhs mapray.animation.Time

時刻

Source:
Returns:

this が rhs を包含しているとき true, それ以外のとき false

Type
boolean

isEmpty()

空時刻区間か?

this が空の時刻区間かどうかを返す。

空時刻区間の場合、区間内に 1 つも時刻が存在しない。

Source:
Returns:

空時刻区間のとき true, それ以外のとき false

Type
boolean

isProper()

通常時刻区間か?

this が通常の時刻区間かどうかを返す。

通常時刻区間の場合、区間内に無限個の時刻が存在する。

通常時刻区間であるなら lower < upper であり、逆も成り立つ。

Source:
Returns:

通常時刻区間のとき true, それ以外のとき false

Type
boolean

isSingle()

単一時刻区間か?

this が単一時刻の時刻区間かどうかを返す。

単一時刻区間の場合、区間内にただ 1 つの時刻が存在する。

単一時刻区間であるなら lower == upper であり、逆は必ずしも成り立たない。

Source:
Returns:

単一時刻区間のとき true, それ以外のとき false

Type
boolean

precedes(rhs)

先行しているか?

this のすべての時刻が rhs のすべての時刻より先行しているときに true, それ以外のときは false を返す。

this または rhs のどちらか、または両方が空時刻区間のときは true を返す。

Parameters:
Name Type Description
rhs mapray.animation.Interval

時刻区間

Source:
Returns:

this が rhs に先行しているとき true, それ以外のとき false

Type
boolean