diff options
author | Dominik Stadler <centic@apache.org> | 2018-12-25 09:59:58 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2018-12-25 09:59:58 +0000 |
commit | 19884d0ca33018d1e417fafd253ec63cf8c31ccd (patch) | |
tree | 4d62b20301f3c4cb1c5995742d27fa6a6068dd34 /src/java/org/apache/poi/sl | |
parent | 7421bc9a17d6f3803d2d9e44e6535d6004a6090b (diff) | |
download | poi-19884d0ca33018d1e417fafd253ec63cf8c31ccd.tar.gz poi-19884d0ca33018d1e417fafd253ec63cf8c31ccd.zip |
Code-style: Unify how arrays are specified from C-style to normal Java-style
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/sl')
13 files changed, 50 insertions, 50 deletions
diff --git a/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java b/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java index c37ce006a0..145791f401 100644 --- a/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java +++ b/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java @@ -72,7 +72,7 @@ public class BitmapImageRenderer implements ImageRenderer { } @Override - public void loadImage(byte data[], String contentType) throws IOException { + public void loadImage(byte[] data, String contentType) throws IOException { img = readImage(new ByteArrayInputStream(data), contentType); } diff --git a/src/java/org/apache/poi/sl/draw/DrawFactory.java b/src/java/org/apache/poi/sl/draw/DrawFactory.java index 99c9942b67..6a032d6c6e 100644 --- a/src/java/org/apache/poi/sl/draw/DrawFactory.java +++ b/src/java/org/apache/poi/sl/draw/DrawFactory.java @@ -211,7 +211,7 @@ public class DrawFactory { } } - + /** * Return a FontManager, either registered beforehand or a default implementation * diff --git a/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java b/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java index a428943699..7dcd704c4e 100644 --- a/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java +++ b/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java @@ -76,7 +76,7 @@ public class DrawFontManagerDefault implements DrawFontManager { public static String mapSymbolChars(String text) { // wingdings doesn't contain high-surrogates, so chars are ok boolean changed = false; - char chrs[] = text.toCharArray(); + char[] chrs = text.toCharArray(); for (int i=0; i<chrs.length; i++) { // only change valid chars if ((0x20 <= chrs[i] && chrs[i] <= 0x7f) || diff --git a/src/java/org/apache/poi/sl/draw/DrawShape.java b/src/java/org/apache/poi/sl/draw/DrawShape.java index 0c6054c8a9..67162ac4a8 100644 --- a/src/java/org/apache/poi/sl/draw/DrawShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawShape.java @@ -65,7 +65,7 @@ public class DrawShape implements Drawable { final Rectangle2D anchor = getAnchor(graphics, ps); - char cmds[] = isHSLF ? new char[]{ 'h','v','r' } : new char[]{ 'r','h','v' }; + char[] cmds = isHSLF ? new char[]{'h', 'v', 'r'} : new char[]{'r', 'h', 'v'}; for (char ch : cmds) { switch (ch) { case 'h': @@ -232,7 +232,7 @@ public class DrawShape implements Drawable { lineDash = LineDash.SOLID; } - int dashPatI[] = lineDash.pattern; + int[] dashPatI = lineDash.pattern; final float dash_phase = 0; float[] dashPatF = null; if (dashPatI != null) { diff --git a/src/java/org/apache/poi/sl/draw/DrawTableShape.java b/src/java/org/apache/poi/sl/draw/DrawTableShape.java index 703fb04d82..1974f0d9a7 100644 --- a/src/java/org/apache/poi/sl/draw/DrawTableShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawTableShape.java @@ -165,7 +165,7 @@ public class DrawTableShape extends DrawShape { final int rows = table.getNumberOfRows(); final int cols = table.getNumberOfColumns(); - BorderEdge edges[] = { BorderEdge.top, BorderEdge.left, null, null }; + BorderEdge[] edges = {BorderEdge.top, BorderEdge.left, null, null}; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { edges[2] = (col == cols - 1) ? BorderEdge.right : null; @@ -189,7 +189,7 @@ public class DrawTableShape extends DrawShape { final int rows = table.getNumberOfRows(); final int cols = table.getNumberOfColumns(); - BorderEdge edges[] = new BorderEdge[4]; + BorderEdge[] edges = new BorderEdge[4]; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { edges[0] = (col == 0) ? BorderEdge.left : null; @@ -215,7 +215,7 @@ public class DrawTableShape extends DrawShape { final int rows = table.getNumberOfRows(); final int cols = table.getNumberOfColumns(); - BorderEdge edges[] = new BorderEdge[2]; + BorderEdge[] edges = new BorderEdge[2]; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { edges[0] = (col > 0 && col < cols - 1) ? BorderEdge.right : null; @@ -232,7 +232,7 @@ public class DrawTableShape extends DrawShape { * @param edges the border edges * @param args the border attributes */ - private static void setEdges(TableCell<?,?> cell, BorderEdge edges[], Object... args) { + private static void setEdges(TableCell<?,?> cell, BorderEdge[] edges, Object... args) { if (cell == null) { return; } diff --git a/src/java/org/apache/poi/sl/draw/ImageRenderer.java b/src/java/org/apache/poi/sl/draw/ImageRenderer.java index b2355b3012..330c02ab01 100644 --- a/src/java/org/apache/poi/sl/draw/ImageRenderer.java +++ b/src/java/org/apache/poi/sl/draw/ImageRenderer.java @@ -96,7 +96,7 @@ public interface ImageRenderer { * @param data the raw image bytes * @param contentType the content type */ - void loadImage(byte data[], String contentType) throws IOException; + void loadImage(byte[] data, String contentType) throws IOException; /** * @return the dimension of the buffered image diff --git a/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java b/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java index 3ecc6e55c7..c6283b6759 100644 --- a/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java +++ b/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java @@ -35,7 +35,7 @@ public class ImageHeaderBitmap { private final Dimension size; - public ImageHeaderBitmap(byte data[], int offset) { + public ImageHeaderBitmap(byte[] data, int offset) { BufferedImage img = null; try { img = ImageIO.read(new ByteArrayInputStream(data, offset, data.length-offset)); diff --git a/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java b/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java index fc7be14fed..48bf45564b 100644 --- a/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java +++ b/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java @@ -36,7 +36,7 @@ public class ImageHeaderEMF { // rectangle that can be drawn around the image stored in the metafile. private final Rectangle deviceBounds; - public ImageHeaderEMF(final byte data[], final int off) { + public ImageHeaderEMF(final byte[] data, final int off) { int offset = off; int type = (int)LittleEndian.getUInt(data, offset); offset += 4; if (type != 1) { diff --git a/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java b/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java index ff121e3e7c..bf9cacefaf 100644 --- a/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java +++ b/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java @@ -32,17 +32,17 @@ public class ImageHeaderPICT { public static final double DEFAULT_RESOLUTION = Units.POINT_DPI; - private static final byte V2_HEADER[] = { - 0x00, 0x11, // v2 version opcode - 0x02, (byte)0xFF, // version number of new picture - 0x0C, 0x00, // header opcode - (byte)0xFF, (byte)0xFE, 0x00, 0x00 // pic size dummy + private static final byte[] V2_HEADER = { + 0x00, 0x11, // v2 version opcode + 0x02, (byte) 0xFF, // version number of new picture + 0x0C, 0x00, // header opcode + (byte) 0xFF, (byte) 0xFE, 0x00, 0x00 // pic size dummy }; private final Rectangle bounds; private final double hRes, vRes; - public ImageHeaderPICT(byte data[], final int off) { + public ImageHeaderPICT(byte[] data, final int off) { // http://mirrors.apple2.org.za/apple.cabi.net/Graphics/PICT.and_QT.INFO/PICT.file.format.TI.txt int offset = off; // low order 16 bits of picture size - can be ignored @@ -86,13 +86,13 @@ public class ImageHeaderPICT { return bounds; } - private static int readUnsignedShort(byte data[], int offset) { + private static int readUnsignedShort(byte[] data, int offset) { int b0 = data[offset] & 0xFF; int b1 = data[offset+1] & 0xFF; return b0 << 8 | b1; } - private static double readFixedPoint(byte data[], int offset) { + private static double readFixedPoint(byte[] data, int offset) { int b0 = data[offset] & 0xFF; int b1 = data[offset+1] & 0xFF; int b2 = data[offset+2] & 0xFF; diff --git a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java index 0abd5d62a5..939add734f 100644 --- a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java +++ b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java @@ -245,31 +245,31 @@ public enum AutoNumberingScheme { //M (1000), CM (900), D (500), CD (400), C (100), XC (90), L (50), XL (40), X (10), IX (9), V (5), IV (4) and I (1). final int[] VALUES = new int[]{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; final String[] ROMAN = new String[]{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; - final String conciseList[][] = { - {"XLV", "VL"}, //45 - {"XCV", "VC"}, //95 - {"CDL", "LD"}, //450 - {"CML", "LM"}, //950 - {"CMVC", "LMVL"}, //995 - {"CDXC", "LDXL"}, //490 - {"CDVC", "LDVL"}, //495 - {"CMXC", "LMXL"}, //990 - {"XCIX", "VCIV"}, //99 - {"XLIX", "VLIV"}, //49 - {"XLIX", "IL"}, //49 - {"XCIX", "IC"}, //99 - {"CDXC", "XD"}, //490 - {"CDVC", "XDV"}, //495 - {"CDIC", "XDIX"}, //499 - {"LMVL", "XMV"}, //995 - {"CMIC", "XMIX"}, //999 - {"CMXC", "XM"}, // 990 - {"XDV", "VD"}, //495 - {"XDIX", "VDIV"}, //499 - {"XMV", "VM"}, // 995 - {"XMIX", "VMIV"}, //999 - {"VDIV", "ID"}, //499 - {"VMIV", "IM"} //999 + final String[][] conciseList = { + {"XLV", "VL"}, //45 + {"XCV", "VC"}, //95 + {"CDL", "LD"}, //450 + {"CML", "LM"}, //950 + {"CMVC", "LMVL"}, //995 + {"CDXC", "LDXL"}, //490 + {"CDVC", "LDVL"}, //495 + {"CMXC", "LMXL"}, //990 + {"XCIX", "VCIV"}, //99 + {"XLIX", "VLIV"}, //49 + {"XLIX", "IL"}, //49 + {"XCIX", "IC"}, //99 + {"CDXC", "XD"}, //490 + {"CDVC", "XDV"}, //495 + {"CDIC", "XDIX"}, //499 + {"LMVL", "XMV"}, //995 + {"CMIC", "XMIX"}, //999 + {"CMXC", "XM"}, // 990 + {"XDV", "VD"}, //495 + {"XDIX", "VDIV"}, //499 + {"XMV", "VM"}, // 995 + {"XMIX", "VMIV"}, //999 + {"VDIV", "ID"}, //499 + {"VMIV", "IM"} //999 }; StringBuilder sb = new StringBuilder(); @@ -280,7 +280,7 @@ public enum AutoNumberingScheme { } } String result = sb.toString(); - for (String cc[] : conciseList) { + for (String[] cc : conciseList) { result = result.replace(cc[0], cc[1]); } return result; diff --git a/src/java/org/apache/poi/sl/usermodel/PresetColor.java b/src/java/org/apache/poi/sl/usermodel/PresetColor.java index 9c4df2f9f6..2538d1b828 100644 --- a/src/java/org/apache/poi/sl/usermodel/PresetColor.java +++ b/src/java/org/apache/poi/sl/usermodel/PresetColor.java @@ -273,7 +273,7 @@ public enum PresetColor { } public static PresetColor valueOfNativeId(int nativeId) { - PresetColor vals[] = values(); + PresetColor[] vals = values(); return (0 < nativeId && nativeId <= vals.length) ? vals[nativeId-1] : null; } } diff --git a/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java b/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java index 81f297e2cc..460e93bb23 100644 --- a/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java +++ b/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java @@ -294,10 +294,10 @@ public class SlideShowFactory { private static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> - > SlideShow<S,P> createSlideShow(String factoryClass, Object args[]) throws IOException, EncryptedDocumentException { + > SlideShow<S,P> createSlideShow(String factoryClass, Object[] args) throws IOException, EncryptedDocumentException { try { Class<?> clazz = SlideShowFactory.class.getClassLoader().loadClass(factoryClass); - Class<?> argsClz[] = new Class<?>[args.length]; + Class<?>[] argsClz = new Class<?>[args.length]; int i=0; for (Object o : args) { Class<?> c = o.getClass(); diff --git a/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java b/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java index b26658fe8b..500dffde4e 100644 --- a/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java +++ b/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java @@ -81,7 +81,7 @@ public interface StrokeStyle { /** PS_DASHDOTDOT system dash style / native 5 */ SYS_DASH_DOT_DOT(5, 11, 2,2,1,1,1,1); - public final int pattern[]; + public final int[] pattern; public final int nativeId; public final int ooxmlId; |