Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
3e3b71d2
Commit
3e3b71d2
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
added Interval.ofLength
parent
18692926
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-data/int/impl/interval.ts
+1
-0
1 addition, 0 deletions
src/mol-data/int/impl/interval.ts
src/mol-data/int/interval.ts
+2
-0
2 additions, 0 deletions
src/mol-data/int/interval.ts
with
3 additions
and
0 deletions
src/mol-data/int/impl/interval.ts
+
1
−
0
View file @
3e3b71d2
...
@@ -9,6 +9,7 @@ import Tuple from '../tuple'
...
@@ -9,6 +9,7 @@ import Tuple from '../tuple'
export
const
Empty
=
Tuple
.
Zero
;
export
const
Empty
=
Tuple
.
Zero
;
export
function
ofRange
(
min
:
number
,
max
:
number
)
{
return
max
<
min
?
Tuple
.
create
(
min
,
min
)
:
Tuple
.
create
(
min
,
max
+
1
);
}
export
function
ofRange
(
min
:
number
,
max
:
number
)
{
return
max
<
min
?
Tuple
.
create
(
min
,
min
)
:
Tuple
.
create
(
min
,
max
+
1
);
}
export
function
ofBounds
(
start
:
number
,
end
:
number
)
{
return
end
<=
start
?
Tuple
.
create
(
start
,
start
)
:
Tuple
.
create
(
start
,
end
);
}
export
function
ofBounds
(
start
:
number
,
end
:
number
)
{
return
end
<=
start
?
Tuple
.
create
(
start
,
start
)
:
Tuple
.
create
(
start
,
end
);
}
export
function
ofLength
(
length
:
number
)
{
return
length
<
0
?
Tuple
.
create
(
0
,
0
)
:
Tuple
.
create
(
0
,
length
);
}
export
const
is
=
Tuple
.
is
;
export
const
is
=
Tuple
.
is
;
export
const
start
=
Tuple
.
fst
;
export
const
start
=
Tuple
.
fst
;
...
...
This diff is collapsed.
Click to expand it.
src/mol-data/int/interval.ts
+
2
−
0
View file @
3e3b71d2
...
@@ -14,6 +14,8 @@ namespace Interval {
...
@@ -14,6 +14,8 @@ namespace Interval {
export
const
ofRange
:
<
T
extends
number
=
number
>
(
min
:
T
,
max
:
T
)
=>
Interval
<
T
>
=
Impl
.
ofRange
as
any
;
export
const
ofRange
:
<
T
extends
number
=
number
>
(
min
:
T
,
max
:
T
)
=>
Interval
<
T
>
=
Impl
.
ofRange
as
any
;
/** Create interval from bounds [start, end), i.e. [start, end - 1] */
/** Create interval from bounds [start, end), i.e. [start, end - 1] */
export
const
ofBounds
:
<
T
extends
number
=
number
>
(
start
:
T
,
end
:
T
)
=>
Interval
<
T
>
=
Impl
.
ofBounds
as
any
;
export
const
ofBounds
:
<
T
extends
number
=
number
>
(
start
:
T
,
end
:
T
)
=>
Interval
<
T
>
=
Impl
.
ofBounds
as
any
;
/** Create interval from length [0, length), i.e. [0, length - 1] */
export
const
ofLength
:
<
T
extends
number
=
number
>
(
length
:
T
)
=>
Interval
<
T
>
=
Impl
.
ofLength
as
any
;
export
const
is
:
<
T
extends
number
=
number
>
(
v
:
any
)
=>
v
is
Interval
<
T
>
=
Impl
.
is
as
any
;
export
const
is
:
<
T
extends
number
=
number
>
(
v
:
any
)
=>
v
is
Interval
<
T
>
=
Impl
.
is
as
any
;
/** Test if a value is within the bounds of the interval */
/** Test if a value is within the bounds of the interval */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment