protected void parseCountry() throws ParseException { if (currentToken != StreamTokenizer.TT_WORD) { throw new ParseException("country expected"); } country = st.sval; nextToken(); if (currentToken == '_') { parseVariant(); } }
protected void parseLocale() throws ParseException { if (currentToken != StreamTokenizer.TT_WORD) { throw new ParseException("language expected"); } language = st.sval; nextToken(); if (currentToken == '_') { nextToken(); parseCountry(); } }
protected void parseVariant() throws ParseException { if (currentToken != StreamTokenizer.TT_WORD) { throw new ParseException("variant expected"); } variant = st.sval; nextToken(); }
/** * @see writeBlockData (String, Vector) */ public boolean writeBlockData(String blockName, String blockData) { String[] temp = new String[1]; temp[0] = blockData; return writeBlockData(blockName, makeVector(temp)); }
protected boolean parse() { boolean hasErrors = false; nextToken(); try { parseLocale(); } catch (ParseException e) { hasErrors = true; exception = e; } return hasErrors; }
public void init() { if (defaultImagePath != null) { defaultImage = ImageUtil.loadImageFromFile(defaultImagePath); } }
/** * Creates the new buffer * * @param size required size */ public CircularIntegerBuffer(int size) { buffer = new int[size]; clear(); }
/** * Indicates the parse error * * @param message * @throws ParseException */ protected void error(String message) throws ParseException { throw new ParseException(message); }
/** * calculates the arithmetic medium of 4 values and add random value in * range of delta. */ protected static int middleValue(int a, int b, int c, int d, int delta) { int result = (((a + b + c + d) / 4) + normRNG(delta)); return result; }
public static Image loadImageFromFile(String fileName) { if(null == fileName) { return null; } for (ImageLoader loader : IMAGE_LOADERS) { Image img = loader.loadImage(fileName); if (null != img) { return img; } } return null; }
/** * Determine if the listener is currently distracted. * * @return <code>true</code> if the listener is ignoring events. */ public boolean isIgnoringEvents() { return distracted.isIgnoringEvents(); }
/** * Get's the configuration value of the provided key. * * @param key The name of the property. * @return The value of the property or an empty string if the key doesn't exist. */ public String getProperty(String key) { return getProperty(key, ""); }
/** * Get a scaled version of the input image. * * @param img * @return */ public static BufferedImage getScaledImage(Image img, int newWidth, int newHeight) { return getScaledImage(img, newWidth, newHeight, IMAGE_SCALE_BICUBIC); }
public boolean isMine() { if (dataFile.exists("blockversion")) { return true; } return false; }
/** * Specify if the listener should be distracted. * * @param distracted * <code>true</code> if the listener should ignore events * <code>false</code> if the listener should pay attention * again. Events that occured while the listener was distracted * NOT going to be processed. */ public void setIgnoringEvents(boolean distracted) { this.distracted.setIgnoringEvents(distracted); }
/** * @see writeBlockData (String, Vector) */ public boolean writeBlockData(String blockName, int[] blockData) { String[] temp = new String[blockData.length]; for (int c = 0; c < blockData.length; c++) { temp[c] = "" + blockData[c]; //$NON-NLS-1$ } return writeBlockData(blockName, makeVector(temp)); }
/** * @see writeBlockData (String, Vector) */ public boolean writeBlockData(String blockName, float blockData) { String[] temp = new String[1]; temp[0] = "" + blockData; //$NON-NLS-1$ return writeBlockData(blockName, makeVector(temp)); }
/** * @see writeBlockData (String, Vector) */ public boolean writeBlockData(String blockName, int blockData) { String[] temp = new String[1]; temp[0] = "" + blockData; //$NON-NLS-1$ return writeBlockData(blockName, makeVector(temp)); }