SHOW:
|
|
- or go back to the newest paste.
1 | Mam klasę: | |
2 | class FlashCard(val langFromTo: (String,String), val question: String, val answer: String) | |
3 | // np. FlashCard( ("POL", "ENG"), "zielony", "green") | |
4 | ||
5 | class StackIndetifier(val name: String) | |
6 | - | trait CardsStack { |
6 | + | |
7 | oraz interface: | |
8 | trait FlashCardsDBConnector { | |
9 | - | def swapCard(from: FlashCard, to: FlashCard) |
9 | + | def addCard(card: FlashCard, stack: StackIndetifier) |
10 | def removeCard(card: FlashCard, stack: StackIndetifier) | |
11 | def swapCard(from: FlashCard, to: FlashCard, stack: StackIndetifier) | |
12 | - | def getAllRandomed() |
12 | + | |
13 | - | def getNextCard() |
13 | + | def getCardsFromStack(stack: StackIndetifier) |
14 | - | def getRandomCard() |
14 | + | |
15 | class CardsStack(val name: String, val cards: Array[FlashCard], DBConnector: FlashCardsDBConnector) { | |
16 | def addCard(card: FlashCard) | |
17 | def removeCard(card: FlashCard) | |
18 | def swapCard(from: FlashCard) | |
19 | ||
20 | def getAll() | |
21 | def getAllSchuffled() | |
22 | def getNext() | |
23 | def getRandom() | |
24 | } | |
25 | Chcę, żeby ten play obsługiwał mi Tak jakby kupkę "fiszek". Pytanko jest, czy ja mam ten interfejs implementować bezpośrednio obsługując wywołania SQL ? Czy robić jakąś pośredniczącą klasę, czy to nie ma sensu ? |