How can you create a linked list? GUI?

I have the following program that I wrote:
package damagecounter;
import java.io.*;
import java.util.*;
public class Main
     public static void main (String[] args) throws Exception
          String logline;
          Player player1 = new Player("Kazzandar");
          try
               BufferedReader logfile = new BufferedReader(new FileReader("TeilmonRun.txt"));
               logline = logfile.readLine();
               while (logline != null)
                    if (logline.startsWith (player1.getName (), 0))
                         if (logline.contains ("recites"))
                              player1.recites++;
                         if (logline.contains ("rescues"))
                              player1.rescues++;
                         if (logline.contains ("utters the words"))
                              player1.spells++;
                         if (logline.contains ("sprawling with a powerful bash."))
                              player1.bashes++;
                         if (logline.contains ("got toasted by"))
                              player1.deaths++;
                         if ((logline.contains ("-=")) && (logline.contains ("=-")))
                              if (logline.startsWith (player1.getName (), 0))
                                   String damage = logline.substring(logline.indexOf ("-=") + 2 , logline.indexOf ("=-"));
                                   player1.setDamage (Integer.parseInt (damage));
                    logline = logfile.readLine ();
          catch (Exception e)
               System.out.println ("Log file not found or corrupt.");
               e.printStackTrace();
          player1.printStats();
}As of right now the code require a person to enter the name of a player and then scans the log file to determine the appropriate counts for that player. If I want to scan the file for multiple players how would I be able to do that without having to run the program over and over. The reason being that sometimes the logs have over 15 different players and I'd hate to have to run the program 15 times to get each players stats. Any suggestions? Would I have to make a linked list?

Yes, the log file looks something like that. Here is a small 15 line version of what the log file actually looks like:
Kazzandar's stab misses Icingdeath. -=0=-
Arien's slash >>> ANNIHILATES <<< Icingdeath! -=118=-
Arien's slash >>> ANNIHILATES <<< Icingdeath! -=112=-
Arien's slash <<< ERADICATES >>> Icingdeath! -=158=-
Parrish utters the words, 'yjrr pzar'.
Arien rescues Shargaas!
Kazzandar's counterattack does UNSPEAKABLE things to Icingdeath! -=636=-
Icingdeath's claw does UNSPEAKABLE things to Arien! -=760=-
Arien's fireball scratches Icingdeath. -=4=-
Arien's lightning bolt grazes Icingdeath. -=7=-
Arien's counterattack -- DESSICATES -- Icingdeath! -=540=-
Icingdeath's claw COMPLETELY TRASHES Arien! -=802=-
Arien is DEAD!
Kitiara's fireball grazes Icingdeath. -=5=-
Kitiara's lightning bolt grazes Icingdeath. -=8=-
Almost always the player name is first but sometimes the "mob" name (In this case Icingdeath) comes out. I don't mind if Icingdeath is referenced as a player and included in the stats, not that big a deal. Thanks for the idea on the HashMap I'll looking into how it works. Since this is my first Java program I often find myself lost at where to begin.
I changed "got toasted by" to "is DEAD!" since it's easier to read. I also changed the majority of the main code into a method for the player class. The main code looks like this now:
public static void main (String[] args) throws Exception
          Player player1 = new Player("Shargaas");
          player1.scanLogForStats("TeilmonRun.txt");
          player1.printStats();
     I was hoping this would make it easier, anyway, thanks again and I'll definitely be looking into HashMap.

