Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (8)
Showing
with 668 additions and 0 deletions
!SESSION 2021-03-18 14:28:21.841 -----------------------------------------------
eclipse.buildId=4.18.0.I20201202-1800
java.version=15.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY org.eclipse.jface 2 0 2021-03-18 14:28:35.852
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2021-03-18 14:28:35.852
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
Open a type in a Java editor,
Category(org.eclipse.ui.category.navigate,Navigate,null,true),
org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5b895e76,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
,
Category(org.eclipse.lsp4e.category,Language Servers,null,true),
org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@74231642,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!ENTRY org.eclipse.egit.ui 2 0 2021-03-18 14:28:45.302
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\benja'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
package defaultpackage;
public interface Structure
{
public void Add(int value);
public void RemoveTete() throws Exception;
public void RemoveMiddle() throws Exception;
public int Get(int index) throws Exception;
public int GetLenght();
}
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
org.eclipse.jdt.core.compiler.compliance=15
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=15
package StandardStructure;
public class LinkedListC {
}
package defaultpackage;
public interface Structure
{
public void Add(int value);
public void RemoveTete() throws Exception;
public void RemoveMiddle() throws Exception;
public int Get(int index) throws Exception;
public int GetLenght();
}
package PersonalStructure;
import defaultpackage.Structure;
public class ChainedList implements Structure {
protected Link head;
protected Cursor cursor;
public int nbVal = 0;
//
// public ChainedList(Link head, Cursor cursor) {
// this.head = head;
// this.cursor = cursor;
// this.nbVal = 1;
// }
public ChainedList(Cursor cursor) {
this.cursor = cursor;
this.nbVal = 0;
}
public void setNextLink(Link currentLink)
{
Link last_next = this.cursor.currentLink.next;
this.cursor.currentLink.next = currentLink;
nbVal+=1;
}
public void setPreviousLink(Link currentLink)
{
Link last_next = this.cursor.currentLink.next;
this.cursor.currentLink.next = currentLink;
nbVal+=1;
}
public Link getLink()
{
return this.cursor.currentLink;
}
public Link getNextLink()
{
return this.cursor.currentLink.next;
}
public Link getPreviousLink(Link currentLink)
{
return this.cursor.currentLink.next;
}
public void replaceCursor(int position)
{
this.cursor.currentList = this;
this.cursor.position(position);
}
public boolean isEmpty() {
boolean res = false;
if(this.nbVal != 0)
res = true;
return res;
}
@Override
public void Add(int value) {
if (nbVal == 0) {
Link new_link = new Link(value);
this.head = new_link;
this.head.last = new_link;
this.cursor.currentLink = new_link;
this.head.next = new_link;
}
else {
this.replaceCursor(this.nbVal);
Link last_before_added = this.cursor.currentLink.last;
Link next_after_added = this.head;
Link new_link = new Link(value, next_after_added, last_before_added);
last_before_added.next = new_link;
this.head.last = new_link;
this.cursor.currentLink = new_link;
}
this.nbVal += 1;
}
public int GetNbVal()
{
return this.nbVal;
}
@Override
public void RemoveTete() throws Exception {
this.replaceCursor(nbVal - 1);
Link last_of_remove = this.cursor.currentLink.last;
Link next_of_remove = this.cursor.currentLink.next;
last_of_remove.next = next_of_remove;
next_of_remove.last = last_of_remove;
this.cursor.currentLink = next_of_remove;
}
@Override
public int Get(int index) throws Exception {
if ((index < 0) && isEmpty())
throw new IndexOutOfBoundsException("Wrong position");
this.replaceCursor(index);
return this.cursor.currentLink.value;
}
@Override
public void RemoveMiddle() throws Exception
{
if(nbVal%2==0)
{
// TODO Auto-generated method stub
this.replaceCursor(nbVal / 2);
Link last_of_remove = this.cursor.currentLink.last;
Link next_of_remove = this.cursor.currentLink.next;
last_of_remove.next = next_of_remove;
next_of_remove.last = last_of_remove;
this.cursor.currentLink = next_of_remove;
}
else
{
// TODO Auto-generated method stub
this.replaceCursor((nbVal-1) / 2);
Link last_of_remove = this.cursor.currentLink.last;
Link next_of_remove = this.cursor.currentLink.next;
last_of_remove.next = next_of_remove;
next_of_remove.last = last_of_remove;
this.cursor.currentLink = next_of_remove;
}
}
@Override
public int GetLenght() {
// TODO Auto-generated method stub
return nbVal;
}
}
package defaultpackage;
import java.math.BigInteger;
import java.util.Random;
import com.sun.jdi.Type;
import PersonalStructure.ChainedList;
import PersonalStructure.Cursor;
import StandardStructure.ArrayListC;
import StandardStructure.LinkedListC;
import StandardStructure.Table;
public class Main {
Type tab;
public static void main(String[] args) throws NumberFormatException, Exception {
// TODO Auto-generated method stub
GenerateTab(args[0], Integer.parseInt(args[1]), args[2], Integer.parseInt(args[3]));
}
public static void GenerateTab(String type, int nbValue, String methode, Integer nbOperation) throws Exception
{
Random rnd = new Random();
if(type.equals("Tableau"))
{
Table tab = new Table(nbValue);
switch(methode)
{
case "Add":
{
for(int i = 0; i < nbOperation; i++)
{
tab.Add(rnd.nextInt());
}
break;
}
case"RemoveTete":
{
for(int i = 0; i < nbOperation; i++)
{
tab.RemoveTete();
}
break;
}
case"RemoveMiddle":
{
for(int i = 0; i < nbOperation; i++)
{
tab.RemoveMiddle();
}
break;
}
case "Get":
{
for(int i = 0; i < nbOperation; i++)
{
tab.Get(rnd.nextInt(tab.GetLenght()-1));
}
break;
}
}
}
if(type.equals("Array")) {
ArrayListC array = new ArrayListC(nbValue);
switch(methode)
{
case "Add":
{
for(int i = 0; i < nbOperation; i++)
{
array.Add(rnd.nextInt());
}
break;
}
case"RemoveTete":
{
for(int i = 0; i < nbOperation; i++)
{
array.RemoveTete();
}
break;
}
case"RemoveMiddle":
{
for(int i = 0; i < nbOperation; i++)
{
array.RemoveMiddle();
}
break;
}
case "Get":
{
for(int i = 0; i < nbOperation; i++)
{
array.Get(rnd.nextInt(array.GetLenght()));
}
break;
}
}
}
if(type.equals("Linked"))
{
LinkedListC linked = new LinkedListC(nbValue);
switch(methode)
{
case "Add":
{
for(int i = 0; i < nbOperation; i++)
{
linked.Add(rnd.nextInt());
}
break;
}
case"RemoveTete":
{
for(int i = 0; i < nbOperation; i++)
{
linked.RemoveTete();
}
break;
}
case"RemoveMiddle":
{
for(int i = 0; i < nbOperation; i++)
{
linked.RemoveMiddle();
}
break;
}
case "Get":
{
for(int i = 0; i < nbOperation; i++)
{
linked.Get(rnd.nextInt(linked.GetLenght()-1));
}
break;
}
}
}
if(type.equals("Maillon"))
{
Cursor cursor = new Cursor();
ChainedList maillons = new ChainedList(cursor);
Random rndMaillon = new Random();
for(int i = 0; i < nbValue; i++) {
maillons.Add(rndMaillon.nextInt());
}
switch(methode)
{
case "Add":
{
for(int i = 0; i < nbOperation; i++)
{
maillons.Add(rnd.nextInt());
}
break;
}
case"RemoveTete":
{
for(int i = 0; i < nbOperation; i++)
{
maillons.RemoveTete();
}
break;
}
case"RemoveMiddle":
{
for(int i = 0; i < nbOperation; i++)
{
maillons.RemoveMiddle();
}
break;
}
case "Get":
{
for(int i = 0; i < nbOperation; i++)
{
maillons.Get(rnd.nextInt(maillons.GetLenght()-1));
}
break;
}
}
}
}
}
package StandardStructure;
import java.util.Random;
import defaultpackage.Structure;
public class Table implements Structure
{
Integer[] tab;
Integer nbValue = 0;
public Table(int nbValue)
{
Random rnd = new Random();
tab = new Integer[nbValue];
for(int i = 0; i < nbValue;i++)
{
Add(rnd.nextInt());
}
}
@Override
public void Add(int value) {
// TODO Auto-generated method stub
if(nbValue < tab.length)
{
tab[nbValue] = value;
nbValue++;
}
else
{
Integer[] temp = new Integer[nbValue * 2];
for(int i = 0; i < nbValue; i++)
{
temp[i] = tab[i];
}
temp[nbValue] = value;
tab=temp;
}
}
@Override
public void RemoveTete() throws Exception
{
// TODO Auto-generated method stub
try
{
for(int y = 1; y<tab.length;y++)
{
tab[y-1] = tab[y];
}
nbValue--;
}
catch(IndexOutOfBoundsException e)
{
throw new Exception("L'index dfini ne se situe pas dans les bornes du tableau");
}
}
@Override
public int Get(int index) throws Exception
{
// TODO Auto-generated method stub
try
{
return tab[index];
}
catch(IndexOutOfBoundsException e)
{
throw new Exception("L'index dfini ne se situe pas dans les bornes du tableau");
}
catch(NullPointerException e)
{
throw new Exception("Tableau n'existe pas");
}
}
@Override
public void RemoveMiddle() throws Exception
{
// TODO Auto-generated method stub
if(tab.length%2==0)
{
tab[tab.length/2]=null;
}
else
{
tab[(tab.length - 1)/2]=null;
}
int i = 0;
while(tab[i] != null)
{
i++;
}
for(int y = i+1; y<tab.length-1;y++)
{
tab[y-1] = tab[y];
}
}
@Override
public int GetLenght() {
// TODO Auto-generated method stub
return nbValue;
}
}
package StandardStructure;
public class ArrayListC {
}
package PersonalStructure;
public class ChainedList {
}
package (defaultpackage);
public interface Structure
{
public void Add(int value);
public void RemoveTete() throws Exception;
public void RemoveMiddle() throws Exception;
public int Get(int index) throws Exception;
public int GetLenght();
}
package StandardStructure;
import java.util.LinkedList;
import java.util.Random;
import defaultpackage.Structure;
public class LinkedListC implements Structure
{
LinkedList<Integer> linkedList;
public LinkedListC(int nbValue)
{
Random rnd = new Random();
linkedList = new LinkedList<Integer>();
for(int i = 0; i < nbValue; i++) {
Add(rnd.nextInt());
}
}
@Override
public void Add(int value) {
// TODO Auto-generated method stub
linkedList.add(value);
}
@Override
public void RemoveTete() throws Exception {
// TODO Auto-generated method stub
try
{
linkedList.remove(linkedList.size() - 1);
}
catch(IndexOutOfBoundsException e)
{
throw new Exception("L'index dfini ne se situe pas dans les bornes du tableau");
}
}
@Override
public int Get(int index) throws Exception
{
// TODO Auto-generated method stub
try
{
return linkedList.get(index);
}
catch(IndexOutOfBoundsException e)
{
throw new Exception("L'index dfini ne se situe pas dans les bornes du tableau");
}
}
@Override
public void RemoveMiddle() throws Exception {
// TODO Auto-generated method stub
if(linkedList.size()%2==0) {
linkedList.remove(linkedList.size()/2);
}
else {
linkedList.remove((linkedList.size()-1)/2);
}
}
@Override
public int GetLenght() {
// TODO Auto-generated method stub
return linkedList.size();
}
}