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