Created new Add function whic allows pass directly low, high and object.
This commit is contained in:
11
add.go
11
add.go
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user