PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/components/forks/poi/src/loci/poi/hssf/record/SeriesChartGroupIndexRecord.java

http://github.com/openmicroscopy/bioformats
Java | 167 lines | 66 code | 37 blank | 64 comment | 2 complexity | 45050aa76ce71d35b6b2608cc1c64d49 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, Apache-2.0, BSD-2-Clause, MPL-2.0-no-copyleft-exception
  1. /*
  2. * #%L
  3. * Fork of Apache Jakarta POI.
  4. * %%
  5. * Copyright (C) 2008 - 2013 Open Microscopy Environment:
  6. * - Board of Regents of the University of Wisconsin-Madison
  7. * - Glencoe Software, Inc.
  8. * - University of Dundee
  9. * %%
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. * #L%
  22. */
  23. /* ====================================================================
  24. Licensed to the Apache Software Foundation (ASF) under one or more
  25. contributor license agreements. See the NOTICE file distributed with
  26. this work for additional information regarding copyright ownership.
  27. The ASF licenses this file to You under the Apache License, Version 2.0
  28. (the "License"); you may not use this file except in compliance with
  29. the License. You may obtain a copy of the License at
  30. http://www.apache.org/licenses/LICENSE-2.0
  31. Unless required by applicable law or agreed to in writing, software
  32. distributed under the License is distributed on an "AS IS" BASIS,
  33. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  34. See the License for the specific language governing permissions and
  35. limitations under the License.
  36. ==================================================================== */
  37. package loci.poi.hssf.record;
  38. import loci.poi.util.*;
  39. /**
  40. * The series chart group index record stores the index to the CHARTFORMAT record (0 based).
  41. * NOTE: This source is automatically generated please do not modify this file. Either subclass or
  42. * remove the record in src/records/definitions.
  43. * @author Glen Stampoultzis (glens at apache.org)
  44. */
  45. public class SeriesChartGroupIndexRecord
  46. extends Record
  47. {
  48. public final static short sid = 0x1045;
  49. private short field_1_chartGroupIndex;
  50. public SeriesChartGroupIndexRecord()
  51. {
  52. }
  53. /**
  54. * Constructs a SeriesChartGroupIndex record and sets its fields appropriately.
  55. *
  56. * @param in the RecordInputstream to read the record from
  57. */
  58. public SeriesChartGroupIndexRecord(RecordInputStream in)
  59. {
  60. super(in);
  61. }
  62. /**
  63. * Checks the sid matches the expected side for this record
  64. *
  65. * @param id the expected sid.
  66. */
  67. protected void validateSid(short id)
  68. {
  69. if (id != sid)
  70. {
  71. throw new RecordFormatException("Not a SeriesChartGroupIndex record");
  72. }
  73. }
  74. protected void fillFields(RecordInputStream in)
  75. {
  76. field_1_chartGroupIndex = in.readShort();
  77. }
  78. public String toString()
  79. {
  80. StringBuffer buffer = new StringBuffer();
  81. buffer.append("[SERTOCRT]\n");
  82. buffer.append(" .chartGroupIndex = ")
  83. .append("0x").append(HexDump.toHex( getChartGroupIndex ()))
  84. .append(" (").append( getChartGroupIndex() ).append(" )");
  85. buffer.append(System.getProperty("line.separator"));
  86. buffer.append("[/SERTOCRT]\n");
  87. return buffer.toString();
  88. }
  89. public int serialize(int offset, byte[] data)
  90. {
  91. int pos = 0;
  92. LittleEndian.putShort(data, 0 + offset, sid);
  93. LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
  94. LittleEndian.putShort(data, 4 + offset + pos, field_1_chartGroupIndex);
  95. return getRecordSize();
  96. }
  97. /**
  98. * Size of record (exluding 4 byte header)
  99. */
  100. public int getRecordSize()
  101. {
  102. return 4 + 2;
  103. }
  104. public short getSid()
  105. {
  106. return sid;
  107. }
  108. public Object clone() {
  109. SeriesChartGroupIndexRecord rec = new SeriesChartGroupIndexRecord();
  110. rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
  111. return rec;
  112. }
  113. /**
  114. * Get the chart group index field for the SeriesChartGroupIndex record.
  115. */
  116. public short getChartGroupIndex()
  117. {
  118. return field_1_chartGroupIndex;
  119. }
  120. /**
  121. * Set the chart group index field for the SeriesChartGroupIndex record.
  122. */
  123. public void setChartGroupIndex(short field_1_chartGroupIndex)
  124. {
  125. this.field_1_chartGroupIndex = field_1_chartGroupIndex;
  126. }
  127. } // END OF CLASS