Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / MultiCore Version / PureMVC-Improvements: Array to Dictonary or Vector ? on: October 30, 2012, 04:37:50
Hi,

I am currently looking at the puremvc sourcecode and maybe I have some improvements.

For example:

org.puremvc.as3.multicore.core.View.as

Why you are using Array instead of Dictonary?

:
// Mapping of Mediator names to Mediator instances
protected var mediatorMap : Array;

// Mapping of Notification names to Observer lists
protected var observerMap : Array;

// Singleton instance
protected static var instanceMap : Array = new Array();


change to:

:
// Mapping of Mediator names to Mediator instances
protected var mediatorMap : Dictionary;

// Mapping of Notification names to Observer lists
protected var observerMap : Dictionary;

// Singleton instance
protected static var instanceMap : Dictionary = new Dictionary();


And I changed:

:
var observers_ref:Array = observerMap[ notification.getName() ] as Array;

// Copy observers from reference array to working array,
// since the reference array may change during the notification loop
var observers:Array = new Array();


to:

:
var observers_ref:Vector.<IObserver> = observerMap[ notification.getName() ] as Vector.<IObserver>;

// Copy observers from reference array to working array,
// since the reference array may change during the notification loop
var observers:Vector.<IObserver> = new Vector.<IObserver>();

On other places it is the same.

Are there any downsides or good reasons not using these changes mentioned above?

Best regards and thanks for this great framework,
Sebastian
2  PureMVC Manifold / MultiCore Version / Exception add for Junction::sendMessage(); on: October 24, 2008, 07:02:34
it would be good if the method sendMessage would throw an exception - as done by addPipeListener

org.puremvc.as3.multicore.utilities.pipes.plumbing.Junction

public function sendMessage( outputPipeName:String, message:IPipeMessage ):Boolean
{
   var success:Boolean=false;
   if ( hasOutputPipe(outputPipeName) )
   {
      var pipe:IPipeFitting = pipesMap[outputPipeName] as IPipeFitting;
      success = pipe.write(message);
   }
   if(!success)
      throw("Unable to send message to output pipe listener on " + outputPipeName);

   return success;
}

Regards,
Sebastian
Pages: [1]