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
b92fa107
Commit
b92fa107
authored
7 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
docs
parent
d09800fe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-data/int/impl/interval.ts
+1
-1
1 addition, 1 deletion
src/mol-data/int/impl/interval.ts
src/mol-data/int/impl/segmentation.ts
+8
-1
8 additions, 1 deletion
src/mol-data/int/impl/segmentation.ts
src/mol-data/int/interval.ts
+15
-2
15 additions, 2 deletions
src/mol-data/int/interval.ts
with
24 additions
and
4 deletions
src/mol-data/int/impl/interval.ts
+
1
−
1
View file @
b92fa107
...
...
@@ -8,7 +8,7 @@ import Tuple from '../tuple'
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
ofBounds
(
min
:
number
,
max
:
number
)
{
return
max
<=
min
?
Tuple
.
create
(
min
,
min
)
:
Tuple
.
create
(
min
,
max
);
}
export
function
ofBounds
(
start
:
number
,
end
:
number
)
{
return
end
<=
start
?
Tuple
.
create
(
start
,
start
)
:
Tuple
.
create
(
start
,
end
);
}
export
const
is
=
Tuple
.
is
;
export
const
start
=
Tuple
.
fst
;
...
...
This diff is collapsed.
Click to expand it.
src/mol-data/int/impl/segmentation.ts
+
8
−
1
View file @
b92fa107
...
...
@@ -10,7 +10,14 @@ import Interval from '../interval'
import
SortedArray
from
'
../sorted-array
'
import
Segs
from
'
../segmentation
'
type
Segmentation
=
{
segments
:
SortedArray
,
segmentMap
:
Int32Array
,
count
:
number
}
interface
Segmentation
{
/** Segments stored as a sorted array */
segments
:
SortedArray
,
/** Mapping of values to segments */
segmentMap
:
Int32Array
,
/** Number of segments */
count
:
number
}
export
function
create
(
values
:
ArrayLike
<
number
>
):
Segmentation
{
const
segments
=
SortedArray
.
ofSortedArray
(
values
);
...
...
This diff is collapsed.
Click to expand it.
src/mol-data/int/interval.ts
+
15
−
2
View file @
b92fa107
...
...
@@ -10,34 +10,47 @@ namespace Interval {
export
const
Empty
:
Interval
=
Impl
.
Empty
as
any
;
export
const
ofSingleton
:
(
value
:
number
)
=>
Interval
=
(
v
)
=>
Impl
.
ofRange
(
v
,
v
)
as
any
;
/** Create interval [min, max] */
/** Create interval
from range
[min, max] */
export
const
ofRange
:
(
min
:
number
,
max
:
number
)
=>
Interval
=
Impl
.
ofRange
as
any
;
/** Create interval
[min, max)
*/
/** Create interval
from bounds [start, end), i.e. [start, end - 1]
*/
export
const
ofBounds
:
(
start
:
number
,
end
:
number
)
=>
Interval
=
Impl
.
ofBounds
as
any
;
export
const
is
:
(
v
:
any
)
=>
v
is
Interval
=
Impl
.
is
as
any
;
/** Test if a value is within the bounds of the interval */
export
const
has
:
(
interval
:
Interval
,
x
:
number
)
=>
boolean
=
Impl
.
has
as
any
;
export
const
indexOf
:
(
interval
:
Interval
,
x
:
number
)
=>
number
=
Impl
.
indexOf
as
any
;
export
const
getAt
:
(
interval
:
Interval
,
i
:
number
)
=>
number
=
Impl
.
getAt
as
any
;
/** Start value of the interval, same as min value */
export
const
start
:
(
interval
:
Interval
)
=>
number
=
Impl
.
start
as
any
;
/** End value of the interval, same as max + 1 */
export
const
end
:
(
interval
:
Interval
)
=>
number
=
Impl
.
end
as
any
;
/** Min value of the interval, same as start value */
export
const
min
:
(
interval
:
Interval
)
=>
number
=
Impl
.
min
as
any
;
/** Max value of the interval, same as end - 1 */
export
const
max
:
(
interval
:
Interval
)
=>
number
=
Impl
.
max
as
any
;
/** Number of values in the interval */
export
const
size
:
(
interval
:
Interval
)
=>
number
=
Impl
.
size
as
any
;
/** Hash code describing the interval */
export
const
hashCode
:
(
interval
:
Interval
)
=>
number
=
Impl
.
hashCode
as
any
;
/** Test if two intervals are identical */
export
const
areEqual
:
(
a
:
Interval
,
b
:
Interval
)
=>
boolean
=
Impl
.
areEqual
as
any
;
/** Test if two intervals are intersecting, i.e. their bounds overlap */
export
const
areIntersecting
:
(
a
:
Interval
,
b
:
Interval
)
=>
boolean
=
Impl
.
areIntersecting
as
any
;
/** Test if interval b is fully included in interval a */
export
const
isSubInterval
:
(
a
:
Interval
,
b
:
Interval
)
=>
boolean
=
Impl
.
isSubInterval
as
any
;
export
const
findPredecessorIndex
:
(
interval
:
Interval
,
x
:
number
)
=>
number
=
Impl
.
findPredecessorIndex
as
any
;
export
const
findPredecessorIndexInInterval
:
(
interval
:
Interval
,
x
:
number
,
bounds
:
Interval
)
=>
number
=
Impl
.
findPredecessorIndexInInterval
as
any
;
export
const
findRange
:
(
interval
:
Interval
,
min
:
number
,
max
:
number
)
=>
Interval
=
Impl
.
findRange
as
any
;
/** Get a new interval that is the intersection of the two intervals */
export
const
intersect
:
(
a
:
Interval
,
b
:
Interval
)
=>
Interval
=
Impl
.
intersect
as
any
;
}
/** Interval describing a range [min, max] of values */
interface
Interval
{
'
@type
'
:
'
int-interval
'
}
export
default
Interval
\ No newline at end of file
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