code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private SearchNode getSearchNode() { Object x = _searchNode.get(); SearchNode g = null; if (x != null) { g = (SearchNode) x; g.reset(); } else { g = new SearchNode(); x = (Object) g; _searchNode.set(x); } return g; } }
public class class_name { private SearchNode getSearchNode() { Object x = _searchNode.get(); SearchNode g = null; if (x != null) { g = (SearchNode) x; // depends on control dependency: [if], data = [none] g.reset(); // depends on control dependency: [if], data = [none] } else { g = new SearchNode(); // depends on control dependency: [if], data = [none] x = (Object) g; // depends on control dependency: [if], data = [none] _searchNode.set(x); // depends on control dependency: [if], data = [(x] } return g; } }
public class class_name { public void invalidate() { if (transitionLength <= 0f) { currentColor.set(targetColor); redNeedsUpdate = greenNeedsUpdate = blueNeedsUpdate = alphaNeedsUpdate = false; transitionInProgress = false; } else { redNeedsUpdate = initialColor.r != targetColor.r; greenNeedsUpdate = initialColor.g != targetColor.g; blueNeedsUpdate = initialColor.b != targetColor.b; alphaNeedsUpdate = initialColor.a != targetColor.a; updateTransitionStatus(); if (transitionInProgress) { initialRedIsGreater = initialColor.r >= targetColor.r; initialGreenIsGreater = initialColor.g >= targetColor.g; initialBlueIsGreater = initialColor.b >= targetColor.b; initialAlphaIsGreater = initialColor.a >= targetColor.a; } } } }
public class class_name { public void invalidate() { if (transitionLength <= 0f) { currentColor.set(targetColor); // depends on control dependency: [if], data = [none] redNeedsUpdate = greenNeedsUpdate = blueNeedsUpdate = alphaNeedsUpdate = false; // depends on control dependency: [if], data = [none] transitionInProgress = false; // depends on control dependency: [if], data = [none] } else { redNeedsUpdate = initialColor.r != targetColor.r; // depends on control dependency: [if], data = [none] greenNeedsUpdate = initialColor.g != targetColor.g; // depends on control dependency: [if], data = [none] blueNeedsUpdate = initialColor.b != targetColor.b; // depends on control dependency: [if], data = [none] alphaNeedsUpdate = initialColor.a != targetColor.a; // depends on control dependency: [if], data = [none] updateTransitionStatus(); // depends on control dependency: [if], data = [none] if (transitionInProgress) { initialRedIsGreater = initialColor.r >= targetColor.r; // depends on control dependency: [if], data = [none] initialGreenIsGreater = initialColor.g >= targetColor.g; // depends on control dependency: [if], data = [none] initialBlueIsGreater = initialColor.b >= targetColor.b; // depends on control dependency: [if], data = [none] initialAlphaIsGreater = initialColor.a >= targetColor.a; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(InstanceFleetProvisioningSpecifications instanceFleetProvisioningSpecifications, ProtocolMarshaller protocolMarshaller) { if (instanceFleetProvisioningSpecifications == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(instanceFleetProvisioningSpecifications.getSpotSpecification(), SPOTSPECIFICATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InstanceFleetProvisioningSpecifications instanceFleetProvisioningSpecifications, ProtocolMarshaller protocolMarshaller) { if (instanceFleetProvisioningSpecifications == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(instanceFleetProvisioningSpecifications.getSpotSpecification(), SPOTSPECIFICATION_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 Object findAndGetFieldValueInHierarchy(Object instance) { Class<?> clazz = instance.getClass(); String fieldname = theField.getName(); String searchName = typeDescriptor.getName().replace('/', '.'); while (clazz != null && !clazz.getName().equals(searchName)) { clazz = clazz.getSuperclass(); } if (clazz == null) { throw new IllegalStateException("Failed to find " + searchName + " in hierarchy of " + instance.getClass()); } try { Field f = clazz.getDeclaredField(fieldname); f.setAccessible(true); return f.get(instance); } catch (Exception e) { throw new IllegalStateException("Unexpectedly could not access field named " + fieldname + " on class " + clazz.getName()); } } }
public class class_name { private Object findAndGetFieldValueInHierarchy(Object instance) { Class<?> clazz = instance.getClass(); String fieldname = theField.getName(); String searchName = typeDescriptor.getName().replace('/', '.'); while (clazz != null && !clazz.getName().equals(searchName)) { clazz = clazz.getSuperclass(); // depends on control dependency: [while], data = [none] } if (clazz == null) { throw new IllegalStateException("Failed to find " + searchName + " in hierarchy of " + instance.getClass()); } try { Field f = clazz.getDeclaredField(fieldname); f.setAccessible(true); // depends on control dependency: [try], data = [none] return f.get(instance); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalStateException("Unexpectedly could not access field named " + fieldname + " on class " + clazz.getName()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<Geometry> featureCollectionToGeometriesList( SimpleFeatureCollection collection, boolean doSubGeoms, String userDataField ) { List<Geometry> geometriesList = new ArrayList<Geometry>(); if (collection == null) { return geometriesList; } SimpleFeatureIterator featureIterator = collection.features(); while( featureIterator.hasNext() ) { SimpleFeature feature = featureIterator.next(); Geometry geometry = (Geometry) feature.getDefaultGeometry(); if (geometry != null) if (doSubGeoms) { int numGeometries = geometry.getNumGeometries(); for( int i = 0; i < numGeometries; i++ ) { Geometry geometryN = geometry.getGeometryN(i); geometriesList.add(geometryN); if (userDataField != null) { Object attribute = feature.getAttribute(userDataField); geometryN.setUserData(attribute); } } } else { geometriesList.add(geometry); if (userDataField != null) { Object attribute = feature.getAttribute(userDataField); geometry.setUserData(attribute); } } } featureIterator.close(); return geometriesList; } }
public class class_name { public static List<Geometry> featureCollectionToGeometriesList( SimpleFeatureCollection collection, boolean doSubGeoms, String userDataField ) { List<Geometry> geometriesList = new ArrayList<Geometry>(); if (collection == null) { return geometriesList; // depends on control dependency: [if], data = [none] } SimpleFeatureIterator featureIterator = collection.features(); while( featureIterator.hasNext() ) { SimpleFeature feature = featureIterator.next(); Geometry geometry = (Geometry) feature.getDefaultGeometry(); if (geometry != null) if (doSubGeoms) { int numGeometries = geometry.getNumGeometries(); for( int i = 0; i < numGeometries; i++ ) { Geometry geometryN = geometry.getGeometryN(i); geometriesList.add(geometryN); // depends on control dependency: [for], data = [none] if (userDataField != null) { Object attribute = feature.getAttribute(userDataField); geometryN.setUserData(attribute); // depends on control dependency: [if], data = [none] } } } else { geometriesList.add(geometry); // depends on control dependency: [if], data = [none] if (userDataField != null) { Object attribute = feature.getAttribute(userDataField); geometry.setUserData(attribute); // depends on control dependency: [if], data = [none] } } } featureIterator.close(); return geometriesList; } }
public class class_name { public long getDateExpires() { int pos = m_flexContextInfoList.size() - 1; if (pos < 0) { // ensure a valid position is used return CmsResource.DATE_EXPIRED_DEFAULT; } return (m_flexContextInfoList.get(pos)).getDateExpires(); } }
public class class_name { public long getDateExpires() { int pos = m_flexContextInfoList.size() - 1; if (pos < 0) { // ensure a valid position is used return CmsResource.DATE_EXPIRED_DEFAULT; // depends on control dependency: [if], data = [none] } return (m_flexContextInfoList.get(pos)).getDateExpires(); } }
public class class_name { public String toGroupByString(Criteria criteria, CriteriaQueryBuilder queryBuilder) { // query builder StringBuilder builder = new StringBuilder(); // iterate over all projections from the list Iterator<Projection> iter = projectionList.iterator(); while( iter.hasNext() ) { Projection projection = iter.next(); // call toGroupByString() on child String groupBy = projection.toGroupByString(criteria, queryBuilder); // add only if result is not null if(groupBy != null && groupBy.trim().length() > 0) { // first add a comma if the builder already contains something if(builder.length() > 0) { builder.append(","); } // add group by expression of child builder.append(groupBy); } } // return result if something has been written to the builder String result = builder.toString().trim(); if(result.length() > 0) { return result; } return null; } }
public class class_name { public String toGroupByString(Criteria criteria, CriteriaQueryBuilder queryBuilder) { // query builder StringBuilder builder = new StringBuilder(); // iterate over all projections from the list Iterator<Projection> iter = projectionList.iterator(); while( iter.hasNext() ) { Projection projection = iter.next(); // call toGroupByString() on child String groupBy = projection.toGroupByString(criteria, queryBuilder); // add only if result is not null if(groupBy != null && groupBy.trim().length() > 0) { // first add a comma if the builder already contains something if(builder.length() > 0) { builder.append(","); // depends on control dependency: [if], data = [none] } // add group by expression of child builder.append(groupBy); // depends on control dependency: [if], data = [(groupBy] } } // return result if something has been written to the builder String result = builder.toString().trim(); if(result.length() > 0) { return result; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public ContextDestroyer initiate() { validateScanners(); // Making sure scanners are properly defined. final Context context = new Context(); context.setCreateMissingDependencies(createMissingDependencies); final ContextDestroyer contextDestroyer = new ContextDestroyer(); mapInContext(context, processors); // Now context contains default processors. They are injectable. mapInContext(context, manuallyAddedComponents); // Now manually added components are in the context. initiateMetaComponents(context, contextDestroyer); // Now context contains custom annotation processors. invokeProcessorActionsBeforeInitiation(); // Processors are ready to process! initiateRegularComponents(context, contextDestroyer);// Now context contains all regular components. invokeProcessorActionsAfterInitiation(context, contextDestroyer); // Processors finish up their work. context.clear(); // Removing all components from context. if (clearProcessors) { destroyInitializer(); // Clearing meta-data. Processors are no longer available. } return contextDestroyer; } }
public class class_name { public ContextDestroyer initiate() { validateScanners(); // Making sure scanners are properly defined. final Context context = new Context(); context.setCreateMissingDependencies(createMissingDependencies); final ContextDestroyer contextDestroyer = new ContextDestroyer(); mapInContext(context, processors); // Now context contains default processors. They are injectable. mapInContext(context, manuallyAddedComponents); // Now manually added components are in the context. initiateMetaComponents(context, contextDestroyer); // Now context contains custom annotation processors. invokeProcessorActionsBeforeInitiation(); // Processors are ready to process! initiateRegularComponents(context, contextDestroyer);// Now context contains all regular components. invokeProcessorActionsAfterInitiation(context, contextDestroyer); // Processors finish up their work. context.clear(); // Removing all components from context. if (clearProcessors) { destroyInitializer(); // Clearing meta-data. Processors are no longer available. // depends on control dependency: [if], data = [none] } return contextDestroyer; } }
public class class_name { public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { Attribute leoAtt = ds.findGlobalAttribute("leoId"); if (leoAtt == null) { if (ds.findVariable("time") == null) { // create a time variable - assume its linear along the vertical dimension double start = ds.readAttributeDouble(null, "start_time", Double.NaN); double stop = ds.readAttributeDouble(null, "stop_time", Double.NaN); if (Double.isNaN(start) && Double.isNaN(stop)) { double top = ds.readAttributeDouble(null, "toptime", Double.NaN); double bot = ds.readAttributeDouble(null, "bottime", Double.NaN); this.conventionName = "Cosmic2"; if (top > bot) { stop = top; start = bot; } else { stop = bot; start = top; } } Dimension dim = ds.findDimension("MSL_alt"); Variable dimV = ds.findVariable("MSL_alt"); Array dimU = dimV.read(); int inscr = (dimU.getFloat(1) - dimU.getFloat(0)) > 0 ? 1 : 0; int n = dim.getLength(); double incr = (stop - start) / n; String timeUnits = "seconds since 1980-01-06 00:00:00"; Variable timeVar = new VariableDS(ds, null, null, "time", DataType.DOUBLE, dim.getShortName(), timeUnits, null); ds.addVariable(null, timeVar); timeVar.addAttribute(new Attribute(CDM.UNITS, timeUnits)); timeVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.toString())); int dir = ds.readAttributeInteger(null, "irs", 1); ArrayDouble.D1 data = (ArrayDouble.D1) Array.factory(DataType.DOUBLE, new int[]{n}); if (inscr == 0) { if (dir == 1) { for (int i = 0; i < n; i++) { data.set(i, start + i * incr); } } else { for (int i = 0; i < n; i++) { data.set(i, stop - i * incr); } } } else { for (int i = 0; i < n; i++) { data.set(i, stop - i * incr); } } timeVar.setCachedData(data, false); } Variable v = ds.findVariable("Lat"); if (v == null) { v = ds.findVariable("GEO_lat"); } v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lat.toString())); Variable v1 = ds.findVariable("Lon"); if (v1 == null) { v1 = ds.findVariable("GEO_lon"); } v1.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString())); } else { Dimension dim = ds.findDimension("time"); int n = dim.getLength(); Variable latVar = new VariableDS(ds, null, null, "Lat", DataType.FLOAT, dim.getShortName(), "degree", null); latVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lat.toString())); ds.addVariable(null, latVar); Variable lonVar = new VariableDS(ds, null, null, "Lon", DataType.FLOAT, dim.getShortName(), "degree", null); lonVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString())); ds.addVariable(null, lonVar); Variable altVar = new VariableDS(ds, null, null, "MSL_alt", DataType.FLOAT, dim.getShortName(), "meter", null); altVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Height.toString())); ds.addVariable(null, altVar); // cal data array ArrayFloat.D1 latData = (ArrayFloat.D1) Array.factory(DataType.FLOAT, new int[]{n}); ArrayFloat.D1 lonData = (ArrayFloat.D1) Array.factory(DataType.FLOAT, new int[]{n}); ArrayFloat.D1 altData = (ArrayFloat.D1) Array.factory(DataType.FLOAT, new int[]{n}); ArrayDouble.D1 timeData = (ArrayDouble.D1) Array.factory(DataType.DOUBLE, new int[]{n}); this.conventionName = "Cosmic3"; int iyr = ds.readAttributeInteger(null, "year", 2009); int mon = ds.readAttributeInteger(null, "month", 0); int iday = ds.readAttributeInteger(null, "day", 0); int ihr = ds.readAttributeInteger(null, "hour", 0); int min = ds.readAttributeInteger(null, "minute", 0); int sec = ds.readAttributeInteger(null, "second", 0); double start = ds.readAttributeDouble(null, "startTime", Double.NaN); double stop = ds.readAttributeDouble(null, "stopTime", Double.NaN); double incr = (stop - start) / n; int t = 0; // double julian = juday(mon, iday, iyr); // cal the dtheta based pm attributes double dtheta = gast(iyr, mon, iday, ihr, min, sec, t); Variable tVar = ds.findVariable("time"); String timeUnits = "seconds since 1980-01-06 00:00:00"; //dtime.getUnit().toString(); tVar.removeAttributeIgnoreCase(CDM.VALID_RANGE); tVar.removeAttributeIgnoreCase(CDM.UNITS); tVar.addAttribute(new Attribute(CDM.UNITS, timeUnits)); tVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.toString())); Variable v = ds.findVariable("xLeo"); Array xLeo = v.read(); v = ds.findVariable("yLeo"); Array yLeo = v.read(); v = ds.findVariable("zLeo"); Array zLeo = v.read(); double a = 6378.1370; double b = 6356.7523142; IndexIterator iiter0 = xLeo.getIndexIterator(); IndexIterator iiter1 = yLeo.getIndexIterator(); IndexIterator iiter2 = zLeo.getIndexIterator(); int i = 0; while (iiter0.hasNext()) { double[] v_inertial = new double[3]; v_inertial[0] = iiter0.getDoubleNext(); //.getDouble(i); //.nextDouble(); v_inertial[1] = iiter1.getDoubleNext(); //.getDouble(i); //.nextDouble(); v_inertial[2] = iiter2.getDoubleNext(); //.getDouble(i); //.nextDouble(); double[] uvz = new double[3]; uvz[0] = 0.0; uvz[1] = 0.0; uvz[2] = 1.0; // v_ecef should be in the (approximate) ECEF frame // double[] v_ecf = execute(v_inertial, julian); double[] v_ecf = spin(v_inertial, uvz, -1 * dtheta); // cal lat/lon here // double [] llh = ECFtoLLA(v_ecf[0]*1000, v_ecf[1]*1000, v_ecf[2]*1000, a, b); double[] llh = xyzell(a, b, v_ecf); latData.set(i, (float) llh[0]); lonData.set(i, (float) llh[1]); altData.set(i, (float) llh[2]); timeData.set(i, start + i * incr); i++; } latVar.setCachedData(latData, false); lonVar.setCachedData(lonData, false); altVar.setCachedData(altData, false); tVar.setCachedData(timeData, false); } ds.finish(); } }
public class class_name { public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { Attribute leoAtt = ds.findGlobalAttribute("leoId"); if (leoAtt == null) { if (ds.findVariable("time") == null) { // create a time variable - assume its linear along the vertical dimension double start = ds.readAttributeDouble(null, "start_time", Double.NaN); double stop = ds.readAttributeDouble(null, "stop_time", Double.NaN); if (Double.isNaN(start) && Double.isNaN(stop)) { double top = ds.readAttributeDouble(null, "toptime", Double.NaN); double bot = ds.readAttributeDouble(null, "bottime", Double.NaN); this.conventionName = "Cosmic2"; // depends on control dependency: [if], data = [none] if (top > bot) { stop = top; // depends on control dependency: [if], data = [none] start = bot; // depends on control dependency: [if], data = [none] } else { stop = bot; // depends on control dependency: [if], data = [none] start = top; // depends on control dependency: [if], data = [none] } } Dimension dim = ds.findDimension("MSL_alt"); Variable dimV = ds.findVariable("MSL_alt"); Array dimU = dimV.read(); int inscr = (dimU.getFloat(1) - dimU.getFloat(0)) > 0 ? 1 : 0; int n = dim.getLength(); double incr = (stop - start) / n; String timeUnits = "seconds since 1980-01-06 00:00:00"; Variable timeVar = new VariableDS(ds, null, null, "time", DataType.DOUBLE, dim.getShortName(), timeUnits, null); ds.addVariable(null, timeVar); timeVar.addAttribute(new Attribute(CDM.UNITS, timeUnits)); timeVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.toString())); int dir = ds.readAttributeInteger(null, "irs", 1); ArrayDouble.D1 data = (ArrayDouble.D1) Array.factory(DataType.DOUBLE, new int[]{n}); if (inscr == 0) { if (dir == 1) { for (int i = 0; i < n; i++) { data.set(i, start + i * incr); // depends on control dependency: [for], data = [i] } } else { for (int i = 0; i < n; i++) { data.set(i, stop - i * incr); // depends on control dependency: [for], data = [i] } } } else { for (int i = 0; i < n; i++) { data.set(i, stop - i * incr); // depends on control dependency: [for], data = [i] } } timeVar.setCachedData(data, false); } Variable v = ds.findVariable("Lat"); if (v == null) { v = ds.findVariable("GEO_lat"); } v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lat.toString())); Variable v1 = ds.findVariable("Lon"); if (v1 == null) { v1 = ds.findVariable("GEO_lon"); } v1.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString())); } else { Dimension dim = ds.findDimension("time"); int n = dim.getLength(); Variable latVar = new VariableDS(ds, null, null, "Lat", DataType.FLOAT, dim.getShortName(), "degree", null); latVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lat.toString())); ds.addVariable(null, latVar); Variable lonVar = new VariableDS(ds, null, null, "Lon", DataType.FLOAT, dim.getShortName(), "degree", null); lonVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString())); ds.addVariable(null, lonVar); Variable altVar = new VariableDS(ds, null, null, "MSL_alt", DataType.FLOAT, dim.getShortName(), "meter", null); altVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Height.toString())); ds.addVariable(null, altVar); // cal data array ArrayFloat.D1 latData = (ArrayFloat.D1) Array.factory(DataType.FLOAT, new int[]{n}); ArrayFloat.D1 lonData = (ArrayFloat.D1) Array.factory(DataType.FLOAT, new int[]{n}); ArrayFloat.D1 altData = (ArrayFloat.D1) Array.factory(DataType.FLOAT, new int[]{n}); ArrayDouble.D1 timeData = (ArrayDouble.D1) Array.factory(DataType.DOUBLE, new int[]{n}); this.conventionName = "Cosmic3"; int iyr = ds.readAttributeInteger(null, "year", 2009); int mon = ds.readAttributeInteger(null, "month", 0); int iday = ds.readAttributeInteger(null, "day", 0); int ihr = ds.readAttributeInteger(null, "hour", 0); int min = ds.readAttributeInteger(null, "minute", 0); int sec = ds.readAttributeInteger(null, "second", 0); double start = ds.readAttributeDouble(null, "startTime", Double.NaN); double stop = ds.readAttributeDouble(null, "stopTime", Double.NaN); double incr = (stop - start) / n; int t = 0; // double julian = juday(mon, iday, iyr); // cal the dtheta based pm attributes double dtheta = gast(iyr, mon, iday, ihr, min, sec, t); Variable tVar = ds.findVariable("time"); String timeUnits = "seconds since 1980-01-06 00:00:00"; //dtime.getUnit().toString(); tVar.removeAttributeIgnoreCase(CDM.VALID_RANGE); tVar.removeAttributeIgnoreCase(CDM.UNITS); tVar.addAttribute(new Attribute(CDM.UNITS, timeUnits)); tVar.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.toString())); Variable v = ds.findVariable("xLeo"); Array xLeo = v.read(); v = ds.findVariable("yLeo"); Array yLeo = v.read(); v = ds.findVariable("zLeo"); Array zLeo = v.read(); double a = 6378.1370; double b = 6356.7523142; IndexIterator iiter0 = xLeo.getIndexIterator(); IndexIterator iiter1 = yLeo.getIndexIterator(); IndexIterator iiter2 = zLeo.getIndexIterator(); int i = 0; while (iiter0.hasNext()) { double[] v_inertial = new double[3]; v_inertial[0] = iiter0.getDoubleNext(); //.getDouble(i); //.nextDouble(); v_inertial[1] = iiter1.getDoubleNext(); //.getDouble(i); //.nextDouble(); v_inertial[2] = iiter2.getDoubleNext(); //.getDouble(i); //.nextDouble(); double[] uvz = new double[3]; uvz[0] = 0.0; uvz[1] = 0.0; uvz[2] = 1.0; // v_ecef should be in the (approximate) ECEF frame // double[] v_ecf = execute(v_inertial, julian); double[] v_ecf = spin(v_inertial, uvz, -1 * dtheta); // cal lat/lon here // double [] llh = ECFtoLLA(v_ecf[0]*1000, v_ecf[1]*1000, v_ecf[2]*1000, a, b); double[] llh = xyzell(a, b, v_ecf); latData.set(i, (float) llh[0]); lonData.set(i, (float) llh[1]); altData.set(i, (float) llh[2]); timeData.set(i, start + i * incr); i++; } latVar.setCachedData(latData, false); lonVar.setCachedData(lonData, false); altVar.setCachedData(altData, false); tVar.setCachedData(timeData, false); } ds.finish(); } }
public class class_name { public static <K, V> Map<K, V> asHashMap(List<V> list, ListExtractor<K, V> extractor) { if (list == null || extractor == null || list.isEmpty()) { return Collections.<K, V>emptyMap(); } Map<K, V> map = new LinkedHashMap<>(list.size()); for (V node : list) { map.put(extractor.extractKey(node), extractor.extractValue(node)); } return map; } }
public class class_name { public static <K, V> Map<K, V> asHashMap(List<V> list, ListExtractor<K, V> extractor) { if (list == null || extractor == null || list.isEmpty()) { return Collections.<K, V>emptyMap(); // depends on control dependency: [if], data = [none] } Map<K, V> map = new LinkedHashMap<>(list.size()); for (V node : list) { map.put(extractor.extractKey(node), extractor.extractValue(node)); // depends on control dependency: [for], data = [node] } return map; } }
public class class_name { public <T> List<T> search(Class<T> managedClass, Name base, String filter, SearchControls scope) { Filter searchFilter = null; if(StringUtils.hasText(filter)) { searchFilter = new HardcodedFilter(filter); } return ldapTemplate.find(base, searchFilter, scope, managedClass); } }
public class class_name { public <T> List<T> search(Class<T> managedClass, Name base, String filter, SearchControls scope) { Filter searchFilter = null; if(StringUtils.hasText(filter)) { searchFilter = new HardcodedFilter(filter); // depends on control dependency: [if], data = [none] } return ldapTemplate.find(base, searchFilter, scope, managedClass); } }
public class class_name { public final void bind(SocketAddress firstLocalAddress, SocketAddress... otherLocalAddresses) throws IOException { if (firstLocalAddress == null) { bind(getDefaultLocalAddresses()); return; } List<SocketAddress> localAddresses = new ArrayList<>(2); localAddresses.add(firstLocalAddress); if (otherLocalAddresses != null) { Collections.addAll(localAddresses, otherLocalAddresses); } bind(localAddresses); } }
public class class_name { public final void bind(SocketAddress firstLocalAddress, SocketAddress... otherLocalAddresses) throws IOException { if (firstLocalAddress == null) { bind(getDefaultLocalAddresses()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } List<SocketAddress> localAddresses = new ArrayList<>(2); localAddresses.add(firstLocalAddress); if (otherLocalAddresses != null) { Collections.addAll(localAddresses, otherLocalAddresses); // depends on control dependency: [if], data = [none] } bind(localAddresses); } }
public class class_name { @SuppressWarnings("VariableNotUsedInsideIf") public Stage stage() { if (sortProject != null) { return Stage.SORT_PROJECT; } else if (sort != null) { return Stage.SORT; } else if (aggregateProject != null) { return Stage.AGGREGATE_PROJECT; } else if (havingFilter != null) { return Stage.HAVING_FILTER; } else if (aggregate != null) { return Stage.AGGREGATE; } else if (selectSort != null) { return Stage.SELECT_SORT; } else if (selectProject != null) { return Stage.SELECT_PROJECT; } else if (whereFilter != null) { return Stage.WHERE_FILTER; } else { return Stage.SCAN; } } }
public class class_name { @SuppressWarnings("VariableNotUsedInsideIf") public Stage stage() { if (sortProject != null) { return Stage.SORT_PROJECT; // depends on control dependency: [if], data = [none] } else if (sort != null) { return Stage.SORT; // depends on control dependency: [if], data = [none] } else if (aggregateProject != null) { return Stage.AGGREGATE_PROJECT; // depends on control dependency: [if], data = [none] } else if (havingFilter != null) { return Stage.HAVING_FILTER; // depends on control dependency: [if], data = [none] } else if (aggregate != null) { return Stage.AGGREGATE; // depends on control dependency: [if], data = [none] } else if (selectSort != null) { return Stage.SELECT_SORT; // depends on control dependency: [if], data = [none] } else if (selectProject != null) { return Stage.SELECT_PROJECT; // depends on control dependency: [if], data = [none] } else if (whereFilter != null) { return Stage.WHERE_FILTER; // depends on control dependency: [if], data = [none] } else { return Stage.SCAN; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static MultiLanguageText.Builder format(final MultiLanguageText.Builder multiLanguageText) { for (final MapFieldEntry.Builder entryBuilder : multiLanguageText.getEntryBuilderList()) { final String value = entryBuilder.getValue(); entryBuilder.clearValue(); entryBuilder.setValue(format(value)); } return multiLanguageText; } }
public class class_name { public static MultiLanguageText.Builder format(final MultiLanguageText.Builder multiLanguageText) { for (final MapFieldEntry.Builder entryBuilder : multiLanguageText.getEntryBuilderList()) { final String value = entryBuilder.getValue(); entryBuilder.clearValue(); // depends on control dependency: [for], data = [entryBuilder] entryBuilder.setValue(format(value)); // depends on control dependency: [for], data = [entryBuilder] } return multiLanguageText; } }
public class class_name { private boolean checkFetchingTasks(Map<URI, Future<Boolean>> concurrentTasks) { boolean result = true; Boolean fetched; for (URI modelUri : concurrentTasks.keySet()) { Future<Boolean> f = concurrentTasks.get(modelUri); try { fetched = f.get(); result = result && fetched; // Track unreachability if (fetched && this.unreachableModels.containsKey(modelUri)) { this.unreachableModels.remove(modelUri); log.info("A previously unreachable model has finally been obtained - {}", modelUri); } if (!fetched) { this.unreachableModels.put(modelUri, new Date()); log.error("Cannot load " + modelUri + ". Marked as invalid"); } } catch (Exception e) { // Mark as invalid log.error("There was an error while trying to fetch a remote model", e); this.unreachableModels.put(modelUri, new Date()); log.info("Added {} to the unreachable models list.", modelUri); result = false; } } return result; } }
public class class_name { private boolean checkFetchingTasks(Map<URI, Future<Boolean>> concurrentTasks) { boolean result = true; Boolean fetched; for (URI modelUri : concurrentTasks.keySet()) { Future<Boolean> f = concurrentTasks.get(modelUri); try { fetched = f.get(); // depends on control dependency: [try], data = [none] result = result && fetched; // depends on control dependency: [try], data = [none] // Track unreachability if (fetched && this.unreachableModels.containsKey(modelUri)) { this.unreachableModels.remove(modelUri); // depends on control dependency: [if], data = [none] log.info("A previously unreachable model has finally been obtained - {}", modelUri); // depends on control dependency: [if], data = [none] } if (!fetched) { this.unreachableModels.put(modelUri, new Date()); // depends on control dependency: [if], data = [none] log.error("Cannot load " + modelUri + ". Marked as invalid"); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // Mark as invalid log.error("There was an error while trying to fetch a remote model", e); this.unreachableModels.put(modelUri, new Date()); log.info("Added {} to the unreachable models list.", modelUri); result = false; } // depends on control dependency: [catch], data = [none] } return result; } }
public class class_name { public static List<File> findFiles(final String start, final String[] extensions) { final List<File> files = new ArrayList<>(); final Stack<File> dirs = new Stack<>(); final File startdir = new File(start); if (startdir.isDirectory()) { dirs.push(new File(start)); } while (dirs.size() > 0) { final File dirFiles = dirs.pop(); final String s[] = dirFiles.list(); if (s != null) { for (final String element : s) { final File file = new File( dirFiles.getAbsolutePath() + File.separator + element); if (file.isDirectory()) { dirs.push(file); } else if (match(element, extensions)) { files.add(file); } } } } return files; } }
public class class_name { public static List<File> findFiles(final String start, final String[] extensions) { final List<File> files = new ArrayList<>(); final Stack<File> dirs = new Stack<>(); final File startdir = new File(start); if (startdir.isDirectory()) { dirs.push(new File(start)); // depends on control dependency: [if], data = [none] } while (dirs.size() > 0) { final File dirFiles = dirs.pop(); final String s[] = dirFiles.list(); if (s != null) { for (final String element : s) { final File file = new File( dirFiles.getAbsolutePath() + File.separator + element); if (file.isDirectory()) { dirs.push(file); // depends on control dependency: [if], data = [none] } else if (match(element, extensions)) { files.add(file); // depends on control dependency: [if], data = [none] } } } } return files; } }
public class class_name { public <E> E findById(final Class<E> entityClass, final Object primaryKey) { E e = find(entityClass, primaryKey); if (e == null) { return null; } // Return a copy of this entity return (E) (e); } }
public class class_name { public <E> E findById(final Class<E> entityClass, final Object primaryKey) { E e = find(entityClass, primaryKey); if (e == null) { return null; // depends on control dependency: [if], data = [none] } // Return a copy of this entity return (E) (e); } }
public class class_name { @Override protected void onAttach() { super.onAttach(); // Adding styles to the heading depending on the parent if (getParent() != null) { if (getParent() instanceof LinkedGroupItem) { addStyleName(Styles.LIST_GROUP_ITEM_HEADING); } else if (getParent() instanceof PanelHeader) { addStyleName(Styles.PANEL_TITLE); } else if (getParent() instanceof MediaBody) { addStyleName(Styles.MEDIA_HEADING); } } } }
public class class_name { @Override protected void onAttach() { super.onAttach(); // Adding styles to the heading depending on the parent if (getParent() != null) { if (getParent() instanceof LinkedGroupItem) { addStyleName(Styles.LIST_GROUP_ITEM_HEADING); // depends on control dependency: [if], data = [none] } else if (getParent() instanceof PanelHeader) { addStyleName(Styles.PANEL_TITLE); // depends on control dependency: [if], data = [none] } else if (getParent() instanceof MediaBody) { addStyleName(Styles.MEDIA_HEADING); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static final int bytesToInt( byte[] data, int[] offset ) { /** * TODO: We use network-order within OceanStore, but temporarily * supporting intel-order to work with some JNI code until JNI code is * set to interoperate with network-order. */ int result = 0; for( int i = 0; i < SIZE_INT; ++i ) { result <<= 8; result |= byteToUnsignedInt(data[offset[0]++]); } return result; } }
public class class_name { public static final int bytesToInt( byte[] data, int[] offset ) { /** * TODO: We use network-order within OceanStore, but temporarily * supporting intel-order to work with some JNI code until JNI code is * set to interoperate with network-order. */ int result = 0; for( int i = 0; i < SIZE_INT; ++i ) { result <<= 8; // depends on control dependency: [for], data = [none] result |= byteToUnsignedInt(data[offset[0]++]); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { private void addCssHeadlines(final PrintWriter writer, final List cssHeadlines) { if (cssHeadlines == null || cssHeadlines.isEmpty()) { return; } writer.write("<!-- Start css headlines -->" + "\n<style type=\"" + WebUtilities.CONTENT_TYPE_CSS + "\" media=\"screen\">"); for (Object line : cssHeadlines) { writer.write("\n" + line); } writer.write("\n</style>" + "<!-- End css headlines -->"); } }
public class class_name { private void addCssHeadlines(final PrintWriter writer, final List cssHeadlines) { if (cssHeadlines == null || cssHeadlines.isEmpty()) { return; // depends on control dependency: [if], data = [none] } writer.write("<!-- Start css headlines -->" + "\n<style type=\"" + WebUtilities.CONTENT_TYPE_CSS + "\" media=\"screen\">"); for (Object line : cssHeadlines) { writer.write("\n" + line); // depends on control dependency: [for], data = [line] } writer.write("\n</style>" + "<!-- End css headlines -->"); } }
public class class_name { public void setValueSelected(T value, boolean selected) { int idx = getIndex(value); if (idx >= 0) { setItemSelectedInternal(idx, selected); } } }
public class class_name { public void setValueSelected(T value, boolean selected) { int idx = getIndex(value); if (idx >= 0) { setItemSelectedInternal(idx, selected); // depends on control dependency: [if], data = [(idx] } } }
public class class_name { public User updateUser(User userParam) { if(userParam != null && this.serviceTicket != null) { userParam.setServiceTicket(this.serviceTicket); } return new User(this.postJson( userParam, WS.Path.User.Version1.userUpdate())); } }
public class class_name { public User updateUser(User userParam) { if(userParam != null && this.serviceTicket != null) { userParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } return new User(this.postJson( userParam, WS.Path.User.Version1.userUpdate())); } }
public class class_name { private String appendRequestPath(String uri, Map<String, Object> headers) { if (!headers.containsKey(REQUEST_PATH_HEADER_NAME)) { return uri; } String requestUri = uri; String path = headers.get(REQUEST_PATH_HEADER_NAME).toString(); while (requestUri.endsWith("/")) { requestUri = requestUri.substring(0, requestUri.length() - 1); } while (path.startsWith("/") && path.length() > 0) { path = path.length() == 1 ? "" : path.substring(1); } return requestUri + "/" + path; } }
public class class_name { private String appendRequestPath(String uri, Map<String, Object> headers) { if (!headers.containsKey(REQUEST_PATH_HEADER_NAME)) { return uri; // depends on control dependency: [if], data = [none] } String requestUri = uri; String path = headers.get(REQUEST_PATH_HEADER_NAME).toString(); while (requestUri.endsWith("/")) { requestUri = requestUri.substring(0, requestUri.length() - 1); // depends on control dependency: [while], data = [none] } while (path.startsWith("/") && path.length() > 0) { path = path.length() == 1 ? "" : path.substring(1); // depends on control dependency: [while], data = [none] } return requestUri + "/" + path; } }
public class class_name { public void marshall(ListSizeConstraintSetsRequest listSizeConstraintSetsRequest, ProtocolMarshaller protocolMarshaller) { if (listSizeConstraintSetsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listSizeConstraintSetsRequest.getNextMarker(), NEXTMARKER_BINDING); protocolMarshaller.marshall(listSizeConstraintSetsRequest.getLimit(), LIMIT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListSizeConstraintSetsRequest listSizeConstraintSetsRequest, ProtocolMarshaller protocolMarshaller) { if (listSizeConstraintSetsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listSizeConstraintSetsRequest.getNextMarker(), NEXTMARKER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listSizeConstraintSetsRequest.getLimit(), LIMIT_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 { @Override public void notifyEntryChange(ArtifactNotification added, ArtifactNotification removed, ArtifactNotification modified, String filter) { if (listener != null) { if (isListenerFilterable()) { ((com.ibm.ws.artifact.ArtifactNotifierExtension.ArtifactListener) listener).notifyEntryChange(added, removed, modified, filter); } else { listener.notifyEntryChange(added, removed, modified); } } } }
public class class_name { @Override public void notifyEntryChange(ArtifactNotification added, ArtifactNotification removed, ArtifactNotification modified, String filter) { if (listener != null) { if (isListenerFilterable()) { ((com.ibm.ws.artifact.ArtifactNotifierExtension.ArtifactListener) listener).notifyEntryChange(added, removed, modified, filter); // depends on control dependency: [if], data = [none] } else { listener.notifyEntryChange(added, removed, modified); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static EndpointRef getSourceEndpoint(Trace fragment) { Node rootNode = fragment.getNodes().isEmpty() ? null : fragment.getNodes().get(0); if (rootNode == null) { return null; } // Create endpoint reference. If initial fragment and root node is a Producer, // then define it as a 'client' endpoint to distinguish it from the same // endpoint representing the server return new EndpointRef(rootNode.getUri(), rootNode.getOperation(), fragment.initialFragment() && rootNode instanceof Producer); } }
public class class_name { public static EndpointRef getSourceEndpoint(Trace fragment) { Node rootNode = fragment.getNodes().isEmpty() ? null : fragment.getNodes().get(0); if (rootNode == null) { return null; // depends on control dependency: [if], data = [none] } // Create endpoint reference. If initial fragment and root node is a Producer, // then define it as a 'client' endpoint to distinguish it from the same // endpoint representing the server return new EndpointRef(rootNode.getUri(), rootNode.getOperation(), fragment.initialFragment() && rootNode instanceof Producer); } }
public class class_name { public void fireAction(Action a) { for (Event e : a.getEvents(Action.Hook.PRE)) { e.visit(notificationDispatcher); } a.visit(notificationDispatcher); for (Event e : a.getEvents(Action.Hook.POST)) { e.visit(notificationDispatcher); } } }
public class class_name { public void fireAction(Action a) { for (Event e : a.getEvents(Action.Hook.PRE)) { e.visit(notificationDispatcher); // depends on control dependency: [for], data = [e] } a.visit(notificationDispatcher); for (Event e : a.getEvents(Action.Hook.POST)) { e.visit(notificationDispatcher); // depends on control dependency: [for], data = [e] } } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadataOrBuilder getTextEntityExtractionDetailsOrBuilder() { if (detailsCase_ == 13) { return (com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata) details_; } return com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata .getDefaultInstance(); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadataOrBuilder getTextEntityExtractionDetailsOrBuilder() { if (detailsCase_ == 13) { return (com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata) details_; // depends on control dependency: [if], data = [none] } return com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata .getDefaultInstance(); } }
public class class_name { public void debug(Object message, Throwable t) { if (IS12) { getLogger().log(FQCN, Level.DEBUG, message, t); } else { getLogger().log(FQCN, Level.DEBUG, message, t); } } }
public class class_name { public void debug(Object message, Throwable t) { if (IS12) { getLogger().log(FQCN, Level.DEBUG, message, t); // depends on control dependency: [if], data = [none] } else { getLogger().log(FQCN, Level.DEBUG, message, t); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Point computeGridSize( Container container, int numComponents, double aspect) { double containerSizeX = container.getWidth(); double containerSizeY = container.getHeight(); double minTotalWastedSpace = Double.MAX_VALUE; int minWasteGridSizeX = -1; for (int gridSizeX = 1; gridSizeX <= numComponents; gridSizeX++) { int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } double cellSizeX = containerSizeX / gridSizeX; double cellSizeY = containerSizeY / gridSizeY; double wastedSpace = computeWastedSpace(cellSizeX, cellSizeY, aspect); double totalWastedSpace = gridSizeX * gridSizeY * wastedSpace; if (totalWastedSpace < minTotalWastedSpace) { minTotalWastedSpace = totalWastedSpace; minWasteGridSizeX = gridSizeX; } } int gridSizeX = minWasteGridSizeX; int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } return new Point(gridSizeX, gridSizeY); } }
public class class_name { private static Point computeGridSize( Container container, int numComponents, double aspect) { double containerSizeX = container.getWidth(); double containerSizeY = container.getHeight(); double minTotalWastedSpace = Double.MAX_VALUE; int minWasteGridSizeX = -1; for (int gridSizeX = 1; gridSizeX <= numComponents; gridSizeX++) { int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; // depends on control dependency: [if], data = [none] } double cellSizeX = containerSizeX / gridSizeX; double cellSizeY = containerSizeY / gridSizeY; double wastedSpace = computeWastedSpace(cellSizeX, cellSizeY, aspect); double totalWastedSpace = gridSizeX * gridSizeY * wastedSpace; if (totalWastedSpace < minTotalWastedSpace) { minTotalWastedSpace = totalWastedSpace; // depends on control dependency: [if], data = [none] minWasteGridSizeX = gridSizeX; // depends on control dependency: [if], data = [none] } } int gridSizeX = minWasteGridSizeX; int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; // depends on control dependency: [if], data = [none] } return new Point(gridSizeX, gridSizeY); } }
public class class_name { private void initParams() { Object o; if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) { // read params from config o = null; } else { // this is not the initial call, get params from session o = getDialogObject(); } if (!(o instanceof CmsSearchWorkplaceBean)) { String oldExplorerMode = getSettings().getExplorerMode(); getSettings().setExplorerMode(null); String explorerResource = getSettings().getExplorerResource(); getSettings().setExplorerMode(oldExplorerMode); m_search = new CmsSearchWorkplaceBean(explorerResource); } else { // reuse params stored in session m_search = (CmsSearchWorkplaceBean)o; } } }
public class class_name { private void initParams() { Object o; if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) { // read params from config o = null; // depends on control dependency: [if], data = [none] } else { // this is not the initial call, get params from session o = getDialogObject(); // depends on control dependency: [if], data = [none] } if (!(o instanceof CmsSearchWorkplaceBean)) { String oldExplorerMode = getSettings().getExplorerMode(); getSettings().setExplorerMode(null); // depends on control dependency: [if], data = [none] String explorerResource = getSettings().getExplorerResource(); getSettings().setExplorerMode(oldExplorerMode); // depends on control dependency: [if], data = [none] m_search = new CmsSearchWorkplaceBean(explorerResource); // depends on control dependency: [if], data = [none] } else { // reuse params stored in session m_search = (CmsSearchWorkplaceBean)o; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void initClassPath() { /* Classpath can be specified in one of two ways, depending on whether the compilation is embedded or invoked from Jspc. 1. Calculated by the web container, and passed to Jasper in the context attribute. 2. Jspc directly invoke JspCompilationContext.setClassPath, in case the classPath initialzed here is ignored. */ StringBuilder cpath = new StringBuilder(); String sep = System.getProperty("path.separator"); cpath.append(options.getScratchDir() + sep); String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH); if (cp == null || cp.equals("")) { cp = options.getClassPath(); } if (cp != null) { classpath = cpath.toString() + cp; } // START GlassFish Issue 845 if (classpath != null) { try { classpath = URLDecoder.decode(classpath, "UTF-8"); } catch (UnsupportedEncodingException e) { if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Exception decoding classpath : " + classpath, e); } } // END GlassFish Issue 845 } }
public class class_name { private void initClassPath() { /* Classpath can be specified in one of two ways, depending on whether the compilation is embedded or invoked from Jspc. 1. Calculated by the web container, and passed to Jasper in the context attribute. 2. Jspc directly invoke JspCompilationContext.setClassPath, in case the classPath initialzed here is ignored. */ StringBuilder cpath = new StringBuilder(); String sep = System.getProperty("path.separator"); cpath.append(options.getScratchDir() + sep); String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH); if (cp == null || cp.equals("")) { cp = options.getClassPath(); // depends on control dependency: [if], data = [none] } if (cp != null) { classpath = cpath.toString() + cp; // depends on control dependency: [if], data = [none] } // START GlassFish Issue 845 if (classpath != null) { try { classpath = URLDecoder.decode(classpath, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Exception decoding classpath : " + classpath, e); } // depends on control dependency: [catch], data = [none] } // END GlassFish Issue 845 } }
public class class_name { public void marshall(AssociateTargetsWithJobRequest associateTargetsWithJobRequest, ProtocolMarshaller protocolMarshaller) { if (associateTargetsWithJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(associateTargetsWithJobRequest.getTargets(), TARGETS_BINDING); protocolMarshaller.marshall(associateTargetsWithJobRequest.getJobId(), JOBID_BINDING); protocolMarshaller.marshall(associateTargetsWithJobRequest.getComment(), COMMENT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AssociateTargetsWithJobRequest associateTargetsWithJobRequest, ProtocolMarshaller protocolMarshaller) { if (associateTargetsWithJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(associateTargetsWithJobRequest.getTargets(), TARGETS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(associateTargetsWithJobRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(associateTargetsWithJobRequest.getComment(), COMMENT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public synchronized void addSSLPropertiesFromKeyStore(WSKeyStore wsks, SSLConfig sslprops) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addSSLPropertiesFromKeyStore"); for (Enumeration<?> e = wsks.propertyNames(); e.hasMoreElements();) { String property = (String) e.nextElement(); String value = wsks.getProperty(property); sslprops.setProperty(property, value); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addSSLPropertiesFromKeyStore"); } }
public class class_name { public synchronized void addSSLPropertiesFromKeyStore(WSKeyStore wsks, SSLConfig sslprops) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addSSLPropertiesFromKeyStore"); for (Enumeration<?> e = wsks.propertyNames(); e.hasMoreElements();) { String property = (String) e.nextElement(); String value = wsks.getProperty(property); sslprops.setProperty(property, value); // depends on control dependency: [for], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addSSLPropertiesFromKeyStore"); } }
public class class_name { @ObjectiveCName("checkCall:withAttempt:") public void checkCall(long callId, int attempt) { if (modules.getCallsModule() != null) { modules.getCallsModule().checkCall(callId, attempt); } } }
public class class_name { @ObjectiveCName("checkCall:withAttempt:") public void checkCall(long callId, int attempt) { if (modules.getCallsModule() != null) { modules.getCallsModule().checkCall(callId, attempt); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ListInventoryEntriesResult withEntries(java.util.Map<String, String>... entries) { if (this.entries == null) { setEntries(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(entries.length)); } for (java.util.Map<String, String> ele : entries) { this.entries.add(ele); } return this; } }
public class class_name { public ListInventoryEntriesResult withEntries(java.util.Map<String, String>... entries) { if (this.entries == null) { setEntries(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(entries.length)); // depends on control dependency: [if], data = [none] } for (java.util.Map<String, String> ele : entries) { this.entries.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public InputSource resolveNormalized(String identifier) { String fileName = identifier; if (!fileName.endsWith(".css")) { fileName += ".scss"; } List<Class<?>> excluded = new ArrayList<>(); excluded.add(ISassResourceGenerator.class); Reader rd = null; try { rd = rsHandler.getResource(bundle, fileName, false, excluded); FilePathMapping linkedResource = getFilePathMapping(fileName); if (linkedResource != null) { addLinkedResource(linkedResource); if (bundle != null) { bundle.getLinkedFilePathMappings().add( new FilePathMapping(bundle, linkedResource.getPath(), linkedResource.getLastModified())); } } } catch (ResourceNotFoundException e) { // Do nothing } if (rd != null) { InputSource source = new InputSource(); source.setCharacterStream(rd); source.setURI(fileName); return source; } else { return null; } } }
public class class_name { @Override public InputSource resolveNormalized(String identifier) { String fileName = identifier; if (!fileName.endsWith(".css")) { fileName += ".scss"; // depends on control dependency: [if], data = [none] } List<Class<?>> excluded = new ArrayList<>(); excluded.add(ISassResourceGenerator.class); Reader rd = null; try { rd = rsHandler.getResource(bundle, fileName, false, excluded); // depends on control dependency: [try], data = [none] FilePathMapping linkedResource = getFilePathMapping(fileName); if (linkedResource != null) { addLinkedResource(linkedResource); // depends on control dependency: [if], data = [(linkedResource] if (bundle != null) { bundle.getLinkedFilePathMappings().add( new FilePathMapping(bundle, linkedResource.getPath(), linkedResource.getLastModified())); // depends on control dependency: [if], data = [none] } } } catch (ResourceNotFoundException e) { // Do nothing } // depends on control dependency: [catch], data = [none] if (rd != null) { InputSource source = new InputSource(); source.setCharacterStream(rd); // depends on control dependency: [if], data = [(rd] source.setURI(fileName); // depends on control dependency: [if], data = [none] return source; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { void doLoad(XMLReader r) throws KNXMLException { boolean main = false; while (r.getPosition() == XMLReader.START_TAG) { final String tag = r.getCurrent().getName(); if (tag.equals(TAG_EXPIRATION)) { final String a = r.getCurrent().getAttribute(ATTR_TIMEOUT); if (a != null) try { timeout = Integer.decode(a).intValue(); } catch (final NumberFormatException e) { throw new KNXMLException("malformed attribute timeout, " + a, null, r.getLineNumber()); } } else if (tag.equals(TAG_UPDATING)) while (r.read() == XMLReader.START_TAG) updating.add(new GroupAddress(r)); else if (tag.equals(TAG_INVALIDATING)) while (r.read() == XMLReader.START_TAG) invalidating.add(new GroupAddress(r)); else if (!main) { super.doLoad(r); main = true; } else throw new KNXMLException("invalid element", tag, r.getLineNumber()); r.read(); } } }
public class class_name { void doLoad(XMLReader r) throws KNXMLException { boolean main = false; while (r.getPosition() == XMLReader.START_TAG) { final String tag = r.getCurrent().getName(); if (tag.equals(TAG_EXPIRATION)) { final String a = r.getCurrent().getAttribute(ATTR_TIMEOUT); if (a != null) try { timeout = Integer.decode(a).intValue(); // depends on control dependency: [try], data = [none] } catch (final NumberFormatException e) { throw new KNXMLException("malformed attribute timeout, " + a, null, r.getLineNumber()); } // depends on control dependency: [catch], data = [none] } else if (tag.equals(TAG_UPDATING)) while (r.read() == XMLReader.START_TAG) updating.add(new GroupAddress(r)); else if (tag.equals(TAG_INVALIDATING)) while (r.read() == XMLReader.START_TAG) invalidating.add(new GroupAddress(r)); else if (!main) { super.doLoad(r); // depends on control dependency: [if], data = [none] main = true; // depends on control dependency: [if], data = [none] } else throw new KNXMLException("invalid element", tag, r.getLineNumber()); r.read(); } } }
public class class_name { public static String getClassPath(Class clazz){ CodeSource codeSource = clazz.getProtectionDomain().getCodeSource(); if(codeSource!=null) return URLUtil.toSystemID(codeSource.getLocation()); else{ URL url = clazz.getResource(clazz.getSimpleName() + ".class"); if("jar".equals(url.getProtocol())){ String path = url.getPath(); try{ return URLUtil.toSystemID(new URL(path.substring(0, path.lastIndexOf('!')))); }catch(MalformedURLException ex){ throw new ImpossibleException("as per JAR URL Syntax this should never happen", ex); } } String resource = URLUtil.toSystemID(url); String relativePath = "/"+clazz.getName().replace(".", FileUtil.SEPARATOR)+".class"; if(resource.endsWith(relativePath)) resource = resource.substring(0, resource.length()-relativePath.length()); return resource; } } }
public class class_name { public static String getClassPath(Class clazz){ CodeSource codeSource = clazz.getProtectionDomain().getCodeSource(); if(codeSource!=null) return URLUtil.toSystemID(codeSource.getLocation()); else{ URL url = clazz.getResource(clazz.getSimpleName() + ".class"); if("jar".equals(url.getProtocol())){ String path = url.getPath(); try{ return URLUtil.toSystemID(new URL(path.substring(0, path.lastIndexOf('!')))); // depends on control dependency: [try], data = [none] }catch(MalformedURLException ex){ throw new ImpossibleException("as per JAR URL Syntax this should never happen", ex); } // depends on control dependency: [catch], data = [none] } String resource = URLUtil.toSystemID(url); String relativePath = "/"+clazz.getName().replace(".", FileUtil.SEPARATOR)+".class"; if(resource.endsWith(relativePath)) resource = resource.substring(0, resource.length()-relativePath.length()); return resource; // depends on control dependency: [if], data = [none] } } }
public class class_name { private int preparedStatement(Cassandra.Client client) { Integer itemId = preparedStatements.get(client); if (itemId == null) { CqlPreparedResult result; try { result = client.prepare_cql3_query(ByteBufferUtil.bytes(cql), Compression.NONE); } catch (InvalidRequestException e) { throw new RuntimeException("failed to prepare cql query " + cql, e); } catch (TException e) { throw new RuntimeException("failed to prepare cql query " + cql, e); } Integer previousId = preparedStatements.putIfAbsent(client, Integer.valueOf(result.itemId)); itemId = previousId == null ? result.itemId : previousId; } return itemId; } }
public class class_name { private int preparedStatement(Cassandra.Client client) { Integer itemId = preparedStatements.get(client); if (itemId == null) { CqlPreparedResult result; try { result = client.prepare_cql3_query(ByteBufferUtil.bytes(cql), Compression.NONE); // depends on control dependency: [try], data = [none] } catch (InvalidRequestException e) { throw new RuntimeException("failed to prepare cql query " + cql, e); } // depends on control dependency: [catch], data = [none] catch (TException e) { throw new RuntimeException("failed to prepare cql query " + cql, e); } // depends on control dependency: [catch], data = [none] Integer previousId = preparedStatements.putIfAbsent(client, Integer.valueOf(result.itemId)); itemId = previousId == null ? result.itemId : previousId; // depends on control dependency: [if], data = [none] } return itemId; } }
public class class_name { static ResourceAddress getLowestTransportLayer(ResourceAddress transport) { if (transport.getTransport() != null) { return getLowestTransportLayer(transport.getTransport()); } return transport; } }
public class class_name { static ResourceAddress getLowestTransportLayer(ResourceAddress transport) { if (transport.getTransport() != null) { return getLowestTransportLayer(transport.getTransport()); // depends on control dependency: [if], data = [(transport.getTransport()] } return transport; } }
public class class_name { public Collection<String> getHasPluginPrefixes(Map<?, ?> formulaCache) { formula = formula.simplify(formulaCache); if (formula.isTrue()) { return null; } if (formula.isFalse()) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(); for (BooleanTerm term : formula) { StringBuffer sb = new StringBuffer(pluginName).append("!"); //$NON-NLS-1$ for (BooleanVar featureVar : new TreeSet<BooleanVar>(term)) { sb.append(featureVar.name).append("?"); //$NON-NLS-1$ if (!featureVar.state) { sb.append(":"); //$NON-NLS-1$ } } result.add(sb.toString()); } return result; } }
public class class_name { public Collection<String> getHasPluginPrefixes(Map<?, ?> formulaCache) { formula = formula.simplify(formulaCache); if (formula.isTrue()) { return null; // depends on control dependency: [if], data = [none] } if (formula.isFalse()) { return Collections.emptySet(); // depends on control dependency: [if], data = [none] } Set<String> result = new HashSet<String>(); for (BooleanTerm term : formula) { StringBuffer sb = new StringBuffer(pluginName).append("!"); //$NON-NLS-1$ for (BooleanVar featureVar : new TreeSet<BooleanVar>(term)) { sb.append(featureVar.name).append("?"); //$NON-NLS-1$ // depends on control dependency: [for], data = [featureVar] if (!featureVar.state) { sb.append(":"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } } result.add(sb.toString()); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { private BaseEntity<?> marshal() { marshalKey(); if (key instanceof Key) { entityBuilder = Entity.newBuilder((Key) key); } else { entityBuilder = FullEntity.newBuilder(key); } marshalFields(); marshalAutoTimestampFields(); if (intent == Intent.UPDATE) { marshalVersionField(); } marshalEmbeddedFields(); return entityBuilder.build(); } }
public class class_name { private BaseEntity<?> marshal() { marshalKey(); if (key instanceof Key) { entityBuilder = Entity.newBuilder((Key) key); // depends on control dependency: [if], data = [none] } else { entityBuilder = FullEntity.newBuilder(key); // depends on control dependency: [if], data = [none] } marshalFields(); marshalAutoTimestampFields(); if (intent == Intent.UPDATE) { marshalVersionField(); // depends on control dependency: [if], data = [none] } marshalEmbeddedFields(); return entityBuilder.build(); } }
public class class_name { public static Date string2DateISO(String st) { try { return new SimpleDateFormat("yyyy-MM-dd").parse(st); } catch (ParseException e) { throw new InvalidArgumentException(st); } } }
public class class_name { public static Date string2DateISO(String st) { try { return new SimpleDateFormat("yyyy-MM-dd").parse(st); // depends on control dependency: [try], data = [none] } catch (ParseException e) { throw new InvalidArgumentException(st); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void moveIndexesToNextCombination() { for (int i = currentIndexes.length - 1, j = list.size() - 1; i >= 0; i--, j--) { if (currentIndexes[i] != j) { currentIndexes[i]++; for (int k = i + 1; k < currentIndexes.length; k++) { currentIndexes[k] = currentIndexes[k - 1] + 1; } return; } } // otherwise, we are all done: currentIndexes = null; } }
public class class_name { private void moveIndexesToNextCombination() { for (int i = currentIndexes.length - 1, j = list.size() - 1; i >= 0; i--, j--) { if (currentIndexes[i] != j) { currentIndexes[i]++; // depends on control dependency: [if], data = [none] for (int k = i + 1; k < currentIndexes.length; k++) { currentIndexes[k] = currentIndexes[k - 1] + 1; // depends on control dependency: [for], data = [k] } return; // depends on control dependency: [if], data = [none] } } // otherwise, we are all done: currentIndexes = null; } }
public class class_name { private NameInfo getNameInfoForName(String name, SymbolType type) { Map<String, NameInfo> map = type == PROPERTY ? propertyNameInfo : varNameInfo; if (map.containsKey(name)) { return map.get(name); } else { NameInfo nameInfo = new NameInfo(name); map.put(name, nameInfo); symbolGraph.createNode(nameInfo); return nameInfo; } } }
public class class_name { private NameInfo getNameInfoForName(String name, SymbolType type) { Map<String, NameInfo> map = type == PROPERTY ? propertyNameInfo : varNameInfo; if (map.containsKey(name)) { return map.get(name); // depends on control dependency: [if], data = [none] } else { NameInfo nameInfo = new NameInfo(name); map.put(name, nameInfo); // depends on control dependency: [if], data = [none] symbolGraph.createNode(nameInfo); // depends on control dependency: [if], data = [none] return nameInfo; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void deleteObject(Object object) { PersistenceBroker broker = null; try { broker = getBroker(); broker.delete(object); } finally { if (broker != null) broker.close(); } } }
public class class_name { public void deleteObject(Object object) { PersistenceBroker broker = null; try { broker = getBroker(); // depends on control dependency: [try], data = [none] broker.delete(object); // depends on control dependency: [try], data = [none] } finally { if (broker != null) broker.close(); } } }
public class class_name { private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException { RandomVariable value = model.getRandomVariableForConstant(0.0); for(int periodIndex = legSchedule.getNumberOfPeriods() - 1; periodIndex >= 0; periodIndex--) { double fixingTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getFixing()); double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getPayment()); double periodLength = legSchedule.getPeriodLength(periodIndex); RandomVariable numeraireAtPayment = model.getNumeraire(paymentTime); RandomVariable monteCarloProbabilitiesAtPayment = model.getMonteCarloWeights(paymentTime); if(swaprate != 0.0) { RandomVariable periodCashFlowFix = model.getRandomVariableForConstant(swaprate * periodLength * notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment); value = value.add(periodCashFlowFix); } if(paysFloat) { RandomVariable libor = model.getLIBOR(fixingTime, fixingTime, paymentTime); RandomVariable periodCashFlowFloat = libor.mult(periodLength).mult(notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment); value = value.add(periodCashFlowFloat); } } return value; } }
public class class_name { private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException { RandomVariable value = model.getRandomVariableForConstant(0.0); for(int periodIndex = legSchedule.getNumberOfPeriods() - 1; periodIndex >= 0; periodIndex--) { double fixingTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getFixing()); double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getPayment()); double periodLength = legSchedule.getPeriodLength(periodIndex); RandomVariable numeraireAtPayment = model.getNumeraire(paymentTime); RandomVariable monteCarloProbabilitiesAtPayment = model.getMonteCarloWeights(paymentTime); if(swaprate != 0.0) { RandomVariable periodCashFlowFix = model.getRandomVariableForConstant(swaprate * periodLength * notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment); value = value.add(periodCashFlowFix); // depends on control dependency: [if], data = [none] } if(paysFloat) { RandomVariable libor = model.getLIBOR(fixingTime, fixingTime, paymentTime); RandomVariable periodCashFlowFloat = libor.mult(periodLength).mult(notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment); value = value.add(periodCashFlowFloat); // depends on control dependency: [if], data = [none] } } return value; } }
public class class_name { private static void convertLastReturnToStatement( Node block, String resultName) { Node ret = block.getLastChild(); checkArgument(ret.isReturn()); Node resultNode = getReplacementReturnStatement(ret, resultName); if (resultNode == null) { block.removeChild(ret); } else { resultNode.useSourceInfoIfMissingFromForTree(ret); block.replaceChild(ret, resultNode); } } }
public class class_name { private static void convertLastReturnToStatement( Node block, String resultName) { Node ret = block.getLastChild(); checkArgument(ret.isReturn()); Node resultNode = getReplacementReturnStatement(ret, resultName); if (resultNode == null) { block.removeChild(ret); // depends on control dependency: [if], data = [none] } else { resultNode.useSourceInfoIfMissingFromForTree(ret); // depends on control dependency: [if], data = [none] block.replaceChild(ret, resultNode); // depends on control dependency: [if], data = [none] } } }
public class class_name { public GetLoadBalancerTlsCertificatesResult withTlsCertificates(LoadBalancerTlsCertificate... tlsCertificates) { if (this.tlsCertificates == null) { setTlsCertificates(new java.util.ArrayList<LoadBalancerTlsCertificate>(tlsCertificates.length)); } for (LoadBalancerTlsCertificate ele : tlsCertificates) { this.tlsCertificates.add(ele); } return this; } }
public class class_name { public GetLoadBalancerTlsCertificatesResult withTlsCertificates(LoadBalancerTlsCertificate... tlsCertificates) { if (this.tlsCertificates == null) { setTlsCertificates(new java.util.ArrayList<LoadBalancerTlsCertificate>(tlsCertificates.length)); // depends on control dependency: [if], data = [none] } for (LoadBalancerTlsCertificate ele : tlsCertificates) { this.tlsCertificates.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private List<ViewProperty> getViewPropertiesExcludingField(Bean bean, String excludedFieldName) { List<ViewProperty> result = new ArrayList<>(); for (Property property:bean.properties) { if (!property.relation.isComponentLink() && !property.name.equals(excludedFieldName)) { result.addAll(property.viewProperties); } } return result; } }
public class class_name { private List<ViewProperty> getViewPropertiesExcludingField(Bean bean, String excludedFieldName) { List<ViewProperty> result = new ArrayList<>(); for (Property property:bean.properties) { if (!property.relation.isComponentLink() && !property.name.equals(excludedFieldName)) { result.addAll(property.viewProperties); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { @Override public void start() { initLogger(); log.info("PROPS start ----------"); props = createProps(); props.loadSystemProperties("sys"); props.loadEnvironment("env"); log.debug("Loaded sys&env props: " + props.countTotalProperties() + " properties."); props.setActiveProfiles(propsProfiles.toArray(new String[0])); // prepare patterns final String[] patterns = new String[propsNamePatterns.size() + 1]; patterns[0] = "/" + nameSupplier.get() + "*.prop*"; for (int i = 0; i < propsNamePatterns.size(); i++) { patterns[i + 1] = propsNamePatterns.get(i); } log.debug("Loading props from classpath..."); final long startTime = System.currentTimeMillis(); props.loadFromClasspath(patterns); log.debug("Props scanning completed in " + (System.currentTimeMillis() - startTime) + "ms."); log.debug("Total properties: " + props.countTotalProperties()); log.info("PROPS OK!"); } }
public class class_name { @Override public void start() { initLogger(); log.info("PROPS start ----------"); props = createProps(); props.loadSystemProperties("sys"); props.loadEnvironment("env"); log.debug("Loaded sys&env props: " + props.countTotalProperties() + " properties."); props.setActiveProfiles(propsProfiles.toArray(new String[0])); // prepare patterns final String[] patterns = new String[propsNamePatterns.size() + 1]; patterns[0] = "/" + nameSupplier.get() + "*.prop*"; for (int i = 0; i < propsNamePatterns.size(); i++) { patterns[i + 1] = propsNamePatterns.get(i); // depends on control dependency: [for], data = [i] } log.debug("Loading props from classpath..."); final long startTime = System.currentTimeMillis(); props.loadFromClasspath(patterns); log.debug("Props scanning completed in " + (System.currentTimeMillis() - startTime) + "ms."); log.debug("Total properties: " + props.countTotalProperties()); log.info("PROPS OK!"); } }
public class class_name { public static String streamToString(InputStream is, String charsetName) { try { Reader r = null; try { r = new BufferedReader(new InputStreamReader(is, charsetName)); return readerToString(r); } finally { if (r != null) { try { r.close(); } catch (IOException e) { } } } } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public static String streamToString(InputStream is, String charsetName) { try { Reader r = null; try { r = new BufferedReader(new InputStreamReader(is, charsetName)); // depends on control dependency: [try], data = [none] return readerToString(r); // depends on control dependency: [try], data = [none] } finally { if (r != null) { try { r.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { } // depends on control dependency: [catch], data = [none] } } } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Status[] getStatus(String[] pdbIds) { Status[] statuses = new Status[pdbIds.length]; List<Map<String,String>> attrList = getStatusIdRecords(pdbIds); //Expect a single record if(attrList == null || attrList.size() != pdbIds.length) { logger.error("Error getting Status for {} from the PDB website.", Arrays.toString(pdbIds)); return null; } for(int pdbNum = 0;pdbNum<pdbIds.length;pdbNum++) { //Locate first element of attrList with matching structureId. //attrList is usually short, so don't worry about performance boolean foundAttr = false; for( Map<String,String> attrs : attrList) { //Check that the record matches pdbId String id = attrs.get("structureId"); if(id == null || !id.equalsIgnoreCase(pdbIds[pdbNum])) { continue; } //Check that the status is given String statusStr = attrs.get("status"); Status status = null; if(statusStr == null ) { logger.error("No status returned for {}", pdbIds[pdbNum]); statuses[pdbNum] = null; } else { status = Status.fromString(statusStr); } if(status == null) { logger.error("Unknown status '{}'", statusStr); statuses[pdbNum] = null; } statuses[pdbNum] = status; foundAttr = true; } if(!foundAttr) { logger.error("No result found for {}", pdbIds[pdbNum]); statuses[pdbNum] = null; } } return statuses; } }
public class class_name { public static Status[] getStatus(String[] pdbIds) { Status[] statuses = new Status[pdbIds.length]; List<Map<String,String>> attrList = getStatusIdRecords(pdbIds); //Expect a single record if(attrList == null || attrList.size() != pdbIds.length) { logger.error("Error getting Status for {} from the PDB website.", Arrays.toString(pdbIds)); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } for(int pdbNum = 0;pdbNum<pdbIds.length;pdbNum++) { //Locate first element of attrList with matching structureId. //attrList is usually short, so don't worry about performance boolean foundAttr = false; for( Map<String,String> attrs : attrList) { //Check that the record matches pdbId String id = attrs.get("structureId"); if(id == null || !id.equalsIgnoreCase(pdbIds[pdbNum])) { continue; } //Check that the status is given String statusStr = attrs.get("status"); Status status = null; if(statusStr == null ) { logger.error("No status returned for {}", pdbIds[pdbNum]); // depends on control dependency: [if], data = [none] statuses[pdbNum] = null; // depends on control dependency: [if], data = [none] } else { status = Status.fromString(statusStr); // depends on control dependency: [if], data = [(statusStr] } if(status == null) { logger.error("Unknown status '{}'", statusStr); // depends on control dependency: [if], data = [none] statuses[pdbNum] = null; // depends on control dependency: [if], data = [none] } statuses[pdbNum] = status; // depends on control dependency: [for], data = [none] foundAttr = true; // depends on control dependency: [for], data = [none] } if(!foundAttr) { logger.error("No result found for {}", pdbIds[pdbNum]); // depends on control dependency: [if], data = [none] statuses[pdbNum] = null; // depends on control dependency: [if], data = [none] } } return statuses; } }
public class class_name { public ArrayObject make1DStringArray() { int nelems = (getRank() == 0) ? 1 : (int) getSize() / indexCalc.getShape(getRank()-1); Array sarr = Array.factory(DataType.STRING, new int[]{nelems}); IndexIterator newsiter = sarr.getIndexIterator(); ArrayChar.StringIterator siter = getStringIterator(); while (siter.hasNext()) { newsiter.setObjectNext(siter.next()); } return (ArrayObject) sarr; } }
public class class_name { public ArrayObject make1DStringArray() { int nelems = (getRank() == 0) ? 1 : (int) getSize() / indexCalc.getShape(getRank()-1); Array sarr = Array.factory(DataType.STRING, new int[]{nelems}); IndexIterator newsiter = sarr.getIndexIterator(); ArrayChar.StringIterator siter = getStringIterator(); while (siter.hasNext()) { newsiter.setObjectNext(siter.next()); // depends on control dependency: [while], data = [none] } return (ArrayObject) sarr; } }
public class class_name { private void updateDisplay(boolean allowEmptyDisplay) { if (!allowEmptyDisplay && mTypedTimes.isEmpty()) { int hour = mTimePicker.getHours(); int minute = mTimePicker.getMinutes(); int second = mTimePicker.getSeconds(); setHour(hour, true); setMinute(minute); setSecond(second); if (!mIs24HourMode) { updateAmPmDisplay(hour < 12? AM : PM); } setCurrentItemShowing(mTimePicker.getCurrentItemShowing(), true, true, true); mOkButton.setEnabled(true); } else { Boolean[] enteredZeros = {false, false, false}; int[] values = getEnteredTime(enteredZeros); String hourFormat = enteredZeros[0] ? "%02d" : "%2d"; String minuteFormat = (enteredZeros[1]) ? "%02d" : "%2d"; String secondFormat = (enteredZeros[1]) ? "%02d" : "%2d"; String hourStr = (values[0] == -1) ? mDoublePlaceholderText : String.format(hourFormat, values[0]).replace(' ', mPlaceholderText); String minuteStr = (values[1] == -1) ? mDoublePlaceholderText : String.format(minuteFormat, values[1]).replace(' ', mPlaceholderText); String secondStr = (values[2] == -1) ? mDoublePlaceholderText : String.format(secondFormat, values[1]).replace(' ', mPlaceholderText); mHourView.setText(hourStr); mHourSpaceView.setText(hourStr); mHourView.setTextColor(mUnselectedColor); mMinuteView.setText(minuteStr); mMinuteSpaceView.setText(minuteStr); mMinuteView.setTextColor(mUnselectedColor); mSecondView.setText(secondStr); mSecondSpaceView.setText(secondStr); mSecondView.setTextColor(mUnselectedColor); if (!mIs24HourMode) { updateAmPmDisplay(values[3]); } } } }
public class class_name { private void updateDisplay(boolean allowEmptyDisplay) { if (!allowEmptyDisplay && mTypedTimes.isEmpty()) { int hour = mTimePicker.getHours(); int minute = mTimePicker.getMinutes(); int second = mTimePicker.getSeconds(); setHour(hour, true); // depends on control dependency: [if], data = [none] setMinute(minute); // depends on control dependency: [if], data = [none] setSecond(second); // depends on control dependency: [if], data = [none] if (!mIs24HourMode) { updateAmPmDisplay(hour < 12? AM : PM); // depends on control dependency: [if], data = [none] } setCurrentItemShowing(mTimePicker.getCurrentItemShowing(), true, true, true); // depends on control dependency: [if], data = [none] mOkButton.setEnabled(true); // depends on control dependency: [if], data = [none] } else { Boolean[] enteredZeros = {false, false, false}; int[] values = getEnteredTime(enteredZeros); String hourFormat = enteredZeros[0] ? "%02d" : "%2d"; String minuteFormat = (enteredZeros[1]) ? "%02d" : "%2d"; String secondFormat = (enteredZeros[1]) ? "%02d" : "%2d"; String hourStr = (values[0] == -1) ? mDoublePlaceholderText : String.format(hourFormat, values[0]).replace(' ', mPlaceholderText); String minuteStr = (values[1] == -1) ? mDoublePlaceholderText : String.format(minuteFormat, values[1]).replace(' ', mPlaceholderText); String secondStr = (values[2] == -1) ? mDoublePlaceholderText : String.format(secondFormat, values[1]).replace(' ', mPlaceholderText); mHourView.setText(hourStr); // depends on control dependency: [if], data = [none] mHourSpaceView.setText(hourStr); // depends on control dependency: [if], data = [none] mHourView.setTextColor(mUnselectedColor); // depends on control dependency: [if], data = [none] mMinuteView.setText(minuteStr); // depends on control dependency: [if], data = [none] mMinuteSpaceView.setText(minuteStr); // depends on control dependency: [if], data = [none] mMinuteView.setTextColor(mUnselectedColor); // depends on control dependency: [if], data = [none] mSecondView.setText(secondStr); // depends on control dependency: [if], data = [none] mSecondSpaceView.setText(secondStr); // depends on control dependency: [if], data = [none] mSecondView.setTextColor(mUnselectedColor); // depends on control dependency: [if], data = [none] if (!mIs24HourMode) { updateAmPmDisplay(values[3]); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Pure public IntegerProperty heightProperty() { if (this.height == null) { this.height = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.HEIGHT); this.height.bind(Bindings.subtract(maxYProperty(), minYProperty())); } return this.height; } }
public class class_name { @Pure public IntegerProperty heightProperty() { if (this.height == null) { this.height = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.HEIGHT); // depends on control dependency: [if], data = [none] this.height.bind(Bindings.subtract(maxYProperty(), minYProperty())); // depends on control dependency: [if], data = [none] } return this.height; } }
public class class_name { @PUT @Produces({ MediaType.TEXT_PLAIN }) public Response reportStartup(@QueryParam("bpid") String bpId, @QueryParam("url4cc") String urlForCc, @QueryParam("url4bpc") String urlForBpc) { if (!monitoringService.isRegistered(bpId)) { // first startup monitoringService.register(bpId, urlForCc, urlForBpc); return Response.created(URI.create(urlForBpc)).build(); } else { // startup after a crash or a shutdown monitoringService.update(bpId, urlForCc, urlForBpc); return Response.noContent().build(); } } }
public class class_name { @PUT @Produces({ MediaType.TEXT_PLAIN }) public Response reportStartup(@QueryParam("bpid") String bpId, @QueryParam("url4cc") String urlForCc, @QueryParam("url4bpc") String urlForBpc) { if (!monitoringService.isRegistered(bpId)) { // first startup monitoringService.register(bpId, urlForCc, urlForBpc); // depends on control dependency: [if], data = [none] return Response.created(URI.create(urlForBpc)).build(); // depends on control dependency: [if], data = [none] } else { // startup after a crash or a shutdown monitoringService.update(bpId, urlForCc, urlForBpc); // depends on control dependency: [if], data = [none] return Response.noContent().build(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isDisjunct() { for (int i = 0, n = this.intervals.size() - 1; i < n; i++) { ChronoInterval<T> current = this.intervals.get(i); ChronoInterval<T> next = this.intervals.get(i + 1); if (current.getEnd().isInfinite() || next.getStart().isInfinite()) { return false; } else if (current.getEnd().isOpen()) { if (this.isAfter(current.getEnd().getTemporal(), next.getStart().getTemporal())) { return false; } } else if (!this.isBefore(current.getEnd().getTemporal(), next.getStart().getTemporal())) { return false; } } return true; } }
public class class_name { public boolean isDisjunct() { for (int i = 0, n = this.intervals.size() - 1; i < n; i++) { ChronoInterval<T> current = this.intervals.get(i); ChronoInterval<T> next = this.intervals.get(i + 1); if (current.getEnd().isInfinite() || next.getStart().isInfinite()) { return false; // depends on control dependency: [if], data = [none] } else if (current.getEnd().isOpen()) { if (this.isAfter(current.getEnd().getTemporal(), next.getStart().getTemporal())) { return false; // depends on control dependency: [if], data = [none] } } else if (!this.isBefore(current.getEnd().getTemporal(), next.getStart().getTemporal())) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { @SuppressWarnings("WeakerAccess") public ApiFuture<List<Instance>> listInstancesAsync() { com.google.bigtable.admin.v2.ListInstancesRequest request = com.google.bigtable.admin.v2.ListInstancesRequest.newBuilder() .setParent(NameUtil.formatProjectName(projectId)) .build(); ApiFuture<com.google.bigtable.admin.v2.ListInstancesResponse> responseFuture = stub.listInstancesCallable().futureCall(request); return ApiFutures.transform( responseFuture, new ApiFunction<com.google.bigtable.admin.v2.ListInstancesResponse, List<Instance>>() { @Override public List<Instance> apply(com.google.bigtable.admin.v2.ListInstancesResponse proto) { // NOTE: pagination is intentionally ignored. The server does not implement it and never // will. Verify.verify( proto.getNextPageToken().isEmpty(), "Server returned an unexpected paginated response"); ImmutableList.Builder<Instance> instances = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Instance protoInstance : proto.getInstancesList()) { instances.add(Instance.fromProto(protoInstance)); } ImmutableList.Builder<String> failedZones = ImmutableList.builder(); for (String locationStr : proto.getFailedLocationsList()) { failedZones.add(NameUtil.extractZoneIdFromLocationName(locationStr)); } if (!failedZones.build().isEmpty()) { throw new PartialListInstancesException(failedZones.build(), instances.build()); } return instances.build(); } }, MoreExecutors.directExecutor()); } }
public class class_name { @SuppressWarnings("WeakerAccess") public ApiFuture<List<Instance>> listInstancesAsync() { com.google.bigtable.admin.v2.ListInstancesRequest request = com.google.bigtable.admin.v2.ListInstancesRequest.newBuilder() .setParent(NameUtil.formatProjectName(projectId)) .build(); ApiFuture<com.google.bigtable.admin.v2.ListInstancesResponse> responseFuture = stub.listInstancesCallable().futureCall(request); return ApiFutures.transform( responseFuture, new ApiFunction<com.google.bigtable.admin.v2.ListInstancesResponse, List<Instance>>() { @Override public List<Instance> apply(com.google.bigtable.admin.v2.ListInstancesResponse proto) { // NOTE: pagination is intentionally ignored. The server does not implement it and never // will. Verify.verify( proto.getNextPageToken().isEmpty(), "Server returned an unexpected paginated response"); ImmutableList.Builder<Instance> instances = ImmutableList.builder(); for (com.google.bigtable.admin.v2.Instance protoInstance : proto.getInstancesList()) { instances.add(Instance.fromProto(protoInstance)); // depends on control dependency: [for], data = [protoInstance] } ImmutableList.Builder<String> failedZones = ImmutableList.builder(); for (String locationStr : proto.getFailedLocationsList()) { failedZones.add(NameUtil.extractZoneIdFromLocationName(locationStr)); // depends on control dependency: [for], data = [locationStr] } if (!failedZones.build().isEmpty()) { throw new PartialListInstancesException(failedZones.build(), instances.build()); } return instances.build(); } }, MoreExecutors.directExecutor()); } }
public class class_name { @Override public void afterPropertiesSet() throws Exception { // NOPMD final boolean isQCEnabld = isQCEnabled(); // iterator over the list of possible external resources // only one of the resources should exist // this is to support special locations on special modules such as: Web // etc. Resource customerPropertyResource = null; // Resource customerXmlResource = null; Resource deploymentResource = null; Resource qcResource = null; if (isQCEnabld) { LOGGER.info("Found the ConfigurationTest class indicating that QC config is to be used instead of deployment and customer config files!"); qcResource = validateQCResource(); } else { customerPropertyResource = validateCustomerPropertyConfig(); deploymentResource = validateDeploymentConfig(); if (!printedToLog) { StringBuffer logMessageBuffer = new StringBuffer("The customer resources loaded are:"); printResourcesLoaded(logMessageBuffer, customerPropertyResource); if(applicationState != null){ applicationState.setState(FoundationLevel.INFO, logMessageBuffer.toString()); } if (deploymentResource != null) { logMessageBuffer = new StringBuffer("The deployment resources loaded are:"); printResourcesLoaded(logMessageBuffer, deploymentResource); if(applicationState != null) { applicationState.setState(FoundationLevel.INFO, logMessageBuffer.toString()); } } } } // get all the resources of the internal property config files. final Resource[] internalPropertyResources = context.getResources(internalPropertyConfig); final List<Resource> internalPropertyResourcesList = Arrays.asList(internalPropertyResources); // get all the resources of the internal xml config files. // xml resources take precedence over the properties loaded. final Resource[] internalXmlResources = context.getResources(internalXmlConfig); final List<Resource> internalXmlResourcesList = Arrays.asList(internalXmlResources); if (!printedToLog) { final StringBuffer logMessageBuffer = new StringBuffer("The default resources loaded are:"); printResourcesLoaded(logMessageBuffer, internalXmlResourcesList); printResourcesLoaded(logMessageBuffer, internalPropertyResourcesList); if(applicationState != null) { applicationState.setState(FoundationLevel.INFO, logMessageBuffer.toString()); } printedToLog = true; } // order of the resources is important to maintain properly the // hierarchy of the configuration. resourcesList.addAll(internalPropertyResourcesList); // xml resources take precedence over the properties loaded. resourcesList.addAll(internalXmlResourcesList); if (deploymentResource != null) { resourcesList.add(deploymentResource); } if (customerPropertyResource != null) { resourcesList.add(customerPropertyResource); } // xml customer resource take precedence over the properties loaded. // if (customerXmlResource != null) { // resourcesList.add(customerXmlResource); // } if (qcResource != null) { resourcesList.add(qcResource); } } }
public class class_name { @Override public void afterPropertiesSet() throws Exception { // NOPMD final boolean isQCEnabld = isQCEnabled(); // iterator over the list of possible external resources // only one of the resources should exist // this is to support special locations on special modules such as: Web // etc. Resource customerPropertyResource = null; // Resource customerXmlResource = null; Resource deploymentResource = null; Resource qcResource = null; if (isQCEnabld) { LOGGER.info("Found the ConfigurationTest class indicating that QC config is to be used instead of deployment and customer config files!"); qcResource = validateQCResource(); } else { customerPropertyResource = validateCustomerPropertyConfig(); deploymentResource = validateDeploymentConfig(); if (!printedToLog) { StringBuffer logMessageBuffer = new StringBuffer("The customer resources loaded are:"); printResourcesLoaded(logMessageBuffer, customerPropertyResource); // depends on control dependency: [if], data = [none] if(applicationState != null){ applicationState.setState(FoundationLevel.INFO, logMessageBuffer.toString()); // depends on control dependency: [if], data = [none] } if (deploymentResource != null) { logMessageBuffer = new StringBuffer("The deployment resources loaded are:"); // depends on control dependency: [if], data = [none] printResourcesLoaded(logMessageBuffer, deploymentResource); // depends on control dependency: [if], data = [none] if(applicationState != null) { applicationState.setState(FoundationLevel.INFO, logMessageBuffer.toString()); // depends on control dependency: [if], data = [none] } } } } // get all the resources of the internal property config files. final Resource[] internalPropertyResources = context.getResources(internalPropertyConfig); final List<Resource> internalPropertyResourcesList = Arrays.asList(internalPropertyResources); // get all the resources of the internal xml config files. // xml resources take precedence over the properties loaded. final Resource[] internalXmlResources = context.getResources(internalXmlConfig); final List<Resource> internalXmlResourcesList = Arrays.asList(internalXmlResources); if (!printedToLog) { final StringBuffer logMessageBuffer = new StringBuffer("The default resources loaded are:"); printResourcesLoaded(logMessageBuffer, internalXmlResourcesList); printResourcesLoaded(logMessageBuffer, internalPropertyResourcesList); if(applicationState != null) { applicationState.setState(FoundationLevel.INFO, logMessageBuffer.toString()); // depends on control dependency: [if], data = [none] } printedToLog = true; } // order of the resources is important to maintain properly the // hierarchy of the configuration. resourcesList.addAll(internalPropertyResourcesList); // xml resources take precedence over the properties loaded. resourcesList.addAll(internalXmlResourcesList); if (deploymentResource != null) { resourcesList.add(deploymentResource); } if (customerPropertyResource != null) { resourcesList.add(customerPropertyResource); } // xml customer resource take precedence over the properties loaded. // if (customerXmlResource != null) { // resourcesList.add(customerXmlResource); // } if (qcResource != null) { resourcesList.add(qcResource); } } }
public class class_name { private static void run(String[] args) { try { LOG.debug("All environment variables: {}", ENV); final String currDir = ENV.get(Environment.PWD.key()); LOG.info("Current working Directory: {}", currDir); final Configuration configuration = GlobalConfiguration.loadConfiguration(currDir); //TODO provide path. FileSystem.initialize(configuration, PluginUtils.createPluginManagerFromRootFolder(Optional.empty())); setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV); final String containerId = ENV.get(YarnResourceManager.ENV_FLINK_CONTAINER_ID); Preconditions.checkArgument(containerId != null, "ContainerId variable %s not set", YarnResourceManager.ENV_FLINK_CONTAINER_ID); SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> { TaskManagerRunner.runTaskManager(configuration, new ResourceID(containerId)); return null; }); } catch (Throwable t) { final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class); // make sure that everything whatever ends up in the log LOG.error("YARN TaskManager initialization failed.", strippedThrowable); System.exit(INIT_ERROR_EXIT_CODE); } } }
public class class_name { private static void run(String[] args) { try { LOG.debug("All environment variables: {}", ENV); // depends on control dependency: [try], data = [none] final String currDir = ENV.get(Environment.PWD.key()); LOG.info("Current working Directory: {}", currDir); // depends on control dependency: [try], data = [none] final Configuration configuration = GlobalConfiguration.loadConfiguration(currDir); //TODO provide path. FileSystem.initialize(configuration, PluginUtils.createPluginManagerFromRootFolder(Optional.empty())); // depends on control dependency: [try], data = [none] setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV); // depends on control dependency: [try], data = [none] final String containerId = ENV.get(YarnResourceManager.ENV_FLINK_CONTAINER_ID); Preconditions.checkArgument(containerId != null, "ContainerId variable %s not set", YarnResourceManager.ENV_FLINK_CONTAINER_ID); // depends on control dependency: [try], data = [none] SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> { TaskManagerRunner.runTaskManager(configuration, new ResourceID(containerId)); return null; }); // depends on control dependency: [try], data = [none] } catch (Throwable t) { final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class); // make sure that everything whatever ends up in the log LOG.error("YARN TaskManager initialization failed.", strippedThrowable); System.exit(INIT_ERROR_EXIT_CODE); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<MessageValidator<? extends ValidationContext>> findMessageValidators(String messageType, Message message) { List<MessageValidator<? extends ValidationContext>> matchingValidators = new ArrayList<>(); for (MessageValidator<? extends ValidationContext> validator : messageValidators) { if (validator.supportsMessageType(messageType, message)) { matchingValidators.add(validator); } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { // try to find fallback message validator for given message payload if (message.getPayload() instanceof String && StringUtils.hasText(message.getPayload(String.class))) { String payload = message.getPayload(String.class).trim(); if (payload.startsWith("<") && !messageType.equals(MessageType.XML.name())) { matchingValidators = findFallbackMessageValidators(MessageType.XML.name(), message); } else if ((payload.trim().startsWith("{") || payload.trim().startsWith("[")) && !messageType.equals(MessageType.JSON.name())) { matchingValidators = findFallbackMessageValidators(MessageType.JSON.name(), message); } else if (!messageType.equals(MessageType.PLAINTEXT.name())) { matchingValidators = findFallbackMessageValidators(MessageType.PLAINTEXT.name(), message); } } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { throw new CitrusRuntimeException("Could not find proper message validator for message type '" + messageType + "', please define a capable message validator for this message type"); } if (log.isDebugEnabled()) { log.debug(String.format("Found %s message validators for message type: %s", matchingValidators.size(), messageType)); } return matchingValidators; } }
public class class_name { public List<MessageValidator<? extends ValidationContext>> findMessageValidators(String messageType, Message message) { List<MessageValidator<? extends ValidationContext>> matchingValidators = new ArrayList<>(); for (MessageValidator<? extends ValidationContext> validator : messageValidators) { if (validator.supportsMessageType(messageType, message)) { matchingValidators.add(validator); // depends on control dependency: [if], data = [none] } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { // try to find fallback message validator for given message payload if (message.getPayload() instanceof String && StringUtils.hasText(message.getPayload(String.class))) { String payload = message.getPayload(String.class).trim(); if (payload.startsWith("<") && !messageType.equals(MessageType.XML.name())) { matchingValidators = findFallbackMessageValidators(MessageType.XML.name(), message); // depends on control dependency: [if], data = [none] } else if ((payload.trim().startsWith("{") || payload.trim().startsWith("[")) && !messageType.equals(MessageType.JSON.name())) { matchingValidators = findFallbackMessageValidators(MessageType.JSON.name(), message); // depends on control dependency: [if], data = [none] } else if (!messageType.equals(MessageType.PLAINTEXT.name())) { matchingValidators = findFallbackMessageValidators(MessageType.PLAINTEXT.name(), message); // depends on control dependency: [if], data = [none] } } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { throw new CitrusRuntimeException("Could not find proper message validator for message type '" + messageType + "', please define a capable message validator for this message type"); } if (log.isDebugEnabled()) { log.debug(String.format("Found %s message validators for message type: %s", matchingValidators.size(), messageType)); // depends on control dependency: [if], data = [none] } return matchingValidators; } }
public class class_name { public void auditProvideAndRegisterDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String submissionSetUniqueId, String patientId) { if (!isAuditorEnabled()) { return; } auditProvideAndRegisterEvent( new IHETransactionEventTypeCodes.ProvideAndRegisterDocumentSet(), eventOutcome, repositoryEndpointUri, userName, submissionSetUniqueId, patientId, null, null); } }
public class class_name { public void auditProvideAndRegisterDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String submissionSetUniqueId, String patientId) { if (!isAuditorEnabled()) { return; // depends on control dependency: [if], data = [none] } auditProvideAndRegisterEvent( new IHETransactionEventTypeCodes.ProvideAndRegisterDocumentSet(), eventOutcome, repositoryEndpointUri, userName, submissionSetUniqueId, patientId, null, null); } }
public class class_name { private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet, @AttrRes final int defaultStyle, @StyleRes final int defaultStyleResource) { TypedArray typedArray = getContext() .obtainStyledAttributes(attributeSet, R.styleable.AbstractListPreference, defaultStyle, defaultStyleResource); try { obtainDialogItemColor(typedArray); obtainEntries(typedArray); obtainEntryValues(typedArray); obtainDialogScrollableArea(typedArray); } finally { typedArray.recycle(); } } }
public class class_name { private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet, @AttrRes final int defaultStyle, @StyleRes final int defaultStyleResource) { TypedArray typedArray = getContext() .obtainStyledAttributes(attributeSet, R.styleable.AbstractListPreference, defaultStyle, defaultStyleResource); try { obtainDialogItemColor(typedArray); // depends on control dependency: [try], data = [none] obtainEntries(typedArray); // depends on control dependency: [try], data = [none] obtainEntryValues(typedArray); // depends on control dependency: [try], data = [none] obtainDialogScrollableArea(typedArray); // depends on control dependency: [try], data = [none] } finally { typedArray.recycle(); } } }
public class class_name { private void fireOnError(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onError(e); } } }
public class class_name { private void fireOnError(ChannelEvent e) { List<EventListener> listeners = changes.getListenerList(AMQP); for (EventListener listener : listeners) { ChannelListener amqpListener = (ChannelListener)listener; amqpListener.onError(e); // depends on control dependency: [for], data = [none] } } }
public class class_name { @Override public Map<String, Collection<String>> getRequireFeatureWithTolerates() { // The feature may be an older feature which never had the tolerates information // stored, in which case, look in the older requireFeature field and massage // that info into the required format. // Or there may just not be any required features at all. Collection<RequireFeatureWithTolerates> rfwt = _asset.getWlpInformation().getRequireFeatureWithTolerates(); if (rfwt != null) { Map<String, Collection<String>> rv = new HashMap<String, Collection<String>>(); for (RequireFeatureWithTolerates feature : rfwt) { rv.put(feature.getFeature(), feature.getTolerates()); } return rv; } // Newer field not present, check the older field Collection<String> rf = _asset.getWlpInformation().getRequireFeature(); if (rf != null) { Map<String, Collection<String>> rv = new HashMap<String, Collection<String>>(); for (String feature : rf) { rv.put(feature, Collections.<String> emptyList()); } return rv; } // No required features at all return null; } }
public class class_name { @Override public Map<String, Collection<String>> getRequireFeatureWithTolerates() { // The feature may be an older feature which never had the tolerates information // stored, in which case, look in the older requireFeature field and massage // that info into the required format. // Or there may just not be any required features at all. Collection<RequireFeatureWithTolerates> rfwt = _asset.getWlpInformation().getRequireFeatureWithTolerates(); if (rfwt != null) { Map<String, Collection<String>> rv = new HashMap<String, Collection<String>>(); for (RequireFeatureWithTolerates feature : rfwt) { rv.put(feature.getFeature(), feature.getTolerates()); // depends on control dependency: [for], data = [feature] } return rv; // depends on control dependency: [if], data = [none] } // Newer field not present, check the older field Collection<String> rf = _asset.getWlpInformation().getRequireFeature(); if (rf != null) { Map<String, Collection<String>> rv = new HashMap<String, Collection<String>>(); for (String feature : rf) { rv.put(feature, Collections.<String> emptyList()); // depends on control dependency: [for], data = [feature] } return rv; // depends on control dependency: [if], data = [none] } // No required features at all return null; } }
public class class_name { public boolean accept(String slashedTypeName, ClassLoader classLoader, ProtectionDomain protectionDomain, byte[] bytes) { if (slashedTypeName == null) { return false; } // Sometimes the package prefix for cglib types is changed, for example: // net/sf/cglib/core/AbstractClassGenerator // org/springframework/cglib/core/AbstractClassGenerator // This test will allow for both variants return slashedTypeName.endsWith("/cglib/core/AbstractClassGenerator"); // || slashedTypeName.equals("net/sf/cglib/reflect/FastClass"); } }
public class class_name { public boolean accept(String slashedTypeName, ClassLoader classLoader, ProtectionDomain protectionDomain, byte[] bytes) { if (slashedTypeName == null) { return false; // depends on control dependency: [if], data = [none] } // Sometimes the package prefix for cglib types is changed, for example: // net/sf/cglib/core/AbstractClassGenerator // org/springframework/cglib/core/AbstractClassGenerator // This test will allow for both variants return slashedTypeName.endsWith("/cglib/core/AbstractClassGenerator"); // || slashedTypeName.equals("net/sf/cglib/reflect/FastClass"); } }
public class class_name { public Criteria in(Iterable<?> values) { Assert.notNull(values, "Collection of 'in' values must not be null"); for (Object value : values) { if (value instanceof Collection) { in((Collection<?>) value); } else { is(value); } } return this; } }
public class class_name { public Criteria in(Iterable<?> values) { Assert.notNull(values, "Collection of 'in' values must not be null"); for (Object value : values) { if (value instanceof Collection) { in((Collection<?>) value); // depends on control dependency: [if], data = [none] } else { is(value); // depends on control dependency: [if], data = [none] } } return this; } }
public class class_name { @Override public JsonObject deepCopy() { JsonObject result = new JsonObject(); for (Map.Entry<String, JsonElement> entry : members.entrySet()) { result.add(entry.getKey(), entry.getValue().deepCopy()); } return result; } }
public class class_name { @Override public JsonObject deepCopy() { JsonObject result = new JsonObject(); for (Map.Entry<String, JsonElement> entry : members.entrySet()) { result.add(entry.getKey(), entry.getValue().deepCopy()); // depends on control dependency: [for], data = [entry] } return result; } }
public class class_name { public final hqlParser.fromClassOrOuterQueryPath_return fromClassOrOuterQueryPath() throws RecognitionException { hqlParser.fromClassOrOuterQueryPath_return retval = new hqlParser.fromClassOrOuterQueryPath_return(); retval.start = input.LT(1); CommonTree root_0 = null; ParserRuleReturnScope path92 =null; ParserRuleReturnScope asAlias93 =null; ParserRuleReturnScope propertyFetch94 =null; RewriteRuleSubtreeStream stream_propertyFetch=new RewriteRuleSubtreeStream(adaptor,"rule propertyFetch"); RewriteRuleSubtreeStream stream_path=new RewriteRuleSubtreeStream(adaptor,"rule path"); RewriteRuleSubtreeStream stream_asAlias=new RewriteRuleSubtreeStream(adaptor,"rule asAlias"); try { // hql.g:296:2: ( path ( asAlias )? ( propertyFetch )? -> ^( RANGE path ( asAlias )? ( propertyFetch )? ) ) // hql.g:296:4: path ( asAlias )? ( propertyFetch )? { pushFollow(FOLLOW_path_in_fromClassOrOuterQueryPath1329); path92=path(); state._fsp--; stream_path.add(path92.getTree()); WeakKeywords(); // hql.g:296:29: ( asAlias )? int alt34=2; int LA34_0 = input.LA(1); if ( (LA34_0==AS||LA34_0==IDENT) ) { alt34=1; } switch (alt34) { case 1 : // hql.g:296:30: asAlias { pushFollow(FOLLOW_asAlias_in_fromClassOrOuterQueryPath1334); asAlias93=asAlias(); state._fsp--; stream_asAlias.add(asAlias93.getTree()); } break; } // hql.g:296:40: ( propertyFetch )? int alt35=2; int LA35_0 = input.LA(1); if ( (LA35_0==FETCH) ) { alt35=1; } switch (alt35) { case 1 : // hql.g:296:41: propertyFetch { pushFollow(FOLLOW_propertyFetch_in_fromClassOrOuterQueryPath1339); propertyFetch94=propertyFetch(); state._fsp--; stream_propertyFetch.add(propertyFetch94.getTree()); } break; } // AST REWRITE // elements: asAlias, propertyFetch, path // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); root_0 = (CommonTree)adaptor.nil(); // 297:3: -> ^( RANGE path ( asAlias )? ( propertyFetch )? ) { // hql.g:297:6: ^( RANGE path ( asAlias )? ( propertyFetch )? ) { CommonTree root_1 = (CommonTree)adaptor.nil(); root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(RANGE, "RANGE"), root_1); adaptor.addChild(root_1, stream_path.nextTree()); // hql.g:297:19: ( asAlias )? if ( stream_asAlias.hasNext() ) { adaptor.addChild(root_1, stream_asAlias.nextTree()); } stream_asAlias.reset(); // hql.g:297:28: ( propertyFetch )? if ( stream_propertyFetch.hasNext() ) { adaptor.addChild(root_1, stream_propertyFetch.nextTree()); } stream_propertyFetch.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public final hqlParser.fromClassOrOuterQueryPath_return fromClassOrOuterQueryPath() throws RecognitionException { hqlParser.fromClassOrOuterQueryPath_return retval = new hqlParser.fromClassOrOuterQueryPath_return(); retval.start = input.LT(1); CommonTree root_0 = null; ParserRuleReturnScope path92 =null; ParserRuleReturnScope asAlias93 =null; ParserRuleReturnScope propertyFetch94 =null; RewriteRuleSubtreeStream stream_propertyFetch=new RewriteRuleSubtreeStream(adaptor,"rule propertyFetch"); RewriteRuleSubtreeStream stream_path=new RewriteRuleSubtreeStream(adaptor,"rule path"); RewriteRuleSubtreeStream stream_asAlias=new RewriteRuleSubtreeStream(adaptor,"rule asAlias"); try { // hql.g:296:2: ( path ( asAlias )? ( propertyFetch )? -> ^( RANGE path ( asAlias )? ( propertyFetch )? ) ) // hql.g:296:4: path ( asAlias )? ( propertyFetch )? { pushFollow(FOLLOW_path_in_fromClassOrOuterQueryPath1329); path92=path(); state._fsp--; stream_path.add(path92.getTree()); WeakKeywords(); // hql.g:296:29: ( asAlias )? int alt34=2; int LA34_0 = input.LA(1); if ( (LA34_0==AS||LA34_0==IDENT) ) { alt34=1; // depends on control dependency: [if], data = [none] } switch (alt34) { case 1 : // hql.g:296:30: asAlias { pushFollow(FOLLOW_asAlias_in_fromClassOrOuterQueryPath1334); asAlias93=asAlias(); state._fsp--; stream_asAlias.add(asAlias93.getTree()); } break; } // hql.g:296:40: ( propertyFetch )? int alt35=2; int LA35_0 = input.LA(1); if ( (LA35_0==FETCH) ) { alt35=1; // depends on control dependency: [if], data = [none] } switch (alt35) { case 1 : // hql.g:296:41: propertyFetch { pushFollow(FOLLOW_propertyFetch_in_fromClassOrOuterQueryPath1339); propertyFetch94=propertyFetch(); state._fsp--; stream_propertyFetch.add(propertyFetch94.getTree()); } break; } // AST REWRITE // elements: asAlias, propertyFetch, path // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); root_0 = (CommonTree)adaptor.nil(); // 297:3: -> ^( RANGE path ( asAlias )? ( propertyFetch )? ) { // hql.g:297:6: ^( RANGE path ( asAlias )? ( propertyFetch )? ) { CommonTree root_1 = (CommonTree)adaptor.nil(); root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(RANGE, "RANGE"), root_1); adaptor.addChild(root_1, stream_path.nextTree()); // hql.g:297:19: ( asAlias )? if ( stream_asAlias.hasNext() ) { adaptor.addChild(root_1, stream_asAlias.nextTree()); // depends on control dependency: [if], data = [none] } stream_asAlias.reset(); // hql.g:297:28: ( propertyFetch )? if ( stream_propertyFetch.hasNext() ) { adaptor.addChild(root_1, stream_propertyFetch.nextTree()); // depends on control dependency: [if], data = [none] } stream_propertyFetch.reset(); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { @Override public void waveHandled(final Wave wave) { this.index++; // Run next command if any if (this.waveList.size() > this.index) { // Try to run the next wave unqueueWaves(); } else { // No more wave to process, we can declare the command as fully handled fireHandled(this.sourceWave); } } }
public class class_name { @Override public void waveHandled(final Wave wave) { this.index++; // Run next command if any if (this.waveList.size() > this.index) { // Try to run the next wave unqueueWaves(); // depends on control dependency: [if], data = [none] } else { // No more wave to process, we can declare the command as fully handled fireHandled(this.sourceWave); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void setFloat(MemorySegment[] segments, int offset, float value) { if (inFirstSegment(segments, offset, 4)) { segments[0].putFloat(offset, value); } else { setFloatMultiSegments(segments, offset, value); } } }
public class class_name { public static void setFloat(MemorySegment[] segments, int offset, float value) { if (inFirstSegment(segments, offset, 4)) { segments[0].putFloat(offset, value); // depends on control dependency: [if], data = [none] } else { setFloatMultiSegments(segments, offset, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nullable public static com.linecorp.centraldogma.common.EntryType convertEntryType(EntryType type) { if (type == null) { return null; } switch (type) { case JSON: return com.linecorp.centraldogma.common.EntryType.JSON; case TEXT: return com.linecorp.centraldogma.common.EntryType.TEXT; case DIRECTORY: return com.linecorp.centraldogma.common.EntryType.DIRECTORY; } throw new Error(); } }
public class class_name { @Nullable public static com.linecorp.centraldogma.common.EntryType convertEntryType(EntryType type) { if (type == null) { return null; // depends on control dependency: [if], data = [none] } switch (type) { case JSON: return com.linecorp.centraldogma.common.EntryType.JSON; case TEXT: return com.linecorp.centraldogma.common.EntryType.TEXT; case DIRECTORY: return com.linecorp.centraldogma.common.EntryType.DIRECTORY; } throw new Error(); } }
public class class_name { static String pullFontPathFromStyle(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final TypedArray typedArray = context.obtainStyledAttributes(attrs, attributeId); if (typedArray != null) { try { // First defined attribute String fontFromAttribute = typedArray.getString(0); if (!TextUtils.isEmpty(fontFromAttribute)) { return fontFromAttribute; } } catch (Exception ignore) { // Failed for some reason. } finally { typedArray.recycle(); } } return null; } }
public class class_name { static String pullFontPathFromStyle(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final TypedArray typedArray = context.obtainStyledAttributes(attrs, attributeId); if (typedArray != null) { try { // First defined attribute String fontFromAttribute = typedArray.getString(0); if (!TextUtils.isEmpty(fontFromAttribute)) { return fontFromAttribute; // depends on control dependency: [if], data = [none] } } catch (Exception ignore) { // Failed for some reason. } finally { // depends on control dependency: [catch], data = [none] typedArray.recycle(); } } return null; } }
public class class_name { public String getRequiredSymbol(String key) { String result = null; Object symbol = getSymbol(key); if (symbol == null) { throw new FitFailureException("No Symbol defined with key: " + key); } else { result = symbol.toString(); } return result; } }
public class class_name { public String getRequiredSymbol(String key) { String result = null; Object symbol = getSymbol(key); if (symbol == null) { throw new FitFailureException("No Symbol defined with key: " + key); } else { result = symbol.toString(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static Date string2DateLocal(String date) { Date ret; try { ret = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).parse(date); } catch (Exception e) { throw new InvalidArgumentException(date); } return ret; } }
public class class_name { public static Date string2DateLocal(String date) { Date ret; try { ret = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).parse(date); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new InvalidArgumentException(date); } // depends on control dependency: [catch], data = [none] return ret; } }
public class class_name { public void marshall(UpdateDefaultBranchRequest updateDefaultBranchRequest, ProtocolMarshaller protocolMarshaller) { if (updateDefaultBranchRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateDefaultBranchRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(updateDefaultBranchRequest.getDefaultBranchName(), DEFAULTBRANCHNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateDefaultBranchRequest updateDefaultBranchRequest, ProtocolMarshaller protocolMarshaller) { if (updateDefaultBranchRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateDefaultBranchRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateDefaultBranchRequest.getDefaultBranchName(), DEFAULTBRANCHNAME_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 String extractAttributes(SoyMsg msg) { StringBuilder attributes = new StringBuilder(); Matcher matcher = MESSAGE_ATTRIBUTE_PATTERN.matcher(msg.getDesc()); while (matcher.find()) { attributes.append(matcher.group()); } return attributes.toString(); } }
public class class_name { private String extractAttributes(SoyMsg msg) { StringBuilder attributes = new StringBuilder(); Matcher matcher = MESSAGE_ATTRIBUTE_PATTERN.matcher(msg.getDesc()); while (matcher.find()) { attributes.append(matcher.group()); // depends on control dependency: [while], data = [none] } return attributes.toString(); } }
public class class_name { public NodeList validate(Document xmlEntity, String schemaRef, String phase) { if (xmlEntity == null || xmlEntity.getDocumentElement() == null) throw new IllegalArgumentException("No XML entity supplied (null)."); InputSource xmlInputSource = null; try { InputStream inputStream = DocumentToInputStream(xmlEntity); xmlInputSource = new InputSource(inputStream); } catch (IOException e) { throw new RuntimeException(e); } PropertyMapBuilder builder = new PropertyMapBuilder(); SchematronProperty.DIAGNOSE.add(builder); if (null != phase && !phase.isEmpty()) { builder.put(SchematronProperty.PHASE, phase); } XmlErrorHandler errHandler = new XmlErrorHandler(); builder.put(ValidateProperty.ERROR_HANDLER, errHandler); ValidationDriver driver = createDriver(builder.toPropertyMap()); InputStream schStream = this.getClass().getResourceAsStream(schemaRef.trim()); try { InputSource input = new InputSource(schStream); try { boolean loaded = driver.loadSchema(input); if (!loaded) { throw new Exception("Failed to load schema at " + schemaRef.trim() + "\nIs the schema valid? Is the phase defined?"); } } finally { schStream.close(); } driver.validate(xmlInputSource); } catch (Exception e) { throw new RuntimeException("Schematron validation failed.", e); } NodeList errList = errHandler.toNodeList(); if (LOGR.isLoggable(Level.FINER)) { LOGR.finer(String.format( "Found %d Schematron rule violation(s):%n %s", errList.getLength(), errHandler.toString())); } return errList; } }
public class class_name { public NodeList validate(Document xmlEntity, String schemaRef, String phase) { if (xmlEntity == null || xmlEntity.getDocumentElement() == null) throw new IllegalArgumentException("No XML entity supplied (null)."); InputSource xmlInputSource = null; try { InputStream inputStream = DocumentToInputStream(xmlEntity); xmlInputSource = new InputSource(inputStream); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] PropertyMapBuilder builder = new PropertyMapBuilder(); SchematronProperty.DIAGNOSE.add(builder); if (null != phase && !phase.isEmpty()) { builder.put(SchematronProperty.PHASE, phase); // depends on control dependency: [if], data = [none] } XmlErrorHandler errHandler = new XmlErrorHandler(); builder.put(ValidateProperty.ERROR_HANDLER, errHandler); ValidationDriver driver = createDriver(builder.toPropertyMap()); InputStream schStream = this.getClass().getResourceAsStream(schemaRef.trim()); try { InputSource input = new InputSource(schStream); try { boolean loaded = driver.loadSchema(input); if (!loaded) { throw new Exception("Failed to load schema at " + schemaRef.trim() + "\nIs the schema valid? Is the phase defined?"); } } finally { schStream.close(); } driver.validate(xmlInputSource); } catch (Exception e) { throw new RuntimeException("Schematron validation failed.", e); } NodeList errList = errHandler.toNodeList(); if (LOGR.isLoggable(Level.FINER)) { LOGR.finer(String.format( "Found %d Schematron rule violation(s):%n %s", errList.getLength(), errHandler.toString())); } return errList; } }
public class class_name { private Object doPrivileged(final String methodName, final Class<?>[] clazz, Object[] params) { try { Method method = context.getClass().getMethod(methodName, clazz); return executeMethod(method, context, params); } catch (Exception ex) { try { handleException(ex); } catch (Throwable t) { handleThrowable(t); throw new RuntimeException(t.getMessage()); } return null; } finally { params = null; } } }
public class class_name { private Object doPrivileged(final String methodName, final Class<?>[] clazz, Object[] params) { try { Method method = context.getClass().getMethod(methodName, clazz); return executeMethod(method, context, params); // depends on control dependency: [try], data = [none] } catch (Exception ex) { try { handleException(ex); // depends on control dependency: [try], data = [none] } catch (Throwable t) { handleThrowable(t); throw new RuntimeException(t.getMessage()); } // depends on control dependency: [catch], data = [none] return null; } finally { // depends on control dependency: [catch], data = [none] params = null; } } }
public class class_name { public final @NotNull S is(@NotNull Condition<A> condition) { if (matches(condition)) { return myself(); } failIfCustomMessageIsSet(); throw failure(errorMessageIfIsNot(condition)); } }
public class class_name { public final @NotNull S is(@NotNull Condition<A> condition) { if (matches(condition)) { return myself(); // depends on control dependency: [if], data = [none] } failIfCustomMessageIsSet(); throw failure(errorMessageIfIsNot(condition)); } }
public class class_name { public static List<Field> getAllFields(Class<?> clas) { JK.fixMe("add caching.."); List<Field> list = new Vector<>(); // start by fields from the super class if (clas.getSuperclass() != null) { list.addAll(getAllFields(clas.getSuperclass())); } Field[] fields = clas.getDeclaredFields(); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { list.add(field); } } return list; } }
public class class_name { public static List<Field> getAllFields(Class<?> clas) { JK.fixMe("add caching.."); List<Field> list = new Vector<>(); // start by fields from the super class if (clas.getSuperclass() != null) { list.addAll(getAllFields(clas.getSuperclass())); // depends on control dependency: [if], data = [(clas.getSuperclass()] } Field[] fields = clas.getDeclaredFields(); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { list.add(field); // depends on control dependency: [if], data = [none] } } return list; } }
public class class_name { protected void parseTypeDefs(Document doc) { // Parse type definitions. Handy to match against defined AVP types // and to fill AVPs with generic function. // Format: <typedefn type-name="Integer32" /> // <typedefn type-name="Enumerated" type-parent="Integer32" /> NodeList typedefNodes = doc.getElementsByTagName("typedefn"); for (int td = 0; td < typedefNodes.getLength(); td++) { Node typedefNode = typedefNodes.item(td); if (typedefNode.getNodeType() == Node.ELEMENT_NODE) { Element typedefElement = (Element) typedefNode; String typeName = typedefElement.getAttribute("type-name"); String typeParent = typedefElement.getAttribute("type-parent"); // UTF8String and Time are special situations, we don't want to convert these. if (typeParent == null || typeParent.equals("") || typeName.equals("UTF8String") || typeName.equals("Time")) { typeParent = typeName; } typedefMap.put(typeName, typeParent); } } } }
public class class_name { protected void parseTypeDefs(Document doc) { // Parse type definitions. Handy to match against defined AVP types // and to fill AVPs with generic function. // Format: <typedefn type-name="Integer32" /> // <typedefn type-name="Enumerated" type-parent="Integer32" /> NodeList typedefNodes = doc.getElementsByTagName("typedefn"); for (int td = 0; td < typedefNodes.getLength(); td++) { Node typedefNode = typedefNodes.item(td); if (typedefNode.getNodeType() == Node.ELEMENT_NODE) { Element typedefElement = (Element) typedefNode; String typeName = typedefElement.getAttribute("type-name"); String typeParent = typedefElement.getAttribute("type-parent"); // UTF8String and Time are special situations, we don't want to convert these. if (typeParent == null || typeParent.equals("") || typeName.equals("UTF8String") || typeName.equals("Time")) { typeParent = typeName; // depends on control dependency: [if], data = [none] } typedefMap.put(typeName, typeParent); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void expandDirNodes(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluNode node1, DeLiCluNode node2) { if(LOG.isDebuggingFinest()) { LOG.debugFinest("ExpandDirNodes: " + node1.getPageID() + " + " + node2.getPageID()); } int numEntries_1 = node1.getNumEntries(); int numEntries_2 = node2.getNumEntries(); // insert all combinations of unhandled - handled children of // node1-node2 into pq for(int i = 0; i < numEntries_1; i++) { DeLiCluEntry entry1 = node1.getEntry(i); if(!entry1.hasUnhandled()) { continue; } for(int j = 0; j < numEntries_2; j++) { DeLiCluEntry entry2 = node2.getEntry(j); if(!entry2.hasHandled()) { continue; } double distance = distFunction.minDist(entry1, entry2); heap.add(new SpatialObjectPair(distance, entry1, entry2, true)); } } } }
public class class_name { private void expandDirNodes(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluNode node1, DeLiCluNode node2) { if(LOG.isDebuggingFinest()) { LOG.debugFinest("ExpandDirNodes: " + node1.getPageID() + " + " + node2.getPageID()); // depends on control dependency: [if], data = [none] } int numEntries_1 = node1.getNumEntries(); int numEntries_2 = node2.getNumEntries(); // insert all combinations of unhandled - handled children of // node1-node2 into pq for(int i = 0; i < numEntries_1; i++) { DeLiCluEntry entry1 = node1.getEntry(i); if(!entry1.hasUnhandled()) { continue; } for(int j = 0; j < numEntries_2; j++) { DeLiCluEntry entry2 = node2.getEntry(j); if(!entry2.hasHandled()) { continue; } double distance = distFunction.minDist(entry1, entry2); heap.add(new SpatialObjectPair(distance, entry1, entry2, true)); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public static String generateJobTableWithResourceInfo(String label, Collection<JobInProgress> jobs, int refresh, int rowId, JobTracker tracker) throws IOException { ResourceReporter reporter = tracker.getResourceReporter(); if (reporter == null) { return generateJobTable(label, jobs, refresh, rowId); } boolean isRunning = label.equals("Running"); boolean isModifiable = isRunning && conf.getBoolean(PRIVATE_ACTIONS_KEY, false); StringBuffer sb = new StringBuffer(); sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"tablesorter\">\n"); if (jobs.size() > 0) { if (isModifiable) { sb.append("<form action=\"/jobtracker_hmon.jsp\" onsubmit=\"return confirmAction();\" method=\"POST\">"); sb.append("<thead><tr>"); sb.append("<td><input type=\"Button\" onclick=\"selectAll()\" " + "value=\"Select All\" id=\"checkEm\"></td>"); sb.append("<td>"); sb.append("<input type=\"submit\" name=\"killJobs\" value=\"Kill Selected Jobs\">"); sb.append("</td>"); sb.append("<td><nobr>"); sb.append("<select name=\"setJobPriority\">"); for (JobPriority prio : JobPriority.values()) { sb.append("<option" + (JobPriority.NORMAL == prio ? " selected=\"selected\">" : ">") + prio + "</option>"); } sb.append("</select>"); sb.append("<input type=\"submit\" name=\"changeJobPriority\" " + "value=\"Change\">"); sb.append("</nobr></td>"); sb.append("<td colspan=\"15\">&nbsp;</td>"); sb.append("</tr>"); sb.append("<th>&nbsp;</th>"); } else { sb.append("<thead><tr>"); } int totalMaps = 0; int comMaps = 0; int totalRunningMaps = 0; int totalReduces = 0; int comReduces = 0; int totalRunningReduces = 0; for (Iterator<JobInProgress> it = jobs.iterator(); it.hasNext(); ) { JobInProgress job = it.next(); totalMaps += job.desiredMaps(); totalReduces += job.desiredReduces(); comMaps += job.finishedMaps(); comReduces += job.finishedReduces(); if (isRunning) { totalRunningMaps += job.runningMaps(); totalRunningReduces += job.runningReduces(); } } sb.append("<th><b>Jobid</b></th><th><b>Priority" + "</b></th><th><b>User</b></th>"); sb.append("<th><b>Name</b></th>"); sb.append("<th><b>Map % Complete</b></th>"); sb.append("<th><b>Map Total " + totalMaps + "</b></th>"); sb.append("<th><b>Maps Completed " + comMaps + "</b></th>"); if (isRunning) { sb.append("<th><b>Maps Running " + totalRunningMaps + "</b></th>"); } sb.append("<th><b>Reduce % Complete</b></th>"); sb.append("<th><b>Reduce Total " + totalReduces + "</b></th>"); sb.append("<th><b>Reduces Completed " + comReduces + "</b></th>"); if (isRunning) { sb.append("<th><b>Reduces Running " + totalRunningReduces + "</b></th>"); } sb.append("<th><b>CPU Now</b></th>"); sb.append("<th><b>CPU Cumulated Cluster-sec</b></th>"); sb.append("<th><b>MEM Now</b></a></th>"); sb.append("<th><b>MEM Cumulated Cluster-sec</b></th>"); sb.append("<th><b>MEM Max/Node</b></th>"); sb.append("</tr></thead><tbody>\n"); for (Iterator<JobInProgress> it = jobs.iterator(); it.hasNext(); ++rowId) { JobInProgress job = it.next(); JobProfile profile = job.getProfile(); JobStatus status = job.getStatus(); JobID jobid = profile.getJobID(); int desiredMaps = job.desiredMaps(); int desiredReduces = job.desiredReduces(); int completedMaps = job.finishedMaps(); int completedReduces = job.finishedReduces(); String runningMapTableData = (isRunning) ? job.runningMaps() + "</td><td>" : ""; String runningReduceTableData = (isRunning) ? "</td><td>" + job.runningReduces() : ""; String name = profile.getJobName(); String jobpri = job.getPriority().toString(); if (isModifiable) { sb.append("<tr><td><input TYPE=\"checkbox\" " + "onclick=\"checkButtonVerbage()\" " + "name=\"jobCheckBox\" value=" + jobid + "></td>"); } else { sb.append("<tr>"); } String cpu = "-"; String mem = "-"; String memMax = "-"; String cpuCost = "-"; String memCost = "-"; if (reporter.getJobCpuCumulatedUsageTime(jobid) != ResourceReporter.UNAVAILABLE) { cpu = String.format("%.2f%%", reporter.getJobCpuPercentageOnCluster(jobid)); if (reporter.getJobCpuPercentageOnCluster(jobid) > 50) { cpu = "<font color=\"red\">" + cpu + "</font>"; } mem = String.format("%.2f%%", reporter.getJobMemPercentageOnCluster(jobid)); if (reporter.getJobMemPercentageOnCluster(jobid) > 50) { mem = "<font color=\"red\">" + mem + "</font>"; } cpuCost = String.format("%.2f", reporter.getJobCpuCumulatedUsageTime(jobid) / 1000D); memCost = String.format("%.2f", reporter.getJobMemCumulatedUsageTime(jobid) / 1000D); memMax = String.format("%.2f%%", reporter.getJobMemMaxPercentageOnBox(jobid)); if (reporter.getJobMemMaxPercentageOnBox(jobid) > 50) { memMax = "<font color=\"red\">" + memMax + "</font>"; } } sb.append("<td id=\"job_" + rowId + "\"><a href=\"jobdetails.jsp?jobid=" + jobid + "&refresh=" + refresh + "\">" + jobid + "</a></td>" + "<td id=\"priority_" + rowId + "\">" + jobpri + "</td>" + "<td id=\"user_" + rowId + "\">" + profile.getUser() + "</td>" + "<td id=\"name_" + rowId + "\">" + ("".equals(name) ? "&nbsp;" : name) + "</td><td>" + StringUtils.formatPercent(status.mapProgress(), 2) + ServletUtil.percentageGraph(status.mapProgress() * 100, 80) + "</td><td>" + desiredMaps + "</td><td>" + completedMaps + "</td><td>" + runningMapTableData + StringUtils.formatPercent(status.reduceProgress(), 2) + ServletUtil.percentageGraph(status.reduceProgress() * 100, 80) + "</td><td>" + desiredReduces + "</td><td> " + completedReduces + runningReduceTableData + "</td><td id=\"cpu_" + rowId + "\">" + cpu + "</td>" + "<td id=\"cpuCost_" + rowId + "\">" + cpuCost + "</td>" + "<td id=\"mem_" + rowId + "\">" + mem + "</td>" + "<td id=\"memCost_" + rowId + "\">" + memCost + "</td>" + "<td id=\"memMax_" + rowId + "\">" + memMax + "</td></tr>\n"); } if (isModifiable) { sb.append("</form>\n"); } sb.append("</tbody>"); } else { sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" + "</td></tr>\n"); } sb.append("</table>\n"); return sb.toString(); } }
public class class_name { public static String generateJobTableWithResourceInfo(String label, Collection<JobInProgress> jobs, int refresh, int rowId, JobTracker tracker) throws IOException { ResourceReporter reporter = tracker.getResourceReporter(); if (reporter == null) { return generateJobTable(label, jobs, refresh, rowId); } boolean isRunning = label.equals("Running"); boolean isModifiable = isRunning && conf.getBoolean(PRIVATE_ACTIONS_KEY, false); StringBuffer sb = new StringBuffer(); sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"tablesorter\">\n"); if (jobs.size() > 0) { if (isModifiable) { sb.append("<form action=\"/jobtracker_hmon.jsp\" onsubmit=\"return confirmAction();\" method=\"POST\">"); sb.append("<thead><tr>"); sb.append("<td><input type=\"Button\" onclick=\"selectAll()\" " + "value=\"Select All\" id=\"checkEm\"></td>"); sb.append("<td>"); sb.append("<input type=\"submit\" name=\"killJobs\" value=\"Kill Selected Jobs\">"); sb.append("</td>"); sb.append("<td><nobr>"); sb.append("<select name=\"setJobPriority\">"); for (JobPriority prio : JobPriority.values()) { sb.append("<option" + (JobPriority.NORMAL == prio ? " selected=\"selected\">" : ">") + prio + "</option>"); // depends on control dependency: [for], data = [none] } sb.append("</select>"); sb.append("<input type=\"submit\" name=\"changeJobPriority\" " + "value=\"Change\">"); sb.append("</nobr></td>"); sb.append("<td colspan=\"15\">&nbsp;</td>"); sb.append("</tr>"); sb.append("<th>&nbsp;</th>"); } else { sb.append("<thead><tr>"); } int totalMaps = 0; int comMaps = 0; int totalRunningMaps = 0; int totalReduces = 0; int comReduces = 0; int totalRunningReduces = 0; for (Iterator<JobInProgress> it = jobs.iterator(); it.hasNext(); ) { JobInProgress job = it.next(); totalMaps += job.desiredMaps(); totalReduces += job.desiredReduces(); comMaps += job.finishedMaps(); comReduces += job.finishedReduces(); if (isRunning) { totalRunningMaps += job.runningMaps(); // depends on control dependency: [if], data = [none] totalRunningReduces += job.runningReduces(); // depends on control dependency: [if], data = [none] } } sb.append("<th><b>Jobid</b></th><th><b>Priority" + "</b></th><th><b>User</b></th>"); sb.append("<th><b>Name</b></th>"); sb.append("<th><b>Map % Complete</b></th>"); sb.append("<th><b>Map Total " + totalMaps + "</b></th>"); sb.append("<th><b>Maps Completed " + comMaps + "</b></th>"); if (isRunning) { sb.append("<th><b>Maps Running " + totalRunningMaps + "</b></th>"); } sb.append("<th><b>Reduce % Complete</b></th>"); sb.append("<th><b>Reduce Total " + totalReduces + "</b></th>"); sb.append("<th><b>Reduces Completed " + comReduces + "</b></th>"); if (isRunning) { sb.append("<th><b>Reduces Running " + totalRunningReduces + "</b></th>"); } sb.append("<th><b>CPU Now</b></th>"); sb.append("<th><b>CPU Cumulated Cluster-sec</b></th>"); sb.append("<th><b>MEM Now</b></a></th>"); sb.append("<th><b>MEM Cumulated Cluster-sec</b></th>"); sb.append("<th><b>MEM Max/Node</b></th>"); sb.append("</tr></thead><tbody>\n"); for (Iterator<JobInProgress> it = jobs.iterator(); it.hasNext(); ++rowId) { JobInProgress job = it.next(); JobProfile profile = job.getProfile(); JobStatus status = job.getStatus(); JobID jobid = profile.getJobID(); int desiredMaps = job.desiredMaps(); int desiredReduces = job.desiredReduces(); int completedMaps = job.finishedMaps(); int completedReduces = job.finishedReduces(); String runningMapTableData = (isRunning) ? job.runningMaps() + "</td><td>" : ""; String runningReduceTableData = (isRunning) ? "</td><td>" + job.runningReduces() : ""; String name = profile.getJobName(); String jobpri = job.getPriority().toString(); if (isModifiable) { sb.append("<tr><td><input TYPE=\"checkbox\" " + "onclick=\"checkButtonVerbage()\" " + "name=\"jobCheckBox\" value=" + jobid + "></td>"); // depends on control dependency: [if], data = [none] } else { sb.append("<tr>"); // depends on control dependency: [if], data = [none] } String cpu = "-"; String mem = "-"; String memMax = "-"; String cpuCost = "-"; String memCost = "-"; if (reporter.getJobCpuCumulatedUsageTime(jobid) != ResourceReporter.UNAVAILABLE) { cpu = String.format("%.2f%%", reporter.getJobCpuPercentageOnCluster(jobid)); // depends on control dependency: [if], data = [none] if (reporter.getJobCpuPercentageOnCluster(jobid) > 50) { cpu = "<font color=\"red\">" + cpu + "</font>"; // depends on control dependency: [if], data = [none] } mem = String.format("%.2f%%", reporter.getJobMemPercentageOnCluster(jobid)); // depends on control dependency: [if], data = [none] if (reporter.getJobMemPercentageOnCluster(jobid) > 50) { mem = "<font color=\"red\">" + mem + "</font>"; // depends on control dependency: [if], data = [none] } cpuCost = String.format("%.2f", reporter.getJobCpuCumulatedUsageTime(jobid) / 1000D); // depends on control dependency: [if], data = [none] memCost = String.format("%.2f", reporter.getJobMemCumulatedUsageTime(jobid) / 1000D); // depends on control dependency: [if], data = [none] memMax = String.format("%.2f%%", reporter.getJobMemMaxPercentageOnBox(jobid)); // depends on control dependency: [if], data = [none] if (reporter.getJobMemMaxPercentageOnBox(jobid) > 50) { memMax = "<font color=\"red\">" + memMax + "</font>"; // depends on control dependency: [if], data = [none] } } sb.append("<td id=\"job_" + rowId + "\"><a href=\"jobdetails.jsp?jobid=" + jobid + "&refresh=" + refresh + "\">" + jobid + "</a></td>" + "<td id=\"priority_" + rowId + "\">" + jobpri + "</td>" + "<td id=\"user_" + rowId + "\">" + profile.getUser() + "</td>" + "<td id=\"name_" + rowId + "\">" + ("".equals(name) ? "&nbsp;" : name) + "</td><td>" + StringUtils.formatPercent(status.mapProgress(), 2) + ServletUtil.percentageGraph(status.mapProgress() * 100, 80) + "</td><td>" + desiredMaps + "</td><td>" + completedMaps + "</td><td>" + runningMapTableData + StringUtils.formatPercent(status.reduceProgress(), 2) + ServletUtil.percentageGraph(status.reduceProgress() * 100, 80) + "</td><td>" + desiredReduces + "</td><td> " + completedReduces + runningReduceTableData + "</td><td id=\"cpu_" + rowId + "\">" + cpu + "</td>" + "<td id=\"cpuCost_" + rowId + "\">" + cpuCost + "</td>" + "<td id=\"mem_" + rowId + "\">" + mem + "</td>" + "<td id=\"memCost_" + rowId + "\">" + memCost + "</td>" + "<td id=\"memMax_" + rowId + "\">" + memMax + "</td></tr>\n"); } if (isModifiable) { sb.append("</form>\n"); } sb.append("</tbody>"); } else { sb.append("<tr><td align=\"center\" colspan=\"8\"><i>none</i>" + "</td></tr>\n"); } sb.append("</table>\n"); return sb.toString(); } }
public class class_name { private String getParameter(String paramKey, String defaultValue) { String paramValue = defaultValue; if (StringUtils.isNotBlank(paramKey) && args != null && args.length > 0) { for (String arg : args) { String[] parameter = arg.split("="); if (parameter != null && parameter.length == 2 && paramKey.equals(parameter[0])) { paramValue = parameter[1]; break; } } } return paramValue; } }
public class class_name { private String getParameter(String paramKey, String defaultValue) { String paramValue = defaultValue; if (StringUtils.isNotBlank(paramKey) && args != null && args.length > 0) { for (String arg : args) { String[] parameter = arg.split("="); if (parameter != null && parameter.length == 2 && paramKey.equals(parameter[0])) { paramValue = parameter[1]; // depends on control dependency: [if], data = [none] break; } } } return paramValue; } }
public class class_name { public void setSessionBackupAsync( final boolean sessionBackupAsync ) { final boolean oldSessionBackupAsync = _sessionBackupAsync; _sessionBackupAsync = sessionBackupAsync; if ( ( oldSessionBackupAsync != sessionBackupAsync ) && _manager.isInitialized() ) { _log.info( "SessionBackupAsync was changed to " + sessionBackupAsync + ", creating new BackupSessionService with new configuration." ); _backupSessionService = new BackupSessionService( _transcoderService, _sessionBackupAsync, _sessionBackupTimeout, _backupThreadCount, _storage, _memcachedNodesManager, _statistics ); } } }
public class class_name { public void setSessionBackupAsync( final boolean sessionBackupAsync ) { final boolean oldSessionBackupAsync = _sessionBackupAsync; _sessionBackupAsync = sessionBackupAsync; if ( ( oldSessionBackupAsync != sessionBackupAsync ) && _manager.isInitialized() ) { _log.info( "SessionBackupAsync was changed to " + sessionBackupAsync + ", creating new BackupSessionService with new configuration." ); _backupSessionService = new BackupSessionService( _transcoderService, _sessionBackupAsync, _sessionBackupTimeout, _backupThreadCount, _storage, _memcachedNodesManager, _statistics ); // depends on control dependency: [if], data = [none] } } }
public class class_name { private JPanel getPaneSelect() { if (paneSelect == null) { paneSelect = new JPanel(); paneSelect.setLayout(new BorderLayout(0,0)); paneSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); paneSelect.add(getTabbedSelect()); } return paneSelect; } }
public class class_name { private JPanel getPaneSelect() { if (paneSelect == null) { paneSelect = new JPanel(); // depends on control dependency: [if], data = [none] paneSelect.setLayout(new BorderLayout(0,0)); // depends on control dependency: [if], data = [none] paneSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); // depends on control dependency: [if], data = [none] paneSelect.add(getTabbedSelect()); // depends on control dependency: [if], data = [none] } return paneSelect; } }
public class class_name { public int convexHullSize() { int ans = 0; Iterator<Vector3> it = this.getConvexHullVerticesIterator(); while (it.hasNext()) { ans++; it.next(); } return ans; } }
public class class_name { public int convexHullSize() { int ans = 0; Iterator<Vector3> it = this.getConvexHullVerticesIterator(); while (it.hasNext()) { ans++; // depends on control dependency: [while], data = [none] it.next(); // depends on control dependency: [while], data = [none] } return ans; } }
public class class_name { @SneakyThrows protected Ticket encodeTicket(final Ticket ticket) { if (!isCipherExecutorEnabled()) { LOGGER.trace(MESSAGE); return ticket; } if (ticket == null) { LOGGER.debug("Ticket passed is null and cannot be encoded"); return null; } LOGGER.debug("Encoding ticket [{}]", ticket); val encodedTicketObject = SerializationUtils.serializeAndEncodeObject(this.cipherExecutor, ticket); val encodedTicketId = encodeTicketId(ticket.getId()); val encodedTicket = new EncodedTicket(encodedTicketId, ByteSource.wrap(encodedTicketObject).read()); LOGGER.debug("Created encoded ticket [{}]", encodedTicket); return encodedTicket; } }
public class class_name { @SneakyThrows protected Ticket encodeTicket(final Ticket ticket) { if (!isCipherExecutorEnabled()) { LOGGER.trace(MESSAGE); // depends on control dependency: [if], data = [none] return ticket; // depends on control dependency: [if], data = [none] } if (ticket == null) { LOGGER.debug("Ticket passed is null and cannot be encoded"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } LOGGER.debug("Encoding ticket [{}]", ticket); val encodedTicketObject = SerializationUtils.serializeAndEncodeObject(this.cipherExecutor, ticket); val encodedTicketId = encodeTicketId(ticket.getId()); val encodedTicket = new EncodedTicket(encodedTicketId, ByteSource.wrap(encodedTicketObject).read()); LOGGER.debug("Created encoded ticket [{}]", encodedTicket); return encodedTicket; } }
public class class_name { public String getReadMethod() { if ( getterName != null ) { return getterName; } String prefix; if ( "boolean".equals( this.type ) ) { prefix = "is"; } else { prefix = "get"; } return prefix + this.name.substring( 0, 1 ).toUpperCase() + this.name.substring( 1 ); } }
public class class_name { public String getReadMethod() { if ( getterName != null ) { return getterName; // depends on control dependency: [if], data = [none] } String prefix; if ( "boolean".equals( this.type ) ) { prefix = "is"; // depends on control dependency: [if], data = [none] } else { prefix = "get"; // depends on control dependency: [if], data = [none] } return prefix + this.name.substring( 0, 1 ).toUpperCase() + this.name.substring( 1 ); } }
public class class_name { @SuppressWarnings("rawtypes") @Override public List<Handler> getHandlerChain(PortInfo paramPortInfo) { List<Handler> handlers = handlersMap.get(paramPortInfo); if (handlers == null) { handlers = createHandlerFromHandlerInfo(paramPortInfo); handlersMap.put(paramPortInfo, handlers); } // return Collections.unmodifiableList(handlers); return handlers; } }
public class class_name { @SuppressWarnings("rawtypes") @Override public List<Handler> getHandlerChain(PortInfo paramPortInfo) { List<Handler> handlers = handlersMap.get(paramPortInfo); if (handlers == null) { handlers = createHandlerFromHandlerInfo(paramPortInfo); // depends on control dependency: [if], data = [none] handlersMap.put(paramPortInfo, handlers); // depends on control dependency: [if], data = [none] } // return Collections.unmodifiableList(handlers); return handlers; } }
public class class_name { public static Token[] convertToRPN(final String expression, final Map<String, Function> userFunctions, final Map<String, Operator> userOperators, final Set<String> variableNames, final boolean implicitMultiplication){ final Stack<Token> stack = new Stack<Token>(); final List<Token> output = new ArrayList<Token>(); final Tokenizer tokenizer = new Tokenizer(expression, userFunctions, userOperators, variableNames, implicitMultiplication); while (tokenizer.hasNext()) { Token token = tokenizer.nextToken(); switch (token.getType()) { case Token.TOKEN_NUMBER: case Token.TOKEN_VARIABLE: output.add(token); break; case Token.TOKEN_FUNCTION: stack.add(token); break; case Token.TOKEN_SEPARATOR: while (!stack.empty() && stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) { output.add(stack.pop()); } if (stack.empty() || stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) { throw new IllegalArgumentException("Misplaced function separator ',' or mismatched parentheses"); } break; case Token.TOKEN_OPERATOR: while (!stack.empty() && stack.peek().getType() == Token.TOKEN_OPERATOR) { OperatorToken o1 = (OperatorToken) token; OperatorToken o2 = (OperatorToken) stack.peek(); if (o1.getOperator().getNumOperands() == 1 && o2.getOperator().getNumOperands() == 2) { break; } else if ((o1.getOperator().isLeftAssociative() && o1.getOperator().getPrecedence() <= o2.getOperator().getPrecedence()) || (o1.getOperator().getPrecedence() < o2.getOperator().getPrecedence())) { output.add(stack.pop()); }else { break; } } stack.push(token); break; case Token.TOKEN_PARENTHESES_OPEN: stack.push(token); break; case Token.TOKEN_PARENTHESES_CLOSE: while (stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) { output.add(stack.pop()); } stack.pop(); if (!stack.isEmpty() && stack.peek().getType() == Token.TOKEN_FUNCTION) { output.add(stack.pop()); } break; default: throw new IllegalArgumentException("Unknown Token type encountered. This should not happen"); } } while (!stack.empty()) { Token t = stack.pop(); if (t.getType() == Token.TOKEN_PARENTHESES_CLOSE || t.getType() == Token.TOKEN_PARENTHESES_OPEN) { throw new IllegalArgumentException("Mismatched parentheses detected. Please check the expression"); } else { output.add(t); } } return (Token[]) output.toArray(new Token[output.size()]); } }
public class class_name { public static Token[] convertToRPN(final String expression, final Map<String, Function> userFunctions, final Map<String, Operator> userOperators, final Set<String> variableNames, final boolean implicitMultiplication){ final Stack<Token> stack = new Stack<Token>(); final List<Token> output = new ArrayList<Token>(); final Tokenizer tokenizer = new Tokenizer(expression, userFunctions, userOperators, variableNames, implicitMultiplication); while (tokenizer.hasNext()) { Token token = tokenizer.nextToken(); switch (token.getType()) { case Token.TOKEN_NUMBER: case Token.TOKEN_VARIABLE: output.add(token); // depends on control dependency: [while], data = [none] break; case Token.TOKEN_FUNCTION: stack.add(token); // depends on control dependency: [while], data = [none] break; case Token.TOKEN_SEPARATOR: while (!stack.empty() && stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) { output.add(stack.pop()); // depends on control dependency: [while], data = [none] } if (stack.empty() || stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) { throw new IllegalArgumentException("Misplaced function separator ',' or mismatched parentheses"); } break; case Token.TOKEN_OPERATOR: while (!stack.empty() && stack.peek().getType() == Token.TOKEN_OPERATOR) { OperatorToken o1 = (OperatorToken) token; OperatorToken o2 = (OperatorToken) stack.peek(); if (o1.getOperator().getNumOperands() == 1 && o2.getOperator().getNumOperands() == 2) { break; } else if ((o1.getOperator().isLeftAssociative() && o1.getOperator().getPrecedence() <= o2.getOperator().getPrecedence()) || (o1.getOperator().getPrecedence() < o2.getOperator().getPrecedence())) { output.add(stack.pop()); // depends on control dependency: [if], data = [none] }else { break; } } stack.push(token); // depends on control dependency: [while], data = [none] break; case Token.TOKEN_PARENTHESES_OPEN: stack.push(token); // depends on control dependency: [while], data = [none] break; case Token.TOKEN_PARENTHESES_CLOSE: while (stack.peek().getType() != Token.TOKEN_PARENTHESES_OPEN) { output.add(stack.pop()); // depends on control dependency: [while], data = [none] } stack.pop(); // depends on control dependency: [while], data = [none] if (!stack.isEmpty() && stack.peek().getType() == Token.TOKEN_FUNCTION) { output.add(stack.pop()); // depends on control dependency: [if], data = [none] } break; default: throw new IllegalArgumentException("Unknown Token type encountered. This should not happen"); } } while (!stack.empty()) { Token t = stack.pop(); if (t.getType() == Token.TOKEN_PARENTHESES_CLOSE || t.getType() == Token.TOKEN_PARENTHESES_OPEN) { throw new IllegalArgumentException("Mismatched parentheses detected. Please check the expression"); } else { output.add(t); } } return (Token[]) output.toArray(new Token[output.size()]); } }
public class class_name { @Override public void cacheResult( List<CommerceTaxFixedRateAddressRel> commerceTaxFixedRateAddressRels) { for (CommerceTaxFixedRateAddressRel commerceTaxFixedRateAddressRel : commerceTaxFixedRateAddressRels) { if (entityCache.getResult( CommerceTaxFixedRateAddressRelModelImpl.ENTITY_CACHE_ENABLED, CommerceTaxFixedRateAddressRelImpl.class, commerceTaxFixedRateAddressRel.getPrimaryKey()) == null) { cacheResult(commerceTaxFixedRateAddressRel); } else { commerceTaxFixedRateAddressRel.resetOriginalValues(); } } } }
public class class_name { @Override public void cacheResult( List<CommerceTaxFixedRateAddressRel> commerceTaxFixedRateAddressRels) { for (CommerceTaxFixedRateAddressRel commerceTaxFixedRateAddressRel : commerceTaxFixedRateAddressRels) { if (entityCache.getResult( CommerceTaxFixedRateAddressRelModelImpl.ENTITY_CACHE_ENABLED, CommerceTaxFixedRateAddressRelImpl.class, commerceTaxFixedRateAddressRel.getPrimaryKey()) == null) { cacheResult(commerceTaxFixedRateAddressRel); // depends on control dependency: [if], data = [none] } else { commerceTaxFixedRateAddressRel.resetOriginalValues(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void transformMessage(String strXMLIn, String strXMLOut, String strTransformer) { try { Reader reader = new FileReader(strXMLIn); Writer stringWriter = new FileWriter(strXMLOut); Reader readerxsl = new FileReader(strTransformer); Utility.transformMessage(reader, stringWriter, readerxsl); } catch (IOException ex) { ex.printStackTrace(); } } }
public class class_name { public static void transformMessage(String strXMLIn, String strXMLOut, String strTransformer) { try { Reader reader = new FileReader(strXMLIn); Writer stringWriter = new FileWriter(strXMLOut); Reader readerxsl = new FileReader(strTransformer); Utility.transformMessage(reader, stringWriter, readerxsl); // depends on control dependency: [try], data = [none] } catch (IOException ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ProjectionCT makeCoordinateTransform(AttributeContainer ctv, String units) { int[] area = getIntArray(ctv, McIDASAreaProjection.ATTR_AREADIR); int[] nav = getIntArray(ctv, McIDASAreaProjection.ATTR_NAVBLOCK); int[] aux = null; if (ctv.findAttributeIgnoreCase(McIDASAreaProjection.ATTR_AUXBLOCK) != null) { aux = getIntArray(ctv, McIDASAreaProjection.ATTR_AUXBLOCK); } // not clear if its ok if aux is null, coverity is complaining McIDASAreaProjection proj = new McIDASAreaProjection(area, nav, aux); return new ProjectionCT(ctv.getName(), "FGDC", proj); } }
public class class_name { public ProjectionCT makeCoordinateTransform(AttributeContainer ctv, String units) { int[] area = getIntArray(ctv, McIDASAreaProjection.ATTR_AREADIR); int[] nav = getIntArray(ctv, McIDASAreaProjection.ATTR_NAVBLOCK); int[] aux = null; if (ctv.findAttributeIgnoreCase(McIDASAreaProjection.ATTR_AUXBLOCK) != null) { aux = getIntArray(ctv, McIDASAreaProjection.ATTR_AUXBLOCK); // depends on control dependency: [if], data = [none] } // not clear if its ok if aux is null, coverity is complaining McIDASAreaProjection proj = new McIDASAreaProjection(area, nav, aux); return new ProjectionCT(ctv.getName(), "FGDC", proj); } }
public class class_name { @Override public int compare(ProposalPersonContract person1, ProposalPersonContract person2) { int retval = 0; if (person1.isInvestigator() || person2.isInvestigator()) { if (person1.isPrincipalInvestigator() || person2.isPrincipalInvestigator()) { if (person1.isPrincipalInvestigator()) { retval--; } if (person2.isPrincipalInvestigator()) { retval++; } } } if (retval == 0) { retval = massageOrdinalNumber(person1).compareTo(massageOrdinalNumber(person2)); } if (retval == 0) { if (isNotBlank(person1.getFullName())) { retval = person1.getLastName().compareTo(person2.getLastName()); } else if (isNotBlank(person2.getLastName())) { retval--; } } LOG.info("retval = " + retval); return retval; } }
public class class_name { @Override public int compare(ProposalPersonContract person1, ProposalPersonContract person2) { int retval = 0; if (person1.isInvestigator() || person2.isInvestigator()) { if (person1.isPrincipalInvestigator() || person2.isPrincipalInvestigator()) { if (person1.isPrincipalInvestigator()) { retval--; // depends on control dependency: [if], data = [none] } if (person2.isPrincipalInvestigator()) { retval++; // depends on control dependency: [if], data = [none] } } } if (retval == 0) { retval = massageOrdinalNumber(person1).compareTo(massageOrdinalNumber(person2)); // depends on control dependency: [if], data = [none] } if (retval == 0) { if (isNotBlank(person1.getFullName())) { retval = person1.getLastName().compareTo(person2.getLastName()); // depends on control dependency: [if], data = [none] } else if (isNotBlank(person2.getLastName())) { retval--; // depends on control dependency: [if], data = [none] } } LOG.info("retval = " + retval); return retval; } }
public class class_name { @Override public void clear() { final ReentrantLock lock = this.lock; lock.lock(); try { setArray(new Object[0]); } finally { lock.unlock(); } } }
public class class_name { @Override public void clear() { final ReentrantLock lock = this.lock; lock.lock(); try { setArray(new Object[0]); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { public void makeScoreHashMethod(CtClass scClass) { // Map of previously extracted PMML names, and their java equivs HashMap<String,String> vars = new HashMap<String,String>(); StringBuilder sb = new StringBuilder(); sb.append("double score( java.util.HashMap row ) {\n"+ " double score = "+_initialScore+";\n"); try { for( int i=0; i<_rules.length; i++ ) _rules[i].makeFeatureHashMethod(sb,vars,scClass); sb.append(" return score;\n}\n"); CtMethod happyMethod = CtMethod.make(sb.toString(),scClass); scClass.addMethod(happyMethod); } catch( Exception re ) { Log.err(Sys.SCORM,"Crashing:"+sb.toString(), new RuntimeException(re)); } } }
public class class_name { public void makeScoreHashMethod(CtClass scClass) { // Map of previously extracted PMML names, and their java equivs HashMap<String,String> vars = new HashMap<String,String>(); StringBuilder sb = new StringBuilder(); sb.append("double score( java.util.HashMap row ) {\n"+ " double score = "+_initialScore+";\n"); try { for( int i=0; i<_rules.length; i++ ) _rules[i].makeFeatureHashMethod(sb,vars,scClass); sb.append(" return score;\n}\n"); // depends on control dependency: [try], data = [none] CtMethod happyMethod = CtMethod.make(sb.toString(),scClass); scClass.addMethod(happyMethod); // depends on control dependency: [try], data = [none] } catch( Exception re ) { Log.err(Sys.SCORM,"Crashing:"+sb.toString(), new RuntimeException(re)); } // depends on control dependency: [catch], data = [none] } }