parent
5d9ada3edd
commit
6265dd9c58
@ -1,3 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* @file CustomJokeStub.ts
|
||||||
|
* @brief Exemple d'utilisation de la classe JokeFactory pour créer des blagues personnalisées.
|
||||||
|
*/
|
||||||
|
|
||||||
import { JokeFactory } from '../../model/JokeFactory';
|
import { JokeFactory } from '../../model/JokeFactory';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stub de blagues personnalisées créées à l'aide de la classe JokeFactory.
|
||||||
|
* @constant
|
||||||
|
* @type {CustomJoke[]}
|
||||||
|
*/
|
||||||
export const customJokeStub = JokeFactory.createCustomJokes('[{"id":"1", "type":"custom", "setup":"one", "punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"},{"id":"2", "type":"custom", "setup":"two","punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"},{"id":"3", "type":"Default", "setup":"three","punchline":"y\'en toujours a pas ;)", "image":"https://placekitten.com/200/300"},{"id":"4", "type":"custom bro", "setup":"four","punchline":"y\'en toujours toujours ap", "image":"https://placekitten.com/200/300"}]');
|
export const customJokeStub = JokeFactory.createCustomJokes('[{"id":"1", "type":"custom", "setup":"one", "punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"},{"id":"2", "type":"custom", "setup":"two","punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"},{"id":"3", "type":"Default", "setup":"three","punchline":"y\'en toujours a pas ;)", "image":"https://placekitten.com/200/300"},{"id":"4", "type":"custom bro", "setup":"four","punchline":"y\'en toujours toujours ap", "image":"https://placekitten.com/200/300"}]');
|
@ -1,2 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* @file SampleJokeStub.ts
|
||||||
|
* @brief Exemple d'utilisation de la classe JokeFactory pour créer des blagues simples.
|
||||||
|
*/
|
||||||
|
|
||||||
import { JokeFactory } from '../../model/JokeFactory';
|
import { JokeFactory } from '../../model/JokeFactory';
|
||||||
export const sampleJokeStub = JokeFactory.createCustomJokes('[{"id":1, "type":"custom", "setup":"one", "punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"},{"id":2, "type":"custom", "setup":"two","punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"}]');
|
|
||||||
|
/**
|
||||||
|
* @brief Stub de blagues simples créées à l'aide de la classe JokeFactory.
|
||||||
|
* @constant
|
||||||
|
* @type {SampleJoke[]}
|
||||||
|
*/
|
||||||
|
export const sampleJokeStub = JokeFactory.createSampleJokes('[{"id":1, "type":"custom", "setup":"one", "punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"},{"id":2, "type":"custom", "setup":"two","punchline":"y\'en a pas", "image":"https://placekitten.com/200/300"}]');
|
@ -1,17 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file SampleJoke.ts
|
||||||
|
* @brief Définition de la classe SampleJoke.
|
||||||
|
*/
|
||||||
|
|
||||||
import { Joke } from "./Joke";
|
import { Joke } from "./Joke";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
* @brief Classe représentant une blague d'échantillon.
|
||||||
|
* @extends Joke
|
||||||
|
*/
|
||||||
export class SampleJoke extends Joke {
|
export class SampleJoke extends Joke {
|
||||||
private _id:number;
|
private _id: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Constructeur de la classe SampleJoke.
|
||||||
|
* @param {number} id - L'identifiant de la blague d'échantillon.
|
||||||
|
* @param {string} type - Le type de la blague.
|
||||||
|
* @param {string} setup - La partie préliminaire de la blague.
|
||||||
|
* @param {string} punchline - La chute de la blague.
|
||||||
|
* @param {string} image - L'URL de l'image associée à la blague.
|
||||||
|
*/
|
||||||
constructor(id: number, type: string, setup: string, punchline: string, image: string) {
|
constructor(id: number, type: string, setup: string, punchline: string, image: string) {
|
||||||
super(type, setup, punchline, image); // Assuming Joke class has these properties
|
super(type, setup, punchline, image); // Assuming Joke class has these properties
|
||||||
this._id = id;
|
this._id = id;
|
||||||
}
|
}
|
||||||
get id():number {
|
|
||||||
|
/**
|
||||||
|
* @brief Obtient l'identifiant de la blague d'échantillon.
|
||||||
|
* @return {number} L'identifiant de la blague d'échantillon.
|
||||||
|
*/
|
||||||
|
get id(): number {
|
||||||
return this._id;
|
return this._id;
|
||||||
}
|
}
|
||||||
set id(id:number) {
|
|
||||||
|
/**
|
||||||
|
* @brief Modifie l'identifiant de la blague d'échantillon.
|
||||||
|
* @param {number} id - Le nouvel identifiant de la blague d'échantillon.
|
||||||
|
*/
|
||||||
|
set id(id: number) {
|
||||||
this._id = id;
|
this._id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Obtient une description textuelle de la blague d'échantillon.
|
||||||
|
* @return {string} Une description textuelle de la blague d'échantillon.
|
||||||
|
*/
|
||||||
description(): string {
|
description(): string {
|
||||||
return `ID: ${this.id}, Setup: ${this.setup}, Punchline: ${this.punchline}`;
|
return `ID: ${this.id}, Setup: ${this.setup}, Punchline: ${this.punchline}`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue