From b5bd096192d0cffc3c43584b847da8bb1ad4afc9 Mon Sep 17 00:00:00 2001 From: Garifullin-Farid <95081032+Garifullin-Farid@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:10:57 +0400 Subject: [PATCH] zzzz --- .idea/.idea/.gitignore | 3 + .idea/.idea/.name | 1 + .../inspectionProfiles/Project_Default.xml | 6 ++ .idea/.idea/misc.xml | 6 ++ .idea/.idea/modules.xml | 8 ++ .idea/.idea/vcs.xml | 6 ++ .idea/src/ArrayBabble.java | 37 ++++++++ .idea/src/Atd.java | 10 +++ .idea/src/List.java | 84 +++++++++++++++++++ .idea/src/ListElements.java | 16 ++++ .idea/src/Main.java | 23 +++++ .idea/untitled.iml | 11 +++ .idea/vcs.xml | 1 + untitled | 1 - 14 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 .idea/.idea/.gitignore create mode 100644 .idea/.idea/.name create mode 100644 .idea/.idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/.idea/misc.xml create mode 100644 .idea/.idea/modules.xml create mode 100644 .idea/.idea/vcs.xml create mode 100644 .idea/src/ArrayBabble.java create mode 100644 .idea/src/Atd.java create mode 100644 .idea/src/List.java create mode 100644 .idea/src/ListElements.java create mode 100644 .idea/src/Main.java create mode 100644 .idea/untitled.iml delete mode 160000 untitled diff --git a/.idea/.idea/.gitignore b/.idea/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.idea/.name b/.idea/.idea/.name new file mode 100644 index 0000000..cd39c06 --- /dev/null +++ b/.idea/.idea/.name @@ -0,0 +1 @@ +untitled.iml \ No newline at end of file diff --git a/.idea/.idea/inspectionProfiles/Project_Default.xml b/.idea/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..72d5831 --- /dev/null +++ b/.idea/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea/misc.xml b/.idea/.idea/misc.xml new file mode 100644 index 0000000..45b76e1 --- /dev/null +++ b/.idea/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea/modules.xml b/.idea/.idea/modules.xml new file mode 100644 index 0000000..3007dae --- /dev/null +++ b/.idea/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea/vcs.xml b/.idea/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/src/ArrayBabble.java b/.idea/src/ArrayBabble.java new file mode 100644 index 0000000..2ed0030 --- /dev/null +++ b/.idea/src/ArrayBabble.java @@ -0,0 +1,37 @@ +class ArrayBubble{ + private long[] a; //ссылка на массив + private int elems; //количество элементов в массиве + + public ArrayBubble(int max){ + a = new long[max]; + elems = 0; + } + + public void into(long value){ + a[elems] = value; + elems++; + } + + public void printer(){ + for (int i = 0; i < elems; i++){ + System.out.print(a[i] + " "); + System.out.println(" "); + } + System.out.println("---------------"); + } + + private void toSwap(int first, int second){ + long dummy = a[first]; + a[first] = a[second]; + a[second] = dummy; + } + + public void bubbleSorter(){ + for (int j = elems - 1; j >= 1; j--){ + for (int i = 0; i < j; i++){ + if(a[i] > a[i + 1]) + toSwap(i, i + 1); + } + } + } +} \ No newline at end of file diff --git a/.idea/src/Atd.java b/.idea/src/Atd.java new file mode 100644 index 0000000..e4d4adf --- /dev/null +++ b/.idea/src/Atd.java @@ -0,0 +1,10 @@ +public interface Atd { + + void addFront(int id,int year,String name,String genre,String county); + + void addBack(int id,int year,String name,String genre,String county); + + ListElements getFront(); + + ListElements getBack(); +} diff --git a/.idea/src/List.java b/.idea/src/List.java new file mode 100644 index 0000000..189fe66 --- /dev/null +++ b/.idea/src/List.java @@ -0,0 +1,84 @@ + +public class List implements Atd { + private ListElements head; // указатель на первый элемент + private ListElements tail; // указатель последний элемент + + + void IsEmpty() { + if(head == null) { + System.out.println("cписок пуст"); + } + } + + @Override + public void addFront(int id,int year,String name,String genre,String county) //добавить спереди + { + ListElements a = new ListElements(id,year,name,genre,county); + if(head == null) + { + head = a; + tail = a; + } + else { + a.next = head; + head = a; + } + } + @Override + public void addBack(int id,int year,String name,String genre,String county) { //добавление в конец списка + ListElements a = new ListElements(id,year,name,genre,county); + if (tail == null) + { + head = a; + tail = a; + } else { + tail.next = a; + tail = a; + } + } + + @Override + public ListElements getFront() { + if (head == null) + { + ;ListElements a = null; + return a; + } + ListElements a = this.head; + return a; + } + + @Override + public ListElements getBack() { + if (tail == null) + { + ;ListElements a = null; + return a; + } + ListElements a = this.tail; + return a; + } + + void printList() + { + ListElements t = this.head; + while (t != null) + { + System.out.print(t.Id + " "+ t.Year+" " +t.Name+" "+t.Genre+" "+t.Country+" \n"); + t = t.next; + } + System.out.println(); + } + void delFrontEl() { + if (head == null) return; + head = head.next; + + } +// void delBackEl() +// { +// if(tail == null) +// return; +// +// tail = head.next; +// } +} \ No newline at end of file diff --git a/.idea/src/ListElements.java b/.idea/src/ListElements.java new file mode 100644 index 0000000..8971a9a --- /dev/null +++ b/.idea/src/ListElements.java @@ -0,0 +1,16 @@ +public class ListElements { + ListElements next; // указатель на следующий элемент + int Id; + int Year; + String Name; + String Genre; + String Country; + + public ListElements (int id,int year,String name,String genre,String county){ + this.Id = id; + this.Year = year; + this.Name = name; + this.Genre = genre; + this.Country = county; + } +} \ No newline at end of file diff --git a/.idea/src/Main.java b/.idea/src/Main.java new file mode 100644 index 0000000..4bfaa5e --- /dev/null +++ b/.idea/src/Main.java @@ -0,0 +1,23 @@ +public class Main { + public static void main(String[] args) { + List ml = new List(); + ml.addFront(10,1993,"AAA","BBBB","CCC"); + ml.printList(); + ml.delFrontEl(); + ml.IsEmpty(); + ml.addFront(9,1993,"AAA","BBBB","CCC"); + ml.addBack(1,1990,"AAA","BBB","CCCC"); + ml.addBack(2,1991,"AAA","BXBB","CC"); + ml.addBack(3,1992,"AA","BBB","CiCi"); + + + ml.printList(); + System.out.println(); + + + + + + System.out.println(); + } +} \ No newline at end of file diff --git a/.idea/untitled.iml b/.idea/untitled.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/.idea/untitled.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1dd..11ac517 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/untitled b/untitled deleted file mode 160000 index 00da6ce..0000000 --- a/untitled +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 00da6ce2f3010c1a4dc4bf5954a55dc2cf9d3dab