code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void reconstituteNetwork(final File file) { BinaryProtoNetworkDescriptor inputProtoNetworkDesc = new BinaryProtoNetworkDescriptor(file); ProtoNetworkExternalizer pne = new BinaryProtoNetworkExternalizer(); ProtoNetwork global = null; try { global = pne.readProtoNetwork(inputProtoNetworkDesc); } catch (ProtoNetworkError e) { error(e.getUserFacingMessage()); final ExitCode ec = ExitCode.NO_GLOBAL_PROTO_NETWORK; exit(ec); } processNetwork(global); } }
public class class_name { private void reconstituteNetwork(final File file) { BinaryProtoNetworkDescriptor inputProtoNetworkDesc = new BinaryProtoNetworkDescriptor(file); ProtoNetworkExternalizer pne = new BinaryProtoNetworkExternalizer(); ProtoNetwork global = null; try { global = pne.readProtoNetwork(inputProtoNetworkDesc); // depends on control dependency: [try], data = [none] } catch (ProtoNetworkError e) { error(e.getUserFacingMessage()); final ExitCode ec = ExitCode.NO_GLOBAL_PROTO_NETWORK; exit(ec); } // depends on control dependency: [catch], data = [none] processNetwork(global); } }
public class class_name { protected double[] makeLevelValues() { List<String> levels = getLevels(); if (levels == null) { return null; } if (levels.size() != getSize()) { // do someting } // Time is always LINEAR int inc = 0; double[] vals = new double[getSize()]; String tstart = levels.get(0).trim().toLowerCase(); String pattern = null; if (tstart.indexOf(":") >= 0) { // HH:mmZddMMMyyyy pattern = dateFormats[0]; } else if (tstart.indexOf("z") >= 0) { // mmZddMMMyyyy pattern = dateFormats[1]; } else if (Character.isLetter(tstart.charAt(0))) { // MMMyyyy pattern = dateFormats[3]; } else { pattern = dateFormats[2]; // ddMMMyyyy } SimpleDateFormat sdf = new SimpleDateFormat(pattern); //sdf.setLenient(true); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); ParsePosition p = new ParsePosition(0); Date d = sdf.parse(tstart, p); if (d == null) { System.out.println("couldn't parse at " + p.getErrorIndex()); d = new Date(0); } //System.out.println("start = " + d); // set the unit sdf.applyPattern("yyyy-MM-dd HH:mm:ss Z"); setUnit("hours since " + sdf.format(d, new StringBuffer(), new FieldPosition(0))); // parse the increment // vvkk where // vv = an integer number, 1 or 2 digits // kk = mn (minute) // hr (hour) // dy (day) // mo (month) // yr (year) String tinc = levels.get(1).toLowerCase(); int incIndex = 0; for (int i = 0; i < incStr.length; i++) { int index = tinc.indexOf(incStr[i]); if (index < 0) { continue; } int numOf = Integer.parseInt(tinc.substring(0, index)); inc = numOf; incIndex = i; break; } Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); calendar.setTime(d); vals[0] = 0; initialTime = makeTimeStruct(calendar); //System.out.println("initial time = " + initialTime); int calInc = calIncs[incIndex]; double hours = (double) 1000 * 60 * 60; for (int i = 1; i < getSize(); i++) { calendar.add(calInc, inc); // subtract from origin, convert to hours double offset = (calendar.getTime().getTime() - d.getTime()) / hours; //millis in an hour vals[i] = offset; } return vals; } }
public class class_name { protected double[] makeLevelValues() { List<String> levels = getLevels(); if (levels == null) { return null; // depends on control dependency: [if], data = [none] } if (levels.size() != getSize()) { // do someting } // Time is always LINEAR int inc = 0; double[] vals = new double[getSize()]; String tstart = levels.get(0).trim().toLowerCase(); String pattern = null; if (tstart.indexOf(":") >= 0) { // HH:mmZddMMMyyyy pattern = dateFormats[0]; // depends on control dependency: [if], data = [none] } else if (tstart.indexOf("z") >= 0) { // mmZddMMMyyyy pattern = dateFormats[1]; // depends on control dependency: [if], data = [none] } else if (Character.isLetter(tstart.charAt(0))) { // MMMyyyy pattern = dateFormats[3]; // depends on control dependency: [if], data = [none] } else { pattern = dateFormats[2]; // ddMMMyyyy // depends on control dependency: [if], data = [none] } SimpleDateFormat sdf = new SimpleDateFormat(pattern); //sdf.setLenient(true); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); ParsePosition p = new ParsePosition(0); Date d = sdf.parse(tstart, p); if (d == null) { System.out.println("couldn't parse at " + p.getErrorIndex()); // depends on control dependency: [if], data = [none] d = new Date(0); // depends on control dependency: [if], data = [none] } //System.out.println("start = " + d); // set the unit sdf.applyPattern("yyyy-MM-dd HH:mm:ss Z"); setUnit("hours since " + sdf.format(d, new StringBuffer(), new FieldPosition(0))); // parse the increment // vvkk where // vv = an integer number, 1 or 2 digits // kk = mn (minute) // hr (hour) // dy (day) // mo (month) // yr (year) String tinc = levels.get(1).toLowerCase(); int incIndex = 0; for (int i = 0; i < incStr.length; i++) { int index = tinc.indexOf(incStr[i]); if (index < 0) { continue; } int numOf = Integer.parseInt(tinc.substring(0, index)); inc = numOf; // depends on control dependency: [for], data = [none] incIndex = i; // depends on control dependency: [for], data = [i] break; } Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); calendar.setTime(d); vals[0] = 0; initialTime = makeTimeStruct(calendar); //System.out.println("initial time = " + initialTime); int calInc = calIncs[incIndex]; double hours = (double) 1000 * 60 * 60; for (int i = 1; i < getSize(); i++) { calendar.add(calInc, inc); // depends on control dependency: [for], data = [none] // subtract from origin, convert to hours double offset = (calendar.getTime().getTime() - d.getTime()) / hours; //millis in an hour vals[i] = offset; // depends on control dependency: [for], data = [i] } return vals; } }
public class class_name { public static Date toDate(String s) { // Build a date formatter using the format specified by dateFormat DateFormat dateFormatter = new SimpleDateFormat(dateFormat); try { return dateFormatter.parse(s); } catch (ParseException e) { // Exception noted so can be ignored. e = null; return null; } } }
public class class_name { public static Date toDate(String s) { // Build a date formatter using the format specified by dateFormat DateFormat dateFormatter = new SimpleDateFormat(dateFormat); try { return dateFormatter.parse(s); // depends on control dependency: [try], data = [none] } catch (ParseException e) { // Exception noted so can be ignored. e = null; return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override @SuppressWarnings("ConstantConditions") @Nonnull public <T> Set<ConstraintViolation<T>> validate(@Nonnull BeanIntrospection<T> introspection, @Nonnull T object, @Nullable Class<?>... groups) { if (introspection == null) { throw new ValidationException("Passed object [" + object + "] cannot be introspected. Please annotate with @Introspected"); } @SuppressWarnings("unchecked") final Collection<? extends BeanProperty<Object, Object>> constrainedProperties = ((BeanIntrospection<Object>) introspection).getIndexedProperties(Constraint.class); @SuppressWarnings("unchecked") final Collection<BeanProperty<Object, Object>> cascadeProperties = ((BeanIntrospection<Object>) introspection).getIndexedProperties(Valid.class); if (CollectionUtils.isNotEmpty(constrainedProperties) || CollectionUtils.isNotEmpty(cascadeProperties)) { DefaultConstraintValidatorContext context = new DefaultConstraintValidatorContext(object, groups); Set<ConstraintViolation<T>> overallViolations = new HashSet<>(5); return doValidate( object, object, constrainedProperties, cascadeProperties, context, overallViolations ); } return Collections.emptySet(); } }
public class class_name { @Override @SuppressWarnings("ConstantConditions") @Nonnull public <T> Set<ConstraintViolation<T>> validate(@Nonnull BeanIntrospection<T> introspection, @Nonnull T object, @Nullable Class<?>... groups) { if (introspection == null) { throw new ValidationException("Passed object [" + object + "] cannot be introspected. Please annotate with @Introspected"); } @SuppressWarnings("unchecked") final Collection<? extends BeanProperty<Object, Object>> constrainedProperties = ((BeanIntrospection<Object>) introspection).getIndexedProperties(Constraint.class); @SuppressWarnings("unchecked") final Collection<BeanProperty<Object, Object>> cascadeProperties = ((BeanIntrospection<Object>) introspection).getIndexedProperties(Valid.class); if (CollectionUtils.isNotEmpty(constrainedProperties) || CollectionUtils.isNotEmpty(cascadeProperties)) { DefaultConstraintValidatorContext context = new DefaultConstraintValidatorContext(object, groups); Set<ConstraintViolation<T>> overallViolations = new HashSet<>(5); return doValidate( object, object, constrainedProperties, cascadeProperties, context, overallViolations ); // depends on control dependency: [if], data = [none] } return Collections.emptySet(); } }
public class class_name { @Override public void resetPMICounters() { // TODO needs to change if cache provider supports PMI counters. final String methodName = "resetPMICounters()"; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName); } } }
public class class_name { @Override public void resetPMICounters() { // TODO needs to change if cache provider supports PMI counters. final String methodName = "resetPMICounters()"; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String toPDB(Chain chain){ StringBuffer w = new StringBuffer(); int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); toPDB(g,w); } return w.toString(); } }
public class class_name { public static String toPDB(Chain chain){ StringBuffer w = new StringBuffer(); int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); toPDB(g,w); // depends on control dependency: [for], data = [none] } return w.toString(); } }
public class class_name { public static ClassLoader getDefaultClassLoader() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = ClassUtils.class.getClassLoader(); if (loader == null) { loader = ClassLoader.getSystemClassLoader(); } } return loader; } }
public class class_name { public static ClassLoader getDefaultClassLoader() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = ClassUtils.class.getClassLoader(); // depends on control dependency: [if], data = [none] if (loader == null) { loader = ClassLoader.getSystemClassLoader(); // depends on control dependency: [if], data = [none] } } return loader; } }
public class class_name { private void initializeFont(Font baseFont, int size, boolean bold, boolean italic) { Map attributes = baseFont.getAttributes(); attributes.put(TextAttribute.SIZE, new Float(size)); attributes.put(TextAttribute.WEIGHT, bold ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR); attributes.put(TextAttribute.POSTURE, italic ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR); try { attributes.put(TextAttribute.class.getDeclaredField("KERNING").get(null), TextAttribute.class.getDeclaredField( "KERNING_ON").get(null)); } catch (Exception ignored) { } font = baseFont.deriveFont(attributes); FontMetrics metrics = GlyphPage.getScratchGraphics().getFontMetrics(font); ascent = metrics.getAscent(); descent = metrics.getDescent(); leading = metrics.getLeading(); // Determine width of space glyph (getGlyphPixelBounds gives a width of zero). char[] chars = " ".toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); spaceWidth = vector.getGlyphLogicalBounds(0).getBounds().width; } }
public class class_name { private void initializeFont(Font baseFont, int size, boolean bold, boolean italic) { Map attributes = baseFont.getAttributes(); attributes.put(TextAttribute.SIZE, new Float(size)); attributes.put(TextAttribute.WEIGHT, bold ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR); attributes.put(TextAttribute.POSTURE, italic ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR); try { attributes.put(TextAttribute.class.getDeclaredField("KERNING").get(null), TextAttribute.class.getDeclaredField( "KERNING_ON").get(null)); // depends on control dependency: [try], data = [none] } catch (Exception ignored) { } // depends on control dependency: [catch], data = [none] font = baseFont.deriveFont(attributes); FontMetrics metrics = GlyphPage.getScratchGraphics().getFontMetrics(font); ascent = metrics.getAscent(); descent = metrics.getDescent(); leading = metrics.getLeading(); // Determine width of space glyph (getGlyphPixelBounds gives a width of zero). char[] chars = " ".toCharArray(); GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT); spaceWidth = vector.getGlyphLogicalBounds(0).getBounds().width; } }
public class class_name { public static void writeFile(String filename, String code){ try { FileOutputStream fidout = new FileOutputStream(filename); fidout.write(code.getBytes()); fidout.close(); } catch (Exception e) { System.err.println(e); } } }
public class class_name { public static void writeFile(String filename, String code){ try { FileOutputStream fidout = new FileOutputStream(filename); fidout.write(code.getBytes()); // depends on control dependency: [try], data = [none] fidout.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String getFirstPageUrl(String domain, String region) { if (firstPageUrl != null) { return firstPageUrl; } return urlFromUri(domain, region, firstPageUri); } }
public class class_name { public String getFirstPageUrl(String domain, String region) { if (firstPageUrl != null) { return firstPageUrl; // depends on control dependency: [if], data = [none] } return urlFromUri(domain, region, firstPageUri); } }
public class class_name { @Override public void write(TextWriterStream out, String label, Object object) { String res = (label != null) ? label + "=" : ""; if(object != null) { if(label != null) { res += object.toString().replace(" ", ""); } else { res += object.toString(); } } out.inlinePrintNoQuotes(res); } }
public class class_name { @Override public void write(TextWriterStream out, String label, Object object) { String res = (label != null) ? label + "=" : ""; if(object != null) { if(label != null) { res += object.toString().replace(" ", ""); // depends on control dependency: [if], data = [none] } else { res += object.toString(); // depends on control dependency: [if], data = [none] } } out.inlinePrintNoQuotes(res); } }
public class class_name { public WorkgroupQueue getQueue(String queueName) { Resourcepart queueNameResourcepart; try { queueNameResourcepart = Resourcepart.from(queueName); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } return getQueue(queueNameResourcepart); } }
public class class_name { public WorkgroupQueue getQueue(String queueName) { Resourcepart queueNameResourcepart; try { queueNameResourcepart = Resourcepart.from(queueName); // depends on control dependency: [try], data = [none] } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] return getQueue(queueNameResourcepart); } }
public class class_name { public static final boolean isInstance(SoyType type, SoyValue value, SourceLocation location) { switch (type.getKind()) { case ANY: case UNKNOWN: return true; case ATTRIBUTES: return isSanitizedofKind(value, ContentKind.ATTRIBUTES); case CSS: return isSanitizedofKind(value, ContentKind.CSS); case BOOL: return value instanceof BooleanData; case FLOAT: return value instanceof FloatData; case HTML: return isSanitizedofKind(value, ContentKind.HTML); case INT: return value instanceof IntegerData; case JS: return isSanitizedofKind(value, ContentKind.JS); case LIST: return value instanceof SoyList; case MAP: return value instanceof SoyMap; case LEGACY_OBJECT_MAP: return value instanceof SoyLegacyObjectMap; case NULL: return value == NullData.INSTANCE || value == UndefinedData.INSTANCE; case PROTO: // proto descriptors use instance equality. return value instanceof SoyProtoValue && ((SoyProtoValue) value).getProto().getDescriptorForType() == ((SoyProtoType) type).getDescriptor(); case PROTO_ENUM: // TODO(lukes): this should also assert that the value is in range return value instanceof IntegerData; case RECORD: return value instanceof SoyRecord; case STRING: if (Flags.stringIsNotSanitizedContent()) { return value instanceof SoyString; } else { if (value instanceof SoyString && value instanceof SanitizedContent && ((SanitizedContent) value).getContentKind() != ContentKind.TEXT && logger.isLoggable(Level.WARNING)) { logger.log( Level.WARNING, String.format( "Passing in sanitized content into a template that accepts only string is " + "forbidden. Please modify the template at %s to take in " + "%s instead of just %s.", location != null ? location.toString() : "unknown", ((SanitizedContent) value).getContentKind(), type.toString())); } return value instanceof SoyString || value instanceof SanitizedContent; } case TRUSTED_RESOURCE_URI: return isSanitizedofKind(value, ContentKind.TRUSTED_RESOURCE_URI); case UNION: for (SoyType memberType : ((UnionType) type).getMembers()) { if (isInstance(memberType, value, location)) { return true; } } return false; case URI: return isSanitizedofKind(value, ContentKind.URI); case VE: case VE_DATA: // Dynamic VE support is minimally implemented in Tofu: ve and ve_data objects are always // null. return value == NullData.INSTANCE; case ERROR: // continue } throw new AssertionError("invalid type: " + type); } }
public class class_name { public static final boolean isInstance(SoyType type, SoyValue value, SourceLocation location) { switch (type.getKind()) { case ANY: case UNKNOWN: return true; case ATTRIBUTES: return isSanitizedofKind(value, ContentKind.ATTRIBUTES); case CSS: return isSanitizedofKind(value, ContentKind.CSS); case BOOL: return value instanceof BooleanData; case FLOAT: return value instanceof FloatData; case HTML: return isSanitizedofKind(value, ContentKind.HTML); case INT: return value instanceof IntegerData; case JS: return isSanitizedofKind(value, ContentKind.JS); case LIST: return value instanceof SoyList; case MAP: return value instanceof SoyMap; case LEGACY_OBJECT_MAP: return value instanceof SoyLegacyObjectMap; case NULL: return value == NullData.INSTANCE || value == UndefinedData.INSTANCE; case PROTO: // proto descriptors use instance equality. return value instanceof SoyProtoValue && ((SoyProtoValue) value).getProto().getDescriptorForType() == ((SoyProtoType) type).getDescriptor(); case PROTO_ENUM: // TODO(lukes): this should also assert that the value is in range return value instanceof IntegerData; case RECORD: return value instanceof SoyRecord; case STRING: if (Flags.stringIsNotSanitizedContent()) { return value instanceof SoyString; // depends on control dependency: [if], data = [none] } else { if (value instanceof SoyString && value instanceof SanitizedContent && ((SanitizedContent) value).getContentKind() != ContentKind.TEXT && logger.isLoggable(Level.WARNING)) { logger.log( Level.WARNING, String.format( "Passing in sanitized content into a template that accepts only string is " + "forbidden. Please modify the template at %s to take in " + "%s instead of just %s.", location != null ? location.toString() : "unknown", ((SanitizedContent) value).getContentKind(), type.toString())); // depends on control dependency: [if], data = [none] } return value instanceof SoyString || value instanceof SanitizedContent; // depends on control dependency: [if], data = [none] } case TRUSTED_RESOURCE_URI: return isSanitizedofKind(value, ContentKind.TRUSTED_RESOURCE_URI); case UNION: for (SoyType memberType : ((UnionType) type).getMembers()) { if (isInstance(memberType, value, location)) { return true; // depends on control dependency: [if], data = [none] } } return false; case URI: return isSanitizedofKind(value, ContentKind.URI); case VE: case VE_DATA: // Dynamic VE support is minimally implemented in Tofu: ve and ve_data objects are always // null. return value == NullData.INSTANCE; case ERROR: // continue } throw new AssertionError("invalid type: " + type); } }
public class class_name { public void marshall(KinesisStreamsInputUpdate kinesisStreamsInputUpdate, ProtocolMarshaller protocolMarshaller) { if (kinesisStreamsInputUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(kinesisStreamsInputUpdate.getResourceARNUpdate(), RESOURCEARNUPDATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(KinesisStreamsInputUpdate kinesisStreamsInputUpdate, ProtocolMarshaller protocolMarshaller) { if (kinesisStreamsInputUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(kinesisStreamsInputUpdate.getResourceARNUpdate(), RESOURCEARNUPDATE_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 { private void cleanTable() { lock.lock(); try { Reference<? extends TransactionConfidence> ref; while ((ref = referenceQueue.poll()) != null) { // Find which transaction got deleted by the GC. WeakConfidenceReference txRef = (WeakConfidenceReference) ref; // And remove the associated map entry so the other bits of memory can also be reclaimed. table.remove(txRef.hash); } } finally { lock.unlock(); } } }
public class class_name { private void cleanTable() { lock.lock(); try { Reference<? extends TransactionConfidence> ref; // depends on control dependency: [try], data = [none] while ((ref = referenceQueue.poll()) != null) { // Find which transaction got deleted by the GC. WeakConfidenceReference txRef = (WeakConfidenceReference) ref; // And remove the associated map entry so the other bits of memory can also be reclaimed. table.remove(txRef.hash); // depends on control dependency: [while], data = [none] } } finally { lock.unlock(); } } }
public class class_name { @SuppressWarnings("unchecked") private T getService(boolean throwException) { T svc = null; ReferenceTuple<T> current = null; ReferenceTuple<T> newTuple = null; do { // Get the current tuple current = tuple.get(); // We have both a context and a service reference.. svc = current.locatedService; if (svc != null) { break; // break out. We know the answer, yes } // If we're missing the required bits, bail... if (current.context == null || current.serviceRef == null) { if (throwException) throw new IllegalStateException("Required attribute is null," + toString()); break; // break out. Nothing more to do here } // We have to locate / resolve the service from the reference SecurityManager sm = System.getSecurityManager(); if (sm != null) { final ReferenceTuple<T> finalCurrent = current; svc = AccessController.doPrivileged(new PrivilegedAction<T>() { @Override public T run() { return finalCurrent.context.locateService(referenceName, finalCurrent.serviceRef); } }); } else { svc = current.context.locateService(referenceName, current.serviceRef); } // if we're asked to throw, throw if we couldn't find the service if (svc == null) { if (throwException) throw new IllegalStateException("Located service is null," + toString()); break; // break out. Nothing more to do here } // Create a new tuple: keep the context and reference, set the cached service newTuple = new ReferenceTuple<T>(current.context, current.serviceRef, svc); // Try to save the new tuple: retry if someone changed the value meanwhile } while (!tuple.compareAndSet(current, newTuple)); return svc; } }
public class class_name { @SuppressWarnings("unchecked") private T getService(boolean throwException) { T svc = null; ReferenceTuple<T> current = null; ReferenceTuple<T> newTuple = null; do { // Get the current tuple current = tuple.get(); // We have both a context and a service reference.. svc = current.locatedService; if (svc != null) { break; // break out. We know the answer, yes } // If we're missing the required bits, bail... if (current.context == null || current.serviceRef == null) { if (throwException) throw new IllegalStateException("Required attribute is null," + toString()); break; // break out. Nothing more to do here } // We have to locate / resolve the service from the reference SecurityManager sm = System.getSecurityManager(); if (sm != null) { final ReferenceTuple<T> finalCurrent = current; svc = AccessController.doPrivileged(new PrivilegedAction<T>() { @Override public T run() { return finalCurrent.context.locateService(referenceName, finalCurrent.serviceRef); } }); // depends on control dependency: [if], data = [none] } else { svc = current.context.locateService(referenceName, current.serviceRef); // depends on control dependency: [if], data = [none] } // if we're asked to throw, throw if we couldn't find the service if (svc == null) { if (throwException) throw new IllegalStateException("Located service is null," + toString()); break; // break out. Nothing more to do here } // Create a new tuple: keep the context and reference, set the cached service newTuple = new ReferenceTuple<T>(current.context, current.serviceRef, svc); // Try to save the new tuple: retry if someone changed the value meanwhile } while (!tuple.compareAndSet(current, newTuple)); return svc; } }
public class class_name { @Override public Enumeration<String> getHeaderNames() { List<String> names = this.request.getHeaderNames(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getHeaderNames: " + names.size()); } return Collections.enumeration(names); } }
public class class_name { @Override public Enumeration<String> getHeaderNames() { List<String> names = this.request.getHeaderNames(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getHeaderNames: " + names.size()); // depends on control dependency: [if], data = [none] } return Collections.enumeration(names); } }
public class class_name { private void maybeIndexResource(String relPath, URL delegate) { if (!index.containsKey(relPath)) { index.put(relPath, delegate); if (relPath.endsWith(File.separator)) { maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate); } } } }
public class class_name { private void maybeIndexResource(String relPath, URL delegate) { if (!index.containsKey(relPath)) { index.put(relPath, delegate); // depends on control dependency: [if], data = [none] if (relPath.endsWith(File.separator)) { maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setResourceUrl(URL resourceUrl) { Assert.isNotNull(resourceUrl); endRequest(); URL oldOriginServerUrl = null; URL newOriginServerUrl = null; try { oldOriginServerUrl = new URL(this.resourceUrl.getProtocol(), this.resourceUrl.getHost(), this.resourceUrl.getPort(), "/"); //$NON-NLS-1$ newOriginServerUrl = new URL(resourceUrl.getProtocol(), resourceUrl.getHost(), resourceUrl.getPort(), "/"); //$NON-NLS-1$ } catch (MalformedURLException e) { // ignore? } if (!oldOriginServerUrl.equals(newOriginServerUrl)) { try { close(); } catch (IOException e) { // ignore? } } this.resourceUrl = resourceUrl; } }
public class class_name { public void setResourceUrl(URL resourceUrl) { Assert.isNotNull(resourceUrl); endRequest(); URL oldOriginServerUrl = null; URL newOriginServerUrl = null; try { oldOriginServerUrl = new URL(this.resourceUrl.getProtocol(), this.resourceUrl.getHost(), this.resourceUrl.getPort(), "/"); //$NON-NLS-1$ // depends on control dependency: [try], data = [none] newOriginServerUrl = new URL(resourceUrl.getProtocol(), resourceUrl.getHost(), resourceUrl.getPort(), "/"); //$NON-NLS-1$ // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { // ignore? } // depends on control dependency: [catch], data = [none] if (!oldOriginServerUrl.equals(newOriginServerUrl)) { try { close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // ignore? } // depends on control dependency: [catch], data = [none] } this.resourceUrl = resourceUrl; } }
public class class_name { public EConvResult convert(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags) { started = true; if (in == null || inPtr == null) { in = NULL_STRING; inPtr = Ptr.NULL; inStop = 0; } if (out == null || outPtr == null) { out = NULL_STRING; outPtr = Ptr.NULL; outStop = 0; } resume: while (true) { EConvResult ret = convertInternal(in, inPtr, inStop, out, outPtr, outStop, flags); if (ret.isInvalidByteSequence() || ret.isIncompleteInput()) { switch (this.flags & INVALID_MASK) { case INVALID_REPLACE: if (outputReplacementCharacter() == 0) continue resume; } } if (ret.isUndefinedConversion()) { switch (this.flags & UNDEF_MASK) { case UNDEF_REPLACE: if (outputReplacementCharacter() == 0) continue resume; break; case UNDEF_HEX_CHARREF: if (outputHexCharref() == 0) continue resume; break; } } return ret; } } }
public class class_name { public EConvResult convert(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags) { started = true; if (in == null || inPtr == null) { in = NULL_STRING; // depends on control dependency: [if], data = [none] inPtr = Ptr.NULL; // depends on control dependency: [if], data = [none] inStop = 0; // depends on control dependency: [if], data = [none] } if (out == null || outPtr == null) { out = NULL_STRING; // depends on control dependency: [if], data = [none] outPtr = Ptr.NULL; // depends on control dependency: [if], data = [none] outStop = 0; // depends on control dependency: [if], data = [none] } resume: while (true) { EConvResult ret = convertInternal(in, inPtr, inStop, out, outPtr, outStop, flags); if (ret.isInvalidByteSequence() || ret.isIncompleteInput()) { switch (this.flags & INVALID_MASK) { case INVALID_REPLACE: if (outputReplacementCharacter() == 0) continue resume; } } if (ret.isUndefinedConversion()) { switch (this.flags & UNDEF_MASK) { case UNDEF_REPLACE: if (outputReplacementCharacter() == 0) continue resume; break; case UNDEF_HEX_CHARREF: if (outputHexCharref() == 0) continue resume; break; } } return ret; // depends on control dependency: [while], data = [none] } } }
public class class_name { @Override public void run() { boolean isValid = false; try { _socket.getChannel().configureBlocking(true); /* EndpointReaderWebSocket wsEndpointReader = _client.getEndpointReader(); do { if (! wsEndpointReader.onRead()) { return; } } while (wsEndpointReader.isReadAvailable() && ! _client.isClosed()); isValid = ! _client.isClosed(); if (isValid) { registerKeepalive(); } */ } catch (Exception e) { e.printStackTrace(); log.log(Level.WARNING, e.toString(), e); } finally { if (! isValid) { _client.close(); } } } }
public class class_name { @Override public void run() { boolean isValid = false; try { _socket.getChannel().configureBlocking(true); // depends on control dependency: [try], data = [none] /* EndpointReaderWebSocket wsEndpointReader = _client.getEndpointReader(); do { if (! wsEndpointReader.onRead()) { return; } } while (wsEndpointReader.isReadAvailable() && ! _client.isClosed()); isValid = ! _client.isClosed(); if (isValid) { registerKeepalive(); } */ } catch (Exception e) { e.printStackTrace(); log.log(Level.WARNING, e.toString(), e); } finally { // depends on control dependency: [catch], data = [none] if (! isValid) { _client.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setPatchFilters(java.util.Collection<PatchFilter> patchFilters) { if (patchFilters == null) { this.patchFilters = null; return; } this.patchFilters = new com.amazonaws.internal.SdkInternalList<PatchFilter>(patchFilters); } }
public class class_name { public void setPatchFilters(java.util.Collection<PatchFilter> patchFilters) { if (patchFilters == null) { this.patchFilters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.patchFilters = new com.amazonaws.internal.SdkInternalList<PatchFilter>(patchFilters); } }
public class class_name { @Override public Boolean getRequestValue(final Request request) { if (isPresent(request)) { String aText = request.getParameter(getId()); return "true".equals(aText); } else { return getValue(); } } }
public class class_name { @Override public Boolean getRequestValue(final Request request) { if (isPresent(request)) { String aText = request.getParameter(getId()); return "true".equals(aText); // depends on control dependency: [if], data = [none] } else { return getValue(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <T> List<T> getUnique(Collection<T> collection) { HashSet<T> set = new HashSet<>(); List<T> out = new ArrayList<>(); for (T t : collection) { if (!set.contains(t)) { out.add(t); set.add(t); } } return out; } }
public class class_name { public static <T> List<T> getUnique(Collection<T> collection) { HashSet<T> set = new HashSet<>(); List<T> out = new ArrayList<>(); for (T t : collection) { if (!set.contains(t)) { out.add(t); // depends on control dependency: [if], data = [none] set.add(t); // depends on control dependency: [if], data = [none] } } return out; } }
public class class_name { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Date) ) { throw new SuperCsvCellProcessorException(Date.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } String result = formatter.format((Date) value); return next.execute(result, context); } }
public class class_name { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Date) ) { throw new SuperCsvCellProcessorException(Date.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); // depends on control dependency: [try], data = [none] } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } // depends on control dependency: [catch], data = [none] String result = formatter.format((Date) value); return next.execute(result, context); } }
public class class_name { public LocalDate getLocalDate(final int index) { if (_values[index] == null || _values[index].isEmpty()) { return null; } else { return LocalDate.parse(_values[index], DATE_FORMATTER); } } }
public class class_name { public LocalDate getLocalDate(final int index) { if (_values[index] == null || _values[index].isEmpty()) { return null; // depends on control dependency: [if], data = [none] } else { return LocalDate.parse(_values[index], DATE_FORMATTER); // depends on control dependency: [if], data = [(_values[index]] } } }
public class class_name { public void onConnected(int serverSessionTimeout, String sessionId, byte[] sessionPassword, int serverId) { if (serverSessionTimeout <= 0) { closeSession(); LOGGER.error("Unable to reconnect to Directory Server, session 0x" + sessionId + " has expired"); return; } boolean reopen = session.id == null || session.id.equals("") ? false : true; session.timeOut = serverSessionTimeout; session.id = sessionId; session.password = sessionPassword; session.serverId = serverId; if(getStatus().isAlive()){ setStatus(ConnectionStatus.CONNECTED); } if(reopen){ eventThread.queueClientEvent(new ClientSessionEvent(SessionEvent.REOPEN)); } else { eventThread.queueClientEvent(new ClientSessionEvent(SessionEvent.CREATED)); } LOGGER.info("Session establishment complete on server " + this.clientSocket.getRemoteSocketAddress() + ", sessionid = 0x" + sessionId + ", session timeout = " + session.timeOut + ", serverId=" + session.serverId); } }
public class class_name { public void onConnected(int serverSessionTimeout, String sessionId, byte[] sessionPassword, int serverId) { if (serverSessionTimeout <= 0) { closeSession(); // depends on control dependency: [if], data = [none] LOGGER.error("Unable to reconnect to Directory Server, session 0x" + sessionId + " has expired"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } boolean reopen = session.id == null || session.id.equals("") ? false : true; session.timeOut = serverSessionTimeout; session.id = sessionId; session.password = sessionPassword; session.serverId = serverId; if(getStatus().isAlive()){ setStatus(ConnectionStatus.CONNECTED); // depends on control dependency: [if], data = [none] } if(reopen){ eventThread.queueClientEvent(new ClientSessionEvent(SessionEvent.REOPEN)); // depends on control dependency: [if], data = [none] } else { eventThread.queueClientEvent(new ClientSessionEvent(SessionEvent.CREATED)); // depends on control dependency: [if], data = [none] } LOGGER.info("Session establishment complete on server " + this.clientSocket.getRemoteSocketAddress() + ", sessionid = 0x" + sessionId + ", session timeout = " + session.timeOut + ", serverId=" + session.serverId); } }
public class class_name { @Override public int indexOf(Object o) { if (getClass().isAssignableFrom(o.getClass())) { T str = $.cast(o); return indexOf(str); } else if (o instanceof CharSequence) { CharSequence str = (CharSequence) o; return indexOf(str); } else if (o instanceof Character) { Character c = (Character) o; return indexOf((int) c); } else if (o instanceof Integer) { Integer n = (Integer) o; return indexOf(n); } return -1; } }
public class class_name { @Override public int indexOf(Object o) { if (getClass().isAssignableFrom(o.getClass())) { T str = $.cast(o); return indexOf(str); // depends on control dependency: [if], data = [none] } else if (o instanceof CharSequence) { CharSequence str = (CharSequence) o; return indexOf(str); // depends on control dependency: [if], data = [none] } else if (o instanceof Character) { Character c = (Character) o; return indexOf((int) c); // depends on control dependency: [if], data = [none] } else if (o instanceof Integer) { Integer n = (Integer) o; return indexOf(n); // depends on control dependency: [if], data = [none] } return -1; } }
public class class_name { public void deselectByValue(String value) { getDispatcher().beforeDeselect(this, value); new Select(getElement()).deselectByValue(value); if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) { logUIActions(UIActions.CLEARED, value); } getDispatcher().afterDeselect(this, value); } }
public class class_name { public void deselectByValue(String value) { getDispatcher().beforeDeselect(this, value); new Select(getElement()).deselectByValue(value); if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) { logUIActions(UIActions.CLEARED, value); // depends on control dependency: [if], data = [none] } getDispatcher().afterDeselect(this, value); } }
public class class_name { public synchronized void resume() { if (!paused) { Util.w(TAG, "require resume this queue(remain " + taskList.size() + "), but it is" + " still running"); return; } paused = false; if (!taskList.isEmpty() && !looping) { looping = true; startNewLooper(); } } }
public class class_name { public synchronized void resume() { if (!paused) { Util.w(TAG, "require resume this queue(remain " + taskList.size() + "), but it is" + " still running"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } paused = false; if (!taskList.isEmpty() && !looping) { looping = true; // depends on control dependency: [if], data = [none] startNewLooper(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addMetadataProvider(MetadataProvider provider) { if (provider instanceof MetadataCache) { throw new IllegalArgumentException("Do not register MetadataCache instances using addMetadataProvider(), use attachMetadataCache() or addAutoAttachCacheFile() instead."); } List<MediaDetails> supportedMedia = provider.supportedMedia(); if (supportedMedia == null || supportedMedia.isEmpty()) { addMetadataProviderForMedia("", provider); } else { for (MediaDetails details : supportedMedia) { addMetadataProviderForMedia(details.hashKey(), provider); } } } }
public class class_name { public void addMetadataProvider(MetadataProvider provider) { if (provider instanceof MetadataCache) { throw new IllegalArgumentException("Do not register MetadataCache instances using addMetadataProvider(), use attachMetadataCache() or addAutoAttachCacheFile() instead."); } List<MediaDetails> supportedMedia = provider.supportedMedia(); if (supportedMedia == null || supportedMedia.isEmpty()) { addMetadataProviderForMedia("", provider); // depends on control dependency: [if], data = [none] } else { for (MediaDetails details : supportedMedia) { addMetadataProviderForMedia(details.hashKey(), provider); // depends on control dependency: [for], data = [details] } } } }
public class class_name { private void releaseReferences() { for (SSTableReader sstable : sstables) { sstable.selfRef().release(); assert sstable.selfRef().globalCount() == 0; } } }
public class class_name { private void releaseReferences() { for (SSTableReader sstable : sstables) { sstable.selfRef().release(); // depends on control dependency: [for], data = [sstable] assert sstable.selfRef().globalCount() == 0; } } }
public class class_name { public void info(String message, Object... args) { if (isInfoEnabled()) { info(String.format(message, args), getThrowable(args)); } } }
public class class_name { public void info(String message, Object... args) { if (isInfoEnabled()) { info(String.format(message, args), getThrowable(args)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addRegion(Region region) { if (!regions.contains(region)) { if (serviceConnected) { try { beaconManager.startMonitoringBeaconsInRegion(region); } catch (RemoteException e) { LogManager.e(e, TAG, "Can't add bootstrap region"); } } else { LogManager.w(TAG, "Adding a region: service not yet Connected"); } regions.add(region); } } }
public class class_name { public void addRegion(Region region) { if (!regions.contains(region)) { if (serviceConnected) { try { beaconManager.startMonitoringBeaconsInRegion(region); // depends on control dependency: [try], data = [none] } catch (RemoteException e) { LogManager.e(e, TAG, "Can't add bootstrap region"); } // depends on control dependency: [catch], data = [none] } else { LogManager.w(TAG, "Adding a region: service not yet Connected"); // depends on control dependency: [if], data = [none] } regions.add(region); // depends on control dependency: [if], data = [none] } } }
public class class_name { void give(NGSession session) { synchronized (lock) { if (done) { // session is already signalled shutdown and removed from all collections return; } workingPool.remove(session); if (idlePool.size() < maxIdleSessions) { idlePool.add(session); return; } } session.shutdown(); } }
public class class_name { void give(NGSession session) { synchronized (lock) { if (done) { // session is already signalled shutdown and removed from all collections return; // depends on control dependency: [if], data = [none] } workingPool.remove(session); if (idlePool.size() < maxIdleSessions) { idlePool.add(session); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } session.shutdown(); } }
public class class_name { public static Client getInstance() { if(instance == null) { instance = new Client(); } instance.API_PORT = PortSingleton.getInstance().getPort(); return instance; } }
public class class_name { public static Client getInstance() { if(instance == null) { instance = new Client(); // depends on control dependency: [if], data = [none] } instance.API_PORT = PortSingleton.getInstance().getPort(); return instance; } }
public class class_name { private List<ResourceRequirement> getSortedInstances(Set<String> componentNames) { List<ResourceRequirement> resourceRequirements = new ArrayList<>(); for (String componentName : componentNames) { Resource requiredResource = this.componentResourceMap.getOrDefault(componentName, defaultInstanceResources); resourceRequirements.add(new ResourceRequirement(componentName, requiredResource.getRam(), requiredResource.getCpu())); } Collections.sort(resourceRequirements, sortingStrategy.reversed()); return resourceRequirements; } }
public class class_name { private List<ResourceRequirement> getSortedInstances(Set<String> componentNames) { List<ResourceRequirement> resourceRequirements = new ArrayList<>(); for (String componentName : componentNames) { Resource requiredResource = this.componentResourceMap.getOrDefault(componentName, defaultInstanceResources); resourceRequirements.add(new ResourceRequirement(componentName, requiredResource.getRam(), requiredResource.getCpu())); // depends on control dependency: [for], data = [none] } Collections.sort(resourceRequirements, sortingStrategy.reversed()); return resourceRequirements; } }
public class class_name { public float remainingHeight() { float result = 0f; for (Iterator i = images.iterator(); i.hasNext();) { Image image = (Image) i.next(); result += image.getScaledHeight(); } return remainingLinesHeight() + cellspacing + 2 * cellpadding + result; } }
public class class_name { public float remainingHeight() { float result = 0f; for (Iterator i = images.iterator(); i.hasNext();) { Image image = (Image) i.next(); result += image.getScaledHeight(); // depends on control dependency: [for], data = [none] } return remainingLinesHeight() + cellspacing + 2 * cellpadding + result; } }
public class class_name { void logContainerStateChangesAndReset() { ContainerStateChangeReport changeReport = createContainerStateChangeReport(true); if (changeReport != null) { final String msg = createChangeReportLogMessage(changeReport, false); ROOT_LOGGER.info(msg); } } }
public class class_name { void logContainerStateChangesAndReset() { ContainerStateChangeReport changeReport = createContainerStateChangeReport(true); if (changeReport != null) { final String msg = createChangeReportLogMessage(changeReport, false); ROOT_LOGGER.info(msg); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override protected String postcss(HttpServletRequest request, String css, IResource resource) throws IOException { final String sourceMethod = "postcss"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{css, resource}); } if (resource.getPath().toLowerCase().endsWith(LESS_SUFFIX)) { css = processLess(resource.getReferenceURI().toString(), css); if (inlineImports) { css = _inlineImports(request, css, resource, ""); //$NON-NLS-1$ } } css = super.postcss(request, css, resource); if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, css); } return css; } }
public class class_name { @Override protected String postcss(HttpServletRequest request, String css, IResource resource) throws IOException { final String sourceMethod = "postcss"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{css, resource}); } if (resource.getPath().toLowerCase().endsWith(LESS_SUFFIX)) { css = processLess(resource.getReferenceURI().toString(), css); if (inlineImports) { css = _inlineImports(request, css, resource, ""); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } } css = super.postcss(request, css, resource); if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, css); } return css; } }
public class class_name { private void append2slow( ) { final int CHUNK_SZ = 1 << H2O.LOG_CHK; if( _sparseLen > CHUNK_SZ ) throw new ArrayIndexOutOfBoundsException(_sparseLen); assert _ds==null; if(_ls != null && _ls.length > 0){ if(_id == null){ // check for sparseness int nzs = 0; for(int i = 0; i < _ls.length; ++i) if(_ls[i] != 0 || _xs[i] != 0)++nzs; if((nzs+1)*_sparseRatio < _len){ set_sparse(nzs); assert _sparseLen == 0 || _sparseLen <= _ls.length:"_sparseLen = " + _sparseLen + ", _ls.length = " + _ls.length + ", nzs = " + nzs + ", len2 = " + _len; assert _id.length == _ls.length; assert _sparseLen <= _len; return; } } else { // verify we're still sufficiently sparse if((_sparseRatio*(_sparseLen) >> 1) > _len) cancel_sparse(); else _id = MemoryManager.arrayCopyOf(_id,_sparseLen<<1); } _ls = MemoryManager.arrayCopyOf(_ls,_sparseLen<<1); _xs = MemoryManager.arrayCopyOf(_xs,_sparseLen<<1); } else { alloc_mantissa(4); alloc_exponent(4); if (_id != null) alloc_indices(4); } assert _sparseLen == 0 || _sparseLen < _ls.length:"_sparseLen = " + _sparseLen + ", _ls.length = " + _ls.length; assert _id == null || _id.length == _ls.length; assert _sparseLen <= _len; } }
public class class_name { private void append2slow( ) { final int CHUNK_SZ = 1 << H2O.LOG_CHK; if( _sparseLen > CHUNK_SZ ) throw new ArrayIndexOutOfBoundsException(_sparseLen); assert _ds==null; if(_ls != null && _ls.length > 0){ if(_id == null){ // check for sparseness int nzs = 0; for(int i = 0; i < _ls.length; ++i) if(_ls[i] != 0 || _xs[i] != 0)++nzs; if((nzs+1)*_sparseRatio < _len){ set_sparse(nzs); // depends on control dependency: [if], data = [none] assert _sparseLen == 0 || _sparseLen <= _ls.length:"_sparseLen = " + _sparseLen + ", _ls.length = " + _ls.length + ", nzs = " + nzs + ", len2 = " + _len; // depends on control dependency: [if], data = [none] assert _id.length == _ls.length; assert _sparseLen <= _len; return; // depends on control dependency: [if], data = [none] } } else { // verify we're still sufficiently sparse if((_sparseRatio*(_sparseLen) >> 1) > _len) cancel_sparse(); else _id = MemoryManager.arrayCopyOf(_id,_sparseLen<<1); } _ls = MemoryManager.arrayCopyOf(_ls,_sparseLen<<1); // depends on control dependency: [if], data = [(_ls] _xs = MemoryManager.arrayCopyOf(_xs,_sparseLen<<1); // depends on control dependency: [if], data = [none] } else { alloc_mantissa(4); // depends on control dependency: [if], data = [none] alloc_exponent(4); // depends on control dependency: [if], data = [none] if (_id != null) alloc_indices(4); } assert _sparseLen == 0 || _sparseLen < _ls.length:"_sparseLen = " + _sparseLen + ", _ls.length = " + _ls.length; assert _id == null || _id.length == _ls.length; assert _sparseLen <= _len; } }
public class class_name { protected StringBuilder constructAdditionalAuthParameters(Map<String, String> additionalParameters) { StringBuilder result = new StringBuilder(); if (additionalParameters != null && !additionalParameters.isEmpty()) { for (Map.Entry<String, String> entry : additionalParameters.entrySet()) { result.append("&") .append(entry.getKey()) .append("=") .append(entry.getValue()); } } return result; } }
public class class_name { protected StringBuilder constructAdditionalAuthParameters(Map<String, String> additionalParameters) { StringBuilder result = new StringBuilder(); if (additionalParameters != null && !additionalParameters.isEmpty()) { for (Map.Entry<String, String> entry : additionalParameters.entrySet()) { result.append("&") .append(entry.getKey()) .append("=") .append(entry.getValue()); // depends on control dependency: [for], data = [none] } } return result; } }
public class class_name { public boolean containsValue(final int value) { boolean found = false; if (value != initialValue) { final int[] entries = this.entries; @DoNotSub final int length = entries.length; for (@DoNotSub int i = 1; i < length; i += 2) { if (value == entries[i]) { found = true; break; } } } return found; } }
public class class_name { public boolean containsValue(final int value) { boolean found = false; if (value != initialValue) { final int[] entries = this.entries; @DoNotSub final int length = entries.length; for (@DoNotSub int i = 1; i < length; i += 2) { if (value == entries[i]) { found = true; // depends on control dependency: [if], data = [none] break; } } } return found; } }
public class class_name { protected void addChildren(CmsTreeItem parent, List<CmsGalleryTreeEntry> children, List<String> selectedGalleries) { if (children != null) { for (CmsGalleryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = createTreeItem(child, selectedGalleries, true); if ((selectedGalleries != null) && selectedGalleries.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedGalleries); } } } }
public class class_name { protected void addChildren(CmsTreeItem parent, List<CmsGalleryTreeEntry> children, List<String> selectedGalleries) { if (children != null) { for (CmsGalleryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = createTreeItem(child, selectedGalleries, true); if ((selectedGalleries != null) && selectedGalleries.contains(child.getPath())) { parent.setOpen(true); // depends on control dependency: [if], data = [none] openParents(parent); // depends on control dependency: [if], data = [none] } parent.addChild(treeItem); // depends on control dependency: [for], data = [none] addChildren(treeItem, child.getChildren(), selectedGalleries); // depends on control dependency: [for], data = [child] } } } }
public class class_name { static String pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final String attributeName; try { attributeName = context.getResources().getResourceEntryName(attributeId[0]); } catch (Resources.NotFoundException e) { // invalid attribute ID return null; } final int stringResourceId = attrs.getAttributeResourceValue(null, attributeName, -1); return stringResourceId > 0 ? context.getString(stringResourceId) : attrs.getAttributeValue(null, attributeName); } }
public class class_name { static String pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final String attributeName; try { attributeName = context.getResources().getResourceEntryName(attributeId[0]); // depends on control dependency: [try], data = [none] } catch (Resources.NotFoundException e) { // invalid attribute ID return null; } // depends on control dependency: [catch], data = [none] final int stringResourceId = attrs.getAttributeResourceValue(null, attributeName, -1); return stringResourceId > 0 ? context.getString(stringResourceId) : attrs.getAttributeValue(null, attributeName); } }
public class class_name { public void setSelected(final boolean selected) { if (selected) { if (isDisabled()) { throw new IllegalStateException("Cannot select a disabled radio button"); } getGroup().setSelectedValue(getValue()); } else if (isSelected()) { // Clear selection getGroup().setData(null); } } }
public class class_name { public void setSelected(final boolean selected) { if (selected) { if (isDisabled()) { throw new IllegalStateException("Cannot select a disabled radio button"); } getGroup().setSelectedValue(getValue()); // depends on control dependency: [if], data = [none] } else if (isSelected()) { // Clear selection getGroup().setData(null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean hasCycle(Graph<?> graph) { int numEdges = graph.edges().size(); if (numEdges == 0) { return false; // An edge-free graph is acyclic by definition. } if (!graph.isDirected() && numEdges >= graph.nodes().size()) { return true; // Optimization for the undirected case: at least one cycle must exist. } Map<Object, NodeVisitState> visitedNodes = Maps.newHashMapWithExpectedSize(graph.nodes().size()); for (Object node : graph.nodes()) { if (subgraphHasCycle(graph, visitedNodes, node, null)) { return true; } } return false; } }
public class class_name { public static boolean hasCycle(Graph<?> graph) { int numEdges = graph.edges().size(); if (numEdges == 0) { return false; // An edge-free graph is acyclic by definition. // depends on control dependency: [if], data = [none] } if (!graph.isDirected() && numEdges >= graph.nodes().size()) { return true; // Optimization for the undirected case: at least one cycle must exist. // depends on control dependency: [if], data = [none] } Map<Object, NodeVisitState> visitedNodes = Maps.newHashMapWithExpectedSize(graph.nodes().size()); for (Object node : graph.nodes()) { if (subgraphHasCycle(graph, visitedNodes, node, null)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static String status(final long status) { if (INITIALIZING == status) { return "INITIALIZING"; } if (ERRORED == status) { return "ERRORED"; } if (ACTIVE == status) { return "ACTIVE"; } if (CLOSING == status) { return "CLOSING"; } return "unknown id=" + status; } }
public class class_name { public static String status(final long status) { if (INITIALIZING == status) { return "INITIALIZING"; // depends on control dependency: [if], data = [none] } if (ERRORED == status) { return "ERRORED"; // depends on control dependency: [if], data = [none] } if (ACTIVE == status) { return "ACTIVE"; // depends on control dependency: [if], data = [none] } if (CLOSING == status) { return "CLOSING"; // depends on control dependency: [if], data = [none] } return "unknown id=" + status; } }
public class class_name { @Nonnull public static String[] mapToEnv(@Nonnull Map<String,String> m) { String[] r = new String[m.size()]; int idx=0; for (final Map.Entry<String,String> e : m.entrySet()) { r[idx++] = e.getKey() + '=' + e.getValue(); } return r; } }
public class class_name { @Nonnull public static String[] mapToEnv(@Nonnull Map<String,String> m) { String[] r = new String[m.size()]; int idx=0; for (final Map.Entry<String,String> e : m.entrySet()) { r[idx++] = e.getKey() + '=' + e.getValue(); // depends on control dependency: [for], data = [e] } return r; } }
public class class_name { protected ResourceBundleHandler initResourceBundleHandler() { ResourceBundleHandler rsHandler = null; if (jawrConfig.getUseBundleMapping() && StringUtils.isNotEmpty(jawrConfig.getJawrWorkingDirectory())) { rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getJawrWorkingDirectory(), jawrConfig.getResourceCharset(), jawrConfig.getGeneratorRegistry(), resourceType); } else { rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getResourceCharset(), jawrConfig.getGeneratorRegistry(), resourceType); } return rsHandler; } }
public class class_name { protected ResourceBundleHandler initResourceBundleHandler() { ResourceBundleHandler rsHandler = null; if (jawrConfig.getUseBundleMapping() && StringUtils.isNotEmpty(jawrConfig.getJawrWorkingDirectory())) { rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getJawrWorkingDirectory(), jawrConfig.getResourceCharset(), jawrConfig.getGeneratorRegistry(), resourceType); // depends on control dependency: [if], data = [none] } else { rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getResourceCharset(), jawrConfig.getGeneratorRegistry(), resourceType); // depends on control dependency: [if], data = [none] } return rsHandler; } }
public class class_name { @SuppressWarnings({"unchecked", "SpellCheckingInspection"}) List<Meeting> findBoringMeetings() { Query query = new Query(Meeting.class, new QueryCriteria("notes", QueryCriteriaOperator.CONTAINS, "Boring")); List<Meeting> boringMeetings = null; try { boringMeetings = persistenceManager.executeQuery(query); } catch (OnyxException e) { // Log an error } return boringMeetings; } }
public class class_name { @SuppressWarnings({"unchecked", "SpellCheckingInspection"}) List<Meeting> findBoringMeetings() { Query query = new Query(Meeting.class, new QueryCriteria("notes", QueryCriteriaOperator.CONTAINS, "Boring")); List<Meeting> boringMeetings = null; try { boringMeetings = persistenceManager.executeQuery(query); // depends on control dependency: [try], data = [none] } catch (OnyxException e) { // Log an error } // depends on control dependency: [catch], data = [none] return boringMeetings; } }
public class class_name { private void updateFromStack(Stack stack) { long startTime = System.currentTimeMillis(); // Update LocalPeer Peer sLocalPeer = stack.getMetaData().getLocalPeer(); localPeer.setUri(sLocalPeer.getUri().toString()); for (InetAddress ipAddress : sLocalPeer.getIPAddresses()) { localPeer.addIpAddress(ipAddress.getHostAddress()); } localPeer.setRealm(sLocalPeer.getRealmName()); localPeer.setVendorId(sLocalPeer.getVendorId()); localPeer.setProductName(sLocalPeer.getProductName()); localPeer.setFirmwareRev(sLocalPeer.getFirmware()); for (org.jdiameter.api.ApplicationId appId : sLocalPeer.getCommonApplications()) { if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { localPeer.addDefaultApplication(ApplicationIdJMX.createAuthApplicationId(appId.getVendorId(), appId.getAuthAppId())); } else { localPeer.addDefaultApplication(ApplicationIdJMX.createAcctApplicationId(appId.getVendorId(), appId.getAcctAppId())); } } HashMap<String, DiameterStatistic> lpStats = new HashMap<String, DiameterStatistic>(); for (StatisticRecord stat : ((IPeer) sLocalPeer).getStatistic().getRecords()) { lpStats.put(stat.getName(), new DiameterStatistic(stat.getName(), stat.getDescription(), stat.toString())); } localPeer.setStatistics(lpStats); MutableConfiguration config = (MutableConfiguration) stack.getMetaData().getConfiguration(); // Update Parameters this.parameters = new ParametersImpl(config); // Update Network ... // ... Peers (config) for (Configuration curPeer : config.getChildren(PeerTable.ordinal())) { String name = curPeer.getStringValue(PeerName.ordinal(), ""); Boolean attemptConnect = curPeer.getBooleanValue(PeerAttemptConnection.ordinal(), false); Integer rating = curPeer.getIntValue(PeerRating.ordinal(), 0); String ip = curPeer.getStringValue(PeerIp.ordinal(), null); String portRange = curPeer.getStringValue(PeerLocalPortRange.ordinal(), ""); Integer portRangeLow = null; Integer portRangeHigh = null; if (portRange != null && !portRange.equals("")) { String[] rng = portRange.trim().split("-"); portRangeLow = Integer.parseInt(rng[0]); portRangeHigh = Integer.parseInt(rng[1]); } String securityRef = curPeer.getStringValue(SecurityRef.ordinal(), ""); network.addPeer(new NetworkPeerImpl(name, attemptConnect, rating, ip, portRangeLow, portRangeHigh, securityRef)); } // ... More Peers (mutable) try { MutablePeerTable peerTable; peerTable = stack.unwrap(MutablePeerTable.class); //Peer p = n.addPeer("aaa://127.0.0.1:13868", "mobicents.org", true); for (Peer peer : peerTable.getPeerTable()) { PeerImpl p = (PeerImpl) peer; NetworkPeerImpl nPeer = new NetworkPeerImpl(p.getUri().toString(), p.isAttemptConnection(), p.getRating(), null, null, null, null); HashMap<String, DiameterStatistic> npStats = new HashMap<String, DiameterStatistic>(); for (StatisticRecord stat : p.getStatistic().getRecords()) { npStats.put(stat.getName(), new DiameterStatistic(stat.getName(), stat.getDescription(), stat.toString())); } nPeer.setStatistics(npStats); network.addPeer(nPeer); } } catch (InternalException e) { logger.error("Failed to update Diameter Configuration from Stack Mutable Peer Table", e); } // ... Realms (configuration) /*for(Configuration realmTable : config.getChildren(RealmTable.ordinal())) { for(Configuration curRealm : realmTable.getChildren(RealmEntry.ordinal())) { String name = curRealm.getStringValue(RealmName.ordinal(), ""); String hosts = curRealm.getStringValue(RealmHosts.ordinal(), "localhost"); ArrayList<String> peers = new ArrayList<String>(); for(String peer : hosts.split(",")) { peers.add(peer.trim()); } String localAction = curRealm.getStringValue(RealmLocalAction.ordinal(), "LOCAL"); Boolean dynamic = curRealm.getBooleanValue(RealmEntryIsDynamic.ordinal(), false); Long expTime = curRealm.getLongValue(RealmEntryExpTime.ordinal(), 0); Configuration[] sAppIds = curRealm.getChildren(ApplicationId.ordinal()); ArrayList<ApplicationIdJMX> appIds = new ArrayList<ApplicationIdJMX>(); for(Configuration appId : sAppIds) { Long acctAppId = appId.getLongValue(AcctApplId.ordinal(), 0); Long authAppId = appId.getLongValue(AuthApplId.ordinal(), 0); Long vendorId = appId.getLongValue(VendorId.ordinal(), 0); if(authAppId != 0) { appIds.add(ApplicationIdJMX.createAuthApplicationId(vendorId, authAppId)); } else if (acctAppId != 0){ appIds.add(ApplicationIdJMX.createAcctApplicationId(vendorId, acctAppId)); } } network.addRealm(new RealmImpl(appIds, name, peers, localAction, dynamic, expTime)); } } */ // ... Realms (mutable) try { MutablePeerTableImpl mpt = (MutablePeerTableImpl) stack.unwrap(PeerTable.class); for (org.jdiameter.api.Realm realm : mpt.getAllRealms()) { IRealm irealm = null; if (realm instanceof IRealm) { irealm = (IRealm) realm; } ArrayList<ApplicationIdJMX> x = new ArrayList<ApplicationIdJMX>(); x.add(ApplicationIdJMX.fromApplicationId(realm.getApplicationId())); network.addRealm(new RealmImpl(x, realm.getName(), new ArrayList<String>(Arrays.asList(((IRealm) realm).getPeerNames())), realm.getLocalAction().toString(), irealm != null ? irealm.getAgentConfiguration() : null, realm.isDynamic(), realm.getExpirationTime())); } } catch (Exception e) { logger.error("Failed to update Diameter Configuration from Stack Mutable Peer Table", e); } long endTime = System.currentTimeMillis(); logger.debug("Info gathered in {}ms", (endTime - startTime)); } }
public class class_name { private void updateFromStack(Stack stack) { long startTime = System.currentTimeMillis(); // Update LocalPeer Peer sLocalPeer = stack.getMetaData().getLocalPeer(); localPeer.setUri(sLocalPeer.getUri().toString()); for (InetAddress ipAddress : sLocalPeer.getIPAddresses()) { localPeer.addIpAddress(ipAddress.getHostAddress()); // depends on control dependency: [for], data = [ipAddress] } localPeer.setRealm(sLocalPeer.getRealmName()); localPeer.setVendorId(sLocalPeer.getVendorId()); localPeer.setProductName(sLocalPeer.getProductName()); localPeer.setFirmwareRev(sLocalPeer.getFirmware()); for (org.jdiameter.api.ApplicationId appId : sLocalPeer.getCommonApplications()) { if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { localPeer.addDefaultApplication(ApplicationIdJMX.createAuthApplicationId(appId.getVendorId(), appId.getAuthAppId())); // depends on control dependency: [if], data = [none] } else { localPeer.addDefaultApplication(ApplicationIdJMX.createAcctApplicationId(appId.getVendorId(), appId.getAcctAppId())); // depends on control dependency: [if], data = [none] } } HashMap<String, DiameterStatistic> lpStats = new HashMap<String, DiameterStatistic>(); for (StatisticRecord stat : ((IPeer) sLocalPeer).getStatistic().getRecords()) { lpStats.put(stat.getName(), new DiameterStatistic(stat.getName(), stat.getDescription(), stat.toString())); // depends on control dependency: [for], data = [stat] } localPeer.setStatistics(lpStats); MutableConfiguration config = (MutableConfiguration) stack.getMetaData().getConfiguration(); // Update Parameters this.parameters = new ParametersImpl(config); // Update Network ... // ... Peers (config) for (Configuration curPeer : config.getChildren(PeerTable.ordinal())) { String name = curPeer.getStringValue(PeerName.ordinal(), ""); Boolean attemptConnect = curPeer.getBooleanValue(PeerAttemptConnection.ordinal(), false); Integer rating = curPeer.getIntValue(PeerRating.ordinal(), 0); String ip = curPeer.getStringValue(PeerIp.ordinal(), null); String portRange = curPeer.getStringValue(PeerLocalPortRange.ordinal(), ""); Integer portRangeLow = null; Integer portRangeHigh = null; if (portRange != null && !portRange.equals("")) { String[] rng = portRange.trim().split("-"); portRangeLow = Integer.parseInt(rng[0]); // depends on control dependency: [if], data = [none] portRangeHigh = Integer.parseInt(rng[1]); // depends on control dependency: [if], data = [none] } String securityRef = curPeer.getStringValue(SecurityRef.ordinal(), ""); network.addPeer(new NetworkPeerImpl(name, attemptConnect, rating, ip, portRangeLow, portRangeHigh, securityRef)); // depends on control dependency: [for], data = [none] } // ... More Peers (mutable) try { MutablePeerTable peerTable; peerTable = stack.unwrap(MutablePeerTable.class); // depends on control dependency: [try], data = [none] //Peer p = n.addPeer("aaa://127.0.0.1:13868", "mobicents.org", true); for (Peer peer : peerTable.getPeerTable()) { PeerImpl p = (PeerImpl) peer; NetworkPeerImpl nPeer = new NetworkPeerImpl(p.getUri().toString(), p.isAttemptConnection(), p.getRating(), null, null, null, null); HashMap<String, DiameterStatistic> npStats = new HashMap<String, DiameterStatistic>(); for (StatisticRecord stat : p.getStatistic().getRecords()) { npStats.put(stat.getName(), new DiameterStatistic(stat.getName(), stat.getDescription(), stat.toString())); // depends on control dependency: [for], data = [stat] } nPeer.setStatistics(npStats); // depends on control dependency: [for], data = [none] network.addPeer(nPeer); // depends on control dependency: [for], data = [none] } } catch (InternalException e) { logger.error("Failed to update Diameter Configuration from Stack Mutable Peer Table", e); } // depends on control dependency: [catch], data = [none] // ... Realms (configuration) /*for(Configuration realmTable : config.getChildren(RealmTable.ordinal())) { for(Configuration curRealm : realmTable.getChildren(RealmEntry.ordinal())) { String name = curRealm.getStringValue(RealmName.ordinal(), ""); String hosts = curRealm.getStringValue(RealmHosts.ordinal(), "localhost"); ArrayList<String> peers = new ArrayList<String>(); for(String peer : hosts.split(",")) { peers.add(peer.trim()); } String localAction = curRealm.getStringValue(RealmLocalAction.ordinal(), "LOCAL"); Boolean dynamic = curRealm.getBooleanValue(RealmEntryIsDynamic.ordinal(), false); Long expTime = curRealm.getLongValue(RealmEntryExpTime.ordinal(), 0); Configuration[] sAppIds = curRealm.getChildren(ApplicationId.ordinal()); ArrayList<ApplicationIdJMX> appIds = new ArrayList<ApplicationIdJMX>(); for(Configuration appId : sAppIds) { Long acctAppId = appId.getLongValue(AcctApplId.ordinal(), 0); Long authAppId = appId.getLongValue(AuthApplId.ordinal(), 0); Long vendorId = appId.getLongValue(VendorId.ordinal(), 0); if(authAppId != 0) { appIds.add(ApplicationIdJMX.createAuthApplicationId(vendorId, authAppId)); } else if (acctAppId != 0){ appIds.add(ApplicationIdJMX.createAcctApplicationId(vendorId, acctAppId)); } } network.addRealm(new RealmImpl(appIds, name, peers, localAction, dynamic, expTime)); } } */ // ... Realms (mutable) try { MutablePeerTableImpl mpt = (MutablePeerTableImpl) stack.unwrap(PeerTable.class); for (org.jdiameter.api.Realm realm : mpt.getAllRealms()) { IRealm irealm = null; if (realm instanceof IRealm) { irealm = (IRealm) realm; // depends on control dependency: [if], data = [none] } ArrayList<ApplicationIdJMX> x = new ArrayList<ApplicationIdJMX>(); x.add(ApplicationIdJMX.fromApplicationId(realm.getApplicationId())); // depends on control dependency: [for], data = [realm] network.addRealm(new RealmImpl(x, realm.getName(), new ArrayList<String>(Arrays.asList(((IRealm) realm).getPeerNames())), realm.getLocalAction().toString(), irealm != null ? irealm.getAgentConfiguration() : null, realm.isDynamic(), realm.getExpirationTime())); // depends on control dependency: [for], data = [realm] } } catch (Exception e) { logger.error("Failed to update Diameter Configuration from Stack Mutable Peer Table", e); } // depends on control dependency: [catch], data = [none] long endTime = System.currentTimeMillis(); logger.debug("Info gathered in {}ms", (endTime - startTime)); } }
public class class_name { public void marshall(GetGcmChannelRequest getGcmChannelRequest, ProtocolMarshaller protocolMarshaller) { if (getGcmChannelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getGcmChannelRequest.getApplicationId(), APPLICATIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetGcmChannelRequest getGcmChannelRequest, ProtocolMarshaller protocolMarshaller) { if (getGcmChannelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getGcmChannelRequest.getApplicationId(), APPLICATIONID_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 { private boolean isGuvnorResource(Object element) { if (element instanceof IResource) { return GuvnorMetadataUtils.findGuvnorMetadata((IResource)element) != null; } else { return false; } } }
public class class_name { private boolean isGuvnorResource(Object element) { if (element instanceof IResource) { return GuvnorMetadataUtils.findGuvnorMetadata((IResource)element) != null; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Deprecated public CmsResourceFilter addRequireType(int type) { if (type != -1) { CmsResourceFilter extendedFilter = (CmsResourceFilter)clone(); extendedFilter.m_type = type; extendedFilter.m_filterType = REQUIRED; extendedFilter.updateCacheId(); return extendedFilter; } return this; } }
public class class_name { @Deprecated public CmsResourceFilter addRequireType(int type) { if (type != -1) { CmsResourceFilter extendedFilter = (CmsResourceFilter)clone(); extendedFilter.m_type = type; // depends on control dependency: [if], data = [none] extendedFilter.m_filterType = REQUIRED; // depends on control dependency: [if], data = [none] extendedFilter.updateCacheId(); // depends on control dependency: [if], data = [none] return extendedFilter; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public boolean flushAllForDelete() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "flushAllForDelete"); synchronized (this) { // Flush may have completed, if so then return // without starting another one. if (flushedForDeleteSource) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", Boolean.TRUE); return true; } // Short circuit if flush already in progress if (deleteFlushSource != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", Boolean.FALSE); return false; } // Otherwise, we need to start a new flush final PtoPOutputHandler psOH = this; deleteFlushSource = new FlushComplete() { public void flushComplete(DestinationHandler destinationHandler) { // Remember that the flush completed for when we redrive // the delete code. synchronized (psOH) { psOH.flushedForDeleteSource = true; psOH.deleteFlushSource = null; } // Now redrive the actual deletion psOH.messageProcessor.getDestinationManager().startAsynchDeletion(); } }; } // Start the flush and return false try { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(tc, "Started PtoP source flush for destination: " + destinationHandler.getName()); startFlush(deleteFlushSource); } catch (FlushAlreadyInProgressException e) { // This shouldn't actually be possible so log it FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.flushAllForDelete", "1:2756:1.241", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", "FlushAlreadyInProgressException"); throw new SIResourceException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", Boolean.FALSE); return false; } }
public class class_name { public boolean flushAllForDelete() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "flushAllForDelete"); synchronized (this) { // Flush may have completed, if so then return // without starting another one. if (flushedForDeleteSource) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", Boolean.TRUE); return true; // depends on control dependency: [if], data = [none] } // Short circuit if flush already in progress if (deleteFlushSource != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", Boolean.FALSE); return false; // depends on control dependency: [if], data = [none] } // Otherwise, we need to start a new flush final PtoPOutputHandler psOH = this; deleteFlushSource = new FlushComplete() { public void flushComplete(DestinationHandler destinationHandler) { // Remember that the flush completed for when we redrive // the delete code. synchronized (psOH) { psOH.flushedForDeleteSource = true; psOH.deleteFlushSource = null; } // Now redrive the actual deletion psOH.messageProcessor.getDestinationManager().startAsynchDeletion(); } }; } // Start the flush and return false try { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(tc, "Started PtoP source flush for destination: " + destinationHandler.getName()); startFlush(deleteFlushSource); } catch (FlushAlreadyInProgressException e) { // This shouldn't actually be possible so log it FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.flushAllForDelete", "1:2756:1.241", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", "FlushAlreadyInProgressException"); throw new SIResourceException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "flushAllForDelete", Boolean.FALSE); return false; } }
public class class_name { private void broadcastError(final Exception exception) { Logger.info(LOG_TAG, "Broadcasting error for upload with ID: " + params.id + ". " + exception.getMessage()); final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes, totalBytes, (attempts - 1), successfullyUploadedFiles, pathStringListFrom(params.files)); final UploadNotificationConfig notificationConfig = params.notificationConfig; if (notificationConfig != null && notificationConfig.getError().message != null) { updateNotification(uploadInfo, notificationConfig.getError()); } BroadcastData data = new BroadcastData() .setStatus(BroadcastData.Status.ERROR) .setUploadInfo(uploadInfo) .setException(exception); final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id); if (delegate != null) { mainThreadHandler.post(new Runnable() { @Override public void run() { delegate.onError(service, uploadInfo, null, exception); } }); } else { service.sendBroadcast(data.getIntent()); } service.taskCompleted(params.id); } }
public class class_name { private void broadcastError(final Exception exception) { Logger.info(LOG_TAG, "Broadcasting error for upload with ID: " + params.id + ". " + exception.getMessage()); final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes, totalBytes, (attempts - 1), successfullyUploadedFiles, pathStringListFrom(params.files)); final UploadNotificationConfig notificationConfig = params.notificationConfig; if (notificationConfig != null && notificationConfig.getError().message != null) { updateNotification(uploadInfo, notificationConfig.getError()); // depends on control dependency: [if], data = [none] } BroadcastData data = new BroadcastData() .setStatus(BroadcastData.Status.ERROR) .setUploadInfo(uploadInfo) .setException(exception); final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id); if (delegate != null) { mainThreadHandler.post(new Runnable() { @Override public void run() { delegate.onError(service, uploadInfo, null, exception); } }); // depends on control dependency: [if], data = [none] } else { service.sendBroadcast(data.getIntent()); // depends on control dependency: [if], data = [none] } service.taskCompleted(params.id); } }
public class class_name { public ResponseInfo syncPut(File file, String key, String token, UploadOptions options) { final UpToken decodedToken = UpToken.parse(token); ResponseInfo info = areInvalidArg(key, null, file, token, decodedToken); if (info != null) { return info; } return FormUploader.syncUpload(client, config, file, key, decodedToken, options); } }
public class class_name { public ResponseInfo syncPut(File file, String key, String token, UploadOptions options) { final UpToken decodedToken = UpToken.parse(token); ResponseInfo info = areInvalidArg(key, null, file, token, decodedToken); if (info != null) { return info; // depends on control dependency: [if], data = [none] } return FormUploader.syncUpload(client, config, file, key, decodedToken, options); } }
public class class_name { private List<GempakParameter> makeParams(DMPart part) { List<GempakParameter> gemparms = new ArrayList<>(part.kparms); for (DMParam param : part.params) { String name = param.kprmnm; GempakParameter parm = GempakParameters.getParameter(name); if (parm == null) { //System.out.println("couldn't find " + name // + " in params table"); parm = new GempakParameter(1, name, name, "", 0); } gemparms.add(parm); } return gemparms; } }
public class class_name { private List<GempakParameter> makeParams(DMPart part) { List<GempakParameter> gemparms = new ArrayList<>(part.kparms); for (DMParam param : part.params) { String name = param.kprmnm; GempakParameter parm = GempakParameters.getParameter(name); if (parm == null) { //System.out.println("couldn't find " + name // + " in params table"); parm = new GempakParameter(1, name, name, "", 0); // depends on control dependency: [if], data = [none] } gemparms.add(parm); // depends on control dependency: [for], data = [none] } return gemparms; } }
public class class_name { public void mapRole(PdfName used, PdfName standard) { PdfDictionary rm = (PdfDictionary)get(PdfName.ROLEMAP); if (rm == null) { rm = new PdfDictionary(); put(PdfName.ROLEMAP, rm); } rm.put(used, standard); } }
public class class_name { public void mapRole(PdfName used, PdfName standard) { PdfDictionary rm = (PdfDictionary)get(PdfName.ROLEMAP); if (rm == null) { rm = new PdfDictionary(); // depends on control dependency: [if], data = [none] put(PdfName.ROLEMAP, rm); // depends on control dependency: [if], data = [none] } rm.put(used, standard); } }
public class class_name { public static double min(double[][] matrix) { double m = Double.POSITIVE_INFINITY; for (double[] x : matrix) { for (double y : x) { if (m > y) { m = y; } } } return m; } }
public class class_name { public static double min(double[][] matrix) { double m = Double.POSITIVE_INFINITY; for (double[] x : matrix) { for (double y : x) { if (m > y) { m = y; // depends on control dependency: [if], data = [none] } } } return m; } }
public class class_name { public void post(String jsonBody, Integer expectedResponseCode) throws IOException { HttpURLConnection conn = getUrlConnection(); try { // send post request with json body for the topology if (!NetworkUtils.sendHttpPostRequest(conn, NetworkUtils.JSON_TYPE, jsonBody.getBytes())) { throw new IOException("Failed to send POST to " + endpointURI); } // check the response if (!NetworkUtils.checkHttpResponseCode(conn, expectedResponseCode)) { byte[] bytes = NetworkUtils.readHttpResponse(conn); LOG.log(Level.SEVERE, "Failed to send POST request to endpoint"); LOG.log(Level.SEVERE, new String(bytes)); throw new IOException("Unexpected response from connection. Expected " + expectedResponseCode + " but received " + conn.getResponseCode()); } } finally { conn.disconnect(); } } }
public class class_name { public void post(String jsonBody, Integer expectedResponseCode) throws IOException { HttpURLConnection conn = getUrlConnection(); try { // send post request with json body for the topology if (!NetworkUtils.sendHttpPostRequest(conn, NetworkUtils.JSON_TYPE, jsonBody.getBytes())) { throw new IOException("Failed to send POST to " + endpointURI); } // check the response if (!NetworkUtils.checkHttpResponseCode(conn, expectedResponseCode)) { byte[] bytes = NetworkUtils.readHttpResponse(conn); LOG.log(Level.SEVERE, "Failed to send POST request to endpoint"); // depends on control dependency: [if], data = [none] LOG.log(Level.SEVERE, new String(bytes)); // depends on control dependency: [if], data = [none] throw new IOException("Unexpected response from connection. Expected " + expectedResponseCode + " but received " + conn.getResponseCode()); } } finally { conn.disconnect(); } } }
public class class_name { public boolean hasTransitionTo(CharRange condition, NFAState<T> state) { Set<Transition<NFAState<T>>> set = transitions.get(condition); if (set != null) { for (Transition<NFAState<T>> tr : set) { if (state.equals(tr.getTo())) { return true; } } } return false; } }
public class class_name { public boolean hasTransitionTo(CharRange condition, NFAState<T> state) { Set<Transition<NFAState<T>>> set = transitions.get(condition); if (set != null) { for (Transition<NFAState<T>> tr : set) { if (state.equals(tr.getTo())) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { protected String getBashVersionInfo() { String versionInfo = ""; try { String result[] = ExecUtil.execute("bash --version"); for(String line : result) { if(!line.isEmpty()) { versionInfo = line; // return only first output line of version info break; } } } catch (IOException|InterruptedException ioe) { ioe.printStackTrace(); } return versionInfo; } }
public class class_name { protected String getBashVersionInfo() { String versionInfo = ""; try { String result[] = ExecUtil.execute("bash --version"); for(String line : result) { if(!line.isEmpty()) { versionInfo = line; // return only first output line of version info // depends on control dependency: [if], data = [none] break; } } } catch (IOException|InterruptedException ioe) { ioe.printStackTrace(); } // depends on control dependency: [catch], data = [none] return versionInfo; } }
public class class_name { private void readHours(ProjectCalendar calendar, Day day, Integer hours) { int value = hours.intValue(); int startHour = 0; ProjectCalendarHours calendarHours = null; Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); calendar.setWorkingDay(day, false); while (value != 0) { // Move forward until we find a working hour while (startHour < 24 && (value & 0x1) == 0) { value = value >> 1; ++startHour; } // No more working hours, bail out if (startHour >= 24) { break; } // Move forward until we find the end of the working hours int endHour = startHour; while (endHour < 24 && (value & 0x1) != 0) { value = value >> 1; ++endHour; } cal.set(Calendar.HOUR_OF_DAY, startHour); Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, endHour); Date endDate = cal.getTime(); if (calendarHours == null) { calendarHours = calendar.addCalendarHours(day); calendar.setWorkingDay(day, true); } calendarHours.addRange(new DateRange(startDate, endDate)); startHour = endHour; } DateHelper.pushCalendar(cal); } }
public class class_name { private void readHours(ProjectCalendar calendar, Day day, Integer hours) { int value = hours.intValue(); int startHour = 0; ProjectCalendarHours calendarHours = null; Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); calendar.setWorkingDay(day, false); while (value != 0) { // Move forward until we find a working hour while (startHour < 24 && (value & 0x1) == 0) { value = value >> 1; // depends on control dependency: [while], data = [none] ++startHour; // depends on control dependency: [while], data = [none] } // No more working hours, bail out if (startHour >= 24) { break; } // Move forward until we find the end of the working hours int endHour = startHour; while (endHour < 24 && (value & 0x1) != 0) { value = value >> 1; // depends on control dependency: [while], data = [none] ++endHour; // depends on control dependency: [while], data = [none] } cal.set(Calendar.HOUR_OF_DAY, startHour); // depends on control dependency: [while], data = [none] Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, endHour); // depends on control dependency: [while], data = [none] Date endDate = cal.getTime(); if (calendarHours == null) { calendarHours = calendar.addCalendarHours(day); // depends on control dependency: [if], data = [none] calendar.setWorkingDay(day, true); // depends on control dependency: [if], data = [none] } calendarHours.addRange(new DateRange(startDate, endDate)); // depends on control dependency: [while], data = [none] startHour = endHour; // depends on control dependency: [while], data = [none] } DateHelper.pushCalendar(cal); } }
public class class_name { public boolean isBMO(boolean cache) { assert orderWeights.size() == 0; boolean bmo = true; final SortedSet<Integer> partitionWeights = new TreeSet<>(); final SortedMap<Integer, Integer> nbPartitionWeights = new TreeMap<>(); for (int i = 0; i < nSoft(); i++) { final int weight = softClauses.get(i).weight(); partitionWeights.add(weight); final Integer foundNB = nbPartitionWeights.get(weight); if (foundNB == null) nbPartitionWeights.put(weight, 1); else nbPartitionWeights.put(weight, foundNB + 1); } for (final int i : partitionWeights) orderWeights.push(i); orderWeights.sortReverse(); long totalWeights = 0; for (int i = 0; i < orderWeights.size(); i++) totalWeights += orderWeights.get(i) * nbPartitionWeights.get(orderWeights.get(i)); for (int i = 0; i < orderWeights.size(); i++) { totalWeights -= orderWeights.get(i) * nbPartitionWeights.get(orderWeights.get(i)); if (orderWeights.get(i) < totalWeights) { bmo = false; break; } } if (!cache) orderWeights.clear(); return bmo; } }
public class class_name { public boolean isBMO(boolean cache) { assert orderWeights.size() == 0; boolean bmo = true; final SortedSet<Integer> partitionWeights = new TreeSet<>(); final SortedMap<Integer, Integer> nbPartitionWeights = new TreeMap<>(); for (int i = 0; i < nSoft(); i++) { final int weight = softClauses.get(i).weight(); partitionWeights.add(weight); // depends on control dependency: [for], data = [none] final Integer foundNB = nbPartitionWeights.get(weight); if (foundNB == null) nbPartitionWeights.put(weight, 1); else nbPartitionWeights.put(weight, foundNB + 1); } for (final int i : partitionWeights) orderWeights.push(i); orderWeights.sortReverse(); long totalWeights = 0; for (int i = 0; i < orderWeights.size(); i++) totalWeights += orderWeights.get(i) * nbPartitionWeights.get(orderWeights.get(i)); for (int i = 0; i < orderWeights.size(); i++) { totalWeights -= orderWeights.get(i) * nbPartitionWeights.get(orderWeights.get(i)); // depends on control dependency: [for], data = [i] if (orderWeights.get(i) < totalWeights) { bmo = false; // depends on control dependency: [if], data = [none] break; } } if (!cache) orderWeights.clear(); return bmo; } }
public class class_name { public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() { Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap(); for (AsyncLogger logger : loggers) { calls.put(logger, logger.getJournalState()); } return QuorumCall.create(calls); } }
public class class_name { public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() { Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap(); for (AsyncLogger logger : loggers) { calls.put(logger, logger.getJournalState()); // depends on control dependency: [for], data = [logger] } return QuorumCall.create(calls); } }
public class class_name { public Map<String, String> toMap() { Map<String, String> result = new LinkedHashMap<String, String>(); for (int i = 0, size = size(); i < size; i++) { String name = name(i); String values = result.get(name); if (values == null) { values = value(i); } else { values += ", " + value(i); } result.put(name, values); } return result; } }
public class class_name { public Map<String, String> toMap() { Map<String, String> result = new LinkedHashMap<String, String>(); for (int i = 0, size = size(); i < size; i++) { String name = name(i); String values = result.get(name); if (values == null) { values = value(i); // depends on control dependency: [if], data = [none] } else { values += ", " + value(i); // depends on control dependency: [if], data = [none] } result.put(name, values); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { private boolean equalShapes(Shape a, Shape b) { a.checkPoints(); b.checkPoints(); for (int i=0;i<a.points.length;i++) { if (a.points[i] != b.points[i]) { return false; } } return true; } }
public class class_name { private boolean equalShapes(Shape a, Shape b) { a.checkPoints(); b.checkPoints(); for (int i=0;i<a.points.length;i++) { if (a.points[i] != b.points[i]) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { @Override public void startPortletHeaderRender( IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) { if (doesPortletNeedHeaderWorker(portletWindowId, request)) { this.startPortletHeaderRenderInternal(portletWindowId, request, response); } else { this.logger.debug( "ignoring startPortletHeadRender request since containerRuntimeOption is not present for portletWindowId " + portletWindowId); } } }
public class class_name { @Override public void startPortletHeaderRender( IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) { if (doesPortletNeedHeaderWorker(portletWindowId, request)) { this.startPortletHeaderRenderInternal(portletWindowId, request, response); // depends on control dependency: [if], data = [none] } else { this.logger.debug( "ignoring startPortletHeadRender request since containerRuntimeOption is not present for portletWindowId " + portletWindowId); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(DescribeImageBuildersRequest describeImageBuildersRequest, ProtocolMarshaller protocolMarshaller) { if (describeImageBuildersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeImageBuildersRequest.getNames(), NAMES_BINDING); protocolMarshaller.marshall(describeImageBuildersRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(describeImageBuildersRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeImageBuildersRequest describeImageBuildersRequest, ProtocolMarshaller protocolMarshaller) { if (describeImageBuildersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeImageBuildersRequest.getNames(), NAMES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeImageBuildersRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeImageBuildersRequest.getNextToken(), NEXTTOKEN_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 { protected String getFullFormattedXml(final Node node, ComparisonType type, boolean formatXml) { StringBuilder sb = new StringBuilder(); final Node nodeToConvert; if (type == ComparisonType.CHILD_NODELIST_SEQUENCE) { nodeToConvert = node.getParentNode(); } else if (node instanceof Document) { Document doc = (Document) node; appendFullDocumentHeader(sb, doc); return sb.toString(); } else if (node instanceof DocumentType) { Document doc = node.getOwnerDocument(); appendFullDocumentHeader(sb, doc); return sb.toString(); } else if (node instanceof Attr) { nodeToConvert = ((Attr) node).getOwnerElement(); } else if (node instanceof org.w3c.dom.CharacterData) { // in case of a simple text node, show the parent TAGs: "<a>xy</a>" instead "xy". nodeToConvert = node.getParentNode(); } else { nodeToConvert = node; } sb.append(getFormattedNodeXml(nodeToConvert, formatXml)); return sb.toString().trim(); } }
public class class_name { protected String getFullFormattedXml(final Node node, ComparisonType type, boolean formatXml) { StringBuilder sb = new StringBuilder(); final Node nodeToConvert; if (type == ComparisonType.CHILD_NODELIST_SEQUENCE) { nodeToConvert = node.getParentNode(); // depends on control dependency: [if], data = [none] } else if (node instanceof Document) { Document doc = (Document) node; appendFullDocumentHeader(sb, doc); // depends on control dependency: [if], data = [none] return sb.toString(); // depends on control dependency: [if], data = [none] } else if (node instanceof DocumentType) { Document doc = node.getOwnerDocument(); appendFullDocumentHeader(sb, doc); // depends on control dependency: [if], data = [none] return sb.toString(); // depends on control dependency: [if], data = [none] } else if (node instanceof Attr) { nodeToConvert = ((Attr) node).getOwnerElement(); // depends on control dependency: [if], data = [none] } else if (node instanceof org.w3c.dom.CharacterData) { // in case of a simple text node, show the parent TAGs: "<a>xy</a>" instead "xy". nodeToConvert = node.getParentNode(); // depends on control dependency: [if], data = [none] } else { nodeToConvert = node; // depends on control dependency: [if], data = [none] } sb.append(getFormattedNodeXml(nodeToConvert, formatXml)); return sb.toString().trim(); } }
public class class_name { @Nonnull public static Map<String, Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> keyAnnotationAttributesByName( @Nonnull Map<? extends ExecutableElement, ? extends AnnotationValue> attributes) { Map<String, Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> result = new LinkedHashMap<>(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> e : attributes.entrySet()) { result.put(e.getKey().getSimpleName().toString(), e); } return result; } }
public class class_name { @Nonnull public static Map<String, Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> keyAnnotationAttributesByName( @Nonnull Map<? extends ExecutableElement, ? extends AnnotationValue> attributes) { Map<String, Map.Entry<? extends ExecutableElement, ? extends AnnotationValue>> result = new LinkedHashMap<>(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> e : attributes.entrySet()) { result.put(e.getKey().getSimpleName().toString(), e); // depends on control dependency: [for], data = [e] } return result; } }
public class class_name { private static String multiPointCoordinatesFromWkt(String wkt) { wkt = removeBrackets(wkt,1); boolean isSecondVersionMultiPoint = wkt.contains("("); String coordinates = ""; if(isSecondVersionMultiPoint){ //(10 40), (40 30), (20 20)-> 10 40, 40 30, 20 20 wkt = wkt.replaceAll("\\(|\\)" ,""); } coordinates = getJsonArrayFromListOfPoints(wkt); return coordinates; } }
public class class_name { private static String multiPointCoordinatesFromWkt(String wkt) { wkt = removeBrackets(wkt,1); boolean isSecondVersionMultiPoint = wkt.contains("("); String coordinates = ""; if(isSecondVersionMultiPoint){ //(10 40), (40 30), (20 20)-> 10 40, 40 30, 20 20 wkt = wkt.replaceAll("\\(|\\)" ,""); // depends on control dependency: [if], data = [none] } coordinates = getJsonArrayFromListOfPoints(wkt); return coordinates; } }
public class class_name { public void fullReset() { // Reset stream to SoftDevice if SD and BL firmware were given separately if (softDeviceBytes != null && bootloaderBytes != null && currentSource == bootloaderBytes) { currentSource = softDeviceBytes; } // Reset the bytes count to 0 bytesReadFromCurrentSource = 0; mark(0); reset(); } }
public class class_name { public void fullReset() { // Reset stream to SoftDevice if SD and BL firmware were given separately if (softDeviceBytes != null && bootloaderBytes != null && currentSource == bootloaderBytes) { currentSource = softDeviceBytes; // depends on control dependency: [if], data = [none] } // Reset the bytes count to 0 bytesReadFromCurrentSource = 0; mark(0); reset(); } }
public class class_name { public void setWeekOfYearVisible(boolean weekOfYearVisible) { if (weekOfYearVisible == this.weekOfYearVisible) { return; } else if (weekOfYearVisible) { add(weekPanel, BorderLayout.WEST); } else { remove(weekPanel); } this.weekOfYearVisible = weekOfYearVisible; validate(); dayPanel.validate(); } }
public class class_name { public void setWeekOfYearVisible(boolean weekOfYearVisible) { if (weekOfYearVisible == this.weekOfYearVisible) { return; // depends on control dependency: [if], data = [none] } else if (weekOfYearVisible) { add(weekPanel, BorderLayout.WEST); // depends on control dependency: [if], data = [none] } else { remove(weekPanel); // depends on control dependency: [if], data = [none] } this.weekOfYearVisible = weekOfYearVisible; validate(); dayPanel.validate(); } }
public class class_name { private void expungeExpiredEntries() { emptyQueue(); if (lifetime == 0) { return; } int cnt = 0; long time = System.currentTimeMillis(); for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator(); t.hasNext(); ) { CacheEntry<K,V> entry = t.next(); if (entry.isValid(time) == false) { t.remove(); cnt++; } } if (DEBUG) { if (cnt != 0) { System.out.println("Removed " + cnt + " expired entries, remaining " + cacheMap.size()); } } } }
public class class_name { private void expungeExpiredEntries() { emptyQueue(); if (lifetime == 0) { return; // depends on control dependency: [if], data = [none] } int cnt = 0; long time = System.currentTimeMillis(); for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator(); t.hasNext(); ) { CacheEntry<K,V> entry = t.next(); if (entry.isValid(time) == false) { t.remove(); // depends on control dependency: [if], data = [none] cnt++; // depends on control dependency: [if], data = [none] } } if (DEBUG) { if (cnt != 0) { System.out.println("Removed " + cnt + " expired entries, remaining " + cacheMap.size()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(TcpRoute tcpRoute, ProtocolMarshaller protocolMarshaller) { if (tcpRoute == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tcpRoute.getAction(), ACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(TcpRoute tcpRoute, ProtocolMarshaller protocolMarshaller) { if (tcpRoute == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tcpRoute.getAction(), ACTION_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 { private void replaceParentClassesForAtomics(ClassOrInterfaceDeclaration n) { for (ClassOrInterfaceType parent : n.getExtendedTypes()) { if ("ConcurrentCircularArrayQueue".equals(parent.getNameAsString())) { parent.setName("AtomicReferenceArrayQueue"); } else if ("ConcurrentSequencedCircularArrayQueue".equals(parent.getNameAsString())) { parent.setName("SequencedAtomicReferenceArrayQueue"); } else { // Padded super classes are to be renamed and thus so does the // class we must extend. parent.setName(translateQueueName(parent.getNameAsString())); } } } }
public class class_name { private void replaceParentClassesForAtomics(ClassOrInterfaceDeclaration n) { for (ClassOrInterfaceType parent : n.getExtendedTypes()) { if ("ConcurrentCircularArrayQueue".equals(parent.getNameAsString())) { parent.setName("AtomicReferenceArrayQueue"); // depends on control dependency: [if], data = [none] } else if ("ConcurrentSequencedCircularArrayQueue".equals(parent.getNameAsString())) { parent.setName("SequencedAtomicReferenceArrayQueue"); // depends on control dependency: [if], data = [none] } else { // Padded super classes are to be renamed and thus so does the // class we must extend. parent.setName(translateQueueName(parent.getNameAsString())); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public final void init(final int WIDTH, final int HEIGHT) { if (WIDTH <= 1 || HEIGHT <= 1) { return; } if (bgImage != null) { bgImage.flush(); } if (lcdImage != null) { lcdImage.flush(); } if (glowImageOn != null) { glowImageOn.flush(); } glowImageOn = GlowImageFactory.INSTANCE.createLcdGlow(WIDTH, HEIGHT, glowColor, true); lcdImage = create_LCD_Image(WIDTH, HEIGHT, null); final double CORNER_RADIUS = WIDTH > HEIGHT ? (HEIGHT * 0.095) : (WIDTH * 0.095); disabledShape = new RoundRectangle2D.Double(0, 0, WIDTH, HEIGHT, CORNER_RADIUS, CORNER_RADIUS); if (isDigitalFont()) { lcdValueFont = LCD_DIGITAL_FONT.deriveFont(0.7f * getInnerBounds().height).deriveFont(Font.PLAIN); if (useCustomLcdUnitFont) { lcdUnitFont = customLcdUnitFont.deriveFont(0.2f * getInnerBounds().height); } else { lcdUnitFont = LCD_STANDARD_FONT.deriveFont(0.2f * getInnerBounds().height); } } else { lcdValueFont = LCD_STANDARD_FONT.deriveFont(0.625f * getInnerBounds().height); if (useCustomLcdUnitFont) { lcdUnitFont = customLcdUnitFont.deriveFont(0.2f * getInnerBounds().height); } else { lcdUnitFont = LCD_STANDARD_FONT.deriveFont(0.2f * getInnerBounds().height); } } lcdInfoFont = LCD_STANDARD_FONT.deriveFont(Font.BOLD, 0.18f * getInnerBounds().height); if (lcdThresholdImage != null) { lcdThresholdImage.flush(); } lcdThresholdImage = create_LCD_THRESHOLD_Image((int) (HEIGHT * 0.2045454545), (int) (HEIGHT * 0.2045454545), lcdColor.TEXT_COLOR); if (!sections.isEmpty()) { sectionsBackground.clear(); sectionsForeground.clear(); final float[] HSB_START = (Color.RGBtoHSB(lcdColor.GRADIENT_START_COLOR.getRed(), lcdColor.GRADIENT_START_COLOR.getGreen(), lcdColor.GRADIENT_START_COLOR.getBlue(), null)); final float[] HSB_FRACTION1 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION1_COLOR.getRed(), lcdColor.GRADIENT_FRACTION1_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION1_COLOR.getBlue(), null)); final float[] HSB_FRACTION2 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION2_COLOR.getRed(), lcdColor.GRADIENT_FRACTION2_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION2_COLOR.getBlue(), null)); final float[] HSB_FRACTION3 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION3_COLOR.getRed(), lcdColor.GRADIENT_FRACTION3_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION3_COLOR.getBlue(), null)); final float[] HSB_STOP = (Color.RGBtoHSB(lcdColor.GRADIENT_STOP_COLOR.getRed(), lcdColor.GRADIENT_STOP_COLOR.getGreen(), lcdColor.GRADIENT_STOP_COLOR.getBlue(), null)); // Hue values of the gradient colors final float HUE_START = HSB_START[0]; final float HUE_FRACTION1 = HSB_FRACTION1[0]; final float HUE_FRACTION2 = HSB_FRACTION2[0]; final float HUE_FRACTION3 = HSB_FRACTION3[0]; final float HUE_STOP = HSB_STOP[0]; // Brightness values of the gradient colors final float BRIGHTNESS_START = HSB_START[2]; final float BRIGHTNESS_FRACTION1 = HSB_FRACTION1[2]; final float BRIGHTNESS_FRACTION2 = HSB_FRACTION2[2]; final float BRIGHTNESS_FRACTION3 = HSB_FRACTION3[2]; final float BRIGHTNESS_STOP = HSB_STOP[2]; for (Section section : sections) { final Color[] BACKGROUND_COLORS; final Color FOREGROUND_COLOR; final float[] HSB_SECTION = Color.RGBtoHSB(section.getColor().getRed(), section.getColor().getGreen(), section.getColor().getBlue(), null); final float HUE_SECTION = HSB_SECTION[0]; final float SATURATION_SECTION = HSB_SECTION[1]; final float BRIGHTNESS_SECTION = HSB_SECTION[2]; if (!UTIL.isMonochrome(section.getColor())) { // Section color is not monochrome if (lcdColor == LcdColor.SECTIONS_LCD) { BACKGROUND_COLORS = new Color[]{ new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_START - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION1 - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION2 - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION3 - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_STOP - 0.31f)) }; } else { final float HUE_DIFF = HUE_SECTION - HUE_FRACTION3; BACKGROUND_COLORS = new Color[]{ UTIL.setHue(lcdColor.GRADIENT_START_COLOR, (HUE_START + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_FRACTION1_COLOR, (HUE_FRACTION1 + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_FRACTION2_COLOR, (HUE_FRACTION2 + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_FRACTION3_COLOR, (HUE_FRACTION3 + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_STOP_COLOR, (HUE_STOP + HUE_DIFF) % 360) }; } FOREGROUND_COLOR = UTIL.setSaturationBrightness(section.getColor(), 0.57f, 0.83f); } else { // Section color is monochrome final float BRIGHTNESS_DIFF = BRIGHTNESS_SECTION - BRIGHTNESS_FRACTION1; BACKGROUND_COLORS = new Color[]{ UTIL.setSaturationBrightness(lcdColor.GRADIENT_START_COLOR, 0, BRIGHTNESS_START + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION1_COLOR, 0, BRIGHTNESS_FRACTION1 + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION2_COLOR, 0, BRIGHTNESS_FRACTION2 + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION3_COLOR, 0, BRIGHTNESS_FRACTION3 + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_STOP_COLOR, 0, BRIGHTNESS_STOP + BRIGHTNESS_DIFF) }; if (UTIL.isDark(section.getColor())) { FOREGROUND_COLOR = Color.WHITE; } else { FOREGROUND_COLOR = Color.BLACK; } } sectionsBackground.add(create_LCD_Image(WIDTH, HEIGHT, BACKGROUND_COLORS)); sectionsForeground.add(FOREGROUND_COLOR); } } // Quality overlay related parameters overlayCornerRadius = WIDTH > HEIGHT ? (HEIGHT * 0.095) - 1 : (WIDTH * 0.095) - 1; overlayFactor = (float) (lcdValue / (lcdMaxValue - lcdMinValue)); if (Double.compare(overlayFactor, 1.0) > 0) { factor = 1.0f; } else if (Double.compare(overlayFactor, 0) < 0) { factor = 0.0f; } else { factor = overlayFactor; } overlayColors = new Color[] { UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor), 0.5f), UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor).darker(), 0.5f), UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor), 0.5f) }; final int INSET = (int) (qualityOverlay.getHeight() * 0.0909090909); overlayInsets.set(INSET, INSET, INSET, INSET); qualityOverlayLookup = new GradientWrapper(new Point2D.Double(overlayInsets.left, 0), new Point2D.Double(lcdImage.getMinX() + lcdImage.getWidth() - overlayInsets.right, 0), qualityOverlayFractions, qualityOverlayColors); qualityOverlayGradient = new LinearGradientPaint(new Point2D.Double(0, overlayInsets.top), new Point2D.Double(0, HEIGHT - overlayInsets.bottom), new float[]{0.0f, 0.5f, 1.0f}, overlayColors); qualityOverlay.setRoundRect(overlayInsets.left, overlayInsets.top, (INNER_BOUNDS.width * overlayFactor) - overlayInsets.left - overlayInsets.right, INNER_BOUNDS.height - overlayInsets.top - overlayInsets.bottom, overlayCornerRadius, overlayCornerRadius); // Prepare bargraph bargraphSegmentFactor = 20 / (lcdMaxValue - lcdMinValue); prepareBargraph(WIDTH, HEIGHT); } }
public class class_name { public final void init(final int WIDTH, final int HEIGHT) { if (WIDTH <= 1 || HEIGHT <= 1) { return; // depends on control dependency: [if], data = [none] } if (bgImage != null) { bgImage.flush(); // depends on control dependency: [if], data = [none] } if (lcdImage != null) { lcdImage.flush(); // depends on control dependency: [if], data = [none] } if (glowImageOn != null) { glowImageOn.flush(); // depends on control dependency: [if], data = [none] } glowImageOn = GlowImageFactory.INSTANCE.createLcdGlow(WIDTH, HEIGHT, glowColor, true); lcdImage = create_LCD_Image(WIDTH, HEIGHT, null); final double CORNER_RADIUS = WIDTH > HEIGHT ? (HEIGHT * 0.095) : (WIDTH * 0.095); disabledShape = new RoundRectangle2D.Double(0, 0, WIDTH, HEIGHT, CORNER_RADIUS, CORNER_RADIUS); if (isDigitalFont()) { lcdValueFont = LCD_DIGITAL_FONT.deriveFont(0.7f * getInnerBounds().height).deriveFont(Font.PLAIN); // depends on control dependency: [if], data = [none] if (useCustomLcdUnitFont) { lcdUnitFont = customLcdUnitFont.deriveFont(0.2f * getInnerBounds().height); // depends on control dependency: [if], data = [none] } else { lcdUnitFont = LCD_STANDARD_FONT.deriveFont(0.2f * getInnerBounds().height); // depends on control dependency: [if], data = [none] } } else { lcdValueFont = LCD_STANDARD_FONT.deriveFont(0.625f * getInnerBounds().height); // depends on control dependency: [if], data = [none] if (useCustomLcdUnitFont) { lcdUnitFont = customLcdUnitFont.deriveFont(0.2f * getInnerBounds().height); // depends on control dependency: [if], data = [none] } else { lcdUnitFont = LCD_STANDARD_FONT.deriveFont(0.2f * getInnerBounds().height); // depends on control dependency: [if], data = [none] } } lcdInfoFont = LCD_STANDARD_FONT.deriveFont(Font.BOLD, 0.18f * getInnerBounds().height); if (lcdThresholdImage != null) { lcdThresholdImage.flush(); // depends on control dependency: [if], data = [none] } lcdThresholdImage = create_LCD_THRESHOLD_Image((int) (HEIGHT * 0.2045454545), (int) (HEIGHT * 0.2045454545), lcdColor.TEXT_COLOR); if (!sections.isEmpty()) { sectionsBackground.clear(); // depends on control dependency: [if], data = [none] sectionsForeground.clear(); // depends on control dependency: [if], data = [none] final float[] HSB_START = (Color.RGBtoHSB(lcdColor.GRADIENT_START_COLOR.getRed(), lcdColor.GRADIENT_START_COLOR.getGreen(), lcdColor.GRADIENT_START_COLOR.getBlue(), null)); final float[] HSB_FRACTION1 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION1_COLOR.getRed(), lcdColor.GRADIENT_FRACTION1_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION1_COLOR.getBlue(), null)); final float[] HSB_FRACTION2 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION2_COLOR.getRed(), lcdColor.GRADIENT_FRACTION2_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION2_COLOR.getBlue(), null)); final float[] HSB_FRACTION3 = (Color.RGBtoHSB(lcdColor.GRADIENT_FRACTION3_COLOR.getRed(), lcdColor.GRADIENT_FRACTION3_COLOR.getGreen(), lcdColor.GRADIENT_FRACTION3_COLOR.getBlue(), null)); final float[] HSB_STOP = (Color.RGBtoHSB(lcdColor.GRADIENT_STOP_COLOR.getRed(), lcdColor.GRADIENT_STOP_COLOR.getGreen(), lcdColor.GRADIENT_STOP_COLOR.getBlue(), null)); // Hue values of the gradient colors final float HUE_START = HSB_START[0]; final float HUE_FRACTION1 = HSB_FRACTION1[0]; final float HUE_FRACTION2 = HSB_FRACTION2[0]; final float HUE_FRACTION3 = HSB_FRACTION3[0]; final float HUE_STOP = HSB_STOP[0]; // Brightness values of the gradient colors final float BRIGHTNESS_START = HSB_START[2]; final float BRIGHTNESS_FRACTION1 = HSB_FRACTION1[2]; final float BRIGHTNESS_FRACTION2 = HSB_FRACTION2[2]; final float BRIGHTNESS_FRACTION3 = HSB_FRACTION3[2]; final float BRIGHTNESS_STOP = HSB_STOP[2]; for (Section section : sections) { final Color[] BACKGROUND_COLORS; final Color FOREGROUND_COLOR; final float[] HSB_SECTION = Color.RGBtoHSB(section.getColor().getRed(), section.getColor().getGreen(), section.getColor().getBlue(), null); final float HUE_SECTION = HSB_SECTION[0]; final float SATURATION_SECTION = HSB_SECTION[1]; final float BRIGHTNESS_SECTION = HSB_SECTION[2]; if (!UTIL.isMonochrome(section.getColor())) { // Section color is not monochrome if (lcdColor == LcdColor.SECTIONS_LCD) { BACKGROUND_COLORS = new Color[]{ new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_START - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION1 - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION2 - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_FRACTION3 - 0.31f)), new Color(Color.HSBtoRGB(HUE_SECTION, SATURATION_SECTION, BRIGHTNESS_STOP - 0.31f)) }; // depends on control dependency: [if], data = [none] } else { final float HUE_DIFF = HUE_SECTION - HUE_FRACTION3; BACKGROUND_COLORS = new Color[]{ UTIL.setHue(lcdColor.GRADIENT_START_COLOR, (HUE_START + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_FRACTION1_COLOR, (HUE_FRACTION1 + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_FRACTION2_COLOR, (HUE_FRACTION2 + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_FRACTION3_COLOR, (HUE_FRACTION3 + HUE_DIFF) % 360), UTIL.setHue(lcdColor.GRADIENT_STOP_COLOR, (HUE_STOP + HUE_DIFF) % 360) }; // depends on control dependency: [if], data = [none] } FOREGROUND_COLOR = UTIL.setSaturationBrightness(section.getColor(), 0.57f, 0.83f); // depends on control dependency: [if], data = [none] } else { // Section color is monochrome final float BRIGHTNESS_DIFF = BRIGHTNESS_SECTION - BRIGHTNESS_FRACTION1; BACKGROUND_COLORS = new Color[]{ UTIL.setSaturationBrightness(lcdColor.GRADIENT_START_COLOR, 0, BRIGHTNESS_START + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION1_COLOR, 0, BRIGHTNESS_FRACTION1 + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION2_COLOR, 0, BRIGHTNESS_FRACTION2 + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_FRACTION3_COLOR, 0, BRIGHTNESS_FRACTION3 + BRIGHTNESS_DIFF), UTIL.setSaturationBrightness(lcdColor.GRADIENT_STOP_COLOR, 0, BRIGHTNESS_STOP + BRIGHTNESS_DIFF) }; // depends on control dependency: [if], data = [none] if (UTIL.isDark(section.getColor())) { FOREGROUND_COLOR = Color.WHITE; // depends on control dependency: [if], data = [none] } else { FOREGROUND_COLOR = Color.BLACK; // depends on control dependency: [if], data = [none] } } sectionsBackground.add(create_LCD_Image(WIDTH, HEIGHT, BACKGROUND_COLORS)); // depends on control dependency: [for], data = [section] sectionsForeground.add(FOREGROUND_COLOR); // depends on control dependency: [for], data = [section] } } // Quality overlay related parameters overlayCornerRadius = WIDTH > HEIGHT ? (HEIGHT * 0.095) - 1 : (WIDTH * 0.095) - 1; overlayFactor = (float) (lcdValue / (lcdMaxValue - lcdMinValue)); if (Double.compare(overlayFactor, 1.0) > 0) { factor = 1.0f; // depends on control dependency: [if], data = [none] } else if (Double.compare(overlayFactor, 0) < 0) { factor = 0.0f; // depends on control dependency: [if], data = [none] } else { factor = overlayFactor; // depends on control dependency: [if], data = [none] } overlayColors = new Color[] { UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor), 0.5f), UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor).darker(), 0.5f), UTIL.setAlpha(qualityOverlayLookup.getColorAt(factor), 0.5f) }; final int INSET = (int) (qualityOverlay.getHeight() * 0.0909090909); overlayInsets.set(INSET, INSET, INSET, INSET); qualityOverlayLookup = new GradientWrapper(new Point2D.Double(overlayInsets.left, 0), new Point2D.Double(lcdImage.getMinX() + lcdImage.getWidth() - overlayInsets.right, 0), qualityOverlayFractions, qualityOverlayColors); qualityOverlayGradient = new LinearGradientPaint(new Point2D.Double(0, overlayInsets.top), new Point2D.Double(0, HEIGHT - overlayInsets.bottom), new float[]{0.0f, 0.5f, 1.0f}, overlayColors); qualityOverlay.setRoundRect(overlayInsets.left, overlayInsets.top, (INNER_BOUNDS.width * overlayFactor) - overlayInsets.left - overlayInsets.right, INNER_BOUNDS.height - overlayInsets.top - overlayInsets.bottom, overlayCornerRadius, overlayCornerRadius); // Prepare bargraph bargraphSegmentFactor = 20 / (lcdMaxValue - lcdMinValue); prepareBargraph(WIDTH, HEIGHT); } }
public class class_name { public void marshall(CloseStatusFilter closeStatusFilter, ProtocolMarshaller protocolMarshaller) { if (closeStatusFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(closeStatusFilter.getStatus(), STATUS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CloseStatusFilter closeStatusFilter, ProtocolMarshaller protocolMarshaller) { if (closeStatusFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(closeStatusFilter.getStatus(), STATUS_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 { private ArrayList<Object> parseArray(JsonParser jp) throws IOException { JsonToken value = jp.nextToken(); ArrayList<Object> ret = new ArrayList<>(); while(value != JsonToken.END_ARRAY) { if (value == JsonToken.START_OBJECT) { Object object = parseObject(jp); ret.add(object); } else if (value == JsonToken.START_ARRAY) { ArrayList<Object> arrayList = parseArray(jp); ret.add(arrayList.toArray()); } else if (value == JsonToken.VALUE_NUMBER_INT) { ret.add(jp.getValueAsInt()); } else if (value == JsonToken.VALUE_FALSE || value == JsonToken.VALUE_TRUE) { ret.add(jp.getValueAsBoolean()); } else if (value == JsonToken.VALUE_NUMBER_FLOAT) { ret.add(jp.getValueAsDouble()); } else if (value == JsonToken.VALUE_STRING) { ret.add(jp.getValueAsString()); } else if (value == JsonToken.VALUE_NULL) { ret.add("null"); } value = jp.nextToken(); } return ret; } }
public class class_name { private ArrayList<Object> parseArray(JsonParser jp) throws IOException { JsonToken value = jp.nextToken(); ArrayList<Object> ret = new ArrayList<>(); while(value != JsonToken.END_ARRAY) { if (value == JsonToken.START_OBJECT) { Object object = parseObject(jp); ret.add(object); // depends on control dependency: [if], data = [none] } else if (value == JsonToken.START_ARRAY) { ArrayList<Object> arrayList = parseArray(jp); ret.add(arrayList.toArray()); // depends on control dependency: [if], data = [none] } else if (value == JsonToken.VALUE_NUMBER_INT) { ret.add(jp.getValueAsInt()); // depends on control dependency: [if], data = [none] } else if (value == JsonToken.VALUE_FALSE || value == JsonToken.VALUE_TRUE) { ret.add(jp.getValueAsBoolean()); // depends on control dependency: [if], data = [none] } else if (value == JsonToken.VALUE_NUMBER_FLOAT) { ret.add(jp.getValueAsDouble()); // depends on control dependency: [if], data = [none] } else if (value == JsonToken.VALUE_STRING) { ret.add(jp.getValueAsString()); // depends on control dependency: [if], data = [none] } else if (value == JsonToken.VALUE_NULL) { ret.add("null"); // depends on control dependency: [if], data = [none] } value = jp.nextToken(); } return ret; } }
public class class_name { @PerformanceSensitive public Class<?> getCallerClass(final String fqcn, final String pkg) { boolean next = false; Class<?> clazz; for (int i = 2; null != (clazz = getCallerClass(i)); i++) { if (fqcn.equals(clazz.getName())) { next = true; continue; } if (next && clazz.getName().startsWith(pkg)) { return clazz; } } // TODO: return Object.class return null; } }
public class class_name { @PerformanceSensitive public Class<?> getCallerClass(final String fqcn, final String pkg) { boolean next = false; Class<?> clazz; for (int i = 2; null != (clazz = getCallerClass(i)); i++) { if (fqcn.equals(clazz.getName())) { next = true; // depends on control dependency: [if], data = [none] continue; } if (next && clazz.getName().startsWith(pkg)) { return clazz; // depends on control dependency: [if], data = [none] } } // TODO: return Object.class return null; } }
public class class_name { public void updateFeatures() { for (int i = 0; i < feaGen.features.size(); i++) { Feature f = (Feature)feaGen.features.get(i); f.wgt = lambda[f.idx]; } } }
public class class_name { public void updateFeatures() { for (int i = 0; i < feaGen.features.size(); i++) { Feature f = (Feature)feaGen.features.get(i); f.wgt = lambda[f.idx]; // depends on control dependency: [for], data = [none] } } }
public class class_name { @Override public void propagate(int evtmask) throws ContradictionException { int min = 0; int max = 0; for (int i = 0; i < n; i++) { ISet nei = g.getPotNeighOf(i); for (int j : nei) { if (i <= j) { max += distMatrix[i][j]; if (g.getMandNeighOf(i).contains(j)) { min += distMatrix[i][j]; } } } } gdm.unfreeze(); minSum.set(min); maxSum.set(max); sum.updateLowerBound(min, this); sum.updateUpperBound(max, this); } }
public class class_name { @Override public void propagate(int evtmask) throws ContradictionException { int min = 0; int max = 0; for (int i = 0; i < n; i++) { ISet nei = g.getPotNeighOf(i); for (int j : nei) { if (i <= j) { max += distMatrix[i][j]; // depends on control dependency: [if], data = [none] if (g.getMandNeighOf(i).contains(j)) { min += distMatrix[i][j]; // depends on control dependency: [if], data = [none] } } } } gdm.unfreeze(); minSum.set(min); maxSum.set(max); sum.updateLowerBound(min, this); sum.updateUpperBound(max, this); } }
public class class_name { void callAnnotated(Class<? extends Annotation> ann, boolean lazy) { for (ComponentAccess p : oMap.values()) { p.callAnnotatedMethod(ann, lazy); } } }
public class class_name { void callAnnotated(Class<? extends Annotation> ann, boolean lazy) { for (ComponentAccess p : oMap.values()) { p.callAnnotatedMethod(ann, lazy); // depends on control dependency: [for], data = [p] } } }
public class class_name { public static void outMark(IRubyObject emitter, IRubyObject node) { Emitter emitterPtr = (Emitter)emitter.dataGetStructChecked(); YEmitter.Extra bonus = (YEmitter.Extra)emitterPtr.bonus; ((RubyObject)node).fastSetInstanceVariable("@emitter", emitter); if(!bonus.oid.isNil()) { ((RubyHash)bonus.data).fastASet(bonus.oid, node); } } }
public class class_name { public static void outMark(IRubyObject emitter, IRubyObject node) { Emitter emitterPtr = (Emitter)emitter.dataGetStructChecked(); YEmitter.Extra bonus = (YEmitter.Extra)emitterPtr.bonus; ((RubyObject)node).fastSetInstanceVariable("@emitter", emitter); if(!bonus.oid.isNil()) { ((RubyHash)bonus.data).fastASet(bonus.oid, node); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean checkFile(Configuration conf, FileSystem srcFs, FileSystem parityFs, Path srcPath, Path parityPath, Codec codec, Progressable reporter, boolean sourceOnly) throws IOException, InterruptedException { FileStatus stat = srcFs.getFileStatus(srcPath); long blockSize = stat.getBlockSize(); long len = stat.getLen(); List<Long> offsets = new ArrayList<Long>(); // check a small part of each stripe. for (int i = 0; i * blockSize < len; i += codec.stripeLength) { offsets.add(i * blockSize); } for (long blockOffset : offsets) { if (sourceOnly) { if (!verifySourceFile(conf, srcFs,stat, codec, blockOffset, reporter)) { return false; } } else { if (!verifyFile(conf, srcFs, parityFs, stat, parityPath, codec, blockOffset, reporter)) { return false; } } } return true; } }
public class class_name { public static boolean checkFile(Configuration conf, FileSystem srcFs, FileSystem parityFs, Path srcPath, Path parityPath, Codec codec, Progressable reporter, boolean sourceOnly) throws IOException, InterruptedException { FileStatus stat = srcFs.getFileStatus(srcPath); long blockSize = stat.getBlockSize(); long len = stat.getLen(); List<Long> offsets = new ArrayList<Long>(); // check a small part of each stripe. for (int i = 0; i * blockSize < len; i += codec.stripeLength) { offsets.add(i * blockSize); } for (long blockOffset : offsets) { if (sourceOnly) { if (!verifySourceFile(conf, srcFs,stat, codec, blockOffset, reporter)) { return false; // depends on control dependency: [if], data = [none] } } else { if (!verifyFile(conf, srcFs, parityFs, stat, parityPath, codec, blockOffset, reporter)) { return false; // depends on control dependency: [if], data = [none] } } } return true; } }
public class class_name { public String getExportPath(String vfsName) { if (vfsName != null) { Iterator<CmsStaticExportRfsRule> it = m_rfsRules.iterator(); while (it.hasNext()) { CmsStaticExportRfsRule rule = it.next(); if (rule.getSource().matcher(vfsName).matches()) { return rule.getExportPath(); } } } if (m_useTempDirs && isFullStaticExport()) { return getExportWorkPath(); } return m_staticExportPath; } }
public class class_name { public String getExportPath(String vfsName) { if (vfsName != null) { Iterator<CmsStaticExportRfsRule> it = m_rfsRules.iterator(); while (it.hasNext()) { CmsStaticExportRfsRule rule = it.next(); if (rule.getSource().matcher(vfsName).matches()) { return rule.getExportPath(); // depends on control dependency: [if], data = [none] } } } if (m_useTempDirs && isFullStaticExport()) { return getExportWorkPath(); // depends on control dependency: [if], data = [none] } return m_staticExportPath; } }
public class class_name { private <A extends Annotation, AS extends Annotation> void processClassAnnotations(int processorIndex, InjectionProcessorProvider<A, AS> provider, Class<?> klass) throws InjectionException { Class<A> annClass = provider.getAnnotationClass(); if (annClass != null) { A ann = klass.getAnnotation(annClass); if (ann != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "found class annotation " + toStringSecure(ann)); InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider); addOrMergeInjectionBinding(processorIndex, processor, klass, null, ann); } Class<AS> pluralAnnClass = provider.getAnnotationsClass(); if (pluralAnnClass != null) { AS pluralAnn = klass.getAnnotation(pluralAnnClass); if (pluralAnn != null) { InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider); A[] singleAnns = processor.getAnnotations(pluralAnn); if (singleAnns != null) { for (A singleAnn : singleAnns) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "found plural class annotation " + toStringSecure(singleAnn)); addOrMergeInjectionBinding(processorIndex, processor, klass, null, singleAnn); } } } } } } }
public class class_name { private <A extends Annotation, AS extends Annotation> void processClassAnnotations(int processorIndex, InjectionProcessorProvider<A, AS> provider, Class<?> klass) throws InjectionException { Class<A> annClass = provider.getAnnotationClass(); if (annClass != null) { A ann = klass.getAnnotation(annClass); if (ann != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "found class annotation " + toStringSecure(ann)); InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider); addOrMergeInjectionBinding(processorIndex, processor, klass, null, ann); } Class<AS> pluralAnnClass = provider.getAnnotationsClass(); if (pluralAnnClass != null) { AS pluralAnn = klass.getAnnotation(pluralAnnClass); if (pluralAnn != null) { InjectionProcessor<A, AS> processor = getProcessor(processorIndex, provider); A[] singleAnns = processor.getAnnotations(pluralAnn); if (singleAnns != null) { for (A singleAnn : singleAnns) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "found plural class annotation " + toStringSecure(singleAnn)); addOrMergeInjectionBinding(processorIndex, processor, klass, null, singleAnn); // depends on control dependency: [for], data = [singleAnn] } } } } } } }
public class class_name { @FFDCIgnore(BatchCDIAmbiguousResolutionCheckedException.class) protected Bean<?> getUniqueBeanForBatchXMLEntry(BeanManager bm, String batchId) { ClassLoader loader = getContextClassLoader(); BatchXMLMapper batchXMLMapper = new BatchXMLMapper(loader); Class<?> clazz = batchXMLMapper.getArtifactById(batchId); if (clazz != null) { try { return findUniqueBeanForClass(bm, clazz); } catch (BatchCDIAmbiguousResolutionCheckedException e) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForBatchXML: BatchCDIAmbiguousResolutionCheckedException: " + e.getMessage()); } return null; } } else { return null; } } }
public class class_name { @FFDCIgnore(BatchCDIAmbiguousResolutionCheckedException.class) protected Bean<?> getUniqueBeanForBatchXMLEntry(BeanManager bm, String batchId) { ClassLoader loader = getContextClassLoader(); BatchXMLMapper batchXMLMapper = new BatchXMLMapper(loader); Class<?> clazz = batchXMLMapper.getArtifactById(batchId); if (clazz != null) { try { return findUniqueBeanForClass(bm, clazz); // depends on control dependency: [try], data = [none] } catch (BatchCDIAmbiguousResolutionCheckedException e) { if (logger.isLoggable(Level.FINER)) { logger.finer("getBeanForBatchXML: BatchCDIAmbiguousResolutionCheckedException: " + e.getMessage()); // depends on control dependency: [if], data = [none] } return null; } // depends on control dependency: [catch], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void removeAllLocalesExcept(CmsXmlContainerPage page, Locale localeToKeep) throws CmsXmlException { List<Locale> locales = page.getLocales(); for (Locale locale : locales) { if (!locale.equals(localeToKeep)) { page.removeLocale(locale); } } } }
public class class_name { private void removeAllLocalesExcept(CmsXmlContainerPage page, Locale localeToKeep) throws CmsXmlException { List<Locale> locales = page.getLocales(); for (Locale locale : locales) { if (!locale.equals(localeToKeep)) { page.removeLocale(locale); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public final int prepare() throws XAException { if (tc.isEntryEnabled()) Tr.entry(tc, "prepare", new Object[] { _resource, _xid }); if (tcSummary.isDebugEnabled()) Tr.debug(tcSummary, "xa_prepare", this); int rc = -1; try { try { // Ensure that the associated XARecoveryData (the PartnerLogData entry in the PartnerLogTable) // has logged itself to the partner log. If the PLD was created before the recovery log // was available we need to ensure that it writes itself to the parter log now. Additionally, // if this was the case, the recovery id it holds is updated from zero to the real value // so we need to update the value cached in this object (originally obtained during contruction // from the pre-logged PLD). If we logged at enlist time, this is a no-op. _recoveryData.logRecoveryEntry(); } catch (Exception e) { throw new XAException(XAException.XAER_INVAL); } rc = _resource.prepare(_xid); // // Convert to Vote. // if (rc == XAResource.XA_OK) { // Record the Vote _vote = JTAResourceVote.commit; return rc; } else if (rc == XAResource.XA_RDONLY) { // Record the Vote _vote = JTAResourceVote.readonly; destroy(); return rc; } } catch (XAException xae) { _prepareXARC = xae.errorCode; // Record the prepare XA return code FFDCFilter.processException(xae, "com.ibm.ws.Transaction.JTA.JTAXAResourceImpl.prepare", "259", this); if (_prepareXARC >= XAException.XA_RBBASE && _prepareXARC <= XAException.XA_RBEND) { _vote = JTAResourceVote.rollback; } else if (_prepareXARC == XAException.XAER_RMFAIL) { // Force reconnect on rollback _state = FAILED; } throw xae; } finally { if (tc.isEntryEnabled()) { if (_vote != null) { Tr.exit(tc, "prepare", XAReturnCodeHelper.convertXACode(rc) + " (" + _vote.name() + ")"); } else { Tr.exit(tc, "prepare", XAReturnCodeHelper.convertXACode(rc)); } } if (tcSummary.isDebugEnabled()) Tr.debug(tcSummary, "xa_prepare result: " + XAReturnCodeHelper.convertXACode(rc)); } // Any other response is invalid throw new XAException(XAException.XAER_INVAL); } }
public class class_name { @Override public final int prepare() throws XAException { if (tc.isEntryEnabled()) Tr.entry(tc, "prepare", new Object[] { _resource, _xid }); if (tcSummary.isDebugEnabled()) Tr.debug(tcSummary, "xa_prepare", this); int rc = -1; try { try { // Ensure that the associated XARecoveryData (the PartnerLogData entry in the PartnerLogTable) // has logged itself to the partner log. If the PLD was created before the recovery log // was available we need to ensure that it writes itself to the parter log now. Additionally, // if this was the case, the recovery id it holds is updated from zero to the real value // so we need to update the value cached in this object (originally obtained during contruction // from the pre-logged PLD). If we logged at enlist time, this is a no-op. _recoveryData.logRecoveryEntry(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new XAException(XAException.XAER_INVAL); } // depends on control dependency: [catch], data = [none] rc = _resource.prepare(_xid); // // Convert to Vote. // if (rc == XAResource.XA_OK) { // Record the Vote _vote = JTAResourceVote.commit; // depends on control dependency: [if], data = [none] return rc; // depends on control dependency: [if], data = [none] } else if (rc == XAResource.XA_RDONLY) { // Record the Vote _vote = JTAResourceVote.readonly; // depends on control dependency: [if], data = [none] destroy(); // depends on control dependency: [if], data = [none] return rc; // depends on control dependency: [if], data = [none] } } catch (XAException xae) { _prepareXARC = xae.errorCode; // Record the prepare XA return code FFDCFilter.processException(xae, "com.ibm.ws.Transaction.JTA.JTAXAResourceImpl.prepare", "259", this); if (_prepareXARC >= XAException.XA_RBBASE && _prepareXARC <= XAException.XA_RBEND) { _vote = JTAResourceVote.rollback; // depends on control dependency: [if], data = [none] } else if (_prepareXARC == XAException.XAER_RMFAIL) { // Force reconnect on rollback _state = FAILED; // depends on control dependency: [if], data = [none] } throw xae; } finally { if (tc.isEntryEnabled()) { if (_vote != null) { Tr.exit(tc, "prepare", XAReturnCodeHelper.convertXACode(rc) + " (" + _vote.name() + ")"); } else { Tr.exit(tc, "prepare", XAReturnCodeHelper.convertXACode(rc)); } } if (tcSummary.isDebugEnabled()) Tr.debug(tcSummary, "xa_prepare result: " + XAReturnCodeHelper.convertXACode(rc)); } // Any other response is invalid throw new XAException(XAException.XAER_INVAL); } }
public class class_name { @Override public List<Metric> transform(QueryContext queryContext, List<Metric> metrics, List<String> constants) { if (constants == null || constants.isEmpty()) { return transform(queryContext, metrics); } if (constants.size() == 1) { if (constants.get(0).toUpperCase().equals(FULLJOIN)){ fulljoinIndicator=true; return transform(queryContext, metrics); }else if(constants.get(0).toUpperCase().equals(INTERSECT)) { fulljoinIndicator=false; return transform(queryContext, metrics); } } return mapping(metrics, constants); } }
public class class_name { @Override public List<Metric> transform(QueryContext queryContext, List<Metric> metrics, List<String> constants) { if (constants == null || constants.isEmpty()) { return transform(queryContext, metrics); // depends on control dependency: [if], data = [none] } if (constants.size() == 1) { if (constants.get(0).toUpperCase().equals(FULLJOIN)){ fulljoinIndicator=true; // depends on control dependency: [if], data = [none] return transform(queryContext, metrics); // depends on control dependency: [if], data = [none] }else if(constants.get(0).toUpperCase().equals(INTERSECT)) { fulljoinIndicator=false; // depends on control dependency: [if], data = [none] return transform(queryContext, metrics); // depends on control dependency: [if], data = [none] } } return mapping(metrics, constants); } }
public class class_name { public OutputHandler handleMessage(MessageItem msg) throws SIMPNotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleMessage", msg); //Set the current arrival time for the msg msg.setCurrentMEArrivalTimestamp(System.currentTimeMillis()); // 169892 // If message's Reliability has not been defined, // default it to that of the Destination Reliability msgReliability = msg.getReliability(); if (msgReliability == Reliability.NONE) { msgReliability = _destination.getDefaultReliability(); msg.setReliability(msgReliability); } else { // 169892 // If message's Reliability is more than destinations, for a temporary // destination this is allowed (since max storage strategy will be set), // otherwise throw an exception if (msgReliability.compareTo(_destination.getMaxReliability()) > 0) { if ((_destination.isTemporary() || _destination.getName().equals(_messageProcessor.getTDReceiverAddr().getDestinationName())) && (msg.getReliability().compareTo(Reliability.RELIABLE_PERSISTENT) >= 0 )) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "handleMessage", "Sending ASSURED message to temporary destination"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleMessage", "Reliablity greater than dest"); SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException( nls_cwsik.getFormattedMessage( "DELIVERY_ERROR_SIRC_33", // MESSAGE_RELIABILITY_ERROR_CWSIP0231 new Object[] { msg.getReliability().toString(), _destination.getMaxReliability().toString(), _destination.getName(), _messageProcessor.getMessagingEngineName()}, null)); e.setExceptionReason(SIRCConstants.SIRC0033_MESSAGE_RELIABILITY_ERROR); e.setExceptionInserts(new String[] { msg.getReliability().toString(), _destination.getMaxReliability().toString(), _destination.getName(), _messageProcessor.getMessagingEngineName()}); throw e; } } } // For a temporary destination, maximum storage strategy is STORE_MAYBE (RELIABLE_NON_PERSISTENT) if(_destination.isTemporary() || _destination.getName().equals(_messageProcessor.getTDReceiverAddr().getDestinationName())) { msg.setMaxStorageStrategy(AbstractItem.STORE_MAYBE); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleMessage"); return null; } }
public class class_name { public OutputHandler handleMessage(MessageItem msg) throws SIMPNotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleMessage", msg); //Set the current arrival time for the msg msg.setCurrentMEArrivalTimestamp(System.currentTimeMillis()); // 169892 // If message's Reliability has not been defined, // default it to that of the Destination Reliability msgReliability = msg.getReliability(); if (msgReliability == Reliability.NONE) { msgReliability = _destination.getDefaultReliability(); msg.setReliability(msgReliability); } else { // 169892 // If message's Reliability is more than destinations, for a temporary // destination this is allowed (since max storage strategy will be set), // otherwise throw an exception if (msgReliability.compareTo(_destination.getMaxReliability()) > 0) { if ((_destination.isTemporary() || _destination.getName().equals(_messageProcessor.getTDReceiverAddr().getDestinationName())) && (msg.getReliability().compareTo(Reliability.RELIABLE_PERSISTENT) >= 0 )) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "handleMessage", "Sending ASSURED message to temporary destination"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleMessage", "Reliablity greater than dest"); SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException( nls_cwsik.getFormattedMessage( "DELIVERY_ERROR_SIRC_33", // MESSAGE_RELIABILITY_ERROR_CWSIP0231 new Object[] { msg.getReliability().toString(), _destination.getMaxReliability().toString(), _destination.getName(), _messageProcessor.getMessagingEngineName()}, null)); e.setExceptionReason(SIRCConstants.SIRC0033_MESSAGE_RELIABILITY_ERROR); // depends on control dependency: [if], data = [none] e.setExceptionInserts(new String[] { msg.getReliability().toString(), _destination.getMaxReliability().toString(), _destination.getName(), _messageProcessor.getMessagingEngineName()}); // depends on control dependency: [if], data = [none] throw e; } } } // For a temporary destination, maximum storage strategy is STORE_MAYBE (RELIABLE_NON_PERSISTENT) if(_destination.isTemporary() || _destination.getName().equals(_messageProcessor.getTDReceiverAddr().getDestinationName())) { msg.setMaxStorageStrategy(AbstractItem.STORE_MAYBE); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleMessage"); return null; } }
public class class_name { public static void create( int dimensions, int numElements, Collection<? super MutableIntTuple> target) { for (int i=0; i<numElements; i++) { target.add(IntTuples.create(dimensions)); } } }
public class class_name { public static void create( int dimensions, int numElements, Collection<? super MutableIntTuple> target) { for (int i=0; i<numElements; i++) { target.add(IntTuples.create(dimensions)); // depends on control dependency: [for], data = [none] } } }
public class class_name { public LocalXAResource createLocalXAResource(ConnectionManager cm, String productName, String productVersion, String jndiName, XAResourceStatistics xastat) { LocalXAResource result = null; if (xastat != null && xastat.isEnabled()) { result = new LocalXAResourceStatImpl(productName, productVersion, jndiName, xastat); } else { result = new LocalXAResourceImpl(productName, productVersion, jndiName); } result.setConnectionManager(cm); return result; } }
public class class_name { public LocalXAResource createLocalXAResource(ConnectionManager cm, String productName, String productVersion, String jndiName, XAResourceStatistics xastat) { LocalXAResource result = null; if (xastat != null && xastat.isEnabled()) { result = new LocalXAResourceStatImpl(productName, productVersion, jndiName, xastat); // depends on control dependency: [if], data = [none] } else { result = new LocalXAResourceImpl(productName, productVersion, jndiName); // depends on control dependency: [if], data = [none] } result.setConnectionManager(cm); return result; } }
public class class_name { @Override public int[] findXYindexFromCoordBounded(double x_coord, double y_coord, int[] result) { if (result == null) result = new int[2]; if ((horizXaxis instanceof CoordinateAxis1D) && (horizYaxis instanceof CoordinateAxis1D)) { result[0] = ((CoordinateAxis1D) horizXaxis).findCoordElementBounded(x_coord); result[1] = ((CoordinateAxis1D) horizYaxis).findCoordElementBounded(y_coord); return result; } else if ((horizXaxis instanceof CoordinateAxis2D) && (horizYaxis instanceof CoordinateAxis2D)) { if (g2d == null) g2d = new GridCoordinate2D((CoordinateAxis2D) horizYaxis, (CoordinateAxis2D) horizXaxis); int[] result2 = new int[2]; g2d.findCoordElement(y_coord, x_coord, result2); // returns best guess result[0] = result2[1]; result[1] = result2[0]; return result; } // cant happen throw new IllegalStateException("GridCoordSystem.findXYindexFromCoord"); } }
public class class_name { @Override public int[] findXYindexFromCoordBounded(double x_coord, double y_coord, int[] result) { if (result == null) result = new int[2]; if ((horizXaxis instanceof CoordinateAxis1D) && (horizYaxis instanceof CoordinateAxis1D)) { result[0] = ((CoordinateAxis1D) horizXaxis).findCoordElementBounded(x_coord); // depends on control dependency: [if], data = [none] result[1] = ((CoordinateAxis1D) horizYaxis).findCoordElementBounded(y_coord); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } else if ((horizXaxis instanceof CoordinateAxis2D) && (horizYaxis instanceof CoordinateAxis2D)) { if (g2d == null) g2d = new GridCoordinate2D((CoordinateAxis2D) horizYaxis, (CoordinateAxis2D) horizXaxis); int[] result2 = new int[2]; g2d.findCoordElement(y_coord, x_coord, result2); // returns best guess // depends on control dependency: [if], data = [none] result[0] = result2[1]; // depends on control dependency: [if], data = [none] result[1] = result2[0]; // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } // cant happen throw new IllegalStateException("GridCoordSystem.findXYindexFromCoord"); } }
public class class_name { public void start(int depth) throws Exception { LOG.info(this.toString()); // register conf to all plugins // except [fetcher, generatorFilter] ConfigurationUtils.setTo(this, dbManager, executor, nextFilter); registerOtherConfigurations(); if (!resumable) { if (dbManager.isDBExists()) { dbManager.clear(); } if (seeds.isEmpty() && forcedSeeds.isEmpty()) { LOG.info("error:Please add at least one seed"); return; } } dbManager.open(); if (!seeds.isEmpty()) { inject(); } if (!forcedSeeds.isEmpty()) { injectForcedSeeds(); } status = RUNNING; for (int i = 0; i < depth; i++) { if (status == STOPED) { break; } LOG.info("start depth " + (i + 1)); long startTime = System.currentTimeMillis(); fetcher = new Fetcher(); //register fetcher conf ConfigurationUtils.setTo(this, fetcher); fetcher.setDBManager(dbManager); fetcher.setExecutor(executor); fetcher.setNextFilter(nextFilter); fetcher.setThreads(threads); int totalGenerate = fetcher.fetchAll(generatorFilter); long endTime = System.currentTimeMillis(); long costTime = (endTime - startTime) / 1000; LOG.info("depth " + (i + 1) + " finish: \n\ttotal urls:\t" + totalGenerate + "\n\ttotal time:\t" + costTime + " seconds"); if (totalGenerate == 0) { break; } } dbManager.close(); afterStop(); } }
public class class_name { public void start(int depth) throws Exception { LOG.info(this.toString()); // register conf to all plugins // except [fetcher, generatorFilter] ConfigurationUtils.setTo(this, dbManager, executor, nextFilter); registerOtherConfigurations(); if (!resumable) { if (dbManager.isDBExists()) { dbManager.clear(); // depends on control dependency: [if], data = [none] } if (seeds.isEmpty() && forcedSeeds.isEmpty()) { LOG.info("error:Please add at least one seed"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } dbManager.open(); if (!seeds.isEmpty()) { inject(); } if (!forcedSeeds.isEmpty()) { injectForcedSeeds(); } status = RUNNING; for (int i = 0; i < depth; i++) { if (status == STOPED) { break; } LOG.info("start depth " + (i + 1)); long startTime = System.currentTimeMillis(); fetcher = new Fetcher(); //register fetcher conf ConfigurationUtils.setTo(this, fetcher); fetcher.setDBManager(dbManager); fetcher.setExecutor(executor); fetcher.setNextFilter(nextFilter); fetcher.setThreads(threads); int totalGenerate = fetcher.fetchAll(generatorFilter); long endTime = System.currentTimeMillis(); long costTime = (endTime - startTime) / 1000; LOG.info("depth " + (i + 1) + " finish: \n\ttotal urls:\t" + totalGenerate + "\n\ttotal time:\t" + costTime + " seconds"); if (totalGenerate == 0) { break; } } dbManager.close(); afterStop(); } }
public class class_name { protected void resize(int new_length) { if(keys == null) { keys=new byte[Math.min(new_length, 0xff)][]; values=new byte[Math.min(new_length, 0xff)][]; return; } if(new_length > 0xff) { if(keys.length < 0xff) new_length=0xff; else throw new ArrayIndexOutOfBoundsException("the hashmap cannot exceed " + 0xff + " entries"); } keys=Arrays.copyOf(keys, new_length); values=Arrays.copyOf(values, new_length); } }
public class class_name { protected void resize(int new_length) { if(keys == null) { keys=new byte[Math.min(new_length, 0xff)][]; // depends on control dependency: [if], data = [none] values=new byte[Math.min(new_length, 0xff)][]; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if(new_length > 0xff) { if(keys.length < 0xff) new_length=0xff; else throw new ArrayIndexOutOfBoundsException("the hashmap cannot exceed " + 0xff + " entries"); } keys=Arrays.copyOf(keys, new_length); values=Arrays.copyOf(values, new_length); } }