|
From: Hiroo H. <hir...@co...> - 2004-08-24 05:48:45
|
Hi,
I've checked in the change for Patch factory. Here is the summary of
the interface changes.
Patch
static IDriver chooseDriver(byte[]) is added.
static IPatch[] valueOf(byte[]) is added.
static String getPatchHeader(byte[]) is added.
# It seems that valueOf() and getInstance are used for factory. I used
# valueOf() for the factory method.
IPatch
IPatch[] dissect() is removed.
void trimSysex() is removed.
IDriver
IPatch[] createPatch(byte[]) is added.
boolean supportsPatch(String, IPatch) is removed.
boolean supportsPatch(String, byte[]) is added.
IPatchDriver
IPatch[] createPatch(byte[]) is removed.
IPatch[] createPatch(SysexMessage[]) is added.
void trimSysex(IPatch) is removed.
IConverter
extractPatch() was removed.
I tried not to change the program behavior, but I might make a mistake.
Let me know if you see anything.
Thanks.
On Sat, 21 Aug 2004 15:07:13 -0500
Hiroo Hayashi <hir...@co...> wrote:
Hiroo> Hi Rib,
Hiroo>
Hiroo> On Sat, 21 Aug 2004 11:55:26 -0700
Hiroo> Rib Rdb <ri...@gm...> wrote:
Hiroo>
Hiroo> Rib> > My next question would be why Converter still extended the Driver:-)
Hiroo> Rib> > The checksumming is the only reason? Or did you see any other problems?
Hiroo> Rib>
Hiroo> Rib> I didn't see any problems at the time, but I just thought of a problem
Hiroo> Rib> when I saw that you added dissect() to IPatch. If Converter is not an
Hiroo> Rib> IPatchDriver, so there would be no way for a Patch's driver to be a
Hiroo> Rib> converter. I think instead we need to make dissect(byte[]) and
Hiroo> Rib> dissect(SysexMessage[]), or else make createPatch return IPatch[] and
Hiroo> Rib> move createPatch from IPatchDriver to IDriver. What do you think?
Hiroo>
Hiroo> I was thinking about the problem, too Your mail made the problem clear.
Hiroo> My take is almost the latter.
Hiroo>
Hiroo> Let me explain what I'm thinking now.
Hiroo>
Hiroo> IConverter is used by Patch.dissect() now.
Hiroo>
Hiroo> IPatch.dissect() is called by ImportAllDialog.doImport(),
Hiroo> ImportMidiFile.doImport(), LibraryFrame.importPatch(),
Hiroo> SceneFrame.importPatch(), and SysexGetDialog.pasterInfoSelectedFrame().
Hiroo>
Hiroo> The input data for SysexGetDialog.pasterInfoSelectedFrame() is
Hiroo> SysexMessage[] and driver is known. What we need is
Hiroo>
Hiroo> IPatch[] IPatchDriver.createPatch(SysexMessage[])
Hiroo>
Hiroo> The most of code in SysexGetDialog.pasterInfoSelectedFrame() will be
Hiroo> included in this method.
Hiroo> The current pasterInfoSelectedFrame() tries other device/drivers when
Hiroo> the received data is not expected one. I think we should simply cause
Hiroo> error on this case.
Hiroo>
Hiroo> The input data for ImportAllDialog.doImport(), ImportMidiFile.doImport(),
Hiroo> LibraryFrame.importPatch(), and SceneFrame.importPatch() is byte[] and
Hiroo> driver is unknown for them. I think this is the job of patch factory
Hiroo> you wrote.
Hiroo>
Hiroo> static IPatch[] Patch.createPatch(byte[])
Hiroo>
Hiroo> This static method will be used for any IPatch object. Using Patch
Hiroo> class (an implementation of IPatch) may not be proper. On the other
Hiroo> hand I feel it might be overkill to create a new class
Hiroo> (PatchFactory.java?) only for this, and I don't see a proper class which
Hiroo> will include this...
Hiroo>
Hiroo> This method will use IDriver.supportsPatch(String, IPatch) (we may want
Hiroo> to change the second argument to byte[]) and the selected driver will
Hiroo> use IPatch[] IDriver.createPatch(byte[]) which you proposed.
Hiroo>
Hiroo> And if we have IDriver.supportsPatch(String, byte[]), a Patch's driver
Hiroo> does not has to be a converter.
Hiroo>
Hiroo> IPatch IPatchDriver.createPatch(byte[]) will be replaced by IPatch[]
Hiroo> IDriver.createPatch(byte[]).
Hiroo>
Hiroo> IPatch.dissect() is no longer an interface method.
Hiroo>
Hiroo> How do you think? If you agree with me and don't mind, I'll try to make this
Hiroo> change during this weekend.
Hiroo>
Hiroo> PS.
Hiroo> To make consistent with IPatch IPatchDriver.createPatch(byte[]),
Hiroo> Patch IPatchDriver.createNewPatch() can be renamed to IPatch
Hiroo> IPatchDriver.createPatch(). Of course Patch Driver.createNewPatch()
Hiroo> will stay the same.
Hiroo> --
Hiroo> Hiroo Hayashi
Hiroo>
Hiroo>
Hiroo>
Hiroo> -------------------------------------------------------
Hiroo> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
Hiroo> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Hiroo> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
Hiroo> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
Hiroo> _______________________________________________
Hiroo> Jsynthlib-devel mailing list
Hiroo> Jsy...@li...
Hiroo> https://lists.sourceforge.net/lists/listinfo/jsynthlib-devel
--
Hiroo Hayashi
|