Alternative for multiple inheritance (AbstractQueue and AbstractList)

Hello all,
What is the best alternative for multiple inheritance? I want to make a list, which supports queue operations. Both AbstractQueue en AbstractList are useful, so I would like to use them both, instead of implementing the methods myself or copying the code.
thanks

Do you mean you want a class just like LinkedList?
Why don't you look at the code for LinkedList. Perhaps you could even use it.
Most Queue methods have trivial implmentations using a List.
From the source for LinkedList
public class LinkedList<E>
    extends AbstractSequentialList<E>
    implements List<E>, Queue<E>, Cloneable, java.io.Serializable

Similar Messages

  • Alternatives to multiple inheritance for my architecture (NPCs in a Realtime Strategy game)?

    Coding isn't that hard actually. The hard part is to write code that makes sense, is readable and understandable. So I want to get a better developer and create some solid architecture.
    So I want to do create an architecture for NPCs in a video-game. It is a Realtime
    Strategy game like Starcraft, Age of Empires, Command & Conquers, etc etc.. So I'll have different kinds of NPCs. A NPC can have one to many abilities (methods) of these: Build(), Farm() and Attack().
    Examples:
    Worker can Build() and Farm()
    Warrior can Attack()
    Citizen can Build(), Farm() and Attack()
    Fisherman can Farm() and Attack()
    I hope everything is clear so far.
    So now I do have my NPC Types and their abilities. But lets come to the technical / programmatical aspect.
    What would be a good programmatic architecture for my different kinds of NPCs?
    Okay I could have a base class. Actually I think this is a good way to stick with the DRY principle.
    So I can have methods like WalkTo(x,y) in
    my base class since every NPC will be able to move. But now lets come to the real problem. Where do I implement my abilities? (remember: Build(), Farm() and Attack())
    Since the abilities will consists of the same logic it would be annoying / break DRY principle to implement them for each NPC (Worker,Warrior, ..).
    Okay I could implement the abilities within the base class. This would require some kind of logic that verifies if a NPC can use ability X. IsBuilder, CanBuild,
    .. I think it is clear what I want to express.
    But I don't feel very well with this idea. This sounds like a bloated base class with too much functionality.
    I do use C# as programming language. So multiple inheritance isn't an opinion here. Means: Having extra base classes like Fisherman
    : Farmer, Attacker won't work.

    Hi
    PandoraElite,
    You can inherit from multiple interfaces (and use explicit interface implementation), but not from classes in C#. You can almost simulate it:
    In C# we don't support multiple inheritance
    http://blogs.msdn.com/b/csharpfaq/archive/2004/03/07/why-doesn-t-c-support-multiple-inheritance.aspx
    What would be a good programmatic architecture for my different kinds of NPCs?
    In your scenario, we can define some interface ,An interface contains only the signatures of methods, properties, events or indexers. A class or struct that implements the interface must implement the members of the interface that are specified
    in the interface definition.
    How to use? Please refer to the following article.
    http://www.codeproject.com/Articles/18743/Interfaces-in-C-For-Beginners
    Best of luck!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Enumerate multiple inheritance scenarios and their java equivalents?

    hi,
    ppl have often said things like
    "java doesn't support multiple inheritance but this is ok, since there are other mechanisms for doing the same thing (by which we nearly always mean interfaces)"
    how solid a statement is this? are there any formal methods available eg smt like "over all possible inheritance trees over all possible classes, only a handful of cases are distinct when viewed from the converting-to-single-inheritance scheme"?
    the two things mentioned as harder to workaround are mixins and the diamond problem - are there more?
    also what other mechanism apart from interfaces (if any) are useful?
    any help appreciated,
    asjf

    What I say is that it doesn't matter since there is
    almost never any need for MI. Most of the time it is
    used it is used because the developer/designer did not
    understand what they were doing and it should not have
    been used in the first place.
    That leaves one with very few cases where it should
    ever be used. And that coupled with the fact that a
    developer should never use it unless they are very
    experienced (so that they actually know that it should
    be used,) means that practicing programmers should
    leave discussion of such usages to scholarly
    journals.thanks :) I guess my problem is that often with computer stuff you don't have to rely on other peoples experience about things - you can go and test it yourself
    I've done very little C++ development, and so have never come across real-world multiple inheritance. I bumped into the first situation with some java code where it might've been a neat solution recently but this could easily fit into the "designer did not understand what they were doing" category from above..
    will have a casual look around the scholarly journals if I can find any that look promising :)
    asjf

  • Replacement for multiple inheritance in MovieClip class

    Hello
    I need your opinion about a problem.
    Commonly, when you need to replace multiple inheritance, you do it by making an aggregation with one of the class involved.
    But in case of MovieClip attached class, there is one more class involved in the process : the MovieClip class, and this class can't be the one aggregated because every class attached to a MovieClip need to inherits from it.
    The problem is if the other class can't be also aggregated because it has some abstract class behaviour, for instance, call of a virtual function.
    A solution could be making the abstract class inherit from the MovieClip class, but what if you want to reuse its behaviour in a class which have nothing to do with MovieClip ?

    This is Not Supported in WebLogic that the Remote Interface extends other Interfaces. Because Annotation Processor just looks up inside the implemented interface methods. The actual interface which is Implemented by the Bean Class. So the Methods declared inside the Interface B and Interface C will be ignored and will not be available as part of the generated Stubs. Thats why u are getting NoSuchMethodError.
    You can even contact Oracle Support on this...there are 3-4 Cases on it. And the Solution is Work As Designed.
    Workaround is : edit your interface A as following
    Declare all the Business Methods only in the Remote Interface and not inside it's Super Interfaces.
    Example:
    @Stateless(name="A")
    @Remote({A.class})
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class AImpl implements A {
    @Override
    public void writeA() {
    System.out.println("A");
    @Override
    public void writeB() {
    System.out.println("B");
    @Override
    public void writeC() {
    System.out.println("C");
    @Remote
    @JNDIName(A.JNDI_NAME)
    public interface A extends B, C {
    public static String JNDI_NAME = "A_JNDI_NAME";
    void writeA();
    void writeB();
    void writeC();
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are Here)

  • Multiple inheritance, delegation and syntactic sugar

    Given that delegation of an interface to a class member gives you most of the effect of multiple inheritance, why isn't there any syntactic sugar in the language to make this easy?
    For example, you could have:
    class B extends A implements I delegate i { I i = new IAdapter(); }
    The semantics is simple: for each method in each delegated interface, if there is no method with that signature defined in the class then create one with a body that delegates the call to the given member. If there is an ambiguity from multiple interfaces, just flag it at compile time so that the programmer must add an explicit method.
    This doesn't impact the class file format as it isn't doing anything that can't be done longhand in the code. It would even provide some protection from interface changes, as a recompile would pass the problem on to the delegate (which would likely inherit from some standard adapter class which would be modified at the same time as the interface).
    Why isn't this done (apart from because MI is inherently evil and just suggesting this addition means I'm a bad person). It would make the language a tiny bit bigger, but at least when people ask why Java doesn't have proper MI you could answer 'it does and you do it like this' with an almost straight face.
    Jonty

    The only problem with this is that with multiple
    delegates it kinda falls apart.
    When yourFunc() is called on an instance of A, which
    function is called?original> If there is an ambiguity from multiple interfaces, just flag it at compile
    original> time so that the programmer must add an explicit method.
    My suggestion was that if there is any ambiguity then no delegation is made, forcing the programmer to do it manually.
    Normally in Java it's no big deal when multiple
    interfaces have the same methods in them.Actually, I find it a bit of an odd choice by the language designers allowing same signature functions defined in different interfaces to not generate a name clash. Normally this indicates that there is, or soon will be, a bug. I can't think of any situation where this is good programming - if you want the method to exist in both interfaces then it should be defined in a third and inherited into both. This makes it clear that it really is the same method.
    Not saying that delegates are a bad idea, but simple
    examples don't prove that delegates are a worthwhile
    feature to add.The point is that delegation is a commonly used pattern, and is almost always trotted out as a good way of getting most of multiple inheritance. The comments so far are about the problems with this pattern, not with my suggestion to make it easier to use.

  • Installing a callback for multiple windows messages and processing EVENT_NEWHANDLE message

    Good afternoon all,  I am a newbie to using the Win32 API.  I have two questions:
    When a single callback is installed to process multiple windows messages, will the install function return the same windows handle for the panel?
    I also saw noted in the help your panel should handle and respond to the EVENT_NEWHANDLE message.  Does the InstallWinMsgCallback function need to be called make sure your panel handles this message as well?
    Thank you for your help.

    Hi hortoxn1,
    We have a KnowledgeBase Article on this topic that you may find useful:
    "How Do CVI Panels Process Windows Messages?"
    http://digital.ni.com/public.nsf/allkb/29C12428E7974EEF862565EF00839871
    Does that explain what you're looking for?
    Steven

  • NI9203 - Need to know how to set up the FPGA code for multiple NI9203 modules and how to calibrate the data

    Hi. I'm using the NI9203 module to detect pressure, temerature and flow rate of water in a cooling system. I have 17 different inputs coming in therefore i'm using 3 NI9203 modules. I've used the example provided with labview as a base for designing my code. The example can be found here : Program Files\National Instruments\LabVIEW 8.0\examples\CompactRIO\Module Specific\NI 9203.
    I've had no problems when testing this code out for a single NI9203 module but when i add code for 3 modules the code will not compile as my resources are over mapped. Is there a simpler way to program the FPGA code.
    That said how do you go about calibrating the data that's received from the module. Preferably i'd like to write a vi to do the calibrating. Just need help on how to go about writing this vi

    Hi havok,
    Firstly, I would use constants to configure the modules, it'll save some resources on the FPGA.  I'm not typically changing the settings on the fly, so using constants whenever possible helps.  I would also take a look at the following KnowledgeBase article on other changes you can make to the FPGA VI to compile the code:
    http://digital.ni.com/public.nsf/allkb/311C18E2D635FA338625714700664816?OpenDocument
    The best changes you can make are to use fewer arrays and front panel elements.  This can be done by using a DMA FIFO or constants on the block diagram. 
    Now actually calibrating the data will require you to do it on the host side.  There is an example VI called Binary to Nominal that changes the raw data to something more useful for datalogging, display, etc.  It can be found in some of the example VIs, or in the following link:
    http://digital.ni.com/public.nsf/allkb/E86D8D460C4C092F8625752F00050A61?OpenDocument 

  • DNS Settings for multiple domains internal and external.

    First forgive me if my post is in the wrong area. If it is, kindly show me to the right location..
    OK, here is the deal. I have an xserve running 10.5.6 perfectly. 5 Domains running on it as well perfectly fine. lets call them domain1, domain2, etc...
    I run web services and mail services for all 5 domains. but heres the problem...
    I want to add another domain "domain6" but I only run the web services not mail. how can I set this up? I tried to add another Zone and only set up the www.domain6.com part but then no mail works as there is no mx record available.
    I am behind a firewall. when I am on a local machine and there is no domain6 DNS entry the mail works as the address to the external mail server is correct. but no local web works because I am getting the external IP to the www server. I need to keep traffic on the LAN.
    BEGIN Basic Question *
    I want to add another domain that I own but only the A record for the WWW part. How do I add a single entry for www.domain6.com but for everything else like MX records forward outside my network.
    END Basic Question *
    Help Please... Thanks! Bill

    Ok that worked. but let me clue you in on something that was happening...
    When I set up the domain6 then set up the ns record went on to create the www, mail1, anad mail2 entries when I went to save it addded domain6 to the end of the nameserver host name and both mail MX entries. That was my problem I just didnt see it the first time. I then edited the mail entries and removed the "domain6.com" and left the real mx host names and all is working now. Thanks for helping me.

  • STO or PO for multiple line items and multiple destinations

    I am working in retail enviornment and I have folloowing two questions:
    1- we need to push articles( materials) to approx 1400store- we need to create STO with approx 10 line items and send materails to 1400 stores- this happens several times a year.
    what is the easiest way to create this document without having to create either 1400 documents or create one  document for all stores and enter 14000 lines? (Sames items/ and qty going to all stores)
    2- We also have to send approx 600 items to one or two stores at a time ( when a new store is opened)- these items are same.
    Is there a way to create this STO/ PO and keep reusing this document again and again withoiut entering 600 line items everytime this requirement comes up ( this requirements comes up anywhere from 10 times per year to 50 times/yr
    Does anyone have any idea on how to simplyfy this process. Any help/ idea would be of great help.
    Thanks
    Raj

    A PO once entered can be copied in ME21N, by drag-n-drop into the shopping cart.  The problem might be changing delivery dates and delivery plants.
    Another option is to use BOMs.

  • Process single chq for Multiple Vendor Invoice and other Non-Vendor GL

    Hello Experts,
    Scenrio :
    In most of the cases, Vendors of our client have the same Banks as that of our client. our client provides facilty to thier Vendors by depositing chqs in thier account upon due date.
    Procedure :
    I want to process a manual transaction (with a single chq for intra-bank transfer). the total amt on chq would be the total of selection of several invoices & some other payable GLs.
    Query :
    which T-Code should i use & how do i proceed.

    Hi Hussein Merchant ,
    For your requirement you have to do single payment at F-53.There you need to select Other account check box at open item selection.Give the all open item vendor codes and get a cleared document number.
    Go to FCH5 and assign manual single check here
    May be this information is useful to you
    If you have any doubt feel free to ask
    Regards
    Surya

  • Email for multiple locations (phone and pc's)

    It seems that if i pull emails onto my phone and then delete them before I pull them onto my pc, they can't be downloaded onto my pc anymore.  I know there is a setting in Outlook to "Leave a copy of messages on server".  Is there a way to set this same setting on my phone??  I think I may have just deleted messages for the last week for three accounts!!  thinking I would still have them on my pc.

    kanderson88 wrote:
    I have three accounts that are pop accounts.  All are godaddy accts, if that helps...
    Hi kanderson88,
    While your phone can be synched with your email accounts to pull emails, delete, forward and perform other email functions, only your email account settings determine how those incoming emails are processed. If you want your email server to retain a copy of all incoming emails for you to pull at your convenience from your PC even if you delete emails from your mobile handset please contact your email provider for assistance with your email server settings.

  • Script for multiple tp addtobuffer and tp import in windows OS

    Hi Gurus,
    Can someone extend some asssitance? I need to transport 5000 transport request in OS level (window). I wanted to create a script that will enable me to addtobuffer and tp import all this 5000 request and will show the error code of the particular TPs that encountered an error.
    Need your immediate assistance please?

    Hi,
    You can do the following
    1.     Compose all the requests in the given specified format.
    tp addtobuffer REQUEST SID client=XXX pf= Transport domain profile  Using excel sheet.
      We should have following things
    a.     Request IDs such as <SID>K9XXXXX
    b.     SID of the system for which these requests are to be imported.
    c.     Specific client no.
    d.     Transport domain profile.
    The final format of the excel sheet with all the transport requests should look like this.
    This format needs to be pasted on to the text file. (transports.txt), in windows you can save as .cmd  or bat format may be.
    tp     addtobuffer     <SID>K9XXXXX     <target SID>     client=XXX pf=TP_DOMAIN_SID.PFL
    tp     addtobuffer     <SID>K9XXXXX     <target SID>     client=XXX pf=TP_DOMAIN_SID.PFL
    tp     addtobuffer     <SID>K9XXXXX     <target SID>     client=XXX pf=TP_DOMAIN_SID.PFL
    tp     addtobuffer     <SID>K9XXXXX     <target SID>     client=XXX pf=TP_DOMAIN_SID.PFL
    u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026
    u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026.
    2.     Once the text file or cmd file with all the requests are made, place it on to the target system transport directory.
    /usr/sap/Trans/bin.
    3.     Execute this file (./transports.bat) and redirect this file to one more file (error.txt) for checking the errors
    ./transports.bat >> error.txt
    Once all the transports are attached into buffer, you can do the mass import from STMS
    Thanks and Regards
    Purna
    Edited by: purnachender on Mar 17, 2010 7:11 AM

  • MS Access alternative for Mac? Filemaker and Bento no longer available?

    Hi,
    I need to create a database to track employee training, certifications, etc. Started working in Access but just realized that doesn't work on a Mac. I tried creating something in Excel but it is too much info to manage in a spreadsheet. I've looked into FileMaker and Bento but they no longer seem to be available. Any suggestions? I have Microsoft Office 2011 and I would need more than just read-only funtion in Access so Crossover/Parallels don't seem like a viable route.
    Thanks in advance for the help.

    Bento is gone, but FileMaker is still available. FileMaker 13 was just introduced in December.

  • Alternative for fetching order number and batch

    Hi All,
    I am currently using CAUFV table to fetch order numbers based on material number and plant.
    After that i am filtering these order numbers and fetching the batch  from AFPO table using the item number and the order
    numbers obtained from CAUFV table.
    Is there a table using which i can get the order number and batch based on the  material number and plant.
    Regards,
    Arjun

    Use viwe IOAFPO and select it

  • Is Interface only an alternative on for mutiple inheritance?

    Last night i read Java Hand Book that shows that interface is used only for alternative for multiple inheritance.
    But i disagree with it.Am i right?

    JosAH wrote:
    BigDaddyLoveHandles wrote:
    jverd wrote:
    JoachimSauer wrote:
    I don't quite understand your question. Are you asking:
    "Are Interfaces the only alternative for multiple inheritance?" (i.e. is that the only possible way to get the same functionality)If this is your question, the answer is yes.
    "Are Interfaces only used as an alternative for multiple inheritance?" (i.e. is that the only use of interfaces).If this is your question, the answer is no.So in general the answer is yes and no.I'd say the answer is yes or no.
    kind regards,
    JosPedantic boolsniffer.

Maybe you are looking for

  • IPhone 6 128GB Blue Screen, Random restarts/crashes

    Alright, i noticed this the day i bought my iPhone 6. Ten minutes of it being in my hand, i got a blue screen and my phone reset itself. Throughout the day it did it about 7 more times. It does this everyday. I have brought it to AT&T and told them i

  • Conditions in case statement

    Hello : Is it possible to make something like this conditions in a Case statment?: Case mycondition of (mycondition >= 10 and mycondition <= 50 ): --do this etc... end Case I know that can use If conditional but is it possible of the above? Thanks in

  • HR-payroll Error in simulation

    hello experts i am getting error in simulation plz guide me . how to resolve it.Error msg is shown below. P2003      S**  DPS       Insert Shift Substitutions in PWS                               No entry in table T556 for key 02                     

  • UnknownHostException when consuming webservice on JBoss server

    Hi all, I just can't get rid of this exception. I have a JBoss server running the stuff that wscompile came up with and it's all properly deployed (I can jndi the interface and call a servicemethod on it). But then the stub throws the above error. I'

  • How to relocate one of the control files on another computer?

    Hi , I have created a database(10g Release 2) on a windows xp laptop. The control_files parameter is: C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10G\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10G\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB10G\C