zzzz
This commit is contained in:
parent
93e7709d02
commit
b5bd096192
3
.idea/.idea/.gitignore
vendored
Normal file
3
.idea/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
1
.idea/.idea/.name
Normal file
1
.idea/.idea/.name
Normal file
@ -0,0 +1 @@
|
||||
untitled.iml
|
6
.idea/.idea/inspectionProfiles/Project_Default.xml
Normal file
6
.idea/.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AssignmentToNull" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
6
.idea/.idea/misc.xml
Normal file
6
.idea/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="corretto-19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/.idea/modules.xml
Normal file
8
.idea/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/untitled.iml" filepath="$PROJECT_DIR$/untitled.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/.idea/vcs.xml
Normal file
6
.idea/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
37
.idea/src/ArrayBabble.java
Normal file
37
.idea/src/ArrayBabble.java
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
.idea/src/Atd.java
Normal file
10
.idea/src/Atd.java
Normal file
@ -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();
|
||||
}
|
84
.idea/src/List.java
Normal file
84
.idea/src/List.java
Normal file
@ -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;
|
||||
// }
|
||||
}
|
16
.idea/src/ListElements.java
Normal file
16
.idea/src/ListElements.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
23
.idea/src/Main.java
Normal file
23
.idea/src/Main.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
11
.idea/untitled.iml
Normal file
11
.idea/untitled.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -2,5 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/untitled" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
1
untitled
1
untitled
@ -1 +0,0 @@
|
||||
Subproject commit 00da6ce2f3010c1a4dc4bf5954a55dc2cf9d3dab
|
Loading…
Reference in New Issue
Block a user