Similar Messages

  • How do you create a linked list

    i need a linked list to hold data which would be words so that the words can be held by the linked list and appear in alphabetica order?

    public class DoubleLink1
         private NodeData head;
         private NodeData tail;
         public DoubleLink1()
         this.tail = null;
         this.head = null;
         public void add(Contact info)
         NodeData newNode = new NodeData(info);
         if(head != null)
         newNode.next = head;
         head.prev = newNode;
         head = newNode;
         else
         head = tail = newNode;
         public Contact retrieve(String name)
         NodeData current = head;
         while(current !=null)
         if(current.data.getName().equals(name))
         return current.data;
         current = current.next;
         return null;
         public void traverse()
         NodeData current = head;
         while(current !=null)
    //     current.getData());print();
         current = current.next;
         public boolean delPhoneNum(String name)
         NodeData current = head;
         NodeData previous = head.prev;
         NodeData next = head.next;
         boolean found = false;
         if (head == null)
         return false;
         while(current != null)
         if(current.data.getName().equals(name))
         found = true;
         return found;
         previous = current;
         current = current.next;
         if (current != null)
         next = current.next;
         if (found)
         if (previous == null)
         head = head.next;
         else if (next == null)
         tail = tail.prev;
         else
         previous = current.next;
         next = current.prev;
         return found;
         }//DoubleLink
    so i have this linked list..how can i apply it to my program with the words instead of the numbers and phone contact

  • How do you create a link to a pdf in Muse? Thought it was going to show that with Katie's menu and can"t find in any of the tutorials.

    How do you create a link to a pdf in Muse? Thought it was going to show that with Katie's menu and can't find in any of the tutorials.

    The steps would be :
    - Add files from file menu > select pdf > add to site
    - Select the content (rectangle,text etc) and click on hyperlink dropdown > it should show you the added files list
    - Select the file you want to link
    Thanks,
    Sanjit

  • How can I create a link on an image?

    How can I create a link on an image?

    Select your image and in the hyperlinks tool on the toolbar simply type in your site address you want to link to. be sure to include the http:// before the domain name.

  • How can I create a property list inside a property list?

    How can I create a property list inside a property list?
    I have a string(that I pulled from a text member). the string
    is actually a propert list.
    the property list has another property list inside it..
    how can I use this list ? how can I conert the text to a list
    that director will understand?
    thanks.

    Not sure if this is what you're wanting, but to make a list
    from a text
    member you could do something like ...
    myList= []
    -- Fill myList with values --
    repeat with i = 1 to member("YourTextMember").line.count
    add myList, (member("YourTextMember").line.i)
    end repeat
    Haven't checked it, but it should work.
    -Matt

  • How do you create a mailing list on an ipod?

    I will sometimes send an email on my ipod touch 4g to multiple people at the same time. But every time I do it I have to manuelly add in everybody one contact at a time. How can I create a mailing list that I can just select whenever I want to send an email to the same group of people?

    By using an app to make a group. The iPod does not support making groups.
    https://itunes.apple.com/us/app/id358960275?mt=8
    https://itunes.apple.com/us/app/id454171229?mt=8

  • How can I create a link from a CHM file to a webhelp file?

    How can I create a link from a CHM file to a webhelp file?
    The CHM output (accreditation.chm) is stored in a parent directory, and the webhelp output (index.htm) is stored in a child directory.

    Open the usual Link dialog and enter the relative path from where the CHM will be installed to where the webhelp will be installed.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How can you create a spry menu bar with no background colour?

    How can you create the first level of a spry menu bar to have no colour? I have a coloured background right now and the colour matches when you load the site in Internet explorer but does not match in Firefox. Any suggestions are welcomed on how to fix this.
    Thanks!
    HK

    Here is the site:
    http://partnersnaturally.ca/
    I am learning with code, (obviously) so any feedback would be nice. I use dreamweaver CS4, but when I originally designed the site it was in a much older version of dreamweaver. I wonder if that could also be a cause. (besides human error)
    Thanks again,
    HK

  • How can you create a writable PDF document from a PPT presentation ?

    How can you create a writable PDF document from a PPT presentation ? Upper part with the image , lower part with a free space in order to take notes for students during presentation or course.
    Thanks.
    B

    You can make a PDF file out of you notes and handouts but using the Adobe PDF printer.
    Open your PowerPoint Document then go to “File” “Print”
    Select ‘Adobe PDF” Printer
    Under slides, select which way you want to print. Note it will not print to a printer but to a PDF file.
    After then go into printer Properties and Setup PDF properties, do the following: (see second image below)
    Default: PDF/A 1-b
    Adobe Security: none (change as needed)
    Adobe Output folder: Prompt for Adobe file name
    Adobe Page size: Letter (change as needed)
    Check the following check boxes
    View Adobe PDf Results,
    Add Document Information,
    Rely on system fonts only,
    Delete Log files for successful jobs.
    Select OK
    A pop will ask you where you want to save the document. The file extension should be PDF. After giving the file name select okay and the file should popup as a PDF. Down side is if you want to speaker notes included then you will have to do another file, like wise with just screen shots then combine into one PDF document.
    I used Acrobat IX Pro. So to do this you need Acrobat IX or X Pro.
    Hope this will help.
    Tiger26

  • How can you create a playlist with music and music video and play those from same playlist through Apple TV?

    How can you create a playlist on Ipod touch with music and music video,  and play those from same playlist through Apple TV?  I can download, create a playlist with both music and music video, stream that through the Apple TV with no problem.  The sound and the information show up on the TV, but when it gets to a music video, it only shows the information and "artwork".
    I also have a video playlist - videos play fine through the Apple TV, but will not shuffle through all videos - continues to repeat the same one.  I have most definitely selected shuffle in both locations - from the playlist and on the ipod video screen while video is playing.

    I finally got it... had to sync the photos with the music in iMovie, arrange the voiceover in GarageBand then export to iTunes, and then I was able to put it all together in iMovie and burn in iDVD... had a few glitches along the way but finally finished : )
    Message was edited by: jpewald

  • How can i Create Database Link

    Dear Expert,
    I have two servers on that there are two databases then
    how can i create database link.

    CREATE [SHARED][PUBLIC] DATABASE LINK link_name
    [CONNECT TO user IDENTIFIED BY password]
    [AUTHENTICATED BY user IDENTIFIED BY password]
    [USING 'connect_string']

  • How can I create email distribution lists in my contacts on my macbook air?

    How can I create email distribution lists in my contacts on my macbook air? I could do this on a pc using outlook, but I don't see how to do it on my new mac.

    UPDATE, ok, I figured out how to make a list, but how can I remove specific contacts from the list? The "Remove from Group" is greyed out & not available.

  • How can you create a swish pan in Final Cut X?

    How can you create a swish pan in Final Cut X?

    Andy's - http://andymees.wordpress.com/swish-transitions/
      How's that for service?
    Cheers!

  • HT5312 How can you find the link to get a rescue email?

    How can you find the link to get a rescue email?
    I am not a regular user - and wonder why????
    Been at this for hours, can't remember questions, support sends you to the questions you can't answer or I would have the first time, or a promise of a link which doesn't seem to exist!!
    Now locked out!

    You need to contact Apple, either through the link in that article or by phoning them and asking for the Account Security team.
    (80167)

  • SharePoint Designer 2013 (2010 Platform Workflow) - How can I create a new list item with a SPECIFIC content type?

    In SharePoint 2010 I created workflows that used the 'Create list Item' Action, which then set the Content Type ID (so I could create documents of various types in a document library). 
    We just switched to the SharePoint 2013 platform, and now the drop down for Content Type ID is blank in all of the workflows that are still using the SharePoint 2010 platform.  Is there any way to create a list item with specific content
    type?  Even if I could just input a string into that field instead of using this blank drop-down.  Please help! 

    Hi Sarah,
    According to your description, my understanding is that you cannot create a new list item with a specific content type using SharePoint 2010 Platform Workflow.
    I tested the same scenario in my environment, and the Create List Item worked fine with the specific content type.
    How did you create the content type?
    Please check if the content type is added to the list/library the workflow associated with.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

Maybe you are looking for