⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bond.java

📁 A program to find frequent molecular substructures and discriminative fragments in a database of mol
💻 JAVA
字号:
/*----------------------------------------------------------------------  File    : Bond.java  Contents: Bond management for molecules  Author  : Christian Borgelt  History : 11.03.2002 file created            28.03.2002 type, src, and dst changed to protected            03.08.2003 final modifier removed from type field            04.08.2003 initialization of Bond.mark and Bond.flags added            07.06.2005 bridge indicator and test function added            21.07.2005 bridge flag moved from type to flags field            12.05.2006 definition of constant RINGBOND added            17.05.2006 RINGBOND and BRIDGE changed to Integer.MIN_VALUE            06.06.2006 type of flags field changed to long            13.07.2006 bond type coding changed (bit 0 always set)----------------------------------------------------------------------*/package moss;/*--------------------------------------------------------------------*/public class Bond {/*--------------------------------------------------------------------*/  /* --- constants: bond types --- */  public static final int  UNKNOWN   = -1;  public static final int  NULL      =  0x0000;  public static final int  SINGLE    =  0x0001;  public static final int  AROMATIC  =  0x0007;  public static final int  DOUBLE    =  0x000f;  public static final int  TRIPLE    =  0x0011;  /* --- constants: bond flags/masks --- */  public static final int  TYPEMASK  =  0x001f;  public static final int  SAMETYPE  =  0x001e;  public static final int  DOWNGRADE = ~0x0006;  public static final int  UPGRADE   = ~0x000c;  public static final int  RINGBOND  =  Integer.MIN_VALUE;  public static final long RINGS     = ~Long.MIN_VALUE;  public static final long BRIDGE    =  Long.MIN_VALUE;  /* DOWNGRADE and UPGRADE are masks, to be anded (bitwise &) with */  /* the type in order to down- or upgrade an aromatic bond to a   */  /* single or a double bond, respectively. */  /* --- constants: bond names --- */  protected static String[] names = {  /*  0    1    2    3    4    5    6    7  */     ".", "-", "?", "=", "?", "?", "?", ":",  /*  8    9   10   11   12   13   14   15  */     "?", "?", "?", "?", "?", "?", "?", "=",  /* 16   17   18   19   20   21   22   23  */     "#", "#", "?", "?", "?", "?", "?", "?",  /* 24   25   26   27   28   29   30   31  */     "?", "?", "?", "?", "?", "?", "?", "?"  };                            /* table of ASCII bond names */  /* Question marks are used if a bond type code should not occur. */  /* Note that code 3 denotes an upgraded aromatic bond. */  /* --- instance variables --- */  protected final Atom src;     /* source      atom */  protected final Atom dst;     /* destination atom */  protected       int  type;    /* type, e.g. SINGLE */  protected       int  mark;    /* marker for substructure */  protected       long flags;   /* flags for rings and bridges */  /*------------------------------------------------------------------*/  protected Bond (Atom src, Atom dst, int type)  {                             /* --- create a bond */    this.src   = src;           /* note the source atom */    this.dst   = dst;           /* and the destination atom */    this.type  = type;          /* set the bond type and */    this.flags = 0;             /* clear ring and bridge flags */    src.addBond(this);          /* store the new bond */    dst.addBond(this);          /* in the connected atoms */  }  /* Bond() */  /*------------------------------------------------------------------*/  public int     getType    ()  { return this.type; }  public Atom    getSource  ()  { return this.src; }  public Atom    getDest    ()  { return this.dst; }  public boolean isAromatic ()  { return (this.type & TYPEMASK) == AROMATIC; }  public long    getRings   ()  { return this.flags & RINGS; }  public boolean isInRing   ()  { return (this.flags & RINGS)  != 0; }  public boolean isBridge   ()  { return (this.flags & BRIDGE) != 0; }  /*------------------------------------------------------------------*/  public void markBridge (boolean bridge)  { if (bridge) this.flags |=  BRIDGE;    else        this.flags &= ~BRIDGE; }}  /* class Bond */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -