PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/openmicroscopy/bioformats
Java | 167 lines | 66 code | 37 blank | 64 comment | 2 complexity | 26a4a8d449ea632677672eeba7632dd1 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 number of axes used on a chart.
  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 AxisUsedRecord
  46. extends Record
  47. {
  48. public final static short sid = 0x1046;
  49. private short field_1_numAxis;
  50. public AxisUsedRecord()
  51. {
  52. }
  53. /**
  54. * Constructs a AxisUsed record and sets its fields appropriately.
  55. *
  56. * @param in the RecordInputstream to read the record from
  57. */
  58. public AxisUsedRecord(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 AxisUsed record");
  72. }
  73. }
  74. protected void fillFields(RecordInputStream in)
  75. {
  76. field_1_numAxis = in.readShort();
  77. }
  78. public String toString()
  79. {
  80. StringBuffer buffer = new StringBuffer();
  81. buffer.append("[AXISUSED]\n");
  82. buffer.append(" .numAxis = ")
  83. .append("0x").append(HexDump.toHex( getNumAxis ()))
  84. .append(" (").append( getNumAxis() ).append(" )");
  85. buffer.append(System.getProperty("line.separator"));
  86. buffer.append("[/AXISUSED]\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_numAxis);
  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. AxisUsedRecord rec = new AxisUsedRecord();
  110. rec.field_1_numAxis = field_1_numAxis;
  111. return rec;
  112. }
  113. /**
  114. * Get the num axis field for the AxisUsed record.
  115. */
  116. public short getNumAxis()
  117. {
  118. return field_1_numAxis;
  119. }
  120. /**
  121. * Set the num axis field for the AxisUsed record.
  122. */
  123. public void setNumAxis(short field_1_numAxis)
  124. {
  125. this.field_1_numAxis = field_1_numAxis;
  126. }
  127. } // END OF CLASS