1 21 package org.apache.derby.client.am; 22 23 public class ProductLevel { 24 public String databaseProductName_; 25 public int versionLevel_; 26 public int releaseLevel_; 27 public int modificationLevel_; 28 29 public String databaseProductVersion_; 31 32 public ProductLevel(String productID, String databaseProductName, 35 String srvrlslv) { 36 versionLevel_ = Integer.parseInt(productID.substring(3, 5)); 42 releaseLevel_ = Integer.parseInt(productID.substring(5, 7)); 43 modificationLevel_ = Integer.parseInt(productID.substring(7, 8)); 44 databaseProductName_ = (databaseProductName == null) ? 45 "Derby" : databaseProductName; 47 int dbVersionOffset = 0; 57 if (srvrlslv != null) { 58 dbVersionOffset = srvrlslv.indexOf('/') + 1; 59 databaseProductVersion_ = srvrlslv.substring(dbVersionOffset); 61 } 62 if (databaseProductVersion_ == null) { 63 databaseProductVersion_ = productID; 64 } 65 } 66 67 public boolean greaterThanOrEqualTo(int versionLevel, int releaseLevel, int modificationLevel) { 68 if (versionLevel_ > versionLevel) { 69 return true; 70 } else if (versionLevel_ == versionLevel) { 71 if (releaseLevel_ > releaseLevel) { 72 return true; 73 } else if (releaseLevel_ == releaseLevel) { 74 if (modificationLevel_ >= modificationLevel) { 75 return true; 76 } 77 } 78 } 79 return false; 80 } 81 82 public boolean lessThan(int versionLevel, int releaseLevel, int modificationLevel) { 83 if (versionLevel_ < versionLevel) { 84 return true; 85 } else if (versionLevel_ == versionLevel) { 86 if (releaseLevel_ < releaseLevel) { 87 return true; 88 } else if (releaseLevel_ == releaseLevel) { 89 if (modificationLevel_ < modificationLevel) { 90 return true; 91 } 92 } 93 } 94 return false; 95 } 96 } 97 | Popular Tags |