| File | Line |
|---|
| org/millscript/millscript/functions/GroupFunction.java | 151 |
| org/millscript/millscript/functions/GroupPreserveOrderFunction.java | 129 |
deepGroup( mc, needsGrouping, fields, idx, limit )
);
}
}
return map;
}
/**
* @see org.millscript.millscript.functions.Function#apply(org.millscript.millscript.vm.Machine, int)
*/
@Override
public void apply( final Machine mc, final int nargs ) {
if ( nargs <= 0 ) {
checkNargsGT( mc, 1, nargs );
} else if ( nargs == 2 ) {
Object by = mc.popObject();
IList list = mc.popIList();
mc.pushObject( group( mc, list, by ) );
} else if ( nargs >= 3 ) {
// This list will hold the fields to group by
EList< Object > fields = new ELinkedList< Object >();
// Pop each field name off the stack and add it to the front of the
// list. (arguments to a function are pushed onto the stack, hence
// you pop them off in reverse order)
for ( int i = 1; i < nargs; i++ ) {
fields.addFirst( mc.popObject() );
}
// Pop the ungrouped list of maps off the stack
IList list = mc.popIList();
// Push the grouped data onto the stack, i.e. from the script point
// of view, return the grouped data
mc.pushObject( deepGroup( mc, list, fields, 1, nargs ) );
}
/* otherwise nargs == 1 and we simply fall thru */
}
} |
| File | Line |
|---|
| org/millscript/millscript/render/PropertiesRenderer.java | 65 |
| org/millscript/millscript/render/PropertiesRenderer.java | 111 |
public void appendEscapeFor( final char ch ) throws IOException {
switch ( ch ) {
case '\\':
super.outputWriter.write( '\\' );
super.outputWriter.write( '\\' );
break;
case '\f':
super.outputWriter.write( '\\' );
super.outputWriter.write( 'f' );
break;
case '\n':
super.outputWriter.write( '\\' );
super.outputWriter.write( 'n' );
break;
case '\r':
super.outputWriter.write( '\\' );
super.outputWriter.write( 'r' );
break;
case '\t':
super.outputWriter.write( '\\' );
super.outputWriter.write( 't' );
break;
case '#': case '!': case '=': case ':': case ' ':
super.outputWriter.write( '\\' );
super.outputWriter.write( ch );
break;
default: |
| File | Line |
|---|
| org/millscript/millscript/render/XMLCDATARenderer.java | 96 |
| org/millscript/millscript/render/AbstractRenderer.java | 158 |
return this.outputEncoder.canEncode( ch );
}
/**
* @see org.millscript.millscript.render.Renderer#render(java.lang.Object)
*/
public void render( final Object o ) throws IOException {
if ( o == null ) {
return;
} else if ( o instanceof Renderable ) {
((Renderable) o).render( this );
} else if ( o instanceof IList ) {
MapIterator it = ((IList) o).iterator( true );
while ( it.hasNext() ) {
this.render( it.nextValue() );
}
} else if ( o instanceof List ) {
Iterator it = ((List)o).iterator();
while ( it.hasNext() ) {
this.render( it.next() );
}
} else {
// FIXME - This code should use the standard
// AbstractRenderer.append(CharSequence) but we need to provide a way to
// parse database content into an XmlElement before we can change
// it.
this.renderObject( o );
}
}
/**
* @see org.millscript.millscript.render.Renderer#renderAsDocument(java.lang.Object)
*/
public final void renderAsDocument( final Object o ) { |
| File | Line |
|---|
| org/millscript/millscript/render/LinesRenderer.java | 54 |
| org/millscript/millscript/render/TXTRenderer.java | 49 |
public TXTRenderer( final Configuration conf, final VFile file ) {
super( conf, file );
// Make a new print writer over the basic buffered writer
this.outputPrintWriter = new PrintWriter( this.outputWriter );
}
/**
* @see org.millscript.millscript.render.Renderer#append(char)
*/
public void append( final char ch ) {
this.appendNoEscape( ch );
}
/**
* @see org.millscript.millscript.render.Renderer#append(java.lang.CharSequence)
*/
@Override
public void append( final CharSequence cs ) {
this.appendNoEscape( cs );
}
/**
* @see org.millscript.millscript.render.Renderer#appendEscapeFor(char)
*/
public void appendEscapeFor( final char ch ) {
this.appendNoEscape( ch );
}
/**
* @see org.millscript.millscript.render.Renderer#appendNoEscape(char)
*/
public void appendNoEscape( final char ch ) {
FormatPrint.print1( this.outputPrintWriter, new Character( ch ) );
}
/**
* @see org.millscript.millscript.render.Renderer#appendNoEscape(java.lang.CharSequence)
*/
@Override
public void appendNoEscape( final CharSequence cs ) {
FormatPrint.print1( this.outputPrintWriter, cs );
}
/**
* @see org.millscript.millscript.render.Renderer#render(java.lang.Object)
*/
@Override
public void render( final Object o ) { |
| File | Line |
|---|
| org/millscript/millscript/functions/JdbcExecuteUpdateFunction.java | 73 |
| org/millscript/millscript/functions/JdbcExecuteQueryFunction.java | 79 |
}
/**
* @see org.millscript.millscript.functions.Function#apply(org.millscript.millscript.vm.Machine, int)
*/
@Override
public void apply( final Machine mc, final int nargs ) {
// Check that we received at least one argument
this.checkNargsGT( mc, 1, nargs );
// Get any prepared statement arguments
final Object[] prepArgs = mc.popArgsArray( nargs - 1 );
// Pop the DataSource we will use for executing the prepared statement
final DatabaseSource source = mc.popDatabaseSource();
try {
// Obtain a connection from the supplied DataSource
Connection conn = source.getConnection();
// First check if the supplied DataSource is the same as the one we
// have cached from previous applications of this function.
if ( conn != cachedConn ) {
// Close the existing prepared statement and connection.
if ( cachedPrep != null ) {
cachedPrep.close();
}
// Using the new connection, prepare the SQL statement
cachedPrep = conn.prepareStatement( sql );
// Now we're fully initialised, store the supplied DataSource.
cachedConn = conn;
}
// Initialise the parameters for the prepared statement by iterating
// through each one and setting it.
for ( int i = 0; i < prepArgs.length; i++ ) {
this.cachedPrep.setObject( i + 1, prepArgs[ i ] );
} |
| File | Line |
|---|
| org/millscript/millscript/render/XMLCDATARenderer.java | 179 |
| org/millscript/millscript/render/HTMLCDATARenderer.java | 167 |
parentRenderer.appendNoEscape( o.toString() );
}
/**
* @see org.millscript.millscript.render.Renderer#renderXMLComment(org.millscript.millscript.datatypes.XmlComment)
*/
public void renderXMLComment( final XmlComment c ) throws IOException {
parentRenderer.renderXMLComment( c );
}
/**
* @see org.millscript.millscript.render.Renderer#renderXMLElement(org.millscript.millscript.datatypes.XmlElement)
*/
public void renderXMLElement( final XmlElement x ) throws IOException {
parentRenderer.appendNoEscape( '<' );
parentRenderer.appendNoEscape( x.tagName() );
MapIterator it = x.getAttributes().iterator( true );
while ( it.hasNext() ) {
Object key = it.nextKey();
Object val = it.currentValue();
if ( key != null ) {
parentRenderer.appendNoEscape( ' ' );
parentRenderer.appendNoEscape( key.toString() ); |
| File | Line |
|---|
| org/millscript/millscript/loaders/XMLSkeletonLoader.java | 71 |
| org/millscript/millscript/loaders/SkeletonLoader.java | 59 |
new NoNamespacesName( "field" )
},
new SpecialTemplateName[] {
new ItemName( this ),
new FieldName( this )
},
true
);
}
/**
* @see org.millscript.millscript.loaders.BasicTemplateLoader#compAttributeValue(java.lang.String)
*/
@Override
public Expr compAttributeValue( final String value ) {
if ( value.length() > 0 && value.charAt( 0 ) == '?' ) {
// Compile everything but the leading '?'
// arg[ s ]
return IndexExpr.make(
new NameExpr( "arg" ),
new ConstantExpr( value.substring( 1, value.length() ) )
);
} else {
return new ConstantExpr( value );
}
}
/**
* @see org.millscript.millscript.loaders.BasicTemplateLoader#compileEndTag(org.millscript.commons.xml.api.token.EndTagToken)
*/
@Override
public void compileEndTag( final EndTagToken token ) { |
| File | Line |
|---|
| org/millscript/millscript/functions/StringToXMLTokenVisitor.java | 260 |
| org/millscript/millscript/loaders/BasicTemplateLoaderTokenVisitor.java | 176 |
).mishap();
}
/**
* @see org.millscript.commons.xml.api.token.TokenVisitor#visit(org.millscript.commons.xml.api.token.EntityDeclToken)
*/
public void visit( final EntityDeclToken token ) {
throw(
Alerts.unimplemented(
"Entity declarations cannot be compiled at the moment, sorry!"
).decorate( token ).mishap()
);
}
/**
* @see org.millscript.commons.xml.api.token.TokenVisitor#visit(org.millscript.commons.xml.api.token.NotationDeclToken)
*/
public void visit( final NotationDeclToken token ) {
throw(
Alerts.unimplemented(
"Notation declarations cannot be compiled at the moment, sorry!"
).decorate( token ).mishap()
);
}
/**
* @see org.millscript.commons.xml.api.token.TokenVisitor#visit(org.millscript.commons.xml.api.token.PIToken)
*/
public void visit( final PIToken token ) {
throw(
Alerts.unimplemented(
"Processing instructions cannot be compiled at the moment, sorry!"
).decorate( token ).mishap()
);
}
/**
* @see org.millscript.commons.xml.api.token.TokenVisitor#visit(org.millscript.commons.xml.api.token.StartTagToken)
*/
public void visit( final StartTagToken token ) {
this.basicTemplateLoader.compileStartTag( token ); |