Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  7. oraz interface:
  8. trait FlashCardsDBConnector {
  9.     def addCard(card: FlashCard, stack: StackIndetifier)
  10.     def removeCard(card: FlashCard, stack: StackIndetifier)
  11.     def swapCard(from: FlashCard, to: FlashCard, stack: StackIndetifier)
  12.    
  13.     def getCardsFromStack(stack: StackIndetifier)
  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 ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement