Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void insertNew(String nome,String sigla,int min,int max){
- root = recInsert(root,nome,sigla);
- for(int i=min;i<=max;i++){
- root.pais.rating.insert(new Rating(i,0));
- }
- }
- public void insert(String nome,String sigla){
- root = recInsert(root,nome,sigla);
- }
- private AVLCountryNode recInsert(AVLCountryNode root,String nome,String sigla){
- if(root==null)return new AVLCountryNode(nome,sigla);
- else if(root.pais.nome.toUpperCase().compareTo(nome.toUpperCase())<0)
- root.left = recInsert(root.left, nome, sigla);
- else if(root.pais.nome.toUpperCase().compareTo(nome.toUpperCase())>0)
- root.right = recInsert(root.right, nome, sigla);
- else
- return root;
- return balance(root);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement