All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cz.jalasoft.transportation.czechrailway.page.Page.scala Maven / Gradle / Ivy

The newest version!
package cz.jalasoft.transportation.czechrailway.page

import cz.jalasoft.util.text.{Fragment, TextFragment}

/**
 * Created by honzales on 8.7.15.
 */
case class Page protected(fragment : TextFragment) {

  require(fragment != null, "Text fragment must not be null")
}

object Page {

  private val MULTIPLE_TRAINS_PAGE_HINT = "
Nalezené vlaky
" private val NO_TRAIN_HINT = "Vlak nebyl nalezen." private val TRAIN_PAGE_HINT = "
Detail vlaku
"; def apply(text: String) : Page = { val fragment = Fragment.fromText(text); text match { case _ if text.contains(MULTIPLE_TRAINS_PAGE_HINT) => new MultipleTrainsPage(fragment) case _ if text.contains(NO_TRAIN_HINT) => new NoTrainPage(fragment) case _ if text.contains(TRAIN_PAGE_HINT) => new TrainDetailPage(fragment) case _ => new UnknownPage(fragment) } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy