Exemplo n.º 1
0
        // get the index of an already existing variable from the collection
        public int indexOf(Variable v)
        {
            if(v == null) { return -1; }

            for(int i=0;i<m_variables.Count();i++) {
                if(v.id.Equals(m_variables[i].id, StringComparison.OrdinalIgnoreCase) &&
                   v.category == m_variables[i].category) {
                    return i;
                }
            }
            return -1;
        }
Exemplo n.º 2
0
        // remove an already existing variable
        public bool remove(Variable v)
        {
            if(v == null) { return false; }

            for(int i=0;i<m_variables.Count();i++) {
                if(v.id.Equals(m_variables[i].id, StringComparison.OrdinalIgnoreCase) &&
                   v.category == m_variables[i].category) {
                    m_variables.RemoveAt(i);
                    return true;
                }
            }
            return false;
        }
Exemplo n.º 3
0
 // add an already existing variable
 public bool add(Variable v)
 {
     if(v == null) { return false; }
     if(!contains(v) && v.category < m_categories.Count()) {
         m_variables.Add(v);
         return true;
     }
     return false;
 }