public virtual void Visit(ArraySource arraySource, State state) { foreach (var item in arraySource.Items) { if (_exitFast) { return; } VisitCore(item, state); } }
public Aa(int residueNumber, bool nTerminus, bool cTerminus) { _atoms = new ArraySource <IAtom>(this); //AtomDefinition[] atomDefinitions = AaTable.GetAtomDefinitions(residueNumber, nTerminus, cTerminus); //Atom[] atoms = new Atom[atomDefinitions.Length]; //for(int i = 0; i < atomDefinitions.Length; i++) //{ // Vector3 position = new Vector3(atomDefinitions[i].X, atomDefinitions[i].Y, atomDefinitions[i].Z); // atoms[i] = new Atom(atomDefinitions[i], position); //} //AddRange(atoms); IsNTerminus = nTerminus; IsCTerminus = cTerminus; ResidueNumber = residueNumber; }
public Aa(IAa other, bool nTerminus, bool cTerminus) { _atoms = new ArraySource <IAtom>(this, other); ResidueNumber = other.ResidueNumber; IsNTerminus = nTerminus; IsCTerminus = cTerminus; AtomDefinition[] definitions = AaTable.GetAtomDefinitions(ResidueNumber, IsNTerminus, IsCTerminus); Matrix unidentifiedAtomTransform = Matrix.Identity; //if (TransformSetting == TransformSettings.Transform) { Vector3[] vLocal = new Vector3[] { definitions[N_].Xyz, definitions[CA_].Xyz, definitions[C_].Xyz }; Vector3[] vOther = new Vector3[] { other[N_].Xyz, other[CA_].Xyz, other[C_].Xyz }; unidentifiedAtomTransform = VectorMath.GetRmsdAlignmentMatrix(vLocal, false, vOther, false); } // Create atoms at final positions for (int i = 0; i < definitions.Length; i++) { Vector3 position = Vector3.Transform(definitions[i].Xyz, unidentifiedAtomTransform); Atom atom = new Atom(definitions[i], position); Add(atom); } this[N_].Xyz = other[N_].Xyz; this[CA_].Xyz = other[CA_].Xyz; this[C_].Xyz = other[C_].Xyz; this[O_].Xyz = other[O_].Xyz; for (int i = Aa.SidechainStart_; i < other.Count; i++) { IAtom otherAtom = other[i]; IAtom thisAtom = this[otherAtom.Name]; if (thisAtom != null) { thisAtom.Xyz = otherAtom.Xyz; } } // Remove parent context - this will result in atoms NOT BEING IN THE ORIGINAL LOCATION this.Parent = null; }
/// <summary> /// Scans for all the grammar rules that are considered for the token at the specified text position. /// </summary> private Parser <LexicalToken> GetBestGrammarAtPosition(int position) { var offset = GetTokenIndex(position); var source = new ArraySource <LexicalToken>(_code.LexerTokens); Parser <LexicalToken> bestGrammar = null; int bestLength = -1; _code.Grammar.Search(source, (_parser, _source, _start, _prevWasMissing) => { // capture the best grammar if (_start == offset && _parser.Tag != null) { var scanLength = _parser.Scan(source, _start); if (scanLength > bestLength) { bestGrammar = _parser; bestLength = scanLength; } } }); return(bestGrammar); }
public ArrayEnumerator(ArraySource <T> source) { Source = source; }
private TArray(ArraySource <T> arrayData) { ArrayData = arrayData; }
public SequentialModel(IReadOnlyList <ILayer> layers, ArraySource?arraySource = null) { Layers = layers; ArraySource = arraySource ?? (size => new double[size]); }
public SequentialModel(ArraySource arraySource, params ILayer[] layers) : this(layers, arraySource) { }