Upload
This commit is contained in:
parent
0020757f27
commit
d6544b387a
19
ProjectMonorail/.idea/workspace.xml
generated
19
ProjectMonorail/.idea/workspace.xml
generated
@ -5,14 +5,10 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="39e7c520-e505-4e53-a269-c949d7c9f5d1" name="Changes" comment="">
|
<list default="true" id="39e7c520-e505-4e53-a269-c949d7c9f5d1" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/CollectionType.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/ListGenericObjects.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/StorageCollection.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/AbstractCompany.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/AbstractCompany.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/AdditionalCollection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/AdditionalCollection.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/DepotSharingService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/DepotSharingService.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/StorageCollection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/StorageCollection.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/ICollectionGenericObjects.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/ICollectionGenericObjects.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Scripts/Forms/FormAdditionalCollection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/Forms/FormAdditionalCollection.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/MassiveGenericObjects.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/CollectionGenericObjects/MassiveGenericObjects.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Scripts/Forms/FormMonorailCollection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/Forms/FormMonorailCollection.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Scripts/Forms/FormMonorailCollection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Scripts/Forms/FormMonorailCollection.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -47,7 +43,7 @@
|
|||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"git-widget-placeholder": "LabWorking__4",
|
"git-widget-placeholder": "LabWorking__4",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "D:/Учеба/PIbd-11_Tarasov_V.D._Hard/ProjectMonorail"
|
"last_opened_file_path": "C:/Учеба/AgarioGame"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}]]></component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
@ -59,6 +55,13 @@
|
|||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="SharedIndexes">
|
||||||
|
<attachedChunks>
|
||||||
|
<set>
|
||||||
|
<option value="jdk-21.0.2-openjdk-21.0.2-4caba194b151-4f524021" />
|
||||||
|
</set>
|
||||||
|
</attachedChunks>
|
||||||
|
</component>
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
<component name="TaskManager">
|
<component name="TaskManager">
|
||||||
<task active="true" id="Default" summary="Default task">
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
@ -4,18 +4,17 @@ import Scripts.Drawing.DrawingModernMonorail;
|
|||||||
import Scripts.Drawing.DrawingMonorail;
|
import Scripts.Drawing.DrawingMonorail;
|
||||||
import Scripts.Entities.EntityModernMonorail;
|
import Scripts.Entities.EntityModernMonorail;
|
||||||
import Scripts.Entities.EntityMonorail;
|
import Scripts.Entities.EntityMonorail;
|
||||||
import Scripts.Wheels.DrawingWheels;
|
|
||||||
import Scripts.Wheels.IDrawingWheels;
|
import Scripts.Wheels.IDrawingWheels;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class AdditionalCollection <T extends EntityMonorail, U extends IDrawingWheels>{
|
public class AdditionalCollection <T extends EntityMonorail, U extends IDrawingWheels>{
|
||||||
public T[] _collectionEntity;
|
public T[] CollectionEntity;
|
||||||
public U[] _collectionWheels;
|
public U[] CollectionWheels;
|
||||||
public AdditionalCollection(int size, Class<T> type1, Class<T> type2) {
|
public AdditionalCollection(int size, Class<T> type1, Class<T> type2) {
|
||||||
_collectionEntity = (T[]) Array.newInstance(type1, size);
|
CollectionEntity = (T[]) Array.newInstance(type1, size);
|
||||||
_collectionWheels = (U[]) Array.newInstance(type2, size);
|
CollectionWheels = (U[]) Array.newInstance(type2, size);
|
||||||
CountEntities = size;
|
CountEntities = size;
|
||||||
CountWheels = size;
|
CountWheels = size;
|
||||||
}
|
}
|
||||||
@ -24,9 +23,9 @@ public class AdditionalCollection <T extends EntityMonorail, U extends IDrawingW
|
|||||||
public int Insert(T entity) {
|
public int Insert(T entity) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < CountEntities) {
|
while (index < CountEntities) {
|
||||||
if (_collectionEntity[index] == null)
|
if (CollectionEntity[index] == null)
|
||||||
{
|
{
|
||||||
_collectionEntity[index] = entity;
|
CollectionEntity[index] = entity;
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
@ -36,9 +35,9 @@ public class AdditionalCollection <T extends EntityMonorail, U extends IDrawingW
|
|||||||
public int Insert(U decks) {
|
public int Insert(U decks) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < CountWheels) {
|
while (index < CountWheels) {
|
||||||
if (_collectionWheels[index] == null)
|
if (CollectionWheels[index] == null)
|
||||||
{
|
{
|
||||||
_collectionWheels[index] = decks;
|
CollectionWheels[index] = decks;
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
@ -47,9 +46,9 @@ public class AdditionalCollection <T extends EntityMonorail, U extends IDrawingW
|
|||||||
}
|
}
|
||||||
public DrawingMonorail CreateAdditionalCollectionStormtrooper() {
|
public DrawingMonorail CreateAdditionalCollectionStormtrooper() {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
if (_collectionEntity == null || _collectionWheels == null) return null;
|
if (CollectionEntity == null || CollectionWheels == null) return null;
|
||||||
T entity = _collectionEntity[random.nextInt(CountEntities)];
|
T entity = CollectionEntity[random.nextInt(CountEntities)];
|
||||||
U wheels = _collectionWheels[random.nextInt(CountWheels)];
|
U wheels = CollectionWheels[random.nextInt(CountWheels)];
|
||||||
DrawingMonorail drawingBaseStormtrooper = null;
|
DrawingMonorail drawingBaseStormtrooper = null;
|
||||||
if (entity instanceof EntityModernMonorail) {
|
if (entity instanceof EntityModernMonorail) {
|
||||||
drawingBaseStormtrooper = new DrawingModernMonorail((EntityModernMonorail)entity, wheels);
|
drawingBaseStormtrooper = new DrawingModernMonorail((EntityModernMonorail)entity, wheels);
|
||||||
|
@ -12,7 +12,7 @@ public class StorageCollection<T> {
|
|||||||
Set<String> keys = _storages.keySet();
|
Set<String> keys = _storages.keySet();
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
public void AddCollection(String name, CollectionType collectionType)
|
public void SetCollectionObject(String name, CollectionType collectionType)
|
||||||
{
|
{
|
||||||
if (_storages.containsKey(name)) return;
|
if (_storages.containsKey(name)) return;
|
||||||
if (collectionType == CollectionType.None) return;
|
if (collectionType == CollectionType.None) return;
|
||||||
@ -26,18 +26,12 @@ public class StorageCollection<T> {
|
|||||||
if (_storages.containsKey(name))
|
if (_storages.containsKey(name))
|
||||||
_storages.remove(name);
|
_storages.remove(name);
|
||||||
}
|
}
|
||||||
public ICollectionGenericObjects<T> getCollectionObject(String name) {
|
public ICollectionGenericObjects<T> GetCollectionObject(String name) {
|
||||||
if (_storages.containsKey(name))
|
if (_storages.containsKey(name))
|
||||||
return _storages.get(name);
|
return _storages.get(name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getObject(String name, int position) {
|
|
||||||
if(_storages.containsKey(name))
|
|
||||||
return _storages.get(name).Get(position);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T remove(String name, int position){
|
public T remove(String name, int position){
|
||||||
if(_storages.containsKey(name))
|
if(_storages.containsKey(name))
|
||||||
return _storages.get(name).Remove(position);
|
return _storages.get(name).Remove(position);
|
||||||
|
@ -105,7 +105,7 @@ public class FormAdditionalCollection extends JFrame {
|
|||||||
public void AddWheels() {
|
public void AddWheels() {
|
||||||
for (int i = 0; i < _additionalCollection.CountWheels; i++) {
|
for (int i = 0; i < _additionalCollection.CountWheels; i++) {
|
||||||
random = new Random();
|
random = new Random();
|
||||||
EntityMonorail entity = _additionalCollection._collectionEntity[i];
|
EntityMonorail entity = _additionalCollection.CollectionEntity[i];
|
||||||
DrawingWheels drawingWheels = null;
|
DrawingWheels drawingWheels = null;
|
||||||
drawingWheels = new DrawingWheels();
|
drawingWheels = new DrawingWheels();
|
||||||
drawingWheels.SetCountWheels((int) ((Math.random() * 3) + 1) * 2);
|
drawingWheels.SetCountWheels((int) ((Math.random() * 3) + 1) * 2);
|
||||||
@ -119,12 +119,12 @@ public class FormAdditionalCollection extends JFrame {
|
|||||||
this._company = company;
|
this._company = company;
|
||||||
String[] data1 = new String[_additionalCollection.CountEntities];
|
String[] data1 = new String[_additionalCollection.CountEntities];
|
||||||
for (int i = 0; i < _additionalCollection.CountEntities; i++) {
|
for (int i = 0; i < _additionalCollection.CountEntities; i++) {
|
||||||
EntityMonorail entity = _additionalCollection._collectionEntity[i];
|
EntityMonorail entity = _additionalCollection.CollectionEntity[i];
|
||||||
data1[i] = ToString(entity);
|
data1[i] = ToString(entity);
|
||||||
}
|
}
|
||||||
String[] data2 = new String[_additionalCollection.CountWheels];
|
String[] data2 = new String[_additionalCollection.CountWheels];
|
||||||
for (int i = 0; i < _additionalCollection.CountWheels; i++) {
|
for (int i = 0; i < _additionalCollection.CountWheels; i++) {
|
||||||
DrawingWheels wheels = _additionalCollection._collectionWheels[i];
|
DrawingWheels wheels = _additionalCollection.CollectionWheels[i];
|
||||||
data2[i] = ToString(wheels);
|
data2[i] = ToString(wheels);
|
||||||
}
|
}
|
||||||
listEntity.setListData(data1);
|
listEntity.setListData(data1);
|
||||||
|
@ -200,7 +200,7 @@ public class FormMonorailCollection extends JFrame{
|
|||||||
} else if (radioButtonList.isSelected()) {
|
} else if (radioButtonList.isSelected()) {
|
||||||
collectionType = CollectionType.List;
|
collectionType = CollectionType.List;
|
||||||
}
|
}
|
||||||
_storageCollection.AddCollection(textBoxCollection.getText(), collectionType);
|
_storageCollection.SetCollectionObject(textBoxCollection.getText(), collectionType);
|
||||||
RerfreshListBoxItems();
|
RerfreshListBoxItems();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -229,7 +229,7 @@ public class FormMonorailCollection extends JFrame{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ICollectionGenericObjects<DrawingMonorail> collection =
|
ICollectionGenericObjects<DrawingMonorail> collection =
|
||||||
_storageCollection.getCollectionObject(listBoxCollection.getSelectedValue().toString());
|
_storageCollection.GetCollectionObject(listBoxCollection.getSelectedValue().toString());
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
JOptionPane.showMessageDialog(null, "Коллекция не проинициализирована");
|
JOptionPane.showMessageDialog(null, "Коллекция не проинициализирована");
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user