*/
public class Declarations extends FObj {
- private Map colorProfiles = null;
+ private Map<String, ColorProfile> colorProfiles = null;
/**
* @param parent FONode that is the parent of this object
private void addColorProfile(ColorProfile cp) {
if (colorProfiles == null) {
- colorProfiles = new java.util.HashMap();
+ colorProfiles = new java.util.HashMap<String, ColorProfile>();
}
if (colorProfiles.get(cp.getColorProfileName()) != null) {
// duplicate names
public ColorProfile getColorProfile(String cpName) {
ColorProfile profile = null;
if (this.colorProfiles != null) {
- profile = (ColorProfile)this.colorProfiles.get(cpName);
+ profile = this.colorProfiles.get(cpName);
}
return profile;
}
*/
public class LayoutMasterSet extends FObj {
- private Map simplePageMasters;
- private Map pageSequenceMasters;
+ private Map<String, SimplePageMaster> simplePageMasters;
+ private Map<String, PageSequenceMaster> pageSequenceMasters;
/**
* Create a LayoutMasterSet instance that is a child of the given
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
getRoot().setLayoutMasterSet(this);
- simplePageMasters = new java.util.HashMap();
- pageSequenceMasters = new java.util.HashMap();
+ simplePageMasters = new java.util.HashMap<String, SimplePageMaster>();
+ pageSequenceMasters = new java.util.HashMap<String, PageSequenceMaster>();
}
/** {@inheritDoc} */
*/
private void checkRegionNames() throws ValidationException {
// (user-entered) region-name to default region map.
- Map allRegions = new java.util.HashMap();
- for (Iterator spm = simplePageMasters.values().iterator();
- spm.hasNext();) {
- SimplePageMaster simplePageMaster
- = (SimplePageMaster)spm.next();
- Map spmRegions = simplePageMaster.getRegions();
- for (Iterator e = spmRegions.values().iterator();
- e.hasNext();) {
- Region region = (Region) e.next();
+ Map<String, String> allRegions = new java.util.HashMap<String, String>();
+ for (SimplePageMaster simplePageMaster : simplePageMasters.values()) {
+ Map<String, Region> spmRegions = simplePageMaster.getRegions();
+ for (Region region : spmRegions.values()) {
if (allRegions.containsKey(region.getRegionName())) {
String defaultRegionName
- = (String) allRegions.get(region.getRegionName());
+ = allRegions.get(region.getRegionName());
if (!defaultRegionName.equals(region.getDefaultRegionName())) {
getFOValidationEventProducer().regionNameMappedToMultipleRegionClasses(this,
region.getRegionName(),
}
}
allRegions.put(region.getRegionName(),
- region.getDefaultRegionName());
+ region.getDefaultRegionName());
}
}
}
* @return the requested simple-page-master
*/
public SimplePageMaster getSimplePageMaster(String masterName) {
- return (SimplePageMaster)this.simplePageMasters.get(masterName);
+ return this.simplePageMasters.get(masterName);
}
/**
* @return the requested PageSequenceMaster instance
*/
public PageSequenceMaster getPageSequenceMaster(String masterName) {
- return (PageSequenceMaster)this.pageSequenceMasters.get(masterName);
+ return this.pageSequenceMasters.get(masterName);
}
/**
* @return true when the region name specified has a region in this LayoutMasterSet
*/
public boolean regionNameExists(String regionName) {
- for (Iterator e = simplePageMasters.values().iterator();
- e.hasNext();) {
- if (((SimplePageMaster)e.next()).regionNameExists(regionName)) {
+ for (SimplePageMaster spm : simplePageMasters.values()) {
+ if (spm.regionNameExists(regionName)) {
return true;
}
}
// the set of flows includes StaticContent flows also
/** Map of flows to their flow name (flow-name, Flow) */
- private Map/*<String, Flow>*/ flowMap;
+ private Map<String, Flow> flowMap;
/**
* The currentSimplePageMaster is either the page master for the
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
- flowMap = new java.util.HashMap/*<String, Flow>*/();
+ flowMap = new java.util.HashMap<String, Flow>();
this.simplePageMaster
= getRoot().getLayoutMasterSet().getSimplePageMaster(masterReference);
break;
case FO_STATIC_CONTENT:
addFlow((StaticContent)child);
- flowMap.put(((StaticContent)child).getFlowName(), child);
+ flowMap.put(((Flow)child).getFlowName(), (Flow)child);
break;
default:
super.addChildNode(child);
}
/** @return the flow map for this page-sequence */
- public Map getFlowMap() {
+ public Map<String, Flow> getFlowMap() {
return this.flowMap;
}
// End of property values
private LayoutMasterSet layoutMasterSet;
- private List subSequenceSpecifiers;
+ private List<SubSequenceSpecifier> subSequenceSpecifiers;
private SubSequenceSpecifier currentSubSequence;
private int currentSubSequenceNumber = -1;
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
- subSequenceSpecifiers = new java.util.ArrayList();
+ subSequenceSpecifiers = new java.util.ArrayList<SubSequenceSpecifier>();
layoutMasterSet = parent.getRoot().getLayoutMasterSet();
layoutMasterSet.addPageSequenceMaster(masterName, this);
}
currentSubSequenceNumber++;
if (currentSubSequenceNumber >= 0
&& currentSubSequenceNumber < subSequenceSpecifiers.size()) {
- return (SubSequenceSpecifier)subSequenceSpecifiers
- .get(currentSubSequenceNumber);
+ return subSequenceSpecifiers.get(currentSubSequenceNumber);
}
return null;
}
currentSubSequenceNumber = -1;
currentSubSequence = null;
if (subSequenceSpecifiers != null) {
- for (int i = 0; i < subSequenceSpecifiers.size(); i++) {
- ((SubSequenceSpecifier)subSequenceSpecifiers.get(i)).reset();
+ for (SubSequenceSpecifier subSequenceSpecifier : subSequenceSpecifiers) {
+ subSequenceSpecifier.reset();
}
}
}
if (!success) {
if (currentSubSequenceNumber > 0) {
currentSubSequenceNumber--;
- currentSubSequence = (SubSequenceSpecifier)subSequenceSpecifiers
+ currentSubSequence = subSequenceSpecifiers
.get(currentSubSequenceNumber);
} else {
currentSubSequence = null;
private int numberConsumed = 0;
- private List conditionalPageMasterRefs;
+ private List<ConditionalPageMasterReference> conditionalPageMasterRefs;
private boolean hasPagePositionLast = false;
private boolean hasPagePositionOnly = false;
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
- conditionalPageMasterRefs = new java.util.ArrayList();
+ conditionalPageMasterRefs = new java.util.ArrayList<ConditionalPageMasterReference>();
assert parent.getName().equals("fo:page-sequence-master"); //Validation by the parent
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
numberConsumed++;
}
- for (int i = 0; i < conditionalPageMasterRefs.size(); i++) {
- ConditionalPageMasterReference cpmr
- = (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i);
+ for (ConditionalPageMasterReference cpmr : conditionalPageMasterRefs) {
if (cpmr.isValid(isOddPage, isFirstPage, isLastPage, isBlankPage)) {
return cpmr.getMasterReference();
}
private LayoutMasterSet layoutMasterSet;
private Declarations declarations;
private BookmarkTree bookmarkTree = null;
- private List destinationList;
- private List pageSequences;
+ private List<Destination> destinationList;
+ private List<PageSequence> pageSequences;
// temporary until above list populated
private boolean pageSequenceFound = false;
*/
public Root(FONode parent) {
super(parent);
- pageSequences = new java.util.ArrayList();
+ pageSequences = new java.util.ArrayList<PageSequence>();
}
/** {@inheritDoc} */
return null;
}
if (currentIndex < (pageSequences.size() - 1)) {
- return (PageSequence)pageSequences.get(currentIndex + 1);
+ return pageSequences.get(currentIndex + 1);
} else {
return null;
}
*/
public void addDestination(Destination destination) {
if (destinationList == null) {
- destinationList = new java.util.ArrayList();
+ destinationList = new java.util.ArrayList<Destination>();
}
destinationList.add(destination);
}
/**
* Returns the name of the next page master.
+ *
* @param isOddPage True if the next page number is odd
* @param isFirstPage True if the next page is the first
* @param isLastPage True if the next page is the last