On 3/23/08, Jeroen Beckers [EMAIL PROTECTED] wrote:
[snip]
If I want to analyze a list of items, those items must implement the correct
interface, according to which analyzers you have added to the class. Fe:
var myClass:AnalyzerBundle = new AnalyzerBundle();
myClass.addAnalyzer(new
Hi Jethani,
I guess this would be the only proper way... Too bad I can't check it
@compile time, but I guess that makes sense ...
I'm going to go with you and do a little loop in the analyze() method and
check all the items (or part of them) against the interfaces.
Thanks for thinking with me
Polymorphisms is a run time technique. There is no way to determine a
dynamic class instance's interface at runtime. I would use a switch
statement in your AnalyzerBundle class to determine which interface an
analyzer implements and process accordingly, throwing an error on default if
necessary
Hi Again, I'm not sure if this needs to be stated or not. But your switch
statement would look something like this.
# switch( true ) {
# case item is IHeightItem:
# //do stuff
# break;
# case item is ILevelItem:
# //do stuff
# break;
# default:
# //do stuff
# }
I was going
Hi Aaron,
That's not really what I meant...
Every Analyzer implements the IAnalyzer interface with a few methods like
analyzeElements, getItemInterface, etc . The user can add as many analyzers
to the AnalyzerBundle as he wants and then give a list of elements. The way
i'm going to do it now, is
this out). So. one of the alternatives is to use the
'unspecified' identifier.
Rick Winscot
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Miller
Sent: Sunday, March 23, 2008 2:51 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Design pattern
'
descriptor.
Rick Winscot
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Miller
Sent: Sunday, March 23, 2008 2:43 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Design pattern for conditional Interfaces ?
Polymorphisms is a run time technique
Hi list!
Situation: I have a class that analyzes stuff. There are different analyzing
classes, suck as HeightAnalyzer, WeightAnalyzer, LevelAnalyzer, etc.
You can add an analyzer to the class by using
'myClass.addAnalyzer(newAnalyzer:IAnalyzer)'.
As you can see, there is an IAnalyzer interface
8 matches
Mail list logo