Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for EMap #91

Open
rettenbs opened this issue Jul 14, 2020 · 0 comments
Open

Support for EMap #91

rettenbs opened this issue Jul 14, 2020 · 0 comments

Comments

@rettenbs
Copy link

It would be nice to have a container that supports key-value pairs where the value is another eType.

I tried something like this, which seems to work for inserting elements:

class Map(dict):
	def insert(self, key, value):
		super().__setitem__(key, value)

class EMap(ECollection, Map):
	@classmethod
	def create(cls, owner, feature=None):
		return cls(owner, feature)

	def __init__(self, owner, feature=None):
		super().__init__(owner, feature)

EReference(upper=-1, derived_class=EMap)

However, I am not sure if ECollection is the corect base class and if there are any other things that need to be considered, i.e. to notify the owner and update the opposite.

I think, for removing it would be possible to use pop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant