code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void setHeader(HeaderFooter header) { this.header = header; DocListener listener; for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { listener = (DocListener) iterator.next(); listener.setHeader(header); } } }
public class class_name { public void setHeader(HeaderFooter header) { this.header = header; DocListener listener; for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { listener = (DocListener) iterator.next(); // depends on control dependency: [for], data = [iterator] listener.setHeader(header); // depends on control dependency: [for], data = [none] } } }
public class class_name { public boolean exists(final String resourceName) { final Loader myLoader = this.loader; final String normalizedName = myLoader.normalize(resourceName); if (normalizedName == null) { return false; } return myLoader.get(normalizedName).exists(); } }
public class class_name { public boolean exists(final String resourceName) { final Loader myLoader = this.loader; final String normalizedName = myLoader.normalize(resourceName); if (normalizedName == null) { return false; // depends on control dependency: [if], data = [none] } return myLoader.get(normalizedName).exists(); } }
public class class_name { private static long getMostRecentDate(CmsObject cms) { long mostRecentDate = Long.MIN_VALUE; try { final List<CmsResource> resources = cms.getResourcesInFolder( DEFAULT_DICTIONARY_DIRECTORY, CmsResourceFilter.DEFAULT_FILES); for (final CmsResource resource : resources) { final String resourceName = resource.getName(); // Check whether the resource matches the desired patterns if (resourceName.matches(DICTIONARY_NAME_REGEX) || resourceName.matches(ZIP_NAME_REGEX) || resourceName.matches(CUSTOM_DICTIONARY)) { if (resource.getDateLastModified() > mostRecentDate) { mostRecentDate = resource.getDateLastModified(); } } } } catch (CmsException e) { LOG.error("Could not read spellchecker dictionaries. "); } return mostRecentDate; } }
public class class_name { private static long getMostRecentDate(CmsObject cms) { long mostRecentDate = Long.MIN_VALUE; try { final List<CmsResource> resources = cms.getResourcesInFolder( DEFAULT_DICTIONARY_DIRECTORY, CmsResourceFilter.DEFAULT_FILES); for (final CmsResource resource : resources) { final String resourceName = resource.getName(); // Check whether the resource matches the desired patterns if (resourceName.matches(DICTIONARY_NAME_REGEX) || resourceName.matches(ZIP_NAME_REGEX) || resourceName.matches(CUSTOM_DICTIONARY)) { if (resource.getDateLastModified() > mostRecentDate) { mostRecentDate = resource.getDateLastModified(); // depends on control dependency: [if], data = [none] } } } } catch (CmsException e) { LOG.error("Could not read spellchecker dictionaries. "); } // depends on control dependency: [catch], data = [none] return mostRecentDate; } }
public class class_name { @Override public BsonType readBsonType() { if (isClosed()) { throw new IllegalStateException("This instance has been closed"); } if (getState() == State.INITIAL || getState() == State.DONE || getState() == State.SCOPE_DOCUMENT) { // in JSON the top level value can be of any type so fall through setState(State.TYPE); } if (getState() != State.TYPE) { throwInvalidState("readBSONType", State.TYPE); } if (getContext().getContextType() == BsonContextType.DOCUMENT) { JsonToken nameToken = popToken(); switch (nameToken.getType()) { case STRING: case UNQUOTED_STRING: setCurrentName(nameToken.getValue(String.class)); break; case END_OBJECT: setState(State.END_OF_DOCUMENT); return BsonType.END_OF_DOCUMENT; default: throw new JsonParseException("JSON reader was expecting a name but found '%s'.", nameToken.getValue()); } JsonToken colonToken = popToken(); if (colonToken.getType() != JsonTokenType.COLON) { throw new JsonParseException("JSON reader was expecting ':' but found '%s'.", colonToken.getValue()); } } JsonToken token = popToken(); if (getContext().getContextType() == BsonContextType.ARRAY && token.getType() == JsonTokenType.END_ARRAY) { setState(State.END_OF_ARRAY); return BsonType.END_OF_DOCUMENT; } boolean noValueFound = false; switch (token.getType()) { case BEGIN_ARRAY: setCurrentBsonType(BsonType.ARRAY); break; case BEGIN_OBJECT: visitExtendedJSON(); break; case DOUBLE: setCurrentBsonType(BsonType.DOUBLE); currentValue = token.getValue(); break; case END_OF_FILE: setCurrentBsonType(BsonType.END_OF_DOCUMENT); break; case INT32: setCurrentBsonType(BsonType.INT32); currentValue = token.getValue(); break; case INT64: setCurrentBsonType(BsonType.INT64); currentValue = token.getValue(); break; case REGULAR_EXPRESSION: setCurrentBsonType(BsonType.REGULAR_EXPRESSION); currentValue = token.getValue(); break; case STRING: setCurrentBsonType(BsonType.STRING); currentValue = token.getValue(); break; case UNQUOTED_STRING: String value = token.getValue(String.class); if ("false".equals(value) || "true".equals(value)) { setCurrentBsonType(BsonType.BOOLEAN); currentValue = Boolean.parseBoolean(value); } else if ("Infinity".equals(value)) { setCurrentBsonType(BsonType.DOUBLE); currentValue = Double.POSITIVE_INFINITY; } else if ("NaN".equals(value)) { setCurrentBsonType(BsonType.DOUBLE); currentValue = Double.NaN; } else if ("null".equals(value)) { setCurrentBsonType(BsonType.NULL); } else if ("undefined".equals(value)) { setCurrentBsonType(BsonType.UNDEFINED); } else if ("MinKey".equals(value)) { visitEmptyConstructor(); setCurrentBsonType(BsonType.MIN_KEY); currentValue = new MinKey(); } else if ("MaxKey".equals(value)) { visitEmptyConstructor(); setCurrentBsonType(BsonType.MAX_KEY); currentValue = new MaxKey(); } else if ("BinData".equals(value)) { setCurrentBsonType(BsonType.BINARY); currentValue = visitBinDataConstructor(); } else if ("Date".equals(value)) { currentValue = visitDateTimeConstructorWithOutNew(); setCurrentBsonType(BsonType.STRING); } else if ("HexData".equals(value)) { setCurrentBsonType(BsonType.BINARY); currentValue = visitHexDataConstructor(); } else if ("ISODate".equals(value)) { setCurrentBsonType(BsonType.DATE_TIME); currentValue = visitISODateTimeConstructor(); } else if ("NumberInt".equals(value)) { setCurrentBsonType(BsonType.INT32); currentValue = visitNumberIntConstructor(); } else if ("NumberLong".equals(value)) { setCurrentBsonType(BsonType.INT64); currentValue = visitNumberLongConstructor(); } else if ("NumberDecimal".equals(value)) { setCurrentBsonType(BsonType.DECIMAL128); currentValue = visitNumberDecimalConstructor(); } else if ("ObjectId".equals(value)) { setCurrentBsonType(BsonType.OBJECT_ID); currentValue = visitObjectIdConstructor(); } else if ("Timestamp".equals(value)) { setCurrentBsonType(BsonType.TIMESTAMP); currentValue = visitTimestampConstructor(); } else if ("RegExp".equals(value)) { setCurrentBsonType(BsonType.REGULAR_EXPRESSION); currentValue = visitRegularExpressionConstructor(); } else if ("DBPointer".equals(value)) { setCurrentBsonType(BsonType.DB_POINTER); currentValue = visitDBPointerConstructor(); } else if ("UUID".equals(value) || "GUID".equals(value) || "CSUUID".equals(value) || "CSGUID".equals(value) || "JUUID".equals(value) || "JGUID".equals(value) || "PYUUID".equals(value) || "PYGUID".equals(value)) { setCurrentBsonType(BsonType.BINARY); currentValue = visitUUIDConstructor(value); } else if ("new".equals(value)) { visitNew(); } else { noValueFound = true; } break; default: noValueFound = true; break; } if (noValueFound) { throw new JsonParseException("JSON reader was expecting a value but found '%s'.", token.getValue()); } if (getContext().getContextType() == BsonContextType.ARRAY || getContext().getContextType() == BsonContextType.DOCUMENT) { JsonToken commaToken = popToken(); if (commaToken.getType() != JsonTokenType.COMMA) { pushToken(commaToken); } } switch (getContext().getContextType()) { case DOCUMENT: case SCOPE_DOCUMENT: default: setState(State.NAME); break; case ARRAY: case JAVASCRIPT_WITH_SCOPE: case TOP_LEVEL: setState(State.VALUE); break; } return getCurrentBsonType(); } }
public class class_name { @Override public BsonType readBsonType() { if (isClosed()) { throw new IllegalStateException("This instance has been closed"); } if (getState() == State.INITIAL || getState() == State.DONE || getState() == State.SCOPE_DOCUMENT) { // in JSON the top level value can be of any type so fall through setState(State.TYPE); // depends on control dependency: [if], data = [none] } if (getState() != State.TYPE) { throwInvalidState("readBSONType", State.TYPE); // depends on control dependency: [if], data = [State.TYPE)] } if (getContext().getContextType() == BsonContextType.DOCUMENT) { JsonToken nameToken = popToken(); switch (nameToken.getType()) { case STRING: case UNQUOTED_STRING: setCurrentName(nameToken.getValue(String.class)); break; case END_OBJECT: setState(State.END_OF_DOCUMENT); // depends on control dependency: [if], data = [none] return BsonType.END_OF_DOCUMENT; // depends on control dependency: [if], data = [none] default: throw new JsonParseException("JSON reader was expecting a name but found '%s'.", nameToken.getValue()); } JsonToken colonToken = popToken(); if (colonToken.getType() != JsonTokenType.COLON) { throw new JsonParseException("JSON reader was expecting ':' but found '%s'.", colonToken.getValue()); } } JsonToken token = popToken(); if (getContext().getContextType() == BsonContextType.ARRAY && token.getType() == JsonTokenType.END_ARRAY) { setState(State.END_OF_ARRAY); return BsonType.END_OF_DOCUMENT; } boolean noValueFound = false; switch (token.getType()) { case BEGIN_ARRAY: setCurrentBsonType(BsonType.ARRAY); break; case BEGIN_OBJECT: visitExtendedJSON(); break; case DOUBLE: setCurrentBsonType(BsonType.DOUBLE); currentValue = token.getValue(); break; case END_OF_FILE: setCurrentBsonType(BsonType.END_OF_DOCUMENT); break; case INT32: setCurrentBsonType(BsonType.INT32); currentValue = token.getValue(); break; case INT64: setCurrentBsonType(BsonType.INT64); currentValue = token.getValue(); break; case REGULAR_EXPRESSION: setCurrentBsonType(BsonType.REGULAR_EXPRESSION); currentValue = token.getValue(); break; case STRING: setCurrentBsonType(BsonType.STRING); currentValue = token.getValue(); break; case UNQUOTED_STRING: String value = token.getValue(String.class); if ("false".equals(value) || "true".equals(value)) { setCurrentBsonType(BsonType.BOOLEAN); currentValue = Boolean.parseBoolean(value); } else if ("Infinity".equals(value)) { setCurrentBsonType(BsonType.DOUBLE); currentValue = Double.POSITIVE_INFINITY; } else if ("NaN".equals(value)) { setCurrentBsonType(BsonType.DOUBLE); currentValue = Double.NaN; } else if ("null".equals(value)) { setCurrentBsonType(BsonType.NULL); } else if ("undefined".equals(value)) { setCurrentBsonType(BsonType.UNDEFINED); } else if ("MinKey".equals(value)) { visitEmptyConstructor(); setCurrentBsonType(BsonType.MIN_KEY); currentValue = new MinKey(); } else if ("MaxKey".equals(value)) { visitEmptyConstructor(); setCurrentBsonType(BsonType.MAX_KEY); currentValue = new MaxKey(); } else if ("BinData".equals(value)) { setCurrentBsonType(BsonType.BINARY); currentValue = visitBinDataConstructor(); } else if ("Date".equals(value)) { currentValue = visitDateTimeConstructorWithOutNew(); setCurrentBsonType(BsonType.STRING); } else if ("HexData".equals(value)) { setCurrentBsonType(BsonType.BINARY); currentValue = visitHexDataConstructor(); } else if ("ISODate".equals(value)) { setCurrentBsonType(BsonType.DATE_TIME); currentValue = visitISODateTimeConstructor(); } else if ("NumberInt".equals(value)) { setCurrentBsonType(BsonType.INT32); currentValue = visitNumberIntConstructor(); } else if ("NumberLong".equals(value)) { setCurrentBsonType(BsonType.INT64); currentValue = visitNumberLongConstructor(); } else if ("NumberDecimal".equals(value)) { setCurrentBsonType(BsonType.DECIMAL128); currentValue = visitNumberDecimalConstructor(); } else if ("ObjectId".equals(value)) { setCurrentBsonType(BsonType.OBJECT_ID); currentValue = visitObjectIdConstructor(); } else if ("Timestamp".equals(value)) { setCurrentBsonType(BsonType.TIMESTAMP); currentValue = visitTimestampConstructor(); } else if ("RegExp".equals(value)) { setCurrentBsonType(BsonType.REGULAR_EXPRESSION); currentValue = visitRegularExpressionConstructor(); } else if ("DBPointer".equals(value)) { setCurrentBsonType(BsonType.DB_POINTER); currentValue = visitDBPointerConstructor(); } else if ("UUID".equals(value) || "GUID".equals(value) || "CSUUID".equals(value) || "CSGUID".equals(value) || "JUUID".equals(value) || "JGUID".equals(value) || "PYUUID".equals(value) || "PYGUID".equals(value)) { setCurrentBsonType(BsonType.BINARY); currentValue = visitUUIDConstructor(value); } else if ("new".equals(value)) { visitNew(); } else { noValueFound = true; } break; default: noValueFound = true; break; } if (noValueFound) { throw new JsonParseException("JSON reader was expecting a value but found '%s'.", token.getValue()); } if (getContext().getContextType() == BsonContextType.ARRAY || getContext().getContextType() == BsonContextType.DOCUMENT) { JsonToken commaToken = popToken(); if (commaToken.getType() != JsonTokenType.COMMA) { pushToken(commaToken); // depends on control dependency: [if], data = [none] } } switch (getContext().getContextType()) { case DOCUMENT: case SCOPE_DOCUMENT: default: setState(State.NAME); break; case ARRAY: case JAVASCRIPT_WITH_SCOPE: case TOP_LEVEL: setState(State.VALUE); break; } return getCurrentBsonType(); } }
public class class_name { private byte[] serialize() { if (messageBytes == null && message != null) { checkConverter(); messageBytes = converter.toBytes(message); if (messageBytes == null) { // should we throw an IOException instead? LOG.warn("Could not serialize " + message.getClass()); } else { message = null; // so that message and messageBytes don't go out of // sync. } } return messageBytes; } }
public class class_name { private byte[] serialize() { if (messageBytes == null && message != null) { checkConverter(); // depends on control dependency: [if], data = [none] messageBytes = converter.toBytes(message); // depends on control dependency: [if], data = [none] if (messageBytes == null) { // should we throw an IOException instead? LOG.warn("Could not serialize " + message.getClass()); // depends on control dependency: [if], data = [none] } else { message = null; // so that message and messageBytes don't go out of // depends on control dependency: [if], data = [none] // sync. } } return messageBytes; } }
public class class_name { protected LightweightTypeReference normalizeFunctionTypeReference(LightweightTypeReference type) { if (type.getKind() == LightweightTypeReference.KIND_FUNCTION_TYPE_REFERENCE) { ParameterizedTypeReference parameterized = new ParameterizedTypeReference(type.getOwner(), type.getType()); for(LightweightTypeReference argument: type.getTypeArguments()) { parameterized.addTypeArgument(argument); } type = parameterized.tryConvertToFunctionTypeReference(false); } return type; } }
public class class_name { protected LightweightTypeReference normalizeFunctionTypeReference(LightweightTypeReference type) { if (type.getKind() == LightweightTypeReference.KIND_FUNCTION_TYPE_REFERENCE) { ParameterizedTypeReference parameterized = new ParameterizedTypeReference(type.getOwner(), type.getType()); for(LightweightTypeReference argument: type.getTypeArguments()) { parameterized.addTypeArgument(argument); // depends on control dependency: [for], data = [argument] } type = parameterized.tryConvertToFunctionTypeReference(false); // depends on control dependency: [if], data = [none] } return type; } }
public class class_name { private boolean makeProjection(NetcdfFile ncfile, int projType) { switch (projType) { case GridTableLookup.RotatedLatLon: makeRotatedLatLon(ncfile); break; case GridTableLookup.PolarStereographic: makePS(); break; case GridTableLookup.LambertConformal: makeLC(); break; case GridTableLookup.Mercator: makeMercator(); break; case GridTableLookup.Orthographic: //makeSpaceViewOrOthographic(); makeMSGgeostationary(); break; case GridTableLookup.Curvilinear: makeCurvilinearAxis( ncfile); break; default: throw new UnsupportedOperationException("unknown projection = " + gds.getInt(GridDefRecord.GRID_TYPE)); } // dummy coordsys variable Variable v = new Variable(ncfile, g, null, grid_name); v.setDataType(DataType.CHAR); v.setDimensions(""); // scalar char[] data = new char[]{'d'}; Array dataArray = Array.factory(DataType.CHAR, new int[0], data); v.setCachedData(dataArray, false); for (Attribute att : attributes) v.addAttribute(att); // add CF Conventions attributes v.addAttribute(new Attribute(GridCF.EARTH_SHAPE, shape_name)); // LOOK - spherical earth ?? double radius_spherical_earth = gds.getDouble(GridDefRecord.RADIUS_SPHERICAL_EARTH); // have to check both because Grib1 and Grib2 used different names if (Double.isNaN(radius_spherical_earth)) radius_spherical_earth = gds.getDouble("radius_spherical_earth"); if( ! Double.isNaN(radius_spherical_earth) ) { //inconsistent - sometimes in km, sometimes in m. if (radius_spherical_earth < 10000.00) // then its in km radius_spherical_earth *= 1000.0; // convert to meters v.addAttribute(new Attribute(GridCF.EARTH_RADIUS, radius_spherical_earth)); //this attribute needs to be meters } else { // oblate earth double major_axis = gds.getDouble( GridDefRecord.MAJOR_AXIS_EARTH ); if (Double.isNaN( major_axis )) major_axis = gds.getDouble("major_axis_earth"); double minor_axis = gds.getDouble( GridDefRecord.MINOR_AXIS_EARTH ); if (Double.isNaN(minor_axis)) minor_axis = gds.getDouble("minor_axis_earth"); if ( ! Double.isNaN ( major_axis ) && ! Double.isNaN ( minor_axis )) { v.addAttribute(new Attribute(GridCF.SEMI_MAJOR_AXIS, major_axis)); v.addAttribute(new Attribute(GridCF.SEMI_MINOR_AXIS, minor_axis)); } } addGDSparams(v); ncfile.addVariable(g, v); return true; } }
public class class_name { private boolean makeProjection(NetcdfFile ncfile, int projType) { switch (projType) { case GridTableLookup.RotatedLatLon: makeRotatedLatLon(ncfile); break; case GridTableLookup.PolarStereographic: makePS(); break; case GridTableLookup.LambertConformal: makeLC(); break; case GridTableLookup.Mercator: makeMercator(); break; case GridTableLookup.Orthographic: //makeSpaceViewOrOthographic(); makeMSGgeostationary(); break; case GridTableLookup.Curvilinear: makeCurvilinearAxis( ncfile); break; default: throw new UnsupportedOperationException("unknown projection = " + gds.getInt(GridDefRecord.GRID_TYPE)); } // dummy coordsys variable Variable v = new Variable(ncfile, g, null, grid_name); v.setDataType(DataType.CHAR); v.setDimensions(""); // scalar char[] data = new char[]{'d'}; Array dataArray = Array.factory(DataType.CHAR, new int[0], data); v.setCachedData(dataArray, false); for (Attribute att : attributes) v.addAttribute(att); // add CF Conventions attributes v.addAttribute(new Attribute(GridCF.EARTH_SHAPE, shape_name)); // LOOK - spherical earth ?? double radius_spherical_earth = gds.getDouble(GridDefRecord.RADIUS_SPHERICAL_EARTH); // have to check both because Grib1 and Grib2 used different names if (Double.isNaN(radius_spherical_earth)) radius_spherical_earth = gds.getDouble("radius_spherical_earth"); if( ! Double.isNaN(radius_spherical_earth) ) { //inconsistent - sometimes in km, sometimes in m. if (radius_spherical_earth < 10000.00) // then its in km radius_spherical_earth *= 1000.0; // convert to meters v.addAttribute(new Attribute(GridCF.EARTH_RADIUS, radius_spherical_earth)); //this attribute needs to be meters // depends on control dependency: [if], data = [none] } else { // oblate earth double major_axis = gds.getDouble( GridDefRecord.MAJOR_AXIS_EARTH ); if (Double.isNaN( major_axis )) major_axis = gds.getDouble("major_axis_earth"); double minor_axis = gds.getDouble( GridDefRecord.MINOR_AXIS_EARTH ); if (Double.isNaN(minor_axis)) minor_axis = gds.getDouble("minor_axis_earth"); if ( ! Double.isNaN ( major_axis ) && ! Double.isNaN ( minor_axis )) { v.addAttribute(new Attribute(GridCF.SEMI_MAJOR_AXIS, major_axis)); // depends on control dependency: [if], data = [none] v.addAttribute(new Attribute(GridCF.SEMI_MINOR_AXIS, minor_axis)); // depends on control dependency: [if], data = [none] } } addGDSparams(v); ncfile.addVariable(g, v); return true; } }
public class class_name { public void init(Object parent, Object record) { super.init(parent, record); if (record instanceof FieldList) this.addFieldList((FieldList)record, 0); else this.addFieldList(this.buildFieldList(), 0); if (this.getFieldList() != null) { boolean bAddCache = true; if (this instanceof JScreen) bAddCache = false; this.getBaseApplet().linkNewRemoteTable(this.getFieldList(), bAddCache); if (this.getFieldList().getTable() != null) { if (this.getFieldList().getEditMode() == Constants.EDIT_NONE) { try { this.getFieldList().getTable().addNew(); } catch (DBException ex) { ex.printStackTrace(); // Never. } } } } } }
public class class_name { public void init(Object parent, Object record) { super.init(parent, record); if (record instanceof FieldList) this.addFieldList((FieldList)record, 0); else this.addFieldList(this.buildFieldList(), 0); if (this.getFieldList() != null) { boolean bAddCache = true; if (this instanceof JScreen) bAddCache = false; this.getBaseApplet().linkNewRemoteTable(this.getFieldList(), bAddCache); // depends on control dependency: [if], data = [(this.getFieldList()] if (this.getFieldList().getTable() != null) { if (this.getFieldList().getEditMode() == Constants.EDIT_NONE) { try { this.getFieldList().getTable().addNew(); // depends on control dependency: [try], data = [none] } catch (DBException ex) { ex.printStackTrace(); // Never. } // depends on control dependency: [catch], data = [none] } } } } }
public class class_name { public static void registerHelpers(ConfigurationExtensionBuilder builder, Map<String, Helper> helpers) { Checker.checkArgumentsNotNull(builder, helpers); for (Entry<String, Helper> entry : helpers.entrySet()) { registerHelper(builder, entry.getKey(), entry.getValue()); } } }
public class class_name { public static void registerHelpers(ConfigurationExtensionBuilder builder, Map<String, Helper> helpers) { Checker.checkArgumentsNotNull(builder, helpers); for (Entry<String, Helper> entry : helpers.entrySet()) { registerHelper(builder, entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { private String translate(final Object messageObject) { if (messageObject instanceof Message) { Message message = (Message) messageObject; return I18nUtilities.format(locale, message.getMessage(), (Object[]) message.getArgs()); } else if (messageObject != null) { return I18nUtilities.format(locale, messageObject.toString()); } return null; } }
public class class_name { private String translate(final Object messageObject) { if (messageObject instanceof Message) { Message message = (Message) messageObject; return I18nUtilities.format(locale, message.getMessage(), (Object[]) message.getArgs()); // depends on control dependency: [if], data = [none] } else if (messageObject != null) { return I18nUtilities.format(locale, messageObject.toString()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public EClass getIfcPipeSegmentType() { if (ifcPipeSegmentTypeEClass == null) { ifcPipeSegmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(422); } return ifcPipeSegmentTypeEClass; } }
public class class_name { @Override public EClass getIfcPipeSegmentType() { if (ifcPipeSegmentTypeEClass == null) { ifcPipeSegmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(422); // depends on control dependency: [if], data = [none] } return ifcPipeSegmentTypeEClass; } }
public class class_name { public static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType) { if (clazz == null) throw new IllegalArgumentException("Clazz parameter can't be null"); A annotation = clazz.getAnnotation(annotationType); if (annotation != null) return annotation; for (Class<?> ifc : clazz.getInterfaces()) { annotation = findAnnotation(ifc, annotationType); if (annotation != null) return annotation; } if (!Annotation.class.isAssignableFrom(clazz)) for (Annotation ann : clazz.getAnnotations()) { annotation = findAnnotation(ann.annotationType(), annotationType); if (annotation != null) return annotation; } Class<?> superClass = clazz.getSuperclass(); if (superClass == null || superClass == Object.class) return null; return findAnnotation(superClass, annotationType); } }
public class class_name { public static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType) { if (clazz == null) throw new IllegalArgumentException("Clazz parameter can't be null"); A annotation = clazz.getAnnotation(annotationType); if (annotation != null) return annotation; for (Class<?> ifc : clazz.getInterfaces()) { annotation = findAnnotation(ifc, annotationType); // depends on control dependency: [for], data = [ifc] if (annotation != null) return annotation; } if (!Annotation.class.isAssignableFrom(clazz)) for (Annotation ann : clazz.getAnnotations()) { annotation = findAnnotation(ann.annotationType(), annotationType); // depends on control dependency: [for], data = [ann] if (annotation != null) return annotation; } Class<?> superClass = clazz.getSuperclass(); if (superClass == null || superClass == Object.class) return null; return findAnnotation(superClass, annotationType); } }
public class class_name { public void getNameAndDimensions(Formatter buf, boolean useFullName, boolean strict) { useFullName = useFullName && !strict; String name = useFullName ? getFullName() : getShortName(); if (strict) name = NetcdfFile.makeValidCDLName(getShortName()); buf.format("%s", name); if (shape != null) { if (getRank() > 0) buf.format("("); for (int i = 0; i < dimensions.size(); i++) { Dimension myd = dimensions.get(i); String dimName = myd.getShortName(); if ((dimName != null) && strict) dimName = NetcdfFile.makeValidCDLName(dimName); if (i != 0) buf.format(", "); if (myd.isVariableLength()) { buf.format("*"); } else if (myd.isShared()) { if (!strict) buf.format("%s=%d", dimName, myd.getLength()); else buf.format("%s", dimName); } else { if (dimName != null) { buf.format("%s=", dimName); } buf.format("%d", myd.getLength()); } } if (getRank() > 0) buf.format(")"); } } }
public class class_name { public void getNameAndDimensions(Formatter buf, boolean useFullName, boolean strict) { useFullName = useFullName && !strict; String name = useFullName ? getFullName() : getShortName(); if (strict) name = NetcdfFile.makeValidCDLName(getShortName()); buf.format("%s", name); if (shape != null) { if (getRank() > 0) buf.format("("); for (int i = 0; i < dimensions.size(); i++) { Dimension myd = dimensions.get(i); String dimName = myd.getShortName(); if ((dimName != null) && strict) dimName = NetcdfFile.makeValidCDLName(dimName); if (i != 0) buf.format(", "); if (myd.isVariableLength()) { buf.format("*"); // depends on control dependency: [if], data = [none] } else if (myd.isShared()) { if (!strict) buf.format("%s=%d", dimName, myd.getLength()); else buf.format("%s", dimName); } else { if (dimName != null) { buf.format("%s=", dimName); // depends on control dependency: [if], data = [none] } buf.format("%d", myd.getLength()); // depends on control dependency: [if], data = [none] } } if (getRank() > 0) buf.format(")"); } } }
public class class_name { public static void install(AddOnClassLoader addOnClassLoader, AddOn addOn) { installResourceBundle(addOnClassLoader, addOn); installAddOnFiles(addOnClassLoader, addOn, true); List<Extension> listExts = installAddOnExtensions(addOn); installAddOnActiveScanRules(addOn, addOnClassLoader); installAddOnPassiveScanRules(addOn, addOnClassLoader); // postInstall actions for (Extension ext : listExts) { if (!ext.isEnabled()) { continue; } try { ext.postInstall(); } catch (Exception e) { logger.error("Post install method failed for add-on " + addOn.getId() + " extension " + ext.getName()); } } } }
public class class_name { public static void install(AddOnClassLoader addOnClassLoader, AddOn addOn) { installResourceBundle(addOnClassLoader, addOn); installAddOnFiles(addOnClassLoader, addOn, true); List<Extension> listExts = installAddOnExtensions(addOn); installAddOnActiveScanRules(addOn, addOnClassLoader); installAddOnPassiveScanRules(addOn, addOnClassLoader); // postInstall actions for (Extension ext : listExts) { if (!ext.isEnabled()) { continue; } try { ext.postInstall(); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Post install method failed for add-on " + addOn.getId() + " extension " + ext.getName()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void setAdapter(RecyclerView.Adapter adapter) { if (mWrappedAdapter != null && mWrappedAdapter.getItemCount() > 0) { notifyItemRangeRemoved(getHeaderCount(), mWrappedAdapter.getItemCount()); } setWrappedAdapter(adapter); notifyItemRangeInserted(getHeaderCount(), mWrappedAdapter.getItemCount()); } }
public class class_name { public void setAdapter(RecyclerView.Adapter adapter) { if (mWrappedAdapter != null && mWrappedAdapter.getItemCount() > 0) { notifyItemRangeRemoved(getHeaderCount(), mWrappedAdapter.getItemCount()); // depends on control dependency: [if], data = [none] } setWrappedAdapter(adapter); notifyItemRangeInserted(getHeaderCount(), mWrappedAdapter.getItemCount()); } }
public class class_name { public boolean isSpecialIdentifierWithContent(String trigger, String... contents) { if (!matches(TokenType.SPECIAL_ID, trigger)) { return false; } if (contents.length == 0) { return true; } for (String content : contents) { if (content != null && content.equals(getContents())) { return true; } } return false; } }
public class class_name { public boolean isSpecialIdentifierWithContent(String trigger, String... contents) { if (!matches(TokenType.SPECIAL_ID, trigger)) { return false; // depends on control dependency: [if], data = [none] } if (contents.length == 0) { return true; // depends on control dependency: [if], data = [none] } for (String content : contents) { if (content != null && content.equals(getContents())) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void onAuthentication(Authentication authentication, HttpServletRequest request, HttpServletResponse response) { boolean hadSessionAlready = request.getSession(false) != null; if (!hadSessionAlready && !alwaysCreateSession) { // Session fixation isn't a problem if there's no session return; } // Create new session if necessary HttpSession session = request.getSession(); if (hadSessionAlready && request.isRequestedSessionIdValid()) { String originalSessionId; String newSessionId; Object mutex = WebUtils.getSessionMutex(session); synchronized (mutex) { // We need to migrate to a new session originalSessionId = session.getId(); session = applySessionFixation(request); newSessionId = session.getId(); } if (originalSessionId.equals(newSessionId)) { logger.warn("Your servlet container did not change the session ID when a new session was created. You will" + " not be adequately protected against session-fixation attacks"); } onSessionChange(originalSessionId, session, authentication); } } }
public class class_name { public void onAuthentication(Authentication authentication, HttpServletRequest request, HttpServletResponse response) { boolean hadSessionAlready = request.getSession(false) != null; if (!hadSessionAlready && !alwaysCreateSession) { // Session fixation isn't a problem if there's no session return; // depends on control dependency: [if], data = [none] } // Create new session if necessary HttpSession session = request.getSession(); if (hadSessionAlready && request.isRequestedSessionIdValid()) { String originalSessionId; String newSessionId; Object mutex = WebUtils.getSessionMutex(session); synchronized (mutex) { // depends on control dependency: [if], data = [none] // We need to migrate to a new session originalSessionId = session.getId(); session = applySessionFixation(request); newSessionId = session.getId(); } if (originalSessionId.equals(newSessionId)) { logger.warn("Your servlet container did not change the session ID when a new session was created. You will" + " not be adequately protected against session-fixation attacks"); // depends on control dependency: [if], data = [none] } onSessionChange(originalSessionId, session, authentication); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ResourcePendingMaintenanceActions withPendingMaintenanceActionDetails(PendingMaintenanceAction... pendingMaintenanceActionDetails) { if (this.pendingMaintenanceActionDetails == null) { setPendingMaintenanceActionDetails(new com.amazonaws.internal.SdkInternalList<PendingMaintenanceAction>(pendingMaintenanceActionDetails.length)); } for (PendingMaintenanceAction ele : pendingMaintenanceActionDetails) { this.pendingMaintenanceActionDetails.add(ele); } return this; } }
public class class_name { public ResourcePendingMaintenanceActions withPendingMaintenanceActionDetails(PendingMaintenanceAction... pendingMaintenanceActionDetails) { if (this.pendingMaintenanceActionDetails == null) { setPendingMaintenanceActionDetails(new com.amazonaws.internal.SdkInternalList<PendingMaintenanceAction>(pendingMaintenanceActionDetails.length)); // depends on control dependency: [if], data = [none] } for (PendingMaintenanceAction ele : pendingMaintenanceActionDetails) { this.pendingMaintenanceActionDetails.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static byte[] toByte(Object object, Charset charset) { ObjectMetaData objectMap = getObjectMap(object.getClass()); try { return convertFieldToByte(objectMap, object, charset); } catch (NoSuchMethodException ie) { LOGGER.debug("Cannot invoke get methed: ", ie); throw new FdfsColumnMapException(ie); } catch (IllegalAccessException iae) { LOGGER.debug("Illegal access: ", iae); throw new FdfsColumnMapException(iae); } catch (InvocationTargetException ite) { LOGGER.debug("Cannot invoke method: ", ite); throw new FdfsColumnMapException(ite); } } }
public class class_name { public static byte[] toByte(Object object, Charset charset) { ObjectMetaData objectMap = getObjectMap(object.getClass()); try { return convertFieldToByte(objectMap, object, charset); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException ie) { LOGGER.debug("Cannot invoke get methed: ", ie); throw new FdfsColumnMapException(ie); } catch (IllegalAccessException iae) { // depends on control dependency: [catch], data = [none] LOGGER.debug("Illegal access: ", iae); throw new FdfsColumnMapException(iae); } catch (InvocationTargetException ite) { // depends on control dependency: [catch], data = [none] LOGGER.debug("Cannot invoke method: ", ite); throw new FdfsColumnMapException(ite); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ExceptionalStream<T, E> collapse(final Try.BiPredicate<? super T, ? super T, ? extends E> collapsible, final Try.BiFunction<? super T, ? super T, T, ? extends E> mergeFunction) { checkArgNotNull(collapsible, "collapsible"); checkArgNotNull(mergeFunction, "mergeFunction"); final ExceptionalIterator<T, E> iter = elements; return newStream(new ExceptionalIterator<T, E>() { private boolean hasNext = false; private T next = null; @Override public boolean hasNext() throws E { return hasNext || iter.hasNext(); } @Override public T next() throws E { T res = hasNext ? next : (next = iter.next()); while ((hasNext = iter.hasNext())) { if (collapsible.test(next, (next = iter.next()))) { res = mergeFunction.apply(res, next); } else { break; } } return res; } }, closeHandlers); } }
public class class_name { public ExceptionalStream<T, E> collapse(final Try.BiPredicate<? super T, ? super T, ? extends E> collapsible, final Try.BiFunction<? super T, ? super T, T, ? extends E> mergeFunction) { checkArgNotNull(collapsible, "collapsible"); checkArgNotNull(mergeFunction, "mergeFunction"); final ExceptionalIterator<T, E> iter = elements; return newStream(new ExceptionalIterator<T, E>() { private boolean hasNext = false; private T next = null; @Override public boolean hasNext() throws E { return hasNext || iter.hasNext(); } @Override public T next() throws E { T res = hasNext ? next : (next = iter.next()); while ((hasNext = iter.hasNext())) { if (collapsible.test(next, (next = iter.next()))) { res = mergeFunction.apply(res, next); // depends on control dependency: [if], data = [none] } else { break; } } return res; } }, closeHandlers); } }
public class class_name { @Override public GoogleCloudStorageFileSet finish(Collection<? extends OutputWriter<ByteBuffer>> writers) throws IOException { List<String> fileNames = new ArrayList<>(); for (OutputWriter<ByteBuffer> writer : writers) { SizeSegmentingGoogleCloudStorageFileWriter segWriter = (SizeSegmentingGoogleCloudStorageFileWriter) writer; for (GoogleCloudStorageFileOutputWriter delegatedWriter : segWriter.getDelegatedWriters()) { fileNames.add(delegatedWriter.getFile().getObjectName()); } } return new GoogleCloudStorageFileSet(bucket, fileNames); } }
public class class_name { @Override public GoogleCloudStorageFileSet finish(Collection<? extends OutputWriter<ByteBuffer>> writers) throws IOException { List<String> fileNames = new ArrayList<>(); for (OutputWriter<ByteBuffer> writer : writers) { SizeSegmentingGoogleCloudStorageFileWriter segWriter = (SizeSegmentingGoogleCloudStorageFileWriter) writer; for (GoogleCloudStorageFileOutputWriter delegatedWriter : segWriter.getDelegatedWriters()) { fileNames.add(delegatedWriter.getFile().getObjectName()); // depends on control dependency: [for], data = [delegatedWriter] } } return new GoogleCloudStorageFileSet(bucket, fileNames); } }
public class class_name { public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; } }
public class class_name { public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected boolean isBasename(String potentialPath){ if (ALLOW_VIEW_NAME_PATH_TRAVERSAL) { return true; } else { if (potentialPath.contains("\\") || potentialPath.contains("/")) { // prevent absolute path and folder traversal to find scripts return false; } return true; } } }
public class class_name { protected boolean isBasename(String potentialPath){ if (ALLOW_VIEW_NAME_PATH_TRAVERSAL) { return true; // depends on control dependency: [if], data = [none] } else { if (potentialPath.contains("\\") || potentialPath.contains("/")) { // prevent absolute path and folder traversal to find scripts return false; // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int createDims(FlatBufferBuilder bufferBuilder,INDArray arr) { int[] tensorDimOffsets = new int[arr.rank()]; int[] nameOffset = new int[arr.rank()]; for(int i = 0; i < tensorDimOffsets.length; i++) { nameOffset[i] = bufferBuilder.createString(""); tensorDimOffsets[i] = TensorDim.createTensorDim(bufferBuilder,arr.size(i),nameOffset[i]); } return Tensor.createShapeVector(bufferBuilder,tensorDimOffsets); } }
public class class_name { public static int createDims(FlatBufferBuilder bufferBuilder,INDArray arr) { int[] tensorDimOffsets = new int[arr.rank()]; int[] nameOffset = new int[arr.rank()]; for(int i = 0; i < tensorDimOffsets.length; i++) { nameOffset[i] = bufferBuilder.createString(""); // depends on control dependency: [for], data = [i] tensorDimOffsets[i] = TensorDim.createTensorDim(bufferBuilder,arr.size(i),nameOffset[i]); // depends on control dependency: [for], data = [i] } return Tensor.createShapeVector(bufferBuilder,tensorDimOffsets); } }
public class class_name { public void getCredentials(@NonNull BaseCallback<Credentials, CredentialsManagerException> callback) { if (!hasValidCredentials()) { callback.onFailure(new CredentialsManagerException("No Credentials were previously set.")); return; } if (authenticateBeforeDecrypt) { Log.d(TAG, "Authentication is required to read the Credentials. Showing the LockScreen."); decryptCallback = callback; activity.startActivityForResult(authIntent, authenticationRequestCode); return; } continueGetCredentials(callback); } }
public class class_name { public void getCredentials(@NonNull BaseCallback<Credentials, CredentialsManagerException> callback) { if (!hasValidCredentials()) { callback.onFailure(new CredentialsManagerException("No Credentials were previously set.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (authenticateBeforeDecrypt) { Log.d(TAG, "Authentication is required to read the Credentials. Showing the LockScreen."); // depends on control dependency: [if], data = [none] decryptCallback = callback; // depends on control dependency: [if], data = [none] activity.startActivityForResult(authIntent, authenticationRequestCode); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } continueGetCredentials(callback); } }
public class class_name { public static void createEventScopeExecution(ExecutionEntity execution) { // parent execution is a subprocess or a miBody ActivityImpl activity = execution.getActivity(); ExecutionEntity scopeExecution = (ExecutionEntity) execution.findExecutionForFlowScope(activity.getFlowScope()); List<EventSubscriptionEntity> eventSubscriptions = execution.getCompensateEventSubscriptions(); if (eventSubscriptions.size() > 0 || hasCompensationEventSubprocess(activity)) { ExecutionEntity eventScopeExecution = scopeExecution.createExecution(); eventScopeExecution.setActivity(execution.getActivity()); eventScopeExecution.activityInstanceStarting(); eventScopeExecution.enterActivityInstance(); eventScopeExecution.setActive(false); eventScopeExecution.setConcurrent(false); eventScopeExecution.setEventScope(true); // copy local variables to eventScopeExecution by value. This way, // the eventScopeExecution references a 'snapshot' of the local variables Map<String, Object> variables = execution.getVariablesLocal(); for (Entry<String, Object> variable : variables.entrySet()) { eventScopeExecution.setVariableLocal(variable.getKey(), variable.getValue()); } // set event subscriptions to the event scope execution: for (EventSubscriptionEntity eventSubscriptionEntity : eventSubscriptions) { EventSubscriptionEntity newSubscription = EventSubscriptionEntity.createAndInsert( eventScopeExecution, EventType.COMPENSATE, eventSubscriptionEntity.getActivity()); newSubscription.setConfiguration(eventSubscriptionEntity.getConfiguration()); // use the original date newSubscription.setCreated(eventSubscriptionEntity.getCreated()); } // set existing event scope executions as children of new event scope execution // (ensuring they don't get removed when 'execution' gets removed) for (PvmExecutionImpl childEventScopeExecution : execution.getEventScopeExecutions()) { childEventScopeExecution.setParent(eventScopeExecution); } ActivityImpl compensationHandler = getEventScopeCompensationHandler(execution); EventSubscriptionEntity eventSubscription = EventSubscriptionEntity .createAndInsert( scopeExecution, EventType.COMPENSATE, compensationHandler ); eventSubscription.setConfiguration(eventScopeExecution.getId()); } } }
public class class_name { public static void createEventScopeExecution(ExecutionEntity execution) { // parent execution is a subprocess or a miBody ActivityImpl activity = execution.getActivity(); ExecutionEntity scopeExecution = (ExecutionEntity) execution.findExecutionForFlowScope(activity.getFlowScope()); List<EventSubscriptionEntity> eventSubscriptions = execution.getCompensateEventSubscriptions(); if (eventSubscriptions.size() > 0 || hasCompensationEventSubprocess(activity)) { ExecutionEntity eventScopeExecution = scopeExecution.createExecution(); eventScopeExecution.setActivity(execution.getActivity()); // depends on control dependency: [if], data = [none] eventScopeExecution.activityInstanceStarting(); // depends on control dependency: [if], data = [none] eventScopeExecution.enterActivityInstance(); // depends on control dependency: [if], data = [none] eventScopeExecution.setActive(false); // depends on control dependency: [if], data = [none] eventScopeExecution.setConcurrent(false); // depends on control dependency: [if], data = [none] eventScopeExecution.setEventScope(true); // depends on control dependency: [if], data = [none] // copy local variables to eventScopeExecution by value. This way, // the eventScopeExecution references a 'snapshot' of the local variables Map<String, Object> variables = execution.getVariablesLocal(); for (Entry<String, Object> variable : variables.entrySet()) { eventScopeExecution.setVariableLocal(variable.getKey(), variable.getValue()); // depends on control dependency: [for], data = [variable] } // set event subscriptions to the event scope execution: for (EventSubscriptionEntity eventSubscriptionEntity : eventSubscriptions) { EventSubscriptionEntity newSubscription = EventSubscriptionEntity.createAndInsert( eventScopeExecution, EventType.COMPENSATE, eventSubscriptionEntity.getActivity()); newSubscription.setConfiguration(eventSubscriptionEntity.getConfiguration()); // depends on control dependency: [for], data = [eventSubscriptionEntity] // use the original date newSubscription.setCreated(eventSubscriptionEntity.getCreated()); // depends on control dependency: [for], data = [eventSubscriptionEntity] } // set existing event scope executions as children of new event scope execution // (ensuring they don't get removed when 'execution' gets removed) for (PvmExecutionImpl childEventScopeExecution : execution.getEventScopeExecutions()) { childEventScopeExecution.setParent(eventScopeExecution); // depends on control dependency: [for], data = [childEventScopeExecution] } ActivityImpl compensationHandler = getEventScopeCompensationHandler(execution); EventSubscriptionEntity eventSubscription = EventSubscriptionEntity .createAndInsert( scopeExecution, EventType.COMPENSATE, compensationHandler ); eventSubscription.setConfiguration(eventScopeExecution.getId()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ListActivitiesResult withActivities(ActivityListItem... activities) { if (this.activities == null) { setActivities(new java.util.ArrayList<ActivityListItem>(activities.length)); } for (ActivityListItem ele : activities) { this.activities.add(ele); } return this; } }
public class class_name { public ListActivitiesResult withActivities(ActivityListItem... activities) { if (this.activities == null) { setActivities(new java.util.ArrayList<ActivityListItem>(activities.length)); // depends on control dependency: [if], data = [none] } for (ActivityListItem ele : activities) { this.activities.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void marshall(TerminateWorkflowExecutionRequest terminateWorkflowExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (terminateWorkflowExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getDomain(), DOMAIN_BINDING); protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getWorkflowId(), WORKFLOWID_BINDING); protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getRunId(), RUNID_BINDING); protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getReason(), REASON_BINDING); protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getDetails(), DETAILS_BINDING); protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getChildPolicy(), CHILDPOLICY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(TerminateWorkflowExecutionRequest terminateWorkflowExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (terminateWorkflowExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getDomain(), DOMAIN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getWorkflowId(), WORKFLOWID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getRunId(), RUNID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getReason(), REASON_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getDetails(), DETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(terminateWorkflowExecutionRequest.getChildPolicy(), CHILDPOLICY_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static INDArray toArray(Collection<? extends Writable> record) { List<Writable> l; if(record instanceof List){ l = (List<Writable>)record; } else { l = new ArrayList<>(record); } //Edge case: single NDArrayWritable if(l.size() == 1 && l.get(0) instanceof NDArrayWritable){ return ((NDArrayWritable) l.get(0)).get(); } int length = 0; for (Writable w : record) { if (w instanceof NDArrayWritable) { INDArray a = ((NDArrayWritable) w).get(); if (!a.isRowVector()) { throw new UnsupportedOperationException("Multiple writables present but NDArrayWritable is " + "not a row vector. Can only concat row vectors with other writables. Shape: " + Arrays.toString(a.shape())); } length += a.length(); } else { //Assume all others are single value length++; } } INDArray arr = Nd4j.create(1, length); int k = 0; for (Writable w : record ) { if (w instanceof NDArrayWritable) { INDArray toPut = ((NDArrayWritable) w).get(); arr.put(new INDArrayIndex[] {NDArrayIndex.point(0), NDArrayIndex.interval(k, k + toPut.length())}, toPut); k += toPut.length(); } else { arr.putScalar(0, k, w.toDouble()); k++; } } return arr; } }
public class class_name { public static INDArray toArray(Collection<? extends Writable> record) { List<Writable> l; if(record instanceof List){ l = (List<Writable>)record; // depends on control dependency: [if], data = [none] } else { l = new ArrayList<>(record); // depends on control dependency: [if], data = [none] } //Edge case: single NDArrayWritable if(l.size() == 1 && l.get(0) instanceof NDArrayWritable){ return ((NDArrayWritable) l.get(0)).get(); // depends on control dependency: [if], data = [none] } int length = 0; for (Writable w : record) { if (w instanceof NDArrayWritable) { INDArray a = ((NDArrayWritable) w).get(); if (!a.isRowVector()) { throw new UnsupportedOperationException("Multiple writables present but NDArrayWritable is " + "not a row vector. Can only concat row vectors with other writables. Shape: " + Arrays.toString(a.shape())); } length += a.length(); // depends on control dependency: [if], data = [none] } else { //Assume all others are single value length++; // depends on control dependency: [if], data = [none] } } INDArray arr = Nd4j.create(1, length); int k = 0; for (Writable w : record ) { if (w instanceof NDArrayWritable) { INDArray toPut = ((NDArrayWritable) w).get(); arr.put(new INDArrayIndex[] {NDArrayIndex.point(0), NDArrayIndex.interval(k, k + toPut.length())}, toPut); // depends on control dependency: [if], data = [none] k += toPut.length(); // depends on control dependency: [if], data = [none] } else { arr.putScalar(0, k, w.toDouble()); // depends on control dependency: [if], data = [none] k++; // depends on control dependency: [if], data = [none] } } return arr; } }
public class class_name { public void initRemoteSkel(ObjectInputStream daIn) { try { int iTypeField = daIn.readInt(); String typeFieldName = daIn.readUTF(); int iTargetValue = daIn.readInt(); this.init(iTypeField, typeFieldName, iTargetValue); } catch (IOException ex) { ex.printStackTrace(); } } }
public class class_name { public void initRemoteSkel(ObjectInputStream daIn) { try { int iTypeField = daIn.readInt(); String typeFieldName = daIn.readUTF(); int iTargetValue = daIn.readInt(); this.init(iTypeField, typeFieldName, iTargetValue); // depends on control dependency: [try], data = [none] } catch (IOException ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setPartitionKeys(java.util.Collection<ResponsePartitionKey> partitionKeys) { if (partitionKeys == null) { this.partitionKeys = null; return; } this.partitionKeys = new java.util.ArrayList<ResponsePartitionKey>(partitionKeys); } }
public class class_name { public void setPartitionKeys(java.util.Collection<ResponsePartitionKey> partitionKeys) { if (partitionKeys == null) { this.partitionKeys = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.partitionKeys = new java.util.ArrayList<ResponsePartitionKey>(partitionKeys); } }
public class class_name { public ValidationData findByParamTypeAndMethodAndUrlAndNameAndParentId(ParamType paramType, String method, String url, String name, Long parentId) { if (parentId == null) { return this.findByParamTypeAndMethodAndUrlAndName(paramType, method, url, name).stream().filter(d -> d.getParentId() == null).findAny().orElse(null); } return this.findByParamTypeAndMethodAndUrlAndName(paramType, method, url, name).stream() .filter(d -> d.getParentId() != null && d.getParentId().equals(parentId)).findAny().orElse(null); } }
public class class_name { public ValidationData findByParamTypeAndMethodAndUrlAndNameAndParentId(ParamType paramType, String method, String url, String name, Long parentId) { if (parentId == null) { return this.findByParamTypeAndMethodAndUrlAndName(paramType, method, url, name).stream().filter(d -> d.getParentId() == null).findAny().orElse(null); // depends on control dependency: [if], data = [null)] } return this.findByParamTypeAndMethodAndUrlAndName(paramType, method, url, name).stream() .filter(d -> d.getParentId() != null && d.getParentId().equals(parentId)).findAny().orElse(null); } }
public class class_name { protected void shutdown() { stop(); if (webcams == null) return; // dispose all webcams Iterator<Webcam> wi = webcams.iterator(); while (wi.hasNext()) { Webcam webcam = wi.next(); webcam.dispose(); } synchronized (Webcam.class) { // clear webcams list webcams.clear(); // unassign webcams from deallocator if (Webcam.isHandleTermSignal()) { WebcamDeallocator.unstore(); } } } }
public class class_name { protected void shutdown() { stop(); if (webcams == null) return; // dispose all webcams Iterator<Webcam> wi = webcams.iterator(); while (wi.hasNext()) { Webcam webcam = wi.next(); webcam.dispose(); // depends on control dependency: [while], data = [none] } synchronized (Webcam.class) { // clear webcams list webcams.clear(); // unassign webcams from deallocator if (Webcam.isHandleTermSignal()) { WebcamDeallocator.unstore(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @SuppressWarnings("fallthrough") private void getAggregatedMetrics(List<MetricTimeRangeValue> metricValue, long startTime, long endTime, long bucketId, MetricsFilter.MetricAggregationType type, MetricGranularity granularity) { LOG.fine("getAggregatedMetrics " + startTime + " " + endTime); // per request long outterCountAvg = 0; // prepare range value long outterStartTime = Long.MAX_VALUE; long outterEndTime = 0; String outterValue = null; double outterResult = 0; Long startKey = cacheMetric.floorKey(startTime); for (Long key = startKey != null ? startKey : cacheMetric.firstKey(); key != null && key <= endTime; key = cacheMetric.higherKey(key)) { LinkedList<MetricDatapoint> bucket = cacheMetric.get(key).get(bucketId); if (bucket != null) { // per bucket long innerCountAvg = 0; // prepare range value long innerStartTime = Long.MAX_VALUE; long innerEndTime = 0; String innerValue = null; double innerResult = 0; for (MetricDatapoint datapoint : bucket) { if (datapoint.inRange(startTime, endTime)) { switch (type) { case AVG: outterCountAvg++; innerCountAvg++; case SUM: outterResult += Double.parseDouble(datapoint.getValue()); innerResult += Double.parseDouble(datapoint.getValue()); break; case LAST: if (outterEndTime < datapoint.getTimestamp()) { outterValue = datapoint.getValue(); } if (innerEndTime < datapoint.getTimestamp()) { innerValue = datapoint.getValue(); } break; case UNKNOWN: default: LOG.warning( "Unknown metric type, CacheCore does not know how to aggregate " + type); return; } outterStartTime = Math.min(outterStartTime, datapoint.getTimestamp()); outterEndTime = Math.max(outterEndTime, datapoint.getTimestamp()); innerStartTime = Math.min(innerStartTime, datapoint.getTimestamp()); innerEndTime = Math.max(innerEndTime, datapoint.getTimestamp()); } } // end bucket if (type.equals(MetricsFilter.MetricAggregationType.AVG) && innerCountAvg > 0) { innerValue = String.valueOf(innerResult / innerCountAvg); } else if (type.equals(MetricsFilter.MetricAggregationType.SUM)) { innerValue = String.valueOf(innerResult); } if (innerValue != null && granularity.equals(MetricGranularity.AGGREGATE_BY_BUCKET)) { metricValue.add(new MetricTimeRangeValue(innerStartTime, innerEndTime, innerValue)); } } } // end tree if (type.equals(MetricsFilter.MetricAggregationType.AVG) && outterCountAvg > 0) { outterValue = String.valueOf(outterResult / outterCountAvg); } else if (type.equals(MetricsFilter.MetricAggregationType.SUM)) { outterValue = String.valueOf(outterResult); } if (outterValue != null && granularity.equals(MetricGranularity.AGGREGATE_ALL_METRICS)) { metricValue.add(new MetricTimeRangeValue(outterStartTime, outterEndTime, outterValue)); } } }
public class class_name { @SuppressWarnings("fallthrough") private void getAggregatedMetrics(List<MetricTimeRangeValue> metricValue, long startTime, long endTime, long bucketId, MetricsFilter.MetricAggregationType type, MetricGranularity granularity) { LOG.fine("getAggregatedMetrics " + startTime + " " + endTime); // per request long outterCountAvg = 0; // prepare range value long outterStartTime = Long.MAX_VALUE; long outterEndTime = 0; String outterValue = null; double outterResult = 0; Long startKey = cacheMetric.floorKey(startTime); for (Long key = startKey != null ? startKey : cacheMetric.firstKey(); key != null && key <= endTime; key = cacheMetric.higherKey(key)) { LinkedList<MetricDatapoint> bucket = cacheMetric.get(key).get(bucketId); if (bucket != null) { // per bucket long innerCountAvg = 0; // prepare range value long innerStartTime = Long.MAX_VALUE; long innerEndTime = 0; String innerValue = null; double innerResult = 0; for (MetricDatapoint datapoint : bucket) { if (datapoint.inRange(startTime, endTime)) { switch (type) { case AVG: outterCountAvg++; innerCountAvg++; case SUM: outterResult += Double.parseDouble(datapoint.getValue()); innerResult += Double.parseDouble(datapoint.getValue()); break; case LAST: if (outterEndTime < datapoint.getTimestamp()) { outterValue = datapoint.getValue(); // depends on control dependency: [if], data = [none] } if (innerEndTime < datapoint.getTimestamp()) { innerValue = datapoint.getValue(); // depends on control dependency: [if], data = [none] } break; case UNKNOWN: default: LOG.warning( "Unknown metric type, CacheCore does not know how to aggregate " + type); return; } outterStartTime = Math.min(outterStartTime, datapoint.getTimestamp()); // depends on control dependency: [if], data = [none] outterEndTime = Math.max(outterEndTime, datapoint.getTimestamp()); // depends on control dependency: [if], data = [none] innerStartTime = Math.min(innerStartTime, datapoint.getTimestamp()); // depends on control dependency: [if], data = [none] innerEndTime = Math.max(innerEndTime, datapoint.getTimestamp()); // depends on control dependency: [if], data = [none] } } // end bucket if (type.equals(MetricsFilter.MetricAggregationType.AVG) && innerCountAvg > 0) { innerValue = String.valueOf(innerResult / innerCountAvg); // depends on control dependency: [if], data = [none] } else if (type.equals(MetricsFilter.MetricAggregationType.SUM)) { innerValue = String.valueOf(innerResult); // depends on control dependency: [if], data = [none] } if (innerValue != null && granularity.equals(MetricGranularity.AGGREGATE_BY_BUCKET)) { metricValue.add(new MetricTimeRangeValue(innerStartTime, innerEndTime, innerValue)); // depends on control dependency: [if], data = [none] } } } // end tree if (type.equals(MetricsFilter.MetricAggregationType.AVG) && outterCountAvg > 0) { outterValue = String.valueOf(outterResult / outterCountAvg); // depends on control dependency: [if], data = [none] } else if (type.equals(MetricsFilter.MetricAggregationType.SUM)) { outterValue = String.valueOf(outterResult); // depends on control dependency: [if], data = [none] } if (outterValue != null && granularity.equals(MetricGranularity.AGGREGATE_ALL_METRICS)) { metricValue.add(new MetricTimeRangeValue(outterStartTime, outterEndTime, outterValue)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double[][] transposeTimes(final double[][] m1, final double[][] m2) { final int rowdim1 = m1.length, coldim1 = getColumnDimensionality(m1); final int coldim2 = getColumnDimensionality(m2); assert m2.length == rowdim1 : ERR_MATRIX_INNERDIM; final double[][] re = new double[coldim1][coldim2]; final double[] Bcolj = new double[rowdim1]; for(int j = 0; j < coldim2; j++) { // Make a linear copy of column j from B for(int k = 0; k < rowdim1; k++) { Bcolj[k] = m2[k][j]; } // multiply it with each row from A for(int i = 0; i < coldim1; i++) { double s = 0; for(int k = 0; k < rowdim1; k++) { s += m1[k][i] * Bcolj[k]; } re[i][j] = s; } } return re; } }
public class class_name { public static double[][] transposeTimes(final double[][] m1, final double[][] m2) { final int rowdim1 = m1.length, coldim1 = getColumnDimensionality(m1); final int coldim2 = getColumnDimensionality(m2); assert m2.length == rowdim1 : ERR_MATRIX_INNERDIM; final double[][] re = new double[coldim1][coldim2]; final double[] Bcolj = new double[rowdim1]; for(int j = 0; j < coldim2; j++) { // Make a linear copy of column j from B for(int k = 0; k < rowdim1; k++) { Bcolj[k] = m2[k][j]; // depends on control dependency: [for], data = [k] } // multiply it with each row from A for(int i = 0; i < coldim1; i++) { double s = 0; for(int k = 0; k < rowdim1; k++) { s += m1[k][i] * Bcolj[k]; // depends on control dependency: [for], data = [k] } re[i][j] = s; // depends on control dependency: [for], data = [i] } } return re; } }
public class class_name { public List<TopicRelationship> getTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(topicRelationships); for (final TargetRelationship relationship : topicTargetRelationships) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } return relationships; } }
public class class_name { public List<TopicRelationship> getTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(topicRelationships); for (final TargetRelationship relationship : topicTargetRelationships) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); // depends on control dependency: [for], data = [relationship] } return relationships; } }
public class class_name { public static FeatureVector toFeatures(Block map) { Map<Integer, Double> features = new HashMap<>(); if (map != null) { for (int position = 0; position < map.getPositionCount(); position += 2) { features.put((int) BIGINT.getLong(map, position), DOUBLE.getDouble(map, position + 1)); } } return new FeatureVector(features); } }
public class class_name { public static FeatureVector toFeatures(Block map) { Map<Integer, Double> features = new HashMap<>(); if (map != null) { for (int position = 0; position < map.getPositionCount(); position += 2) { features.put((int) BIGINT.getLong(map, position), DOUBLE.getDouble(map, position + 1)); // depends on control dependency: [for], data = [position] } } return new FeatureVector(features); } }
public class class_name { public int getLength() { if (m_count == -1) { short count = 0; for (int n = dtm.getFirstAttribute(element); n != -1; n = dtm.getNextAttribute(n)) { ++count; } m_count = count; } return (int) m_count; } }
public class class_name { public int getLength() { if (m_count == -1) { short count = 0; for (int n = dtm.getFirstAttribute(element); n != -1; n = dtm.getNextAttribute(n)) { ++count; // depends on control dependency: [for], data = [none] } m_count = count; // depends on control dependency: [if], data = [none] } return (int) m_count; } }
public class class_name { public DateTime toDomain(Date from) { if (from == null) { return null; } return new DateTime(from.getTime()); } }
public class class_name { public DateTime toDomain(Date from) { if (from == null) { return null; // depends on control dependency: [if], data = [none] } return new DateTime(from.getTime()); } }
public class class_name { public List<InterceptorFactory> getAroundConstructInterceptors() { List<List<InterceptorFactory>> sortedItems = aroundConstructInterceptors.getSortedItems(); List<InterceptorFactory> interceptorFactories = new ArrayList<>(); for(List<InterceptorFactory> i : sortedItems) { interceptorFactories.addAll(i); } return interceptorFactories; } }
public class class_name { public List<InterceptorFactory> getAroundConstructInterceptors() { List<List<InterceptorFactory>> sortedItems = aroundConstructInterceptors.getSortedItems(); List<InterceptorFactory> interceptorFactories = new ArrayList<>(); for(List<InterceptorFactory> i : sortedItems) { interceptorFactories.addAll(i); // depends on control dependency: [for], data = [i] } return interceptorFactories; } }
public class class_name { private void addProperties(final SystemProperties config) { for(Property property : config.getProperty()) { String name = property.getName().trim(); String value = property.getValue().trim(); if(config.isOverrideProperties() || (System.getProperty(name) == null)) { System.setProperty(name, value); } } } }
public class class_name { private void addProperties(final SystemProperties config) { for(Property property : config.getProperty()) { String name = property.getName().trim(); String value = property.getValue().trim(); if(config.isOverrideProperties() || (System.getProperty(name) == null)) { System.setProperty(name, value); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @GuardedBy("evictionLock") void drainValueReferences() { if (!collectValues()) { return; } Reference<? extends V> valueRef; while ((valueRef = valueReferenceQueue().poll()) != null) { @SuppressWarnings("unchecked") InternalReference<V> ref = (InternalReference<V>) valueRef; Node<K, V> node = data.get(ref.getKeyReference()); if ((node != null) && (valueRef == node.getValueReference())) { evictEntry(node, RemovalCause.COLLECTED, 0L); } } } }
public class class_name { @GuardedBy("evictionLock") void drainValueReferences() { if (!collectValues()) { return; // depends on control dependency: [if], data = [none] } Reference<? extends V> valueRef; while ((valueRef = valueReferenceQueue().poll()) != null) { @SuppressWarnings("unchecked") InternalReference<V> ref = (InternalReference<V>) valueRef; Node<K, V> node = data.get(ref.getKeyReference()); if ((node != null) && (valueRef == node.getValueReference())) { evictEntry(node, RemovalCause.COLLECTED, 0L); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected static <E extends MTreeEntry, N extends AbstractMTreeNode<?, N, E>> double[][] computeDistanceMatrix(AbstractMTree<?, N, E, ?> tree, N node) { final int n = node.getNumEntries(); double[][] distancematrix = new double[n][n]; // Build distance matrix for(int i = 0; i < n; i++) { E ei = node.getEntry(i); double[] row_i = distancematrix[i]; for(int j = i + 1; j < n; j++) { row_i[j] = distancematrix[j][i] = tree.distance(ei, node.getEntry(j)); } } return distancematrix; } }
public class class_name { protected static <E extends MTreeEntry, N extends AbstractMTreeNode<?, N, E>> double[][] computeDistanceMatrix(AbstractMTree<?, N, E, ?> tree, N node) { final int n = node.getNumEntries(); double[][] distancematrix = new double[n][n]; // Build distance matrix for(int i = 0; i < n; i++) { E ei = node.getEntry(i); double[] row_i = distancematrix[i]; for(int j = i + 1; j < n; j++) { row_i[j] = distancematrix[j][i] = tree.distance(ei, node.getEntry(j)); // depends on control dependency: [for], data = [j] } } return distancematrix; } }
public class class_name { public static Map dotDissoc(final Map map, final String pathString) { if (pathString == null || pathString.isEmpty()) { throw new IllegalArgumentException(PATH_MUST_BE_SPECIFIED); } if (!pathString.contains(SEPARATOR)) { map.remove(pathString); return map; } final Object[] path = pathString.split(SEPARATOR_REGEX); return MapApi.dissoc(map, path); } }
public class class_name { public static Map dotDissoc(final Map map, final String pathString) { if (pathString == null || pathString.isEmpty()) { throw new IllegalArgumentException(PATH_MUST_BE_SPECIFIED); } if (!pathString.contains(SEPARATOR)) { map.remove(pathString); // depends on control dependency: [if], data = [none] return map; // depends on control dependency: [if], data = [none] } final Object[] path = pathString.split(SEPARATOR_REGEX); return MapApi.dissoc(map, path); } }
public class class_name { private boolean softEvictConnection(final PoolEntry poolEntry, final String reason, final boolean owner) { poolEntry.markEvicted(); if (owner || connectionBag.reserve(poolEntry)) { closeConnection(poolEntry, reason); return true; } return false; } }
public class class_name { private boolean softEvictConnection(final PoolEntry poolEntry, final String reason, final boolean owner) { poolEntry.markEvicted(); if (owner || connectionBag.reserve(poolEntry)) { closeConnection(poolEntry, reason); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public SyntacticCategory assignFeatures(Map<Integer, String> assignedFeatures, Map<Integer, Integer> relabeledFeatures) { String newFeatureValue = featureValue; int newFeatureVariable = featureVariable; if (assignedFeatures.containsKey(featureVariable)) { newFeatureValue = assignedFeatures.get(featureVariable); newFeatureVariable = -1; } else if (relabeledFeatures.containsKey(featureVariable)) { newFeatureVariable = relabeledFeatures.get(newFeatureVariable); } if (isAtomic()) { return SyntacticCategory.createAtomic(value, newFeatureValue, newFeatureVariable); } else { SyntacticCategory assignedReturn = returnType.assignFeatures(assignedFeatures, relabeledFeatures); SyntacticCategory assignedArgument = argumentType.assignFeatures(assignedFeatures, relabeledFeatures); return SyntacticCategory.createFunctional(direction, assignedReturn, assignedArgument, newFeatureValue, newFeatureVariable); } } }
public class class_name { public SyntacticCategory assignFeatures(Map<Integer, String> assignedFeatures, Map<Integer, Integer> relabeledFeatures) { String newFeatureValue = featureValue; int newFeatureVariable = featureVariable; if (assignedFeatures.containsKey(featureVariable)) { newFeatureValue = assignedFeatures.get(featureVariable); // depends on control dependency: [if], data = [none] newFeatureVariable = -1; // depends on control dependency: [if], data = [none] } else if (relabeledFeatures.containsKey(featureVariable)) { newFeatureVariable = relabeledFeatures.get(newFeatureVariable); // depends on control dependency: [if], data = [none] } if (isAtomic()) { return SyntacticCategory.createAtomic(value, newFeatureValue, newFeatureVariable); // depends on control dependency: [if], data = [none] } else { SyntacticCategory assignedReturn = returnType.assignFeatures(assignedFeatures, relabeledFeatures); SyntacticCategory assignedArgument = argumentType.assignFeatures(assignedFeatures, relabeledFeatures); return SyntacticCategory.createFunctional(direction, assignedReturn, assignedArgument, newFeatureValue, newFeatureVariable); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected <T> T doExecute(URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor) throws RestClientException { Assert.notNull(url, "'url' must not be null"); Assert.notNull(method, "'method' must not be null"); ClientHttpResponse response = null; try { ClientHttpRequest request = createRequest(url, method); if (requestCallback != null) { requestCallback.doWithRequest(request); } response = request.execute(); if (!getErrorHandler().hasError(response)) { logResponseStatus(method, url, response); } else { handleResponseError(method, url, response); } if (responseExtractor != null) { return responseExtractor.extractData(response); } else { return null; } } catch (IOException ex) { throw new ResourceAccessException("I/O error on " + method.name() + " request for \"" + url + "\": " + ex.getMessage(), ex); } finally { if (response != null) { response.close(); } } } }
public class class_name { protected <T> T doExecute(URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor<T> responseExtractor) throws RestClientException { Assert.notNull(url, "'url' must not be null"); Assert.notNull(method, "'method' must not be null"); ClientHttpResponse response = null; try { ClientHttpRequest request = createRequest(url, method); if (requestCallback != null) { requestCallback.doWithRequest(request); // depends on control dependency: [if], data = [none] } response = request.execute(); if (!getErrorHandler().hasError(response)) { logResponseStatus(method, url, response); // depends on control dependency: [if], data = [none] } else { handleResponseError(method, url, response); // depends on control dependency: [if], data = [none] } if (responseExtractor != null) { return responseExtractor.extractData(response); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } catch (IOException ex) { throw new ResourceAccessException("I/O error on " + method.name() + " request for \"" + url + "\": " + ex.getMessage(), ex); } finally { if (response != null) { response.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void checkForStall(long currentTime) { long delta = currentTime - _lastMonitoringStep; if (delta < _shortestObservedDelta) { _shortestObservedDelta = delta; } long stall = Math.max(0, delta - _shortestObservedDelta); if (stall > _minStallNano) { _stalls.put(_lastMonitoringStep, stall); if (_stalls.size() > _stallsHistorySize) { _stalls.pollFirstEntry(); } } } }
public class class_name { private void checkForStall(long currentTime) { long delta = currentTime - _lastMonitoringStep; if (delta < _shortestObservedDelta) { _shortestObservedDelta = delta; // depends on control dependency: [if], data = [none] } long stall = Math.max(0, delta - _shortestObservedDelta); if (stall > _minStallNano) { _stalls.put(_lastMonitoringStep, stall); // depends on control dependency: [if], data = [none] if (_stalls.size() > _stallsHistorySize) { _stalls.pollFirstEntry(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void rotateShiftAtoms(Atom[] ca){ for (int i = 0 ; i < ca.length; i++){ Atom c = ca[i]; Calc.rotate(c,currentRotMatrix); Calc.shift(c,currentTranMatrix); //System.out.println("after " + c); ca[i] = c; } //System.out.println("after " + ca[0]); } }
public class class_name { private void rotateShiftAtoms(Atom[] ca){ for (int i = 0 ; i < ca.length; i++){ Atom c = ca[i]; Calc.rotate(c,currentRotMatrix); // depends on control dependency: [for], data = [none] Calc.shift(c,currentTranMatrix); // depends on control dependency: [for], data = [none] //System.out.println("after " + c); ca[i] = c; // depends on control dependency: [for], data = [i] } //System.out.println("after " + ca[0]); } }
public class class_name { private String getAdditionalIncludeDirectories(final String baseDir, final CommandLineCompilerConfiguration compilerConfig) { final File[] includePath = compilerConfig.getIncludePath(); final StringBuffer includeDirs = new StringBuffer(); // Darren Sargent Feb 10 2010 -- reverted to older code to ensure sys // includes get, erm, included final String[] args = compilerConfig.getPreArguments(); for (final String arg : args) { if (arg.startsWith("/I")) { includeDirs.append(arg.substring(2)); includeDirs.append(';'); } } // end Darren if (includeDirs.length() > 0) { includeDirs.setLength(includeDirs.length() - 1); } return includeDirs.toString(); } }
public class class_name { private String getAdditionalIncludeDirectories(final String baseDir, final CommandLineCompilerConfiguration compilerConfig) { final File[] includePath = compilerConfig.getIncludePath(); final StringBuffer includeDirs = new StringBuffer(); // Darren Sargent Feb 10 2010 -- reverted to older code to ensure sys // includes get, erm, included final String[] args = compilerConfig.getPreArguments(); for (final String arg : args) { if (arg.startsWith("/I")) { includeDirs.append(arg.substring(2)); // depends on control dependency: [if], data = [none] includeDirs.append(';'); // depends on control dependency: [if], data = [none] } } // end Darren if (includeDirs.length() > 0) { includeDirs.setLength(includeDirs.length() - 1); // depends on control dependency: [if], data = [(includeDirs.length()] } return includeDirs.toString(); } }
public class class_name { @Override public final boolean hasNext() { resetToLastKey(); // a predicate has to evaluate to true only once. if (mIsFirst) { mIsFirst = false; if (mPredicate.hasNext()) { if (isBooleanFalse()) { resetToStartKey(); return false; } // reset is needed, because a predicate works more like a // filter. It // does // not change the current transaction. resetToLastKey(); return true; } } resetToStartKey(); return false; } }
public class class_name { @Override public final boolean hasNext() { resetToLastKey(); // a predicate has to evaluate to true only once. if (mIsFirst) { mIsFirst = false; // depends on control dependency: [if], data = [none] if (mPredicate.hasNext()) { if (isBooleanFalse()) { resetToStartKey(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } // reset is needed, because a predicate works more like a // filter. It // does // not change the current transaction. resetToLastKey(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } resetToStartKey(); return false; } }
public class class_name { protected void setDataProvider(DataProvider provider) { if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig() .applicationSession() .removePropertyChangeListener(ApplicationSession.USER, this); } this.dataProvider = provider; if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig().applicationSession().addPropertyChangeListener( ApplicationSession.USER, this); } } }
public class class_name { protected void setDataProvider(DataProvider provider) { if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig() .applicationSession() .removePropertyChangeListener(ApplicationSession.USER, this); // depends on control dependency: [if], data = [none] } this.dataProvider = provider; if ((this.dataProvider != null) && (this.dataProvider.getRefreshPolicy() == DataProvider.RefreshPolicy.ON_USER_SWITCH)) { getApplicationConfig().applicationSession().addPropertyChangeListener( ApplicationSession.USER, this); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String urlquote(String text) { try { return URLEncoder.encode(text, "UTF-8").replace("+", "%20"); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } }
public class class_name { public static String urlquote(String text) { try { return URLEncoder.encode(text, "UTF-8").replace("+", "%20"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static BufferedImage rotate(BufferedImage image, int degree) { int iw = image.getWidth();// 原始图象的宽度 int ih = image.getHeight();// 原始图象的高度 int w = 0; int h = 0; int x = 0; int y = 0; degree = degree % 360; if (degree < 0) degree = 360 + degree;// 将角度转换到0-360度之间 double ang = degree * 0.0174532925;// 将角度转为弧度 /** * 确定旋转后的图象的高度和宽度 */ if (degree == 180 || degree == 0 || degree == 360) { w = iw; h = ih; } else if (degree == 90 || degree == 270) { w = ih; h = iw; } else { int d = iw + ih; w = (int) (d * Math.abs(Math.cos(ang))); h = (int) (d * Math.abs(Math.sin(ang))); } x = (w / 2) - (iw / 2);// 确定原点坐标 y = (h / 2) - (ih / 2); BufferedImage rotatedImage = new BufferedImage(w, h, image.getType()); Graphics2D gs = rotatedImage.createGraphics(); gs.fillRect(0, 0, w, h);// 以给定颜色绘制旋转后图片的背景 AffineTransform at = new AffineTransform(); at.rotate(ang, w / 2, h / 2);// 旋转图象 at.translate(x, y); AffineTransformOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); op.filter(image, rotatedImage); image = rotatedImage; return image; } }
public class class_name { public static BufferedImage rotate(BufferedImage image, int degree) { int iw = image.getWidth();// 原始图象的宽度 int ih = image.getHeight();// 原始图象的高度 int w = 0; int h = 0; int x = 0; int y = 0; degree = degree % 360; if (degree < 0) degree = 360 + degree;// 将角度转换到0-360度之间 double ang = degree * 0.0174532925;// 将角度转为弧度 /** * 确定旋转后的图象的高度和宽度 */ if (degree == 180 || degree == 0 || degree == 360) { w = iw; // depends on control dependency: [if], data = [none] h = ih; // depends on control dependency: [if], data = [none] } else if (degree == 90 || degree == 270) { w = ih; // depends on control dependency: [if], data = [none] h = iw; // depends on control dependency: [if], data = [none] } else { int d = iw + ih; w = (int) (d * Math.abs(Math.cos(ang))); // depends on control dependency: [if], data = [none] h = (int) (d * Math.abs(Math.sin(ang))); // depends on control dependency: [if], data = [none] } x = (w / 2) - (iw / 2);// 确定原点坐标 y = (h / 2) - (ih / 2); BufferedImage rotatedImage = new BufferedImage(w, h, image.getType()); Graphics2D gs = rotatedImage.createGraphics(); gs.fillRect(0, 0, w, h);// 以给定颜色绘制旋转后图片的背景 AffineTransform at = new AffineTransform(); at.rotate(ang, w / 2, h / 2);// 旋转图象 at.translate(x, y); AffineTransformOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); op.filter(image, rotatedImage); image = rotatedImage; return image; } }
public class class_name { public void initMultiCountMetrics(PhysicalPlanHelper helper) { // For spout, we would consider the output stream List<TopologyAPI.OutputStream> outputs = helper.getMySpout().getOutputsList(); for (TopologyAPI.OutputStream outputStream : outputs) { String streamId = outputStream.getStream().getId(); ackCount.scope(streamId); failCount.scope(streamId); timeoutCount.scope(streamId); emitCount.scope(streamId); } } }
public class class_name { public void initMultiCountMetrics(PhysicalPlanHelper helper) { // For spout, we would consider the output stream List<TopologyAPI.OutputStream> outputs = helper.getMySpout().getOutputsList(); for (TopologyAPI.OutputStream outputStream : outputs) { String streamId = outputStream.getStream().getId(); ackCount.scope(streamId); // depends on control dependency: [for], data = [none] failCount.scope(streamId); // depends on control dependency: [for], data = [none] timeoutCount.scope(streamId); // depends on control dependency: [for], data = [none] emitCount.scope(streamId); // depends on control dependency: [for], data = [none] } } }
public class class_name { private void initialise() throws EFapsException { final AbstractCommand command = getCommand(); if (command == null) { setShowCheckBoxes(false); } else { // set target table if (command.getTargetTable() != null) { setTableUUID(command.getTargetTable().getUUID()); if (Context.getThreadContext().containsSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER))) { @SuppressWarnings("unchecked") final Map<String, TableFilter> sessfilter = (Map<String, TableFilter>) Context.getThreadContext() .getSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER)); for (final Field field : command.getTargetTable().getFields()) { if (sessfilter.containsKey(field.getName())) { final TableFilter filter = sessfilter.get(field.getName()); filter.setHeaderFieldId(field.getId()); this.filters.put(field.getName(), filter); } } } else { // add the filter here, if it is a required filter or a default value is set, that must be // applied against the database for (final Field field : command.getTargetTable().getFields()) { if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance()) && (field.getFilter().isRequired() || field.getFilter().getDefaultValue() != null && !field.getFilter().getDefaultValue().isEmpty()) && field.getFilter().getBase().equals(FilterBase.DATABASE)) { this.filters.put(field.getName(), new TableFilter(field.getId())); } } } } // set default sort if (command.getTargetTableSortKey() != null) { setSortKeyInternal(command.getTargetTableSortKey()); setSortDirection(command.getTargetTableSortDirection()); } setEnforceSorted("true".equalsIgnoreCase(command.getProperty("TargetEnforceSorted"))); setShowCheckBoxes(command.isTargetShowCheckBoxes()); // get the User specific Attributes if exist overwrite the defaults try { if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.SORTKEY))) { setSortKeyInternal(Context.getThreadContext().getUserAttribute( getCacheKey(UITable.UserCacheKey.SORTKEY))); } if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.SORTDIRECTION))) { setSortDirection(SortDirection.getEnum(Context.getThreadContext() .getUserAttribute(getCacheKey(UITable.UserCacheKey.SORTDIRECTION)))); } } catch (final EFapsException e) { // we don't throw an error because this are only Usersettings UITable.LOG.error("error during the retrieve of UserAttributes", e); } } } }
public class class_name { private void initialise() throws EFapsException { final AbstractCommand command = getCommand(); if (command == null) { setShowCheckBoxes(false); } else { // set target table if (command.getTargetTable() != null) { setTableUUID(command.getTargetTable().getUUID()); // depends on control dependency: [if], data = [(command.getTargetTable()] if (Context.getThreadContext().containsSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER))) { @SuppressWarnings("unchecked") final Map<String, TableFilter> sessfilter = (Map<String, TableFilter>) Context.getThreadContext() .getSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER)); for (final Field field : command.getTargetTable().getFields()) { if (sessfilter.containsKey(field.getName())) { final TableFilter filter = sessfilter.get(field.getName()); filter.setHeaderFieldId(field.getId()); // depends on control dependency: [if], data = [none] this.filters.put(field.getName(), filter); // depends on control dependency: [if], data = [none] } } } else { // add the filter here, if it is a required filter or a default value is set, that must be // applied against the database for (final Field field : command.getTargetTable().getFields()) { if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance()) && (field.getFilter().isRequired() || field.getFilter().getDefaultValue() != null && !field.getFilter().getDefaultValue().isEmpty()) && field.getFilter().getBase().equals(FilterBase.DATABASE)) { this.filters.put(field.getName(), new TableFilter(field.getId())); // depends on control dependency: [if], data = [none] } } } } // set default sort if (command.getTargetTableSortKey() != null) { setSortKeyInternal(command.getTargetTableSortKey()); // depends on control dependency: [if], data = [(command.getTargetTableSortKey()] setSortDirection(command.getTargetTableSortDirection()); // depends on control dependency: [if], data = [none] } setEnforceSorted("true".equalsIgnoreCase(command.getProperty("TargetEnforceSorted"))); setShowCheckBoxes(command.isTargetShowCheckBoxes()); // get the User specific Attributes if exist overwrite the defaults try { if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.SORTKEY))) { setSortKeyInternal(Context.getThreadContext().getUserAttribute( getCacheKey(UITable.UserCacheKey.SORTKEY))); // depends on control dependency: [if], data = [none] } if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.SORTDIRECTION))) { setSortDirection(SortDirection.getEnum(Context.getThreadContext() .getUserAttribute(getCacheKey(UITable.UserCacheKey.SORTDIRECTION)))); // depends on control dependency: [if], data = [none] } } catch (final EFapsException e) { // we don't throw an error because this are only Usersettings UITable.LOG.error("error during the retrieve of UserAttributes", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public RestHandlerBuilder addRequestFilter(ContainerRequestFilter filter) { if (filter.getClass().getDeclaredAnnotation(PreMatching.class) != null) { this.preMatchRequestFilters.add(filter); } else { this.requestFilters.add(filter); } return this; } }
public class class_name { public RestHandlerBuilder addRequestFilter(ContainerRequestFilter filter) { if (filter.getClass().getDeclaredAnnotation(PreMatching.class) != null) { this.preMatchRequestFilters.add(filter); // depends on control dependency: [if], data = [none] } else { this.requestFilters.add(filter); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private void registerOperandSubQueries( SqlValidatorScope parentScope, SqlCall call, int operandOrdinal) { SqlNode operand = call.operand(operandOrdinal); if (operand == null) { return; } if (operand.getKind().belongsTo(SqlKind.QUERY) && call.getOperator().argumentMustBeScalar(operandOrdinal)) { operand = SqlStdOperatorTable.SCALAR_QUERY.createCall( operand.getParserPosition(), operand); call.setOperand(operandOrdinal, operand); } registerSubQueries(parentScope, operand); } }
public class class_name { private void registerOperandSubQueries( SqlValidatorScope parentScope, SqlCall call, int operandOrdinal) { SqlNode operand = call.operand(operandOrdinal); if (operand == null) { return; // depends on control dependency: [if], data = [none] } if (operand.getKind().belongsTo(SqlKind.QUERY) && call.getOperator().argumentMustBeScalar(operandOrdinal)) { operand = SqlStdOperatorTable.SCALAR_QUERY.createCall( operand.getParserPosition(), operand); // depends on control dependency: [if], data = [none] call.setOperand(operandOrdinal, operand); // depends on control dependency: [if], data = [none] } registerSubQueries(parentScope, operand); } }
public class class_name { private void initPlayer(Context ctx) { mMediaPlayer = new MediaPlayer(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mMediaPlayer.setDataSource(ctx, mUri); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } try { mMediaPlayer.prepare(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } mMediaPlayer.setOnCompletionListener(mOnCompletion); } }
public class class_name { private void initPlayer(Context ctx) { mMediaPlayer = new MediaPlayer(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mMediaPlayer.setDataSource(ctx, mUri); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } catch (IllegalStateException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } catch (IOException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } catch (Exception e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } // depends on control dependency: [catch], data = [none] try { mMediaPlayer.prepare(); // depends on control dependency: [try], data = [none] } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } catch (Exception e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } // depends on control dependency: [catch], data = [none] mMediaPlayer.setOnCompletionListener(mOnCompletion); } }
public class class_name { private List<ENTITY> getByComplexKeys(Collection<KEY> ids) { List<ENTITY> entities = new ArrayList<ENTITY>(ids.size()); for (KEY key : ids) { List<Match> matches = queryGenerator.getKeyMatches(key); entities.addAll(find(matches.toArray(new Match[matches.size()]))); } return entities; } }
public class class_name { private List<ENTITY> getByComplexKeys(Collection<KEY> ids) { List<ENTITY> entities = new ArrayList<ENTITY>(ids.size()); for (KEY key : ids) { List<Match> matches = queryGenerator.getKeyMatches(key); entities.addAll(find(matches.toArray(new Match[matches.size()]))); // depends on control dependency: [for], data = [none] } return entities; } }
public class class_name { private static List<Validate> createManagedConnectionFactory(Connector cmd, List<Failure> failures, ResourceBundle rb, ClassLoader cl) { List<Validate> result = new ArrayList<Validate>(); if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter().getConnectionDefinitions() != null) { List<ConnectionDefinition> cdMetas = cmd.getResourceadapter() .getOutboundResourceadapter().getConnectionDefinitions(); if (!cdMetas.isEmpty()) { for (ConnectionDefinition cdMeta : cdMetas) { if (cdMeta.getManagedConnectionFactoryClass() != null) { try { Class<?> clazz = Class.forName(cdMeta.getManagedConnectionFactoryClass().getValue(), true, cl); List<ConfigProperty> configProperties = cdMeta.getConfigProperties(); ValidateClass vc = new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, clazz, configProperties); result.add(vc); } catch (ClassNotFoundException | NoClassDefFoundError e) { Failure failure = new Failure(Severity.ERROR, rb.getString("uncategorized"), rb.getString("mcf.cnfe"), e.getMessage()); failures.add(failure); } } } } } return result; } }
public class class_name { private static List<Validate> createManagedConnectionFactory(Connector cmd, List<Failure> failures, ResourceBundle rb, ClassLoader cl) { List<Validate> result = new ArrayList<Validate>(); if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter().getConnectionDefinitions() != null) { List<ConnectionDefinition> cdMetas = cmd.getResourceadapter() .getOutboundResourceadapter().getConnectionDefinitions(); if (!cdMetas.isEmpty()) { for (ConnectionDefinition cdMeta : cdMetas) { if (cdMeta.getManagedConnectionFactoryClass() != null) { try { Class<?> clazz = Class.forName(cdMeta.getManagedConnectionFactoryClass().getValue(), true, cl); List<ConfigProperty> configProperties = cdMeta.getConfigProperties(); ValidateClass vc = new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, clazz, configProperties); result.add(vc); } catch (ClassNotFoundException | NoClassDefFoundError e) { Failure failure = new Failure(Severity.ERROR, rb.getString("uncategorized"), rb.getString("mcf.cnfe"), e.getMessage()); failures.add(failure); } } } } } return result; // depends on control dependency: [if], data = [none] } }
public class class_name { static void collectAllExpressions(HsqlList set, Expression e, OrderedIntHashSet typeSet, OrderedIntHashSet stopAtTypeSet) { if (e == null) { return; } if (stopAtTypeSet.contains(e.opType)) { return; } for (int i = 0; i < e.nodes.length; i++) { collectAllExpressions(set, e.nodes[i], typeSet, stopAtTypeSet); } if (typeSet.contains(e.opType)) { set.add(e); } if (e.subQuery != null && e.subQuery.queryExpression != null) { e.subQuery.queryExpression.collectAllExpressions(set, typeSet, stopAtTypeSet); } } }
public class class_name { static void collectAllExpressions(HsqlList set, Expression e, OrderedIntHashSet typeSet, OrderedIntHashSet stopAtTypeSet) { if (e == null) { return; // depends on control dependency: [if], data = [none] } if (stopAtTypeSet.contains(e.opType)) { return; // depends on control dependency: [if], data = [none] } for (int i = 0; i < e.nodes.length; i++) { collectAllExpressions(set, e.nodes[i], typeSet, stopAtTypeSet); // depends on control dependency: [for], data = [i] } if (typeSet.contains(e.opType)) { set.add(e); // depends on control dependency: [if], data = [none] } if (e.subQuery != null && e.subQuery.queryExpression != null) { e.subQuery.queryExpression.collectAllExpressions(set, typeSet, stopAtTypeSet); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isNotVisited(int loc) { if (checkBounds(loc)) { return (ZERO == this.registry[loc]); } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); } } }
public class class_name { public boolean isNotVisited(int loc) { if (checkBounds(loc)) { return (ZERO == this.registry[loc]); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException( "The location " + loc + " out of bounds [0," + (this.registry.length - 1) + "]"); } } }
public class class_name { private void CheckYCbCr(IfdTags metadata, int n) { // Samples per pixel if (!metadata.containsTagId(TiffTags.getTagId("SamplesPerPixel"))) { validation.addErrorLoc("Missing Samples Per Pixel", "IFD" + n); } else { long spp = metadata.get(TiffTags.getTagId("SamplesPerPixel")).getFirstNumericValue(); if (spp != 3) { validation.addError("Invalid Samples Per Pixel", "IFD" + n, spp); } } // BitsPerSample if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) { validation.addErrorLoc("Missing BitsPerSample", "IFD" + n); } else { for (abstractTiffType vi : metadata.get(TiffTags.getTagId("BitsPerSample")).getValue()) { if (vi.toInt() != 8) { validation.addError("Invalid BitsPerSample", "IFD" + n, vi.toInt()); break; } } } // Compression // long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 5 && comp != 6) // validation.addError("Invalid Compression", comp); // if (!metadata.containsTagId(TiffTags.getTagId("ReferenceBlackWhite"))) // validation.addError("Missing ReferenceBlackWhite"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrCoefficients"))) // validation.addError("Missing YCbCr Coefficients"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrSubSampling"))) // validation.addError("Missing YCbCr SubSampling"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrPositioning"))) // validation.addError("Missing YCbCr Positioning"); } }
public class class_name { private void CheckYCbCr(IfdTags metadata, int n) { // Samples per pixel if (!metadata.containsTagId(TiffTags.getTagId("SamplesPerPixel"))) { validation.addErrorLoc("Missing Samples Per Pixel", "IFD" + n); // depends on control dependency: [if], data = [none] } else { long spp = metadata.get(TiffTags.getTagId("SamplesPerPixel")).getFirstNumericValue(); if (spp != 3) { validation.addError("Invalid Samples Per Pixel", "IFD" + n, spp); // depends on control dependency: [if], data = [none] } } // BitsPerSample if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) { validation.addErrorLoc("Missing BitsPerSample", "IFD" + n); // depends on control dependency: [if], data = [none] } else { for (abstractTiffType vi : metadata.get(TiffTags.getTagId("BitsPerSample")).getValue()) { if (vi.toInt() != 8) { validation.addError("Invalid BitsPerSample", "IFD" + n, vi.toInt()); // depends on control dependency: [if], data = [none] break; } } } // Compression // long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 5 && comp != 6) // validation.addError("Invalid Compression", comp); // if (!metadata.containsTagId(TiffTags.getTagId("ReferenceBlackWhite"))) // validation.addError("Missing ReferenceBlackWhite"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrCoefficients"))) // validation.addError("Missing YCbCr Coefficients"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrSubSampling"))) // validation.addError("Missing YCbCr SubSampling"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrPositioning"))) // validation.addError("Missing YCbCr Positioning"); } }
public class class_name { public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) { Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState); if (dstCompliant == null) { return null; } return dstCompliant.get(srcState); } }
public class class_name { public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) { Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState); if (dstCompliant == null) { return null; // depends on control dependency: [if], data = [none] } return dstCompliant.get(srcState); } }
public class class_name { public void setNiceName(String value) { checkFrozen(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_niceName = getName(); } else { m_niceName = value.trim(); } } }
public class class_name { public void setNiceName(String value) { checkFrozen(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_niceName = getName(); // depends on control dependency: [if], data = [none] } else { m_niceName = value.trim(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ColumnConfig setValueNumeric(String valueNumeric) { if ((valueNumeric == null) || "null".equalsIgnoreCase(valueNumeric)) { this.valueNumeric = null; } else { String saved = valueNumeric; if (valueNumeric.startsWith("(")) { valueNumeric = valueNumeric.replaceFirst("^\\(", ""); valueNumeric = valueNumeric.replaceFirst("\\)$", ""); } try { this.valueNumeric = ValueNumeric.of(Locale.US, valueNumeric); } catch (ParseException e) { this.valueComputed = new DatabaseFunction(saved); } } return this; } }
public class class_name { public ColumnConfig setValueNumeric(String valueNumeric) { if ((valueNumeric == null) || "null".equalsIgnoreCase(valueNumeric)) { this.valueNumeric = null; // depends on control dependency: [if], data = [none] } else { String saved = valueNumeric; if (valueNumeric.startsWith("(")) { valueNumeric = valueNumeric.replaceFirst("^\\(", ""); // depends on control dependency: [if], data = [none] valueNumeric = valueNumeric.replaceFirst("\\)$", ""); // depends on control dependency: [if], data = [none] } try { this.valueNumeric = ValueNumeric.of(Locale.US, valueNumeric); // depends on control dependency: [try], data = [none] } catch (ParseException e) { this.valueComputed = new DatabaseFunction(saved); } // depends on control dependency: [catch], data = [none] } return this; } }
public class class_name { public synchronized void addHandler(Class iface, Object handler) { try { iface.cast(handler); } catch (Exception e) { throw new IllegalArgumentException("Handler: " + handler.getClass().getName() + " does not implement: " + iface.getName()); } if (contract.getInterfaces().get(iface.getSimpleName()) == null) { throw new IllegalArgumentException("Interface: " + iface.getName() + " is not a part of this Contract"); } if (contract.getPackage() == null) { setContractPackage(iface); } handlers.put(iface.getSimpleName(), handler); } }
public class class_name { public synchronized void addHandler(Class iface, Object handler) { try { iface.cast(handler); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalArgumentException("Handler: " + handler.getClass().getName() + " does not implement: " + iface.getName()); } // depends on control dependency: [catch], data = [none] if (contract.getInterfaces().get(iface.getSimpleName()) == null) { throw new IllegalArgumentException("Interface: " + iface.getName() + " is not a part of this Contract"); } if (contract.getPackage() == null) { setContractPackage(iface); // depends on control dependency: [if], data = [none] } handlers.put(iface.getSimpleName(), handler); } }
public class class_name { public String convert(String string, Locale locale) { if ((string == null) || (string.isEmpty())) { return string; } // fast and simple cases first... if ((!hasWordSeparator()) && (this.wordStartCase == this.otherCase)) { String s = string; if (this.wordSeparator == null) { s = removeSpecialCharacters(s); } if (this.firstCase == this.wordStartCase) { s = this.firstCase.convert(s, locale); } else { String first = this.firstCase.convert(s.substring(0, 1), locale); String rest = this.otherCase.convert(s.substring(1), locale); s = first + rest; } return s; } CharIterator charIterator = new SequenceCharIterator(string); StringBuilder buffer = new StringBuilder(string.length() + 4); char c = charIterator.next(); CharClass previousClass = CharClass.of(c); while (previousClass.isSeparatorOrDollar()) { if ((buffer.length() == 0) && hasWordSeparator()) { buffer.append(this.wordSeparator); } if (!charIterator.hasNext()) { return buffer.toString(); } c = charIterator.next(); previousClass = CharClass.of(c); } appendCasedChar(buffer, c, this.firstCase); CaseConversion previousCase = CaseConversion.ofExample(c, false); int start = 1; int end = start; while (charIterator.hasNext()) { c = charIterator.next(); CharClass currentClass = CharClass.of(c); CaseConversion currentCase = CaseConversion.ofExample(c, false); switch (currentClass) { case LETTER: if (previousClass.isSeparatorOrDollar()) { appendCasedChar(buffer, c, this.wordStartCase); start++; } else if (currentCase != previousCase) { if ((currentCase == CaseConversion.UPPER_CASE) && (end > 1)) { assert (previousCase == CaseConversion.LOWER_CASE); start = appendOthers(string, buffer, start, end); if (hasWordSeparator()) { buffer.append(this.wordSeparator); } appendCasedChar(buffer, c, this.wordStartCase); } } break; case SEPARATOR: case DOLLAR: if (!previousClass.isSeparatorOrDollar()) { start = appendOthers(string, buffer, start, end); if (KEEP_SPECIAL_CHARS.equals(this.wordSeparator)) { buffer.append(c); } else if (this.wordSeparator != null) { buffer.append(this.wordSeparator); } } else { start++; } break; default : break; } if (currentClass != CharClass.DIGIT) { previousClass = currentClass; previousCase = currentCase; } end++; } if (start < end) { appendOthers(string, buffer, start, end); } return buffer.toString(); } }
public class class_name { public String convert(String string, Locale locale) { if ((string == null) || (string.isEmpty())) { return string; // depends on control dependency: [if], data = [none] } // fast and simple cases first... if ((!hasWordSeparator()) && (this.wordStartCase == this.otherCase)) { String s = string; if (this.wordSeparator == null) { s = removeSpecialCharacters(s); // depends on control dependency: [if], data = [none] } if (this.firstCase == this.wordStartCase) { s = this.firstCase.convert(s, locale); // depends on control dependency: [if], data = [none] } else { String first = this.firstCase.convert(s.substring(0, 1), locale); String rest = this.otherCase.convert(s.substring(1), locale); s = first + rest; // depends on control dependency: [if], data = [none] } return s; // depends on control dependency: [if], data = [none] } CharIterator charIterator = new SequenceCharIterator(string); StringBuilder buffer = new StringBuilder(string.length() + 4); char c = charIterator.next(); CharClass previousClass = CharClass.of(c); while (previousClass.isSeparatorOrDollar()) { if ((buffer.length() == 0) && hasWordSeparator()) { buffer.append(this.wordSeparator); // depends on control dependency: [if], data = [none] } if (!charIterator.hasNext()) { return buffer.toString(); // depends on control dependency: [if], data = [none] } c = charIterator.next(); // depends on control dependency: [while], data = [none] previousClass = CharClass.of(c); // depends on control dependency: [while], data = [none] } appendCasedChar(buffer, c, this.firstCase); CaseConversion previousCase = CaseConversion.ofExample(c, false); int start = 1; int end = start; while (charIterator.hasNext()) { c = charIterator.next(); // depends on control dependency: [while], data = [none] CharClass currentClass = CharClass.of(c); CaseConversion currentCase = CaseConversion.ofExample(c, false); switch (currentClass) { case LETTER: if (previousClass.isSeparatorOrDollar()) { appendCasedChar(buffer, c, this.wordStartCase); // depends on control dependency: [if], data = [none] start++; // depends on control dependency: [if], data = [none] } else if (currentCase != previousCase) { if ((currentCase == CaseConversion.UPPER_CASE) && (end > 1)) { assert (previousCase == CaseConversion.LOWER_CASE); // depends on control dependency: [if], data = [none] start = appendOthers(string, buffer, start, end); // depends on control dependency: [if], data = [none] if (hasWordSeparator()) { buffer.append(this.wordSeparator); // depends on control dependency: [if], data = [none] } appendCasedChar(buffer, c, this.wordStartCase); // depends on control dependency: [if], data = [none] } } break; case SEPARATOR: case DOLLAR: if (!previousClass.isSeparatorOrDollar()) { start = appendOthers(string, buffer, start, end); // depends on control dependency: [if], data = [none] if (KEEP_SPECIAL_CHARS.equals(this.wordSeparator)) { buffer.append(c); // depends on control dependency: [if], data = [none] } else if (this.wordSeparator != null) { buffer.append(this.wordSeparator); // depends on control dependency: [if], data = [(this.wordSeparator] } } else { start++; // depends on control dependency: [if], data = [none] } break; default : break; } if (currentClass != CharClass.DIGIT) { previousClass = currentClass; // depends on control dependency: [if], data = [none] previousCase = currentCase; // depends on control dependency: [if], data = [none] } end++; // depends on control dependency: [while], data = [none] } if (start < end) { appendOthers(string, buffer, start, end); // depends on control dependency: [if], data = [end)] } return buffer.toString(); } }
public class class_name { @Override public void removeExpired() { if (timeToExpire == 0 || !(map instanceof LinkedHashMap)) return; final long now = System.currentTimeMillis(); final long duration = timeToExpire * 1000L; CacheObject o = null; synchronized (this) { for (final Iterator<CacheObject> i = map.values().iterator(); i.hasNext();) { o = i.next(); if (now >= o.getTimestamp() + duration) { i.remove(); notifyRemoved(o); } else break; } } } }
public class class_name { @Override public void removeExpired() { if (timeToExpire == 0 || !(map instanceof LinkedHashMap)) return; final long now = System.currentTimeMillis(); final long duration = timeToExpire * 1000L; CacheObject o = null; synchronized (this) { for (final Iterator<CacheObject> i = map.values().iterator(); i.hasNext();) { o = i.next(); // depends on control dependency: [for], data = [i] if (now >= o.getTimestamp() + duration) { i.remove(); // depends on control dependency: [if], data = [none] notifyRemoved(o); // depends on control dependency: [if], data = [none] } else break; } } } }
public class class_name { protected final String render(final LogEntry logEntry) { if (builder == null) { StringBuilder builder = new StringBuilder(BUILDER_CAPACITY); token.render(logEntry, builder); return builder.toString(); } else { builder.setLength(0); token.render(logEntry, builder); return builder.toString(); } } }
public class class_name { protected final String render(final LogEntry logEntry) { if (builder == null) { StringBuilder builder = new StringBuilder(BUILDER_CAPACITY); token.render(logEntry, builder); // depends on control dependency: [if], data = [none] return builder.toString(); // depends on control dependency: [if], data = [none] } else { builder.setLength(0); // depends on control dependency: [if], data = [none] token.render(logEntry, builder); // depends on control dependency: [if], data = [none] return builder.toString(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int[] getParameterRegisters(Method obj) { Type[] argTypes = obj.getArgumentTypes(); int[] regs = new int[argTypes.length]; int curReg = obj.isStatic() ? 0 : 1; for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); regs[t] = curReg; curReg += SignatureUtils.getSignatureSize(sig); } return regs; } }
public class class_name { public static int[] getParameterRegisters(Method obj) { Type[] argTypes = obj.getArgumentTypes(); int[] regs = new int[argTypes.length]; int curReg = obj.isStatic() ? 0 : 1; for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); regs[t] = curReg; // depends on control dependency: [for], data = [t] curReg += SignatureUtils.getSignatureSize(sig); // depends on control dependency: [for], data = [none] } return regs; } }
public class class_name { private void init(final ZonedDateTime TIME) { time = new ObjectPropertyBase<ZonedDateTime>(TIME) { @Override protected void invalidated() { if (!isRunning() && isAnimated()) { long animationDuration = getAnimationDuration(); timeline.stop(); final KeyValue KEY_VALUE = new KeyValue(currentTime, TIME.toEpochSecond()); final KeyFrame KEY_FRAME = new KeyFrame(javafx.util.Duration.millis(animationDuration), KEY_VALUE); timeline.getKeyFrames().setAll(KEY_FRAME); timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT)); timeline.play(); } else { currentTime.set(TIME.toEpochSecond()); fireUpdateEvent(FINISHED_EVENT); } } @Override public Object getBean() { return Clock.this; } @Override public String getName() { return "time"; } }; currentTime = new LongPropertyBase(time.get().toEpochSecond()) { @Override protected void invalidated() {} @Override public Object getBean() { return Clock.this; } @Override public String getName() { return "currentTime"; } }; zoneId = time.get().getZone(); timeline = new Timeline(); timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT)); updateInterval = LONG_INTERVAL; _checkSectionsForValue = false; _checkAreasForValue = false; sections = FXCollections.observableArrayList(); _secondsVisible = false; _highlightSections = false; areas = FXCollections.observableArrayList(); _areasVisible = false; _highlightAreas = false; _text = ""; _discreteSeconds = true; _discreteMinutes = true; _discreteHours = false; _secondsVisible = false; _titleVisible = false; _textVisible = false; _dateVisible = false; _dayVisible = false; _nightMode = false; _running = false; _autoNightMode = false; _backgroundPaint = Color.TRANSPARENT; _borderPaint = Color.TRANSPARENT; _borderWidth = 1; _foregroundPaint = Color.TRANSPARENT; _titleColor = DARK_COLOR; _textColor = DARK_COLOR; _dateColor = DARK_COLOR; _hourTickMarkColor = DARK_COLOR; _minuteTickMarkColor = DARK_COLOR; _tickLabelColor = DARK_COLOR; _alarmColor = DARK_COLOR; _hourTickMarksVisible = true; _minuteTickMarksVisible = true; _tickLabelsVisible = true; _hourColor = DARK_COLOR; _minuteColor = DARK_COLOR; _secondColor = DARK_COLOR; _knobColor = DARK_COLOR; _lcdDesign = LcdDesign.STANDARD; _alarmsEnabled = false; _alarmsVisible = false; alarms = FXCollections.observableArrayList(); alarmsToRemove = new ArrayList<>(); _lcdCrystalEnabled = false; _shadowsEnabled = false; _lcdFont = LcdFont.DIGITAL_BOLD; _locale = Locale.US; _tickLabelLocation = TickLabelLocation.INSIDE; _animated = false; animationDuration = 10000; _customFontEnabled = false; _customFont = Fonts.robotoRegular(12); } }
public class class_name { private void init(final ZonedDateTime TIME) { time = new ObjectPropertyBase<ZonedDateTime>(TIME) { @Override protected void invalidated() { if (!isRunning() && isAnimated()) { long animationDuration = getAnimationDuration(); timeline.stop(); // depends on control dependency: [if], data = [none] final KeyValue KEY_VALUE = new KeyValue(currentTime, TIME.toEpochSecond()); final KeyFrame KEY_FRAME = new KeyFrame(javafx.util.Duration.millis(animationDuration), KEY_VALUE); timeline.getKeyFrames().setAll(KEY_FRAME); // depends on control dependency: [if], data = [none] timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT)); // depends on control dependency: [if], data = [none] timeline.play(); // depends on control dependency: [if], data = [none] } else { currentTime.set(TIME.toEpochSecond()); // depends on control dependency: [if], data = [none] fireUpdateEvent(FINISHED_EVENT); // depends on control dependency: [if], data = [none] } } @Override public Object getBean() { return Clock.this; } @Override public String getName() { return "time"; } }; currentTime = new LongPropertyBase(time.get().toEpochSecond()) { @Override protected void invalidated() {} @Override public Object getBean() { return Clock.this; } @Override public String getName() { return "currentTime"; } }; zoneId = time.get().getZone(); timeline = new Timeline(); timeline.setOnFinished(e -> fireUpdateEvent(FINISHED_EVENT)); updateInterval = LONG_INTERVAL; _checkSectionsForValue = false; _checkAreasForValue = false; sections = FXCollections.observableArrayList(); _secondsVisible = false; _highlightSections = false; areas = FXCollections.observableArrayList(); _areasVisible = false; _highlightAreas = false; _text = ""; _discreteSeconds = true; _discreteMinutes = true; _discreteHours = false; _secondsVisible = false; _titleVisible = false; _textVisible = false; _dateVisible = false; _dayVisible = false; _nightMode = false; _running = false; _autoNightMode = false; _backgroundPaint = Color.TRANSPARENT; _borderPaint = Color.TRANSPARENT; _borderWidth = 1; _foregroundPaint = Color.TRANSPARENT; _titleColor = DARK_COLOR; _textColor = DARK_COLOR; _dateColor = DARK_COLOR; _hourTickMarkColor = DARK_COLOR; _minuteTickMarkColor = DARK_COLOR; _tickLabelColor = DARK_COLOR; _alarmColor = DARK_COLOR; _hourTickMarksVisible = true; _minuteTickMarksVisible = true; _tickLabelsVisible = true; _hourColor = DARK_COLOR; _minuteColor = DARK_COLOR; _secondColor = DARK_COLOR; _knobColor = DARK_COLOR; _lcdDesign = LcdDesign.STANDARD; _alarmsEnabled = false; _alarmsVisible = false; alarms = FXCollections.observableArrayList(); alarmsToRemove = new ArrayList<>(); _lcdCrystalEnabled = false; _shadowsEnabled = false; _lcdFont = LcdFont.DIGITAL_BOLD; _locale = Locale.US; _tickLabelLocation = TickLabelLocation.INSIDE; _animated = false; animationDuration = 10000; _customFontEnabled = false; _customFont = Fonts.robotoRegular(12); } }
public class class_name { public void addEventContext(EventContextHandle handle, EventContext eventContext) { if(logger.isDebugEnabled()) { logger.debug("Adding event context "+eventContext+" to datasource. Event context handle is "+handle); } dataSource.put(handle, eventContext); } }
public class class_name { public void addEventContext(EventContextHandle handle, EventContext eventContext) { if(logger.isDebugEnabled()) { logger.debug("Adding event context "+eventContext+" to datasource. Event context handle is "+handle); // depends on control dependency: [if], data = [none] } dataSource.put(handle, eventContext); } }
public class class_name { public void startElement (String qName, AttributeList qAtts) throws SAXException { // These are exceptions from the // first pass; they should be // ignored if there's a second pass, // but reported otherwise. ArrayList<SAXParseException> exceptions = null; // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { if (contentHandler != null) { attAdapter.setAttributeList(qAtts); contentHandler.startElement("", "", qName.intern(), attAdapter); } return; } // OK, we're doing Namespace processing. nsSupport.pushContext(); int length = qAtts.getLength(); // First pass: handle NS decls for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); if (!attQName.startsWith("xmlns")) continue; // Could be a declaration... String prefix; int n = attQName.indexOf(':'); // xmlns=... if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... at most, warn continue; } else // xmlns:foo=... prefix = attQName.substring(n+1); String value = qAtts.getValue(i); if (!nsSupport.declarePrefix(prefix, value)) { reportError("Illegal Namespace prefix: " + prefix); continue; } if (contentHandler != null) contentHandler.startPrefixMapping(prefix, value); } // Second pass: copy all relevant // attributes into the SAX2 AttributeList // using updated prefix bindings atts.clear(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); String type = qAtts.getType(i); String value = qAtts.getValue(i); // Declaration? if (attQName.startsWith("xmlns")) { String prefix; int n = attQName.indexOf(':'); if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... ignore prefix = null; } else { prefix = attQName.substring(6); } // Yes, decl: report or prune if (prefix != null) { if (prefixes) { if (uris) // note funky case: localname can be null // when declaring the default prefix, and // yet the uri isn't null. atts.addAttribute (nsSupport.XMLNS, prefix, attQName.intern(), type, value); else atts.addAttribute ("", "", attQName.intern(), type, value); } continue; } } // Not a declaration -- report try { String attName[] = processName(attQName, true, true); atts.addAttribute(attName[0], attName[1], attName[2], type, value); } catch (SAXException e) { if (exceptions == null) { exceptions = new ArrayList<SAXParseException>(); } exceptions.add((SAXParseException) e); atts.addAttribute("", attQName, attQName, type, value); } } // now handle the deferred exception reports if (exceptions != null && errorHandler != null) { for (SAXParseException ex : exceptions) { errorHandler.error(ex); } } // OK, finally report the event. if (contentHandler != null) { String name[] = processName(qName, false, false); contentHandler.startElement(name[0], name[1], name[2], atts); } } }
public class class_name { public void startElement (String qName, AttributeList qAtts) throws SAXException { // These are exceptions from the // first pass; they should be // ignored if there's a second pass, // but reported otherwise. ArrayList<SAXParseException> exceptions = null; // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { if (contentHandler != null) { attAdapter.setAttributeList(qAtts); // depends on control dependency: [if], data = [none] contentHandler.startElement("", "", qName.intern(), attAdapter); // depends on control dependency: [if], data = [none] } return; } // OK, we're doing Namespace processing. nsSupport.pushContext(); int length = qAtts.getLength(); // First pass: handle NS decls for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); if (!attQName.startsWith("xmlns")) continue; // Could be a declaration... String prefix; int n = attQName.indexOf(':'); // xmlns=... if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... at most, warn continue; } else // xmlns:foo=... prefix = attQName.substring(n+1); String value = qAtts.getValue(i); if (!nsSupport.declarePrefix(prefix, value)) { reportError("Illegal Namespace prefix: " + prefix); continue; } if (contentHandler != null) contentHandler.startPrefixMapping(prefix, value); } // Second pass: copy all relevant // attributes into the SAX2 AttributeList // using updated prefix bindings atts.clear(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); String type = qAtts.getType(i); String value = qAtts.getValue(i); // Declaration? if (attQName.startsWith("xmlns")) { String prefix; int n = attQName.indexOf(':'); if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... ignore prefix = null; } else { prefix = attQName.substring(6); } // Yes, decl: report or prune if (prefix != null) { if (prefixes) { if (uris) // note funky case: localname can be null // when declaring the default prefix, and // yet the uri isn't null. atts.addAttribute (nsSupport.XMLNS, prefix, attQName.intern(), type, value); else atts.addAttribute ("", "", attQName.intern(), type, value); } continue; } } // Not a declaration -- report try { String attName[] = processName(attQName, true, true); atts.addAttribute(attName[0], attName[1], attName[2], type, value); } catch (SAXException e) { if (exceptions == null) { exceptions = new ArrayList<SAXParseException>(); } exceptions.add((SAXParseException) e); atts.addAttribute("", attQName, attQName, type, value); } } // now handle the deferred exception reports if (exceptions != null && errorHandler != null) { for (SAXParseException ex : exceptions) { errorHandler.error(ex); } } // OK, finally report the event. if (contentHandler != null) { String name[] = processName(qName, false, false); contentHandler.startElement(name[0], name[1], name[2], atts); } } }
public class class_name { public static InetSocketAddress buildInetSocketAddress(String host, int defaultPort) { if (StrUtil.isBlank(host)) { host = LOCAL_IP; } String destHost = null; int port = 0; int index = host.indexOf(":"); if (index != -1) { // host:port形式 destHost = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { destHost = host; port = defaultPort; } return new InetSocketAddress(destHost, port); } }
public class class_name { public static InetSocketAddress buildInetSocketAddress(String host, int defaultPort) { if (StrUtil.isBlank(host)) { host = LOCAL_IP; // depends on control dependency: [if], data = [none] } String destHost = null; int port = 0; int index = host.indexOf(":"); if (index != -1) { // host:port形式 destHost = host.substring(0, index); // depends on control dependency: [if], data = [none] port = Integer.parseInt(host.substring(index + 1)); // depends on control dependency: [if], data = [(index] } else { destHost = host; // depends on control dependency: [if], data = [none] port = defaultPort; // depends on control dependency: [if], data = [none] } return new InetSocketAddress(destHost, port); } }
public class class_name { @Deprecated public static Wootric init(FragmentActivity fragmentActivity, String clientId, String clientSecret, String accountToken) { Wootric local = singleton; if(local == null) { synchronized (Wootric.class) { local = singleton; if(local == null) { checkNotNull(fragmentActivity, "FragmentActivity"); checkNotNull(clientId, "Client Id"); checkNotNull(clientSecret, "Client Secret"); checkNotNull(accountToken, "Account Token"); singleton = local = new Wootric(fragmentActivity, clientId, clientSecret, accountToken); } } } return local; } }
public class class_name { @Deprecated public static Wootric init(FragmentActivity fragmentActivity, String clientId, String clientSecret, String accountToken) { Wootric local = singleton; if(local == null) { synchronized (Wootric.class) { // depends on control dependency: [if], data = [none] local = singleton; if(local == null) { checkNotNull(fragmentActivity, "FragmentActivity"); // depends on control dependency: [if], data = [none] checkNotNull(clientId, "Client Id"); // depends on control dependency: [if], data = [none] checkNotNull(clientSecret, "Client Secret"); // depends on control dependency: [if], data = [none] checkNotNull(accountToken, "Account Token"); // depends on control dependency: [if], data = [none] singleton = local = new Wootric(fragmentActivity, clientId, clientSecret, accountToken); // depends on control dependency: [if], data = [none] } } } return local; } }
public class class_name { public <C extends Model> LazyList<C> get(Class<C> targetModelClass, String criteria, Object ... params){ OneToManyAssociation oneToManyAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, OneToManyAssociation.class); MetaModel mm = metaModelLocal; Many2ManyAssociation manyToManyAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, Many2ManyAssociation.class); OneToManyPolymorphicAssociation oneToManyPolymorphicAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, OneToManyPolymorphicAssociation.class); String additionalCriteria = criteria != null? " AND ( " + criteria + " ) " : ""; String subQuery; String targetId = metaModelOf(targetModelClass).getIdName(); MetaModel targetMM = metaModelOf(targetModelClass); String targetTable = targetMM.getTableName(); if (oneToManyAssociation != null) { subQuery = oneToManyAssociation.getFkName() + " = ? " + additionalCriteria; } else if (manyToManyAssociation != null) { String joinTable = manyToManyAssociation.getJoin(); String query = "SELECT " + targetTable + ".* FROM " + targetTable + ", " + joinTable + " WHERE " + targetTable + "." + targetId + " = " + joinTable + "." + manyToManyAssociation.getTargetFkName() + " AND " + joinTable + "." + manyToManyAssociation.getSourceFkName() + " = ? " + additionalCriteria; Object[] allParams = new Object[params.length + 1]; allParams[0] = getId(); System.arraycopy(params, 0, allParams, 1, params.length); return new LazyList<>(true, metaModelOf(manyToManyAssociation.getTargetClass()), query, allParams); } else if (oneToManyPolymorphicAssociation != null) { subQuery = "parent_id = ? AND " + " parent_type = '" + oneToManyPolymorphicAssociation.getTypeLabel() + "'" + additionalCriteria; } else { throw new NotAssociatedException(metaModelLocal.getModelClass(), targetModelClass); } Object[] allParams = new Object[params.length + 1]; allParams[0] = getId(); System.arraycopy(params, 0, allParams, 1, params.length); return new LazyList<>(subQuery, targetMM, allParams); } }
public class class_name { public <C extends Model> LazyList<C> get(Class<C> targetModelClass, String criteria, Object ... params){ OneToManyAssociation oneToManyAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, OneToManyAssociation.class); MetaModel mm = metaModelLocal; Many2ManyAssociation manyToManyAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, Many2ManyAssociation.class); OneToManyPolymorphicAssociation oneToManyPolymorphicAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, OneToManyPolymorphicAssociation.class); String additionalCriteria = criteria != null? " AND ( " + criteria + " ) " : ""; String subQuery; String targetId = metaModelOf(targetModelClass).getIdName(); MetaModel targetMM = metaModelOf(targetModelClass); String targetTable = targetMM.getTableName(); if (oneToManyAssociation != null) { subQuery = oneToManyAssociation.getFkName() + " = ? " + additionalCriteria; // depends on control dependency: [if], data = [none] } else if (manyToManyAssociation != null) { String joinTable = manyToManyAssociation.getJoin(); String query = "SELECT " + targetTable + ".* FROM " + targetTable + ", " + joinTable + " WHERE " + targetTable + "." + targetId + " = " + joinTable + "." + manyToManyAssociation.getTargetFkName() + " AND " + joinTable + "." + manyToManyAssociation.getSourceFkName() + " = ? " + additionalCriteria; Object[] allParams = new Object[params.length + 1]; allParams[0] = getId(); // depends on control dependency: [if], data = [none] System.arraycopy(params, 0, allParams, 1, params.length); // depends on control dependency: [if], data = [none] return new LazyList<>(true, metaModelOf(manyToManyAssociation.getTargetClass()), query, allParams); // depends on control dependency: [if], data = [(manyToManyAssociation] } else if (oneToManyPolymorphicAssociation != null) { subQuery = "parent_id = ? AND " + " parent_type = '" + oneToManyPolymorphicAssociation.getTypeLabel() + "'" + additionalCriteria; // depends on control dependency: [if], data = [none] } else { throw new NotAssociatedException(metaModelLocal.getModelClass(), targetModelClass); } Object[] allParams = new Object[params.length + 1]; allParams[0] = getId(); System.arraycopy(params, 0, allParams, 1, params.length); return new LazyList<>(subQuery, targetMM, allParams); } }
public class class_name { private void initializeSecurityManager(SubjectAwareDescriptor subjectAware) { String cfg = subjectAware.getConfiguration(); if (cfg.length() > 0) { Factory<SecurityManager> factory = new IniSecurityManagerFactory(cfg); SecurityManager securityManager = factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); } String username = subjectAware.getUsername(); if ((username != null) && (username.length() > 0)) { UsernamePasswordToken token = new UsernamePasswordToken(username, subjectAware.getPassword()); SecurityUtils.getSubject().login(token); } } }
public class class_name { private void initializeSecurityManager(SubjectAwareDescriptor subjectAware) { String cfg = subjectAware.getConfiguration(); if (cfg.length() > 0) { Factory<SecurityManager> factory = new IniSecurityManagerFactory(cfg); SecurityManager securityManager = factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); // depends on control dependency: [if], data = [none] } String username = subjectAware.getUsername(); if ((username != null) && (username.length() > 0)) { UsernamePasswordToken token = new UsernamePasswordToken(username, subjectAware.getPassword()); SecurityUtils.getSubject().login(token); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String isbn10Format(final String pstring) { if (pstring == null) { return null; } final ValueWithPos<String> formatedValue = isbn10FormatWithPos(new ValueWithPos<>(pstring, -1)); return formatedValue.getValue(); } }
public class class_name { public static String isbn10Format(final String pstring) { if (pstring == null) { return null; // depends on control dependency: [if], data = [none] } final ValueWithPos<String> formatedValue = isbn10FormatWithPos(new ValueWithPos<>(pstring, -1)); return formatedValue.getValue(); } }
public class class_name { @Override protected long overallEndTime() { long ret = super.overallEndTime(); for (Node child : nodes) { long childEndTime = child.overallEndTime(); if (childEndTime > ret) { ret = childEndTime; } } return ret; } }
public class class_name { @Override protected long overallEndTime() { long ret = super.overallEndTime(); for (Node child : nodes) { long childEndTime = child.overallEndTime(); if (childEndTime > ret) { ret = childEndTime; // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { public static String getFormattedTagAndLength(final byte[] data, final int indentLength) { StringBuilder buf = new StringBuilder(); String indent = getSpaces(indentLength); TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data)); boolean firstLine = true; try { while (stream.available() > 0) { if (firstLine) { firstLine = false; } else { buf.append("\n"); } buf.append(indent); ITag tag = searchTagById(stream.readTag()); int length = stream.readLength(); buf.append(prettyPrintHex(tag.getTagBytes())); buf.append(" "); buf.append(String.format("%02x", length)); buf.append(" -- "); buf.append(tag.getName()); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(stream); } return buf.toString(); } }
public class class_name { public static String getFormattedTagAndLength(final byte[] data, final int indentLength) { StringBuilder buf = new StringBuilder(); String indent = getSpaces(indentLength); TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data)); boolean firstLine = true; try { while (stream.available() > 0) { if (firstLine) { firstLine = false; // depends on control dependency: [if], data = [none] } else { buf.append("\n"); // depends on control dependency: [if], data = [none] } buf.append(indent); // depends on control dependency: [while], data = [none] ITag tag = searchTagById(stream.readTag()); int length = stream.readLength(); buf.append(prettyPrintHex(tag.getTagBytes())); // depends on control dependency: [while], data = [none] buf.append(" "); // depends on control dependency: [while], data = [none] buf.append(String.format("%02x", length)); // depends on control dependency: [while], data = [none] buf.append(" -- "); // depends on control dependency: [while], data = [none] buf.append(tag.getName()); // depends on control dependency: [while], data = [none] } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } finally { // depends on control dependency: [catch], data = [none] IOUtils.closeQuietly(stream); } return buf.toString(); } }
public class class_name { @Override public Enumeration<String> getParameterNames() { Set<String> paramNames = new HashSet<String>(); Enumeration<String> paramEnum = super.getParameterNames(); while (paramEnum.hasMoreElements()) { paramNames.add((String) paramEnum.nextElement()); } paramNames.addAll(getMultipartParameters().keySet()); return Collections.enumeration(paramNames); } }
public class class_name { @Override public Enumeration<String> getParameterNames() { Set<String> paramNames = new HashSet<String>(); Enumeration<String> paramEnum = super.getParameterNames(); while (paramEnum.hasMoreElements()) { paramNames.add((String) paramEnum.nextElement()); // depends on control dependency: [while], data = [none] } paramNames.addAll(getMultipartParameters().keySet()); return Collections.enumeration(paramNames); } }
public class class_name { private void avoidObstacle(int nextStep, int max) { if (nextStep >= max - 1) { pathStoppedRequested = true; } final Collection<Integer> cid = mapPath.getObjectsId(path.getX(nextStep), path.getY(nextStep)); if (sharedPathIds.containsAll(cid)) { setDestination(destX, destY); } else { if (!ignoredIds.containsAll(cid)) { setDestination(destX, destY); } } } }
public class class_name { private void avoidObstacle(int nextStep, int max) { if (nextStep >= max - 1) { pathStoppedRequested = true; // depends on control dependency: [if], data = [none] } final Collection<Integer> cid = mapPath.getObjectsId(path.getX(nextStep), path.getY(nextStep)); if (sharedPathIds.containsAll(cid)) { setDestination(destX, destY); // depends on control dependency: [if], data = [none] } else { if (!ignoredIds.containsAll(cid)) { setDestination(destX, destY); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected List<FormItem> multipartFormItems(String encoding, long maxUploadSize) { //we are thread safe, because controllers are pinned to a thread and discarded after each request. if(RequestContext.getFormItems() != null ){ return RequestContext.getFormItems(); } HttpServletRequest req = RequestContext.getHttpRequest(); if (req instanceof AWMockMultipartHttpServletRequest) {//running inside a test, and simulating upload. RequestContext.setFormItems(((AWMockMultipartHttpServletRequest) req).getFormItems()); } else { if (!ServletFileUpload.isMultipartContent(req)) throw new ControllerException("this is not a multipart request, be sure to add this attribute to the form: ... enctype=\"multipart/form-data\" ..."); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(Configuration.getMaxUploadSize()); factory.setRepository(Configuration.getTmpDir()); ServletFileUpload upload = new ServletFileUpload(factory); if(encoding != null) upload.setHeaderEncoding(encoding); upload.setFileSizeMax(maxUploadSize); try { List<org.apache.commons.fileupload.FileItem> apacheFileItems = upload.parseRequest(RequestContext.getHttpRequest()); ArrayList items = new ArrayList<>(); for (FileItem apacheItem : apacheFileItems) { ApacheFileItemFacade f = new ApacheFileItemFacade(apacheItem); if(f.isFormField()){ items.add(new FormItem(f)); }else{ items.add(new org.javalite.activeweb.FileItem(f)); } } RequestContext.setFormItems(items); } catch (Exception e) { throw new ControllerException(e); } } return RequestContext.getFormItems(); } }
public class class_name { protected List<FormItem> multipartFormItems(String encoding, long maxUploadSize) { //we are thread safe, because controllers are pinned to a thread and discarded after each request. if(RequestContext.getFormItems() != null ){ return RequestContext.getFormItems(); // depends on control dependency: [if], data = [none] } HttpServletRequest req = RequestContext.getHttpRequest(); if (req instanceof AWMockMultipartHttpServletRequest) {//running inside a test, and simulating upload. RequestContext.setFormItems(((AWMockMultipartHttpServletRequest) req).getFormItems()); // depends on control dependency: [if], data = [none] } else { if (!ServletFileUpload.isMultipartContent(req)) throw new ControllerException("this is not a multipart request, be sure to add this attribute to the form: ... enctype=\"multipart/form-data\" ..."); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(Configuration.getMaxUploadSize()); // depends on control dependency: [if], data = [none] factory.setRepository(Configuration.getTmpDir()); // depends on control dependency: [if], data = [none] ServletFileUpload upload = new ServletFileUpload(factory); if(encoding != null) upload.setHeaderEncoding(encoding); upload.setFileSizeMax(maxUploadSize); // depends on control dependency: [if], data = [none] try { List<org.apache.commons.fileupload.FileItem> apacheFileItems = upload.parseRequest(RequestContext.getHttpRequest()); ArrayList items = new ArrayList<>(); for (FileItem apacheItem : apacheFileItems) { ApacheFileItemFacade f = new ApacheFileItemFacade(apacheItem); if(f.isFormField()){ items.add(new FormItem(f)); // depends on control dependency: [if], data = [none] }else{ items.add(new org.javalite.activeweb.FileItem(f)); // depends on control dependency: [if], data = [none] } } RequestContext.setFormItems(items); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new ControllerException(e); } // depends on control dependency: [catch], data = [none] } return RequestContext.getFormItems(); } }
public class class_name { public Optional<RoutingTable> getRoutingTable(final String dataSourceName, final String actualTableName) { for (RoutingTable each : routingTables) { if (dataSourceName.equalsIgnoreCase(masterSlaveLogicDataSourceName) && each.getActualTableName().equalsIgnoreCase(actualTableName)) { return Optional.of(each); } } return Optional.absent(); } }
public class class_name { public Optional<RoutingTable> getRoutingTable(final String dataSourceName, final String actualTableName) { for (RoutingTable each : routingTables) { if (dataSourceName.equalsIgnoreCase(masterSlaveLogicDataSourceName) && each.getActualTableName().equalsIgnoreCase(actualTableName)) { return Optional.of(each); // depends on control dependency: [if], data = [none] } } return Optional.absent(); } }
public class class_name { protected final void appendDesc(StringBuilder sb) { if (_type == TYPE_OBJECT) { sb.append('{'); if (_currentName != null) { sb.append('"'); // !!! TODO: Name chars should be escaped? sb.append(_currentName); sb.append('"'); } else { sb.append('?'); } sb.append('}'); } else if (_type == TYPE_ARRAY) { sb.append('['); sb.append(getCurrentIndex()); sb.append(']'); } else { // nah, ROOT: sb.append("/"); } } }
public class class_name { protected final void appendDesc(StringBuilder sb) { if (_type == TYPE_OBJECT) { sb.append('{'); // depends on control dependency: [if], data = [none] if (_currentName != null) { sb.append('"'); // depends on control dependency: [if], data = [none] // !!! TODO: Name chars should be escaped? sb.append(_currentName); // depends on control dependency: [if], data = [(_currentName] sb.append('"'); // depends on control dependency: [if], data = [none] } else { sb.append('?'); // depends on control dependency: [if], data = [none] } sb.append('}'); // depends on control dependency: [if], data = [none] } else if (_type == TYPE_ARRAY) { sb.append('['); // depends on control dependency: [if], data = [none] sb.append(getCurrentIndex()); // depends on control dependency: [if], data = [none] sb.append(']'); // depends on control dependency: [if], data = [none] } else { // nah, ROOT: sb.append("/"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setSeverities(java.util.Collection<String> severities) { if (severities == null) { this.severities = null; return; } this.severities = new java.util.ArrayList<String>(severities); } }
public class class_name { public void setSeverities(java.util.Collection<String> severities) { if (severities == null) { this.severities = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.severities = new java.util.ArrayList<String>(severities); } }
public class class_name { private static Long getTimeout(final Ticket ticket) { val ttl = ticket.getExpirationPolicy().getTimeToLive(); if (ttl > Integer.MAX_VALUE) { return (long) Integer.MAX_VALUE; } else if (ttl <= 0) { return 1L; } return ttl; } }
public class class_name { private static Long getTimeout(final Ticket ticket) { val ttl = ticket.getExpirationPolicy().getTimeToLive(); if (ttl > Integer.MAX_VALUE) { return (long) Integer.MAX_VALUE; // depends on control dependency: [if], data = [none] } else if (ttl <= 0) { return 1L; // depends on control dependency: [if], data = [none] } return ttl; } }
public class class_name { @SuppressWarnings("unchecked") public <S extends MadvocScope> S defaultOrScopeType(final Class<S> scopeClass) { if (scopeClass == null) { return (S) getOrInitScope(RequestScope.class); } return (S) getOrInitScope(scopeClass); } }
public class class_name { @SuppressWarnings("unchecked") public <S extends MadvocScope> S defaultOrScopeType(final Class<S> scopeClass) { if (scopeClass == null) { return (S) getOrInitScope(RequestScope.class); // depends on control dependency: [if], data = [none] } return (S) getOrInitScope(scopeClass); } }
public class class_name { public String getString(Collection<ByteBuffer> names) { StringBuilder builder = new StringBuilder(); for (ByteBuffer name : names) { builder.append(getString(name)).append(","); } return builder.toString(); } }
public class class_name { public String getString(Collection<ByteBuffer> names) { StringBuilder builder = new StringBuilder(); for (ByteBuffer name : names) { builder.append(getString(name)).append(","); // depends on control dependency: [for], data = [name] } return builder.toString(); } }
public class class_name { public String getFileDir() { // 获取相对于classpath的路径 if (targetDirPath != null) { if (targetDirPath.startsWith("/")) { return OsUtil.pathJoin(targetDirPath); } return OsUtil.pathJoin(ClassLoaderUtil.getClassPath(), targetDirPath); } return ClassLoaderUtil.getClassPath(); } }
public class class_name { public String getFileDir() { // 获取相对于classpath的路径 if (targetDirPath != null) { if (targetDirPath.startsWith("/")) { return OsUtil.pathJoin(targetDirPath); // depends on control dependency: [if], data = [none] } return OsUtil.pathJoin(ClassLoaderUtil.getClassPath(), targetDirPath); // depends on control dependency: [if], data = [none] } return ClassLoaderUtil.getClassPath(); } }
public class class_name { public static void main(String[] args) { org.apache.hadoop.hdfs.DnsMonitorSecurityManager.setTheManager(); try { System.exit(runBalancer(args)); } catch (Throwable e) { LOG.error(StringUtils.stringifyException(e)); System.exit(-1); } } }
public class class_name { public static void main(String[] args) { org.apache.hadoop.hdfs.DnsMonitorSecurityManager.setTheManager(); try { System.exit(runBalancer(args)); // depends on control dependency: [try], data = [none] } catch (Throwable e) { LOG.error(StringUtils.stringifyException(e)); System.exit(-1); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void merge(ChangesItem changesItem) { workspaceChangedSize += changesItem.getWorkspaceChangedSize(); for (Entry<String, Long> changesEntry : changesItem.calculatedChangedNodesSize.entrySet()) { String nodePath = changesEntry.getKey(); Long currentDelta = changesEntry.getValue(); Long oldDelta = calculatedChangedNodesSize.get(nodePath); Long newDelta = currentDelta + (oldDelta == null ? 0 : oldDelta); calculatedChangedNodesSize.put(nodePath, newDelta); } for (String path : changesItem.unknownChangedNodesSize) { unknownChangedNodesSize.add(path); } for (String path : changesItem.asyncUpdate) { asyncUpdate.add(path); } } }
public class class_name { public void merge(ChangesItem changesItem) { workspaceChangedSize += changesItem.getWorkspaceChangedSize(); for (Entry<String, Long> changesEntry : changesItem.calculatedChangedNodesSize.entrySet()) { String nodePath = changesEntry.getKey(); Long currentDelta = changesEntry.getValue(); Long oldDelta = calculatedChangedNodesSize.get(nodePath); Long newDelta = currentDelta + (oldDelta == null ? 0 : oldDelta); calculatedChangedNodesSize.put(nodePath, newDelta); // depends on control dependency: [for], data = [none] } for (String path : changesItem.unknownChangedNodesSize) { unknownChangedNodesSize.add(path); // depends on control dependency: [for], data = [path] } for (String path : changesItem.asyncUpdate) { asyncUpdate.add(path); // depends on control dependency: [for], data = [path] } } }
public class class_name { private static void selectToJson(CqlSession session) { Statement stmt = selectFrom("examples", "json_jackson_function") .column("id") .function("toJson", Selector.column("user")) .as("user") .function("toJson", Selector.column("scores")) .as("scores") .whereColumn("id") .in(literal(1), literal(2)) .build(); System.out.println(((SimpleStatement) stmt).getQuery()); ResultSet rows = session.execute(stmt); for (Row row : rows) { int id = row.getInt("id"); // retrieve the JSON payload and convert it to a User instance User user = row.get("user", User.class); // it is also possible to retrieve the raw JSON payload String userJson = row.getString("user"); // retrieve the JSON payload and convert it to a JsonNode instance // note that the codec requires that the type passed to the get() method // be always JsonNode, and not a subclass of it, such as ObjectNode JsonNode scores = row.get("scores", JsonNode.class); // it is also possible to retrieve the raw JSON payload String scoresJson = row.getString("scores"); System.out.printf( "Retrieved row:%n" + "id %d%n" + "user %s%n" + "user (raw) %s%n" + "scores %s%n" + "scores (raw) %s%n%n", id, user, userJson, scores, scoresJson); } } }
public class class_name { private static void selectToJson(CqlSession session) { Statement stmt = selectFrom("examples", "json_jackson_function") .column("id") .function("toJson", Selector.column("user")) .as("user") .function("toJson", Selector.column("scores")) .as("scores") .whereColumn("id") .in(literal(1), literal(2)) .build(); System.out.println(((SimpleStatement) stmt).getQuery()); ResultSet rows = session.execute(stmt); for (Row row : rows) { int id = row.getInt("id"); // retrieve the JSON payload and convert it to a User instance User user = row.get("user", User.class); // it is also possible to retrieve the raw JSON payload String userJson = row.getString("user"); // retrieve the JSON payload and convert it to a JsonNode instance // note that the codec requires that the type passed to the get() method // be always JsonNode, and not a subclass of it, such as ObjectNode JsonNode scores = row.get("scores", JsonNode.class); // it is also possible to retrieve the raw JSON payload String scoresJson = row.getString("scores"); System.out.printf( "Retrieved row:%n" + "id %d%n" + "user %s%n" + "user (raw) %s%n" + "scores %s%n" + "scores (raw) %s%n%n", id, user, userJson, scores, scoresJson); // depends on control dependency: [for], data = [none] } } }
public class class_name { protected void removeFromCache(String cacheName, String key) { try { ICache cache = getCache(cacheName); if (cache != null) { cache.delete(key); } } catch (CacheException e) { LOGGER.warn(e.getMessage(), e); } } }
public class class_name { protected void removeFromCache(String cacheName, String key) { try { ICache cache = getCache(cacheName); if (cache != null) { cache.delete(key); // depends on control dependency: [if], data = [none] } } catch (CacheException e) { LOGGER.warn(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Field updateFieldTrueFalse(Field formFieldParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.TrueFalse); formFieldParam.setTypeMetaData(FieldMetaData.TrueFalse.TRUE_FALSE); } return new Field(this.postJson( formFieldParam, WS.Path.UserField.Version1.userFieldUpdate())); } }
public class class_name { public Field updateFieldTrueFalse(Field formFieldParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.TrueFalse); // depends on control dependency: [if], data = [none] formFieldParam.setTypeMetaData(FieldMetaData.TrueFalse.TRUE_FALSE); // depends on control dependency: [if], data = [none] } return new Field(this.postJson( formFieldParam, WS.Path.UserField.Version1.userFieldUpdate())); } }
public class class_name { public static void verify() { try { Approvals.verify(TURTLE.getImage()); } catch (Exception e) { throw ObjectUtils.throwAsError(e); } finally { TortoiseUtils.resetTurtle(); } } }
public class class_name { public static void verify() { try { Approvals.verify(TURTLE.getImage()); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw ObjectUtils.throwAsError(e); } finally { // depends on control dependency: [catch], data = [none] TortoiseUtils.resetTurtle(); } } }
public class class_name { public String getParameterNameAt(int index) { if (info == null || info.parameters == null) { return null; } if (index >= info.parameters.size()) { return null; } return Iterables.get(info.parameters.keySet(), index); } }
public class class_name { public String getParameterNameAt(int index) { if (info == null || info.parameters == null) { return null; // depends on control dependency: [if], data = [none] } if (index >= info.parameters.size()) { return null; // depends on control dependency: [if], data = [none] } return Iterables.get(info.parameters.keySet(), index); } }
public class class_name { private List<SourceLocation> createAbsoluteLocations(GraphQLError relativeError, MergedField fields) { Optional<SourceLocation> baseLocation = Optional.ofNullable(fields.getSingleField().getSourceLocation()); // if (!fields.isEmpty()) { // baseLocation = Optional.ofNullable(fields.get(0).getSourceLocation()); // } else { // baseLocation = Optional.empty(); // } // relative error empty path should yield an absolute error with the base path if (relativeError.getLocations() != null && relativeError.getLocations().isEmpty()) { return baseLocation.map(Collections::singletonList).orElse(null); } return Optional.ofNullable( relativeError.getLocations()) .map(locations -> locations.stream() .map(l -> baseLocation .map(base -> new SourceLocation( base.getLine() + l.getLine(), base.getColumn() + l.getColumn())) .orElse(null)) .collect(Collectors.toList())) .map(Collections::unmodifiableList) .orElse(null); } }
public class class_name { private List<SourceLocation> createAbsoluteLocations(GraphQLError relativeError, MergedField fields) { Optional<SourceLocation> baseLocation = Optional.ofNullable(fields.getSingleField().getSourceLocation()); // if (!fields.isEmpty()) { // baseLocation = Optional.ofNullable(fields.get(0).getSourceLocation()); // } else { // baseLocation = Optional.empty(); // } // relative error empty path should yield an absolute error with the base path if (relativeError.getLocations() != null && relativeError.getLocations().isEmpty()) { return baseLocation.map(Collections::singletonList).orElse(null); // depends on control dependency: [if], data = [none] } return Optional.ofNullable( relativeError.getLocations()) .map(locations -> locations.stream() .map(l -> baseLocation .map(base -> new SourceLocation( base.getLine() + l.getLine(), base.getColumn() + l.getColumn())) .orElse(null)) .collect(Collectors.toList())) .map(Collections::unmodifiableList) .orElse(null); } }