1 33 34 package net.percederberg.grammatica.code.csharp; 35 36 import java.io.PrintWriter ; 37 import net.percederberg.grammatica.code.CodeElement; 38 import net.percederberg.grammatica.code.CodeStyle; 39 40 46 public class CSharpUsing extends CodeElement { 47 48 51 private String namespace; 52 53 58 public CSharpUsing(String namespace) { 59 this.namespace = namespace; 60 } 61 62 73 public int compareTo(Object obj) { 74 int value = super.compareTo(obj); 75 76 if (value == 0) { 77 return namespace.compareTo(obj.toString()); 78 } else { 79 return value; 80 } 81 } 82 83 91 public boolean equals(Object obj) { 92 return compareTo(obj) == 0; 93 } 94 95 100 public String toString() { 101 return namespace; 102 } 103 104 112 public int category() { 113 return namespace.startsWith("System") ? 1 : 2; 114 } 115 116 123 public void print(PrintWriter out, CodeStyle style, int indent) { 124 out.println(style.getIndent(indent) + "using " + namespace + ";"); 125 } 126 } 127 | Popular Tags |