source: trunk/packages/invirt-vnc-client/CapabilityInfo.java @ 2574

Last change on this file since 2574 was 1334, checked in by broder, 16 years ago

sipb-xen-vnc-client -> invirt-vnc-client

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