From 7901ac138100262506585ca29795621457678ef9 Mon Sep 17 00:00:00 2001 From: Robert Machmer Date: Sat, 9 Jan 2016 05:06:54 +0100 Subject: [PATCH] Add setters for replacing the default Edge and Node classes This can be handy if the user wants to extend the functionality of those classes. They can simply be inherited in a new class with that new class being used in the Graph then. --- fd/Graph.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fd/Graph.lua b/fd/Graph.lua index 0e58083..ee5c141 100644 --- a/fd/Graph.lua +++ b/fd/Graph.lua @@ -242,4 +242,20 @@ function Graph.new() return self; end +--- +-- Replaces the default Edge class with a custom one. +-- @param class - The custom Edge class to use. +-- +function Graph.setEdgeClass( class ) + Edge = class; +end + +--- +-- Replaces the default Node class with a custom one. +-- @param class - The custom Node class to use. +-- +function Graph.setNodeClass( class ) + Node = class; +end + return Graph;