comparison src/treeVnc/CapabilityInfo.java @ 0:756bfaf731f3

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