Esempio n. 1
0
        } //end nextVASPToken(boolean newLine)

        /// <summary> Find the next token of a VASP file begining
        /// with the *next* line.
        /// </summary>
        public virtual System.String nextVASPTokenFollowing(System.String string_Renamed)
        {
            int index;

            System.String line;
            while (inputBuffer.Peek() != -1)
            {
                line  = inputBuffer.ReadLine();
                index = line.IndexOf(string_Renamed);
                if (index > 0)
                {
                    index = index + string_Renamed.Length;
                    line  = line.Substring(index);
                    st    = new SupportClass.Tokenizer(line, " =\t");
                    while (!st.HasMoreTokens() && inputBuffer.Peek() != -1)
                    {
                        line = inputBuffer.ReadLine();
                        st   = new SupportClass.Tokenizer(line, " =\t");
                    }
                    if (st.HasMoreTokens())
                    {
                        fieldVal = st.NextToken();
                    }
                    else
                    {
                        fieldVal = null;
                    }
                    break;
                }
            }
            return(fieldVal);
        } //end nextVASPTokenFollowing(String string)
Esempio n. 2
0
        /// <summary> Find the next token of an VASP file.
        /// ABINIT tokens are words separated by space(s). Characters
        /// following a "#" are ignored till the end of the line.
        ///
        /// </summary>
        /// <returns> a <code>String</code> value
        /// </returns>
        /// <exception cref="IOException">if an error occurs
        /// </exception>
        public virtual System.String nextVASPToken(bool newLine)
        {
            System.String line;

            if (newLine)
            {
                // We ignore the end of the line and go to the following line
                if (inputBuffer.Peek() != -1)
                {
                    line = inputBuffer.ReadLine();
                    st   = new SupportClass.Tokenizer(line, " =\t");
                }
            }

            while (!st.HasMoreTokens() && inputBuffer.Peek() != -1)
            {
                line = inputBuffer.ReadLine();
                st   = new SupportClass.Tokenizer(line, " =\t");
            }
            if (st.HasMoreTokens())
            {
                fieldVal = st.NextToken();
                if (fieldVal.StartsWith("#"))
                {
                    nextVASPToken(true);
                }
            }
            else
            {
                fieldVal = null;
            }
            return(this.fieldVal);
        } //end nextVASPToken(boolean newLine)
Esempio n. 3
0
 public virtual System.String exhaustStringTokenizer(Support.SupportClass.Tokenizer tokenizer)
 {
     System.Text.StringBuilder buffer = new System.Text.StringBuilder();
     buffer.Append(" ");
     while (tokenizer.HasMoreTokens())
     {
         buffer.Append(tokenizer.NextToken());
         buffer.Append(" ");
     }
     return(buffer.ToString());
 }
Esempio n. 4
0
        } //end nextVASPToken(boolean newLine)


        /// <summary> Find the next token of a VASP file begining
        /// with the *next* line.
        /// </summary>
        public virtual System.String nextVASPTokenFollowing(System.String string_Renamed)
        {
            int index;
            System.String line;
            while (inputBuffer.Peek() != -1)
            {
                line = inputBuffer.ReadLine();
                index = line.IndexOf(string_Renamed);
                if (index > 0)
                {
                    index = index + string_Renamed.Length;
                    line = line.Substring(index);
                    st = new SupportClass.Tokenizer(line, " =\t");
                    while (!st.HasMoreTokens() && inputBuffer.Peek() != -1)
                    {
                        line = inputBuffer.ReadLine();
                        st = new SupportClass.Tokenizer(line, " =\t");
                    }
                    if (st.HasMoreTokens())
                    {
                        fieldVal = st.NextToken();
                    }
                    else
                    {
                        fieldVal = null;
                    }
                    break;
                }
            }
            return fieldVal;
        } //end nextVASPTokenFollowing(String string) 
Esempio n. 5
0
        /// <summary> Find the next token of an VASP file.
        /// ABINIT tokens are words separated by space(s). Characters
        /// following a "#" are ignored till the end of the line.
        /// 
        /// </summary>
        /// <returns> a <code>String</code> value
        /// </returns>
        /// <exception cref="IOException">if an error occurs
        /// </exception>
        public virtual System.String nextVASPToken(bool newLine)
        {

            System.String line;

            if (newLine)
            {
                // We ignore the end of the line and go to the following line
                if (inputBuffer.Peek() != -1)
                {
                    line = inputBuffer.ReadLine();
                    st = new SupportClass.Tokenizer(line, " =\t");
                }
            }

            while (!st.HasMoreTokens() && inputBuffer.Peek() != -1)
            {
                line = inputBuffer.ReadLine();
                st = new SupportClass.Tokenizer(line, " =\t");
            }
            if (st.HasMoreTokens())
            {
                fieldVal = st.NextToken();
                if (fieldVal.StartsWith("#"))
                {
                    nextVASPToken(true);
                }
            }
            else
            {
                fieldVal = null;
            }
            return this.fieldVal;
        } //end nextVASPToken(boolean newLine)