1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.jdt.core.IBuffer; 14 import org.eclipse.jdt.core.ICompilationUnit; 15 import org.eclipse.jdt.core.WorkingCopyOwner; 16 17 22 public class BufferFactoryWrapper extends WorkingCopyOwner { 23 24 public org.eclipse.jdt.core.IBufferFactory factory; 25 26 private BufferFactoryWrapper(org.eclipse.jdt.core.IBufferFactory factory) { 27 this.factory = factory; 28 } 29 30 public static WorkingCopyOwner create(org.eclipse.jdt.core.IBufferFactory factory) { 31 return new BufferFactoryWrapper(factory); 32 } 33 34 37 public IBuffer createBuffer(ICompilationUnit workingCopy) { 38 if (this.factory == null) return super.createBuffer(workingCopy); 39 return this.factory.createBuffer(workingCopy); 40 } 41 42 public boolean equals(Object obj) { 43 if (!(obj instanceof BufferFactoryWrapper)) return false; 44 BufferFactoryWrapper other = (BufferFactoryWrapper)obj; 45 if (this.factory == null) return other.factory == null; 46 return this.factory.equals(other.factory); 47 } 48 public int hashCode() { 49 if (this.factory == null) return 0; 50 return this.factory.hashCode(); 51 } 52 public String toString() { 53 return "FactoryWrapper for " + this.factory; } 55 } 56 | Popular Tags |