Created new Add function whic allows pass directly low, high and object.

This commit is contained in:
Daniel Gil
2018-05-31 14:46:54 +02:00
parent f9d1375f1e
commit 1d6fd664fa
5 changed files with 145 additions and 133 deletions

11
add.go
View File

@@ -1,6 +1,15 @@
package interval
func (intvls *intervals) Add(itvl *Interval) error {
func (intvls *intervals) Add(low, high int, obj interface{}) error {
itvl := &Interval{
Low: low,
High: high,
Object: obj,
}
return intvls.AddInterval(itvl)
}
func (intvls *intervals) AddInterval(itvl *Interval) error {
low := intvls.getInclusiveLow(itvl.Low)
high := intvls.getInclusiveHigh(itvl.High)