diff --git a/README.md b/README.md index 0a4ca0d..ede5d5c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,14 @@ # HyperSet -2nd Year Project of IT BUT in Aubière - -Created by : - +## Description of the project + +2nd Year Project of IT BUT in Aubière + +## Subject + + +[link of the initial project](https://codefirst.iut.uca.fr/git/cedric.bouhours/Projets_SAE_S4/src/branch/master/Projets/Projet_11.md) + +## Created by : + LACOTE Raphaël JAULT Aurian ARNAL Rémi JACQUELIN Bastien \ No newline at end of file diff --git a/src/Console/Console.html b/src/Console/Console.html new file mode 100644 index 0000000..949c519 --- /dev/null +++ b/src/Console/Console.html @@ -0,0 +1,22 @@ + + + + + + + Console + + + +

Console - test

+ +
+ +
+ + + + + + + \ No newline at end of file diff --git a/src/Console/main.js b/src/Console/main.js new file mode 100644 index 0000000..936ce4b --- /dev/null +++ b/src/Console/main.js @@ -0,0 +1,28 @@ +// import { Card5 } from "../Model/Card5"; +// import('../Model/Card5'); +//import {Card} from '../Model/Card'; + +console.log("~#Test#~"); +let card4 = new Card('red','2','losange','full'); +console.group('Carte 4 attributes'); +console.log(`carte de 4 elements : ${card4.color}`); +console.groupEnd(); +let card5 = new Card5('blue','2','losange','full','pointillet'); +console.group('Carte 5 attributes'); +console.log(`carte de 5 elements : ${card5.outline}`); +console.log(`carte de 5 éléments instance de 5: ${card5 instanceof Card5}`); +console.log(`carte de 5 éléments accès par méthode idx 0: ${card5.getAttributes()[0]}`); +console.log(`carte de 5 éléments accès par méthode idx 4: ${card5.getAttributes()[4]}`); +console.groupEnd(); +console.group('Error'); +try { + let errCard = new Card5('blue','','losange','full','pointillet'); +}catch(errCard){ + if(errCard instanceof EmptyParamaterException){ + console.log('Error in constructor'); + } + else{ + console.error(errCard); + } +} +console.groupEnd(); diff --git a/src/Model/Card.js b/src/Model/Card.js new file mode 100644 index 0000000..d7da58b --- /dev/null +++ b/src/Model/Card.js @@ -0,0 +1,33 @@ +class Card{ + constructor(color, number, shape, filling){ + if(!color){ + throw new EmptyParamaterException('Color'); + } + if(!number){ + throw new EmptyParamaterException('Number'); + } + if(!shape){ + throw new EmptyParamaterException('Shape'); + } + if(!filling){ + throw new EmptyParamaterException('Filling'); + } + this.color=color; + this.number=number; + this.shape=shape; + this.filling=filling; + } + /** + * @returns array of all attributes : + idx 1 : color + idx 2 : number + idx 3 : shape + idx 4 : filling + idx 5 : null + * @author Bastien Jacquelin + */ + getAttributes(){ + return [this.color,this.number,this.shape,this.filling]; + } + +}//export {Card} \ No newline at end of file diff --git a/src/Model/Card5.js b/src/Model/Card5.js new file mode 100644 index 0000000..b9d7894 --- /dev/null +++ b/src/Model/Card5.js @@ -0,0 +1,25 @@ +// import('.Card'); + +class Card5 extends Card { + constructor(color, number, shape, filling, outline){ + super(color,number,shape,filling); + if(!outline){ + throw new EmptyParamaterException('Outline'); + } + this.outline=outline; + } + /** + * @returns array of all attributes : + idx 1 : color + idx 2 : number + idx 3 : shape + idx 4 : filling + idx 5 : outline + * @author Bastien Jacquelin + */ + getAttributes(){ + // return [this.color,this.number,this.shape,this.filling,this.outline]; + return super.getAttributes().concat(this.outline); + } +} +// export {Card5}; \ No newline at end of file diff --git a/src/Model/emptyParameterException.js b/src/Model/emptyParameterException.js new file mode 100644 index 0000000..f1a7346 --- /dev/null +++ b/src/Model/emptyParameterException.js @@ -0,0 +1,5 @@ +class EmptyParamaterException extends Error{ + constructor(field){ + super(`Field ${field} missing`); + } +} \ No newline at end of file