You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StrucFlgs.java 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id: $ */
  18. package org.apache.fop.render.afp.modca.triplets;
  19. /**
  20. * Used by ObjectClassificationTriplet to provide
  21. * information on the structure of the object and its container
  22. */
  23. public class StrucFlgs {
  24. private static final int OBJECT_DATA_NOT_CARRIED_IN_OBJECT_CONTAINER = 1;
  25. private static final int OBJECT_DATA_OBJECT_CONTAINER_STRUCTURE_UNKNOWN = 2;
  26. private static final int OBJECT_DATA_CARRIED_IN_OBJECT_CONTAINER = 3;
  27. private static final int OBJECT_CONTAINER_NOT_INCLUDE_OBJECT_ENVIRONMENT_GROUP = 4;
  28. private static final int OBJECT_CONTAINER_OBJECT_ENVIRONMENT_GROUP_CONTAINMENT_UNKNOWN = 8;
  29. private static final int OBJECT_CONTAINER_INCLUDES_OBJECT_ENVIRONMENT_GROUP = 12;
  30. private static final int OBJECT_CONTAINER_DATA_NOT_CARRIED_IN_OBJECT_DATA = 16;
  31. private static final int OBJECT_CONTAINER_DATA_OBJECT_DATA_CONTAINMENT_UNKNOWN = 32;
  32. private static final int OBJECT_CONTAINER_DATA_CARRIES_OBJECT_DATA = 48;
  33. // private static final int OBJECT_DATA_NOT_CARRIED_IN_OBJECT_CONTAINER = 48;
  34. // private static final int OBJECT_DATA_OBJECT_CONTAINER_STRUCTURE_UNKNOWN = 32;
  35. // private static final int OBJECT_DATA_CARRIED_IN_OBJECT_CONTAINER = 16;
  36. //
  37. // private static final int OBJECT_CONTAINER_NOT_INCLUDE_OBJECT_ENVIRONMENT_GROUP = 12;
  38. // private static final int OBJECT_CONTAINER_OBJECT_ENVIRONMENT_GROUP_CONTAINMENT_UNKNOWN = 8;
  39. // private static final int OBJECT_CONTAINER_INCLUDES_OBJECT_ENVIRONMENT_GROUP = 4;
  40. //
  41. // private static final int OBJECT_CONTAINER_DATA_NOT_CARRIED_IN_OBJECT_DATA = 3;
  42. // private static final int OBJECT_CONTAINER_DATA_OBJECT_DATA_CONTAINMENT_UNKNOWN = 2;
  43. // private static final int OBJECT_CONTAINER_DATA_CARRIES_OBJECT_DATA = 1;
  44. /**
  45. * the default structured flags setting
  46. * - data is in container with no object environment group and data in object container data
  47. */
  48. public static final StrucFlgs DEFAULT = new StrucFlgs(true, false, true);
  49. private int value = 0;
  50. /**
  51. * Main constructor
  52. *
  53. * @param dataInContainer true if the object data in carried in the object container
  54. * @param containerHasOEG true if the object container has an object environment group
  55. * @param dataInOCD true if the object container data carries the object data
  56. */
  57. public StrucFlgs(boolean dataInContainer, boolean containerHasOEG, boolean dataInOCD) {
  58. if (dataInContainer) {
  59. this.value += OBJECT_DATA_CARRIED_IN_OBJECT_CONTAINER;
  60. } else {
  61. this.value += OBJECT_DATA_NOT_CARRIED_IN_OBJECT_CONTAINER;
  62. }
  63. if (containerHasOEG) {
  64. this.value += OBJECT_CONTAINER_INCLUDES_OBJECT_ENVIRONMENT_GROUP;
  65. } else {
  66. this.value += OBJECT_CONTAINER_NOT_INCLUDE_OBJECT_ENVIRONMENT_GROUP;
  67. }
  68. if (dataInOCD) {
  69. this.value += OBJECT_CONTAINER_DATA_CARRIES_OBJECT_DATA;
  70. } else {
  71. this.value += OBJECT_CONTAINER_DATA_NOT_CARRIED_IN_OBJECT_DATA;
  72. }
  73. }
  74. /**
  75. * Default constructor
  76. */
  77. public StrucFlgs() {
  78. this.value = OBJECT_DATA_OBJECT_CONTAINER_STRUCTURE_UNKNOWN
  79. + OBJECT_CONTAINER_OBJECT_ENVIRONMENT_GROUP_CONTAINMENT_UNKNOWN
  80. + OBJECT_CONTAINER_DATA_OBJECT_DATA_CONTAINMENT_UNKNOWN;
  81. }
  82. /**
  83. * Returns the value of structure flags value
  84. *
  85. * @return the value of structure flags value
  86. */
  87. public byte getValue() {
  88. return (byte)this.value;
  89. }
  90. }