Index: anches/OMEdit/OMEditGUI/OMC/OMCCommandsCache.cpp
===================================================================
--- /branches/OMEdit/OMEditGUI/OMC/OMCCommandsCache.cpp	(revision 15451)
+++ 	(revision )
@@ -1,197 +1,0 @@
-/*
- * This file is part of OpenModelica.
- *
- * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
- * c/o Linköpings universitet, Department of Computer and Information Science,
- * SE-58183 Linköping, Sweden.
- *
- * All rights reserved.
- *
- * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR 
- * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. 
- * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
- * OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE. 
- *
- * The OpenModelica software and the Open Source Modelica
- * Consortium (OSMC) Public License (OSMC-PL) are obtained
- * from OSMC, either from the above address,
- * from the URLs: http://www.ida.liu.se/projects/OpenModelica or  
- * http://www.openmodelica.org, and in the OpenModelica distribution. 
- * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
- *
- * This program is distributed WITHOUT ANY WARRANTY; without
- * even the implied warranty of  MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
- * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
- *
- * See the full OSMC Public License conditions for more details.
- *
- */
-/*!
- * 
- * @author Adeel Asghar <adeel.asghar@liu.se>
- *
- * RCS: $Id$
- *
- */
-
-#include "OMCCommandsCache.h"
-
-/*!
-  \class OMCCommand
-  \brief Stores the cache OMC Command with its result.
-  */
-/*!
-  \param command - the OMC command
-  \param command - the OMC command result
-  \param pParent - pointer to QObject
-  */
-OMCCommand::OMCCommand(QString command, QString commandResult, QObject *pParent)
-  : QObject(pParent)
-{
-  mOMCCommand = command;
-  mOMCCommandResult = commandResult;
-}
-
-/*!
-  Returns the OMC Command.
-  \return the OMC command.
-  */
-QString OMCCommand::getOMCCommand()
-{
-  return mOMCCommand;
-}
-
-/*!
-  Returns the OMC Command Result.
-  \return the OMC command result.
-  */
-QString OMCCommand::getOMCCommandResult()
-{
-  return mOMCCommandResult;
-}
-
-/*!
-  \class OMCClassName
-  \brief Stores the cache OMC class name and all the commands associated with this class name.
-  */
-/*!
-  \param className - the name of the class.
-  \param pParent - pointer to QObject
-  */
-OMCClassName::OMCClassName(QString className, QObject *pParent)
-  : QObject(pParent)
-{
-  mOMCClassName = className;
-}
-
-/*!
-  Returns the OMC class name.
-  \return the OMC class name.
-  */
-QString OMCClassName::getOMCClassName()
-{
-  return mOMCClassName;
-}
-
-/*!
-  Adds the OMC Command to the list of cached commands.
-  \param pOMCCommand - pointer to OMCCommand
-  */
-void OMCClassName::addOMCCommand(OMCCommand *pOMCCommand)
-{
-  mOMCCommandsList.append(pOMCCommand);
-}
-
-/*!
-  Returns the cached OMC command from the list.
-  \param command - the command to search for.
-  \return pointer to OMCCommand
-  */
-OMCCommand* OMCClassName::getOMCCommand(QString command)
-{
-  foreach (OMCCommand *pOMCCommand, mOMCCommandsList)
-  {
-    if (pOMCCommand->getOMCCommand().compare(command) == 0)
-      return pOMCCommand;
-  }
-  return 0;
-}
-
-/*!
-  \class OMCCommandsCache
-  \brief Stores the list of cached OMC classes.
-  */
-/*!
-  \param pParent - pointer to QObject
-  */
-OMCCommandsCache::OMCCommandsCache(QObject *pParent)
-  : QObject(pParent)
-{
-
-}
-
-/*!
-  Returns the cached OMC class name from the list.
-  \param className - the name of the class to search for.
-  \return pointer to OMCClassName
-  */
-OMCClassName* OMCCommandsCache::getOMCClassName(QString className)
-{
-  foreach (OMCClassName *pOMCClassName, mOMCClassNamesList)
-  {
-    if (pOMCClassName->getOMCClassName().compare(className) == 0)
-      return pOMCClassName;
-  }
-  return 0;
-}
-
-/*!
-  Returns the cached OMC command from the list.
-  \param className - the name of the class to search for.
-  \param command - the command to search for.
-  \return pointer to OMCCommand
-  */
-OMCCommand* OMCCommandsCache::getOMCCommand(QString className, QString command)
-{
-  OMCClassName *pOMCClassName = getOMCClassName(className);
-  if (pOMCClassName)
-    return pOMCClassName->getOMCCommand(command);
-  else
-    return 0;
-}
-
-/*!
-  Adds the OMC class name to the list of cached classes.
-  \param pOMCClassName - pointer to OMCClassName.
-  */
-void OMCCommandsCache::addOMCClassName(OMCClassName *pOMCClassName)
-{
-  mOMCClassNamesList.append(pOMCClassName);
-}
-
-/*!
-  Adds the OMC class name to the list of cached classes.
-  \param className - the name of the class.
-  \param command - the command.
-  \param commandResult - the command result
-  */
-void OMCCommandsCache::addOMCCommand(QString className, QString command, QString commandResult)
-{
-  OMCClassName *pOMCClassName = getOMCClassName(className);
-  if (pOMCClassName)
-  {
-    OMCCommand *pOMCCommand = pOMCClassName->getOMCCommand(command);
-    if (!pOMCCommand)
-    {
-      OMCCommand *pOMCCommand = new OMCCommand(command, commandResult, pOMCClassName);
-      pOMCClassName->addOMCCommand(pOMCCommand);
-    }
-  }
-  else
-  {
-    pOMCClassName = new OMCClassName(className, this);
-    addOMCClassName(pOMCClassName);
-  }
-}
-
Index: anches/OMEdit/OMEditGUI/OMC/OMCCommandsCache.h
===================================================================
--- /branches/OMEdit/OMEditGUI/OMC/OMCCommandsCache.h	(revision 15451)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * This file is part of OpenModelica.
- *
- * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
- * c/o Linköpings universitet, Department of Computer and Information Science,
- * SE-58183 Linköping, Sweden.
- *
- * All rights reserved.
- *
- * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR 
- * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. 
- * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
- * OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE. 
- *
- * The OpenModelica software and the Open Source Modelica
- * Consortium (OSMC) Public License (OSMC-PL) are obtained
- * from OSMC, either from the above address,
- * from the URLs: http://www.ida.liu.se/projects/OpenModelica or  
- * http://www.openmodelica.org, and in the OpenModelica distribution. 
- * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
- *
- * This program is distributed WITHOUT ANY WARRANTY; without
- * even the implied warranty of  MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
- * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
- *
- * See the full OSMC Public License conditions for more details.
- *
- */
-/*!
- * 
- * @author Adeel Asghar <adeel.asghar@liu.se>
- *
- * RCS: $Id$
- *
- */
-
-#ifndef OMCCOMMANDSCACHE_H
-#define OMCCOMMANDSCACHE_H
-
-#include "OMCProxy.h"
-
-class OMCCommand : public QObject
-{
-  Q_OBJECT
-public:
-  OMCCommand(QString command, QString commandResult, QObject *pParent);
-  QString getOMCCommand();
-  QString getOMCCommandResult();
-private:
-  QString mOMCCommand;
-  QString mOMCCommandResult;
-};
-class OMCClassName : public QObject
-{
-  Q_OBJECT
-public:
-  OMCClassName(QString className, QObject *pParent);
-  QString getOMCClassName();
-  void addOMCCommand(OMCCommand *pOMCCommand);
-  OMCCommand* getOMCCommand(QString command);
-private:
-  QString mOMCClassName;
-  QList<OMCCommand*> mOMCCommandsList;
-};
-
-class OMCCommandsCache : public QObject
-{
-  Q_OBJECT
-public:
-  OMCCommandsCache(QObject *pParent);
-  OMCClassName* getOMCClassName(QString className);
-  OMCCommand* getOMCCommand(QString className, QString command);
-  void addOMCClassName(OMCClassName *pOMCClassName);
-  void addOMCCommand(QString className, QString command, QString commandResult);
-private:
-  QList<OMCClassName*> mOMCClassNamesList;
-};
-
-#endif // OMCCOMMANDSCACHE_H
Index: /branches/OMEdit/OMEditGUI/OMC/OMCProxy.cpp
===================================================================
--- /branches/OMEdit/OMEditGUI/OMC/OMCProxy.cpp	(revision 15451)
+++ /branches/OMEdit/OMEditGUI/OMC/OMCProxy.cpp	(revision 15452)
@@ -42,4 +42,79 @@
 #include "OMCProxy.h"
 #include "../../../Compiler/runtime/config.h"
