Beispiel #1
0
func main() {
	
	c := runtime.NumCPU() * 2
	runtime.GOMAXPROCS(1)
	conn := client.MustConn("")
	argsWithoutProg := os.Args[1:]
	var i info
	common.MustJSONDecode([]byte(argsWithoutProg[0]), &i)
	r := everything.RGet(i.rideID)
	fmt.Println(r.Name)
	p, _ := everything.GetG(append([]byte{0},[]byte{0}[0],[]byte{0}[0]))
	count := 0
	t := true
	fmt.Print("[")
	for i := r.CurTrip; i < len(r.Times); i++ {
		if r.Capacity - r.Capacities[i] > 2 {
			a := r.GetTimeRange(i)
			for j := 0; j < len(p.Times); j++ {
				if between(a[0], a[1], p.Times[j][0], p.Times[j][1]) {
					t = false
				}
			}
			if t {
				conn.Put([]byte(strconv.Itoa(i)),common.MustJSONEncode(p.Times[j]))
				conn.Put([]byte(strconv.Itoa(i) + "r"),common.MustJSONEncode(r.K)
				fmt.Print("{" + r.Name + ":" + " [" + getTime(p.Times[j][0]) + "," + getTime(p.Times[j][1]) + "],id:" + strconv.Itoa(i) +  "},")
				count += 1
			}
		}
		if count == 3 { break }
	}
	fmt.Print("]")


}
Beispiel #2
0
func main() {
	a := (s(3, 30, 50, 20, 27))
	fmt.Println(a)
	fmt.Println(a)
	conn := client.MustConn("localhost:9191")
	bytes := common.MustJSONEncode(a)
	conn.Put(murmur.HashString("hi"), bytes)
}