InstanceWrapper.cs 954 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. namespace sccdlib
  4. {
  5. public class InstanceWrapper
  6. {
  7. RuntimeClassBase instance;
  8. Dictionary<string,Association> associations = new Dictionary<string, Association>();
  9. public InstanceWrapper (RuntimeClassBase instance, List<Association> associations)
  10. {
  11. this.instance = instance;
  12. foreach (var association in associations) {
  13. this.associations[association.getName()] = association;
  14. }
  15. }
  16. public Association getAssociation (string name)
  17. {
  18. try{
  19. return this.associations[name];
  20. }catch (KeyNotFoundException) {
  21. throw new AssociationReferenceException("Unknown association.");
  22. }
  23. }
  24. public RuntimeClassBase getInstance ()
  25. {
  26. return this.instance;
  27. }
  28. }
  29. }