Gridarta Editor
TestFileControl.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.mapmanager;
21 
22 import java.io.File;
27 import org.jetbrains.annotations.NotNull;
28 import org.jetbrains.annotations.Nullable;
29 
34 public class TestFileControl implements FileControl<TestGameObject, TestMapArchObject, TestArchetype> {
35 
39  @NotNull
40  private final StringBuilder sb = new StringBuilder();
41 
42  @Override
43  public void openFile(final boolean mapFile) {
44  throw new AssertionError();
45  }
46 
47  @Override
48  public boolean save(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) {
49  throw new AssertionError();
50  }
51 
52  @Override
53  public void saveAllMaps() {
54  throw new AssertionError();
55  }
56 
57  @Override
58  public boolean closeAllMaps() {
59  throw new AssertionError();
60  }
61 
62  @Override
63  public boolean saveAs(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) {
64  throw new AssertionError();
65  }
66 
67  @Override
69  throw new AssertionError();
70  }
71 
72  @Override
73  public void reportSaveError(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final String message) {
74  throw new AssertionError();
75  }
76 
77  @Override
78  public void reportSaveError(@NotNull final File mapFile, @NotNull final String message) {
79  sb.append("reportSaveError: ");
80  sb.append(mapFile);
81  sb.append(" ");
82  sb.append(message);
83  sb.append("\n");
84  }
85 
86  @Override
87  public void reportLoadError(@Nullable final File file, @NotNull final String message) {
88  throw new AssertionError();
89  }
90 
91  @Override
92  public void reportOutOfMapBoundsDeleted(@NotNull final File file, final int outOfMapBoundsDeleted, @NotNull final StringBuilder outOfMapBoundsObjects) {
93  throw new AssertionError();
94  }
95 
96  @Override
97  public void reportOutOfMemory(@NotNull final File file) {
98  throw new AssertionError();
99  }
100 
101  @Override
102  public void reportTeleportCharacterError(@NotNull final String mapPath, @NotNull final String message) {
103  throw new AssertionError();
104  }
105 
106  @Override
107  public String toString() {
108  return sb.toString();
109  }
110 
111 }
net.sf.gridarta.model.archetype.TestArchetype
An Archetype implementation for testing purposes.
Definition: TestArchetype.java:30
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.model.mapmanager.TestFileControl.reportSaveError
void reportSaveError(@NotNull final MapControl< TestGameObject, TestMapArchObject, TestArchetype > mapControl, @NotNull final String message)
Definition: TestFileControl.java:73
net.sf.gridarta.model.gameobject.TestGameObject
A GameObject implementation for testing purposes.
Definition: TestGameObject.java:34
net.sf.gridarta.model.mapmanager.TestFileControl.closeAllMaps
boolean closeAllMaps()
Definition: TestFileControl.java:58
net.sf
net.sf.gridarta.model.mapmanager.TestFileControl.reportSaveError
void reportSaveError(@NotNull final File mapFile, @NotNull final String message)
Definition: TestFileControl.java:78
net.sf.gridarta.model.mapmanager.FileControl
Definition: FileControl.java:30
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.model.mapcontrol
Definition: DefaultMapControl.java:20
net.sf.gridarta.model.mapmanager.TestFileControl
A FileControl implementation for testing purposes.
Definition: TestFileControl.java:34
net.sf.gridarta.model.mapmanager.TestFileControl.sb
final StringBuilder sb
Collects the performed actions.
Definition: TestFileControl.java:40
net.sf.gridarta.model.mapmanager.TestFileControl.save
boolean save(@NotNull final MapControl< TestGameObject, TestMapArchObject, TestArchetype > mapControl)
Definition: TestFileControl.java:48
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net
net.sf.gridarta.model.mapmanager.TestFileControl.toString
String toString()
Definition: TestFileControl.java:107
net.sf.gridarta.model.mapmanager.TestFileControl.reportOutOfMemory
void reportOutOfMemory(@NotNull final File file)
Definition: TestFileControl.java:97
net.sf.gridarta.model.mapmanager.TestFileControl.openFile
void openFile(final boolean mapFile)
Definition: TestFileControl.java:43
net.sf.gridarta.model.mapmanager.TestFileControl.reportOutOfMapBoundsDeleted
void reportOutOfMapBoundsDeleted(@NotNull final File file, final int outOfMapBoundsDeleted, @NotNull final StringBuilder outOfMapBoundsObjects)
Definition: TestFileControl.java:92
net.sf.gridarta.model.mapmanager.TestFileControl.reportTeleportCharacterError
void reportTeleportCharacterError(@NotNull final String mapPath, @NotNull final String message)
Definition: TestFileControl.java:102
net.sf.gridarta.model.mapmanager.TestFileControl.saveAllMaps
void saveAllMaps()
Definition: TestFileControl.java:53
net.sf.gridarta.model.mapmanager.TestFileControl.reportLoadError
void reportLoadError(@Nullable final File file, @NotNull final String message)
Definition: TestFileControl.java:87
net.sf.gridarta.model.mapmanager.TestFileControl.saveAs
boolean saveAs(@NotNull final MapControl< TestGameObject, TestMapArchObject, TestArchetype > mapControl)
Definition: TestFileControl.java:63
net.sf.gridarta.model
net.sf.gridarta.model.mapcontrol.MapControl
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
net.sf.gridarta.model.maparchobject.TestMapArchObject
A MapArchObject implementation for testing purposes.
Definition: TestMapArchObject.java:28
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.model.mapmanager.TestFileControl.confirmSaveChanges
boolean confirmSaveChanges(@NotNull final MapControl< TestGameObject, TestMapArchObject, TestArchetype > mapControl)
Definition: TestFileControl.java:68