package com.icloud.server.scala.engine.web

import com.icloud.server.utils.JsonUtils

import java.util
import java.util.regex.{Matcher, Pattern}
import scala.collection.convert.ImplicitConversions.`seq AsJavaList`

object test {
  def main(args: Array[String]): Unit = {
//    var result="asd"
//    val map = new util.HashMap[String,String]()
//    map.put("attau",result)
//    val str = JsonUtils.toJsonString(map)
//    println(str)
//    var word = "@@全部内容"
//    val result = word.search("全部内容")
//    console.log(word.search("全部内容") != -1)
    var u="http://pay.finekaa.com/#/?ditch=1578582016&goodsid=284406742828216320&phone=1"
    val s = u.split("\\//").toList(1)
    println(s)

    val a = new AA("q", new BB("q", "1"))
    val b = new AA("2", new BB("c", "2"))
    val c = new AA("3", new BB("d", "3"))
//    var si=Set(1,2,3,4,5,6)
//    var s1=Set()
//    val value = si.filter(x => x == 1).toSet

//        var si=Set(a,b,c)
//    println(si)
//    val value = si.filter(x => x.b.a.equals("c")).toSet
//        println(value)

    val cc = new CC(List(a, b),"")
    val c1 = new CC(List( c),"")
    var dd=new DD(List(cc,c1))
//    println(dd)
//    dd.cc.map(x=>{x.aas= x.aas.filter(y=>{y.a=="2"})}).filter(x=>{x.!=(null)})
//
//    println(dd)
val dd1 = setaa(dd)
    println(dd1)
//    r
//    var s="asdasdasd aas"
//    println(s.hashCode)
//    println(patterns("1qweqwe", "1qweqweasdas"))
//    println(patterns("1qweqweasdas", "1qweqwe"))

//    请求url = http://pay.finekaa.com/?code=031eUSkl2420B94onZkl2UsF400eUSkn&state=1
//      数据库域名:http://pay.finekaa.com
//      域名校验结果:false
//    var s1="http://pay.finekaa.com/?code=031eUSkl2420B94onZkl2UsF400eUSkn&state=1"
//    var s2="http://pay.finekaa.com"
//    println(patterns(s1, s2))
//    println(patterns(s2, s1))



  }
  def setaa(d:DD): DD ={

    val value = d.cc.filter(x => {
      x.ff = "1123122"
      true
    })
    new DD(value)
  }
  def patterns(param1:String,param2:String): Boolean ={
    var boolean=false
    val pattern = Pattern.compile( param1 )
    val matcher: Matcher = pattern.matcher( param2 )
    boolean = matcher.find
    boolean
  }

  def r(): Unit ={
    var wxpays=List(1,2,1,5,4)
    var random=4
    var start: Int = 0
    var end: Int = 0
    var ni: Int = 1
    var wx=wxpays.last
    while (ni < wxpays.size) {
      if (ni == 1) { //初始化
        start = wxpays(ni - 1)
        end = wxpays(ni - 1) + wxpays(ni)
      } else {
        start = end
        end = start + wxpays(ni)
      }
      if (random >= start && random < end) {
        wx= wxpays(ni)
        ni= wxpays.size+1
      }
      else if (random < start) {
        wx= wxpays.get(ni - 1)
        ni= wxpays.size+1
      }
      ni+=1
    }
    println(wx)
  }
}
case class AA(a:String,b:BB)

case class BB(a:String,b:String)

case class CC(var aas: List[AA],var ff:String)
case class DD(cc: List[CC])