code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static void addSuppressed(Throwable owner, Throwable add) { try { Method method = owner.getClass().getMethod("addSuppressed", Throwable.class); method.invoke(owner, add); } catch (NoSuchMethodException e) { // ignore, will happen for JRE < 1.7 } catch (SecurityException e) { throwUncheckedException(e); } catch (IllegalAccessException e) { throwUncheckedException(e); } catch (IllegalArgumentException e) { throwUncheckedException(e); } catch (InvocationTargetException e) { throwUncheckedException(e); } } }
public class class_name { public static void addSuppressed(Throwable owner, Throwable add) { try { Method method = owner.getClass().getMethod("addSuppressed", Throwable.class); method.invoke(owner, add); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { // ignore, will happen for JRE < 1.7 } catch (SecurityException e) { // depends on control dependency: [catch], data = [none] throwUncheckedException(e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throwUncheckedException(e); } catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none] throwUncheckedException(e); } catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none] throwUncheckedException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void release() { CounterLock lock; synchronized (DataStore.class) { lock = FILE_LOCKS.get(file); if(lock == null) { LOG.error("Trying to release unlocked file {}", file); return; } lock.dec(); if(lock.counter == 0) { FILE_LOCKS.remove(file); } } LOG.trace("Releasing the lock {} for '{}'", lock, file); lock.unlock(); LOG.trace("Released the lock {} for '{}'", lock, file); } }
public class class_name { public void release() { CounterLock lock; synchronized (DataStore.class) { lock = FILE_LOCKS.get(file); if(lock == null) { LOG.error("Trying to release unlocked file {}", file); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } lock.dec(); if(lock.counter == 0) { FILE_LOCKS.remove(file); // depends on control dependency: [if], data = [none] } } LOG.trace("Releasing the lock {} for '{}'", lock, file); lock.unlock(); LOG.trace("Released the lock {} for '{}'", lock, file); } }
public class class_name { public static String getClassName(Class<?> cls) { if (cls.isMemberClass()) { String name = cls.getName(); name = StringUtils.substringAfterLast(name, PACKAGE_SEPARATOR); return name; } return cls.getSimpleName(); } }
public class class_name { public static String getClassName(Class<?> cls) { if (cls.isMemberClass()) { String name = cls.getName(); name = StringUtils.substringAfterLast(name, PACKAGE_SEPARATOR); // depends on control dependency: [if], data = [none] return name; // depends on control dependency: [if], data = [none] } return cls.getSimpleName(); } }
public class class_name { public MethodFilter build() { if(filters.isEmpty()) { throw new IllegalStateException("No filter specified."); } if(filters.size() == 1) { return filters.get(0); } MethodFilter[] methodFilters = new MethodFilter[filters.size()]; filters.toArray(methodFilters); return new MethodFilterList(methodFilters); } }
public class class_name { public MethodFilter build() { if(filters.isEmpty()) { throw new IllegalStateException("No filter specified."); } if(filters.size() == 1) { return filters.get(0); // depends on control dependency: [if], data = [none] } MethodFilter[] methodFilters = new MethodFilter[filters.size()]; filters.toArray(methodFilters); return new MethodFilterList(methodFilters); } }
public class class_name { protected ImageDTO extractOneImageFromCurrentCursor(Cursor cursor) { int api = android.os.Build.VERSION.SDK_INT; if(imageIdCol == -1) { imageIdCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID); imageTitleCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE); imageDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME); imageDescriptionCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DESCRIPTION); imageBucketIdCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_ID); imageBucketDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_DISPLAY_NAME); imageDataCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); imageMimeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.MIME_TYPE); imageSizeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE); imageOrientationCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.ORIENTATION); imageDateAddedCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_ADDED); imageDateTakenCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_TAKEN); imageDateModifyCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_MODIFIED); latitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.LATITUDE); longitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.LONGITUDE); if (api >= 16) { widthCol = cursor.getColumnIndexOrThrow(MediaStore_Media_WIDTH); heightCol = cursor.getColumnIndexOrThrow(MediaStore_Media_HEIGHT); } } ImageDTO image = new ImageDTO(); image.setId(cursor.getLong(imageIdCol)); image.setTitle(cursor.getString(imageTitleCol)); image.setDisplayName(cursor.getString(imageDisplayNameCol)); image.setDescription(cursor.getString(imageDescriptionCol)); image.setBucketId(cursor.getString(imageBucketIdCol)); image.setBucketDisplayName(cursor.getString(imageBucketDisplayNameCol)); image.setUri(cursor.getString(imageDataCol)); image.setMimeType(cursor.getString(imageMimeCol)); image.setSize(cursor.getLong(imageSizeCol)); image.setOrientation(translateOrientation(cursor.getInt(imageOrientationCol))); image.setAddedDate(new Date(cursor.getLong(imageDateAddedCol))); image.setTakenDate(new Date(cursor.getLong(imageDateTakenCol))); image.setModifyDate(new Date(cursor.getLong(imageDateModifyCol))); image.setLatitude(cursor.getDouble(latitudeCol)); image.setLongitude(cursor.getDouble(longitudeCol)); if (api >= 16) { image.setWidth(cursor.getInt(widthCol)); image.setHeight(cursor.getInt(heightCol)); } return image; } }
public class class_name { protected ImageDTO extractOneImageFromCurrentCursor(Cursor cursor) { int api = android.os.Build.VERSION.SDK_INT; if(imageIdCol == -1) { imageIdCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID); // depends on control dependency: [if], data = [none] imageTitleCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE); // depends on control dependency: [if], data = [none] imageDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME); // depends on control dependency: [if], data = [none] imageDescriptionCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DESCRIPTION); // depends on control dependency: [if], data = [none] imageBucketIdCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_ID); // depends on control dependency: [if], data = [none] imageBucketDisplayNameCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_DISPLAY_NAME); // depends on control dependency: [if], data = [none] imageDataCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); // depends on control dependency: [if], data = [none] imageMimeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.MIME_TYPE); // depends on control dependency: [if], data = [none] imageSizeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE); // depends on control dependency: [if], data = [none] imageOrientationCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.ORIENTATION); // depends on control dependency: [if], data = [none] imageDateAddedCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_ADDED); // depends on control dependency: [if], data = [none] imageDateTakenCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_TAKEN); // depends on control dependency: [if], data = [none] imageDateModifyCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_MODIFIED); // depends on control dependency: [if], data = [none] latitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.LATITUDE); // depends on control dependency: [if], data = [none] longitudeCol = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.LONGITUDE); // depends on control dependency: [if], data = [none] if (api >= 16) { widthCol = cursor.getColumnIndexOrThrow(MediaStore_Media_WIDTH); // depends on control dependency: [if], data = [none] heightCol = cursor.getColumnIndexOrThrow(MediaStore_Media_HEIGHT); // depends on control dependency: [if], data = [none] } } ImageDTO image = new ImageDTO(); image.setId(cursor.getLong(imageIdCol)); image.setTitle(cursor.getString(imageTitleCol)); image.setDisplayName(cursor.getString(imageDisplayNameCol)); image.setDescription(cursor.getString(imageDescriptionCol)); image.setBucketId(cursor.getString(imageBucketIdCol)); image.setBucketDisplayName(cursor.getString(imageBucketDisplayNameCol)); image.setUri(cursor.getString(imageDataCol)); image.setMimeType(cursor.getString(imageMimeCol)); image.setSize(cursor.getLong(imageSizeCol)); image.setOrientation(translateOrientation(cursor.getInt(imageOrientationCol))); image.setAddedDate(new Date(cursor.getLong(imageDateAddedCol))); image.setTakenDate(new Date(cursor.getLong(imageDateTakenCol))); image.setModifyDate(new Date(cursor.getLong(imageDateModifyCol))); image.setLatitude(cursor.getDouble(latitudeCol)); image.setLongitude(cursor.getDouble(longitudeCol)); if (api >= 16) { image.setWidth(cursor.getInt(widthCol)); // depends on control dependency: [if], data = [none] image.setHeight(cursor.getInt(heightCol)); // depends on control dependency: [if], data = [none] } return image; } }
public class class_name { @Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(1024); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_ORGUNIT_EDITOR_LABEL_IDENTIFICATION_BLOCK_0))); result.append(createWidgetTableStart()); result.append(createDialogRowsHtml(0, 2)); result.append(createWidgetTableEnd()); result.append(dialogBlockEnd()); } result.append(createWidgetTableEnd()); return result.toString(); } }
public class class_name { @Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(1024); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_ORGUNIT_EDITOR_LABEL_IDENTIFICATION_BLOCK_0))); // depends on control dependency: [if], data = [none] result.append(createWidgetTableStart()); // depends on control dependency: [if], data = [none] result.append(createDialogRowsHtml(0, 2)); // depends on control dependency: [if], data = [none] result.append(createWidgetTableEnd()); // depends on control dependency: [if], data = [none] result.append(dialogBlockEnd()); // depends on control dependency: [if], data = [none] } result.append(createWidgetTableEnd()); return result.toString(); } }
public class class_name { public EventRecord getNext() { try { String line = reader.readLine(); if (line != null) { if (firstLine == null) firstLine = new String(line); offset += line.length() + 1; return parseLine(line); } } catch (IOException e) { e.printStackTrace(); } return null; } }
public class class_name { public EventRecord getNext() { try { String line = reader.readLine(); if (line != null) { if (firstLine == null) firstLine = new String(line); offset += line.length() + 1; // depends on control dependency: [if], data = [none] return parseLine(line); // depends on control dependency: [if], data = [(line] } } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private static Optional<AbbreviatedObjectId> createAbbreviatedCommitId(@Nonnull ObjectReader objectReader, ObjectId commitId, int requestedLength) { if (requestedLength < 2) { // 0 means we don't want to print commit id's at all return Optional.empty(); } try { AbbreviatedObjectId abbreviatedObjectId = objectReader.abbreviate(commitId, requestedLength); return Optional.of(abbreviatedObjectId); } catch (IOException e) { return Optional.empty(); } } }
public class class_name { private static Optional<AbbreviatedObjectId> createAbbreviatedCommitId(@Nonnull ObjectReader objectReader, ObjectId commitId, int requestedLength) { if (requestedLength < 2) { // 0 means we don't want to print commit id's at all return Optional.empty(); // depends on control dependency: [if], data = [none] } try { AbbreviatedObjectId abbreviatedObjectId = objectReader.abbreviate(commitId, requestedLength); return Optional.of(abbreviatedObjectId); // depends on control dependency: [try], data = [none] } catch (IOException e) { return Optional.empty(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static int compareMarkers(IMarker m1, IMarker m2) { if (m1 == null || m2 == null || !m1.exists() || !m2.exists()) { return 0; } int rank1 = MarkerUtil.findBugRankForMarker(m1); int rank2 = MarkerUtil.findBugRankForMarker(m2); int result = rank1 - rank2; if (result != 0) { return result; } int prio1 = MarkerUtil.findConfidenceForMarker(m1).ordinal(); int prio2 = MarkerUtil.findConfidenceForMarker(m2).ordinal(); result = prio1 - prio2; if (result != 0) { return result; } String a1 = m1.getAttribute(IMarker.MESSAGE, ""); String a2 = m2.getAttribute(IMarker.MESSAGE, ""); return a1.compareToIgnoreCase(a2); } }
public class class_name { static int compareMarkers(IMarker m1, IMarker m2) { if (m1 == null || m2 == null || !m1.exists() || !m2.exists()) { return 0; // depends on control dependency: [if], data = [none] } int rank1 = MarkerUtil.findBugRankForMarker(m1); int rank2 = MarkerUtil.findBugRankForMarker(m2); int result = rank1 - rank2; if (result != 0) { return result; // depends on control dependency: [if], data = [none] } int prio1 = MarkerUtil.findConfidenceForMarker(m1).ordinal(); int prio2 = MarkerUtil.findConfidenceForMarker(m2).ordinal(); result = prio1 - prio2; if (result != 0) { return result; // depends on control dependency: [if], data = [none] } String a1 = m1.getAttribute(IMarker.MESSAGE, ""); String a2 = m2.getAttribute(IMarker.MESSAGE, ""); return a1.compareToIgnoreCase(a2); } }
public class class_name { private static String chompLastParam(String input) { int lastCommaIndex = input.lastIndexOf(','); if (lastCommaIndex == -1) { return input; } else { return input.substring(0, lastCommaIndex) + ")"; } } }
public class class_name { private static String chompLastParam(String input) { int lastCommaIndex = input.lastIndexOf(','); if (lastCommaIndex == -1) { return input; // depends on control dependency: [if], data = [none] } else { return input.substring(0, lastCommaIndex) + ")"; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static List<Kontonummer> getKontonummerList(int length) { final class NormalKontonrDigitGenerator extends KontonummerDigitGenerator { @Override String generateKontonummer() { StringBuilder kontonrBuffer = new StringBuilder(LENGTH); for (int i = 0; i < LENGTH; i++) { kontonrBuffer.append((int) (Math.random() * 10)); } return kontonrBuffer.toString(); } } return getKontonummerListUsingGenerator(new NormalKontonrDigitGenerator(), length); } }
public class class_name { public static List<Kontonummer> getKontonummerList(int length) { final class NormalKontonrDigitGenerator extends KontonummerDigitGenerator { @Override String generateKontonummer() { StringBuilder kontonrBuffer = new StringBuilder(LENGTH); for (int i = 0; i < LENGTH; i++) { kontonrBuffer.append((int) (Math.random() * 10)); // depends on control dependency: [for], data = [none] } return kontonrBuffer.toString(); } } return getKontonummerListUsingGenerator(new NormalKontonrDigitGenerator(), length); } }
public class class_name { @JSFProperty(partialStateHolder=true) public Converter getConverter() { if (_converter != null) { return _converter; } ValueExpression expression = getValueExpression("converter"); if (expression != null) { return (Converter) expression.getValue(getFacesContext().getELContext()); } return null; } }
public class class_name { @JSFProperty(partialStateHolder=true) public Converter getConverter() { if (_converter != null) { return _converter; // depends on control dependency: [if], data = [none] } ValueExpression expression = getValueExpression("converter"); if (expression != null) { return (Converter) expression.getValue(getFacesContext().getELContext()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public final UnicodeSet add(CharSequence s) { checkFrozen(); int cp = getSingleCP(s); if (cp < 0) { strings.add(s.toString()); pat = null; } else { add_unchecked(cp, cp); } return this; } }
public class class_name { public final UnicodeSet add(CharSequence s) { checkFrozen(); int cp = getSingleCP(s); if (cp < 0) { strings.add(s.toString()); // depends on control dependency: [if], data = [none] pat = null; // depends on control dependency: [if], data = [none] } else { add_unchecked(cp, cp); // depends on control dependency: [if], data = [(cp] } return this; } }
public class class_name { @SuppressWarnings("unchecked") private Map<String, CmsTemplateContext> getContextMap() { Object cachedObj = m_cache.getCachedObject(m_cms, getConfigurationPropertyPath()); if (cachedObj != null) { return (Map<String, CmsTemplateContext>)cachedObj; } else { try { Map<String, CmsTemplateContext> map = initMap(); m_cache.putCachedObject(m_cms, getConfigurationPropertyPath(), map); return map; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return Collections.emptyMap(); } } } }
public class class_name { @SuppressWarnings("unchecked") private Map<String, CmsTemplateContext> getContextMap() { Object cachedObj = m_cache.getCachedObject(m_cms, getConfigurationPropertyPath()); if (cachedObj != null) { return (Map<String, CmsTemplateContext>)cachedObj; // depends on control dependency: [if], data = [none] } else { try { Map<String, CmsTemplateContext> map = initMap(); m_cache.putCachedObject(m_cms, getConfigurationPropertyPath(), map); // depends on control dependency: [try], data = [none] return map; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return Collections.emptyMap(); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static GeoRSSModule getGeoRSS(final SyndFeed feed) { final GeoRSSModule simple = (GeoRSSModule) feed.getModule(GeoRSSModule.GEORSS_GEORSS_URI); final GeoRSSModule w3cGeo = (GeoRSSModule) feed.getModule(GeoRSSModule.GEORSS_W3CGEO_URI); final GeoRSSModule gml = (GeoRSSModule) feed.getModule(GeoRSSModule.GEORSS_GML_URI); if (gml != null) { return gml; } if (simple != null) { return simple; } if (w3cGeo != null) { return w3cGeo; } return null; /* * if (geoRSSModule == null && w3cGeo != null) { geoRSSModule = w3cGeo; } else if * (geoRSSModule == null && gml != null) { geoRSSModule = gml; } else if (geoRSSModule != * null && w3cGeo != null) { // sanity check if * (!geoRSSModule.getGeometry().equals(w3cGeo.getGeometry())) { throw new * Error("geometry of simple and w3c do not match"); } } return geoRSSModule; */ } }
public class class_name { public static GeoRSSModule getGeoRSS(final SyndFeed feed) { final GeoRSSModule simple = (GeoRSSModule) feed.getModule(GeoRSSModule.GEORSS_GEORSS_URI); final GeoRSSModule w3cGeo = (GeoRSSModule) feed.getModule(GeoRSSModule.GEORSS_W3CGEO_URI); final GeoRSSModule gml = (GeoRSSModule) feed.getModule(GeoRSSModule.GEORSS_GML_URI); if (gml != null) { return gml; // depends on control dependency: [if], data = [none] } if (simple != null) { return simple; // depends on control dependency: [if], data = [none] } if (w3cGeo != null) { return w3cGeo; // depends on control dependency: [if], data = [none] } return null; /* * if (geoRSSModule == null && w3cGeo != null) { geoRSSModule = w3cGeo; } else if * (geoRSSModule == null && gml != null) { geoRSSModule = gml; } else if (geoRSSModule != * null && w3cGeo != null) { // sanity check if * (!geoRSSModule.getGeometry().equals(w3cGeo.getGeometry())) { throw new * Error("geometry of simple and w3c do not match"); } } return geoRSSModule; */ } }
public class class_name { public static void sort(final List<Artifact> targets) { int n = targets.size(); while(n != 0){ int newn = 0; for(int i = 1 ; i <= n-1 ; i++){ if (targets.get(i-1).toString().compareTo(targets.get(i).toString()) > 0){ Collections.swap(targets, i - 1, i); newn = i; } } n = newn; } } }
public class class_name { public static void sort(final List<Artifact> targets) { int n = targets.size(); while(n != 0){ int newn = 0; for(int i = 1 ; i <= n-1 ; i++){ if (targets.get(i-1).toString().compareTo(targets.get(i).toString()) > 0){ Collections.swap(targets, i - 1, i); // depends on control dependency: [if], data = [none] newn = i; // depends on control dependency: [if], data = [none] } } n = newn; // depends on control dependency: [while], data = [none] } } }
public class class_name { public static SoyMsgRawTextPart of(String rawText) { int utf8Length = Utf8.encodedLength(rawText); // Determine whether UTF8 or UTF16 uses less memory, and choose between one of the two internal // implementations. char[] is preferred if the sizes are equal because it is faster to turn // back into a String. In a realistic application with 1 million messages in memory, using // UTF-8 saves about 35M, and dynamicaly switching encodings saves another 10M. // IMPORTANT! This choice is deterministic, so that for any particular input string the choice // of implementation class is the same. This ensures operations like equals() and hashCode() // do not have to decode the contents. if (utf8Length < rawText.length() * BYTES_PER_CHAR) { return new Utf8SoyMsgRawTextPart(rawText); } else { return new CharArraySoyMsgRawTextPart(rawText); } } }
public class class_name { public static SoyMsgRawTextPart of(String rawText) { int utf8Length = Utf8.encodedLength(rawText); // Determine whether UTF8 or UTF16 uses less memory, and choose between one of the two internal // implementations. char[] is preferred if the sizes are equal because it is faster to turn // back into a String. In a realistic application with 1 million messages in memory, using // UTF-8 saves about 35M, and dynamicaly switching encodings saves another 10M. // IMPORTANT! This choice is deterministic, so that for any particular input string the choice // of implementation class is the same. This ensures operations like equals() and hashCode() // do not have to decode the contents. if (utf8Length < rawText.length() * BYTES_PER_CHAR) { return new Utf8SoyMsgRawTextPart(rawText); // depends on control dependency: [if], data = [none] } else { return new CharArraySoyMsgRawTextPart(rawText); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static TimestampSpec mergeTimestampSpec(List<TimestampSpec> toMerge) { if (toMerge == null || toMerge.size() == 0) { return null; } TimestampSpec result = toMerge.get(0); for (int i = 1; i < toMerge.size(); i++) { if (toMerge.get(i) == null) { continue; } if (!Objects.equals(result, toMerge.get(i))) { return null; } } return result; } }
public class class_name { public static TimestampSpec mergeTimestampSpec(List<TimestampSpec> toMerge) { if (toMerge == null || toMerge.size() == 0) { return null; // depends on control dependency: [if], data = [none] } TimestampSpec result = toMerge.get(0); for (int i = 1; i < toMerge.size(); i++) { if (toMerge.get(i) == null) { continue; } if (!Objects.equals(result, toMerge.get(i))) { return null; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public static List<String> getResourceNamesFromJAR(String path, String extension, Class<?> clazz) throws IOException { CodeSource src = clazz.getProtectionDomain().getCodeSource(); List<String> testResources = new ArrayList<String>(); ZipInputStream zip = null; if (src != null) { URL jar = src.getLocation(); ZipEntry ze = null; try { zip = new ZipInputStream(jar.openStream()); while ((ze = zip.getNextEntry()) != null) { String entryName = ze.getName(); if (entryName.startsWith(path) && entryName.endsWith("." + extension)) { testResources.add(entryName); } } } finally { closeQuietly(zip); } } else { throw new IOException("Unable to get code source for " + clazz.getSimpleName()); } return testResources; } }
public class class_name { public static List<String> getResourceNamesFromJAR(String path, String extension, Class<?> clazz) throws IOException { CodeSource src = clazz.getProtectionDomain().getCodeSource(); List<String> testResources = new ArrayList<String>(); ZipInputStream zip = null; if (src != null) { URL jar = src.getLocation(); ZipEntry ze = null; try { zip = new ZipInputStream(jar.openStream()); while ((ze = zip.getNextEntry()) != null) { String entryName = ze.getName(); if (entryName.startsWith(path) && entryName.endsWith("." + extension)) { testResources.add(entryName); // depends on control dependency: [if], data = [none] } } } finally { closeQuietly(zip); } } else { throw new IOException("Unable to get code source for " + clazz.getSimpleName()); } return testResources; } }
public class class_name { public static String toStringLimited(ImmutableSet<?> items, int limit) { if (items.size() <= limit) { return items.toString(); } else { return items.asList().subList(0, limit).toString() + "... (" + (items.size() - limit) + " more)"; } } }
public class class_name { public static String toStringLimited(ImmutableSet<?> items, int limit) { if (items.size() <= limit) { return items.toString(); // depends on control dependency: [if], data = [none] } else { return items.asList().subList(0, limit).toString() + "... (" + (items.size() - limit) + " more)"; // depends on control dependency: [if], data = [(items.size()] } } }
public class class_name { public void setOffscreenPageLimit(int limit) { if (limit < DEFAULT_OFFSCREEN_PAGES) { Log.w(TAG, "Requested offscreen page limit " + limit + " too small; defaulting to " + DEFAULT_OFFSCREEN_PAGES); limit = DEFAULT_OFFSCREEN_PAGES; } if (limit != mOffscreenPageLimit) { mOffscreenPageLimit = limit; populate(); } } }
public class class_name { public void setOffscreenPageLimit(int limit) { if (limit < DEFAULT_OFFSCREEN_PAGES) { Log.w(TAG, "Requested offscreen page limit " + limit + " too small; defaulting to " + // depends on control dependency: [if], data = [none] DEFAULT_OFFSCREEN_PAGES); limit = DEFAULT_OFFSCREEN_PAGES; // depends on control dependency: [if], data = [none] } if (limit != mOffscreenPageLimit) { mOffscreenPageLimit = limit; // depends on control dependency: [if], data = [none] populate(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private BufferedImage create_FRAME_Image(final int WIDTH, BufferedImage image) { if (WIDTH <= 0) { return null; } if (image == null) { image = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); transformGraphics(IMAGE_WIDTH, IMAGE_HEIGHT, G2); // Define shape that will be subtracted from the frame shapes and will be filled by the background later on final GeneralPath BACKGROUND = new GeneralPath(); BACKGROUND.setWindingRule(Path2D.WIND_EVEN_ODD); BACKGROUND.moveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028); BACKGROUND.curveTo(IMAGE_WIDTH * 0.6401869158878505, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.1588785046728972, IMAGE_WIDTH * 0.29439252336448596, IMAGE_HEIGHT * 0.32242990654205606); BACKGROUND.curveTo(IMAGE_WIDTH * 0.17289719626168223, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.6635514018691588, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.curveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.closePath(); final Area SUBTRACT = new Area(BACKGROUND); final GeneralPath FRAME_OUTERFRAME = new GeneralPath(); FRAME_OUTERFRAME.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_OUTERFRAME.moveTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0); FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.0); FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 0.3644859813084112, IMAGE_HEIGHT * 0.0, IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 0.308411214953271, IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 1.0); FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0); FRAME_OUTERFRAME.closePath(); G2.setPaint(getOuterFrameColor()); final Area FRAME_OUTERFRAME_AREA = new Area(FRAME_OUTERFRAME); FRAME_OUTERFRAME_AREA.subtract(SUBTRACT); G2.fill(FRAME_OUTERFRAME_AREA); final GeneralPath FRAME_MAIN = new GeneralPath(); FRAME_MAIN.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_MAIN.moveTo(IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384); FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.004672897196261682, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.004672897196261682); FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.3364485981308411, IMAGE_HEIGHT * 0.004672897196261682, IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.35514018691588783, IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.9953271028037384); FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384); FRAME_MAIN.closePath(); final Point2D FRAME_MAIN_START; final Point2D FRAME_MAIN_STOP; final Point2D FRAME_MAIN_CENTER = new Point2D.Double(FRAME_MAIN.getBounds2D().getCenterX(), FRAME_MAIN.getBounds2D().getCenterY()); switch (getOrientation()) { case NORTH_WEST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); break; case NORTH_EAST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); break; case SOUTH_EAST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); break; case SOUTH_WEST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); break; default: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); } final float ANGLE_OFFSET = (float) Math.toDegrees(Math.atan((IMAGE_HEIGHT / 8.0f) / (IMAGE_WIDTH / 2.0f))); final Area FRAME_MAIN_AREA = new Area(FRAME_MAIN); if (getFrameDesign() == FrameDesign.CUSTOM) { G2.setPaint(getCustomFrameDesign()); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); } else { switch (getFrameDesign()) { case BLACK_METAL: float[] frameMainFractions1 = { 0.0f, 90.0f - 2 * ANGLE_OFFSET, 90.0f, 90.0f + 3 * ANGLE_OFFSET, 180.0f, 270.0f - 3 * ANGLE_OFFSET, 270.0f, 270.0f + 2 * ANGLE_OFFSET, 1.0f }; Color[] frameMainColors1 = { new Color(254, 254, 254, 255), new Color(0, 0, 0, 255), new Color(153, 153, 153, 255), new Color(0, 0, 0, 255), new Color(0, 0, 0, 255), new Color(0, 0, 0, 255), new Color(153, 153, 153, 255), new Color(0, 0, 0, 255), new Color(254, 254, 254, 255) }; Paint frameMainGradient1 = new ConicalGradientPaint(true, FRAME_MAIN_CENTER, 0, frameMainFractions1, frameMainColors1); G2.setPaint(frameMainGradient1); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case METAL: float[] frameMainFractions2 = { 0.0f, 0.07f, 0.12f, 1.0f }; Color[] frameMainColors2 = { new Color(254, 254, 254, 255), new Color(210, 210, 210, 255), new Color(179, 179, 179, 255), new Color(213, 213, 213, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient2 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions2, frameMainColors2); G2.setPaint(frameMainGradient2); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case SHINY_METAL: float[] frameMainFractions3 = { 0.0f, 90.0f - 2 * ANGLE_OFFSET, 90.0f, 90.0f + 4 * ANGLE_OFFSET, 180.0f, 270.0f - 4 * ANGLE_OFFSET, 270.0f, 270.0f + 2 * ANGLE_OFFSET, 1.0f }; Color[] frameMainColors3; if (isFrameBaseColorEnabled()) { frameMainColors3 = new Color[]{ new Color(254, 254, 254, 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().brighter().brighter().getRed(), getFrameBaseColor().brighter().brighter().getGreen(), getFrameBaseColor().brighter().brighter().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().brighter().brighter().getRed(), getFrameBaseColor().brighter().brighter().getGreen(), getFrameBaseColor().brighter().brighter().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(254, 254, 254, 255) }; } else { frameMainColors3 = new Color[]{ new Color(254, 254, 254, 255), new Color(179, 179, 179, 255), new Color(238, 238, 238, 255), new Color(179, 179, 179, 255), new Color(179, 179, 179, 255), new Color(179, 179, 179, 255), new Color(238, 238, 238, 255), new Color(179, 179, 179, 255), new Color(254, 254, 254, 255) }; } Paint frameMainGradient3 = new eu.hansolo.steelseries.tools.ConicalGradientPaint(true, FRAME_MAIN_CENTER, 0, frameMainFractions3, frameMainColors3); G2.setPaint(frameMainGradient3); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case GLOSSY_METAL: final GeneralPath FRAME_GLOSSY1 = new GeneralPath(); FRAME_GLOSSY1.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY1.moveTo(0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT); FRAME_GLOSSY1.curveTo(0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT); FRAME_GLOSSY1.curveTo(0.3364485981308411 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT, 0.004672897196261682 * IMAGE_WIDTH, 0.35514018691588783 * IMAGE_HEIGHT, 0.004672897196261682 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT); FRAME_GLOSSY1.curveTo(0.004672897196261682 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT); FRAME_GLOSSY1.closePath(); final Area FRAME_GLOSSY_1 = new Area(FRAME_GLOSSY1); FRAME_GLOSSY_1.subtract(SUBTRACT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.9906542056074766 * IMAGE_WIDTH, 0.9813084112149533 * IMAGE_HEIGHT), (float)(0.9789719626168224 * IMAGE_WIDTH), new float[]{0.0f, 0.94f, 1.0f}, new Color[]{new Color(0.8235294118f, 0.8235294118f, 0.8235294118f, 1f), new Color(0.8235294118f, 0.8235294118f, 0.8235294118f, 1f), new Color(1f, 1f, 1f, 1f)})); G2.fill(FRAME_GLOSSY_1); final GeneralPath FRAME_GLOSSY2 = new GeneralPath(); FRAME_GLOSSY2.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY2.moveTo(0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT); FRAME_GLOSSY2.curveTo(0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT); FRAME_GLOSSY2.curveTo(0.3364485981308411 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT, 0.009345794392523364 * IMAGE_WIDTH, 0.3598130841121495 * IMAGE_HEIGHT, 0.009345794392523364 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT); FRAME_GLOSSY2.curveTo(0.009345794392523364 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT); FRAME_GLOSSY2.closePath(); final Area FRAME_GLOSSY_2 = new Area(FRAME_GLOSSY2); FRAME_GLOSSY_1.subtract(SUBTRACT); G2.setPaint(new LinearGradientPaint(new Point2D.Double(0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT), new Point2D.Double(0.9953271028037384 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT), new float[]{0.0f, 0.18f, 0.32f, 0.66f, 0.89f, 1.0f}, new Color[]{new Color(0.9764705882f, 0.9764705882f, 0.9764705882f, 1f), new Color(0.7843137255f, 0.7647058824f, 0.7490196078f, 1f), new Color(0.9960784314f, 0.9960784314f, 0.9921568627f, 1f), new Color(0.1137254902f, 0.1137254902f, 0.1137254902f, 1f), new Color(0.7843137255f, 0.7647058824f, 0.7490196078f, 1f), new Color(0.8196078431f, 0.8196078431f, 0.8196078431f, 1f)})); G2.fill(FRAME_GLOSSY_2); final GeneralPath FRAME_GLOSSY3 = new GeneralPath(); FRAME_GLOSSY3.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY3.moveTo(0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT); FRAME_GLOSSY3.curveTo(0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT); FRAME_GLOSSY3.curveTo(0.40654205607476634 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT, 0.07009345794392523 * IMAGE_WIDTH, 0.37383177570093457 * IMAGE_HEIGHT, 0.07009345794392523 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT); FRAME_GLOSSY3.curveTo(0.07009345794392523 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT); FRAME_GLOSSY3.closePath(); final Area FRAME_GLOSSY_3 = new Area(FRAME_GLOSSY3); FRAME_GLOSSY_3.subtract(SUBTRACT); G2.setPaint(new Color(0.9647058824f, 0.9647058824f, 0.9647058824f, 1f)); G2.fill(FRAME_GLOSSY_3); final GeneralPath FRAME_GLOSSY4 = new GeneralPath(); FRAME_GLOSSY4.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY4.moveTo(0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT); FRAME_GLOSSY4.curveTo(0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT); FRAME_GLOSSY4.curveTo(0.3878504672897196 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT, 0.07476635514018691 * IMAGE_WIDTH, 0.4158878504672897 * IMAGE_HEIGHT, 0.07476635514018691 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT); FRAME_GLOSSY4.curveTo(0.07476635514018691 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT); FRAME_GLOSSY4.closePath(); final Area FRAME_GLOSSY_4 = new Area(FRAME_GLOSSY4); FRAME_GLOSSY_4.subtract(SUBTRACT); G2.setPaint(new Color(0.2f, 0.2f, 0.2f, 1f)); G2.fill(FRAME_GLOSSY_4); break; case BRASS: float[] frameMainFractions5 = { 0.0f, 0.05f, 0.10f, 0.50f, 0.90f, 0.95f, 1.0f }; Color[] frameMainColors5 = { new Color(249, 243, 155, 255), new Color(246, 226, 101, 255), new Color(240, 225, 132, 255), new Color(90, 57, 22, 255), new Color(249, 237, 139, 255), new Color(243, 226, 108, 255), new Color(202, 182, 113, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient5 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions5, frameMainColors5); G2.setPaint(frameMainGradient5); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case STEEL: float[] frameMainFractions6 = { 0.0f, 0.05f, 0.10f, 0.50f, 0.90f, 0.95f, 1.0f }; Color[] frameMainColors6 = { new Color(231, 237, 237, 255), new Color(189, 199, 198, 255), new Color(192, 201, 200, 255), new Color(23, 31, 33, 255), new Color(196, 205, 204, 255), new Color(194, 204, 203, 255), new Color(189, 201, 199, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient6 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions6, frameMainColors6); G2.setPaint(frameMainGradient6); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case CHROME: float[] frameMainFractions7 = { 0.0f, 0.09f, 0.12f, 0.16f, 0.25f, 0.29f, 0.33f, 0.38f, 0.48f, 0.52f, 0.63f, 0.68f, 0.8f, 0.83f, 0.87f, 0.97f, 1.0f }; Color[] frameMainColors7 = { new Color(255, 255, 255, 255), new Color(255, 255, 255, 255), new Color(136, 136, 138, 255), new Color(164, 185, 190, 255), new Color(158, 179, 182, 255), new Color(112, 112, 112, 255), new Color(221, 227, 227, 255), new Color(155, 176, 179, 255), new Color(156, 176, 177, 255), new Color(254, 255, 255, 255), new Color(255, 255, 255, 255), new Color(156, 180, 180, 255), new Color(198, 209, 211, 255), new Color(246, 248, 247, 255), new Color(204, 216, 216, 255), new Color(164, 188, 190, 255), new Color(255, 255, 255, 255) }; Paint frameMainGradient7 = new eu.hansolo.steelseries.tools.ConicalGradientPaint(false, FRAME_MAIN_CENTER, 0, frameMainFractions7, frameMainColors7); G2.setPaint(frameMainGradient7); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case GOLD: float[] frameMainFractions8 = { 0.0f, 0.15f, 0.22f, 0.3f, 0.38f, 0.44f, 0.51f, 0.6f, 0.68f, 0.75f, 1.0f }; Color[] frameMainColors8 = { new Color(255, 255, 207, 255), new Color(255, 237, 96, 255), new Color(254, 199, 57, 255), new Color(255, 249, 203, 255), new Color(255, 199, 64, 255), new Color(252, 194, 60, 255), new Color(255, 204, 59, 255), new Color(213, 134, 29, 255), new Color(255, 201, 56, 255), new Color(212, 135, 29, 255), new Color(247, 238, 101, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient8 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions8, frameMainColors8); G2.setPaint(frameMainGradient8); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case ANTHRACITE: float[] frameMainFractions9 = { 0.0f, 0.06f, 0.12f, 1.0f }; Color[] frameMainColors9 = { new Color(118, 117, 135, 255), new Color(74, 74, 82, 255), new Color(50, 50, 54, 255), new Color(97, 97, 108, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient9 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions9, frameMainColors9); G2.setPaint(frameMainGradient9); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case TILTED_GRAY: FRAME_MAIN_START.setLocation((0.2336448598130841 * IMAGE_WIDTH), (0.08411214953271028 * IMAGE_HEIGHT)); FRAME_MAIN_STOP.setLocation(((0.2336448598130841 + 0.5789369637935792) * IMAGE_WIDTH), ((0.08411214953271028 + 0.8268076708711319) * IMAGE_HEIGHT)); float[] frameMainFractions10 = { 0.0f, 0.07f, 0.16f, 0.33f, 0.55f, 0.79f, 1.0f }; Color[] frameMainColors10 = { new Color(255, 255, 255, 255), new Color(210, 210, 210, 255), new Color(179, 179, 179, 255), new Color(255, 255, 255, 255), new Color(197, 197, 197, 255), new Color(255, 255, 255, 255), new Color(102, 102, 102, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient10 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions10, frameMainColors10); G2.setPaint(frameMainGradient10); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case TILTED_BLACK: FRAME_MAIN_START.setLocation((0.22897196261682243 * IMAGE_WIDTH), (0.0794392523364486 * IMAGE_HEIGHT)); FRAME_MAIN_STOP.setLocation(((0.22897196261682243 + 0.573576436351046) * IMAGE_WIDTH), ((0.0794392523364486 + 0.8191520442889918) * IMAGE_HEIGHT)); float[] frameMainFractions11 = { 0.0f, 0.21f, 0.47f, 0.99f, 1.0f }; Color[] frameMainColors11 = { new Color(102, 102, 102, 255), new Color(0, 0, 0, 255), new Color(102, 102, 102, 255), new Color(0, 0, 0, 255), new Color(0, 0, 0, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient11 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions11, frameMainColors11); G2.setPaint(frameMainGradient11); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; default: float[] frameMainFractions = { 0.0f, 0.07f, 0.12f, 1.0f }; Color[] frameMainColors = { new Color(254, 254, 254, 255), new Color(210, 210, 210, 255), new Color(179, 179, 179, 255), new Color(213, 213, 213, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions, frameMainColors); G2.setPaint(frameMainGradient); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; } } // Apply frame effects final float[] EFFECT_FRACTIONS; final Color[] EFFECT_COLORS; final GradientWrapper EFFECT_GRADIENT; float scale = 1.0f; final Shape[] EFFECT = new Shape[100]; switch (getFrameEffect()) { case EFFECT_BULGE: EFFECT_FRACTIONS = new float[]{ 0.0f, 0.13f, 0.14f, 0.17f, 0.18f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 102), // Outside new Color(255, 255, 255, 151), new Color(219, 219, 219, 153), new Color(0, 0, 0, 95), new Color(0, 0, 0, 76), // Inside new Color(0, 0, 0, 0) }; EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS); for (int i = 0; i < 100; i++) { EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale); scale -= 0.01f; } G2.setStroke(new BasicStroke(1.5f)); for (int i = 0; i < EFFECT.length; i++) { G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f)); G2.draw(EFFECT[i]); } break; case EFFECT_CONE: EFFECT_FRACTIONS = new float[]{ 0.0f, 0.0399f, 0.04f, 0.1799f, 0.18f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 76), new Color(223, 223, 223, 127), new Color(255, 255, 255, 124), new Color(9, 9, 9, 51), new Color(0, 0, 0, 50), new Color(0, 0, 0, 0) }; EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS); for (int i = 0; i < 100; i++) { EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale); scale -= 0.01f; } G2.setStroke(new BasicStroke(1.5f)); for (int i = 0; i < EFFECT.length; i++) { G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f)); G2.draw(EFFECT[i]); } break; case EFFECT_TORUS: EFFECT_FRACTIONS = new float[]{ 0.0f, 0.08f, 0.1799f, 0.18f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 76), new Color(255, 255, 255, 64), new Color(13, 13, 13, 51), new Color(0, 0, 0, 50), new Color(0, 0, 0, 0) }; EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS); for (int i = 0; i < 100; i++) { EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale); scale -= 0.01f; } G2.setStroke(new BasicStroke(1.5f)); for (int i = 0; i < EFFECT.length; i++) { G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f)); G2.draw(EFFECT[i]); } break; case EFFECT_INNER_FRAME: final java.awt.Shape EFFECT_BIGINNERFRAME = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, 0.8785046339035034); final Point2D EFFECT_BIGINNERFRAME_START = new Point2D.Double(0, EFFECT_BIGINNERFRAME.getBounds2D().getMinY()); final Point2D EFFECT_BIGINNERFRAME_STOP = new Point2D.Double(0, EFFECT_BIGINNERFRAME.getBounds2D().getMaxY()); EFFECT_FRACTIONS = new float[]{ 0.0f, 0.3f, 0.5f, 0.71f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 183), new Color(148, 148, 148, 25), new Color(0, 0, 0, 159), new Color(0, 0, 0, 81), new Color(255, 255, 255, 158) }; Util.INSTANCE.validateGradientPoints(EFFECT_BIGINNERFRAME_START, EFFECT_BIGINNERFRAME_STOP); final LinearGradientPaint EFFECT_BIGINNERFRAME_GRADIENT = new LinearGradientPaint(EFFECT_BIGINNERFRAME_START, EFFECT_BIGINNERFRAME_STOP, EFFECT_FRACTIONS, EFFECT_COLORS); G2.setPaint(EFFECT_BIGINNERFRAME_GRADIENT); G2.fill(EFFECT_BIGINNERFRAME); break; } final GeneralPath GAUGE_BACKGROUND_MAIN = new GeneralPath(); GAUGE_BACKGROUND_MAIN.setWindingRule(Path2D.WIND_EVEN_ODD); GAUGE_BACKGROUND_MAIN.moveTo(IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.0794392523364486, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.0794392523364486); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.6822429906542056, IMAGE_HEIGHT * 0.0794392523364486, IMAGE_WIDTH * 0.48130841121495327, IMAGE_HEIGHT * 0.13551401869158877, IMAGE_WIDTH * 0.3037383177570093, IMAGE_HEIGHT * 0.308411214953271); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.6822429906542056, IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.9205607476635514); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514); GAUGE_BACKGROUND_MAIN.closePath(); G2.setColor(Color.WHITE); final java.awt.geom.Area GAUGE_BACKGROUND_MAIN_AREA = new java.awt.geom.Area(GAUGE_BACKGROUND_MAIN); GAUGE_BACKGROUND_MAIN_AREA.subtract(SUBTRACT); G2.fill(GAUGE_BACKGROUND_MAIN_AREA); G2.dispose(); return image; } }
public class class_name { private BufferedImage create_FRAME_Image(final int WIDTH, BufferedImage image) { if (WIDTH <= 0) { return null; // depends on control dependency: [if], data = [none] } if (image == null) { image = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); // depends on control dependency: [if], data = [none] } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); transformGraphics(IMAGE_WIDTH, IMAGE_HEIGHT, G2); // Define shape that will be subtracted from the frame shapes and will be filled by the background later on final GeneralPath BACKGROUND = new GeneralPath(); BACKGROUND.setWindingRule(Path2D.WIND_EVEN_ODD); BACKGROUND.moveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028); BACKGROUND.curveTo(IMAGE_WIDTH * 0.6401869158878505, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.1588785046728972, IMAGE_WIDTH * 0.29439252336448596, IMAGE_HEIGHT * 0.32242990654205606); BACKGROUND.curveTo(IMAGE_WIDTH * 0.17289719626168223, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.6635514018691588, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.curveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.closePath(); final Area SUBTRACT = new Area(BACKGROUND); final GeneralPath FRAME_OUTERFRAME = new GeneralPath(); FRAME_OUTERFRAME.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_OUTERFRAME.moveTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0); FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.0); FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 0.3644859813084112, IMAGE_HEIGHT * 0.0, IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 0.308411214953271, IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 1.0); FRAME_OUTERFRAME.curveTo(IMAGE_WIDTH * 0.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0, IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 1.0); FRAME_OUTERFRAME.closePath(); G2.setPaint(getOuterFrameColor()); final Area FRAME_OUTERFRAME_AREA = new Area(FRAME_OUTERFRAME); FRAME_OUTERFRAME_AREA.subtract(SUBTRACT); G2.fill(FRAME_OUTERFRAME_AREA); final GeneralPath FRAME_MAIN = new GeneralPath(); FRAME_MAIN.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_MAIN.moveTo(IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384); FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.004672897196261682, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.004672897196261682); FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.3364485981308411, IMAGE_HEIGHT * 0.004672897196261682, IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.35514018691588783, IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.9953271028037384); FRAME_MAIN.curveTo(IMAGE_WIDTH * 0.004672897196261682, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384, IMAGE_WIDTH * 0.9953271028037384, IMAGE_HEIGHT * 0.9953271028037384); FRAME_MAIN.closePath(); final Point2D FRAME_MAIN_START; final Point2D FRAME_MAIN_STOP; final Point2D FRAME_MAIN_CENTER = new Point2D.Double(FRAME_MAIN.getBounds2D().getCenterX(), FRAME_MAIN.getBounds2D().getCenterY()); switch (getOrientation()) { case NORTH_WEST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); break; case NORTH_EAST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); break; case SOUTH_EAST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); break; case SOUTH_WEST: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); break; default: FRAME_MAIN_START = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMinY()); FRAME_MAIN_STOP = new Point2D.Double(0, FRAME_MAIN.getBounds2D().getMaxY()); } final float ANGLE_OFFSET = (float) Math.toDegrees(Math.atan((IMAGE_HEIGHT / 8.0f) / (IMAGE_WIDTH / 2.0f))); final Area FRAME_MAIN_AREA = new Area(FRAME_MAIN); if (getFrameDesign() == FrameDesign.CUSTOM) { G2.setPaint(getCustomFrameDesign()); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); } else { switch (getFrameDesign()) { case BLACK_METAL: float[] frameMainFractions1 = { 0.0f, 90.0f - 2 * ANGLE_OFFSET, 90.0f, 90.0f + 3 * ANGLE_OFFSET, 180.0f, 270.0f - 3 * ANGLE_OFFSET, 270.0f, 270.0f + 2 * ANGLE_OFFSET, 1.0f }; Color[] frameMainColors1 = { new Color(254, 254, 254, 255), new Color(0, 0, 0, 255), new Color(153, 153, 153, 255), new Color(0, 0, 0, 255), new Color(0, 0, 0, 255), new Color(0, 0, 0, 255), new Color(153, 153, 153, 255), new Color(0, 0, 0, 255), new Color(254, 254, 254, 255) }; Paint frameMainGradient1 = new ConicalGradientPaint(true, FRAME_MAIN_CENTER, 0, frameMainFractions1, frameMainColors1); G2.setPaint(frameMainGradient1); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case METAL: float[] frameMainFractions2 = { 0.0f, 0.07f, 0.12f, 1.0f }; Color[] frameMainColors2 = { new Color(254, 254, 254, 255), new Color(210, 210, 210, 255), new Color(179, 179, 179, 255), new Color(213, 213, 213, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient2 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions2, frameMainColors2); G2.setPaint(frameMainGradient2); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case SHINY_METAL: float[] frameMainFractions3 = { 0.0f, 90.0f - 2 * ANGLE_OFFSET, 90.0f, 90.0f + 4 * ANGLE_OFFSET, 180.0f, 270.0f - 4 * ANGLE_OFFSET, 270.0f, 270.0f + 2 * ANGLE_OFFSET, 1.0f }; Color[] frameMainColors3; if (isFrameBaseColorEnabled()) { frameMainColors3 = new Color[]{ new Color(254, 254, 254, 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().brighter().brighter().getRed(), getFrameBaseColor().brighter().brighter().getGreen(), getFrameBaseColor().brighter().brighter().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(getFrameBaseColor().brighter().brighter().getRed(), getFrameBaseColor().brighter().brighter().getGreen(), getFrameBaseColor().brighter().brighter().getBlue(), 255), new Color(getFrameBaseColor().getRed(), getFrameBaseColor().getGreen(), getFrameBaseColor().getBlue(), 255), new Color(254, 254, 254, 255) }; // depends on control dependency: [if], data = [none] } else { frameMainColors3 = new Color[]{ new Color(254, 254, 254, 255), new Color(179, 179, 179, 255), new Color(238, 238, 238, 255), new Color(179, 179, 179, 255), new Color(179, 179, 179, 255), new Color(179, 179, 179, 255), new Color(238, 238, 238, 255), new Color(179, 179, 179, 255), new Color(254, 254, 254, 255) }; // depends on control dependency: [if], data = [none] } Paint frameMainGradient3 = new eu.hansolo.steelseries.tools.ConicalGradientPaint(true, FRAME_MAIN_CENTER, 0, frameMainFractions3, frameMainColors3); G2.setPaint(frameMainGradient3); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case GLOSSY_METAL: final GeneralPath FRAME_GLOSSY1 = new GeneralPath(); FRAME_GLOSSY1.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY1.moveTo(0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT); FRAME_GLOSSY1.curveTo(0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT); FRAME_GLOSSY1.curveTo(0.3364485981308411 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT, 0.004672897196261682 * IMAGE_WIDTH, 0.35514018691588783 * IMAGE_HEIGHT, 0.004672897196261682 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT); FRAME_GLOSSY1.curveTo(0.004672897196261682 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT, 0.9953271028037384 * IMAGE_WIDTH, 0.9953271028037384 * IMAGE_HEIGHT); FRAME_GLOSSY1.closePath(); final Area FRAME_GLOSSY_1 = new Area(FRAME_GLOSSY1); FRAME_GLOSSY_1.subtract(SUBTRACT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.9906542056074766 * IMAGE_WIDTH, 0.9813084112149533 * IMAGE_HEIGHT), (float)(0.9789719626168224 * IMAGE_WIDTH), new float[]{0.0f, 0.94f, 1.0f}, new Color[]{new Color(0.8235294118f, 0.8235294118f, 0.8235294118f, 1f), new Color(0.8235294118f, 0.8235294118f, 0.8235294118f, 1f), new Color(1f, 1f, 1f, 1f)})); G2.fill(FRAME_GLOSSY_1); final GeneralPath FRAME_GLOSSY2 = new GeneralPath(); FRAME_GLOSSY2.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY2.moveTo(0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT); FRAME_GLOSSY2.curveTo(0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT); FRAME_GLOSSY2.curveTo(0.3364485981308411 * IMAGE_WIDTH, 0.009345794392523364 * IMAGE_HEIGHT, 0.009345794392523364 * IMAGE_WIDTH, 0.3598130841121495 * IMAGE_HEIGHT, 0.009345794392523364 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT); FRAME_GLOSSY2.curveTo(0.009345794392523364 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT, 0.9906542056074766 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT); FRAME_GLOSSY2.closePath(); final Area FRAME_GLOSSY_2 = new Area(FRAME_GLOSSY2); FRAME_GLOSSY_1.subtract(SUBTRACT); G2.setPaint(new LinearGradientPaint(new Point2D.Double(0.9953271028037384 * IMAGE_WIDTH, 0.004672897196261682 * IMAGE_HEIGHT), new Point2D.Double(0.9953271028037384 * IMAGE_WIDTH, 0.9906542056074766 * IMAGE_HEIGHT), new float[]{0.0f, 0.18f, 0.32f, 0.66f, 0.89f, 1.0f}, new Color[]{new Color(0.9764705882f, 0.9764705882f, 0.9764705882f, 1f), new Color(0.7843137255f, 0.7647058824f, 0.7490196078f, 1f), new Color(0.9960784314f, 0.9960784314f, 0.9921568627f, 1f), new Color(0.1137254902f, 0.1137254902f, 0.1137254902f, 1f), new Color(0.7843137255f, 0.7647058824f, 0.7490196078f, 1f), new Color(0.8196078431f, 0.8196078431f, 0.8196078431f, 1f)})); G2.fill(FRAME_GLOSSY_2); final GeneralPath FRAME_GLOSSY3 = new GeneralPath(); FRAME_GLOSSY3.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY3.moveTo(0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT); FRAME_GLOSSY3.curveTo(0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT); FRAME_GLOSSY3.curveTo(0.40654205607476634 * IMAGE_WIDTH, 0.06542056074766354 * IMAGE_HEIGHT, 0.07009345794392523 * IMAGE_WIDTH, 0.37383177570093457 * IMAGE_HEIGHT, 0.07009345794392523 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT); FRAME_GLOSSY3.curveTo(0.07009345794392523 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT, 0.9299065420560748 * IMAGE_WIDTH, 0.9299065420560748 * IMAGE_HEIGHT); FRAME_GLOSSY3.closePath(); final Area FRAME_GLOSSY_3 = new Area(FRAME_GLOSSY3); FRAME_GLOSSY_3.subtract(SUBTRACT); G2.setPaint(new Color(0.9647058824f, 0.9647058824f, 0.9647058824f, 1f)); G2.fill(FRAME_GLOSSY_3); final GeneralPath FRAME_GLOSSY4 = new GeneralPath(); FRAME_GLOSSY4.setWindingRule(Path2D.WIND_EVEN_ODD); FRAME_GLOSSY4.moveTo(0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT); FRAME_GLOSSY4.curveTo(0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT); FRAME_GLOSSY4.curveTo(0.3878504672897196 * IMAGE_WIDTH, 0.07009345794392523 * IMAGE_HEIGHT, 0.07476635514018691 * IMAGE_WIDTH, 0.4158878504672897 * IMAGE_HEIGHT, 0.07476635514018691 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT); FRAME_GLOSSY4.curveTo(0.07476635514018691 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT, 0.9252336448598131 * IMAGE_WIDTH, 0.9252336448598131 * IMAGE_HEIGHT); FRAME_GLOSSY4.closePath(); final Area FRAME_GLOSSY_4 = new Area(FRAME_GLOSSY4); FRAME_GLOSSY_4.subtract(SUBTRACT); G2.setPaint(new Color(0.2f, 0.2f, 0.2f, 1f)); G2.fill(FRAME_GLOSSY_4); break; case BRASS: float[] frameMainFractions5 = { 0.0f, 0.05f, 0.10f, 0.50f, 0.90f, 0.95f, 1.0f }; Color[] frameMainColors5 = { new Color(249, 243, 155, 255), new Color(246, 226, 101, 255), new Color(240, 225, 132, 255), new Color(90, 57, 22, 255), new Color(249, 237, 139, 255), new Color(243, 226, 108, 255), new Color(202, 182, 113, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient5 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions5, frameMainColors5); G2.setPaint(frameMainGradient5); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case STEEL: float[] frameMainFractions6 = { 0.0f, 0.05f, 0.10f, 0.50f, 0.90f, 0.95f, 1.0f }; Color[] frameMainColors6 = { new Color(231, 237, 237, 255), new Color(189, 199, 198, 255), new Color(192, 201, 200, 255), new Color(23, 31, 33, 255), new Color(196, 205, 204, 255), new Color(194, 204, 203, 255), new Color(189, 201, 199, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient6 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions6, frameMainColors6); G2.setPaint(frameMainGradient6); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case CHROME: float[] frameMainFractions7 = { 0.0f, 0.09f, 0.12f, 0.16f, 0.25f, 0.29f, 0.33f, 0.38f, 0.48f, 0.52f, 0.63f, 0.68f, 0.8f, 0.83f, 0.87f, 0.97f, 1.0f }; Color[] frameMainColors7 = { new Color(255, 255, 255, 255), new Color(255, 255, 255, 255), new Color(136, 136, 138, 255), new Color(164, 185, 190, 255), new Color(158, 179, 182, 255), new Color(112, 112, 112, 255), new Color(221, 227, 227, 255), new Color(155, 176, 179, 255), new Color(156, 176, 177, 255), new Color(254, 255, 255, 255), new Color(255, 255, 255, 255), new Color(156, 180, 180, 255), new Color(198, 209, 211, 255), new Color(246, 248, 247, 255), new Color(204, 216, 216, 255), new Color(164, 188, 190, 255), new Color(255, 255, 255, 255) }; Paint frameMainGradient7 = new eu.hansolo.steelseries.tools.ConicalGradientPaint(false, FRAME_MAIN_CENTER, 0, frameMainFractions7, frameMainColors7); G2.setPaint(frameMainGradient7); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case GOLD: float[] frameMainFractions8 = { 0.0f, 0.15f, 0.22f, 0.3f, 0.38f, 0.44f, 0.51f, 0.6f, 0.68f, 0.75f, 1.0f }; Color[] frameMainColors8 = { new Color(255, 255, 207, 255), new Color(255, 237, 96, 255), new Color(254, 199, 57, 255), new Color(255, 249, 203, 255), new Color(255, 199, 64, 255), new Color(252, 194, 60, 255), new Color(255, 204, 59, 255), new Color(213, 134, 29, 255), new Color(255, 201, 56, 255), new Color(212, 135, 29, 255), new Color(247, 238, 101, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient8 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions8, frameMainColors8); G2.setPaint(frameMainGradient8); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case ANTHRACITE: float[] frameMainFractions9 = { 0.0f, 0.06f, 0.12f, 1.0f }; Color[] frameMainColors9 = { new Color(118, 117, 135, 255), new Color(74, 74, 82, 255), new Color(50, 50, 54, 255), new Color(97, 97, 108, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient9 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions9, frameMainColors9); G2.setPaint(frameMainGradient9); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case TILTED_GRAY: FRAME_MAIN_START.setLocation((0.2336448598130841 * IMAGE_WIDTH), (0.08411214953271028 * IMAGE_HEIGHT)); FRAME_MAIN_STOP.setLocation(((0.2336448598130841 + 0.5789369637935792) * IMAGE_WIDTH), ((0.08411214953271028 + 0.8268076708711319) * IMAGE_HEIGHT)); float[] frameMainFractions10 = { 0.0f, 0.07f, 0.16f, 0.33f, 0.55f, 0.79f, 1.0f }; Color[] frameMainColors10 = { new Color(255, 255, 255, 255), new Color(210, 210, 210, 255), new Color(179, 179, 179, 255), new Color(255, 255, 255, 255), new Color(197, 197, 197, 255), new Color(255, 255, 255, 255), new Color(102, 102, 102, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient10 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions10, frameMainColors10); G2.setPaint(frameMainGradient10); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; case TILTED_BLACK: FRAME_MAIN_START.setLocation((0.22897196261682243 * IMAGE_WIDTH), (0.0794392523364486 * IMAGE_HEIGHT)); FRAME_MAIN_STOP.setLocation(((0.22897196261682243 + 0.573576436351046) * IMAGE_WIDTH), ((0.0794392523364486 + 0.8191520442889918) * IMAGE_HEIGHT)); float[] frameMainFractions11 = { 0.0f, 0.21f, 0.47f, 0.99f, 1.0f }; Color[] frameMainColors11 = { new Color(102, 102, 102, 255), new Color(0, 0, 0, 255), new Color(102, 102, 102, 255), new Color(0, 0, 0, 255), new Color(0, 0, 0, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient11 = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions11, frameMainColors11); G2.setPaint(frameMainGradient11); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; default: float[] frameMainFractions = { 0.0f, 0.07f, 0.12f, 1.0f }; Color[] frameMainColors = { new Color(254, 254, 254, 255), new Color(210, 210, 210, 255), new Color(179, 179, 179, 255), new Color(213, 213, 213, 255) }; Util.INSTANCE.validateGradientPoints(FRAME_MAIN_START, FRAME_MAIN_STOP); Paint frameMainGradient = new LinearGradientPaint(FRAME_MAIN_START, FRAME_MAIN_STOP, frameMainFractions, frameMainColors); G2.setPaint(frameMainGradient); FRAME_MAIN_AREA.subtract(SUBTRACT); G2.fill(FRAME_MAIN_AREA); break; } } // Apply frame effects final float[] EFFECT_FRACTIONS; final Color[] EFFECT_COLORS; final GradientWrapper EFFECT_GRADIENT; float scale = 1.0f; final Shape[] EFFECT = new Shape[100]; switch (getFrameEffect()) { case EFFECT_BULGE: EFFECT_FRACTIONS = new float[]{ 0.0f, 0.13f, 0.14f, 0.17f, 0.18f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 102), // Outside new Color(255, 255, 255, 151), new Color(219, 219, 219, 153), new Color(0, 0, 0, 95), new Color(0, 0, 0, 76), // Inside new Color(0, 0, 0, 0) }; EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS); for (int i = 0; i < 100; i++) { EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale); // depends on control dependency: [for], data = [i] scale -= 0.01f; // depends on control dependency: [for], data = [none] } G2.setStroke(new BasicStroke(1.5f)); for (int i = 0; i < EFFECT.length; i++) { G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f)); // depends on control dependency: [for], data = [i] G2.draw(EFFECT[i]); // depends on control dependency: [for], data = [i] } break; case EFFECT_CONE: EFFECT_FRACTIONS = new float[]{ 0.0f, 0.0399f, 0.04f, 0.1799f, 0.18f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 76), new Color(223, 223, 223, 127), new Color(255, 255, 255, 124), new Color(9, 9, 9, 51), new Color(0, 0, 0, 50), new Color(0, 0, 0, 0) }; EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS); for (int i = 0; i < 100; i++) { EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale); // depends on control dependency: [for], data = [i] scale -= 0.01f; // depends on control dependency: [for], data = [none] } G2.setStroke(new BasicStroke(1.5f)); for (int i = 0; i < EFFECT.length; i++) { G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f)); // depends on control dependency: [for], data = [i] G2.draw(EFFECT[i]); // depends on control dependency: [for], data = [i] } break; case EFFECT_TORUS: EFFECT_FRACTIONS = new float[]{ 0.0f, 0.08f, 0.1799f, 0.18f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 76), new Color(255, 255, 255, 64), new Color(13, 13, 13, 51), new Color(0, 0, 0, 50), new Color(0, 0, 0, 0) }; EFFECT_GRADIENT = new GradientWrapper(new Point2D.Double(100, 0), new Point2D.Double(0, 0), EFFECT_FRACTIONS, EFFECT_COLORS); for (int i = 0; i < 100; i++) { EFFECT[i] = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, scale); // depends on control dependency: [for], data = [i] scale -= 0.01f; // depends on control dependency: [for], data = [none] } G2.setStroke(new BasicStroke(1.5f)); for (int i = 0; i < EFFECT.length; i++) { G2.setPaint(EFFECT_GRADIENT.getColorAt(i / 100f)); // depends on control dependency: [for], data = [i] G2.draw(EFFECT[i]); // depends on control dependency: [for], data = [i] } break; case EFFECT_INNER_FRAME: final java.awt.Shape EFFECT_BIGINNERFRAME = Scaler.INSTANCE.scale(FRAME_MAIN_AREA, 0.8785046339035034); final Point2D EFFECT_BIGINNERFRAME_START = new Point2D.Double(0, EFFECT_BIGINNERFRAME.getBounds2D().getMinY()); final Point2D EFFECT_BIGINNERFRAME_STOP = new Point2D.Double(0, EFFECT_BIGINNERFRAME.getBounds2D().getMaxY()); EFFECT_FRACTIONS = new float[]{ 0.0f, 0.3f, 0.5f, 0.71f, 1.0f }; EFFECT_COLORS = new Color[]{ new Color(0, 0, 0, 183), new Color(148, 148, 148, 25), new Color(0, 0, 0, 159), new Color(0, 0, 0, 81), new Color(255, 255, 255, 158) }; Util.INSTANCE.validateGradientPoints(EFFECT_BIGINNERFRAME_START, EFFECT_BIGINNERFRAME_STOP); final LinearGradientPaint EFFECT_BIGINNERFRAME_GRADIENT = new LinearGradientPaint(EFFECT_BIGINNERFRAME_START, EFFECT_BIGINNERFRAME_STOP, EFFECT_FRACTIONS, EFFECT_COLORS); G2.setPaint(EFFECT_BIGINNERFRAME_GRADIENT); G2.fill(EFFECT_BIGINNERFRAME); break; } final GeneralPath GAUGE_BACKGROUND_MAIN = new GeneralPath(); GAUGE_BACKGROUND_MAIN.setWindingRule(Path2D.WIND_EVEN_ODD); GAUGE_BACKGROUND_MAIN.moveTo(IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.0794392523364486, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.0794392523364486); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.6822429906542056, IMAGE_HEIGHT * 0.0794392523364486, IMAGE_WIDTH * 0.48130841121495327, IMAGE_HEIGHT * 0.13551401869158877, IMAGE_WIDTH * 0.3037383177570093, IMAGE_HEIGHT * 0.308411214953271); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.6822429906542056, IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.9205607476635514); GAUGE_BACKGROUND_MAIN.curveTo(IMAGE_WIDTH * 0.0794392523364486, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.9205607476635514); GAUGE_BACKGROUND_MAIN.closePath(); G2.setColor(Color.WHITE); final java.awt.geom.Area GAUGE_BACKGROUND_MAIN_AREA = new java.awt.geom.Area(GAUGE_BACKGROUND_MAIN); GAUGE_BACKGROUND_MAIN_AREA.subtract(SUBTRACT); G2.fill(GAUGE_BACKGROUND_MAIN_AREA); G2.dispose(); return image; } }
public class class_name { public double calculateDistance(DoubleSolution individual, double[] lambda) { double scale; double distance; double[] vecInd = new double[problem.getNumberOfObjectives()]; double[] vecProj = new double[problem.getNumberOfObjectives()]; // vecInd has been normalized to the range [0,1] for (int i = 0; i < problem.getNumberOfObjectives(); i++) { vecInd[i] = (individual.getObjective(i) - idealPoint.getValue(i)) / (nadirPoint.getValue(i) - idealPoint.getValue(i)); } scale = innerproduct(vecInd, lambda) / innerproduct(lambda, lambda); for (int i = 0; i < problem.getNumberOfObjectives(); i++) { vecProj[i] = vecInd[i] - scale * lambda[i]; } distance = norm_vector(vecProj); return distance; } }
public class class_name { public double calculateDistance(DoubleSolution individual, double[] lambda) { double scale; double distance; double[] vecInd = new double[problem.getNumberOfObjectives()]; double[] vecProj = new double[problem.getNumberOfObjectives()]; // vecInd has been normalized to the range [0,1] for (int i = 0; i < problem.getNumberOfObjectives(); i++) { vecInd[i] = (individual.getObjective(i) - idealPoint.getValue(i)) / (nadirPoint.getValue(i) - idealPoint.getValue(i)); // depends on control dependency: [for], data = [i] } scale = innerproduct(vecInd, lambda) / innerproduct(lambda, lambda); for (int i = 0; i < problem.getNumberOfObjectives(); i++) { vecProj[i] = vecInd[i] - scale * lambda[i]; // depends on control dependency: [for], data = [i] } distance = norm_vector(vecProj); return distance; } }
public class class_name { public Content getSignature(MemberDoc member) { Content pre = new HtmlTree(HtmlTag.PRE); writer.addAnnotationInfo(member, pre); addModifiers(member, pre); Content link = writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, getType(member))); pre.addContent(link); pre.addContent(writer.getSpace()); if (configuration.linksource) { Content memberName = new StringContent(member.name()); writer.addSrcLink(member, memberName, pre); } else { addName(member.name(), pre); } return pre; } }
public class class_name { public Content getSignature(MemberDoc member) { Content pre = new HtmlTree(HtmlTag.PRE); writer.addAnnotationInfo(member, pre); addModifiers(member, pre); Content link = writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, getType(member))); pre.addContent(link); pre.addContent(writer.getSpace()); if (configuration.linksource) { Content memberName = new StringContent(member.name()); writer.addSrcLink(member, memberName, pre); // depends on control dependency: [if], data = [none] } else { addName(member.name(), pre); // depends on control dependency: [if], data = [none] } return pre; } }
public class class_name { public static long benchGet(DMatrixRMaj A , int n ) { long before = System.currentTimeMillis(); double total = 0; for( int iter = 0; iter < n; iter++ ) { for( int i = 0; i < A.numRows; i++ ) { for( int j = 0; j < A.numCols; j++ ) { total += A.get(i,j); } } } long after = System.currentTimeMillis(); // print to ensure that ensure that an overly smart compiler does not optimize out // the whole function and to show that both produce the same results. System.out.println(total); return after-before; } }
public class class_name { public static long benchGet(DMatrixRMaj A , int n ) { long before = System.currentTimeMillis(); double total = 0; for( int iter = 0; iter < n; iter++ ) { for( int i = 0; i < A.numRows; i++ ) { for( int j = 0; j < A.numCols; j++ ) { total += A.get(i,j); // depends on control dependency: [for], data = [j] } } } long after = System.currentTimeMillis(); // print to ensure that ensure that an overly smart compiler does not optimize out // the whole function and to show that both produce the same results. System.out.println(total); return after-before; } }
public class class_name { @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int contentWidth = mWidth - paddingLeft - paddingRight; int contentHeight = mHeight - paddingTop - paddingBottom; mCirclePaint.setStyle(Paint.Style.FILL); mCirclePaint.setColor(Color.RED); // Draw CircularViewObject mCircle.draw(canvas); // Draw non-highlighted Markers if (mMarkerList != null && !mMarkerList.isEmpty()) { for (final Marker marker : mMarkerList) { if (!mDrawHighlightedMarkerOnTop || !marker.equals(mHighlightedMarker)) { marker.draw(canvas); } } } // Draw highlighted marker if (mDrawHighlightedMarkerOnTop && mHighlightedMarker != null) { mHighlightedMarker.draw(canvas); } // Draw line if (mIsAnimating) { final float radiusFromCenter = mCircle.getRadius() + CIRCLE_TO_MARKER_PADDING + BASE_MARKER_RADIUS; final float x = (float) Math.cos(Math.toRadians(mHighlightedDegree)) * radiusFromCenter + mCircle.getX(); final float y = (float) Math.sin(Math.toRadians(mHighlightedDegree)) * radiusFromCenter + mCircle.getY(); canvas.drawLine(mCircle.getX(), mCircle.getY(), x, y, mCirclePaint); } // Draw the text. if (!TextUtils.isEmpty(mText)) { canvas.drawText(mText, mCircle.getX() - mTextWidth / 2f, mCircle.getY() - mTextHeight / 2f, // paddingLeft + (contentWidth - mTextWidth) / 2, // paddingTop + (contentHeight + mTextHeight) / 2, mTextPaint); } } }
public class class_name { @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int contentWidth = mWidth - paddingLeft - paddingRight; int contentHeight = mHeight - paddingTop - paddingBottom; mCirclePaint.setStyle(Paint.Style.FILL); mCirclePaint.setColor(Color.RED); // Draw CircularViewObject mCircle.draw(canvas); // Draw non-highlighted Markers if (mMarkerList != null && !mMarkerList.isEmpty()) { for (final Marker marker : mMarkerList) { if (!mDrawHighlightedMarkerOnTop || !marker.equals(mHighlightedMarker)) { marker.draw(canvas); // depends on control dependency: [if], data = [none] } } } // Draw highlighted marker if (mDrawHighlightedMarkerOnTop && mHighlightedMarker != null) { mHighlightedMarker.draw(canvas); // depends on control dependency: [if], data = [none] } // Draw line if (mIsAnimating) { final float radiusFromCenter = mCircle.getRadius() + CIRCLE_TO_MARKER_PADDING + BASE_MARKER_RADIUS; final float x = (float) Math.cos(Math.toRadians(mHighlightedDegree)) * radiusFromCenter + mCircle.getX(); final float y = (float) Math.sin(Math.toRadians(mHighlightedDegree)) * radiusFromCenter + mCircle.getY(); canvas.drawLine(mCircle.getX(), mCircle.getY(), x, y, mCirclePaint); // depends on control dependency: [if], data = [none] } // Draw the text. if (!TextUtils.isEmpty(mText)) { canvas.drawText(mText, mCircle.getX() - mTextWidth / 2f, mCircle.getY() - mTextHeight / 2f, // paddingLeft + (contentWidth - mTextWidth) / 2, // paddingTop + (contentHeight + mTextHeight) / 2, mTextPaint); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<SequenceGenerator<EntityMappings<T>>> getAllSequenceGenerator() { List<SequenceGenerator<EntityMappings<T>>> list = new ArrayList<SequenceGenerator<EntityMappings<T>>>(); List<Node> nodeList = childNode.get("sequence-generator"); for(Node node: nodeList) { SequenceGenerator<EntityMappings<T>> type = new SequenceGeneratorImpl<EntityMappings<T>>(this, "sequence-generator", childNode, node); list.add(type); } return list; } }
public class class_name { public List<SequenceGenerator<EntityMappings<T>>> getAllSequenceGenerator() { List<SequenceGenerator<EntityMappings<T>>> list = new ArrayList<SequenceGenerator<EntityMappings<T>>>(); List<Node> nodeList = childNode.get("sequence-generator"); for(Node node: nodeList) { SequenceGenerator<EntityMappings<T>> type = new SequenceGeneratorImpl<EntityMappings<T>>(this, "sequence-generator", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public static String decode(String s, String enc, boolean decodeSlash, boolean formEncoding, StringBuilder buffer) { buffer.setLength(0); boolean needToChange = false; int numChars = s.length(); int i = 0; while (i < numChars) { char c = s.charAt(i); if (c == '+') { if (formEncoding) { buffer.append(' '); i++; needToChange = true; } else { i++; buffer.append(c); } } else if (c == '%' || c > 127) { /* * Starting with this instance of a character * that needs to be encoded, process all * consecutive substrings of the form %xy. Each * substring %xy will yield a byte. Convert all * consecutive bytes obtained this way to whatever * character(s) they represent in the provided * encoding. * * Note that we need to decode the whole rest of the value, we can't just decode * three characters. For multi code point characters there if the code point can be * represented as an alphanumeric */ try { // guess the size of the remaining bytes // of remaining bytes // this works for percent encoded characters, // not so much for unencoded bytes byte[] bytes = new byte[numChars - i + 1]; int pos = 0; while ((i < numChars)) { if (c == '%') { char p1 = Character.toLowerCase(s.charAt(i + 1)); char p2 = Character.toLowerCase(s.charAt(i + 2)); if (!decodeSlash && ((p1 == '2' && p2 == 'f') || (p1 == '5' && p2 == 'c'))) { if(pos + 2 >= bytes.length) { bytes = expandBytes(bytes); } bytes[pos++] = (byte) c; // should be copied with preserved upper/lower case bytes[pos++] = (byte) s.charAt(i + 1); bytes[pos++] = (byte) s.charAt(i + 2); i += 3; if (i < numChars) { c = s.charAt(i); } continue; } int v = 0; if (p1 >= '0' && p1 <= '9') { v = (p1 - '0') << 4; } else if (p1 >= 'a' && p1 <= 'f') { v = (p1 - 'a' + 10) << 4; } else { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, null); } if (p2 >= '0' && p2 <= '9') { v += (p2 - '0'); } else if (p2 >= 'a' && p2 <= 'f') { v += (p2 - 'a' + 10); } else { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, null); } if (v < 0) { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, null); } if(pos == bytes.length) { bytes = expandBytes(bytes); } bytes[pos++] = (byte) v; i += 3; if (i < numChars) { c = s.charAt(i); } } else if (c == '+' && formEncoding) { if(pos == bytes.length) { bytes = expandBytes(bytes); } bytes[pos++] = (byte) ' '; ++i; if (i < numChars) { c = s.charAt(i); } } else { if (pos == bytes.length) { bytes = expandBytes(bytes); } ++i; if(c >> 8 != 0) { bytes[pos++] = (byte) (c >> 8); if (pos == bytes.length) { bytes = expandBytes(bytes); } bytes[pos++] = (byte) c; } else { bytes[pos++] = (byte) c; if (i < numChars) { c = s.charAt(i); } } } } String decoded = new String(bytes, 0, pos, enc); buffer.append(decoded); } catch (NumberFormatException e) { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, e); } catch (UnsupportedEncodingException e) { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, e); } needToChange = true; break; } else { buffer.append(c); i++; } } return (needToChange ? buffer.toString() : s); } }
public class class_name { public static String decode(String s, String enc, boolean decodeSlash, boolean formEncoding, StringBuilder buffer) { buffer.setLength(0); boolean needToChange = false; int numChars = s.length(); int i = 0; while (i < numChars) { char c = s.charAt(i); if (c == '+') { if (formEncoding) { buffer.append(' '); // depends on control dependency: [if], data = [none] i++; // depends on control dependency: [if], data = [none] needToChange = true; // depends on control dependency: [if], data = [none] } else { i++; // depends on control dependency: [if], data = [none] buffer.append(c); // depends on control dependency: [if], data = [none] } } else if (c == '%' || c > 127) { /* * Starting with this instance of a character * that needs to be encoded, process all * consecutive substrings of the form %xy. Each * substring %xy will yield a byte. Convert all * consecutive bytes obtained this way to whatever * character(s) they represent in the provided * encoding. * * Note that we need to decode the whole rest of the value, we can't just decode * three characters. For multi code point characters there if the code point can be * represented as an alphanumeric */ try { // guess the size of the remaining bytes // of remaining bytes // this works for percent encoded characters, // not so much for unencoded bytes byte[] bytes = new byte[numChars - i + 1]; int pos = 0; while ((i < numChars)) { if (c == '%') { char p1 = Character.toLowerCase(s.charAt(i + 1)); char p2 = Character.toLowerCase(s.charAt(i + 2)); if (!decodeSlash && ((p1 == '2' && p2 == 'f') || (p1 == '5' && p2 == 'c'))) { if(pos + 2 >= bytes.length) { bytes = expandBytes(bytes); // depends on control dependency: [if], data = [none] } bytes[pos++] = (byte) c; // depends on control dependency: [if], data = [none] // should be copied with preserved upper/lower case bytes[pos++] = (byte) s.charAt(i + 1); // depends on control dependency: [if], data = [none] bytes[pos++] = (byte) s.charAt(i + 2); // depends on control dependency: [if], data = [none] i += 3; // depends on control dependency: [if], data = [none] if (i < numChars) { c = s.charAt(i); // depends on control dependency: [if], data = [(i] } continue; } int v = 0; if (p1 >= '0' && p1 <= '9') { v = (p1 - '0') << 4; // depends on control dependency: [if], data = [(p1] } else if (p1 >= 'a' && p1 <= 'f') { v = (p1 - 'a' + 10) << 4; // depends on control dependency: [if], data = [(p1] } else { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, null); } if (p2 >= '0' && p2 <= '9') { v += (p2 - '0'); // depends on control dependency: [if], data = [(p2] } else if (p2 >= 'a' && p2 <= 'f') { v += (p2 - 'a' + 10); // depends on control dependency: [if], data = [(p2] } else { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, null); } if (v < 0) { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, null); } if(pos == bytes.length) { bytes = expandBytes(bytes); // depends on control dependency: [if], data = [none] } bytes[pos++] = (byte) v; // depends on control dependency: [if], data = [none] i += 3; // depends on control dependency: [if], data = [none] if (i < numChars) { c = s.charAt(i); // depends on control dependency: [if], data = [(i] } } else if (c == '+' && formEncoding) { if(pos == bytes.length) { bytes = expandBytes(bytes); // depends on control dependency: [if], data = [none] } bytes[pos++] = (byte) ' '; // depends on control dependency: [if], data = [none] ++i; // depends on control dependency: [if], data = [none] if (i < numChars) { c = s.charAt(i); // depends on control dependency: [if], data = [(i] } } else { if (pos == bytes.length) { bytes = expandBytes(bytes); // depends on control dependency: [if], data = [none] } ++i; // depends on control dependency: [if], data = [none] if(c >> 8 != 0) { bytes[pos++] = (byte) (c >> 8); // depends on control dependency: [if], data = [(c >> 8] if (pos == bytes.length) { bytes = expandBytes(bytes); // depends on control dependency: [if], data = [none] } bytes[pos++] = (byte) c; // depends on control dependency: [if], data = [none] } else { bytes[pos++] = (byte) c; // depends on control dependency: [if], data = [none] if (i < numChars) { c = s.charAt(i); // depends on control dependency: [if], data = [(i] } } } } String decoded = new String(bytes, 0, pos, enc); buffer.append(decoded); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, e); } catch (UnsupportedEncodingException e) { // depends on control dependency: [catch], data = [none] throw UndertowMessages.MESSAGES.failedToDecodeURL(s, enc, e); } // depends on control dependency: [catch], data = [none] needToChange = true; // depends on control dependency: [if], data = [none] break; } else { buffer.append(c); // depends on control dependency: [if], data = [(c] i++; // depends on control dependency: [if], data = [none] } } return (needToChange ? buffer.toString() : s); } }
public class class_name { @Override public EClass getIfcBoundedCurve() { if (ifcBoundedCurveEClass == null) { ifcBoundedCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(53); } return ifcBoundedCurveEClass; } }
public class class_name { @Override public EClass getIfcBoundedCurve() { if (ifcBoundedCurveEClass == null) { ifcBoundedCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(53); // depends on control dependency: [if], data = [none] } return ifcBoundedCurveEClass; } }
public class class_name { public Object execute(final Map<Object, Object> iArgs) { if (clusterName == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseDocumentInternal database = getDatabase(); final int clusterId = database.getClusterIdByName(clusterName); if (clusterId < 0) { throw new ODatabaseException("Cluster with name " + clusterName + " does not exist"); } final OSchema schema = database.getMetadata().getSchema(); final OClass clazz = schema.getClassByClusterId(clusterId); if (clazz == null) { final OStorage storage = database.getStorage(); final OCluster cluster = storage.getClusterById(clusterId); if (cluster == null) { throw new ODatabaseException("Cluster with name " + clusterName + " does not exist"); } try { database.checkForClusterPermissions(cluster.getName()); cluster.truncate(); } catch (IOException ioe) { throw OException.wrapException(new ODatabaseException("Error during truncation of cluster with name " + clusterName), ioe); } } else { clazz.truncateCluster(clusterName); } return true; } }
public class class_name { public Object execute(final Map<Object, Object> iArgs) { if (clusterName == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseDocumentInternal database = getDatabase(); final int clusterId = database.getClusterIdByName(clusterName); if (clusterId < 0) { throw new ODatabaseException("Cluster with name " + clusterName + " does not exist"); } final OSchema schema = database.getMetadata().getSchema(); final OClass clazz = schema.getClassByClusterId(clusterId); if (clazz == null) { final OStorage storage = database.getStorage(); final OCluster cluster = storage.getClusterById(clusterId); if (cluster == null) { throw new ODatabaseException("Cluster with name " + clusterName + " does not exist"); } try { database.checkForClusterPermissions(cluster.getName()); // depends on control dependency: [try], data = [none] cluster.truncate(); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { throw OException.wrapException(new ODatabaseException("Error during truncation of cluster with name " + clusterName), ioe); } // depends on control dependency: [catch], data = [none] } else { clazz.truncateCluster(clusterName); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public synchronized void load() { XmlFile file = getConfigFile(); if(!file.exists()) return; try { file.unmarshal(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } } }
public class class_name { public synchronized void load() { XmlFile file = getConfigFile(); if(!file.exists()) return; try { file.unmarshal(this); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(RemoveTagsRequest removeTagsRequest, ProtocolMarshaller protocolMarshaller) { if (removeTagsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(removeTagsRequest.getResourceId(), RESOURCEID_BINDING); protocolMarshaller.marshall(removeTagsRequest.getTagKeys(), TAGKEYS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RemoveTagsRequest removeTagsRequest, ProtocolMarshaller protocolMarshaller) { if (removeTagsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(removeTagsRequest.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(removeTagsRequest.getTagKeys(), TAGKEYS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static Set<Character> parseCharactersToForbid(String paramValue) { final Set<Character> charactersToForbid = new HashSet<Character>(); if (null == paramValue) { paramValue = DEFAULT_CHARACTERS_BLOCKED; } if ("none".equals(paramValue)) { return charactersToForbid; } final String[] tokens = paramValue.split("\\s+"); if (0 == tokens.length) { FilterUtils.logException(LOGGER, new IllegalArgumentException("Expected tokens when parsing [" + paramValue + "] but found no tokens." + " If you really want to configure no characters, use the magic value 'none'.")); } for (final String token : tokens) { if (token.length() > 1) { FilterUtils.logException(LOGGER, new IllegalArgumentException("Expected tokens of length 1 but found [" + token + "] when " + "parsing [" + paramValue + "]")); } final Character character = token.charAt(0); charactersToForbid.add(character); } return charactersToForbid; } }
public class class_name { static Set<Character> parseCharactersToForbid(String paramValue) { final Set<Character> charactersToForbid = new HashSet<Character>(); if (null == paramValue) { paramValue = DEFAULT_CHARACTERS_BLOCKED; // depends on control dependency: [if], data = [none] } if ("none".equals(paramValue)) { return charactersToForbid; // depends on control dependency: [if], data = [none] } final String[] tokens = paramValue.split("\\s+"); if (0 == tokens.length) { FilterUtils.logException(LOGGER, new IllegalArgumentException("Expected tokens when parsing [" + paramValue + "] but found no tokens." + " If you really want to configure no characters, use the magic value 'none'.")); // depends on control dependency: [if], data = [none] } for (final String token : tokens) { if (token.length() > 1) { FilterUtils.logException(LOGGER, new IllegalArgumentException("Expected tokens of length 1 but found [" + token + "] when " + "parsing [" + paramValue + "]")); // depends on control dependency: [if], data = [none] } final Character character = token.charAt(0); charactersToForbid.add(character); // depends on control dependency: [for], data = [none] } return charactersToForbid; } }
public class class_name { public static String safeToString(Object value) { try { // TODO(b/36844237): Re-evaluate if this is the best place for null handling (null is also // handled for arguments via visitNull() and this is only for literal arguments). return value != null ? toString(value) : "null"; } catch (RuntimeException e) { return getErrorString(value, e); } } }
public class class_name { public static String safeToString(Object value) { try { // TODO(b/36844237): Re-evaluate if this is the best place for null handling (null is also // handled for arguments via visitNull() and this is only for literal arguments). return value != null ? toString(value) : "null"; // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { return getErrorString(value, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public TreeGraphNode highestNodeWithSameHead() { TreeGraphNode node = this; while (true) { TreeGraphNode parent = safeCast(node.parent()); if (parent == null || parent.headWordNode() != node.headWordNode()) { return node; } node = parent; } } }
public class class_name { public TreeGraphNode highestNodeWithSameHead() { TreeGraphNode node = this; while (true) { TreeGraphNode parent = safeCast(node.parent()); if (parent == null || parent.headWordNode() != node.headWordNode()) { return node; // depends on control dependency: [if], data = [none] } node = parent; // depends on control dependency: [while], data = [none] } } }
public class class_name { private static char encodeChar(char c, int offset, boolean isDecodeNumber) { if (isDecodeNumber) { if (c >= CHAR0 && c <= CHAR9) { c -= CHAR0; c = (char) ((c + offset) % 10); c += CHAR0; } } // A == 65, Z == 90 if (c >= ACHAR && c <= ZCHAR) { c -= ACHAR; c = (char) ((c + offset) % 26); c += ACHAR; } // a == 97, z == 122. else if (c >= aCHAR && c <= zCHAR) { c -= aCHAR; c = (char) ((c + offset) % 26); c += aCHAR; } return c; } }
public class class_name { private static char encodeChar(char c, int offset, boolean isDecodeNumber) { if (isDecodeNumber) { if (c >= CHAR0 && c <= CHAR9) { c -= CHAR0; // depends on control dependency: [if], data = [none] c = (char) ((c + offset) % 10); // depends on control dependency: [if], data = [(c] c += CHAR0; // depends on control dependency: [if], data = [none] } } // A == 65, Z == 90 if (c >= ACHAR && c <= ZCHAR) { c -= ACHAR; // depends on control dependency: [if], data = [none] c = (char) ((c + offset) % 26); // depends on control dependency: [if], data = [(c] c += ACHAR; // depends on control dependency: [if], data = [none] } // a == 97, z == 122. else if (c >= aCHAR && c <= zCHAR) { c -= aCHAR; // depends on control dependency: [if], data = [none] c = (char) ((c + offset) % 26); // depends on control dependency: [if], data = [(c] c += aCHAR; // depends on control dependency: [if], data = [none] } return c; } }
public class class_name { private static <T> boolean containsIdentity(List<T> list, T object) { for (T item : list) { if (item == object) { return true; } } return false; } }
public class class_name { private static <T> boolean containsIdentity(List<T> list, T object) { for (T item : list) { if (item == object) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private int getStatement() { checkValue = baseValue; baseValue = DATDictionary.getItem(checkValue).getBase() + charHashCode; if (baseValue < DATDictionary.arrayLength && (DATDictionary.getItem(baseValue).getCheck() == checkValue || DATDictionary.getItem(baseValue).getCheck() == -1)) { return DATDictionary.getItem(baseValue).getStatus(); } return 0; } }
public class class_name { private int getStatement() { checkValue = baseValue; baseValue = DATDictionary.getItem(checkValue).getBase() + charHashCode; if (baseValue < DATDictionary.arrayLength && (DATDictionary.getItem(baseValue).getCheck() == checkValue || DATDictionary.getItem(baseValue).getCheck() == -1)) { return DATDictionary.getItem(baseValue).getStatus(); // depends on control dependency: [if], data = [(baseValue] } return 0; } }
public class class_name { public void setValue(org.openprovenance.prov.model.Value value) { if (value!=null) { this.value = value; getAllAttributes().add((org.openprovenance.prov.model.Attribute)value); //FIXME: should replace previous value! } } }
public class class_name { public void setValue(org.openprovenance.prov.model.Value value) { if (value!=null) { this.value = value; // depends on control dependency: [if], data = [none] getAllAttributes().add((org.openprovenance.prov.model.Attribute)value); //FIXME: should replace previous value! // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setCurrentGroup(int groupId){ if(mCurrentGroup != groupId){ int oldGroupId = mCurrentGroup; mCurrentGroup = groupId; mGroupChanged = true; dispatchOnToolbarGroupChanged(oldGroupId, mCurrentGroup); animateOut(); } } }
public class class_name { public void setCurrentGroup(int groupId){ if(mCurrentGroup != groupId){ int oldGroupId = mCurrentGroup; mCurrentGroup = groupId; // depends on control dependency: [if], data = [none] mGroupChanged = true; // depends on control dependency: [if], data = [none] dispatchOnToolbarGroupChanged(oldGroupId, mCurrentGroup); // depends on control dependency: [if], data = [none] animateOut(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public T get(final T value) { expungeStaleEntries(); // final int index = (value.hashCode() & 0x7FFFFFFF) % elementData.length; Entry<T> m = elementData[index]; while (m != null) { if (eq(value, m.get())) { return m.get(); } m = m.nextInSlot; } return null; } }
public class class_name { public T get(final T value) { expungeStaleEntries(); // final int index = (value.hashCode() & 0x7FFFFFFF) % elementData.length; Entry<T> m = elementData[index]; while (m != null) { if (eq(value, m.get())) { return m.get(); // depends on control dependency: [if], data = [none] } m = m.nextInSlot; // depends on control dependency: [while], data = [none] } return null; } }
public class class_name { public final JavaParser.formalParameter_return formalParameter() throws RecognitionException { JavaParser.formalParameter_return retval = new JavaParser.formalParameter_return(); retval.start = input.LT(1); int formalParameter_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 95) ) { return retval; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:5: ( ( variableModifier )* type variableDeclaratorId ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:7: ( variableModifier )* type variableDeclaratorId { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:7: ( variableModifier )* loop127: while (true) { int alt127=2; int LA127_0 = input.LA(1); if ( (LA127_0==58||LA127_0==83) ) { alt127=1; } switch (alt127) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:7: variableModifier { pushFollow(FOLLOW_variableModifier_in_formalParameter4388); variableModifier(); state._fsp--; if (state.failed) return retval; } break; default : break loop127; } } pushFollow(FOLLOW_type_in_formalParameter4391); type(); state._fsp--; if (state.failed) return retval; pushFollow(FOLLOW_variableDeclaratorId_in_formalParameter4393); variableDeclaratorId(); state._fsp--; if (state.failed) return retval; } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 95, formalParameter_StartIndex); } } return retval; } }
public class class_name { public final JavaParser.formalParameter_return formalParameter() throws RecognitionException { JavaParser.formalParameter_return retval = new JavaParser.formalParameter_return(); retval.start = input.LT(1); int formalParameter_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 95) ) { return retval; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:5: ( ( variableModifier )* type variableDeclaratorId ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:7: ( variableModifier )* type variableDeclaratorId { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:7: ( variableModifier )* loop127: while (true) { int alt127=2; int LA127_0 = input.LA(1); if ( (LA127_0==58||LA127_0==83) ) { alt127=1; // depends on control dependency: [if], data = [none] } switch (alt127) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1019:7: variableModifier { pushFollow(FOLLOW_variableModifier_in_formalParameter4388); variableModifier(); state._fsp--; if (state.failed) return retval; } break; default : break loop127; } } pushFollow(FOLLOW_type_in_formalParameter4391); type(); state._fsp--; if (state.failed) return retval; pushFollow(FOLLOW_variableDeclaratorId_in_formalParameter4393); variableDeclaratorId(); state._fsp--; if (state.failed) return retval; } retval.stop = input.LT(-1); } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 95, formalParameter_StartIndex); } // depends on control dependency: [if], data = [none] } return retval; } }
public class class_name { public final static List<ConnectionNotation> getAllEdgeConnections(List<ConnectionNotation> connections) { List<ConnectionNotation> listEdgeConnection = new ArrayList<ConnectionNotation>(); for (ConnectionNotation connection : connections) { if (!(connection.getrGroupSource().equals("pair"))) { listEdgeConnection.add(connection); } } return listEdgeConnection; } }
public class class_name { public final static List<ConnectionNotation> getAllEdgeConnections(List<ConnectionNotation> connections) { List<ConnectionNotation> listEdgeConnection = new ArrayList<ConnectionNotation>(); for (ConnectionNotation connection : connections) { if (!(connection.getrGroupSource().equals("pair"))) { listEdgeConnection.add(connection); // depends on control dependency: [if], data = [none] } } return listEdgeConnection; } }
public class class_name { public ListGitHubAccountTokenNamesResult withTokenNameList(String... tokenNameList) { if (this.tokenNameList == null) { setTokenNameList(new com.amazonaws.internal.SdkInternalList<String>(tokenNameList.length)); } for (String ele : tokenNameList) { this.tokenNameList.add(ele); } return this; } }
public class class_name { public ListGitHubAccountTokenNamesResult withTokenNameList(String... tokenNameList) { if (this.tokenNameList == null) { setTokenNameList(new com.amazonaws.internal.SdkInternalList<String>(tokenNameList.length)); // depends on control dependency: [if], data = [none] } for (String ele : tokenNameList) { this.tokenNameList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static List<CPDefinitionOptionValueRel> toModels( CPDefinitionOptionValueRelSoap[] soapModels) { if (soapModels == null) { return null; } List<CPDefinitionOptionValueRel> models = new ArrayList<CPDefinitionOptionValueRel>(soapModels.length); for (CPDefinitionOptionValueRelSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } }
public class class_name { public static List<CPDefinitionOptionValueRel> toModels( CPDefinitionOptionValueRelSoap[] soapModels) { if (soapModels == null) { return null; // depends on control dependency: [if], data = [none] } List<CPDefinitionOptionValueRel> models = new ArrayList<CPDefinitionOptionValueRel>(soapModels.length); for (CPDefinitionOptionValueRelSoap soapModel : soapModels) { models.add(toModel(soapModel)); // depends on control dependency: [for], data = [soapModel] } return models; } }
public class class_name { public static void runExample( AdWordsServicesInterface adWordsServices, AdWordsSession session, Long campaignId) throws ApiException, RemoteException { // Get the CustomerExtensionSettingService. CustomerExtensionSettingServiceInterface customerExtensionSettingService = adWordsServices.get(session, CustomerExtensionSettingServiceInterface.class); // Create the price extension feed item. PriceFeedItem priceFeedItem = new PriceFeedItem(); priceFeedItem.setPriceExtensionType(PriceExtensionType.SERVICES); // Price qualifier is optional. priceFeedItem.setPriceQualifier(PriceExtensionPriceQualifier.FROM); priceFeedItem.setTrackingUrlTemplate("http://tracker.example.com/?u={lpurl}"); priceFeedItem.setLanguage("en"); FeedItemCampaignTargeting campaignTargeting = new FeedItemCampaignTargeting(); campaignTargeting.setTargetingCampaignId(campaignId); priceFeedItem.setCampaignTargeting(campaignTargeting); priceFeedItem.setScheduling( new FeedItemScheduling( new FeedItemSchedule[] { new FeedItemSchedule(DayOfWeek.SUNDAY, 10, MinuteOfHour.ZERO, 18, MinuteOfHour.ZERO), new FeedItemSchedule(DayOfWeek.SATURDAY, 10, MinuteOfHour.ZERO, 22, MinuteOfHour.ZERO) })); // To create a price extension, at least three table rows are needed. List<PriceTableRow> priceTableRows = new ArrayList<>(); String currencyCode = "USD"; priceTableRows.add( createPriceTableRow( "Scrubs", "Body Scrub, Salt Scrub", "http://www.example.com/scrubs", "http://m.example.com/scrubs", 60000000, currencyCode, PriceExtensionPriceUnit.PER_HOUR)); priceTableRows.add( createPriceTableRow( "Hair Cuts", "Once a month", "http://www.example.com/haircuts", "http://m.example.com/haircuts", 75000000, currencyCode, PriceExtensionPriceUnit.PER_MONTH)); priceTableRows.add( createPriceTableRow( "Skin Care Package", "Four times a month", "http://www.example.com/skincarepackage", null, 250000000, currencyCode, PriceExtensionPriceUnit.PER_MONTH)); priceFeedItem.setTableRows(priceTableRows.toArray(new PriceTableRow[priceTableRows.size()])); // Create your campaign extension settings. This associates the sitelinks // to your campaign. CustomerExtensionSetting customerExtensionSetting = new CustomerExtensionSetting(); customerExtensionSetting.setExtensionType(FeedType.PRICE); ExtensionSetting extensionSetting = new ExtensionSetting(); extensionSetting.setExtensions(new ExtensionFeedItem[] {priceFeedItem}); customerExtensionSetting.setExtensionSetting(extensionSetting); CustomerExtensionSettingOperation operation = new CustomerExtensionSettingOperation(); operation.setOperand(customerExtensionSetting); operation.setOperator(Operator.ADD); // Add the extensions. CustomerExtensionSettingReturnValue returnValue = customerExtensionSettingService.mutate(new CustomerExtensionSettingOperation[] {operation}); if (returnValue.getValue() != null && returnValue.getValue().length > 0) { CustomerExtensionSetting newExtensionSetting = returnValue.getValue(0); System.out.printf( "Extension setting with type '%s' was added.%n", newExtensionSetting.getExtensionType().getValue()); } else { System.out.println("No extension settings were created."); } } }
public class class_name { public static void runExample( AdWordsServicesInterface adWordsServices, AdWordsSession session, Long campaignId) throws ApiException, RemoteException { // Get the CustomerExtensionSettingService. CustomerExtensionSettingServiceInterface customerExtensionSettingService = adWordsServices.get(session, CustomerExtensionSettingServiceInterface.class); // Create the price extension feed item. PriceFeedItem priceFeedItem = new PriceFeedItem(); priceFeedItem.setPriceExtensionType(PriceExtensionType.SERVICES); // Price qualifier is optional. priceFeedItem.setPriceQualifier(PriceExtensionPriceQualifier.FROM); priceFeedItem.setTrackingUrlTemplate("http://tracker.example.com/?u={lpurl}"); priceFeedItem.setLanguage("en"); FeedItemCampaignTargeting campaignTargeting = new FeedItemCampaignTargeting(); campaignTargeting.setTargetingCampaignId(campaignId); priceFeedItem.setCampaignTargeting(campaignTargeting); priceFeedItem.setScheduling( new FeedItemScheduling( new FeedItemSchedule[] { new FeedItemSchedule(DayOfWeek.SUNDAY, 10, MinuteOfHour.ZERO, 18, MinuteOfHour.ZERO), new FeedItemSchedule(DayOfWeek.SATURDAY, 10, MinuteOfHour.ZERO, 22, MinuteOfHour.ZERO) })); // To create a price extension, at least three table rows are needed. List<PriceTableRow> priceTableRows = new ArrayList<>(); String currencyCode = "USD"; priceTableRows.add( createPriceTableRow( "Scrubs", "Body Scrub, Salt Scrub", "http://www.example.com/scrubs", "http://m.example.com/scrubs", 60000000, currencyCode, PriceExtensionPriceUnit.PER_HOUR)); priceTableRows.add( createPriceTableRow( "Hair Cuts", "Once a month", "http://www.example.com/haircuts", "http://m.example.com/haircuts", 75000000, currencyCode, PriceExtensionPriceUnit.PER_MONTH)); priceTableRows.add( createPriceTableRow( "Skin Care Package", "Four times a month", "http://www.example.com/skincarepackage", null, 250000000, currencyCode, PriceExtensionPriceUnit.PER_MONTH)); priceFeedItem.setTableRows(priceTableRows.toArray(new PriceTableRow[priceTableRows.size()])); // Create your campaign extension settings. This associates the sitelinks // to your campaign. CustomerExtensionSetting customerExtensionSetting = new CustomerExtensionSetting(); customerExtensionSetting.setExtensionType(FeedType.PRICE); ExtensionSetting extensionSetting = new ExtensionSetting(); extensionSetting.setExtensions(new ExtensionFeedItem[] {priceFeedItem}); customerExtensionSetting.setExtensionSetting(extensionSetting); CustomerExtensionSettingOperation operation = new CustomerExtensionSettingOperation(); operation.setOperand(customerExtensionSetting); operation.setOperator(Operator.ADD); // Add the extensions. CustomerExtensionSettingReturnValue returnValue = customerExtensionSettingService.mutate(new CustomerExtensionSettingOperation[] {operation}); if (returnValue.getValue() != null && returnValue.getValue().length > 0) { CustomerExtensionSetting newExtensionSetting = returnValue.getValue(0); System.out.printf( "Extension setting with type '%s' was added.%n", newExtensionSetting.getExtensionType().getValue()); // depends on control dependency: [if], data = [none] } else { System.out.println("No extension settings were created."); // depends on control dependency: [if], data = [none] } } }
public class class_name { private int convertFocusDirectionToLayoutDirection(int focusDirection) { switch (focusDirection) { case View.FOCUS_BACKWARD: return RenderState.LAYOUT_START; case View.FOCUS_FORWARD: return RenderState.LAYOUT_END; case View.FOCUS_UP: return mOrientation == VERTICAL ? RenderState.LAYOUT_START : RenderState.INVALID_LAYOUT; case View.FOCUS_DOWN: return mOrientation == VERTICAL ? RenderState.LAYOUT_END : RenderState.INVALID_LAYOUT; case View.FOCUS_LEFT: return mOrientation == HORIZONTAL ? RenderState.LAYOUT_START : RenderState.INVALID_LAYOUT; case View.FOCUS_RIGHT: return mOrientation == HORIZONTAL ? RenderState.LAYOUT_END : RenderState.INVALID_LAYOUT; default: if (DEBUG) { Log.d(TAG, "Unknown focus request:" + focusDirection); } return RenderState.INVALID_LAYOUT; } } }
public class class_name { private int convertFocusDirectionToLayoutDirection(int focusDirection) { switch (focusDirection) { case View.FOCUS_BACKWARD: return RenderState.LAYOUT_START; case View.FOCUS_FORWARD: return RenderState.LAYOUT_END; case View.FOCUS_UP: return mOrientation == VERTICAL ? RenderState.LAYOUT_START : RenderState.INVALID_LAYOUT; case View.FOCUS_DOWN: return mOrientation == VERTICAL ? RenderState.LAYOUT_END : RenderState.INVALID_LAYOUT; case View.FOCUS_LEFT: return mOrientation == HORIZONTAL ? RenderState.LAYOUT_START : RenderState.INVALID_LAYOUT; case View.FOCUS_RIGHT: return mOrientation == HORIZONTAL ? RenderState.LAYOUT_END : RenderState.INVALID_LAYOUT; default: if (DEBUG) { Log.d(TAG, "Unknown focus request:" + focusDirection); // depends on control dependency: [if], data = [none] } return RenderState.INVALID_LAYOUT; } } }
public class class_name { @Override public Model read(Configuration config) { String name = config.getName(); Descriptor desc = getDescriptor(); if (CHANNELS.equals(name)) { return new V1ChannelsModel(config, desc); } else if (CHANNEL.equals(name)) { return new V1ChannelModel(config, desc); } else if (LISTENERS.equals(name)) { return new V1ListenersModel(config, desc); } else if (LISTENER.equals(name)) { return new V1ListenerModel(config, desc); } else if (LOGGERS.equals(name)) { return new V1LoggersModel(config, desc); } else if (LOGGER.equals(name)) { return new V1LoggerModel(config, desc); } else if (MANIFEST.equals(name)) { return new V1ManifestModel(config, desc); } else if (CONTAINER.equals(name)) { return new V1ContainerModel(config, desc); } else if (RESOURCES.equals(name)) { return new V1ResourcesModel(config, desc); } else if (RESOURCE.equals(name)) { return new V1ResourceModel(config, desc); } else if (RESOURCE_DETAIL.equals(name)) { return new V1ResourceDetailModel(config, desc); } else if (OPERATIONS.equals(name)) { return new V1OperationsModel(config, desc); } else if (GLOBALS.equals(name)) { return new V1GlobalsModel(config, desc); } else if (GLOBAL.equals(name)) { return new V1GlobalModel(config, desc); } else if (INPUTS.equals(name)) { return new V1InputsModel(config, desc); } else if (INPUT.equals(name)) { return new V1InputModel(config, desc); } else if (OUTPUTS.equals(name)) { return new V1OutputsModel(config, desc); } else if (OUTPUT.equals(name)) { return new V1OutputModel(config, desc); } else if (FAULTS.equals(name)) { return new V1FaultsModel(config, desc); } else if (FAULT.equals(name)) { return new V1FaultModel(config, desc); } else if (PROPERTIES.equals(name)) { return new V1PropertiesModel(config, desc); } else if (PROPERTY.equals(name)) { return new V1PropertyModel(config, desc); } else if (USER_GROUP_CALLBACK.equals(name)) { return new V1UserGroupCallbackModel(config, desc); } else if (WORK_ITEM_HANDLERS.equals(name)) { return new V1WorkItemHandlersModel(config, desc); } else if (WORK_ITEM_HANDLER.equals(name)) { return new V1WorkItemHandlerModel(config, desc); } return super.read(config); } }
public class class_name { @Override public Model read(Configuration config) { String name = config.getName(); Descriptor desc = getDescriptor(); if (CHANNELS.equals(name)) { return new V1ChannelsModel(config, desc); // depends on control dependency: [if], data = [none] } else if (CHANNEL.equals(name)) { return new V1ChannelModel(config, desc); // depends on control dependency: [if], data = [none] } else if (LISTENERS.equals(name)) { return new V1ListenersModel(config, desc); // depends on control dependency: [if], data = [none] } else if (LISTENER.equals(name)) { return new V1ListenerModel(config, desc); // depends on control dependency: [if], data = [none] } else if (LOGGERS.equals(name)) { return new V1LoggersModel(config, desc); // depends on control dependency: [if], data = [none] } else if (LOGGER.equals(name)) { return new V1LoggerModel(config, desc); // depends on control dependency: [if], data = [none] } else if (MANIFEST.equals(name)) { return new V1ManifestModel(config, desc); // depends on control dependency: [if], data = [none] } else if (CONTAINER.equals(name)) { return new V1ContainerModel(config, desc); // depends on control dependency: [if], data = [none] } else if (RESOURCES.equals(name)) { return new V1ResourcesModel(config, desc); // depends on control dependency: [if], data = [none] } else if (RESOURCE.equals(name)) { return new V1ResourceModel(config, desc); // depends on control dependency: [if], data = [none] } else if (RESOURCE_DETAIL.equals(name)) { return new V1ResourceDetailModel(config, desc); // depends on control dependency: [if], data = [none] } else if (OPERATIONS.equals(name)) { return new V1OperationsModel(config, desc); // depends on control dependency: [if], data = [none] } else if (GLOBALS.equals(name)) { return new V1GlobalsModel(config, desc); // depends on control dependency: [if], data = [none] } else if (GLOBAL.equals(name)) { return new V1GlobalModel(config, desc); // depends on control dependency: [if], data = [none] } else if (INPUTS.equals(name)) { return new V1InputsModel(config, desc); // depends on control dependency: [if], data = [none] } else if (INPUT.equals(name)) { return new V1InputModel(config, desc); // depends on control dependency: [if], data = [none] } else if (OUTPUTS.equals(name)) { return new V1OutputsModel(config, desc); // depends on control dependency: [if], data = [none] } else if (OUTPUT.equals(name)) { return new V1OutputModel(config, desc); // depends on control dependency: [if], data = [none] } else if (FAULTS.equals(name)) { return new V1FaultsModel(config, desc); // depends on control dependency: [if], data = [none] } else if (FAULT.equals(name)) { return new V1FaultModel(config, desc); // depends on control dependency: [if], data = [none] } else if (PROPERTIES.equals(name)) { return new V1PropertiesModel(config, desc); // depends on control dependency: [if], data = [none] } else if (PROPERTY.equals(name)) { return new V1PropertyModel(config, desc); // depends on control dependency: [if], data = [none] } else if (USER_GROUP_CALLBACK.equals(name)) { return new V1UserGroupCallbackModel(config, desc); // depends on control dependency: [if], data = [none] } else if (WORK_ITEM_HANDLERS.equals(name)) { return new V1WorkItemHandlersModel(config, desc); // depends on control dependency: [if], data = [none] } else if (WORK_ITEM_HANDLER.equals(name)) { return new V1WorkItemHandlerModel(config, desc); // depends on control dependency: [if], data = [none] } return super.read(config); } }
public class class_name { protected void eol(byte[] in, int sz) throws IOException { int next = ConsoleNote.findPreamble(in,0,sz); // perform byte[]->char[] while figuring out the char positions of the BLOBs int written = 0; while (next>=0) { if (next>written) { out.write(in,written,next-written); written = next; } else { assert next==written; } int rest = sz - next; ByteArrayInputStream b = new ByteArrayInputStream(in, next, rest); ConsoleNote.skip(new DataInputStream(b)); int bytesUsed = rest - b.available(); // bytes consumed by annotations written += bytesUsed; next = ConsoleNote.findPreamble(in,written,sz-written); } // finish the remaining bytes->chars conversion out.write(in,written,sz-written); } }
public class class_name { protected void eol(byte[] in, int sz) throws IOException { int next = ConsoleNote.findPreamble(in,0,sz); // perform byte[]->char[] while figuring out the char positions of the BLOBs int written = 0; while (next>=0) { if (next>written) { out.write(in,written,next-written); // depends on control dependency: [if], data = [written)] written = next; // depends on control dependency: [if], data = [none] } else { assert next==written; } int rest = sz - next; ByteArrayInputStream b = new ByteArrayInputStream(in, next, rest); ConsoleNote.skip(new DataInputStream(b)); int bytesUsed = rest - b.available(); // bytes consumed by annotations written += bytesUsed; next = ConsoleNote.findPreamble(in,written,sz-written); } // finish the remaining bytes->chars conversion out.write(in,written,sz-written); } }
public class class_name { public void checkBrowserType(final HttpServletRequest request) { String reqpar = request.getParameter(getBrowserTypeRequestName()); if (reqpar != null) { if (reqpar.equals("!")) { // Go back to unsticky browser type setBrowserTypeSticky(false); } else { setBrowserType(reqpar); setBrowserTypeSticky(false); } } reqpar = request.getParameter(getBrowserTypeStickyRequestName()); if (reqpar != null) { if (reqpar.equals("!")) { // Go back to unsticky browser type setBrowserTypeSticky(false); } else { setBrowserType(reqpar); setBrowserTypeSticky(true); } } } }
public class class_name { public void checkBrowserType(final HttpServletRequest request) { String reqpar = request.getParameter(getBrowserTypeRequestName()); if (reqpar != null) { if (reqpar.equals("!")) { // Go back to unsticky browser type setBrowserTypeSticky(false); // depends on control dependency: [if], data = [none] } else { setBrowserType(reqpar); // depends on control dependency: [if], data = [none] setBrowserTypeSticky(false); // depends on control dependency: [if], data = [none] } } reqpar = request.getParameter(getBrowserTypeStickyRequestName()); if (reqpar != null) { if (reqpar.equals("!")) { // Go back to unsticky browser type setBrowserTypeSticky(false); // depends on control dependency: [if], data = [none] } else { setBrowserType(reqpar); // depends on control dependency: [if], data = [none] setBrowserTypeSticky(true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void dropIndex(final String indexName) { makeActive(); executeOutsideTx(new OCallable<Object, OrientBaseGraph>() { @Override public Object call(OrientBaseGraph g) { try { final OIndexManager indexManager = getRawGraph().getMetadata().getIndexManager(); final OIndex index = indexManager.getIndex(indexName); ODocument metadata = index.getConfiguration().field("metadata"); String recordMapIndexName = null; if (metadata != null) { recordMapIndexName = metadata.field(OrientIndex.CONFIG_RECORD_MAP_NAME); } indexManager.dropIndex(indexName); if (recordMapIndexName != null) getRawGraph().getMetadata().getIndexManager().dropIndex(recordMapIndexName); saveIndexConfiguration(); return null; } catch (Exception e) { g.rollback(); throw new RuntimeException(e.getMessage(), e); } } }, "drop index '", indexName, "'"); } }
public class class_name { public void dropIndex(final String indexName) { makeActive(); executeOutsideTx(new OCallable<Object, OrientBaseGraph>() { @Override public Object call(OrientBaseGraph g) { try { final OIndexManager indexManager = getRawGraph().getMetadata().getIndexManager(); final OIndex index = indexManager.getIndex(indexName); ODocument metadata = index.getConfiguration().field("metadata"); String recordMapIndexName = null; if (metadata != null) { recordMapIndexName = metadata.field(OrientIndex.CONFIG_RECORD_MAP_NAME); // depends on control dependency: [if], data = [none] } indexManager.dropIndex(indexName); // depends on control dependency: [try], data = [none] if (recordMapIndexName != null) getRawGraph().getMetadata().getIndexManager().dropIndex(recordMapIndexName); saveIndexConfiguration(); // depends on control dependency: [try], data = [none] return null; // depends on control dependency: [try], data = [none] } catch (Exception e) { g.rollback(); throw new RuntimeException(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }, "drop index '", indexName, "'"); } }
public class class_name { @Override public void notifyHandlableAdded(Featurable featurable) { if (featurable.hasFeature(Displayable.class)) { final Displayable displayable = featurable.getFeature(Displayable.class); final Integer layer = getLayer(featurable); final Collection<Displayable> displayables = getLayer(layer); displayables.add(displayable); indexs.add(layer); } } }
public class class_name { @Override public void notifyHandlableAdded(Featurable featurable) { if (featurable.hasFeature(Displayable.class)) { final Displayable displayable = featurable.getFeature(Displayable.class); final Integer layer = getLayer(featurable); final Collection<Displayable> displayables = getLayer(layer); displayables.add(displayable); // depends on control dependency: [if], data = [none] indexs.add(layer); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int readRawUntil (final StringBuilder out, final String in, final int start, final char end) { int pos = start; while (pos < in.length ()) { final char ch = in.charAt (pos); if (ch == end) break; out.append (ch); pos++; } return (pos == in.length ()) ? -1 : pos; } }
public class class_name { public static int readRawUntil (final StringBuilder out, final String in, final int start, final char end) { int pos = start; while (pos < in.length ()) { final char ch = in.charAt (pos); if (ch == end) break; out.append (ch); // depends on control dependency: [while], data = [none] pos++; // depends on control dependency: [while], data = [none] } return (pos == in.length ()) ? -1 : pos; } }
public class class_name { void startBlockImpl( String[] selectors ) { for( int i=0; i<selectors.length; i++ ) { if( i > 0 ) { output.append( ',' ); newline(); } insets(); append( selectors[i] ); } space(); output.append( '{' ); newline(); incInsets(); } }
public class class_name { void startBlockImpl( String[] selectors ) { for( int i=0; i<selectors.length; i++ ) { if( i > 0 ) { output.append( ',' ); // depends on control dependency: [if], data = [none] newline(); // depends on control dependency: [if], data = [none] } insets(); // depends on control dependency: [for], data = [none] append( selectors[i] ); // depends on control dependency: [for], data = [i] } space(); output.append( '{' ); newline(); incInsets(); } }
public class class_name { public void setName(final String repoName) { if (name == null) { name = repoName; } else if (!name.equals(repoName)) { throw new IllegalStateException( "Repository [" + name + "] cannot be renamed as [" + repoName + "]."); } } }
public class class_name { public void setName(final String repoName) { if (name == null) { name = repoName; // depends on control dependency: [if], data = [none] } else if (!name.equals(repoName)) { throw new IllegalStateException( "Repository [" + name + "] cannot be renamed as [" + repoName + "]."); } } }
public class class_name { private TableDescriptor getTableDescriptor(Table table, SchemaDescriptor schemaDescriptor, Store store) { TableDescriptor tableDescriptor; if (table instanceof View) { View view = (View) table; ViewDescriptor viewDescriptor = store.create(ViewDescriptor.class); viewDescriptor.setUpdatable(view.isUpdatable()); CheckOptionType checkOption = view.getCheckOption(); if (checkOption != null) { viewDescriptor.setCheckOption(checkOption.name()); } schemaDescriptor.getViews().add(viewDescriptor); tableDescriptor = viewDescriptor; } else { tableDescriptor = store.create(TableDescriptor.class); schemaDescriptor.getTables().add(tableDescriptor); } tableDescriptor.setName(table.getName()); return tableDescriptor; } }
public class class_name { private TableDescriptor getTableDescriptor(Table table, SchemaDescriptor schemaDescriptor, Store store) { TableDescriptor tableDescriptor; if (table instanceof View) { View view = (View) table; ViewDescriptor viewDescriptor = store.create(ViewDescriptor.class); viewDescriptor.setUpdatable(view.isUpdatable()); // depends on control dependency: [if], data = [none] CheckOptionType checkOption = view.getCheckOption(); if (checkOption != null) { viewDescriptor.setCheckOption(checkOption.name()); // depends on control dependency: [if], data = [(checkOption] } schemaDescriptor.getViews().add(viewDescriptor); // depends on control dependency: [if], data = [none] tableDescriptor = viewDescriptor; // depends on control dependency: [if], data = [none] } else { tableDescriptor = store.create(TableDescriptor.class); // depends on control dependency: [if], data = [none] schemaDescriptor.getTables().add(tableDescriptor); // depends on control dependency: [if], data = [none] } tableDescriptor.setName(table.getName()); return tableDescriptor; } }
public class class_name { public String toIntegerRationalString() { BigDecimal fractionNumerator = numerator.remainder(denominator); BigDecimal integerNumerator = numerator.subtract(fractionNumerator); BigDecimal integerPart = integerNumerator.divide(denominator); StringBuilder result = new StringBuilder(); if (integerPart.signum() != 0) { result.append(integerPart); } if (fractionNumerator.signum() != 0) { if (result.length() > 0) { result.append(' '); } result.append(fractionNumerator.abs()); result.append('/'); result.append(denominator); } if (result.length() == 0) { result.append('0'); } return result.toString(); } }
public class class_name { public String toIntegerRationalString() { BigDecimal fractionNumerator = numerator.remainder(denominator); BigDecimal integerNumerator = numerator.subtract(fractionNumerator); BigDecimal integerPart = integerNumerator.divide(denominator); StringBuilder result = new StringBuilder(); if (integerPart.signum() != 0) { result.append(integerPart); // depends on control dependency: [if], data = [none] } if (fractionNumerator.signum() != 0) { if (result.length() > 0) { result.append(' '); // depends on control dependency: [if], data = [none] } result.append(fractionNumerator.abs()); // depends on control dependency: [if], data = [none] result.append('/'); // depends on control dependency: [if], data = [none] result.append(denominator); // depends on control dependency: [if], data = [none] } if (result.length() == 0) { result.append('0'); // depends on control dependency: [if], data = [none] } return result.toString(); } }
public class class_name { public void marshall(DeleteEventSubscriptionRequest deleteEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteEventSubscriptionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteEventSubscriptionRequest deleteEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteEventSubscriptionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean isGroupGuests(String groupName) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(groupName)) { return false; } return m_groupGuests.equals(groupName) || groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + m_groupGuests); } }
public class class_name { public boolean isGroupGuests(String groupName) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(groupName)) { return false; // depends on control dependency: [if], data = [none] } return m_groupGuests.equals(groupName) || groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + m_groupGuests); } }
public class class_name { public Query withParams(Collection<Object> paramValues) { if (null == paramValues) { return this; } int i = 0; for (Object paramValue : paramValues) { paramIndexValues.put(++i, this.converterValue(paramValue)); } return this; } }
public class class_name { public Query withParams(Collection<Object> paramValues) { if (null == paramValues) { return this; // depends on control dependency: [if], data = [none] } int i = 0; for (Object paramValue : paramValues) { paramIndexValues.put(++i, this.converterValue(paramValue)); // depends on control dependency: [for], data = [paramValue] } return this; } }
public class class_name { public double[] solveInplace(double[] b) { if(b.length != m) { throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS); } if(!this.isNonsingular()) { throw new ArithmeticException(ERR_SINGULAR); } // Solve L*Y = B(piv,:) for(int k = 0; k < n; k++) { for(int i = k + 1; i < n; i++) { b[i] -= b[k] * LU[i][k]; } } // Solve U*X = Y; for(int k = n - 1; k >= 0; k--) { b[k] /= LU[k][k]; for(int i = 0; i < k; i++) { b[i] -= b[k] * LU[i][k]; } } return b; } }
public class class_name { public double[] solveInplace(double[] b) { if(b.length != m) { throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS); } if(!this.isNonsingular()) { throw new ArithmeticException(ERR_SINGULAR); } // Solve L*Y = B(piv,:) for(int k = 0; k < n; k++) { for(int i = k + 1; i < n; i++) { b[i] -= b[k] * LU[i][k]; // depends on control dependency: [for], data = [i] } } // Solve U*X = Y; for(int k = n - 1; k >= 0; k--) { b[k] /= LU[k][k]; // depends on control dependency: [for], data = [k] for(int i = 0; i < k; i++) { b[i] -= b[k] * LU[i][k]; // depends on control dependency: [for], data = [i] } } return b; } }
public class class_name { public static byte[] vleEncodeLong(final long value) { if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) { return new byte[] { (byte) value }; } else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) { return Bytes.fromShort((short) value); } else if (Integer.MIN_VALUE <= value && value <= Integer.MAX_VALUE) { return Bytes.fromInt((int) value); } else { return Bytes.fromLong(value); } } }
public class class_name { public static byte[] vleEncodeLong(final long value) { if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) { return new byte[] { (byte) value }; // depends on control dependency: [if], data = [none] } else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) { return Bytes.fromShort((short) value); // depends on control dependency: [if], data = [none] } else if (Integer.MIN_VALUE <= value && value <= Integer.MAX_VALUE) { return Bytes.fromInt((int) value); // depends on control dependency: [if], data = [none] } else { return Bytes.fromLong(value); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Observable<ServiceResponse<ExplicitListItem>> getExplicitListItemWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, long itemId) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.getExplicitListItem(appId, versionId, entityId, itemId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ExplicitListItem>>>() { @Override public Observable<ServiceResponse<ExplicitListItem>> call(Response<ResponseBody> response) { try { ServiceResponse<ExplicitListItem> clientResponse = getExplicitListItemDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ExplicitListItem>> getExplicitListItemWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, long itemId) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (entityId == null) { throw new IllegalArgumentException("Parameter entityId is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.getExplicitListItem(appId, versionId, entityId, itemId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ExplicitListItem>>>() { @Override public Observable<ServiceResponse<ExplicitListItem>> call(Response<ResponseBody> response) { try { ServiceResponse<ExplicitListItem> clientResponse = getExplicitListItemDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static <L extends Listener, E extends Event<?, L>> boolean checkPrevent( EventStack eventStack, E event, BiConsumer<L, E> bc, ExceptionCallback ec) { // check if any of the currently dispatched events marked the target // listener class to be prevented. final Optional<SequentialEvent<?, ?>> cause = eventStack.preventDispatch( event.getListenerClass()); if (cause.isPresent()) { event.setPrevented(true); cause.get().addSuppressedEvent( new SuppressedEventImpl<L, E>(event, ec, bc)); return true; } return false; } }
public class class_name { public static <L extends Listener, E extends Event<?, L>> boolean checkPrevent( EventStack eventStack, E event, BiConsumer<L, E> bc, ExceptionCallback ec) { // check if any of the currently dispatched events marked the target // listener class to be prevented. final Optional<SequentialEvent<?, ?>> cause = eventStack.preventDispatch( event.getListenerClass()); if (cause.isPresent()) { event.setPrevented(true); // depends on control dependency: [if], data = [none] cause.get().addSuppressedEvent( new SuppressedEventImpl<L, E>(event, ec, bc)); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private List<DelayedEntry> callHandler(Collection<DelayedEntry> delayedEntries, StoreOperationType operationType) { final int size = delayedEntries.size(); if (size == 0) { return Collections.emptyList(); } // if we want to write all store operations on a key into the MapStore, not same as write-coalescing, we don't call // batch processing methods e.g., MapStore{#storeAll,#deleteAll}, instead we call methods which process single entries // e.g. MapStore{#store,#delete}. This is because MapStore#storeAll requires a Map type in its signature and Map type // can only contain one store operation type per key, so only last update on a key can be included when batching. // Due to that limitation it is not possible to provide a correct no-write-coalescing write-behind behavior. // Under that limitation of current MapStore interface, we are making a workaround and persisting all // entries one by one for no-write-coalescing write-behind map-stores and as a result not doing batching // when writeCoalescing is false. if (size == 1 || !writeCoalescing) { return processEntriesOneByOne(delayedEntries, operationType); } final DelayedEntry[] delayedEntriesArray = delayedEntries.toArray(new DelayedEntry[0]); final Map<Object, DelayedEntry> batchMap = prepareBatchMap(delayedEntriesArray); // if all batch is on same key, call single store. if (batchMap.size() == 1) { final DelayedEntry delayedEntry = delayedEntriesArray[delayedEntriesArray.length - 1]; return callSingleStoreWithListeners(delayedEntry, operationType); } final List<DelayedEntry> failedEntryList = callBatchStoreWithListeners(batchMap, operationType); final List<DelayedEntry> failedTries = new ArrayList<>(); for (DelayedEntry entry : failedEntryList) { final Collection<DelayedEntry> tmpFails = callSingleStoreWithListeners(entry, operationType); failedTries.addAll(tmpFails); } return failedTries; } }
public class class_name { private List<DelayedEntry> callHandler(Collection<DelayedEntry> delayedEntries, StoreOperationType operationType) { final int size = delayedEntries.size(); if (size == 0) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } // if we want to write all store operations on a key into the MapStore, not same as write-coalescing, we don't call // batch processing methods e.g., MapStore{#storeAll,#deleteAll}, instead we call methods which process single entries // e.g. MapStore{#store,#delete}. This is because MapStore#storeAll requires a Map type in its signature and Map type // can only contain one store operation type per key, so only last update on a key can be included when batching. // Due to that limitation it is not possible to provide a correct no-write-coalescing write-behind behavior. // Under that limitation of current MapStore interface, we are making a workaround and persisting all // entries one by one for no-write-coalescing write-behind map-stores and as a result not doing batching // when writeCoalescing is false. if (size == 1 || !writeCoalescing) { return processEntriesOneByOne(delayedEntries, operationType); // depends on control dependency: [if], data = [none] } final DelayedEntry[] delayedEntriesArray = delayedEntries.toArray(new DelayedEntry[0]); final Map<Object, DelayedEntry> batchMap = prepareBatchMap(delayedEntriesArray); // if all batch is on same key, call single store. if (batchMap.size() == 1) { final DelayedEntry delayedEntry = delayedEntriesArray[delayedEntriesArray.length - 1]; return callSingleStoreWithListeners(delayedEntry, operationType); // depends on control dependency: [if], data = [none] } final List<DelayedEntry> failedEntryList = callBatchStoreWithListeners(batchMap, operationType); final List<DelayedEntry> failedTries = new ArrayList<>(); for (DelayedEntry entry : failedEntryList) { final Collection<DelayedEntry> tmpFails = callSingleStoreWithListeners(entry, operationType); failedTries.addAll(tmpFails); // depends on control dependency: [for], data = [none] } return failedTries; } }
public class class_name { public static Set<Locale> getLocalizationProblemLocales( Class<?> i18nClass ) { CheckArg.isNotNull(i18nClass, "i18nClass"); Set<Locale> locales = new HashSet<Locale>(LOCALE_TO_CLASS_TO_PROBLEMS_MAP.size()); for (Entry<Locale, Map<Class<?>, Set<String>>> localeEntry : LOCALE_TO_CLASS_TO_PROBLEMS_MAP.entrySet()) { for (Entry<Class<?>, Set<String>> classEntry : localeEntry.getValue().entrySet()) { if (!classEntry.getValue().isEmpty()) { locales.add(localeEntry.getKey()); break; } } } return locales; } }
public class class_name { public static Set<Locale> getLocalizationProblemLocales( Class<?> i18nClass ) { CheckArg.isNotNull(i18nClass, "i18nClass"); Set<Locale> locales = new HashSet<Locale>(LOCALE_TO_CLASS_TO_PROBLEMS_MAP.size()); for (Entry<Locale, Map<Class<?>, Set<String>>> localeEntry : LOCALE_TO_CLASS_TO_PROBLEMS_MAP.entrySet()) { for (Entry<Class<?>, Set<String>> classEntry : localeEntry.getValue().entrySet()) { if (!classEntry.getValue().isEmpty()) { locales.add(localeEntry.getKey()); // depends on control dependency: [if], data = [none] break; } } } return locales; } }
public class class_name { @Override public EClass getIfcTrimmedCurve() { if (ifcTrimmedCurveEClass == null) { ifcTrimmedCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(734); } return ifcTrimmedCurveEClass; } }
public class class_name { @Override public EClass getIfcTrimmedCurve() { if (ifcTrimmedCurveEClass == null) { ifcTrimmedCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(734); // depends on control dependency: [if], data = [none] } return ifcTrimmedCurveEClass; } }
public class class_name { protected void justAdd(final String key, final String value, final ArrayList<String> keyProfiles, final Operator operator) { if (operator == Operator.COPY) { HashMap<String,Object> target = new HashMap<>(); String[] profiles = null; if (keyProfiles != null) { profiles = keyProfiles.toArray(new String[0]); } String[] sources = StringUtil.splitc(value, ','); for (String source : sources) { source = source.trim(); // try to extract profile for parsing String[] lookupProfiles = profiles; String lookupProfilesString = null; int leftIndex = source.indexOf('<'); if (leftIndex != -1) { int rightIndex = source.indexOf('>'); lookupProfilesString = source.substring(leftIndex + 1, rightIndex); source = source.substring(0, leftIndex).concat(source.substring(rightIndex + 1)); lookupProfiles = StringUtil.splitc(lookupProfilesString, ','); StringUtil.trimAll(lookupProfiles); } String[] wildcards = new String[] {source + ".*"}; propsData.extract(target, lookupProfiles, wildcards, null); for (Map.Entry<String, Object> entry : target.entrySet()) { String entryKey = entry.getKey(); String suffix = entryKey.substring(source.length()); String newKey = key + suffix; String newValue = "${" + entryKey; if (lookupProfilesString != null) { newValue += "<" + lookupProfilesString + ">"; } newValue += "}"; if (profiles == null) { propsData.putBaseProperty(newKey, newValue, false); } else { for (final String p : profiles) { propsData.putProfileProperty(newKey, newValue, p, false); } } } } return; } boolean append = operator == Operator.QUICK_APPEND; if (keyProfiles == null) { propsData.putBaseProperty(key, value, append); return; } for (final String p : keyProfiles) { propsData.putProfileProperty(key, value, p, append); } } }
public class class_name { protected void justAdd(final String key, final String value, final ArrayList<String> keyProfiles, final Operator operator) { if (operator == Operator.COPY) { HashMap<String,Object> target = new HashMap<>(); String[] profiles = null; if (keyProfiles != null) { profiles = keyProfiles.toArray(new String[0]); // depends on control dependency: [if], data = [none] } String[] sources = StringUtil.splitc(value, ','); for (String source : sources) { source = source.trim(); // depends on control dependency: [for], data = [source] // try to extract profile for parsing String[] lookupProfiles = profiles; String lookupProfilesString = null; int leftIndex = source.indexOf('<'); if (leftIndex != -1) { int rightIndex = source.indexOf('>'); lookupProfilesString = source.substring(leftIndex + 1, rightIndex); // depends on control dependency: [if], data = [(leftIndex] source = source.substring(0, leftIndex).concat(source.substring(rightIndex + 1)); // depends on control dependency: [if], data = [none] lookupProfiles = StringUtil.splitc(lookupProfilesString, ','); // depends on control dependency: [if], data = [none] StringUtil.trimAll(lookupProfiles); // depends on control dependency: [if], data = [none] } String[] wildcards = new String[] {source + ".*"}; propsData.extract(target, lookupProfiles, wildcards, null); // depends on control dependency: [for], data = [none] for (Map.Entry<String, Object> entry : target.entrySet()) { String entryKey = entry.getKey(); String suffix = entryKey.substring(source.length()); String newKey = key + suffix; String newValue = "${" + entryKey; if (lookupProfilesString != null) { newValue += "<" + lookupProfilesString + ">"; // depends on control dependency: [if], data = [none] } newValue += "}"; // depends on control dependency: [for], data = [none] if (profiles == null) { propsData.putBaseProperty(newKey, newValue, false); // depends on control dependency: [if], data = [none] } else { for (final String p : profiles) { propsData.putProfileProperty(newKey, newValue, p, false); // depends on control dependency: [for], data = [p] } } } } return; // depends on control dependency: [if], data = [none] } boolean append = operator == Operator.QUICK_APPEND; if (keyProfiles == null) { propsData.putBaseProperty(key, value, append); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } for (final String p : keyProfiles) { propsData.putProfileProperty(key, value, p, append); // depends on control dependency: [for], data = [p] } } }
public class class_name { public static boolean getAsynchronousMethods(Method[] beanMethods, boolean[] asynchMethodFlags, MethodInterface methodInterface) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getAsynchronousMethods"); Asynchronous asynchAnnotation = null; boolean asynchMethodFound = false; if (methodInterface != MethodInterface.SERVICE_ENDPOINT) { //d599046 for (int i = 0; i < beanMethods.length; i++) { // Check to make sure this beanMethod is not null because it can be if the method // was a remove method. Remove methods get special handling. if (beanMethods[i] != null) { // Only get the value from annotations if it is not already set by WCCM. There is no way to // turn off the asynchronous setting using annotations or xml (ie. it can only be turned on). if (asynchMethodFlags[i] == false) { asynchAnnotation = null; // Try to get method level annotation asynchAnnotation = beanMethods[i].getAnnotation(Asynchronous.class); if (asynchAnnotation == null) { // Method level annotation not found so check for class level annotation asynchAnnotation = beanMethods[i].getDeclaringClass().getAnnotation(Asynchronous.class); if (isTraceOn && tc.isDebugEnabled() && asynchAnnotation != null) { // Class level @Asynchronous annotation found Tr.debug(tc, "The " + beanMethods[i].getName() + " method on the " + beanMethods[i].getDeclaringClass().getName() + " bean is configured asynchronous at the class level"); } } else { // Method level @Asynchronous annotation found if (isTraceOn && tc.isDebugEnabled()) { Tr.debug(tc, "The " + beanMethods[i].getName() + " method on the " + beanMethods[i].getDeclaringClass().getName() + " bean is configured asynchronous at the method level"); } } // Update array of asynch methods with true or false for the current method if (asynchAnnotation != null) { asynchMethodFlags[i] = true; asynchMethodFound = true; } else { asynchMethodFlags[i] = false; } } // no annotation at method level } else { // bean method is null so set asynch method array entry to false (ie. the default value) // F743-4582 Update - do not set this to false, as it would overwrite the value from WCCM //asynchMethodFlags[i] = false; } } // for all bean methods } // end if (methodInterface != MethodInterface.SERVICE_ENDPOINT) if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(tc, "getAsynchonousMethods"); } return (asynchMethodFound); } }
public class class_name { public static boolean getAsynchronousMethods(Method[] beanMethods, boolean[] asynchMethodFlags, MethodInterface methodInterface) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getAsynchronousMethods"); Asynchronous asynchAnnotation = null; boolean asynchMethodFound = false; if (methodInterface != MethodInterface.SERVICE_ENDPOINT) { //d599046 for (int i = 0; i < beanMethods.length; i++) { // Check to make sure this beanMethod is not null because it can be if the method // was a remove method. Remove methods get special handling. if (beanMethods[i] != null) { // Only get the value from annotations if it is not already set by WCCM. There is no way to // turn off the asynchronous setting using annotations or xml (ie. it can only be turned on). if (asynchMethodFlags[i] == false) { asynchAnnotation = null; // depends on control dependency: [if], data = [none] // Try to get method level annotation asynchAnnotation = beanMethods[i].getAnnotation(Asynchronous.class); // depends on control dependency: [if], data = [none] if (asynchAnnotation == null) { // Method level annotation not found so check for class level annotation asynchAnnotation = beanMethods[i].getDeclaringClass().getAnnotation(Asynchronous.class); // depends on control dependency: [if], data = [none] if (isTraceOn && tc.isDebugEnabled() && asynchAnnotation != null) { // Class level @Asynchronous annotation found Tr.debug(tc, "The " + beanMethods[i].getName() + " method on the " + beanMethods[i].getDeclaringClass().getName() + " bean is configured asynchronous at the class level"); // depends on control dependency: [if], data = [none] } } else { // Method level @Asynchronous annotation found if (isTraceOn && tc.isDebugEnabled()) { Tr.debug(tc, "The " + beanMethods[i].getName() + " method on the " + beanMethods[i].getDeclaringClass().getName() + " bean is configured asynchronous at the method level"); // depends on control dependency: [if], data = [none] } } // Update array of asynch methods with true or false for the current method if (asynchAnnotation != null) { asynchMethodFlags[i] = true; // depends on control dependency: [if], data = [none] asynchMethodFound = true; // depends on control dependency: [if], data = [none] } else { asynchMethodFlags[i] = false; // depends on control dependency: [if], data = [none] } } // no annotation at method level } else { // bean method is null so set asynch method array entry to false (ie. the default value) // F743-4582 Update - do not set this to false, as it would overwrite the value from WCCM //asynchMethodFlags[i] = false; } } // for all bean methods } // end if (methodInterface != MethodInterface.SERVICE_ENDPOINT) if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(tc, "getAsynchonousMethods"); // depends on control dependency: [if], data = [none] } return (asynchMethodFound); } }
public class class_name { public SemanticType.Record extractRecordType(SemanticType type, Environment environment, ReadWriteTypeExtractor.Combinator<SemanticType.Record> combinator, SyntacticItem item) { // if (type != null) { SemanticType.Record recordT = rwTypeExtractor.apply(type, environment, combinator); // if (recordT == null) { syntaxError(item, EXPECTED_RECORD); } else { return recordT; } } return null; } }
public class class_name { public SemanticType.Record extractRecordType(SemanticType type, Environment environment, ReadWriteTypeExtractor.Combinator<SemanticType.Record> combinator, SyntacticItem item) { // if (type != null) { SemanticType.Record recordT = rwTypeExtractor.apply(type, environment, combinator); // if (recordT == null) { syntaxError(item, EXPECTED_RECORD); // depends on control dependency: [if], data = [none] } else { return recordT; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static byte [] padTail(final byte [] a, final int length) { byte [] padding = new byte[length]; for (int i = 0; i < length; i++) { padding[i] = 0; } return add(a, padding); } }
public class class_name { public static byte [] padTail(final byte [] a, final int length) { byte [] padding = new byte[length]; for (int i = 0; i < length; i++) { padding[i] = 0; // depends on control dependency: [for], data = [i] } return add(a, padding); } }
public class class_name { private void updateBufferPoolMetrics() { for (BufferPoolMXBean bufferPoolMXBean : bufferPoolMXBeanList) { String normalizedKeyName = bufferPoolMXBean.getName().replaceAll("[^\\w]", "-"); final ByteAmount memoryUsed = ByteAmount.fromBytes(bufferPoolMXBean.getMemoryUsed()); final ByteAmount totalCapacity = ByteAmount.fromBytes(bufferPoolMXBean.getTotalCapacity()); final ByteAmount count = ByteAmount.fromBytes(bufferPoolMXBean.getCount()); // The estimated memory the JVM is using for this buffer pool jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-memory-used") .setValue(memoryUsed.asMegabytes()); // The estimated total capacity of the buffers in this pool jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-total-capacity") .setValue(totalCapacity.asMegabytes()); // THe estimated number of buffers in this pool jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-count") .setValue(count.asMegabytes()); } } }
public class class_name { private void updateBufferPoolMetrics() { for (BufferPoolMXBean bufferPoolMXBean : bufferPoolMXBeanList) { String normalizedKeyName = bufferPoolMXBean.getName().replaceAll("[^\\w]", "-"); final ByteAmount memoryUsed = ByteAmount.fromBytes(bufferPoolMXBean.getMemoryUsed()); final ByteAmount totalCapacity = ByteAmount.fromBytes(bufferPoolMXBean.getTotalCapacity()); final ByteAmount count = ByteAmount.fromBytes(bufferPoolMXBean.getCount()); // The estimated memory the JVM is using for this buffer pool jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-memory-used") .setValue(memoryUsed.asMegabytes()); // depends on control dependency: [for], data = [none] // The estimated total capacity of the buffers in this pool jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-total-capacity") .setValue(totalCapacity.asMegabytes()); // depends on control dependency: [for], data = [none] // THe estimated number of buffers in this pool jvmBufferPoolMemoryUsage.safeScope(normalizedKeyName + "-count") .setValue(count.asMegabytes()); // depends on control dependency: [for], data = [none] } } }
public class class_name { static List<String> stringsWithEq(String name, @Nullable List<String> values) { List<String> result = new ArrayList<>(); if (values != null) { for (String value : values) { result.addAll(stringWithEq(name, value)); } } return result; } }
public class class_name { static List<String> stringsWithEq(String name, @Nullable List<String> values) { List<String> result = new ArrayList<>(); if (values != null) { for (String value : values) { result.addAll(stringWithEq(name, value)); // depends on control dependency: [for], data = [value] } } return result; } }
public class class_name { public BooleanExpression isNotNull() { if (isnotnull == null) { isnotnull = Expressions.booleanOperation(Ops.IS_NOT_NULL, mixin); } return isnotnull; } }
public class class_name { public BooleanExpression isNotNull() { if (isnotnull == null) { isnotnull = Expressions.booleanOperation(Ops.IS_NOT_NULL, mixin); // depends on control dependency: [if], data = [none] } return isnotnull; } }
public class class_name { public List<String> getRepositoryUrls() { List<String> urls = new ArrayList<String>(); for ( Repository repo : getRepositories() ) { urls.add( repo.getUrl() ); } return urls; } }
public class class_name { public List<String> getRepositoryUrls() { List<String> urls = new ArrayList<String>(); for ( Repository repo : getRepositories() ) { urls.add( repo.getUrl() ); // depends on control dependency: [for], data = [repo] } return urls; } }
public class class_name { protected void extractProfilesAndAdd(final String key, final String value, final Operator operator) { String fullKey = key; int ndx = fullKey.indexOf(PROFILE_LEFT); if (ndx == -1) { justAdd(fullKey, value, null, operator); return; } // extract profiles ArrayList<String> keyProfiles = new ArrayList<>(); while (true) { ndx = fullKey.indexOf(PROFILE_LEFT); if (ndx == -1) { break; } final int len = fullKey.length(); int ndx2 = fullKey.indexOf(PROFILE_RIGHT, ndx + 1); if (ndx2 == -1) { ndx2 = len; } // remember profile final String profile = fullKey.substring(ndx + 1, ndx2); keyProfiles.add(profile); // extract profile from key ndx2++; final String right = (ndx2 == len) ? StringPool.EMPTY : fullKey.substring(ndx2); fullKey = fullKey.substring(0, ndx) + right; } if (fullKey.startsWith(StringPool.DOT)) { // check for special case when only profile is defined in section fullKey = fullKey.substring(1); } // add value to extracted profiles justAdd(fullKey, value, keyProfiles, operator); } }
public class class_name { protected void extractProfilesAndAdd(final String key, final String value, final Operator operator) { String fullKey = key; int ndx = fullKey.indexOf(PROFILE_LEFT); if (ndx == -1) { justAdd(fullKey, value, null, operator); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // extract profiles ArrayList<String> keyProfiles = new ArrayList<>(); while (true) { ndx = fullKey.indexOf(PROFILE_LEFT); // depends on control dependency: [while], data = [none] if (ndx == -1) { break; } final int len = fullKey.length(); int ndx2 = fullKey.indexOf(PROFILE_RIGHT, ndx + 1); if (ndx2 == -1) { ndx2 = len; // depends on control dependency: [if], data = [none] } // remember profile final String profile = fullKey.substring(ndx + 1, ndx2); keyProfiles.add(profile); // depends on control dependency: [while], data = [none] // extract profile from key ndx2++; // depends on control dependency: [while], data = [none] final String right = (ndx2 == len) ? StringPool.EMPTY : fullKey.substring(ndx2); fullKey = fullKey.substring(0, ndx) + right; // depends on control dependency: [while], data = [none] } if (fullKey.startsWith(StringPool.DOT)) { // check for special case when only profile is defined in section fullKey = fullKey.substring(1); // depends on control dependency: [if], data = [none] } // add value to extracted profiles justAdd(fullKey, value, keyProfiles, operator); } }
public class class_name { public Collection<CascadeType> getCascades(PluralAttribute<?, ?, ?> attribute) { if (attribute.getJavaMember() instanceof AccessibleObject) { AccessibleObject accessibleObject = (AccessibleObject) attribute.getJavaMember(); OneToMany oneToMany = accessibleObject.getAnnotation(OneToMany.class); if (oneToMany != null) { return newArrayList(oneToMany.cascade()); } ManyToMany manyToMany = accessibleObject.getAnnotation(ManyToMany.class); if (manyToMany != null) { return newArrayList(manyToMany.cascade()); } } return newArrayList(); } }
public class class_name { public Collection<CascadeType> getCascades(PluralAttribute<?, ?, ?> attribute) { if (attribute.getJavaMember() instanceof AccessibleObject) { AccessibleObject accessibleObject = (AccessibleObject) attribute.getJavaMember(); OneToMany oneToMany = accessibleObject.getAnnotation(OneToMany.class); if (oneToMany != null) { return newArrayList(oneToMany.cascade()); // depends on control dependency: [if], data = [(oneToMany] } ManyToMany manyToMany = accessibleObject.getAnnotation(ManyToMany.class); if (manyToMany != null) { return newArrayList(manyToMany.cascade()); // depends on control dependency: [if], data = [(manyToMany] } } return newArrayList(); } }
public class class_name { public void marshall(EntityRecognizerMetadataEntityTypesListItem entityRecognizerMetadataEntityTypesListItem, ProtocolMarshaller protocolMarshaller) { if (entityRecognizerMetadataEntityTypesListItem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(entityRecognizerMetadataEntityTypesListItem.getType(), TYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EntityRecognizerMetadataEntityTypesListItem entityRecognizerMetadataEntityTypesListItem, ProtocolMarshaller protocolMarshaller) { if (entityRecognizerMetadataEntityTypesListItem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(entityRecognizerMetadataEntityTypesListItem.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(TerminologyDataLocation terminologyDataLocation, ProtocolMarshaller protocolMarshaller) { if (terminologyDataLocation == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(terminologyDataLocation.getRepositoryType(), REPOSITORYTYPE_BINDING); protocolMarshaller.marshall(terminologyDataLocation.getLocation(), LOCATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(TerminologyDataLocation terminologyDataLocation, ProtocolMarshaller protocolMarshaller) { if (terminologyDataLocation == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(terminologyDataLocation.getRepositoryType(), REPOSITORYTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(terminologyDataLocation.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void parkNanos(Object blocker, long nanos) { try { Strand.parkNanos(blocker, nanos); } catch (SuspendExecution e) { throw RuntimeSuspendExecution.of(e); } } }
public class class_name { public static void parkNanos(Object blocker, long nanos) { try { Strand.parkNanos(blocker, nanos); // depends on control dependency: [try], data = [none] } catch (SuspendExecution e) { throw RuntimeSuspendExecution.of(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static <T> T firstNotNull(T o1, T o2) { if (o1 != null) { return o1; } return o2; } }
public class class_name { private static <T> T firstNotNull(T o1, T o2) { if (o1 != null) { return o1; // depends on control dependency: [if], data = [none] } return o2; } }
public class class_name { public static <T> T getLast(Collection<T> collection) { if (isEmpty(collection)) { return null; } // 当类型List时,直接取得最后一个元素. if (collection instanceof List) { List<T> list = (List<T>) collection; return list.get(list.size() - 1); } return Iterators.getLast(collection.iterator()); } }
public class class_name { public static <T> T getLast(Collection<T> collection) { if (isEmpty(collection)) { return null; // depends on control dependency: [if], data = [none] } // 当类型List时,直接取得最后一个元素. if (collection instanceof List) { List<T> list = (List<T>) collection; return list.get(list.size() - 1); // depends on control dependency: [if], data = [none] } return Iterators.getLast(collection.iterator()); } }
public class class_name { public String asYaml(String jsonStringFile) throws JsonProcessingException, IOException, FileNotFoundException { InputStream stream = getClass().getClassLoader().getResourceAsStream(jsonStringFile); Writer writer = new StringWriter(); char[] buffer = new char[1024]; Reader reader; if (stream == null) { this.getLogger().error("File does not exist: {}", jsonStringFile); throw new FileNotFoundException("ERR! File not found: " + jsonStringFile); } try { reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); } } catch (Exception readerexception) { this.getLogger().error(readerexception.getMessage()); } finally { try { stream.close(); } catch (Exception closeException) { this.getLogger().error(closeException.getMessage()); } } String text = writer.toString(); String std = text.replace("\r", "").replace("\n", ""); // make sure we have unix style text regardless of the input // parse JSON JsonNode jsonNodeTree = new ObjectMapper().readTree(std); // save it as YAML String jsonAsYaml = new YAMLMapper().writeValueAsString(jsonNodeTree); return jsonAsYaml; } }
public class class_name { public String asYaml(String jsonStringFile) throws JsonProcessingException, IOException, FileNotFoundException { InputStream stream = getClass().getClassLoader().getResourceAsStream(jsonStringFile); Writer writer = new StringWriter(); char[] buffer = new char[1024]; Reader reader; if (stream == null) { this.getLogger().error("File does not exist: {}", jsonStringFile); throw new FileNotFoundException("ERR! File not found: " + jsonStringFile); } try { reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); // depends on control dependency: [while], data = [none] } } catch (Exception readerexception) { this.getLogger().error(readerexception.getMessage()); } finally { try { stream.close(); // depends on control dependency: [try], data = [none] } catch (Exception closeException) { this.getLogger().error(closeException.getMessage()); } // depends on control dependency: [catch], data = [none] } String text = writer.toString(); String std = text.replace("\r", "").replace("\n", ""); // make sure we have unix style text regardless of the input // parse JSON JsonNode jsonNodeTree = new ObjectMapper().readTree(std); // save it as YAML String jsonAsYaml = new YAMLMapper().writeValueAsString(jsonNodeTree); return jsonAsYaml; } }
public class class_name { public void setClusterSecurityGroups(java.util.Collection<ClusterSecurityGroup> clusterSecurityGroups) { if (clusterSecurityGroups == null) { this.clusterSecurityGroups = null; return; } this.clusterSecurityGroups = new com.amazonaws.internal.SdkInternalList<ClusterSecurityGroup>(clusterSecurityGroups); } }
public class class_name { public void setClusterSecurityGroups(java.util.Collection<ClusterSecurityGroup> clusterSecurityGroups) { if (clusterSecurityGroups == null) { this.clusterSecurityGroups = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.clusterSecurityGroups = new com.amazonaws.internal.SdkInternalList<ClusterSecurityGroup>(clusterSecurityGroups); } }
public class class_name { @Reference(name = REFERENCE_ADMIN_OBJECT_SERVICES, service = AdminObjectService.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected synchronized void addAdminObjectService(ServiceReference<AdminObjectService> reference) { String id = (String) reference.getProperty(ADMIN_OBJECT_CFG_ID); if (id != null) { String jndiName = (String) reference.getProperty(ADMIN_OBJECT_CFG_JNDI_NAME); addAdminObjectService(reference, id, false); if (jndiName != null && !jndiName.equals(id)) { addAdminObjectService(reference, jndiName, true); } } } }
public class class_name { @Reference(name = REFERENCE_ADMIN_OBJECT_SERVICES, service = AdminObjectService.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) protected synchronized void addAdminObjectService(ServiceReference<AdminObjectService> reference) { String id = (String) reference.getProperty(ADMIN_OBJECT_CFG_ID); if (id != null) { String jndiName = (String) reference.getProperty(ADMIN_OBJECT_CFG_JNDI_NAME); addAdminObjectService(reference, id, false); // depends on control dependency: [if], data = [none] if (jndiName != null && !jndiName.equals(id)) { addAdminObjectService(reference, jndiName, true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { static ClassRefTypeSignature parse(final Parser parser, final String definingClassName) throws ParseException { if (parser.peek() == 'L') { parser.next(); if (!TypeUtils.getIdentifierToken(parser, /* separator = */ '/', /* separatorReplace = */ '.')) { throw new ParseException(parser, "Could not parse identifier token"); } final String className = parser.currToken(); final List<TypeArgument> typeArguments = TypeArgument.parseList(parser, definingClassName); List<String> suffixes; List<List<TypeArgument>> suffixTypeArguments; if (parser.peek() == '.') { suffixes = new ArrayList<>(); suffixTypeArguments = new ArrayList<>(); while (parser.peek() == '.') { parser.expect('.'); if (!TypeUtils.getIdentifierToken(parser, /* separator = */ '/', /* separatorReplace = */ '.')) { throw new ParseException(parser, "Could not parse identifier token"); } suffixes.add(parser.currToken()); suffixTypeArguments.add(TypeArgument.parseList(parser, definingClassName)); } } else { suffixes = Collections.emptyList(); suffixTypeArguments = Collections.emptyList(); } parser.expect(';'); return new ClassRefTypeSignature(className, typeArguments, suffixes, suffixTypeArguments); } else { return null; } } }
public class class_name { static ClassRefTypeSignature parse(final Parser parser, final String definingClassName) throws ParseException { if (parser.peek() == 'L') { parser.next(); if (!TypeUtils.getIdentifierToken(parser, /* separator = */ '/', /* separatorReplace = */ '.')) { throw new ParseException(parser, "Could not parse identifier token"); } final String className = parser.currToken(); final List<TypeArgument> typeArguments = TypeArgument.parseList(parser, definingClassName); List<String> suffixes; List<List<TypeArgument>> suffixTypeArguments; if (parser.peek() == '.') { suffixes = new ArrayList<>(); // depends on control dependency: [if], data = [none] suffixTypeArguments = new ArrayList<>(); // depends on control dependency: [if], data = [none] while (parser.peek() == '.') { parser.expect('.'); // depends on control dependency: [while], data = ['.')] if (!TypeUtils.getIdentifierToken(parser, /* separator = */ '/', /* separatorReplace = */ '.')) { throw new ParseException(parser, "Could not parse identifier token"); } suffixes.add(parser.currToken()); // depends on control dependency: [while], data = [none] suffixTypeArguments.add(TypeArgument.parseList(parser, definingClassName)); // depends on control dependency: [while], data = [none] } } else { suffixes = Collections.emptyList(); // depends on control dependency: [if], data = [none] suffixTypeArguments = Collections.emptyList(); // depends on control dependency: [if], data = [none] } parser.expect(';'); return new ClassRefTypeSignature(className, typeArguments, suffixes, suffixTypeArguments); } else { return null; } } }
public class class_name { @Override public boolean removeAll(IntSet c) { if (c == null || c.isEmpty()) { return false; } IntIterator itr; if (c instanceof HashIntSet) { itr = ((HashIntSet) c).unsortedIterator(); } else { itr = c.iterator(); } boolean res = false; while (itr.hasNext()) { res |= remove(itr.next()); } return res; } }
public class class_name { @Override public boolean removeAll(IntSet c) { if (c == null || c.isEmpty()) { return false; // depends on control dependency: [if], data = [none] } IntIterator itr; if (c instanceof HashIntSet) { itr = ((HashIntSet) c).unsortedIterator(); // depends on control dependency: [if], data = [none] } else { itr = c.iterator(); // depends on control dependency: [if], data = [none] } boolean res = false; while (itr.hasNext()) { res |= remove(itr.next()); // depends on control dependency: [while], data = [none] } return res; } }
public class class_name { protected void init() { handle = TessBaseAPICreate(); StringArray sarray = new StringArray(configList.toArray(new String[0])); PointerByReference configs = new PointerByReference(); configs.setPointer(sarray); TessBaseAPIInit1(handle, datapath, language, ocrEngineMode, configs, configList.size()); if (psm > -1) { TessBaseAPISetPageSegMode(handle, psm); } } }
public class class_name { protected void init() { handle = TessBaseAPICreate(); StringArray sarray = new StringArray(configList.toArray(new String[0])); PointerByReference configs = new PointerByReference(); configs.setPointer(sarray); TessBaseAPIInit1(handle, datapath, language, ocrEngineMode, configs, configList.size()); if (psm > -1) { TessBaseAPISetPageSegMode(handle, psm); // depends on control dependency: [if], data = [none] } } }
public class class_name { void setParameter(String name, Object value) throws Exception { logger.debug("public void setParameter"); try { if (this.sfStatement != null) { this.sfStatement.addProperty(name, value); } } catch (SFException ex) { throw new SnowflakeSQLException(ex); } } }
public class class_name { void setParameter(String name, Object value) throws Exception { logger.debug("public void setParameter"); try { if (this.sfStatement != null) { this.sfStatement.addProperty(name, value); // depends on control dependency: [if], data = [none] } } catch (SFException ex) { throw new SnowflakeSQLException(ex); } } }
public class class_name { public List<abstractTiffType> getDescriptiveValueObject() { Tag tag = TiffTags.getTag(id); if (tag != null) { if (tag.hasReadableDescription()){ String desc = this.toString(); String tagDescription = tag.getTextDescription(toString()); if (tagDescription != null){ desc = tagDescription; } return Arrays.asList(new Text(desc)); } else { return getValue(); } } return null; } }
public class class_name { public List<abstractTiffType> getDescriptiveValueObject() { Tag tag = TiffTags.getTag(id); if (tag != null) { if (tag.hasReadableDescription()){ String desc = this.toString(); String tagDescription = tag.getTextDescription(toString()); if (tagDescription != null){ desc = tagDescription; // depends on control dependency: [if], data = [none] } return Arrays.asList(new Text(desc)); // depends on control dependency: [if], data = [none] } else { return getValue(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void adjustTransformer(Transformer transformer, String sourceFilename, File targetFile) { GitHelper.addCommitProperties(transformer, baseDir, 7, getLog()); String warBasename; String webhelpOutdir = targetFile.getName().substring(0, targetFile.getName().lastIndexOf('.')); if(null != webhelpDirname && !webhelpDirname.isEmpty()){ warBasename = webhelpDirname; } else { warBasename = webhelpOutdir; } targetFile = new File( getTargetDirectory() + "/" + warBasename + "/dummy.webhelp" ); super.adjustTransformer(transformer, sourceFilename, targetFile); transformer.setParameter("groupId", docProject.getGroupId()); transformer.setParameter("artifactId", docProject.getArtifactId()); transformer.setParameter("docProjectVersion", docProject.getVersion()); transformer.setParameter("pomProjectName", docProject.getName()); if(commentsPhp != null){ transformer.setParameter("comments.php", commentsPhp); } if(glossaryUri != null){ transformer.setParameter("glossary.uri", glossaryUri); } if(feedbackEmail != null){ transformer.setParameter("feedback.email", feedbackEmail); } if(useDisqusId != null){ transformer.setParameter("use.disqus.id", useDisqusId); } if (useVersionForDisqus != null) { transformer.setParameter("use.version.for.disqus", useVersionForDisqus); } transformer.setParameter("project.build.directory", projectBuildDirectory.toURI().toString()); transformer.setParameter("branding", branding); //if the pdf is generated automatically with webhelp then this will be set. transformer.setParameter("autoPdfUrl", autoPdfUrl); if (null != builtForOpenStack) { transformer.setParameter("builtForOpenStack", builtForOpenStack); } transformer.setParameter("coverLogoPath", coverLogoPath); if (null != secondaryCoverLogoPath) { transformer.setParameter("secondaryCoverLogoPath", secondaryCoverLogoPath); } transformer.setParameter("coverLogoLeft", coverLogoLeft); transformer.setParameter("coverLogoTop", coverLogoTop); transformer.setParameter("coverUrl", coverUrl); transformer.setParameter("coverColor", coverColor); if(null != pageWidth){ transformer.setParameter("page.width", pageWidth); } if(null != pageHeight){ transformer.setParameter("page.height", pageHeight); } if(null != omitCover){ transformer.setParameter("omitCover", omitCover); } if(null != doubleSided){ transformer.setParameter("double.sided", doubleSided); } transformer.setParameter("enable.disqus", enableDisqus); if (disqusShortname != null) { transformer.setParameter("disqus.shortname", disqusShortname); } if (disqusIdentifier != null) { transformer.setParameter("disqus_identifier", disqusIdentifier); } if (enableGoogleAnalytics != null) { transformer.setParameter("enable.google.analytics", enableGoogleAnalytics); } if (googleAnalyticsId != null) { transformer.setParameter("google.analytics.id", googleAnalyticsId); } if(googleAnalyticsDomain != null){ transformer.setParameter("google.analytics.domain", googleAnalyticsDomain); } if (pdfUrl != null) { transformer.setParameter("pdf.url", pdfUrl); } if (useLatestSuffixInPdfUrl != null) { transformer.setParameter("useLatestSuffixInPdfUrl", useLatestSuffixInPdfUrl); } if (legalNoticeUrl != null) { transformer.setParameter("legal.notice.url", legalNoticeUrl); } String sysWebhelpWar=System.getProperty("webhelp.war"); if(null!=sysWebhelpWar && !sysWebhelpWar.isEmpty()){ webhelpWar=sysWebhelpWar; } transformer.setParameter("webhelp.war", webhelpWar); if(null != includeDateInPdfFilename){ transformer.setParameter("includeDateInPdfFilename", includeDateInPdfFilename); } transformer.setParameter("pdfFilenameBase", pdfFilenameBase); transformer.setParameter("webhelpDirname", webhelpDirname); transformer.setParameter("publicationNotificationEmails", publicationNotificationEmails); String sysDraftStatus=System.getProperty("draft.status"); if(null!=sysDraftStatus && !sysDraftStatus.isEmpty()){ draftStatus=sysDraftStatus; } transformer.setParameter("draft.status", draftStatus); String sysStatusBarText=System.getProperty("statusBarText"); if(null!=sysStatusBarText && !sysStatusBarText.isEmpty()){ statusBarText=sysStatusBarText; } if(null != statusBarText){ transformer.setParameter("status.bar.text", statusBarText); } if(null != bodyFont){ transformer.setParameter("bodyFont", bodyFont); } if(null != monospaceFont){ transformer.setParameter("monospaceFont", monospaceFont); } if(canonicalUrlBase != null){ transformer.setParameter("canonical.url.base",canonicalUrlBase); } String sysSecurity=System.getProperty("security"); if(null!=sysSecurity && !sysSecurity.isEmpty()){ security=sysSecurity; } if(security != null){ transformer.setParameter("security",security); } if(showChangebars != null){ transformer.setParameter("show.changebars",showChangebars); } if(metaRobots != null){ transformer.setParameter("meta.robots",metaRobots); } if(trimWadlUriCount != null){ transformer.setParameter("trim.wadl.uri.count",trimWadlUriCount); } transformer.setParameter("social.icons",socialIcons); sourceDocBook = new File(sourceFilename); sourceDirectory = sourceDocBook.getParentFile(); transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString()); transformer.setParameter("source.directory",sourceDirectory.toURI().toString()); transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath); } }
public class class_name { public void adjustTransformer(Transformer transformer, String sourceFilename, File targetFile) { GitHelper.addCommitProperties(transformer, baseDir, 7, getLog()); String warBasename; String webhelpOutdir = targetFile.getName().substring(0, targetFile.getName().lastIndexOf('.')); if(null != webhelpDirname && !webhelpDirname.isEmpty()){ warBasename = webhelpDirname; // depends on control dependency: [if], data = [none] } else { warBasename = webhelpOutdir; // depends on control dependency: [if], data = [none] } targetFile = new File( getTargetDirectory() + "/" + warBasename + "/dummy.webhelp" ); super.adjustTransformer(transformer, sourceFilename, targetFile); transformer.setParameter("groupId", docProject.getGroupId()); transformer.setParameter("artifactId", docProject.getArtifactId()); transformer.setParameter("docProjectVersion", docProject.getVersion()); transformer.setParameter("pomProjectName", docProject.getName()); if(commentsPhp != null){ transformer.setParameter("comments.php", commentsPhp); // depends on control dependency: [if], data = [none] } if(glossaryUri != null){ transformer.setParameter("glossary.uri", glossaryUri); // depends on control dependency: [if], data = [none] } if(feedbackEmail != null){ transformer.setParameter("feedback.email", feedbackEmail); // depends on control dependency: [if], data = [none] } if(useDisqusId != null){ transformer.setParameter("use.disqus.id", useDisqusId); // depends on control dependency: [if], data = [none] } if (useVersionForDisqus != null) { transformer.setParameter("use.version.for.disqus", useVersionForDisqus); // depends on control dependency: [if], data = [none] } transformer.setParameter("project.build.directory", projectBuildDirectory.toURI().toString()); transformer.setParameter("branding", branding); //if the pdf is generated automatically with webhelp then this will be set. transformer.setParameter("autoPdfUrl", autoPdfUrl); if (null != builtForOpenStack) { transformer.setParameter("builtForOpenStack", builtForOpenStack); // depends on control dependency: [if], data = [builtForOpenStack)] } transformer.setParameter("coverLogoPath", coverLogoPath); if (null != secondaryCoverLogoPath) { transformer.setParameter("secondaryCoverLogoPath", secondaryCoverLogoPath); // depends on control dependency: [if], data = [secondaryCoverLogoPath)] } transformer.setParameter("coverLogoLeft", coverLogoLeft); transformer.setParameter("coverLogoTop", coverLogoTop); transformer.setParameter("coverUrl", coverUrl); transformer.setParameter("coverColor", coverColor); if(null != pageWidth){ transformer.setParameter("page.width", pageWidth); // depends on control dependency: [if], data = [pageWidth)] } if(null != pageHeight){ transformer.setParameter("page.height", pageHeight); // depends on control dependency: [if], data = [pageHeight)] } if(null != omitCover){ transformer.setParameter("omitCover", omitCover); // depends on control dependency: [if], data = [omitCover)] } if(null != doubleSided){ transformer.setParameter("double.sided", doubleSided); // depends on control dependency: [if], data = [doubleSided)] } transformer.setParameter("enable.disqus", enableDisqus); if (disqusShortname != null) { transformer.setParameter("disqus.shortname", disqusShortname); // depends on control dependency: [if], data = [none] } if (disqusIdentifier != null) { transformer.setParameter("disqus_identifier", disqusIdentifier); // depends on control dependency: [if], data = [none] } if (enableGoogleAnalytics != null) { transformer.setParameter("enable.google.analytics", enableGoogleAnalytics); // depends on control dependency: [if], data = [none] } if (googleAnalyticsId != null) { transformer.setParameter("google.analytics.id", googleAnalyticsId); // depends on control dependency: [if], data = [none] } if(googleAnalyticsDomain != null){ transformer.setParameter("google.analytics.domain", googleAnalyticsDomain); // depends on control dependency: [if], data = [none] } if (pdfUrl != null) { transformer.setParameter("pdf.url", pdfUrl); // depends on control dependency: [if], data = [none] } if (useLatestSuffixInPdfUrl != null) { transformer.setParameter("useLatestSuffixInPdfUrl", useLatestSuffixInPdfUrl); // depends on control dependency: [if], data = [none] } if (legalNoticeUrl != null) { transformer.setParameter("legal.notice.url", legalNoticeUrl); // depends on control dependency: [if], data = [none] } String sysWebhelpWar=System.getProperty("webhelp.war"); if(null!=sysWebhelpWar && !sysWebhelpWar.isEmpty()){ webhelpWar=sysWebhelpWar; // depends on control dependency: [if], data = [none] } transformer.setParameter("webhelp.war", webhelpWar); if(null != includeDateInPdfFilename){ transformer.setParameter("includeDateInPdfFilename", includeDateInPdfFilename); // depends on control dependency: [if], data = [includeDateInPdfFilename)] } transformer.setParameter("pdfFilenameBase", pdfFilenameBase); transformer.setParameter("webhelpDirname", webhelpDirname); transformer.setParameter("publicationNotificationEmails", publicationNotificationEmails); String sysDraftStatus=System.getProperty("draft.status"); if(null!=sysDraftStatus && !sysDraftStatus.isEmpty()){ draftStatus=sysDraftStatus; // depends on control dependency: [if], data = [none] } transformer.setParameter("draft.status", draftStatus); String sysStatusBarText=System.getProperty("statusBarText"); if(null!=sysStatusBarText && !sysStatusBarText.isEmpty()){ statusBarText=sysStatusBarText; // depends on control dependency: [if], data = [none] } if(null != statusBarText){ transformer.setParameter("status.bar.text", statusBarText); // depends on control dependency: [if], data = [statusBarText)] } if(null != bodyFont){ transformer.setParameter("bodyFont", bodyFont); // depends on control dependency: [if], data = [bodyFont)] } if(null != monospaceFont){ transformer.setParameter("monospaceFont", monospaceFont); // depends on control dependency: [if], data = [monospaceFont)] } if(canonicalUrlBase != null){ transformer.setParameter("canonical.url.base",canonicalUrlBase); // depends on control dependency: [if], data = [none] } String sysSecurity=System.getProperty("security"); if(null!=sysSecurity && !sysSecurity.isEmpty()){ security=sysSecurity; // depends on control dependency: [if], data = [none] } if(security != null){ transformer.setParameter("security",security); // depends on control dependency: [if], data = [none] } if(showChangebars != null){ transformer.setParameter("show.changebars",showChangebars); // depends on control dependency: [if], data = [none] } if(metaRobots != null){ transformer.setParameter("meta.robots",metaRobots); // depends on control dependency: [if], data = [none] } if(trimWadlUriCount != null){ transformer.setParameter("trim.wadl.uri.count",trimWadlUriCount); // depends on control dependency: [if], data = [none] } transformer.setParameter("social.icons",socialIcons); sourceDocBook = new File(sourceFilename); sourceDirectory = sourceDocBook.getParentFile(); transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString()); transformer.setParameter("source.directory",sourceDirectory.toURI().toString()); transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath); } }
public class class_name { protected boolean isBinaryResource(String resourcePath) { String extension = FileNameUtils.getExtension(resourcePath); if (extension != null) { extension = extension.toLowerCase(); } return MIMETypesSupport.getSupportedProperties(this).containsKey(extension); } }
public class class_name { protected boolean isBinaryResource(String resourcePath) { String extension = FileNameUtils.getExtension(resourcePath); if (extension != null) { extension = extension.toLowerCase(); // depends on control dependency: [if], data = [none] } return MIMETypesSupport.getSupportedProperties(this).containsKey(extension); } }
public class class_name { public boolean hasNewHeader(int position, boolean isReverseLayout) { if (indexOutOfBounds(position)) { return false; } long headerId = mAdapter.getHeaderId(position); if (headerId < 0) { return false; } long nextItemHeaderId = -1; int nextItemPosition = position + (isReverseLayout? 1: -1); if (!indexOutOfBounds(nextItemPosition)){ nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition); } int firstItemPosition = isReverseLayout? mAdapter.getItemCount()-1 : 0; return position == firstItemPosition || headerId != nextItemHeaderId; } }
public class class_name { public boolean hasNewHeader(int position, boolean isReverseLayout) { if (indexOutOfBounds(position)) { return false; // depends on control dependency: [if], data = [none] } long headerId = mAdapter.getHeaderId(position); if (headerId < 0) { return false; // depends on control dependency: [if], data = [none] } long nextItemHeaderId = -1; int nextItemPosition = position + (isReverseLayout? 1: -1); if (!indexOutOfBounds(nextItemPosition)){ nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition); // depends on control dependency: [if], data = [none] } int firstItemPosition = isReverseLayout? mAdapter.getItemCount()-1 : 0; return position == firstItemPosition || headerId != nextItemHeaderId; } }
public class class_name { public String findFilter(String destination) { FindFilterEvent event = new FindFilterEvent(); event.setDestination(destination); try { Object obj = delegate.callManager(event); if (obj != null && obj instanceof String) { return (String) obj; } else { throw new CanalException("No Such Canal by [" + destination + "]"); } } catch (Exception e) { throw new CanalException("call_manager_error", e); } } }
public class class_name { public String findFilter(String destination) { FindFilterEvent event = new FindFilterEvent(); event.setDestination(destination); try { Object obj = delegate.callManager(event); if (obj != null && obj instanceof String) { return (String) obj; // depends on control dependency: [if], data = [none] } else { throw new CanalException("No Such Canal by [" + destination + "]"); } } catch (Exception e) { throw new CanalException("call_manager_error", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setFormEnabled(boolean enabled) { m_formEnabled = enabled; m_selectBox.setEnabled(enabled); m_heightBox.setEnabled(enabled); m_widthBox.setEnabled(enabled); if (enabled) { m_cropButton.enable(); m_removeCropButton.enable(); } else { m_cropButton.disable(Messages.get().key(Messages.GUI_IMAGE_NO_FORMATS_AVAILABLE_0)); m_removeCropButton.disable(Messages.get().key(Messages.GUI_IMAGE_NO_FORMATS_AVAILABLE_0)); } } }
public class class_name { public void setFormEnabled(boolean enabled) { m_formEnabled = enabled; m_selectBox.setEnabled(enabled); m_heightBox.setEnabled(enabled); m_widthBox.setEnabled(enabled); if (enabled) { m_cropButton.enable(); // depends on control dependency: [if], data = [none] m_removeCropButton.enable(); // depends on control dependency: [if], data = [none] } else { m_cropButton.disable(Messages.get().key(Messages.GUI_IMAGE_NO_FORMATS_AVAILABLE_0)); // depends on control dependency: [if], data = [none] m_removeCropButton.disable(Messages.get().key(Messages.GUI_IMAGE_NO_FORMATS_AVAILABLE_0)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private File captureScreen(TestMethod rootMethod) { byte[] screenData = AdapterContainer.globalInstance().captureScreen(); if (screenData == null) { return null; } // use encoded name to avoid various possible file name encoding problem // and to escape invalid file name character (Method name may contain such characters // if method is Groovy method, for example). File captureFile = new File(String.format("%s/%s/%s/%03d.png", captureRootDir, CommonUtils.encodeToSafeAsciiFileNameString(rootMethod.getTestClass().getQualifiedName(), StandardCharsets.UTF_8), CommonUtils.encodeToSafeAsciiFileNameString(rootMethod.getSimpleName(), StandardCharsets.UTF_8), currentCaptureNo)); currentCaptureNo++; if (captureFile.getParentFile() != null) { captureFile.getParentFile().mkdirs(); } FileOutputStream stream = null; try { stream = new FileOutputStream(captureFile); stream.write(screenData); } catch (IOException e) { throw new RuntimeException(e); } finally { IOUtils.closeQuietly(stream); } return captureFile; } }
public class class_name { private File captureScreen(TestMethod rootMethod) { byte[] screenData = AdapterContainer.globalInstance().captureScreen(); if (screenData == null) { return null; // depends on control dependency: [if], data = [none] } // use encoded name to avoid various possible file name encoding problem // and to escape invalid file name character (Method name may contain such characters // if method is Groovy method, for example). File captureFile = new File(String.format("%s/%s/%s/%03d.png", captureRootDir, CommonUtils.encodeToSafeAsciiFileNameString(rootMethod.getTestClass().getQualifiedName(), StandardCharsets.UTF_8), CommonUtils.encodeToSafeAsciiFileNameString(rootMethod.getSimpleName(), StandardCharsets.UTF_8), currentCaptureNo)); currentCaptureNo++; if (captureFile.getParentFile() != null) { captureFile.getParentFile().mkdirs(); // depends on control dependency: [if], data = [none] } FileOutputStream stream = null; try { stream = new FileOutputStream(captureFile); // depends on control dependency: [try], data = [none] stream.write(screenData); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } finally { // depends on control dependency: [catch], data = [none] IOUtils.closeQuietly(stream); } return captureFile; } }
public class class_name { @SuppressWarnings("unchecked") public <T> T get(final Class<T> type) { T bean = (T) components.get(type); if (bean != null) { return bean; } return (T) get(type.getName()); } }
public class class_name { @SuppressWarnings("unchecked") public <T> T get(final Class<T> type) { T bean = (T) components.get(type); if (bean != null) { return bean; // depends on control dependency: [if], data = [none] } return (T) get(type.getName()); } }
public class class_name { public void stop(Path baseDir, Path sampleDir, ProcessExitCallback callback) { if (!sampleDir.toFile().exists() && callback != null) { callback.callback(0); } ProcessCommand cmd = MavenProject.load(baseDir).mvnw("jetty:stop", "-f", sampleDir.toString()); if (callback != null) cmd.getExitCallbacks().add(callback); cmd.executeAsync(); } }
public class class_name { public void stop(Path baseDir, Path sampleDir, ProcessExitCallback callback) { if (!sampleDir.toFile().exists() && callback != null) { callback.callback(0); // depends on control dependency: [if], data = [none] } ProcessCommand cmd = MavenProject.load(baseDir).mvnw("jetty:stop", "-f", sampleDir.toString()); if (callback != null) cmd.getExitCallbacks().add(callback); cmd.executeAsync(); } }
public class class_name { public MediaWikiParser createParser(){ logger.debug( "Selected Parser: {}", parserClass ); if( parserClass == ModularParser.class ){ ModularParser mwgp = new ModularParser( // resolveLineSeparator(), "\n", languageIdentifers, categoryIdentifers, imageIdentifers, showImageText, deleteTags, showMathTagContent, calculateSrcSpans, null ); StringBuilder sb = new StringBuilder(); sb.append( lineSeparator + "languageIdentifers: "); for( String s: languageIdentifers ) { sb.append( s + " "); } sb.append( lineSeparator + "categoryIdentifers: "); for( String s: categoryIdentifers ) { sb.append( s + " "); } sb.append( lineSeparator + "imageIdentifers: "); for( String s: imageIdentifers ) { sb.append( s + " "); } logger.debug( sb.toString() ); MediaWikiTemplateParser mwtp; logger.debug( "Selected TemplateParser: {}", templateParserClass); if( templateParserClass == GermanTemplateParser.class ){ for( String s: deleteTemplates) { logger.debug( "DeleteTemplate: '{}'", s); } for( String s: parseTemplates) { logger.debug( "ParseTemplate: '{}'", s); } mwtp = new GermanTemplateParser( mwgp, deleteTemplates, parseTemplates ); } else if( templateParserClass == FlushTemplates.class ) { mwtp = new FlushTemplates(); } else if( templateParserClass == ShowTemplateNamesAndParameters.class ){ mwtp = new ShowTemplateNamesAndParameters(); } else{ logger.error("TemplateParser Class Not Found!"); return null; } mwgp.setTemplateParser( mwtp ); return mwgp; } else{ logger.error("Parser Class Not Found!"); return null; } } }
public class class_name { public MediaWikiParser createParser(){ logger.debug( "Selected Parser: {}", parserClass ); if( parserClass == ModularParser.class ){ ModularParser mwgp = new ModularParser( // resolveLineSeparator(), "\n", languageIdentifers, categoryIdentifers, imageIdentifers, showImageText, deleteTags, showMathTagContent, calculateSrcSpans, null ); StringBuilder sb = new StringBuilder(); sb.append( lineSeparator + "languageIdentifers: "); // depends on control dependency: [if], data = [none] for( String s: languageIdentifers ) { sb.append( s + " "); // depends on control dependency: [for], data = [s] } sb.append( lineSeparator + "categoryIdentifers: "); // depends on control dependency: [if], data = [none] for( String s: categoryIdentifers ) { sb.append( s + " "); // depends on control dependency: [for], data = [s] } sb.append( lineSeparator + "imageIdentifers: "); // depends on control dependency: [if], data = [none] for( String s: imageIdentifers ) { sb.append( s + " "); // depends on control dependency: [for], data = [s] } logger.debug( sb.toString() ); // depends on control dependency: [if], data = [none] MediaWikiTemplateParser mwtp; logger.debug( "Selected TemplateParser: {}", templateParserClass); // depends on control dependency: [if], data = [none] if( templateParserClass == GermanTemplateParser.class ){ for( String s: deleteTemplates) { logger.debug( "DeleteTemplate: '{}'", s); // depends on control dependency: [for], data = [s] } for( String s: parseTemplates) { logger.debug( "ParseTemplate: '{}'", s); // depends on control dependency: [for], data = [s] } mwtp = new GermanTemplateParser( mwgp, deleteTemplates, parseTemplates ); // depends on control dependency: [if], data = [none] } else if( templateParserClass == FlushTemplates.class ) { mwtp = new FlushTemplates(); // depends on control dependency: [if], data = [none] } else if( templateParserClass == ShowTemplateNamesAndParameters.class ){ mwtp = new ShowTemplateNamesAndParameters(); // depends on control dependency: [if], data = [none] } else{ logger.error("TemplateParser Class Not Found!"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } mwgp.setTemplateParser( mwtp ); // depends on control dependency: [if], data = [none] return mwgp; // depends on control dependency: [if], data = [none] } else{ logger.error("Parser Class Not Found!"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void moveupFieldData(FieldData fieldInfo) { // Move these fields up to the field passed in BaseField field; String thisFieldStr; int count = fieldInfo.getFieldCount() + DBConstants.MAIN_FIELD; for (int i = DBConstants.MAIN_FIELD; i < count; i++) { field = fieldInfo.getField(i); if (field.getString().length() == 0) { thisFieldStr = m_FieldData.getField(i).getString(); if (thisFieldStr.length() != 0) field.setString(thisFieldStr); } } } }
public class class_name { public void moveupFieldData(FieldData fieldInfo) { // Move these fields up to the field passed in BaseField field; String thisFieldStr; int count = fieldInfo.getFieldCount() + DBConstants.MAIN_FIELD; for (int i = DBConstants.MAIN_FIELD; i < count; i++) { field = fieldInfo.getField(i); // depends on control dependency: [for], data = [i] if (field.getString().length() == 0) { thisFieldStr = m_FieldData.getField(i).getString(); // depends on control dependency: [if], data = [none] if (thisFieldStr.length() != 0) field.setString(thisFieldStr); } } } }