public GeneOrthologyEntry(String line) { String[] a = line.split("\\s"); geneName = a[0]; s288cCoords = parseCoordsString(a[1]); sigmaCoords = parseCoordsString(a[2]); try { identity = Double.parseDouble(a[3]); } catch (NumberFormatException e) { identity = null; } flags = new HashSet<Flag>(); orfCoords = null; if (a.length > 4) { String[] fa = a[4].split(","); for (int i = 0; i < fa.length; i++) { try { if (fa[i].length() > 0) { flags.add(Flag.valueOf(fa[i])); } else { flags.add(Flag.UNKNOWN); } } catch (IllegalArgumentException e) { System.err.println(String.format("Unknown FLAG: \"%s\"", fa[i])); flags.add(Flag.UNKNOWN); } } if (a.length > 5) { orfCoords = parseCoordsString(a[5]); } } }
public static boolean isFlagSet(short flags, Flag flag) { return flag != null && ((flags & flag.value()) == flag.value()); }
/** * Clears a number of flags in a message * * @param flags The flags * @return A reference to the message */ public Message clearFlag(Flag... flags) { if (flags != null) for (Flag flag : flags) if (flag != null) this.flags &= ~flag.value(); return this; }
/** * Sets a number of flags in a message * * @param flags The flag or flags * @return A reference to the message */ public Message setFlag(Flag... flags) { if (flags != null) for (Flag flag : flags) if (flag != null) this.flags |= flag.value(); return this; }