Class NamingContext
- java.lang.Object
-
- com.cosylab.vdct.graphics.objects.NamingContext
-
public class NamingContext extends Object
- Author:
- ilist
-
-
Constructor Summary
Constructors Constructor Description NamingContext(NamingContext parent, VDBTemplate template, String addedPrefix, String removedPrefix, boolean export)
This constructor should be used for the topmost template, which doesn't have template instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMacro(String name, String value)
Adds a macro to this naming contextvoid
addPort(String name, String value)
Adds a port to this naming contextNamingContext
createNamingContextFor(VDBTemplateInstance instance)
Creates or returns NamingContext for specific templateString
findAndResolveMacro(String name)
Searches for the macro in the specific template.String
findAndResolvePort(String temp, String name)
Searches for port in the specific template.Map
getMacroMap()
Returns only mapping of macrosMap
getMap()
Returns full mapNamingContext
getParent()
Returns parent, which can be null.String
getResolvedName(String name)
Used in write VDCT data Should handle exporting single GroupVDBTemplate
getTemplate()
Returns templateVDBTemplateInstance
getTemplateInstance()
Returns template instance, which can be nullString
matchAndReplace(String value)
Finds $() and $(.) in strings and replaces them.String
resolveLink(String target)
Subtracts record name from link, looks for apropriate record and renames the record in apropriate way.String
resolveMacro(String name, String value)
Recursively resolves macros/portsString
resolvePort(VDBPort port)
Recursively resolves macros/ports
-
-
-
Field Detail
-
cycleFlag
public static final Object cycleFlag
-
-
Constructor Detail
-
NamingContext
public NamingContext(NamingContext parent, VDBTemplate template, String addedPrefix, String removedPrefix, boolean export)
This constructor should be used for the topmost template, which doesn't have template instance- Parameters:
parent
- parenttemplate
- templateaddedPrefix
- addedPrefixremovedPrefix
- removedPrefixexport
- export
-
-
Method Detail
-
getParent
public NamingContext getParent()
Returns parent, which can be null.- Returns:
- something
-
getTemplateInstance
public VDBTemplateInstance getTemplateInstance()
Returns template instance, which can be null- Returns:
- something
-
getTemplate
public VDBTemplate getTemplate()
Returns template- Returns:
- something
-
getMap
public Map getMap()
Returns full map- Returns:
- something
-
getMacroMap
public Map getMacroMap()
Returns only mapping of macros- Returns:
- something
-
resolveMacro
public String resolveMacro(String name, String value)
Recursively resolves macros/ports- Parameters:
name
- namevalue
- value- Returns:
- something
-
createNamingContextFor
public NamingContext createNamingContextFor(VDBTemplateInstance instance)
Creates or returns NamingContext for specific template- Parameters:
instance
- instance- Returns:
- something
-
resolvePort
public String resolvePort(VDBPort port)
Recursively resolves macros/ports- Parameters:
port
- port- Returns:
- something
-
getResolvedName
public String getResolvedName(String name)
Used in write VDCT data Should handle exporting single Group- Parameters:
name
- name- Returns:
- something
-
addPort
public void addPort(String name, String value)
Adds a port to this naming context- Parameters:
name
- namevalue
- value
-
addMacro
public void addMacro(String name, String value)
Adds a macro to this naming context- Parameters:
name
- namevalue
- value
-
resolveLink
public String resolveLink(String target)
Subtracts record name from link, looks for apropriate record and renames the record in apropriate way. It contructs back the link.- Parameters:
target
- target- Returns:
- something
-
findAndResolveMacro
public String findAndResolveMacro(String name)
Searches for the macro in the specific template. Possibly also for global macro definitions.- Parameters:
name
- name- Returns:
- something
-
findAndResolvePort
public String findAndResolvePort(String temp, String name)
Searches for port in the specific template. Notice that port has to be resolved in inner template, but added in outer one.- Parameters:
temp
- tempname
- name- Returns:
- something
-
matchAndReplace
public String matchAndReplace(String value)
Finds $() and $(.) in strings and replaces them. TASK:RECMACROS: currently it doesn't handle something like $($()) very well. I don't think this is a simple problem, which could be done with regex. Hierarchy prevents it.- Parameters:
value
- value- Returns:
- something
-
-