KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnet > Admin > RMI > LocalInfoDesc


1 /*
2  * LocalInfoDesc.java
3  *
4  * Created on 11. květen 2004, 14:42
5  */

6
7 package SOFA.SOFAnet.Admin.RMI;
8
9 import SOFA.SOFAnet.Repository.LocalInfo;
10 import java.io.Serializable JavaDoc;
11
12 /**
13  *
14  * @author Ladislav Sobr
15  */

16 public class LocalInfoDesc implements Serializable JavaDoc, Comparable JavaDoc
17 {
18   public String JavaDoc bundleName;
19   public int state;
20   
21   /** Creates a new instance of LocalInfoDesc */
22   public LocalInfoDesc(LocalInfo localInfo)
23   {
24     bundleName = localInfo.getName();
25     state = localInfo.getState();
26   }
27   
28   public LocalInfoDesc(String JavaDoc bundleName, int state)
29   {
30     this.bundleName = bundleName;
31     this.state = state;
32   }
33   
34   public String JavaDoc toString()
35   {
36     return bundleName;
37   }
38   
39   public boolean equals(Object JavaDoc o)
40   {
41     if (this == o) return true;
42     if (o instanceof LocalInfoDesc)
43     {
44       LocalInfoDesc localInfoDesc = (LocalInfoDesc)o;
45       return bundleName.compareTo(localInfoDesc.bundleName) == 0;
46     }
47     else return false;
48   }
49
50   public int compareTo(Object JavaDoc o)
51   {
52     LocalInfoDesc localInfoDesc = (LocalInfoDesc)o;
53     return bundleName.compareTo(localInfoDesc.bundleName);
54   }
55   
56   
57   public boolean isInstalled()
58   {
59     return (state & LocalInfo.STATE_INSTALLED) != 0;
60   }
61   
62   public boolean isShareManager()
63   {
64     return (state & LocalInfo.STATE_SHARE_MANAGER) != 0;
65   }
66   
67   public boolean isShareClient()
68   {
69     return (state & LocalInfo.STATE_SHARE_CLIENT) != 0;
70   }
71
72   public boolean areShareClientModes()
73   {
74     return (state & (LocalInfo.STATE_SHARE_CLIENT | LocalInfo.STATE_SHARE_PRECLIENT)) != 0;
75   }
76
77   public boolean isSharePreClient()
78   {
79     return (state & LocalInfo.STATE_SHARE_PRECLIENT) != 0;
80   }
81
82   public boolean isInSharing()
83   {
84     return (state & (LocalInfo.STATE_SHARE_MANAGER | LocalInfo.STATE_SHARE_CLIENT | LocalInfo.STATE_SHARE_PRECLIENT)) != 0;
85   }
86   
87 }
88
Popular Tags