Subversion Repositories SmartDukaan

Rev

Rev 3283 | Rev 4980 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3283 Rev 4975
Line 81... Line 81...
81
	private Node addChars(char[] s, int position, Node node, String string)
81
	private Node addChars(char[] s, int position, Node node, String string)
82
    {
82
    {
83
        if (node == null) { 
83
        if (node == null) { 
84
        	node = new Node(s[position], null); 
84
        	node = new Node(s[position], null); 
85
        }
85
        }
86
        if (s[position] < node.storedChar) { 
86
        if (s[position] < node.storedChar) {
87
        	node.left = addChars(s, position, node.left, string); 
87
        	node.left = addChars(s, position, node.left, string); 
88
        }
88
        }
89
        else if (s[position] > node.storedChar) { 
89
        else if (s[position] > node.storedChar) {
90
        	node.right = addChars(s, position, node.right, string); 
90
        	node.right = addChars(s, position, node.right, string); 
-
 
91
        }
-
 
92
        else {
-
 
93
        	if (position + 1 == s.length) {
-
 
94
        		node.addItem(string);
91
        	}
95
        	}
92
        	else
96
        	else {
93
        	{
-
 
94
        		if (position + 1 == s.length) { node.addItem(string); }
-
 
95
        		else { node.center =  addChars(s, position + 1, node.center, string); }
97
        		node.center =  addChars(s, position + 1, node.center, string);
96
        	}
98
        	}
-
 
99
        }
97
        return node;
100
        return node;
98
    }
101
    }
99
 
102
 
100
    public void addStringPart(String part, String string)
103
    public void addStringPart(String part, String string)
101
    {
104
    {
Line 172... Line 175...
172
    
175
    
173
    private void getChildElements(Node node, Set<String>  set){
176
    private void getChildElements(Node node, Set<String>  set){
174
    	if(node == null){
177
    	if(node == null){
175
    		return;
178
    		return;
176
    	}
179
    	}
177
    	if(node.itemSet != null){
-
 
178
    		if(node.itemSet != null && !node.itemSet.isEmpty()){
180
    	if(node.itemSet != null && !node.itemSet.isEmpty()){
179
    			set.addAll(node.itemSet);
181
    		set.addAll(node.itemSet);
180
    		}
-
 
181
    		return;
-
 
182
    	}else{
-
 
183
    		getChildElements(node.center, set);	
-
 
184
    	}
182
    	}
-
 
183
    	getChildElements(node.center, set);	
185
    	getChildElements(node.left, set);
184
    	getChildElements(node.left, set);
186
    	getChildElements(node.right, set);
185
    	getChildElements(node.right, set);
187
    }
186
    }
188
    
187
    
189
 
188