fix generics warning
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1143740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad4cef7557
commit
d1eb54b129
@ -24,7 +24,9 @@ package org.apache.poi.hwpf.model;
|
|||||||
* It handles the conversion as required between bytes
|
* It handles the conversion as required between bytes
|
||||||
* and characters.
|
* and characters.
|
||||||
*/
|
*/
|
||||||
public abstract class BytePropertyNode extends PropertyNode {
|
public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends
|
||||||
|
PropertyNode<T>
|
||||||
|
{
|
||||||
private final int startBytes;
|
private final int startBytes;
|
||||||
private final int endBytes;
|
private final int endBytes;
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.usermodel.CharacterProperties;
|
|
||||||
import org.apache.poi.hwpf.sprm.SprmBuffer;
|
|
||||||
import org.apache.poi.hwpf.sprm.CharacterSprmUncompressor;
|
import org.apache.poi.hwpf.sprm.CharacterSprmUncompressor;
|
||||||
|
import org.apache.poi.hwpf.sprm.SprmBuffer;
|
||||||
|
import org.apache.poi.hwpf.usermodel.CharacterProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DANGER - works in bytes!
|
* DANGER - works in bytes!
|
||||||
@ -31,7 +31,7 @@ import org.apache.poi.hwpf.sprm.CharacterSprmUncompressor;
|
|||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class CHPX extends BytePropertyNode
|
public final class CHPX extends BytePropertyNode<CHPX>
|
||||||
{
|
{
|
||||||
|
|
||||||
public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[] grpprl)
|
public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[] grpprl)
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.sprm.SprmBuffer;
|
|
||||||
|
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.sprm.SprmBuffer;
|
||||||
|
|
||||||
public final class CachedPropertyNode
|
public final class CachedPropertyNode
|
||||||
extends PropertyNode
|
extends PropertyNode<CachedPropertyNode>
|
||||||
{
|
{
|
||||||
protected SoftReference _propCache;
|
protected SoftReference _propCache;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
public final class GenericPropertyNode
|
public final class GenericPropertyNode
|
||||||
extends PropertyNode
|
extends PropertyNode<GenericPropertyNode>
|
||||||
{
|
{
|
||||||
public GenericPropertyNode(int start, int end, byte[] buf)
|
public GenericPropertyNode(int start, int end, byte[] buf)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class PAPX extends BytePropertyNode {
|
public final class PAPX extends BytePropertyNode<PAPX> {
|
||||||
|
|
||||||
private ParagraphHeight _phe;
|
private ParagraphHeight _phe;
|
||||||
private int _hugeGrpprlOffset = -1;
|
private int _hugeGrpprlOffset = -1;
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a lightweight node in the Trees used to store content
|
* Represents a lightweight node in the Trees used to store content
|
||||||
* properties.
|
* properties.
|
||||||
@ -31,7 +31,7 @@ import java.util.Arrays;
|
|||||||
*
|
*
|
||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
public abstract class PropertyNode implements Comparable, Cloneable
|
public abstract class PropertyNode<T extends PropertyNode<T>> implements Comparable<T>, Cloneable
|
||||||
{
|
{
|
||||||
private final static POILogger _logger = POILogFactory.getLogger(PropertyNode.class);
|
private final static POILogger _logger = POILogFactory.getLogger(PropertyNode.class);
|
||||||
protected Object _buf;
|
protected Object _buf;
|
||||||
@ -114,16 +114,22 @@ public abstract class PropertyNode implements Comparable, Cloneable
|
|||||||
|
|
||||||
protected boolean limitsAreEqual(Object o)
|
protected boolean limitsAreEqual(Object o)
|
||||||
{
|
{
|
||||||
return ((PropertyNode)o).getStart() == _cpStart &&
|
return ((PropertyNode<?>)o).getStart() == _cpStart &&
|
||||||
((PropertyNode)o).getEnd() == _cpEnd;
|
((PropertyNode<?>)o).getEnd() == _cpEnd;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return this._cpStart * 31 + this._buf.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(Object o)
|
public boolean equals(Object o)
|
||||||
{
|
{
|
||||||
if (limitsAreEqual(o))
|
if (limitsAreEqual(o))
|
||||||
{
|
{
|
||||||
Object testBuf = ((PropertyNode)o)._buf;
|
Object testBuf = ((PropertyNode<?>)o)._buf;
|
||||||
if (testBuf instanceof byte[] && _buf instanceof byte[])
|
if (testBuf instanceof byte[] && _buf instanceof byte[])
|
||||||
{
|
{
|
||||||
return Arrays.equals((byte[])testBuf, (byte[])_buf);
|
return Arrays.equals((byte[])testBuf, (byte[])_buf);
|
||||||
@ -133,18 +139,18 @@ public abstract class PropertyNode implements Comparable, Cloneable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object clone()
|
public T clone()
|
||||||
throws CloneNotSupportedException
|
throws CloneNotSupportedException
|
||||||
{
|
{
|
||||||
return super.clone();
|
return (T) super.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for sorting in collections.
|
* Used for sorting in collections.
|
||||||
*/
|
*/
|
||||||
public int compareTo(Object o)
|
public int compareTo(T o)
|
||||||
{
|
{
|
||||||
int cpEnd = ((PropertyNode)o).getEnd();
|
int cpEnd = o.getEnd();
|
||||||
if(_cpEnd == cpEnd)
|
if(_cpEnd == cpEnd)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -23,7 +23,7 @@ import org.apache.poi.hwpf.usermodel.SectionProperties;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public final class SEPX extends BytePropertyNode
|
public final class SEPX extends BytePropertyNode<SEPX>
|
||||||
{
|
{
|
||||||
|
|
||||||
SectionDescriptor _sed;
|
SectionDescriptor _sed;
|
||||||
|
@ -28,7 +28,7 @@ import java.io.UnsupportedEncodingException;
|
|||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class TextPiece extends PropertyNode implements Comparable
|
public final class TextPiece extends PropertyNode<TextPiece>
|
||||||
{
|
{
|
||||||
private boolean _usesUnicode;
|
private boolean _usesUnicode;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user