org.prorefactor.macrolevel
Class MacroRef

java.lang.Object
  extended by org.prorefactor.macrolevel.MacroRef
All Implemented Interfaces:
Xferable, java.io.Serializable, MacroEvent
Direct Known Subclasses:
IncludeRef, NamedMacroRef

public abstract class MacroRef
extends java.lang.Object
implements MacroEvent

Abstract class for a macro reference. There are two subclasses: one for references to named macros (i.e. those named with &global, &scoped, or an include argument), and one for references to include files.

See Also:
Serialized Form

Field Summary
 java.util.ArrayList<MacroEvent> macroEventList
          A list of macro references and defines that are in this macro's source
 MacroRef parent
           
 int refColumn
           
 int refLine
           
 
Constructor Summary
protected MacroRef()
          Only to be used for persistence/serialization.
 
Method Summary
 java.util.ArrayList<MacroEvent> findExternalMacroReferences()
          Find external macro references.
 java.util.ArrayList<MacroEvent> findExternalMacroReferences(int[] begin, int[] end)
           
 java.util.ArrayList<IncludeRef> findIncludeReferences(int fileIndex)
          Find references to an include file by the include file's file index number.
abstract  int getFileIndex()
           
 int getListingFileLine()
           
 MacroRef getParent()
           
 int[] getPosition()
          Get an int[3] file/line/column position for this macro reference.
 void writeXferBytes(DataXferStream out)
          Implement Xferable.
 void writeXferSchema(DataXferStream out)
          Implement Xferable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

refColumn

public int refColumn

refLine

public int refLine

parent

public MacroRef parent

macroEventList

public java.util.ArrayList<MacroEvent> macroEventList
A list of macro references and defines that are in this macro's source

Constructor Detail

MacroRef

protected MacroRef()
Only to be used for persistence/serialization.

Method Detail

getListingFileLine

public int getListingFileLine()

getParent

public MacroRef getParent()
Specified by:
getParent in interface MacroEvent

findExternalMacroReferences

public java.util.ArrayList<MacroEvent> findExternalMacroReferences()
Find external macro references. An external macro is an include file, a &GLOBAL or a &SCOPED from another file, and include args. TODO: (Jan 26) This doesn't seem right to me anymore. An &UNDEFINE only affects the local scope. If re-implemented after building a pseudoprocessor, consider dropping this. &UNDEFINE of a &GLOBAL or of a &SCOPED from another file is considered a reference. &UNDEFINE of an include argument is considered a reference. The subroutine is recursive, because a local define may incur an external reference!

Returns:
An array of objects: MacroRef and MacroDef (for UNDEFINE).

findExternalMacroReferences

public java.util.ArrayList<MacroEvent> findExternalMacroReferences(int[] begin,
                                                                   int[] end)
Parameters:
begin - An array of two integers to indicate the beginning line/column. May be null to indicate the beginning of the range is open ended.
end - An array of two integers to indicate the ending line/column. May be null to indicate the ending of the range is open ended.
See Also:
findExternalMacroReferences()

findIncludeReferences

public java.util.ArrayList<IncludeRef> findIncludeReferences(int fileIndex)
Find references to an include file by the include file's file index number. Search is recursive, beginning at this MacroRef object.

Parameters:
fileIndex - The fileIndex for the include file we want references to.
Returns:
An array of IncludeRef objects.

getFileIndex

public abstract int getFileIndex()

getPosition

public int[] getPosition()
                  throws RefactorException
Get an int[3] file/line/column position for this macro reference.

Specified by:
getPosition in interface MacroEvent
Throws:
RefactorException

writeXferBytes

public void writeXferBytes(DataXferStream out)
                    throws java.io.IOException
Implement Xferable.

Specified by:
writeXferBytes in interface Xferable
Throws:
java.io.IOException

writeXferSchema

public void writeXferSchema(DataXferStream out)
                     throws java.io.IOException
Implement Xferable.

Specified by:
writeXferSchema in interface Xferable
Throws:
java.io.IOException


Copyright © 2008 Joanju Software. All Rights Reserved.