PageRenderTime 41ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/openmicroscopy/bioformats
Java | 167 lines | 66 code | 37 blank | 64 comment | 2 complexity | 61857d2698e853c4c2d03468a4263142 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. * Indicates the chart-group index for a series. The order probably defines the mapping. So the 0th record probably means the 0th series. The only field in this of course defines which chart group the 0th series (for instance) would map to. Confusing? Well thats because it is. (p 522 BCG)
  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 Andrew C. Oliver (acoliver at apache.org)
  44. */
  45. public class SeriesToChartGroupRecord
  46. extends Record
  47. {
  48. public final static short sid = 0x1045;
  49. private short field_1_chartGroupIndex;
  50. public SeriesToChartGroupRecord()
  51. {
  52. }
  53. /**
  54. * Constructs a SeriesToChartGroup record and sets its fields appropriately.
  55. *
  56. * @param in the RecordInputstream to read the record from
  57. */
  58. public SeriesToChartGroupRecord(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 SeriesToChartGroup 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("[SeriesToChartGroup]\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("[/SeriesToChartGroup]\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. SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord();
  110. rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
  111. return rec;
  112. }
  113. /**
  114. * Get the chart group index field for the SeriesToChartGroup record.
  115. */
  116. public short getChartGroupIndex()
  117. {
  118. return field_1_chartGroupIndex;
  119. }
  120. /**
  121. * Set the chart group index field for the SeriesToChartGroup record.
  122. */
  123. public void setChartGroupIndex(short field_1_chartGroupIndex)
  124. {
  125. this.field_1_chartGroupIndex = field_1_chartGroupIndex;
  126. }
  127. } // END OF CLASS