com.rathravane.till.legal.CopyrightGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of silt Show documentation
Show all versions of silt Show documentation
A small collection of classes used in various Rathravane systems.
/*
* Copyright 2006-2012, Rathravane LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rathravane.till.legal;
import java.util.ArrayList;
import java.util.List;
public class CopyrightGenerator
{
public CopyrightGenerator addHolder ( String holder, int fromYear )
{
fHolders.add ( new HolderInfo ( holder, fromYear ) );
return this;
}
public List getCopyrightNotices ()
{
final ArrayList result = new ArrayList ();
for ( HolderInfo hi : fHolders )
{
result.add ( getCopyrightNotice ( hi.fHolder, hi.fFromYr ) );
}
result.add ( getCopyrightNotice ( rrStdCopyrightInfo.kHolder, rrStdCopyrightInfo.kStartYear ) );
return result;
}
public static String getCopyrightNotice ()
{
return getCopyrightNotice ( rrStdCopyrightInfo.kHolder, rrStdCopyrightInfo.kStartYear );
}
public static String getCopyrightNotice ( String holder, int fromYear )
{
return getCopyrightNotice ( holder, fromYear, thisYear () );
}
public static String getCopyrightNotice ( String holder, int fromYear, int toYear )
{
final StringBuffer sb = new StringBuffer ();
sb.append ( "(c) " );
sb.append ( getYearRange ( fromYear, toYear ) );
sb.append ( ", " );
sb.append ( holder );
return sb.toString ();
}
public static String getYearRange ( int fromYear, int toYear )
{
final StringBuffer sb = new StringBuffer ();
sb.append ( fromYear );
if ( toYear > fromYear )
{
sb.append ( "-" );
sb.append ( "" + toYear );
}
return sb.toString ();
}
private static int thisYear ()
{
return rrStdCopyrightInfo.kBuildYear;
}
private class HolderInfo
{
public HolderInfo ( String holder, int fromYr )
{
fHolder = holder;
fFromYr = fromYr;
}
public final String fHolder;
public final int fFromYr;
};
private final ArrayList fHolders = new ArrayList ();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy