download:Python’s three-year-old distributed crawler, Scrapy, builds a search engine
What era is the future? It’s the data age! Data analysis services, Internet finance, data modeling, natural language processing, medical case analysis… More and more work is done based on data, and crawlers are the most important way to get data quickly, compared to other languages, Python crawler is more simple and efficient for the crowd Suitable for interested in reptiles, want to do is to develop large data but couldn’t find the data Don’t know how to set up a set of stable and reliable distributed crawler classmates Want to set up the search engine technology reserve requirements but don’t know how to proceed with classmates have a certain native crawler based Understanding the front page, object-oriented concepts, Computer network protocol and database knowledge Package com.kukudeyu. Hotelsystem; public class Room { private int id; Private String type; Private Boolean status; Public Room() {} public Room(int ID, String type, Boolean status) {this.id = id; this.type = type; this.status = status; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getType() { return type; } public void setType(String type) { this.type = type; } public boolean getStatus() { return status; } public void setStatus(boolean status) { this.status = status; } / *
- Override toString method
- Print room details, including room number, type, and status
- @override public String toString() {return “[” + this.id + “, “+ this.type +”,” + (this.status? “) + “]”; Br /> @override public Boolean equals(Object o) {if (this == o) return true; if (o == null || ! (o instanceof Room)) return false; Room room = (Room)o; if(this.id == room.id){ return true; } return false; }} Hotel (Hotel)
[
package com.kukudeyu.hotelsystem; public class Hotel { private Room[][] rooms; // Create a hotel room array with a two-dimensional array
Application structure method to stop the hotel room layout operation application array traversal, create the hotel room object into the hotel room array in which, the first floor is a single world, the second floor is a double world, the third floor is the presidential suite
/
public Hotel() {
rooms = new Room[3][10];
for (int i = 0; i < rooms.length; i++) {
for (int j = 0; j < rooms[i].length; j++) {
if (i == 0) {
rooms[i][j] = new Room((i + 1)
100 + j + 1, “single world “, true); } else if (i == 1) { rooms[i][j] = new Room((i + 1)
100 + j + 1, “Double world “, true); } else if (i == 2) { rooms[i][j] = new Room((i + 1)
100 + j + 1, “Presidential suite “, true); }}}} /
](mailto:br/%3E@Override%3Cbr/)