Namestorm

A

Alan Gutierrez

I've got an framework for creating SAX handlers through the
composition of strategies. Don't like the names.

Here are the interfaces...

public interface Strategy {
void startDocument(StrategyContext strategyContext,
EventContext eventContext);
void startElement(StrategyContext strategyContext,
EventContext eventContext);
void characters(StrategyContext strategyContext,
EventContext eventContext);
// And so on...
}

/** Example of Event. */
public interface Characters extends Event {
char[] getCharacters();
int getStart();
int getLength();
}

public interface StrategyContext {
Strategy getStrategy();
List getStrategyContextStack();
StrategyContext getParentContext(); // shortcut, common question
Map getVariables();
}

public interface EventContext {
Event getEvent();
List getEventContextStack();
EventContext getParentContext(); // shortcut, common question
Map getVariables();
PrefixMappingSet getPrefixMappingSet();
}

...in the above example, the context interfaces wrap something that
is external to wrapped object.

When a Strategy is at work, it is on a stack of strategies. Only
when it is on the stack, does it have a parent, and the
associated variables.

So a StrategyContext, is a bucket into which to put a Strategy,
before putting it into a stack.

Similarly, an event only has a meaningful set of prefix
mappings when it is on a processing stack.

My question is, what is a better name for these interfaces?

I don't think StrategyBucket is any better, since the user's
focus insn't necessarily on the stack.

- EventContext < Event >
- EventState < Event >
- EventBox < Event >

- Event < Lexeme >

- StrategyContext < Strategy >
- StrategyState < Strategy >
- StrategyBox < Strategy >

- ParseContext < Strategy >
- Stream < Strategy >
- StreamContext < Strategy >
- Process < Strategy >

Thanks for your consideration.

Alan Gutierrez - (e-mail address removed)
 
A

Alan Gutierrez

When a Strategy is at work, it is on a stack of strategies. Only
when it is on the stack, does it have a parent, and the
associated variables.

So a StrategyContext, is a bucket into which to put a Strategy,
before putting it into a stack.

Similarly, an event only has a meaningful set of prefix
mappings when it is on a processing stack.

My question is, what is a better name for these interfaces?

I don't think StrategyBucket is any better, since the user's
focus insn't necessarily on the stack.

- EventContext < Event >
- EventState < Event >
- EventBox < Event >

- Event < Lexeme >

- StrategyContext < Strategy >
- StrategyState < Strategy >
- StrategyBox < Strategy >

- ParseContext < Strategy >
- Stream < Strategy >
- StreamContext < Strategy >
- Process < Strategy >

Thanks for your consideration.

I settled on this:

Event < Lexeme >
Campaign < Strategy >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top