Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.litesoft.aokeyhole.objects.support;

import java.util.*;

public abstract class AbstractLineBase extends AbstractBase
{
    public String[] toLines()
    {
        LinkedList<String> list = new LinkedList<String>();
        addLines( list, 0 );
        return list.toArray( new String[list.size()] );
    }

    abstract public void addLines( List<String> pCollector, int pIndent );

    protected StringBuilder startLine( int pIndent )
    {
        return baseLine( pIndent );
    }

    protected void addNonNullLine( List<String> pCollector, int pIndent, String pWhat, String pData )
    {
        if ( pData != null )
        {
            pCollector.add( baseLine( pIndent ).append( pWhat ).append( ':' ).append( pData ).toString() );
        }
    }

    protected StringBuilder baseLine( int pIndent )
    {
        StringBuilder sb = new StringBuilder();
        while ( pIndent-- > 0 )
        {
            sb.append( '.' );
        }
        return sb;
    }
}

Commits for litesoft/trunk/Java/KeyHole/src/org/litesoft/aokeyhole/objects/support/AbstractLineBase.java

Diff revisions: vs.
Revision Author Commited Message
2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000