1 34 35 package net.percederberg.grammatica.code.visualbasic; 36 37 import java.io.PrintWriter ; 38 import net.percederberg.grammatica.code.CodeElement; 39 import net.percederberg.grammatica.code.CodeStyle; 40 41 49 public class VisualBasicImports extends CodeElement { 50 51 54 private String namespace; 55 56 61 public VisualBasicImports(String namespace) { 62 this.namespace = namespace; 63 } 64 65 76 public int compareTo(Object obj) { 77 int value = super.compareTo(obj); 78 79 if (value == 0) { 80 return namespace.compareTo(obj.toString()); 81 } else { 82 return value; 83 } 84 } 85 86 94 public boolean equals(Object obj) { 95 return compareTo(obj) == 0; 96 } 97 98 103 public String toString() { 104 return namespace; 105 } 106 107 115 public int category() { 116 return namespace.startsWith("System") ? 1 : 2; 117 } 118 119 126 public void print(PrintWriter out, CodeStyle style, int indent) { 127 out.println(style.getIndent(indent) + "Imports " + namespace); 128 } 129 } 130 | Popular Tags |