+
+/*!
+  \class OMCCommandsCache
+  \brief Stores the list of cached OMC classes.
+  */
+/*!
+  \param pParent - pointer to QObject
+  */
+OMCCommandsCache::OMCCommandsCache(QObject *pParent)
+  : QObject(pParent)
+{
+
+}
+
+/*!
+  Returns the cached OMC command from the hash.
+  \param className - the name of the class to search for.
+  \param command - the command to search for.
+  \return the OMC command
+  */
+OMCCommand OMCCommandsCache::getOMCCommand(QString className, QString command)
+{
+  if (mOMCCommandsHash.contains(className))
+  {
+    QList<OMCCommand> commandsList = mOMCCommandsHash.value(className);
+    foreach (OMCCommand omcCommand, commandsList)
+    {
+      if (omcCommand.mOMCCommand.compare(command) == 0)
+        return omcCommand;
+    }
+  }
+  return OMCCommand();
+}
+
+/*!
+  Adds the OMC class name to the hash of cached classes.
+  \param className - the name of the class.
+  \param command - the command.
+  \param commandResult - the command result
+  */
+void OMCCommandsCache::addOMCCommand(QString className, QString command, QString commandResult)
+{
+  /* if the className is already in commands hash */
+  if (mOMCCommandsHash.contains(className))
+  {
+    QList<OMCCommand> commandsList = mOMCCommandsHash.value(className);
+    /* if the commands list doesn't contain the command then add it */
+    bool found = false;
+    foreach (OMCCommand omcCommand, commandsList)
+    {
+      if (omcCommand.mOMCCommand.compare(command) == 0)
+      {
+        found = true;
+        break;
+      }
+    }
+    if (!found)
+    {
+      OMCCommand omcCommand;
+      omcCommand.mOMCCommand = command;
+      omcCommand.mOMCCommandResult = commandResult;
+      commandsList.append(omcCommand);
+      mOMCCommandsHash.insert(className, commandsList);
+    }
+  }
+  else
+  {
+    QList<OMCCommand> commandsList;
+    OMCCommand omcCommand;
+    omcCommand.mOMCCommand = command;
+    omcCommand.mOMCCommandResult = commandResult;
+    commandsList.append(omcCommand);
+    mOMCCommandsHash.insert(className, commandsList);
+  }
+}
 
 /*!
@@ -333,8 +408,8 @@
     }
   /* if OMC command is find in the cached OMC commands then use it and return. */
