private void divideSamples(Node node, SampleSet nodeSet){
		/*
		 * The first step is to assign the given set to the top node of the subtree.
		 * If it is a leaf, we're done; else we have to divide the samples into the
		 * correct subsets for the subtrees.
		 */
		node.setSampleSet(nodeSet);
		if(!node.isLeaf()){
			
			InternalNode decisionNode = (InternalNode) node;
			Test nodeTest = decisionNode.getTest();

			System.out.println("Dividing pruning set based on "+ decisionNode.getTest().printTest());

			/*
			 * For tests on continuous attributes, the division is always binary.
			 * Therefore we can divide the set into the set for which the test is true
			 * and the set for which it's false. This is obviously dependent on the 
			 * test of the node, which is always a comparison "<x" due to the construction implementation.
			 */
			if(nodeTest instanceof ContinuousTest){
				
				SampleSet trueSet = new SampleSet();
				trueSet.setAtrributes(nodeSet.getAttributes());
				SampleSet falseSet = new SampleSet();
				falseSet.setAtrributes(nodeSet.getAttributes());
				
				for(Sample s: nodeSet.getSamples()){
					if(s.getValue(nodeTest.getTestAttribute().getId()).doubleValue() < ((ContinuousTest) nodeTest).getSplitValue()){
						trueSet.addSample(s);
					}else
						falseSet.addSample(s);
					}
				
				/*
				 * After the determination of the true and false set dependent on the node's test
				 * those sets are recursively distributed among the two subtrees starting with the node's children.
				 */
				for(Node child: decisionNode.getChildren()){
					if (((ContinuousTestValue) child.getTestValue()).value == true){
						divideSamples(child, trueSet);
					}else{
						divideSamples(child, falseSet);
					}
				}
			}
			/*
			 * For categorical Attributes the distribution is done per child.
			 * For each child, all samples with the correct attribute value according
			 * to the testValue of the child are assembled in a new set of samples.
			 * Then the derived samples are distributed in the subtree of that child.
			 */
			else{
				CategoricalAttribute decisionAttribute = (CategoricalAttribute) decisionNode.getTest().getTestAttribute();
				
				for(Node child: decisionNode.getChildren()){
					SampleSet childSet = new SampleSet();
					childSet.setAtrributes(nodeSet.getAttributes());
				
					String childValue = ((CategoricalTestValue) child.getTestValue()).getValue();
					
					for(Sample s: nodeSet.getSamples()){
						if(s.getValue(decisionAttribute.getId()).equals(decisionAttribute.addValue(childValue))){
							childSet.addSample(s);
						}
					}
					
					divideSamples(child, childSet);
				}
			}
		}
	}