1 11 package org.eclipse.ant.internal.ui.dtd.schema; 12 13 import org.eclipse.ant.internal.ui.dtd.IAtom; 14 import org.eclipse.ant.internal.ui.dtd.util.Factory; 15 import org.eclipse.ant.internal.ui.dtd.util.FactoryObject; 16 17 41 public class NfmNode implements FactoryObject { 42 43 public IAtom symbol; 44 public NfmNode next1; 45 public NfmNode next2; 46 public Dfm dfm; 47 public int mark; 48 49 private NfmNode() { 50 } 51 52 public static NfmNode nfmNode(IAtom symbol, NfmNode next) { 53 NfmNode nfm = getFree(); 54 nfm.symbol = symbol; 55 nfm.next1 = next; 56 return nfm; 57 } 58 59 public static NfmNode nfmNode(NfmNode next) { 60 NfmNode nfm = getFree(); 61 nfm.next1 = next; 62 return nfm; 63 } 64 65 public static NfmNode nfmNode() { 66 return getFree(); 67 } 68 69 72 public static void freeAll() { 73 while (fUsed != null) { 74 FactoryObject nfm = fUsed; 75 fUsed = nfm.next(); 76 setFree((NfmNode)nfm); 77 } 78 } 79 80 82 85 public FactoryObject next() { 86 return next; 87 } 88 89 92 public void next(FactoryObject obj) { 93 next = (NfmNode) obj; 94 } 95 private NfmNode next; 96 private static Factory fFactory = new Factory(); 97 private static FactoryObject fUsed = null; 98 private static NfmNode getFree() { 99 NfmNode nfm = (NfmNode) fFactory.getFree(); 100 if (nfm == null) 101 nfm = new NfmNode(); 102 nfm.next(fUsed); 103 fUsed = nfm; 104 return nfm; 105 } 106 private static void setFree(NfmNode nfm) { 107 nfm.symbol = null; 108 nfm.next1 = nfm.next2 = null; 109 nfm.dfm = null; 110 nfm.mark = 0; 111 fFactory.setFree(nfm); 112 } 113 } 114 | Popular Tags |