summaryrefslogtreecommitdiff
path: root/addons/gut/one_to_many.gd
diff options
context:
space:
mode:
authorSophia Pearson <codergal89@gmail.com>2022-10-03 22:22:50 +0200
committerSophia Pearson <codergal89@gmail.com>2022-10-04 22:18:18 +0200
commite127ad39e742396030352240d829bc903b1d4464 (patch)
tree10cc21d70bf13181aef7c8ad0344077ff63579a3 /addons/gut/one_to_many.gd
parentddbb045f6387a8ba23b1210b27a745516a387a52 (diff)
downloadtexty-e127ad39e742396030352240d829bc903b1d4464.tar.xz
texty-e127ad39e742396030352240d829bc903b1d4464.zip
godot: inital Godot 4 migration
Diffstat (limited to 'addons/gut/one_to_many.gd')
-rw-r--r--addons/gut/one_to_many.gd38
1 files changed, 0 insertions, 38 deletions
diff --git a/addons/gut/one_to_many.gd b/addons/gut/one_to_many.gd
deleted file mode 100644
index 6a0f818..0000000
--- a/addons/gut/one_to_many.gd
+++ /dev/null
@@ -1,38 +0,0 @@
-# ------------------------------------------------------------------------------
-# This datastructure represents a simple one-to-many relationship. It manages
-# a dictionary of value/array pairs. It ignores duplicates of both the "one"
-# and the "many".
-# ------------------------------------------------------------------------------
-var _items = {}
-
-# return the size of _items or the size of an element in _items if "one" was
-# specified.
-func size(one=null):
- var to_return = 0
- if(one == null):
- to_return = _items.size()
- elif(_items.has(one)):
- to_return = _items[one].size()
- return to_return
-
-# Add an element to "one" if it does not already exist
-func add(one, many_item):
- if(_items.has(one) and !_items[one].has(many_item)):
- _items[one].append(many_item)
- else:
- _items[one] = [many_item]
-
-func clear():
- _items.clear()
-
-func has(one, many_item):
- var to_return = false
- if(_items.has(one)):
- to_return = _items[one].has(many_item)
- return to_return
-
-func to_s():
- var to_return = ''
- for key in _items:
- to_return += str(key, ": ", _items[key], "\n")
- return to_return