API Reference
This file lists the public classes and their observable public members. All signatures and behaviors are taken directly from the source in src/main/java/.
br.gm.cards.App
public static Deck deck— application-wide deck instance.public void start(Stage stage) throws IOException— JavaFX lifecycle method; constructs the initialScenewith thefristOpenFXML resource and shows theStage(window). Window size is fixed to 600×600 and stage is set non-resizable in the implementation.static void setRoot(String fxml) throws IOException— replaces the current scene root with theParentloaded fromloadFXML(fxml).public static Parent loadFXML(String fxml) throws IOException— loads an FXML resource usingApp.class.getResource(fxml + ".fxml")and returns the loadedParent.public static void main(String[] args)— callslaunch().
br.gm.cards.model.Card
public Card()— no-argument constructor.public Card(String pergunta, String resposta)— constructs a card with the provided question (pergunta) and answer (resposta).public String getPergunta()/public void setPergunta(String)— getter/setter for question.public String getResposta()/public void setResposta(String)— getter/setter for answer.public String toString()andpublic String toString(int index)— string representations; literalCarta{...}is used in output.
br.gm.cards.model.Deck
- Fields (observable):
ArrayList<Card> cartas,ArrayList<Card> cartasEasy,ArrayList<Card> cartasShuffle;boolean shuffled;int dificuldade. public boolean isShuffled()— returns theshuffledflag.public int getDificuldade()/public void setDificuldade(int dificuldade)— setter modifies internal lists: whendificuldadeis 0 or 1,cartasEasyis used to resetcartas; otherwise the implementation clones and shuffles tocartasShuffleand assignscartasfromcartasShuffle.public void add(String pergunta, String resposta)— constructs a newCardand appends tocartas.public void add(Card carta)— appends an existingCardobject tocartas.public void remove(Card carta)— removes the suppliedCardfromcartas.public void remove(String questionTextField, String answerTextField)— iteratescartasand removes the firstCardwhoseperguntaequalsquestionTextFieldandrespostaequalsanswerTextField.public void removeFromShuffled(String questionTextField, String answerTextField)— same logic asremove, operated oncartasShuffle.public void remove(int index)— removes the element atindexfromcartas.public void removeAll()— callscartas.removeAll(cartas)in source; observable effect is thatcartasbecomes empty (see source for exact call).public int getIndex(Card carta)— returnscartas.indexOf(carta).public int size()— returnscartas.size().public void shuffle()— clonescartasintocartasShuffleand callsCollections.shuffle(cartasShuffle), then setsshuffled = true.public void clearShuffled()— clearscartasShuffleand setsshuffled = false.public String getPergunta(int index)— ifshuffledis true returnscartasShuffle.get(index).getPergunta(), otherwisecartas.get(index).getPergunta().public String getResposta(int index)— implementation note: whenshuffledis true the method returnscartasShuffle.get(index).getPergunta()(the question) rather than the answer; this is observable in source and documented as a known bug inREADME.md.@Override public String toString()— returns a combined representation ofcartasandcartasShuffleincludingdificuldade.
Controllers (summary of public handlers)
br.gm.cards.FristOpenController
@FXML void addFristCardAction(ActionEvent event) throws IOException— opens modal dialog to add a first card and, on success, callschangeScene(event, "home.fxml").@FXML void importDeckAction(ActionEvent event)— present but empty in source (no implementation).public void addCardToDeck(ActionEvent event)/public void removeCardFromDeck(ActionEvent event)— build and display modal dialogs to add/remove cards.public static void changeScene(ActionEvent event, String fxml) throws IOException— loads the given resource withFXMLLoader.load(FristOpenController.class.getResource(fxml))and sets it as the currentStageScene.private Card Card(String text, String text0)— in source this method throwsUnsupportedOperationExceptionand is therefore a placeholder.
br.gm.cards.HomeController
@FXML public void initialize()— initializes UI text usingdeck.size().@FXML void add(ActionEvent event),@FXML void remove(ActionEvent event),@FXML void start(ActionEvent event)— handlers for add/remove/start actions;startrequiresdeck.size() > 1, otherwise shows an errorAlert.@FXML void importDeckAction(ActionEvent event)— present but empty in source.public void selectDificulty(ActionEvent event)— shows a dialog to set difficulty using radio buttons; theHardoption is disabled in the UI.
br.gm.cards.PlayController
@FXML public void initialize()— sets initial UI state and displaysdeck.getPergunta(page).@FXML void back(ActionEvent event)/@FXML void next(ActionEvent event)— navigate between question and answer using internalpage,index, andallReadyShowQuestionstate.@FXML void exit(ActionEvent event)— callschangeScene(event, "home.fxml").
br.gm.cards.FinishController
@FXML void close(ActionEvent event)— callsPlatform.exit().@FXML void returnHome(ActionEvent event) throws IOException— opens reset dialog and callschangeScene(event, "home.fxml").public void resetDialog(ActionEvent event)— builds and shows a dialog offering to delete or shuffle the deck;Confirmaction invokesdeck.removeAll()if yes selected, otherwisedeck.shuffle().