diff options
author | jonas <himself@jonasgunz.de> | 2017-01-30 17:43:25 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2017-01-30 17:43:25 +0100 |
commit | c55ef6a36cf8c8d862ce9a8aa4277b637c86c278 (patch) | |
tree | 0480a258fb3d855a8e5b0ba7233da4848b858d5f | |
download | tree-c55ef6a36cf8c8d862ce9a8aa4277b637c86c278.tar.gz |
initial
-rw-r--r-- | tree/.cproject | 114 | ||||
-rw-r--r-- | tree/.gitignore | 1 | ||||
-rw-r--r-- | tree/.project | 27 | ||||
-rw-r--r-- | tree/.settings/language.settings.xml | 25 | ||||
-rw-r--r-- | tree/src/cData.cpp | 68 | ||||
-rw-r--r-- | tree/src/cData.h | 46 | ||||
-rw-r--r-- | tree/src/cNode.cpp | 136 | ||||
-rw-r--r-- | tree/src/cNode.h | 108 | ||||
-rw-r--r-- | tree/src/cTree.h | 30 | ||||
-rw-r--r-- | tree/src/main.cpp | 18 |
10 files changed, 573 insertions, 0 deletions
diff --git a/tree/.cproject b/tree/.cproject new file mode 100644 index 0000000..af2dc9d --- /dev/null +++ b/tree/.cproject @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.992883527"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.992883527" moduleId="org.eclipse.cdt.core.settings" name="Debug"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.992883527" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.992883527." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1750761033" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug"> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1864634322" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/> + <builder buildPath="${workspace_loc:/tree}/Debug" id="cdt.managedbuild.builder.gnu.cross.1349048457" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.builder.gnu.cross"/> + <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1925147654" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1319784671" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.option.debugging.level.649809700" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.382352829" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.378734056" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"> + <option id="gnu.cpp.compiler.option.optimization.level.1373181722" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.debugging.level.1527262653" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1867538012" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1293762997" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/> + <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1925898847" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.247454882" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1424149941" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/> + <tool id="cdt.managedbuild.tool.gnu.cross.assembler.893200012" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler"> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.250215905" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.507680601"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.507680601" moduleId="org.eclipse.cdt.core.settings" name="Release"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.507680601" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release"> + <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.507680601." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.984796511" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release"> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1120185805" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/> + <builder buildPath="${workspace_loc:/tree}/Release" id="cdt.managedbuild.builder.gnu.cross.2019898451" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.builder.gnu.cross"/> + <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.825674553" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler"> + <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1348342568" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.option.debugging.level.1462242656" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1915290344" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1286372418" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"> + <option id="gnu.cpp.compiler.option.optimization.level.2143794272" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.debugging.level.1668423462" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.223350955" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.2003157311" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/> + <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.804455710" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2030423663" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1292539643" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/> + <tool id="cdt.managedbuild.tool.gnu.cross.assembler.519967687" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler"> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.919314138" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + </cconfiguration> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="tree.cdt.managedbuild.target.gnu.cross.exe.2082357251" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/> + </storageModule> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.992883527;cdt.managedbuild.config.gnu.cross.exe.debug.992883527.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.378734056;cdt.managedbuild.tool.gnu.cpp.compiler.input.1867538012"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.992883527;cdt.managedbuild.config.gnu.cross.exe.debug.992883527.;cdt.managedbuild.tool.gnu.cross.c.compiler.1925147654;cdt.managedbuild.tool.gnu.c.compiler.input.382352829"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.507680601;cdt.managedbuild.config.gnu.cross.exe.release.507680601.;cdt.managedbuild.tool.gnu.cross.c.compiler.825674553;cdt.managedbuild.tool.gnu.c.compiler.input.1915290344"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.507680601;cdt.managedbuild.config.gnu.cross.exe.release.507680601.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1286372418;cdt.managedbuild.tool.gnu.cpp.compiler.input.223350955"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> +</cproject> diff --git a/tree/.gitignore b/tree/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/tree/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/tree/.project b/tree/.project new file mode 100644 index 0000000..885bee8 --- /dev/null +++ b/tree/.project @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>tree</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + </natures> +</projectDescription> diff --git a/tree/.settings/language.settings.xml b/tree/.settings/language.settings.xml new file mode 100644 index 0000000..e4c49b3 --- /dev/null +++ b/tree/.settings/language.settings.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<project> + <configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.992883527" name="Debug"> + <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> + <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> + <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> + <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> + <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="903670054141926848" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <language-scope id="org.eclipse.cdt.core.gcc"/> + <language-scope id="org.eclipse.cdt.core.g++"/> + </provider> + </extension> + </configuration> + <configuration id="cdt.managedbuild.config.gnu.cross.exe.release.507680601" name="Release"> + <extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> + <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> + <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> + <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> + <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="903670054141926848" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <language-scope id="org.eclipse.cdt.core.gcc"/> + <language-scope id="org.eclipse.cdt.core.g++"/> + </provider> + </extension> + </configuration> +</project> diff --git a/tree/src/cData.cpp b/tree/src/cData.cpp new file mode 100644 index 0000000..1599c3f --- /dev/null +++ b/tree/src/cData.cpp @@ -0,0 +1,68 @@ +/* + * cData.cpp + * + * Created on: Jan 29, 2017 + * Author: jonas + */ + +#include "cData.h" + +cData::cData(string _data) +{ + sData = _data; +} + +cData::~cData() +{ + +} + +string cData::getData() +{ + return sData; +} + + +bool cData::operator<(cData _data) +{ + if(sData.compare(_data.getData()) < 0) + return true; + else + return false; +} +bool cData::operator>(cData _data) +{ + if(sData.compare(_data.getData()) > 0) + return true; + else + return false; +} +bool cData::operator<(string _string) +{ + if(sData.compare(_string) < 0) + return true; + else + return false; +} +bool cData::operator>(string _string) +{ + if(sData.compare(_string) > 0) + return true; + else + return false; +} +bool cData::operator==(cData _data) +{ + if(_data.getData() == sData) + return true; + return false; +} +bool cData::operator==(string _data) +{ + if(sData == _data) + return true; + return false; +} + + + diff --git a/tree/src/cData.h b/tree/src/cData.h new file mode 100644 index 0000000..c0c2e28 --- /dev/null +++ b/tree/src/cData.h @@ -0,0 +1,46 @@ +/* + * cData.h + * + * Created on: Jan 26, 2017 + * Author: jonas + */ + +#ifndef NULL +#define NULL 0x00 +#endif + +#ifndef SRC_CDATA_H_ +#define SRC_CDATA_H_ + +#include <string> + +using namespace std; + +class cData{ +public: + cData(string _data); + /* + * Initializes cData with _data as saved Information + */ + ~cData(); + + string getData(); + /* + * Returns content of cData instance as String + */ + + bool operator<(cData); + bool operator>(cData); + bool operator<(string); + bool operator>(string); + bool operator==(cData); + bool operator==(string); + +private: + string sData; +}; + + + + +#endif /* SRC_CDATA_H_ */ diff --git a/tree/src/cNode.cpp b/tree/src/cNode.cpp new file mode 100644 index 0000000..0da4a34 --- /dev/null +++ b/tree/src/cNode.cpp @@ -0,0 +1,136 @@ +/* + * cDatanode.cpp + * + * Created on: Jan 29, 2017 + * Author: jonas + */ + +#include "cNode.h" +cNode::cNode() {} +cNode::~cNode(){} + +// +//===================================================================================================================== +// + +cDatanode::cDatanode(cData* _data) +{ + data = _data; + nextBigger = new cEndnode(); + nextSmaller = new cEndnode(); +}//constructor + +cDatanode::~cDatanode() +{ + delete data; + data = NULL; +}//Destructor + +cData cDatanode::getDataObject() +{ + return *data; +}//getDataObject + +void cDatanode::insert(cData* _data, cNode* _me = NULL) +{ + if (*_data > *data) + //nextBigger->isEnd() ? (void)(nextBigger = new cDatanode(_data)) : nextBigger->insert(_data); + nextBigger->insert(_data, nextBigger); + else + nextSmaller->insert(_data, nextSmaller); + //nextSmaller->isEnd() ? (void)(nextSmaller = new cDatanode(_data)) : nextSmaller->insert(_data); +}//insert + +void cDatanode::remove(cData* _data) +{ + +}//remove + +cData* cDatanode::search(string _search) +{ + if(*data > _search) + return nextSmaller->search(_search); + else if(*data < _search) + return nextBigger->search(_search); + else if(*data==_search) + return data; + return NULL; +}//search + +bool cDatanode::isEnd() +{ + return false; +}//isEnd + +list<cData>* cDatanode::getSortet(list<cData>* _list) +{ + nextSmaller->getSortet(_list); + _list->push_back(*data); + return nextBigger->getSortet(_list); +}//getSortet + +// +//============================================================================================================================== +// + +cEndnode::cEndnode() {} +cEndnode::~cEndnode() {} + +bool cEndnode::isEnd() +{ + delete this; ///TODO Check if it works!!! + return true; +} + +cData cEndnode::getDataObject() +{ + return (cData)NULL; +} + +void cEndnode::insert(cData* _data, cNode* _me) +{ + _me = _data; + delete this; +} + +void cEndnode::remove(cData*) +{ + +} + +cData* cEndnode::search(string) +{ + return NULL; +} + +list<cData>* cEndnode::getSortet(list<cData>* _list) +{ + return _list; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tree/src/cNode.h b/tree/src/cNode.h new file mode 100644 index 0000000..26267aa --- /dev/null +++ b/tree/src/cNode.h @@ -0,0 +1,108 @@ +/* + * cNode.h + * + * Created on: Jan 25, 2017 + * Author: jonas + */ + +#ifndef SRC_CNODE_H_ +#define SRC_CNODE_H_ + +#include "cData.h" +#include <list> + +using namespace std; + +class cNode { +public: + cNode(); + virtual ~cNode(); + + virtual cData getDataObject() = 0; + /* + * returns dataObject + */ + virtual void insert(cData*, cNode* = NULL) = 0; + /* + * Inserts *cData into tree + */ + virtual void remove(cData*) = 0; + /* + * Removes *cData from tree + */ + virtual cData* search(string) = 0; + /* + * Searches for a Object by its Primary Key, returns pointer pointing at result (NULL if no result) + */ + virtual bool isEnd() = 0; + /* + * returns false + */ + virtual list<cData>* getSortet(list<cData>* _list) = 0; + +}; + +class cDatanode:public cNode +{ + cDatanode(cData* _data); + ~cDatanode(); + + cData getDataObject(); + /* + * returns dataObject + */ + void insert(cData*, cNode* = NULL); + /* + * Inserts *cData into tree + */ + void remove(cData*); + /* + * Removes *cData from tree + */ + cData* search(string); + /* + * Searches for a Object by its Primary Key, returns pointer pointing at result (NULL if no result) + */ + bool isEnd(); + /* + * returns false + */ + list<cData>* getSortet(list<cData>* _list); +private: + cNode *nextSmaller, *nextBigger; + cData *data; + +}; + +class cEndnode:public cNode +{ +public: + cEndnode(); + ~cEndnode(); + + cData getDataObject(); + /* + * returns dataObject + */ + void insert(cData*, cNode* ); + /* + * Inserts *cData into tree + */ + void remove(cData*); + /* + * Removes *cData from tree + */ + cData* search(string); + /* + * Searches for a Object by its Primary Key, returns pointer pointing at result (NULL if no result) + */ + bool isEnd(); + /* + * returns false + */ + list<cData>* getSortet(list<cData>* _list); + +private: +}; + +#endif /* SRC_CNODE_H_ */ diff --git a/tree/src/cTree.h b/tree/src/cTree.h new file mode 100644 index 0000000..a6f1b83 --- /dev/null +++ b/tree/src/cTree.h @@ -0,0 +1,30 @@ +/* + * cTree.h + * + * Created on: Jan 25, 2017 + * Author: jonas + */ + +#ifndef SRC_CTREE_H_ +#define SRC_CTREE_H_ + +#include "cNode.h" +#include <string> + +using namespace std; + +class cTree{ +public: + void insert(cData*); + void insert(string); + + void remove(cData*); + cData search(string); + + +private: + +}; + + +#endif /* SRC_CTREE_H_ */ diff --git a/tree/src/main.cpp b/tree/src/main.cpp new file mode 100644 index 0000000..cdaa7b5 --- /dev/null +++ b/tree/src/main.cpp @@ -0,0 +1,18 @@ +/* + * main.cpp + * + * Created on: Jan 25, 2017 + * Author: jonas + */ +#include <iostream> + +#include "cTree.h" + +int main (void) +{ + + return 0; +} + + + |