1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core;
13 import net.sourceforge.phpdt.core.IBuffer;
14 import net.sourceforge.phpdt.core.ICompilationUnit;
15 import net.sourceforge.phpdt.core.WorkingCopyOwner;
18 * Wraps an IBufferFactory. TODO remove when removing IBufferFactory
22 public class BufferFactoryWrapper extends WorkingCopyOwner {
24 public net.sourceforge.phpdt.core.IBufferFactory factory;
26 private BufferFactoryWrapper(
27 net.sourceforge.phpdt.core.IBufferFactory factory) {
28 this.factory = factory;
31 public static WorkingCopyOwner create(
32 net.sourceforge.phpdt.core.IBufferFactory factory) {
33 return new BufferFactoryWrapper(factory);
39 * @see net.sourceforge.phpdt.core.WorkingCopyOwner#createBuffer(net.sourceforge.phpdt.core.ICompilationUnit)
41 public IBuffer createBuffer(ICompilationUnit workingCopy) {
42 if (this.factory == null)
43 return super.createBuffer(workingCopy);
44 return this.factory.createBuffer(workingCopy);
47 public boolean equals(Object obj) {
48 if (!(obj instanceof BufferFactoryWrapper))
50 BufferFactoryWrapper other = (BufferFactoryWrapper) obj;
51 if (this.factory == null)
52 return other.factory == null;
53 return this.factory.equals(other.factory);
56 public int hashCode() {
57 if (this.factory == null)
59 return this.factory.hashCode();
62 public String toString() {
63 return "FactoryWrapper for " + this.factory; //$NON-NLS-1$