-  OMCCommand *pOMCCommand = mpOMCCommandsCache->getOMCCommand(className, expression);
-  if (pOMCCommand)
-  {
-    setResult(pOMCCommand->getOMCCommandResult());
+  OMCCommand pOMCCommand = mpOMCCommandsCache->getOMCCommand(className, expression);
+  if (!pOMCCommand.mOMCCommandResult.isEmpty())
+  {
+    setResult(pOMCCommand.mOMCCommandResult);
     // write command to the commands log.
     QTime commandTime;
Index: /branches/OMEdit/OMEditGUI/OMC/OMCProxy.h
===================================================================
--- /branches/OMEdit/OMEditGUI/OMC/OMCProxy.h	(revision 15451)
+++ /branches/OMEdit/OMEditGUI/OMC/OMCProxy.h	(revision 15452)
@@ -51,4 +51,21 @@
 class StringHandler;
 class OMCCommandsCache;
+
+struct OMCCommand
+{
+  QString mOMCCommand;
+  QString mOMCCommandResult;
+};
+
+class OMCCommandsCache : public QObject
+{
+  Q_OBJECT
+public:
+  OMCCommandsCache(QObject *pParent);
+  OMCCommand getOMCCommand(QString className, QString command);
+  void addOMCCommand(QString className, QString command, QString commandResult);
+private:
+  QHash<QString, QList<OMCCommand> > mOMCCommandsHash;
+};
 
 class OMCProxy : public QObject
Index: /branches/OMEdit/OMEditGUI/OMEditGUI.pro
===================================================================
--- /branches/OMEdit/OMEditGUI/OMEditGUI.pro	(revision 15451)
+++ /branches/OMEdit/OMEditGUI/OMEditGUI.pro	(revision 15452)
@@ -61,5 +61,4 @@
     omc_communication.cc \
     OMC/OMCProxy.cpp \
-    OMC/OMCCommandsCache.cpp \
     Util/StringHandler.cpp \
     GUI/Widgets/MessagesWidget.cpp \
@@ -92,5 +91,4 @@
     omc_communication.h \
     OMC/OMCProxy.h \
-    OMC/OMCCommandsCache.h \
     Util/StringHandler.h \
     GUI/Widgets/MessagesWidget.h \
