whyclj
2020-08-05 343ce79c0364f84e15ee785ffdade8bc5e8f47f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.motor.data;
 
import java.util.ArrayList;
import java.util.List;
 
import com.mchange.v1.util.Sublist;
import com.motor.alarm.Motor_Alarm;
 
public class Motor_inf {
    
    public int motor_id;                            //µç»úid
    public String motor_name;                        //µç»úÃû³Æ
    public int motor_type;                            //µç»úÀàÐÍ
    public String motor_ip;                            //µç»úip
    public String note;                                //±¸ÓÃ
    
    public Load_motor_state load_state;                //¼ÓÔØµç»ú״̬
    public Subject_motor_state subject_state;        //ÊÜÊÔµç»ú״̬
    
    public List<Motor_Alarm> alarms;
    
    public Motor_inf(int motor_id) {
        this.motor_id = motor_id;
        alarms = new ArrayList<Motor_Alarm>();
        load_state = new Load_motor_state(motor_id);
        subject_state = new Subject_motor_state(motor_id);
    }
    
    public int getMotor_id() {
        return motor_id;
    }
    public String getMotor_name() {
        return motor_name;
    }
    public int getMotor_type() {
        return motor_type;
    }
    public String getMotor_ip() {
        return motor_ip;
    }
    public String getNote() {
        return note;
    }
    public void setMotor_id(int motor_id) {
        this.motor_id = motor_id;
    }
    public void setMotor_name(String motor_name) {
        this.motor_name = motor_name;
    }
    public void setMotor_type(int motor_type) {
        this.motor_type = motor_type;
    }
    public void setMotor_ip(String motor_ip) {
        this.motor_ip = motor_ip;
    }
    public void setNote(String note) {
        this.note = note;
    }
    
    /**
     *     »ñÈ¡µ±Ç°µç»ú¶ÔÏó
     * @return
     */
    public static Motor_inf getNowMotor(int motor_id,List<Motor_inf> motors) {
        Motor_inf motor = null;
        for(int i=0;i<motors.size();i++) {
            if(motor_id == motors.get(i).motor_id) {
                return motors.get(i);
            }
        }
        return motor;
    }
    
    @Override
    public String toString() {
        return "Motor_inf [motor_id=" + motor_id + ", motor_name=" + motor_name + ", motor_type=" + motor_type
                + ", motor_ip=" + motor_ip + ", note=" + note + "]";
    }
}