/// <summary> Returns the most abundant (major) isotope whose symbol equals element. /// /// </summary> /// <param name="symbol"> Description of the Parameter /// </param> /// <returns> The Major Isotope value /// </returns> public virtual IIsotope getMajorIsotope(System.String symbol) { IIsotope major = null; if (majorIsotopes.ContainsValue(symbol)) { major = (IIsotope)majorIsotopes[symbol]; } else { for (int f = 0; f < isotopes.Count; f++) { IIsotope current = (IIsotope)isotopes[f]; if (current.Symbol.Equals(symbol)) { try { if (major == null) { major = (IIsotope)current.Clone(); } else { if (current.NaturalAbundance > major.NaturalAbundance) { major = (IIsotope)current.Clone(); } } } //UPGRADE_NOTE: Exception 'java.lang.CloneNotSupportedException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'" catch (System.Exception e) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //logger.error("Could not clone IIsotope: ", e.Message); //logger.debug(e); } } } if (major == null) { //logger.error("Could not find major isotope for: ", symbol); } else { majorIsotopes[symbol] = major; } } return(major); }
/// <summary> Adds the atom oAtom to a specified Strand, whereas the Monomer is unspecified. Hence /// the atom will be added to a Monomer of type UNKNOWN in the specified Strand. /// /// </summary> /// <param name="oAtom"> The atom to add /// </param> /// <param name="oStrand">The strand the atom belongs to /// </param> public virtual void addAtom(IAtom oAtom, IStrand oStrand) { int atomCount = base.AtomCount; // Add atom to AtomContainer base.addAtom(oAtom); if (atomCount != base.AtomCount && oStrand != null) { // Maybe better to throw nullpointer exception here, so user realises that // Strand == null and Atom only gets added to this BioPolymer, but not to a Strand. oStrand.addAtom(oAtom); if (!strands.ContainsValue(oStrand.StrandName)) { strands[oStrand.StrandName] = oStrand; } } /* notifyChanged() is called by addAtom in * AtomContainer */ }
static int _m_ContainsValue(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _value = translator.GetObject(L, 2, typeof(object)); bool gen_ret = gen_to_be_invoked.ContainsValue(_value); LuaAPI.lua_pushboolean(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public bool ContainsValue(TValue val) { return(tbl.ContainsValue(val)); }
void UpdateFileLifecycleStateEvents_GetRestrictions(object sender, UpdateFileLifeCycleStateCommandEventArgs e) { //PWLifecycleSettings mPWSettings = PWLifecycleSettings.Load(); if ((mPWLfcycles.Count == 0)) { mReadPWLfcs(sender); } mFullyApproved = false; mReleasedFiles = new List <string>(); IWebService service = sender as IWebService; if (service == null) { return; } WebServiceCredentials cred = new WebServiceCredentials(service); using (WebServiceManager mgr = new WebServiceManager(cred)) { long currentUserId = mgr.SecurityService.SecurityHeader.UserId; //FileArray mFileCollection; // = mgr.DocumentService.GetFilesByMasterIds(e.FileMasterIds); FileArray[] mAllFileCollections = mgr.DocumentService.GetFilesByMasterIds(e.FileMasterIds); int N = 0; foreach (FileArray mFileCollection in mAllFileCollections) { //toDo: loop for all file collections, not only for [0] int numFileCol = mFileCollection.Files.Length; //check that lifecycle type is of parallelApproval ? Yes -> continue File mLatestFile = mFileCollection.Files[mFileCollection.Files.Length - 1]; long mCurrentLfcID = mLatestFile.FileLfCyc.LfCycDefId; if (!(mPWLfcycles.ContainsValue(mCurrentLfcID))) { return; } if (!(mApprovalLfcycle.Contains(mFileCollection.Files[numFileCol - 1].FileLfCyc.LfCycDefId))) //(!(mLatestFile.FileLfCyc.LfCycDefId == mLfCycle.Id)) { return; } //check that current latestversion is not released state ? No -> continue long mCurrentFinalStateID = (long)mPWFinalStates[mCurrentLfcID]; if (mLatestFile.FileLfCyc.LfCycStateId == mCurrentFinalStateID) { return; } if (mReleaseStates.Contains(mLatestFile.FileLfCyc.LfCycStateId)) { return; } //check that the file(s) toStateId is a released state or member of parallel approvals states? //Yes -> continue | NOT -> raise restriction //if (!(mApprovalStateIDs.Contains(e.ToStateIds[N])) || !(mReleaseStates.Contains(e.ToStateIds[N]))) //{ // return; //} //check that the file(s) custom state is fully approved ? yes -> continue long[] mReturnFiles = new long[mFileCollection.Files.Length]; Int32 i = 0; foreach (File mFile in mFileCollection.Files) { mReturnFiles[i] = mFile.Id; i += 1; } FileArray[] mFileHistory = null; mFileHistory = mgr.DocumentService.GetFilesByHistoryType(mReturnFiles, FileHistoryTypeOptions.All); mFullyApproved = mCheckParallelFlow(sender, e, mFileHistory, (string[])mPWStatesByName[mCurrentLfcID]); //if (!(mFullyApproved) && mReleaseStates.Contains(e.ToStateIds[N]) && // mParallelStates.Contains(mFileCollection.Files[numFileCol-2].FileLfCyc.LfCycStateName)) if (!(mFullyApproved) && (long)mPWFinalStates[mCurrentLfcID] == e.ToStateIds[N]) { String mFileName = mFileCollection.Files[N].Name; RestrictRelease(e, "Freigabe Bedingungen", mFileName, (string[])mPWStatesByName[mCurrentLfcID]); } N += 1; mReturnFiles = null; mFileHistory = null; mLatestFile = null; } //foreach file collection } //using }
/// <summary> /// 设置格式 /// </summary> public void SetFormat(int startRow, int startCol, int endRow, int endCol, System.Collections.Hashtable htFormat) { object m_objOpt = System.Reflection.Missing.Value; excel.Range range = Sheet.get_Range(ToExcelCellIndex(startRow, startCol), ToExcelCellIndex(endRow, endCol)); if (htFormat.Contains("NumberFormat")) { range.NumberFormatLocal = htFormat["NumberFormat"]; } if (htFormat.Contains("BoldFont")) { range.Font.Bold = htFormat["BoldFont"]; } if (htFormat.Contains("SetBorders")) { if (htFormat["SetBorders"].Equals("粗")) { range.Borders.Weight = excel.XlBorderWeight.xlThick; } else if (htFormat["SetBorders"].Equals("细")) { range.Borders.Weight = excel.XlBorderWeight.xlThin; } else { range.Borders.Weight = excel.XlBorderWeight.xlMedium; } } if (htFormat.Contains("LeftThickBorder") && htFormat.ContainsValue("加粗")) { range.Borders[excel.XlBordersIndex.xlEdgeLeft].Weight = excel.XlBorderWeight.xlMedium; } if (htFormat.Contains("RightThickBorder") && htFormat.ContainsValue("加粗")) { range.Borders[excel.XlBordersIndex.xlEdgeRight].Weight = excel.XlBorderWeight.xlMedium; } if (htFormat.Contains("BottomtThickBorder") && htFormat.ContainsValue("加粗")) { range.Borders[excel.XlBordersIndex.xlEdgeBottom].Weight = excel.XlBorderWeight.xlMedium; } if (htFormat.Contains("TopThickBorder") && htFormat.ContainsValue("加粗")) { range.Borders[excel.XlBordersIndex.xlEdgeTop].Weight = excel.XlBorderWeight.xlMedium; } if (htFormat.Contains("FontName")) { range.Font.Name = htFormat["FontName"]; } if (htFormat.Contains("FontSize")) { range.Font.Size = htFormat["FontSize"]; } if (htFormat.Contains("FontColor")) { range.Font.Color = htFormat["FontColor"]; } if (htFormat.Contains("RowHeight")) { range.RowHeight = htFormat["RowHeight"]; } if (htFormat.Contains("ColumnWidth")) { range.ColumnWidth = htFormat["ColumnWidth"]; } }