Methods Summary |
---|
public void | add(javax.mail.Flags$Flag flag)Add the specified system flag to this Flags object.
system_flags |= flag.bit;
|
public void | add(java.lang.String flag)Add the specified user flag to this Flags object.
if (user_flags == null)
user_flags = new Hashtable(1);
user_flags.put(flag.toLowerCase(Locale.ENGLISH), flag);
|
public void | add(javax.mail.Flags f)Add all the flags in the given Flags object to this
Flags object.
system_flags |= f.system_flags; // add system flags
if (f.user_flags != null) { // add user-defined flags
if (user_flags == null)
user_flags = new Hashtable(1);
Enumeration e = f.user_flags.keys();
while (e.hasMoreElements()) {
String s = (String)e.nextElement();
user_flags.put(s, f.user_flags.get(s));
}
}
|
public java.lang.Object | clone()Returns a clone of this Flags object.
Flags f = null;
try {
f = (Flags)super.clone();
} catch (CloneNotSupportedException cex) {
// ignore, can't happen
}
if (this.user_flags != null && f != null)
f.user_flags = (Hashtable)this.user_flags.clone();
return f;
|
public boolean | contains(javax.mail.Flags$Flag flag)Check whether the specified system flag is present in this Flags object.
return (system_flags & flag.bit) != 0;
|
public boolean | contains(java.lang.String flag)Check whether the specified user flag is present in this Flags object.
if (user_flags == null)
return false;
else
return user_flags.containsKey(flag.toLowerCase(Locale.ENGLISH));
|
public boolean | contains(javax.mail.Flags f)Check whether all the flags in the specified Flags object are
present in this Flags object.
// Check system flags
if ((f.system_flags & system_flags) != f.system_flags)
return false;
// Check user flags
if (f.user_flags != null) {
if (user_flags == null)
return false;
Enumeration e = f.user_flags.keys();
while (e.hasMoreElements()) {
if (!user_flags.containsKey(e.nextElement()))
return false;
}
}
// If we've made it till here, return true
return true;
|
public boolean | equals(java.lang.Object obj)Check whether the two Flags objects are equal.
if (!(obj instanceof Flags))
return false;
Flags f = (Flags)obj;
// Check system flags
if (f.system_flags != this.system_flags)
return false;
// Check user flags
if (f.user_flags == null && this.user_flags == null)
return true;
if (f.user_flags != null && this.user_flags != null &&
f.user_flags.size() == this.user_flags.size()) {
Enumeration e = f.user_flags.keys();
while (e.hasMoreElements()) {
if (!this.user_flags.containsKey(e.nextElement()))
return false;
}
return true;
}
return false;
|
public javax.mail.Flags$Flag[] | getSystemFlags()Return all the system flags in this Flags object. Returns
an array of size zero if no flags are set.
Vector v = new Vector();
if ((system_flags & ANSWERED_BIT) != 0)
v.addElement(Flag.ANSWERED);
if ((system_flags & DELETED_BIT) != 0)
v.addElement(Flag.DELETED);
if ((system_flags & DRAFT_BIT) != 0)
v.addElement(Flag.DRAFT);
if ((system_flags & FLAGGED_BIT) != 0)
v.addElement(Flag.FLAGGED);
if ((system_flags & RECENT_BIT) != 0)
v.addElement(Flag.RECENT);
if ((system_flags & SEEN_BIT) != 0)
v.addElement(Flag.SEEN);
if ((system_flags & USER_BIT) != 0)
v.addElement(Flag.USER);
Flag[] f = new Flag[v.size()];
v.copyInto(f);
return f;
|
public java.lang.String[] | getUserFlags()Return all the user flags in this Flags object. Returns
an array of size zero if no flags are set.
Vector v = new Vector();
if (user_flags != null) {
Enumeration e = user_flags.elements();
while (e.hasMoreElements())
v.addElement(e.nextElement());
}
String[] f = new String[v.size()];
v.copyInto(f);
return f;
|
public int | hashCode()Compute a hash code for this Flags object.
int hash = system_flags;
if (user_flags != null) {
Enumeration e = user_flags.keys();
while (e.hasMoreElements())
hash += ((String)e.nextElement()).hashCode();
}
return hash;
|
public void | remove(javax.mail.Flags f)Remove all flags in the given Flags object from this
Flags object.
system_flags &= ~f.system_flags; // remove system flags
if (f.user_flags != null) {
if (user_flags == null)
return;
Enumeration e = f.user_flags.keys();
while (e.hasMoreElements())
user_flags.remove(e.nextElement());
}
|
public void | remove(javax.mail.Flags$Flag flag)Remove the specified system flag from this Flags object.
system_flags &= ~flag.bit;
|
public void | remove(java.lang.String flag)Remove the specified user flag from this Flags object.
if (user_flags != null)
user_flags.remove(flag.toLowerCase(Locale.ENGLISH));
|