File: Preferences2.java

package info (click to toggle)
airport-utils 2-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,020 kB
  • sloc: java: 30,844; xml: 571; sh: 553; makefile: 36
file content (158 lines) | stat: -rw-r--r-- 4,213 bytes parent folder | download | duplicates (5)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
 * Wireless Host Monitor
 *
 * Copyright (C) 2003, Jonathan Sevy <jsevy@mcs.drexel.edu>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

package airporthostmon;

import java.io.*;
import java.net.*;


public class Preferences2 extends Preferences
                implements Serializable
{
	public boolean logFlag;
	public int logMode;
	public String logFile;
	
	public boolean notifyFlag;
	public int notifyMode;
	public boolean beepNotifyFlag;
	public boolean emailNotifyFlag;
	public String emailAddress;
	public String emailSMTPHost;
	
	
	public static final int LOG_ALL = 1;
    public static final int LOG_UNKNOWN = 2;
    public static final int LOG_NONE = 3;
    
    public static final int NOTIFY_ALL = 1;
    public static final int NOTIFY_UNKNOWN = 2;
    public static final int NOTIFY_NONE = 3;
    
    
	
	
	public Preferences2()
	{
	    super();
	    
	    logFlag = false;
    	logMode = LOG_NONE;
    	logFile = "";
    	
    	notifyFlag = false;
    	notifyMode = NOTIFY_NONE;
    	beepNotifyFlag = false;
    	emailNotifyFlag = false;
    	emailAddress = "";
    	emailSMTPHost = "";
	}
	
	
	
	public Preferences2(Preferences preferences)
	{
	    this.ipAddress = preferences.ipAddress;
    	this.password = preferences.password;
    	this.queryInterval = preferences.queryInterval;
    	this.accessPointType = preferences.accessPointType;
	    
	    logFlag = false;
    	logMode = LOG_NONE;
    	logFile = "";
    	
    	notifyFlag = false;
    	notifyMode = NOTIFY_NONE;
    	beepNotifyFlag = false;
    	emailNotifyFlag = false;
    	emailAddress = "";
    	emailSMTPHost = "";
	}
	
	
	
	public Preferences2(Preferences2 preferences)
	{
	    this.ipAddress = preferences.ipAddress;
    	this.password = preferences.password;
    	this.queryInterval = preferences.queryInterval;
    	this.accessPointType = preferences.accessPointType;
	    
	    this.logFlag = preferences.logFlag;
    	this.logMode = preferences.logMode;
    	this.logFile = preferences.logFile;
    	
    	this.notifyFlag = preferences.notifyFlag;
    	this.notifyMode = preferences.notifyMode;
    	this.beepNotifyFlag = preferences.beepNotifyFlag;
    	this.emailNotifyFlag = preferences.emailNotifyFlag;
    	this.emailAddress = preferences.emailAddress;
    	this.emailSMTPHost = preferences.emailSMTPHost;
	}
	
	
	public boolean equals(Object otherPrefsObject)
	{
	    if (!(otherPrefsObject instanceof Preferences2))
	    {
	        return false;
	    }
	       
	    Preferences2 otherPrefs = (Preferences2)otherPrefsObject;
	    
	    // check superclass fields
	    if (!super.equals(otherPrefsObject))
	        return false;
	    
	    // compare all fields but passwords
	    if 
	    (
	        (this.logFlag == otherPrefs.logFlag)
	      &&
	        (this.logMode == otherPrefs.logMode)
	      &&
	        (this.logFile.equals(otherPrefs.logFile))
	      &&
	        (this.notifyFlag == otherPrefs.notifyFlag)
	      &&
	        (this.notifyMode == otherPrefs.notifyMode)
	      &&
	        (this.beepNotifyFlag == otherPrefs.beepNotifyFlag)
	      &&
	        (this.emailNotifyFlag == otherPrefs.emailNotifyFlag)
	      &&
	        (this.emailAddress.equals(otherPrefs.emailAddress))
	      &&
	        (this.emailSMTPHost.equals(otherPrefs.emailSMTPHost))
	      
	    )
	    {
	        return true;
	    }
	    else
	    {
	        return false;
	    }
	        
	}
	
}