annotate src/CapabilityInfo.java @ 0:e04119c40b9b

upload all file of tighVNCClient
author e085711
date Tue, 12 Apr 2011 12:57:33 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
1 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
2 // Copyright (C) 2003 Constantin Kaplinsky. All Rights Reserved.
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
3 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
4 // This is free software; you can redistribute it and/or modify
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
5 // it under the terms of the GNU General Public License as published by
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
6 // the Free Software Foundation; either version 2 of the License, or
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
7 // (at your option) any later version.
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
8 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
9 // This software is distributed in the hope that it will be useful,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
12 // GNU General Public License for more details.
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
13 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
14 // You should have received a copy of the GNU General Public License
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
15 // along with this software; if not, write to the Free Software
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
17 // USA.
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
18 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
19
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
20 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
21 // CapabilityInfo.java - A class to hold information about a
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
22 // particular capability as used in the RFB protocol 3.130.
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
23 //
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
24
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
25 class CapabilityInfo {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
26
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
27 // Public methods
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
28
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
29 public CapabilityInfo(int code,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
30 String vendorSignature,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
31 String nameSignature,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
32 String description) {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
33 this.code = code;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
34 this.vendorSignature = vendorSignature;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
35 this.nameSignature = nameSignature;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
36 this.description = description;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
37 enabled = false;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
38 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
39
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
40 public CapabilityInfo(int code,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
41 byte[] vendorSignature,
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
42 byte[] nameSignature) {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
43 this.code = code;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
44 this.vendorSignature = new String(vendorSignature);
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
45 this.nameSignature = new String(nameSignature);
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
46 this.description = null;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
47 enabled = false;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
48 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
49
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
50 public int getCode() {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
51 return code;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
52 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
53
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
54 public String getDescription() {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
55 return description;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
56 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
57
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
58 public boolean isEnabled() {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
59 return enabled;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
60 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
61
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
62 public void enable() {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
63 enabled = true;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
64 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
65
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
66 public boolean equals(CapabilityInfo other) {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
67 return (other != null && this.code == other.code &&
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
68 this.vendorSignature.equals(other.vendorSignature) &&
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
69 this.nameSignature.equals(other.nameSignature));
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
70 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
71
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
72 public boolean enableIfEquals(CapabilityInfo other) {
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
73 if (this.equals(other))
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
74 enable();
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
75
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
76 return isEnabled();
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
77 }
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
78
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
79 // Protected data
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
80
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
81 protected int code;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
82 protected String vendorSignature;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
83 protected String nameSignature;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
84
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
85 protected String description;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
86 protected boolean enabled;
e04119c40b9b upload all file of tighVNCClient
e085711
parents:
diff changeset
87 }