Revision: 5139
Author:   hansonr
Date:     2006-05-18 10:13:03 -0700 (Thu, 18 May 2006)
ViewCVS:  http://svn.sourceforge.net/jmol/?rev=5139&view=rev

Log Message:
-----------
bob200603 introduces wildcards for insertion

 select 186^*;spacefill on
 select 186^?;spacefill on
 #above two are the same -- just the insertions at 186

 select *^?;spacefill on;color yellow
 #all insertions

 select *^A;spacefill on;color blue
 #all insertions with "A"

Modified Paths:
--------------
    branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Group.java
    branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java   2006-05-18 
05:17:40 UTC (rev 5138)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java   2006-05-18 
17:13:03 UTC (rev 5139)
@@ -173,12 +173,15 @@
           continue;
         }
         if (lookingAtSeqcode()) {
-          int seqNum =
+          int seqNum =(script.charAt(ichToken) == '*' ? 0 : 
             Integer.parseInt(script.substring(ichToken,
-                                              ichToken + cchToken - 2));
+                                              ichToken + cchToken - 2)));
           char insertionCode = script.charAt(ichToken + cchToken - 1);
+          if (insertionCode == '*')
+            insertionCode = '?';
           int seqcode = Group.getSeqcode(seqNum, insertionCode);
           ltoken.addElement(new Token(Token.seqcode, seqcode, "seqcode"));
+          System.out.println("compiler ins code "+insertionCode);
           continue;
         }
         if (lookingAtInteger((tokCommand & Token.negnums) != 0)) {
@@ -591,12 +594,18 @@
   boolean lookingAtSeqcode() {
     int ichT = ichToken;
     char ch = ' ';
-    while (ichT < cchScript && isDigit(ch = script.charAt(ichT)))
+    if (ichT + 1 < cchScript && script.charAt(ichT) == '*'
+        && script.charAt(ichT + 1) == '^') {
+      ch = '^';
       ++ichT;
+    } else {
+      while (ichT < cchScript && isDigit(ch = script.charAt(ichT)))
+        ++ichT;
+    }
     if (ichT == ichToken || ichT + 2 > cchScript || ch != '^')
       return false;
     ch = script.charAt(++ichT);
-    if (! isAlphabetic(ch))
+    if (ch != '*' && ch != '?' && !isAlphabetic(ch))
       return false;
     ++ichT;
     cchToken = ichT - ichToken;

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java      2006-05-18 
05:17:40 UTC (rev 5138)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java      2006-05-18 
17:13:03 UTC (rev 5139)
@@ -1960,9 +1960,21 @@
 
   BitSet getSpecSeqcode(int seqcode) {
     BitSet bsResno = new BitSet();
-    for (int i = atomCount; --i >= 0;) {
-      if (seqcode == atoms[i].getSeqcode())
-        bsResno.set(i);
+    int seqNum = (seqcode >> 8);
+    if (Group.getInsertionCode(seqcode) == '?') {
+      for (int i = atomCount; --i >= 0;) {
+        int atomSeqcode = atoms[i].getSeqcode();
+        if ((seqNum == 0 || seqNum == (atomSeqcode >> 8))
+            && (atomSeqcode & 0xFF) != 0)
+          bsResno.set(i);
+      }
+    } else {
+      for (int i = atomCount; --i >= 0;) {
+        int atomSeqcode = atoms[i].getSeqcode();
+        if (seqcode == atoms[i].getSeqcode() || seqNum == 0
+            && seqcode == (atomSeqcode & 0xFF))
+          bsResno.set(i);
+      }
     }
     return bsResno;
   }

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Group.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Group.java      2006-05-18 
05:17:40 UTC (rev 5138)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Group.java      2006-05-18 
17:13:03 UTC (rev 5139)
@@ -192,7 +192,8 @@
       return sequenceNumber;
     if (! ((insertionCode >= 'A' && insertionCode <= 'Z') ||
            (insertionCode >= 'a' && insertionCode <= 'z') ||
-           (insertionCode >= '0' && insertionCode <= '9'))) {
+           (insertionCode >= '0' && insertionCode <= '9')) &&
+           insertionCode != '?') {
       if (insertionCode != ' ' && insertionCode != '\0')
         System.out.println("unrecognized insertionCode:" + insertionCode);
       insertionCode = '\0';
@@ -214,6 +215,12 @@
     return (char)(seqcode & 0xFF);
   }
   
+  static char getInsertionCode(int seqcode) {
+    if (seqcode == Integer.MIN_VALUE)
+      return '\0';
+    return (char)(seqcode & 0xFF);
+  }
+  
   final void selectAtoms(BitSet bs) {
     for (int i = firstAtomIndex; i <= lastAtomIndex; ++i)
       bs.set(i);

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java      
2006-05-18 05:17:40 UTC (rev 5138)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java      
2006-05-18 17:13:03 UTC (rev 5139)
@@ -42,7 +42,7 @@
   // for now, just update this by hand
   // perhaps use ant filter later ... but mth doesn't like it :-(
   public final static String copyright = "(C) 2006 Jmol Development";
-  public final static String version = "10.x.02(branch bob200603)";
+  public final static String version = "10.x.03(branch bob200603)";
   public final static String cvsDate = "$Date$";
   public final static String date = cvsDate.substring(7, 23);
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to