Changeset 79c0d2f


Ignore:
Timestamp:
May 25, 2010, 11:17:17 AM (10 years ago)
Author:
Michael Seifert <mseifert@…>
Branches:
master
Children:
477b694
Parents:
7ec5446
Message:

Completed WARP v0.5;

Added license headers;

Dealt with ticket #12;

Improved loading code for factories;

Added javadoc comments

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • pom.xml

    r7ec5446 r79c0d2f  
    33  <groupId>de.erichseifert.warp</groupId>
    44  <artifactId>WARP</artifactId>
    5   <version>0.4</version>
     5  <version>0.5</version>
    66  <inceptionYear>2010</inceptionYear>
    77 
  • src/main/java/de/erichseifert/warp/ActionFilter.java

    r7ec5446 r79c0d2f  
    2323
    2424
     25/**
     26 * Interface used to filter actions based on certain criteria.
     27 */
    2528public interface ActionFilter {
    2629
  • src/main/java/de/erichseifert/warp/ActionFilterFactory.java

    r7ec5446 r79c0d2f  
    2323
    2424import java.io.IOException;
     25import java.io.InputStream;
    2526import java.lang.reflect.Constructor;
    2627import java.lang.reflect.InvocationTargetException;
     
    3435import de.erichseifert.warp.util.FileUtil;
    3536
     37/**
     38 * Class that represents a factory for {@link ActionFilter ActionFilters}.
     39 * It automatically checks all registered <code>ActionFilters</code>.
     40 * Filters register by entering the class of the filtered action and
     41 * their own class in any file named "actionsfilters.txt".
     42 */
    3643public class ActionFilterFactory {
    3744        private static ActionFilterFactory instance;
    3845        private final Map<Class<? extends GameAction>, List<Class<? extends ActionFilter>>> filtersByClass;
    3946
     47        /**
     48         * Creates a new <code>ActionFilterFactory</code> object.
     49         * This constructor registers all filter classes that are contained
     50         * in the respective files.
     51         */
    4052        @SuppressWarnings("unchecked")
    4153        private ActionFilterFactory() {
     
    5062                }
    5163                while (files.hasMoreElements()) {
    52                         String path = files.nextElement().getFile();
     64                        InputStream stream = null;
    5365                        try {
    54                                 Map<String, List<String>> mappedFilters = FileUtil.parseFile(path);
     66                                stream = files.nextElement().openStream();
     67                        } catch (IOException e1) {
     68                                // TODO Auto-generated catch block
     69                                e1.printStackTrace();
     70                        }
     71                        try {
     72                                Map<String, List<String>> mappedFilters = FileUtil.parseFile(stream);
    5573                                for (Map.Entry<String, List<String>> entry : mappedFilters.entrySet()) {
    5674                                        String actionClassName = entry.getKey();
     
    7492        }
    7593
    76         @SuppressWarnings("unchecked")
     94        /**
     95         * Returns an <code>ActionFilter</code> for the specified action.
     96         * @param action Action to be filtered.
     97         * @return Filter.
     98         */
    7799        public ActionFilter getFilter(GameAction action) {
    78100                // If the filter map contains an action class...
     
    112134        }
    113135
     136        /**
     137         * Returns an instance of this factory.
     138         * @return Instance.
     139         */
    114140        public static ActionFilterFactory getInstance() {
    115141                if (instance == null) {
  • src/main/java/de/erichseifert/warp/ChatMessage.java

    r7ec5446 r79c0d2f  
    2222package de.erichseifert.warp;
    2323
    24 
     24/**
     25 * Interface that provides the most basic functions a chat message must have.
     26 * Comparing two <code>ChatMessage</code> objects yields the same result as comparing their time stamps.
     27 */
    2528public interface ChatMessage extends Comparable<ChatMessage> {
    2629        /**
  • src/main/java/de/erichseifert/warp/DefaultChatMessage.java

    r7ec5446 r79c0d2f  
    2222package de.erichseifert.warp;
    2323
     24/**
     25 * Class that represents a default implementation of a chat message.
     26 */
    2427public class DefaultChatMessage extends DefaultVersionedComponent implements ChatMessage {
    2528        private final int timeStamp;
     
    2730        private final String message;
    2831
     32        /**
     33         * Creates a new <code>DefaultChatMessage</code> object with the specified time stamp, channel code, and message string.
     34         * @param timeStamp Point in time at which the message was sent.
     35         * @param channelCode Code of the chat channel.
     36         * @param message Actual message.
     37         */
    2938        public DefaultChatMessage(int timeStamp, int channelCode, String message) {
    3039                this.timeStamp = timeStamp;
  • src/main/java/de/erichseifert/warp/DefaultGameAction.java

    r7ec5446 r79c0d2f  
    2222package de.erichseifert.warp;
    2323
     24/**
     25 * Class the represents the default implementation of a game action.
     26 */
    2427public class DefaultGameAction extends DefaultVersionedComponent implements GameAction {
    2528        private int timestamp;
    2629
     30        /**
     31         * Creates a new <code>DefaultGameAction</code> object with the specified time stamp.
     32         * @param timestamp Point in time when the action occured.
     33         */
    2734        public DefaultGameAction(int timestamp) {
    2835                this.timestamp = timestamp;
     
    3340                return timestamp;
    3441        }
    35 
    3642}
  • src/main/java/de/erichseifert/warp/DefaultPlayer.java

    r7ec5446 r79c0d2f  
    2727import java.util.List;
    2828
    29 /**
    30  * Abstract implementation of the <code>Player</code> interface.
    31  * The <code>AbstractPlayer</code> class itself is a <code>VersionedComponent</code> to
    32  * allow support for specific replay versions.
    33  */
    3429public class DefaultPlayer extends DefaultVersionedComponent implements Player {
    3530        private final List<GameAction> actions;
  • src/main/java/de/erichseifert/warp/DefaultReplay.java

    r7ec5446 r79c0d2f  
    8888        }
    8989
     90        /**
     91         * Sets the players of this replay to the specified list.
     92         * @param players List of players.
     93         */
    9094        public void setPlayers(List<? extends Player> players) {
    9195                this.players.clear();
  • src/main/java/de/erichseifert/warp/GameAction.java

    r7ec5446 r79c0d2f  
    2222package de.erichseifert.warp;
    2323
    24 
     24/**
     25 * Interface that represents a basic action a player has undertaken.
     26 */
    2527public interface GameAction extends VersionedComponent {
     28        /**
     29         * Returns the point in time when this action has occurred.
     30         * @return Time stamp.
     31         */
    2632        int getTimestamp();
    2733}
  • src/main/java/de/erichseifert/warp/GameActionFactory.java

    r7ec5446 r79c0d2f  
    2424import java.nio.ByteBuffer;
    2525
     26/**
     27 * Interface that represents a factory for player actions of the specified type.
     28 * @param <T> Action type.
     29 */
    2630public interface GameActionFactory<T extends GameAction> {
     31        /**
     32         * Returns the next action contained in the specified buffer.
     33         * @param src Buffer containing actions.
     34         * @return Action.
     35         */
    2736        T getAction(ByteBuffer src);
    2837}
  • src/main/java/de/erichseifert/warp/Player.java

    r7ec5446 r79c0d2f  
    2525import java.util.List;
    2626
     27/**
     28 * Interface that provides the most basic functions a player must have.
     29 */
    2730public interface Player {
    2831
  • src/main/java/de/erichseifert/warp/gui/ReplayParserGUI.java

    r7ec5446 r79c0d2f  
    123123                        }
    124124                };
    125                 openAction.putValue(Action.NAME, "Open...");
     125                openAction.putValue(Action.NAME, "Open folder...");
    126126
    127127                Action exitAction = new AbstractAction() {
  • src/main/java/de/erichseifert/warp/replays/ReplayParserFactory.java

    r7ec5446 r79c0d2f  
    2424import java.io.File;
    2525import java.io.IOException;
     26import java.io.InputStream;
    2627import java.lang.reflect.Constructor;
    2728import java.lang.reflect.InvocationTargetException;
     
    5253                }
    5354                while (files.hasMoreElements()) {
    54                         String path = files.nextElement().getFile();
     55                        InputStream stream = null;
    5556                        try {
    56                                 Map<String, List<String>> mappedParsers = FileUtil.parseFile(path);
     57                                stream = files.nextElement().openStream();
     58                        } catch (IOException e1) {
     59                                // TODO Auto-generated catch block
     60                                e1.printStackTrace();
     61                        }
     62                        try {
     63                                Map<String, List<String>> mappedParsers = FileUtil.parseFile(stream);
    5764                                for (Map.Entry<String, List<String>> entry : mappedParsers.entrySet()) {
    5865                                        String fileExtension = entry.getKey().toLowerCase();
  • src/main/java/de/erichseifert/warp/replays/sc2replay/SC2Actions.java

    r7ec5446 r79c0d2f  
     1/**
     2 * WARP: WARP is a Replay Manager for Java(R)
     3 *
     4 * (C) Copyright 2010-2010 Michael Seifert <michael.seifert[at]gmx.net>
     5 *
     6 * This file is part of WARP.
     7 *
     8 * WARP is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * WARP is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with WARP.  If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
    122package de.erichseifert.warp.replays.sc2replay;
    223
  • src/main/java/de/erichseifert/warp/replays/sc2replay/SC2ChatLog.java

    r7ec5446 r79c0d2f  
     1/**
     2 * WARP: WARP is a Replay Manager for Java(R)
     3 *
     4 * (C) Copyright 2010-2010 Michael Seifert <michael.seifert[at]gmx.net>
     5 *
     6 * This file is part of WARP.
     7 *
     8 * WARP is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * WARP is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with WARP.  If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
    122package de.erichseifert.warp.replays.sc2replay;
    223
  • src/main/java/de/erichseifert/warp/replays/sc2replay/SC2ReplayDetail.java

    r7ec5446 r79c0d2f  
     1/**
     2 * WARP: WARP is a Replay Manager for Java(R)
     3 *
     4 * (C) Copyright 2010-2010 Michael Seifert <michael.seifert[at]gmx.net>
     5 *
     6 * This file is part of WARP.
     7 *
     8 * WARP is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * WARP is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with WARP.  If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
    122package de.erichseifert.warp.replays.sc2replay;
    223
  • src/main/java/de/erichseifert/warp/replays/sc2replay/SC2ReplayInitData.java

    r7ec5446 r79c0d2f  
     1/**
     2 * WARP: WARP is a Replay Manager for Java(R)
     3 *
     4 * (C) Copyright 2010-2010 Michael Seifert <michael.seifert[at]gmx.net>
     5 *
     6 * This file is part of WARP.
     7 *
     8 * WARP is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * WARP is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with WARP.  If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
    122package de.erichseifert.warp.replays.sc2replay;
    223
  • src/main/java/de/erichseifert/warp/replays/sc2replay/SC2Replay_v1.java

    r7ec5446 r79c0d2f  
     1/**
     2 * WARP: WARP is a Replay Manager for Java(R)
     3 *
     4 * (C) Copyright 2010-2010 Michael Seifert <michael.seifert[at]gmx.net>
     5 *
     6 * This file is part of WARP.
     7 *
     8 * WARP is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * WARP is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with WARP.  If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
    122package de.erichseifert.warp.replays.sc2replay;
    223
  • src/main/java/de/erichseifert/warp/util/FileUtil.java

    r7ec5446 r79c0d2f  
    2424import java.io.BufferedReader;
    2525import java.io.File;
    26 import java.io.FileReader;
    2726import java.io.IOException;
     27import java.io.InputStream;
     28import java.io.InputStreamReader;
    2829import java.util.ArrayList;
    2930import java.util.HashMap;
     
    3334public class FileUtil {
    3435
    35         public static final Map<String, List<String>> parseFile(String path) throws IOException {
    36                 FileReader fr = new FileReader(new File(path));
    37                 BufferedReader br = new BufferedReader(fr);
     36        public static final Map<String, List<String>> parseFile(InputStream stream) throws IOException {
     37                InputStreamReader ifs = new InputStreamReader(stream);
     38                BufferedReader br = new BufferedReader(ifs);
    3839                Map<String, List<String>> map = new HashMap<String, List<String>>();
    3940                String line;
     
    4950                        values.add(value);
    5051                }
     52                ifs.close();
    5153                return map;
    5254        }
  • src/main/resources/help/about.html

    r7ec5446 r79c0d2f  
    66  <body>
    77    <h1>About WARP</h1>
    8     <p>This a snapshot of WARP 0.3. <br />
     8    <p>This a snapshot of WARP 0.5. <br />
    99    Keep up to date and visit the project page at <a href="http://trac.erichseifert.de/warp">http://trac.erichseifert.de/warp</a> for the newest version.</p>
    1010    <h1>Credits</h1>
     
    1313    <ul>
    1414      <li>My brother Erich for the hosting</li>
    15       <li>BigD for providing test replays</li>
     15      <li>murphlaw for providing a beta-key</li>
    1616      <li>sofahamster for information on the replay duration and version</li>
    1717    </ul>
Note: See TracChangeset for help on using the changeset viewer.