From d6e386a555585ac72ce6b61dfe019c4b9b4209a5 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 28 Apr 2016 15:36:27 -0400 Subject: [PATCH] Add a base method for GroupCmp You'll want to override this when implementing a resource that does grouping. --- resources.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources.go b/resources.go index 0c5f1359..b3b57d86 100644 --- a/resources.go +++ b/resources.go @@ -256,6 +256,12 @@ func (obj *BaseRes) ReadEvent(event *Event) (exit, poke bool) { return true, false // required to keep the stupid go compiler happy } +// GroupCmp compares two resources and decides if they're suitable for grouping +// You'll probably want to override this method when implementing a resource... +func (obj *BaseRes) GroupCmp(res Res) bool { + return false // base implementation assumes false, override me! +} + func (obj *BaseRes) GroupRes(res Res) error { if l := len(res.GetGroup()); l > 0 { return fmt.Errorf("Res: %v already contains %d grouped resources!", res, l)