001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 * created at May 28, 2008 021 */ 022package org.biojava.nbio.structure.gui.util; 023 024public class AlignedPosition { 025 int pos1; 026 int pos2; 027 int equivalent; 028 029 /** flag if this position is equivalent 030 * 031 */ 032 public static final int EQUIVALENT = 1; 033 034 /** they can be shown in the same column (for a compact display) 035 * , but they are not structurally equivalent 036 * 037 */ 038 public static final int NOT_ALIGNED = 0; 039 040 public AlignedPosition(){ 041 pos1 = -1; 042 pos2 = -1; 043 equivalent = NOT_ALIGNED; 044 } 045 046 public int getPos(int position){ 047 if (position == 1) 048 return pos1; 049 else 050 return pos2; 051 } 052 public void setPos(int position, int pos){ 053 if (position == 1) 054 pos1 = pos; 055 else 056 pos2 = pos; 057 } 058 059 060 061 062 @Override 063 public String toString(){ 064 String t = " AlignedPosition pos1: " + pos1 + " pos2: "+ pos2 ; 065 if ( equivalent == EQUIVALENT) 066 t+= " EQR"; 067 068 return t; 069 } 070 071 public int getPos1() { 072 return pos1; 073 } 074 075 public void setPos1(int pos1) { 076 this.pos1 = pos1; 077 } 078 079 public int getPos2() { 080 return pos2; 081 } 082 083 public void setPos2(int pos2) { 084 this.pos2 = pos2; 085 } 086 087 public int getEquivalent() { 088 return equivalent; 089 } 090 091 public void setEquivalent(int equivalent) { 092 this.equivalent = equivalent; 093 } 094 095 096}