package votorola.a.position; // Copyright 2013, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. import java.util.*; import votorola.a.*; import votorola.g.lang.*; /** A component pipe revision constructed for a specific {@linkplain DraftRevision draft * revision path}. */ public final @ThreadSafe class ComponentPipeRevision1 extends ComponentPipeRevision { /** Partially constructs a ComponentPipeRevision1 for {@linkplain #init(CoreRevision) * init} to finish. * * @see #pageID() * @param _pageName will be normalized for the {@linkplain #pageName() pageName}. * @see #rev() * @see #revLatest() * @see #nominee() * @see #person() * @see #pollName() */ ComponentPipeRevision1( final PollwikiVS wiki, int _pageID, String _pageName, int _rev, int _revLatest, String _nomineeName, String _personName, final String pollName ) throws MalformedContent { super( wiki, _pageID, _pageName, _rev, _revLatest, _nomineeName, _personName, pollName ); } /** Finishes the construction of this ComponentPipeRevision1 and sets {@linkplain * #isFullyConstructed() isFullyConstructed} true. * * @see #variant() * * @throws IllegalStateException if called a second time. */ public @ThreadRestricted("constructor") void init( CoreRevision _variant ) { if( isFullyConstructed ) throw new IllegalStateException(); variant = _variant; if( variant == null ) throw new NullPointerException(); // fail fast isFullyConstructed = true; } /** @throws UnsupportedOperationException */ public void init( PollwikiVS _wiki, String _contextPersonName, votorola.a.count.CountSource _countSource ) { throw new UnsupportedOperationException(); } // ------------------------------------------------------------------------------------ /** The variant indicated by this component pipe, being either the candidate variant * or the wild variant depending on the specific revision path for which this pipe * was constructed. */ public CoreRevision variant() { return variant; } private CoreRevision variant; // final when fully constructed, never null then // - C o r e - R e v i s i o n -------------------------------------------------------- public List addDraftRevisionPath( final List path ) { path.add( rev() ); return variant.addDraftRevisionPath( path ); } public CoreRevision contextView( String _contextPersonName ) { return ComponentPipeRevision1.this; } public DraftRevision draft() { return variant.draft(); } /** @see #init(CoreRevision) */ public boolean isFullyConstructed() { return isFullyConstructed; } private boolean isFullyConstructed; }