/** * Saves current mapping into a DSL mapping file * @param out * @throws IOException */ public void saveMapping(final Writer out) throws IOException { for ( final Iterator it = this.mapping.getEntries().iterator(); it.hasNext(); ) { out.write( it.next().toString() ); out.write( "\n" ); } }
/** * Method to return the current mapping as a String object * @return */ public String dumpFile() { final StringBuilder buf = new StringBuilder(); for ( final Iterator it = this.mapping.getEntries().iterator(); it.hasNext(); ) { buf.append( it.next() ); buf.append( "\n" ); } return buf.toString(); }
/** * Saves the given mapping into a DSL mapping file * * @param out * @param mapping * @throws IOException */ public static void saveMapping(final Writer out, final DSLMapping mapping) throws IOException { for ( final Iterator it = mapping.getEntries().iterator(); it.hasNext(); ) { out.write( it.next().toString() ); out.write( "\n" ); } }
/** * Add the new mapping to this expander. * * @param mapping */ public void addDSLMapping(final DSLMapping mapping) { for ( DSLMappingEntry entry : mapping.getEntries() ) { if ( DSLMappingEntry.KEYWORD.equals( entry.getSection() ) ) { this.keywords.add( entry ); } else if ( DSLMappingEntry.CONDITION.equals( entry.getSection() ) ) { this.condition.add( entry ); } else if ( DSLMappingEntry.CONSEQUENCE.equals( entry.getSection() ) ) { this.consequence.add( entry ); } else { // if any, then add to them both condition and consequence this.condition.add( entry ); this.consequence.add( entry ); } } if ( mapping.getOption( "result" ) ) showResult = true; if ( mapping.getOption( "steps" ) ) showSteps = true; if ( mapping.getOption( "keyword" ) ) showKeyword = true; if ( mapping.getOption( "when" ) ) showWhen = true; if ( mapping.getOption( "then" ) ) showThen = true; if ( mapping.getOption( "usage" ) ) showUsage = true; }
private void populateDSLSentences(final List<DSLTokenizedMappingFile> dsls) { for ( DSLTokenizedMappingFile file : dsls ) { for ( DSLMappingEntry entry : file.getMapping().getEntries() ) { if ( entry.getSection() == DSLMappingEntry.CONDITION ) { builder.addDSLConditionSentence( entry.getMappingKey() ); } else if ( entry.getSection() == DSLMappingEntry.CONSEQUENCE ) { builder.addDSLActionSentence( entry.getMappingKey() ); } else if ( entry.getSection() == DSLMappingEntry.KEYWORD ) { builder.addDSLMapping( entry ); } else if ( entry.getSection() == DSLMappingEntry.ANY ) { builder.addDSLConditionSentence( entry.getMappingKey() ); builder.addDSLActionSentence( entry.getMappingKey() ); } } } }
private void populateDSLSentences(final List<DSLTokenizedMappingFile> dsls) { for ( DSLTokenizedMappingFile file : dsls ) { for ( DSLMappingEntry entry : file.getMapping().getEntries() ) { if ( entry.getSection() == DSLMappingEntry.CONDITION ) { builder.addDSLConditionSentence( entry.getMappingKey() ); } else if ( entry.getSection() == DSLMappingEntry.CONSEQUENCE ) { builder.addDSLActionSentence( entry.getMappingKey() ); } else if ( entry.getSection() == DSLMappingEntry.KEYWORD ) { builder.addDSLMapping( entry ); } else if ( entry.getSection() == DSLMappingEntry.ANY ) { builder.addDSLConditionSentence( entry.getMappingKey() ); builder.addDSLActionSentence( entry.getMappingKey() ); } } } }