code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static byte[] getBlob(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getBlob(cursor.getColumnIndex(columnName));
} } | public class class_name {
public static byte[] getBlob(Cursor cursor, String columnName) {
if (cursor == null) {
return null; // depends on control dependency: [if], data = [none]
}
return cursor.getBlob(cursor.getColumnIndex(columnName));
} } |
public class class_name {
private void assignCurrencyPrivate(XAttributable element, String currency) {
if (currency != null && currency.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_CURRENCY.clone();
attr.setValue(currency);
element.getAttributes().put(KEY_CURRENCY, attr);
}
} } | public class class_name {
private void assignCurrencyPrivate(XAttributable element, String currency) {
if (currency != null && currency.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_CURRENCY.clone();
attr.setValue(currency);
// depends on control dependency: [if], data = [(currency]
element.getAttributes().put(KEY_CURRENCY, attr);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<Geometry> getGeometriesIn( String tableName, Geometry intersectionGeometry, String... prePostWhere )
throws Exception {
List<Geometry> geoms = new ArrayList<Geometry>();
List<String> wheres = new ArrayList<>();
String pre = "";
String post = "";
String where = "";
if (prePostWhere != null && prePostWhere.length == 3) {
if (prePostWhere[0] != null)
pre = prePostWhere[0];
if (prePostWhere[1] != null)
post = prePostWhere[1];
if (prePostWhere[2] != null) {
where = prePostWhere[2];
wheres.add(where);
}
}
GeometryColumn gCol = getGeometryColumnsForTable(tableName);
String sql = "SELECT " + pre + gCol.geometryColumnName + post + " FROM " + tableName;
if (intersectionGeometry != null) {
intersectionGeometry.setSRID(gCol.srid);
wheres.add(getSpatialindexGeometryWherePiece(tableName, null, intersectionGeometry));
}
if (wheres.size() > 0) {
sql += " WHERE " + DbsUtilities.joinBySeparator(wheres, " AND ");
}
IGeometryParser geometryParser = getType().getGeometryParser();
String _sql = sql;
return execOnConnection(connection -> {
try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(_sql)) {
while( rs.next() ) {
Geometry geometry = geometryParser.fromResultSet(rs, 1);
geoms.add(geometry);
}
return geoms;
}
});
} } | public class class_name {
public List<Geometry> getGeometriesIn( String tableName, Geometry intersectionGeometry, String... prePostWhere )
throws Exception {
List<Geometry> geoms = new ArrayList<Geometry>();
List<String> wheres = new ArrayList<>();
String pre = "";
String post = "";
String where = "";
if (prePostWhere != null && prePostWhere.length == 3) {
if (prePostWhere[0] != null)
pre = prePostWhere[0];
if (prePostWhere[1] != null)
post = prePostWhere[1];
if (prePostWhere[2] != null) {
where = prePostWhere[2]; // depends on control dependency: [if], data = [none]
wheres.add(where); // depends on control dependency: [if], data = [none]
}
}
GeometryColumn gCol = getGeometryColumnsForTable(tableName);
String sql = "SELECT " + pre + gCol.geometryColumnName + post + " FROM " + tableName;
if (intersectionGeometry != null) {
intersectionGeometry.setSRID(gCol.srid);
wheres.add(getSpatialindexGeometryWherePiece(tableName, null, intersectionGeometry));
}
if (wheres.size() > 0) {
sql += " WHERE " + DbsUtilities.joinBySeparator(wheres, " AND ");
}
IGeometryParser geometryParser = getType().getGeometryParser();
String _sql = sql;
return execOnConnection(connection -> {
try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(_sql)) {
while( rs.next() ) {
Geometry geometry = geometryParser.fromResultSet(rs, 1);
geoms.add(geometry);
}
return geoms;
}
});
} } |
public class class_name {
public final boolean isInferredConst() {
if (nameNode == null) {
return false;
}
return nameNode.getBooleanProp(Node.IS_CONSTANT_VAR)
|| nameNode.getBooleanProp(Node.IS_CONSTANT_NAME);
} } | public class class_name {
public final boolean isInferredConst() {
if (nameNode == null) {
return false; // depends on control dependency: [if], data = [none]
}
return nameNode.getBooleanProp(Node.IS_CONSTANT_VAR)
|| nameNode.getBooleanProp(Node.IS_CONSTANT_NAME);
} } |
public class class_name {
public Object getPropertyValue(Property property) {
Validate.argumentIsNotNull(property);
Object val = properties.get(property.getName());
if (val == null){
return Defaults.defaultValue(property.getGenericType());
}
return val;
} } | public class class_name {
public Object getPropertyValue(Property property) {
Validate.argumentIsNotNull(property);
Object val = properties.get(property.getName());
if (val == null){
return Defaults.defaultValue(property.getGenericType()); // depends on control dependency: [if], data = [none]
}
return val;
} } |
public class class_name {
public void marshall(StreamDescription streamDescription, ProtocolMarshaller protocolMarshaller) {
if (streamDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(streamDescription.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(streamDescription.getStreamARN(), STREAMARN_BINDING);
protocolMarshaller.marshall(streamDescription.getStreamStatus(), STREAMSTATUS_BINDING);
protocolMarshaller.marshall(streamDescription.getShards(), SHARDS_BINDING);
protocolMarshaller.marshall(streamDescription.getHasMoreShards(), HASMORESHARDS_BINDING);
protocolMarshaller.marshall(streamDescription.getRetentionPeriodHours(), RETENTIONPERIODHOURS_BINDING);
protocolMarshaller.marshall(streamDescription.getStreamCreationTimestamp(), STREAMCREATIONTIMESTAMP_BINDING);
protocolMarshaller.marshall(streamDescription.getEnhancedMonitoring(), ENHANCEDMONITORING_BINDING);
protocolMarshaller.marshall(streamDescription.getEncryptionType(), ENCRYPTIONTYPE_BINDING);
protocolMarshaller.marshall(streamDescription.getKeyId(), KEYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StreamDescription streamDescription, ProtocolMarshaller protocolMarshaller) {
if (streamDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(streamDescription.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getStreamARN(), STREAMARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getStreamStatus(), STREAMSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getShards(), SHARDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getHasMoreShards(), HASMORESHARDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getRetentionPeriodHours(), RETENTIONPERIODHOURS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getStreamCreationTimestamp(), STREAMCREATIONTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getEnhancedMonitoring(), ENHANCEDMONITORING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getEncryptionType(), ENCRYPTIONTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamDescription.getKeyId(), KEYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void deleteAlias(MonolingualTextValue alias) {
String lang = alias.getLanguageCode();
AliasesWithUpdate currentAliases = newAliases.get(lang);
if (currentAliases != null) {
currentAliases.aliases.remove(alias);
currentAliases.deleted.add(alias);
currentAliases.write = true;
}
} } | public class class_name {
protected void deleteAlias(MonolingualTextValue alias) {
String lang = alias.getLanguageCode();
AliasesWithUpdate currentAliases = newAliases.get(lang);
if (currentAliases != null) {
currentAliases.aliases.remove(alias); // depends on control dependency: [if], data = [none]
currentAliases.deleted.add(alias); // depends on control dependency: [if], data = [none]
currentAliases.write = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int computeOffset(int x, int y) {
if(y > x) {
return computeOffset(y, x);
}
return ((x * (x + 1)) >> 1) + y;
} } | public class class_name {
private int computeOffset(int x, int y) {
if(y > x) {
return computeOffset(y, x); // depends on control dependency: [if], data = [(y]
}
return ((x * (x + 1)) >> 1) + y;
} } |
public class class_name {
private static TileConfiguration createTileConfiguration(MapConfiguration mapConfig,
ClientVectorLayerInfo layerInfo, final ViewPort viewPort) {
TileConfiguration tileConfig = new TileConfiguration();
ClientMapInfo mapInfo = mapConfig.getHintValue(GeomajasServerExtension.MAPINFO);
tileConfig.setTileWidth(mapInfo.getPreferredPixelsPerTile().getWidth());
tileConfig.setTileHeight(mapInfo.getPreferredPixelsPerTile().getHeight());
List<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < viewPort.getResolutionCount(); i++) {
resolutions.add(viewPort.getResolution(i));
}
tileConfig.setResolutions(resolutions);
if (layerInfo.getMaxExtent() != null) {
tileConfig.setTileOrigin(BboxService.getOrigin(layerInfo.getMaxExtent()));
} else {
tileConfig.setTileOrigin(new Coordinate());
}
return tileConfig;
} } | public class class_name {
private static TileConfiguration createTileConfiguration(MapConfiguration mapConfig,
ClientVectorLayerInfo layerInfo, final ViewPort viewPort) {
TileConfiguration tileConfig = new TileConfiguration();
ClientMapInfo mapInfo = mapConfig.getHintValue(GeomajasServerExtension.MAPINFO);
tileConfig.setTileWidth(mapInfo.getPreferredPixelsPerTile().getWidth());
tileConfig.setTileHeight(mapInfo.getPreferredPixelsPerTile().getHeight());
List<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < viewPort.getResolutionCount(); i++) {
resolutions.add(viewPort.getResolution(i)); // depends on control dependency: [for], data = [i]
}
tileConfig.setResolutions(resolutions);
if (layerInfo.getMaxExtent() != null) {
tileConfig.setTileOrigin(BboxService.getOrigin(layerInfo.getMaxExtent())); // depends on control dependency: [if], data = [(layerInfo.getMaxExtent()]
} else {
tileConfig.setTileOrigin(new Coordinate()); // depends on control dependency: [if], data = [none]
}
return tileConfig;
} } |
public class class_name {
private void acquireLocksOnEntries(final OMMapBufferEntry[] entries, OPERATION_TYPE operationType) {
if (operationType == OPERATION_TYPE.WRITE)
for (OMMapBufferEntry entry : entries) {
entry.acquireWriteLock();
entry.setDirty();
}
else
for (OMMapBufferEntry entry : entries)
entry.acquireReadLock();
} } | public class class_name {
private void acquireLocksOnEntries(final OMMapBufferEntry[] entries, OPERATION_TYPE operationType) {
if (operationType == OPERATION_TYPE.WRITE)
for (OMMapBufferEntry entry : entries) {
entry.acquireWriteLock();
// depends on control dependency: [for], data = [entry]
entry.setDirty();
// depends on control dependency: [for], data = [entry]
}
else
for (OMMapBufferEntry entry : entries)
entry.acquireReadLock();
} } |
public class class_name {
private static PipedInputStream createInputStream( final Jar jar )
throws IOException
{
final CloseAwarePipedInputStream pin = new CloseAwarePipedInputStream();
final PipedOutputStream pout = new PipedOutputStream( pin );
new Thread()
{
public void run()
{
try
{
jar.write( pout );
}
catch( Exception e )
{
if (pin.closed)
{
// logging the message at DEBUG logging instead
// -- reading thread probably stopped reading
LOG.debug( "Bundle cannot be generated, pipe closed by reader", e );
}
else {
LOG.warn( "Bundle cannot be generated", e );
}
}
finally
{
try
{
jar.close();
pout.close();
}
catch( IOException ignore )
{
// if we get here something is very wrong
LOG.error( "Bundle cannot be generated", ignore );
}
}
}
}.start();
return pin;
} } | public class class_name {
private static PipedInputStream createInputStream( final Jar jar )
throws IOException
{
final CloseAwarePipedInputStream pin = new CloseAwarePipedInputStream();
final PipedOutputStream pout = new PipedOutputStream( pin );
new Thread()
{
public void run()
{
try
{
jar.write( pout ); // depends on control dependency: [try], data = [none]
}
catch( Exception e )
{
if (pin.closed)
{
// logging the message at DEBUG logging instead
// -- reading thread probably stopped reading
LOG.debug( "Bundle cannot be generated, pipe closed by reader", e ); // depends on control dependency: [if], data = [none]
}
else {
LOG.warn( "Bundle cannot be generated", e ); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
finally
{
try
{
jar.close(); // depends on control dependency: [try], data = [none]
pout.close(); // depends on control dependency: [try], data = [none]
}
catch( IOException ignore )
{
// if we get here something is very wrong
LOG.error( "Bundle cannot be generated", ignore );
} // depends on control dependency: [catch], data = [none]
}
}
}.start();
return pin;
} } |
public class class_name {
public void marshall(ListIPSetsRequest listIPSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listIPSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listIPSetsRequest.getNextMarker(), NEXTMARKER_BINDING);
protocolMarshaller.marshall(listIPSetsRequest.getLimit(), LIMIT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListIPSetsRequest listIPSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listIPSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listIPSetsRequest.getNextMarker(), NEXTMARKER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listIPSetsRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T> int getIndex(List<T> l, T o, int fromIndex) {
int i = -1;
for (T o1 : l) {
i++;
if (i < fromIndex) {
continue;
}
if (o.equals(o1)) {
return i;
}
}
return -1;
} } | public class class_name {
public static <T> int getIndex(List<T> l, T o, int fromIndex) {
int i = -1;
for (T o1 : l) {
i++;
// depends on control dependency: [for], data = [none]
if (i < fromIndex) {
continue;
}
if (o.equals(o1)) {
return i;
// depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
public Object newInstance(String className) {
try {
return classLoader.loadClass(className).newInstance();
} catch (Exception e) {
throw new ScalaInstanceNotFound(className);
}
} } | public class class_name {
public Object newInstance(String className) {
try {
return classLoader.loadClass(className).newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ScalaInstanceNotFound(className);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void parseAvps(Document doc) {
// Format: <avpdefn name="Talk-Burst-Volume" code="1256" vendor-id="TGPP" mandatory="must" protected="may" may-encrypt="true" vendor-bit="must" >
// <type type-name="Unsigned32" />
// </avpdefn>
NodeList avpDefnNodes = doc.getElementsByTagName("avpdefn");
for (int i = 0; i < avpDefnNodes.getLength(); i++) {
Node avpNode = avpDefnNodes.item(i);
Element avpDefnElement = (Element) avpNode;
String avpName = avpDefnElement.getAttribute("name");
String avpCode = avpDefnElement.getAttribute("code");
String avpVendorId = avpDefnElement.getAttribute("vendor-id");
String avpMandatory = avpDefnElement.getAttribute("mandatory");
String avpProtected = avpDefnElement.getAttribute("protected").equals("") ? "may" : avpDefnElement.getAttribute("protected");
String avpMayEncrypt = avpDefnElement.getAttribute("may-encrypt");
String avpVendorBit = avpDefnElement.getAttribute("vendor-bit");
long vendorCode = getVendorCode(avpVendorId);
// Let's figure out the type
// It can be:
// <type type-name="UTF8String" />
// OR
// <grouped> <avp name="PoC-Change-Time" multiplicity="1" /> ... </grouped>
// OR
// <type type-name="Enumerated"> <enum code="0" name="MULTICAST" /> ... </enumerated>
String avpOriginalType = UNDEFINED_AVP_TYPE;
String avpType = avpOriginalType;
List<AvpRepresentation> groupedAvpChilds = new ArrayList<AvpRepresentation>();
NodeList avpDefnChildNodes = avpNode.getChildNodes();
for (int j = 0; j < avpDefnChildNodes.getLength(); j++) {
Node avpDefnChildNode = avpDefnChildNodes.item(j);
if (avpDefnChildNode.getNodeType() == Node.ELEMENT_NODE) {
Element avpDefnChildElement = (Element) avpDefnChildNode;
if (avpDefnChildElement.getNodeName().equals("grouped")) {
avpOriginalType = "Grouped";
avpType = avpOriginalType;
// Let's fetch the childs
// Format: <avp name="PoC-Change-Time" multiplicity="1" />
NodeList groupedAvpMembers = avpDefnChildElement.getChildNodes();
for (int gChildIndex = 0; gChildIndex < groupedAvpMembers.getLength(); gChildIndex++) {
Node groupedAvpChildNode = groupedAvpMembers.item(gChildIndex);
if (groupedAvpChildNode.getNodeType() == Node.ELEMENT_NODE) {
Element groupedAvpChildElement = (Element) groupedAvpChildNode;
String childName = null;
String childMultiplicity = AVP_DEFAULT_MULTIPLICITY;
String childIndexIndicator = AVP_DEFAULT_INDEX;
if (!groupedAvpChildElement.hasAttribute("name")) {
if (logger.isDebugEnabled()) {
logger.debug(new StringBuffer("[ERROR] Grouped child does not have name, grouped avp: Name[").append(avpName).append("] Description[")
.append("").append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory[")
.append(avpMandatory).append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id [")
.append(avpVendorId).append("] Constrained[").append("").append("] Type [").append(avpType).append("]").toString());
}
continue;
}
else {
childName = groupedAvpChildElement.getAttribute("name");
}
childMultiplicity = groupedAvpChildElement.hasAttribute("multiplicity") ?
groupedAvpChildElement.getAttribute("multiplicity") : AvpRepresentation._MP_ZERO_OR_MORE;
childIndexIndicator = groupedAvpChildElement.hasAttribute("index") ?
groupedAvpChildElement.getAttribute("index") : "-1";
// have we parsed this child definition already?
AvpRepresentation childRep = this.avpByNameMap.get(childName);
AvpRepresentationImpl child = null;
if (childRep != null) {
try {
child = (AvpRepresentationImpl) childRep.clone();
}
catch (CloneNotSupportedException cnse) {
// It should not happen, but anyway
if (logger.isWarnEnabled()) {
logger.warn("Unable to clone AVP " + childRep, cnse);
}
}
}
else {
child = new AvpRepresentationImpl(childName, vendorCode);
child.markWeak(true);
}
child.setMultiplicityIndicator(childMultiplicity);
child.markFixPosition(Integer.valueOf(childIndexIndicator));
groupedAvpChilds.add(child);
}
}
}
else if (avpDefnChildElement.getNodeName().equals("type")) {
avpOriginalType = avpDefnChildElement.getAttribute("type-name");
avpType = avpOriginalType;
//FIXME: baranowb: why this is like that? This changes type of AVP to primitive ONE..? Checks against type dont make sense, ie to check for Address type...
avpType = typedefMap.get(avpType);
if (avpType == null) {
logger.warn("Unknown AVP Type ({}) for AVP with code {} and vendor-id {} ",
new Object[] { avpDefnChildElement.getAttribute("type-name"), avpCode, avpVendorId});
}
}
else {
logger.warn("Unknown AVP Definition child element for AVP with code {} and vendor-id {} ", avpCode, avpVendorId);
}
}
}
try {
AvpRepresentationImpl avp = null;
avp = new AvpRepresentationImpl(avpName, "N/A", Integer.valueOf(avpCode), avpMayEncrypt.equals("yes"), avpMandatory,
avpProtected, avpVendorBit, vendorCode, avpOriginalType, avpType);
if (avp.isGrouped()) {
avp.setChildren(groupedAvpChilds);
// we are not strong enough, children are referenced ONLY by name, so we are
// weak until all children can be resolved to strong representation
avp.markWeak(true);
}
resolveWeakLinks(avp);
AvpRepresentation existingAvp = null;
if ((existingAvp = avpMap.get(avp)) != null) {
logger.warn("Duplicated AVP Definition for AVP Code: {}, Vendor-Id: {}. See TRACE logs for definitions.", avp.getCode(), avp.getVendorId());
logger.trace("Existing AVP:\r\n {}\r\n New AVP:\r\n {}", existingAvp, avp);
}
else {
avpMap.put(avp, avp);
}
AvpRepresentation oldAvp = avpByNameMap.put(avp.getName(), avp);
if (oldAvp != null) {
logger.debug("[WARN] Overwrited definition of AVP with the same name: Old: {}, New: {}", new Object[] { oldAvp, avp });
}
}
catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug(new StringBuffer("[ERROR] Failed Parsing AVP: Name[").append(avpName).append("] Description[").append("N/A").
append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory[").append(avpMandatory).
append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id [").append(avpVendorId).
append("] Constrained[").append("N/A").append("] OriginalType [").append(avpOriginalType).
append("] Type [").append(avpType).append("]").toString(), e);
}
}
}
for (AvpRepresentation rep : avpMap.values()) {
markWeaks((AvpRepresentationImpl) rep);
}
} } | public class class_name {
protected void parseAvps(Document doc) {
// Format: <avpdefn name="Talk-Burst-Volume" code="1256" vendor-id="TGPP" mandatory="must" protected="may" may-encrypt="true" vendor-bit="must" >
// <type type-name="Unsigned32" />
// </avpdefn>
NodeList avpDefnNodes = doc.getElementsByTagName("avpdefn");
for (int i = 0; i < avpDefnNodes.getLength(); i++) {
Node avpNode = avpDefnNodes.item(i);
Element avpDefnElement = (Element) avpNode;
String avpName = avpDefnElement.getAttribute("name");
String avpCode = avpDefnElement.getAttribute("code");
String avpVendorId = avpDefnElement.getAttribute("vendor-id");
String avpMandatory = avpDefnElement.getAttribute("mandatory");
String avpProtected = avpDefnElement.getAttribute("protected").equals("") ? "may" : avpDefnElement.getAttribute("protected");
String avpMayEncrypt = avpDefnElement.getAttribute("may-encrypt");
String avpVendorBit = avpDefnElement.getAttribute("vendor-bit");
long vendorCode = getVendorCode(avpVendorId);
// Let's figure out the type
// It can be:
// <type type-name="UTF8String" />
// OR
// <grouped> <avp name="PoC-Change-Time" multiplicity="1" /> ... </grouped>
// OR
// <type type-name="Enumerated"> <enum code="0" name="MULTICAST" /> ... </enumerated>
String avpOriginalType = UNDEFINED_AVP_TYPE;
String avpType = avpOriginalType;
List<AvpRepresentation> groupedAvpChilds = new ArrayList<AvpRepresentation>();
NodeList avpDefnChildNodes = avpNode.getChildNodes();
for (int j = 0; j < avpDefnChildNodes.getLength(); j++) {
Node avpDefnChildNode = avpDefnChildNodes.item(j);
if (avpDefnChildNode.getNodeType() == Node.ELEMENT_NODE) {
Element avpDefnChildElement = (Element) avpDefnChildNode;
if (avpDefnChildElement.getNodeName().equals("grouped")) {
avpOriginalType = "Grouped";
// depends on control dependency: [if], data = [none]
avpType = avpOriginalType;
// depends on control dependency: [if], data = [none]
// Let's fetch the childs
// Format: <avp name="PoC-Change-Time" multiplicity="1" />
NodeList groupedAvpMembers = avpDefnChildElement.getChildNodes();
for (int gChildIndex = 0; gChildIndex < groupedAvpMembers.getLength(); gChildIndex++) {
Node groupedAvpChildNode = groupedAvpMembers.item(gChildIndex);
if (groupedAvpChildNode.getNodeType() == Node.ELEMENT_NODE) {
Element groupedAvpChildElement = (Element) groupedAvpChildNode;
String childName = null;
String childMultiplicity = AVP_DEFAULT_MULTIPLICITY;
String childIndexIndicator = AVP_DEFAULT_INDEX;
if (!groupedAvpChildElement.hasAttribute("name")) {
if (logger.isDebugEnabled()) {
logger.debug(new StringBuffer("[ERROR] Grouped child does not have name, grouped avp: Name[").append(avpName).append("] Description[")
.append("").append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory[")
.append(avpMandatory).append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id [")
.append(avpVendorId).append("] Constrained[").append("").append("] Type [").append(avpType).append("]").toString());
// depends on control dependency: [if], data = [none]
}
continue;
}
else {
childName = groupedAvpChildElement.getAttribute("name");
// depends on control dependency: [if], data = [none]
}
childMultiplicity = groupedAvpChildElement.hasAttribute("multiplicity") ?
groupedAvpChildElement.getAttribute("multiplicity") : AvpRepresentation._MP_ZERO_OR_MORE;
// depends on control dependency: [if], data = [none]
childIndexIndicator = groupedAvpChildElement.hasAttribute("index") ?
groupedAvpChildElement.getAttribute("index") : "-1";
// depends on control dependency: [if], data = [none]
// have we parsed this child definition already?
AvpRepresentation childRep = this.avpByNameMap.get(childName);
AvpRepresentationImpl child = null;
if (childRep != null) {
try {
child = (AvpRepresentationImpl) childRep.clone();
// depends on control dependency: [try], data = [none]
}
catch (CloneNotSupportedException cnse) {
// It should not happen, but anyway
if (logger.isWarnEnabled()) {
logger.warn("Unable to clone AVP " + childRep, cnse);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
}
else {
child = new AvpRepresentationImpl(childName, vendorCode);
// depends on control dependency: [if], data = [none]
child.markWeak(true);
// depends on control dependency: [if], data = [none]
}
child.setMultiplicityIndicator(childMultiplicity);
// depends on control dependency: [if], data = [none]
child.markFixPosition(Integer.valueOf(childIndexIndicator));
// depends on control dependency: [if], data = [none]
groupedAvpChilds.add(child);
// depends on control dependency: [if], data = [none]
}
}
}
else if (avpDefnChildElement.getNodeName().equals("type")) {
avpOriginalType = avpDefnChildElement.getAttribute("type-name");
// depends on control dependency: [if], data = [none]
avpType = avpOriginalType;
// depends on control dependency: [if], data = [none]
//FIXME: baranowb: why this is like that? This changes type of AVP to primitive ONE..? Checks against type dont make sense, ie to check for Address type...
avpType = typedefMap.get(avpType);
// depends on control dependency: [if], data = [none]
if (avpType == null) {
logger.warn("Unknown AVP Type ({}) for AVP with code {} and vendor-id {} ",
new Object[] { avpDefnChildElement.getAttribute("type-name"), avpCode, avpVendorId});
// depends on control dependency: [if], data = [none]
}
}
else {
logger.warn("Unknown AVP Definition child element for AVP with code {} and vendor-id {} ", avpCode, avpVendorId);
// depends on control dependency: [if], data = [none]
}
}
}
try {
AvpRepresentationImpl avp = null;
avp = new AvpRepresentationImpl(avpName, "N/A", Integer.valueOf(avpCode), avpMayEncrypt.equals("yes"), avpMandatory,
avpProtected, avpVendorBit, vendorCode, avpOriginalType, avpType);
if (avp.isGrouped()) {
avp.setChildren(groupedAvpChilds);
// depends on control dependency: [if], data = [none]
// we are not strong enough, children are referenced ONLY by name, so we are
// weak until all children can be resolved to strong representation
avp.markWeak(true);
// depends on control dependency: [if], data = [none]
}
resolveWeakLinks(avp);
AvpRepresentation existingAvp = null;
if ((existingAvp = avpMap.get(avp)) != null) {
logger.warn("Duplicated AVP Definition for AVP Code: {}, Vendor-Id: {}. See TRACE logs for definitions.", avp.getCode(), avp.getVendorId());
logger.trace("Existing AVP:\r\n {}\r\n New AVP:\r\n {}", existingAvp, avp);
}
else {
avpMap.put(avp, avp);
}
AvpRepresentation oldAvp = avpByNameMap.put(avp.getName(), avp);
if (oldAvp != null) {
logger.debug("[WARN] Overwrited definition of AVP with the same name: Old: {}, New: {}", new Object[] { oldAvp, avp });
}
}
catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug(new StringBuffer("[ERROR] Failed Parsing AVP: Name[").append(avpName).append("] Description[").append("N/A").
append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory[").append(avpMandatory).
append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id [").append(avpVendorId).
append("] Constrained[").append("N/A").append("] OriginalType [").append(avpOriginalType).
append("] Type [").append(avpType).append("]").toString(), e);
}
}
}
for (AvpRepresentation rep : avpMap.values()) {
markWeaks((AvpRepresentationImpl) rep);
}
} } |
public class class_name {
protected String getPath( final Bundle bundle )
{
if( m_pathManifestHeader != null )
{
final Object value = bundle.getHeaders().get( m_pathManifestHeader );
if( value instanceof String && ( (String) value ).trim().length() > 0 )
{
String path = (String) value;
if( !path.endsWith( "/" ) )
{
path = path + "/";
}
return path;
}
}
return m_path;
} } | public class class_name {
protected String getPath( final Bundle bundle )
{
if( m_pathManifestHeader != null )
{
final Object value = bundle.getHeaders().get( m_pathManifestHeader );
if( value instanceof String && ( (String) value ).trim().length() > 0 )
{
String path = (String) value;
if( !path.endsWith( "/" ) )
{
path = path + "/"; // depends on control dependency: [if], data = [none]
}
return path; // depends on control dependency: [if], data = [none]
}
}
return m_path;
} } |
public class class_name {
private void finishData() {
if (!savedChunks) {
md5 = Util.toHex(messageDigester.digest());
messageDigester = null;
length = totalBytes;
savedChunks = true;
try {
if (inputStream != null && closeStreamOnPersist) {
inputStream.close();
}
} catch (IOException e) {
//ignore
}
}
} } | public class class_name {
private void finishData() {
if (!savedChunks) {
md5 = Util.toHex(messageDigester.digest()); // depends on control dependency: [if], data = [none]
messageDigester = null; // depends on control dependency: [if], data = [none]
length = totalBytes; // depends on control dependency: [if], data = [none]
savedChunks = true; // depends on control dependency: [if], data = [none]
try {
if (inputStream != null && closeStreamOnPersist) {
inputStream.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
//ignore
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public void addLink(String name1, String name2, String... domain) {
if (domain.length == 1) {
name1 = domain[0] + "::" + name1;
name2 = domain[0] + "::" + name2;
} else if (domain.length > 1) {
throw new Error("error: domain should be 1 parameter");
}
Role role1 = createRole(name1);
Role role2 = createRole(name2);
role1.addRole(role2);
} } | public class class_name {
@Override
public void addLink(String name1, String name2, String... domain) {
if (domain.length == 1) {
name1 = domain[0] + "::" + name1; // depends on control dependency: [if], data = [none]
name2 = domain[0] + "::" + name2; // depends on control dependency: [if], data = [none]
} else if (domain.length > 1) {
throw new Error("error: domain should be 1 parameter");
}
Role role1 = createRole(name1);
Role role2 = createRole(name2);
role1.addRole(role2);
} } |
public class class_name {
@Override
public void inject(Configuration config) {
Set<Field> fields = config.getInjectionTargets(InjectionCategory.POJO);
for (Field field : fields) {
if(!field.isAccessible()) field.setAccessible(true);
try {
Class<?> fieldType = field.getType();
Class<? extends Object> pojoType = null;
if(field.getAnnotation(InjectPojo.class).value().equals(Void.class)) {
if(!fieldType.isAnnotationPresent(Pojo.class)) {
StringBuilder builder = new StringBuilder()
.append("Pojo injection failed on ")
.append(field.getName())
.append(". Please provide the missing class attribute on @InjectPojo. ")
.append(" Or else specify the default implementation using @Pojo on ")
.append(fieldType.getName())
.append(". ");
throw new InjectionException(builder.toString());
}
pojoType = fieldType.getAnnotation(Pojo.class).value();
}
else {
pojoType = field.getAnnotation(InjectPojo.class).value();
}
field.set(config.getContext(), pojoType.newInstance());
}
catch (Exception e) {
Log.e(getClass().getName(), "Injection Failed!", e);
}
}
} } | public class class_name {
@Override
public void inject(Configuration config) {
Set<Field> fields = config.getInjectionTargets(InjectionCategory.POJO);
for (Field field : fields) {
if(!field.isAccessible()) field.setAccessible(true);
try {
Class<?> fieldType = field.getType();
Class<? extends Object> pojoType = null; // depends on control dependency: [try], data = [none]
if(field.getAnnotation(InjectPojo.class).value().equals(Void.class)) {
if(!fieldType.isAnnotationPresent(Pojo.class)) {
StringBuilder builder = new StringBuilder()
.append("Pojo injection failed on ")
.append(field.getName())
.append(". Please provide the missing class attribute on @InjectPojo. ")
.append(" Or else specify the default implementation using @Pojo on ")
.append(fieldType.getName())
.append(". "); // depends on control dependency: [if], data = [none]
throw new InjectionException(builder.toString());
}
pojoType = fieldType.getAnnotation(Pojo.class).value(); // depends on control dependency: [if], data = [none]
}
else {
pojoType = field.getAnnotation(InjectPojo.class).value(); // depends on control dependency: [if], data = [none]
}
field.set(config.getContext(), pojoType.newInstance()); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
Log.e(getClass().getName(), "Injection Failed!", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public Observable<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>> listWithServiceResponseAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath, ItemScope scope, ItemTypeParameter type, Boolean includeContent) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (scopePath == null) {
throw new IllegalArgumentException("Parameter scopePath is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.list(this.client.subscriptionId(), resourceGroupName, resourceName, scopePath, this.client.apiVersion(), scope, type, includeContent, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>>>() {
@Override
public Observable<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>> clientResponse = listDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>> listWithServiceResponseAsync(String resourceGroupName, String resourceName, ItemScopePath scopePath, ItemScope scope, ItemTypeParameter type, Boolean includeContent) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (scopePath == null) {
throw new IllegalArgumentException("Parameter scopePath is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.list(this.client.subscriptionId(), resourceGroupName, resourceName, scopePath, this.client.apiVersion(), scope, type, includeContent, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>>>() {
@Override
public Observable<ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<ApplicationInsightsComponentAnalyticsItemInner>> clientResponse = listDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public void restore(ObjectInputStream ois, int dataVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc, "restore",new Object[] { ois, new Integer(dataVersion) });
try
{
HashMap hm = (HashMap)ois.readObject();
final byte meuuid[] = (byte[])hm.get("iMEUuid");
iMEUuid = new SIBUuid8(meuuid);
iBusId = (String)hm.get("iBusId");
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.Neighbour.restore",
"1:1057:1.107",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.proxyhandler.Neighbour",
"1:1064:1.107",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restore", "SIErrorException");
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.proxyhandler.Neighbour",
"1:1074:1.107",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restore");
} } | public class class_name {
public void restore(ObjectInputStream ois, int dataVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc, "restore",new Object[] { ois, new Integer(dataVersion) });
try
{
HashMap hm = (HashMap)ois.readObject();
final byte meuuid[] = (byte[])hm.get("iMEUuid");
iMEUuid = new SIBUuid8(meuuid); // depends on control dependency: [try], data = [none]
iBusId = (String)hm.get("iBusId"); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.proxyhandler.Neighbour.restore",
"1:1057:1.107",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.proxyhandler.Neighbour",
"1:1064:1.107",
e });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restore", "SIErrorException");
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.proxyhandler.Neighbour",
"1:1074:1.107",
e },
null),
e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "restore");
} } |
public class class_name {
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final RelativeLayout rl = new RelativeLayout(this);
this.mMapView = new MapView(this);
this.mMapView.setTilesScaledToDpi(true);
rl.addView(this.mMapView, new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
/* Itemized Overlay */
{
/* Create a static ItemizedOverlay showing a some Markers on some cities. */
final ArrayList<OverlayItem> items = new ArrayList<>();
items.add(new OverlayItem("Hannover", "SampleDescription", new GeoPoint(52.370816, 9.735936)));
items.add(new OverlayItem("Berlin", "SampleDescription", new GeoPoint(52.518333, 13.408333)));
items.add(new OverlayItem("Washington", "SampleDescription", new GeoPoint(38.895000, -77.036667)));
items.add(new OverlayItem("San Francisco", "SampleDescription", new GeoPoint(37.779300, -122.419200)));
items.add(new OverlayItem("Tolaga Bay", "SampleDescription", new GeoPoint(-38.371000, 178.298000)));
/* OnTapListener for the Markers, shows a simple Toast. */
this.mMyLocationOverlay = new ItemizedIconOverlay<>(items,
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
Toast.makeText(
SampleWithMinimapItemizedoverlay.this,
"Item '" + item.getTitle() + "' (index=" + index
+ ") got single tapped up", Toast.LENGTH_LONG).show();
return true; // We 'handled' this event.
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
Toast.makeText(
SampleWithMinimapItemizedoverlay.this,
"Item '" + item.getTitle() + "' (index=" + index
+ ") got long pressed", Toast.LENGTH_LONG).show();
return true;
}
}, getApplicationContext());
this.mMapView.getOverlays().add(this.mMyLocationOverlay);
}
/* MiniMap */
{
final MinimapOverlay miniMapOverlay = new MinimapOverlay(this,
mMapView.getTileRequestCompleteHandler());
this.mMapView.getOverlays().add(miniMapOverlay);
}
/* list of items currently displayed */
{
final MapEventsReceiver mReceive = new MapEventsReceiver() {
@Override
public boolean singleTapConfirmedHelper(GeoPoint p) {
return false;
}
@Override
public boolean longPressHelper(final GeoPoint p) {
final List<OverlayItem> displayed = mMyLocationOverlay.getDisplayedItems();
final StringBuilder buffer = new StringBuilder();
String sep = "";
for (final OverlayItem item : displayed) {
buffer.append(sep).append('\'').append(item.getTitle()).append('\'');
sep = ", ";
}
Toast.makeText(
SampleWithMinimapItemizedoverlay.this,
"Currently displayed: " + buffer.toString(), Toast.LENGTH_LONG).show();
return true;
}
};
mMapView.getOverlays().add(new MapEventsOverlay(mReceive));
final RotationGestureOverlay rotationGestureOverlay = new RotationGestureOverlay(mMapView);
rotationGestureOverlay.setEnabled(true);
mMapView.getOverlays().add(rotationGestureOverlay);
}
this.setContentView(rl);
// Default location and zoom level
IMapController mapController = mMapView.getController();
mapController.setZoom(5.);
GeoPoint startPoint = new GeoPoint(50.936255, 6.957779);
mapController.setCenter(startPoint);
} } | public class class_name {
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final RelativeLayout rl = new RelativeLayout(this);
this.mMapView = new MapView(this);
this.mMapView.setTilesScaledToDpi(true);
rl.addView(this.mMapView, new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
/* Itemized Overlay */
{
/* Create a static ItemizedOverlay showing a some Markers on some cities. */
final ArrayList<OverlayItem> items = new ArrayList<>();
items.add(new OverlayItem("Hannover", "SampleDescription", new GeoPoint(52.370816, 9.735936)));
items.add(new OverlayItem("Berlin", "SampleDescription", new GeoPoint(52.518333, 13.408333)));
items.add(new OverlayItem("Washington", "SampleDescription", new GeoPoint(38.895000, -77.036667)));
items.add(new OverlayItem("San Francisco", "SampleDescription", new GeoPoint(37.779300, -122.419200)));
items.add(new OverlayItem("Tolaga Bay", "SampleDescription", new GeoPoint(-38.371000, 178.298000)));
/* OnTapListener for the Markers, shows a simple Toast. */
this.mMyLocationOverlay = new ItemizedIconOverlay<>(items,
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
Toast.makeText(
SampleWithMinimapItemizedoverlay.this,
"Item '" + item.getTitle() + "' (index=" + index
+ ") got single tapped up", Toast.LENGTH_LONG).show();
return true; // We 'handled' this event.
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
Toast.makeText(
SampleWithMinimapItemizedoverlay.this,
"Item '" + item.getTitle() + "' (index=" + index
+ ") got long pressed", Toast.LENGTH_LONG).show();
return true;
}
}, getApplicationContext());
this.mMapView.getOverlays().add(this.mMyLocationOverlay);
}
/* MiniMap */
{
final MinimapOverlay miniMapOverlay = new MinimapOverlay(this,
mMapView.getTileRequestCompleteHandler());
this.mMapView.getOverlays().add(miniMapOverlay);
}
/* list of items currently displayed */
{
final MapEventsReceiver mReceive = new MapEventsReceiver() {
@Override
public boolean singleTapConfirmedHelper(GeoPoint p) {
return false;
}
@Override
public boolean longPressHelper(final GeoPoint p) {
final List<OverlayItem> displayed = mMyLocationOverlay.getDisplayedItems();
final StringBuilder buffer = new StringBuilder();
String sep = "";
for (final OverlayItem item : displayed) {
buffer.append(sep).append('\'').append(item.getTitle()).append('\''); // depends on control dependency: [for], data = [item]
sep = ", "; // depends on control dependency: [for], data = [none]
}
Toast.makeText(
SampleWithMinimapItemizedoverlay.this,
"Currently displayed: " + buffer.toString(), Toast.LENGTH_LONG).show();
return true;
}
};
mMapView.getOverlays().add(new MapEventsOverlay(mReceive));
final RotationGestureOverlay rotationGestureOverlay = new RotationGestureOverlay(mMapView);
rotationGestureOverlay.setEnabled(true);
mMapView.getOverlays().add(rotationGestureOverlay);
}
this.setContentView(rl);
// Default location and zoom level
IMapController mapController = mMapView.getController();
mapController.setZoom(5.);
GeoPoint startPoint = new GeoPoint(50.936255, 6.957779);
mapController.setCenter(startPoint);
} } |
public class class_name {
public static void replaceComponent(Component component, Component replacement) {
if (!component.isAttached()) {
throw new IllegalArgumentException("Component must be attached");
}
HasComponents parent = component.getParent();
if (parent instanceof ComponentContainer) {
((ComponentContainer)parent).replaceComponent(component, replacement);
} else if (parent instanceof SingleComponentContainer) {
((SingleComponentContainer)parent).setContent(replacement);
} else {
throw new IllegalArgumentException("Illegal class for parent: " + parent.getClass());
}
} } | public class class_name {
public static void replaceComponent(Component component, Component replacement) {
if (!component.isAttached()) {
throw new IllegalArgumentException("Component must be attached");
}
HasComponents parent = component.getParent();
if (parent instanceof ComponentContainer) {
((ComponentContainer)parent).replaceComponent(component, replacement); // depends on control dependency: [if], data = [none]
} else if (parent instanceof SingleComponentContainer) {
((SingleComponentContainer)parent).setContent(replacement); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Illegal class for parent: " + parent.getClass());
}
} } |
public class class_name {
protected void logRegistration(Set<String> deploymentIds, ProcessApplicationReference reference) {
if (!LOG.isInfoEnabled()) {
// building the log message is expensive (db queries) so we avoid it if we can
return;
}
try {
StringBuilder builder = new StringBuilder();
builder.append("ProcessApplication '");
builder.append(reference.getName());
builder.append("' registered for DB deployments ");
builder.append(deploymentIds);
builder.append(". ");
List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
List<CaseDefinition> caseDefinitions = new ArrayList<CaseDefinition>();
CommandContext commandContext = Context.getCommandContext();
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
boolean cmmnEnabled = processEngineConfiguration.isCmmnEnabled();
for (String deploymentId : deploymentIds) {
DeploymentEntity deployment = commandContext
.getDbEntityManager()
.selectById(DeploymentEntity.class, deploymentId);
if(deployment != null) {
processDefinitions.addAll(getDeployedProcessDefinitionArtifacts(deployment));
if (cmmnEnabled) {
caseDefinitions.addAll(getDeployedCaseDefinitionArtifacts(deployment));
}
}
}
logProcessDefinitionRegistrations(builder, processDefinitions);
if (cmmnEnabled) {
logCaseDefinitionRegistrations(builder, caseDefinitions);
}
LOG.registrationSummary(builder.toString());
}
catch(Throwable e) {
LOG.exceptionWhileLoggingRegistrationSummary(e);
}
} } | public class class_name {
protected void logRegistration(Set<String> deploymentIds, ProcessApplicationReference reference) {
if (!LOG.isInfoEnabled()) {
// building the log message is expensive (db queries) so we avoid it if we can
return; // depends on control dependency: [if], data = [none]
}
try {
StringBuilder builder = new StringBuilder();
builder.append("ProcessApplication '");
builder.append(reference.getName());
builder.append("' registered for DB deployments "); // depends on control dependency: [try], data = [none]
builder.append(deploymentIds); // depends on control dependency: [try], data = [none]
builder.append(". "); // depends on control dependency: [try], data = [none]
List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
List<CaseDefinition> caseDefinitions = new ArrayList<CaseDefinition>();
CommandContext commandContext = Context.getCommandContext();
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
boolean cmmnEnabled = processEngineConfiguration.isCmmnEnabled();
for (String deploymentId : deploymentIds) {
DeploymentEntity deployment = commandContext
.getDbEntityManager()
.selectById(DeploymentEntity.class, deploymentId);
if(deployment != null) {
processDefinitions.addAll(getDeployedProcessDefinitionArtifacts(deployment)); // depends on control dependency: [if], data = [(deployment]
if (cmmnEnabled) {
caseDefinitions.addAll(getDeployedCaseDefinitionArtifacts(deployment)); // depends on control dependency: [if], data = [none]
}
}
}
logProcessDefinitionRegistrations(builder, processDefinitions); // depends on control dependency: [try], data = [none]
if (cmmnEnabled) {
logCaseDefinitionRegistrations(builder, caseDefinitions); // depends on control dependency: [if], data = [none]
}
LOG.registrationSummary(builder.toString()); // depends on control dependency: [try], data = [none]
}
catch(Throwable e) {
LOG.exceptionWhileLoggingRegistrationSummary(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String repositoryUrl(Request request) {
String requestURL = request.uri();
int delimiterSegmentIdx = requestURL.length();
for (String methodName : ALL_METHODS) {
if (requestURL.indexOf(methodName) != -1) {
delimiterSegmentIdx = requestURL.indexOf(methodName);
break;
}
}
return requestURL.substring(0, delimiterSegmentIdx);
} } | public class class_name {
public static String repositoryUrl(Request request) {
String requestURL = request.uri();
int delimiterSegmentIdx = requestURL.length();
for (String methodName : ALL_METHODS) {
if (requestURL.indexOf(methodName) != -1) {
delimiterSegmentIdx = requestURL.indexOf(methodName); // depends on control dependency: [if], data = [none]
break;
}
}
return requestURL.substring(0, delimiterSegmentIdx);
} } |
public class class_name {
public void setTaskExecutions(java.util.Collection<TaskExecutionListEntry> taskExecutions) {
if (taskExecutions == null) {
this.taskExecutions = null;
return;
}
this.taskExecutions = new java.util.ArrayList<TaskExecutionListEntry>(taskExecutions);
} } | public class class_name {
public void setTaskExecutions(java.util.Collection<TaskExecutionListEntry> taskExecutions) {
if (taskExecutions == null) {
this.taskExecutions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.taskExecutions = new java.util.ArrayList<TaskExecutionListEntry>(taskExecutions);
} } |
public class class_name {
private void determineProxyIpAnyLocalAddress() {
try {
proxyIpAnyLocalAddress = proxyIp.isEmpty() || InetAddress.getByName(proxyIp).isAnyLocalAddress();
} catch (UnknownHostException e) {
proxyIpAnyLocalAddress = false;
}
} } | public class class_name {
private void determineProxyIpAnyLocalAddress() {
try {
proxyIpAnyLocalAddress = proxyIp.isEmpty() || InetAddress.getByName(proxyIp).isAnyLocalAddress();
// depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
proxyIpAnyLocalAddress = false;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private List<Object> eval(Iterable<ExpressionContext> expressions) {
List<Object> results = new ArrayList<Object>();
for (ExpressionContext expression : expressions) {
results.add(eval(expression));
}
return results;
} } | public class class_name {
private List<Object> eval(Iterable<ExpressionContext> expressions) {
List<Object> results = new ArrayList<Object>();
for (ExpressionContext expression : expressions) {
results.add(eval(expression)); // depends on control dependency: [for], data = [expression]
}
return results;
} } |
public class class_name {
public boolean next() {
checkState();
if (mPlayerPlaylist.isEmpty()) {
return false;
}
PlaybackService.play(getContext(), mClientKey, mPlayerPlaylist.next());
return true;
} } | public class class_name {
public boolean next() {
checkState();
if (mPlayerPlaylist.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
PlaybackService.play(getContext(), mClientKey, mPlayerPlaylist.next());
return true;
} } |
public class class_name {
@Override
public void consumeLine(final String line) {
sb.append(line).append(LINE_SEPARATOR);
String logMessage = logMessagePrefix != null ? logMessagePrefix + line : line;
if (error) {
logger.error(logMessage);
} else {
logger.info(logMessage);
}
} } | public class class_name {
@Override
public void consumeLine(final String line) {
sb.append(line).append(LINE_SEPARATOR);
String logMessage = logMessagePrefix != null ? logMessagePrefix + line : line;
if (error) {
logger.error(logMessage);
// depends on control dependency: [if], data = [none]
} else {
logger.info(logMessage);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T> MutableLongCollection collectLong(
Iterable<T> iterable,
LongFunction<? super T> longFunction)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).collectLong(longFunction);
}
if (iterable instanceof ArrayList)
{
return ArrayListIterate.collectLong((ArrayList<T>) iterable, longFunction);
}
if (iterable instanceof List)
{
return ListIterate.collectLong((List<T>) iterable, longFunction);
}
if (iterable != null)
{
return IterableIterate.collectLong(iterable, longFunction);
}
throw new IllegalArgumentException("Cannot perform a collectLong on null");
} } | public class class_name {
public static <T> MutableLongCollection collectLong(
Iterable<T> iterable,
LongFunction<? super T> longFunction)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).collectLong(longFunction); // depends on control dependency: [if], data = [none]
}
if (iterable instanceof ArrayList)
{
return ArrayListIterate.collectLong((ArrayList<T>) iterable, longFunction); // depends on control dependency: [if], data = [none]
}
if (iterable instanceof List)
{
return ListIterate.collectLong((List<T>) iterable, longFunction); // depends on control dependency: [if], data = [none]
}
if (iterable != null)
{
return IterableIterate.collectLong(iterable, longFunction); // depends on control dependency: [if], data = [(iterable]
}
throw new IllegalArgumentException("Cannot perform a collectLong on null");
} } |
public class class_name {
public Iterator<Integer> searchAll(RuleQuery query) {
SearchRequestBuilder esSearch = client
.prepareSearch(TYPE_RULE)
.setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES));
optimizeScrollRequest(esSearch);
QueryBuilder qb = buildQuery(query);
Map<String, QueryBuilder> filters = buildFilters(query);
BoolQueryBuilder fb = boolQuery();
for (QueryBuilder filterBuilder : filters.values()) {
fb.must(filterBuilder);
}
esSearch.setQuery(boolQuery().must(qb).filter(fb));
SearchResponse response = esSearch.get();
return scrollIds(client, response, Integer::parseInt);
} } | public class class_name {
public Iterator<Integer> searchAll(RuleQuery query) {
SearchRequestBuilder esSearch = client
.prepareSearch(TYPE_RULE)
.setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES));
optimizeScrollRequest(esSearch);
QueryBuilder qb = buildQuery(query);
Map<String, QueryBuilder> filters = buildFilters(query);
BoolQueryBuilder fb = boolQuery();
for (QueryBuilder filterBuilder : filters.values()) {
fb.must(filterBuilder); // depends on control dependency: [for], data = [filterBuilder]
}
esSearch.setQuery(boolQuery().must(qb).filter(fb));
SearchResponse response = esSearch.get();
return scrollIds(client, response, Integer::parseInt);
} } |
public class class_name {
public CMAUiExtension create(String spaceId, String environmentId, CMAUiExtension extension) {
assertNotNull(extension, "extension");
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
final String id = extension.getId();
final CMASystem system = extension.getSystem();
extension.setSystem(null);
try {
if (id == null) {
return service.create(spaceId, environmentId, extension).blockingFirst();
} else {
return service.create(spaceId, environmentId, id, extension).blockingFirst();
}
} finally {
extension.setSystem(system);
}
} } | public class class_name {
public CMAUiExtension create(String spaceId, String environmentId, CMAUiExtension extension) {
assertNotNull(extension, "extension");
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
final String id = extension.getId();
final CMASystem system = extension.getSystem();
extension.setSystem(null);
try {
if (id == null) {
return service.create(spaceId, environmentId, extension).blockingFirst(); // depends on control dependency: [if], data = [none]
} else {
return service.create(spaceId, environmentId, id, extension).blockingFirst(); // depends on control dependency: [if], data = [none]
}
} finally {
extension.setSystem(system);
}
} } |
public class class_name {
public void cascadeRemove(String id) {
Process entity = access().getProcess(id);
List<HistoryOrder> historyOrders = access().getHistoryOrders(null, new QueryFilter().setProcessId(id));
for(HistoryOrder historyOrder : historyOrders) {
ServiceContext.getEngine().order().cascadeRemove(historyOrder.getId());
}
access().deleteProcess(entity);
clear(entity);
} } | public class class_name {
public void cascadeRemove(String id) {
Process entity = access().getProcess(id);
List<HistoryOrder> historyOrders = access().getHistoryOrders(null, new QueryFilter().setProcessId(id));
for(HistoryOrder historyOrder : historyOrders) {
ServiceContext.getEngine().order().cascadeRemove(historyOrder.getId()); // depends on control dependency: [for], data = [historyOrder]
}
access().deleteProcess(entity);
clear(entity);
} } |
public class class_name {
public void pauseJob (@Nonnull final TriggerKey aTriggerKey)
{
ValueEnforcer.notNull (aTriggerKey, "TriggerKey");
try
{
m_aScheduler.pauseTrigger (aTriggerKey);
LOGGER.info ("Succesfully paused job with TriggerKey " + aTriggerKey.toString ());
}
catch (final SchedulerException ex)
{
LOGGER.error ("Failed to pause job with TriggerKey " + aTriggerKey.toString (), ex);
}
} } | public class class_name {
public void pauseJob (@Nonnull final TriggerKey aTriggerKey)
{
ValueEnforcer.notNull (aTriggerKey, "TriggerKey");
try
{
m_aScheduler.pauseTrigger (aTriggerKey); // depends on control dependency: [try], data = [none]
LOGGER.info ("Succesfully paused job with TriggerKey " + aTriggerKey.toString ()); // depends on control dependency: [try], data = [none]
}
catch (final SchedulerException ex)
{
LOGGER.error ("Failed to pause job with TriggerKey " + aTriggerKey.toString (), ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean writeStdCompare(int type, boolean simulate) {
type = type-COMPARE_NOT_EQUAL;
// look if really compare
if (type<0||type>7) return false;
if (!simulate) {
MethodVisitor mv = getController().getMethodVisitor();
OperandStack operandStack = getController().getOperandStack();
// operands are on the stack already
int bytecode = stdCompareCodes[type];
Label l1 = new Label();
mv.visitJumpInsn(bytecode,l1);
mv.visitInsn(ICONST_1);
Label l2 = new Label();
mv.visitJumpInsn(GOTO, l2);
mv.visitLabel(l1);
mv.visitInsn(ICONST_0);
mv.visitLabel(l2);
operandStack.replace(ClassHelper.boolean_TYPE, 2);
}
return true;
} } | public class class_name {
protected boolean writeStdCompare(int type, boolean simulate) {
type = type-COMPARE_NOT_EQUAL;
// look if really compare
if (type<0||type>7) return false;
if (!simulate) {
MethodVisitor mv = getController().getMethodVisitor();
OperandStack operandStack = getController().getOperandStack();
// operands are on the stack already
int bytecode = stdCompareCodes[type];
Label l1 = new Label();
mv.visitJumpInsn(bytecode,l1); // depends on control dependency: [if], data = [none]
mv.visitInsn(ICONST_1); // depends on control dependency: [if], data = [none]
Label l2 = new Label();
mv.visitJumpInsn(GOTO, l2); // depends on control dependency: [if], data = [none]
mv.visitLabel(l1); // depends on control dependency: [if], data = [none]
mv.visitInsn(ICONST_0); // depends on control dependency: [if], data = [none]
mv.visitLabel(l2); // depends on control dependency: [if], data = [none]
operandStack.replace(ClassHelper.boolean_TYPE, 2); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void marshall(UserPoolPolicyType userPoolPolicyType, ProtocolMarshaller protocolMarshaller) {
if (userPoolPolicyType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPoolPolicyType.getPasswordPolicy(), PASSWORDPOLICY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UserPoolPolicyType userPoolPolicyType, ProtocolMarshaller protocolMarshaller) {
if (userPoolPolicyType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPoolPolicyType.getPasswordPolicy(), PASSWORDPOLICY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void load() {
try {
File f = new File(persistFile.toString());
if (f.exists()) {
// we have V4 config
loadVer4(persistFile.toString());
} else {
String s1 = persistFile.toString().replace("3.xml", "2.xml");
f = new File(s1);
if (f.exists()) {
loadVer3(s1);
this.store();
f.delete();
} else {
s1 = persistFile.toString().replace("3.xml", ".xml");
f = new File(s1);
if (f.exists()) {
if (!loadVer1(s1)) {
loadVer2(s1);
}
}
this.store();
f.delete();
}
}
// File f = new File(persistFile.toString());
// if (f.exists()) {
// // we have V3 config
// loadVer3(persistFile.toString());
// } else {
// String s1 = persistFile.toString().replace("2.xml", ".xml");
// f = new File(s1);
//
// if (f.exists()) {
// if (!loadVer1(s1)) {
// loadVer2(s1);
// }
// }
//
// this.store();
// f.delete();
// }
} catch (XMLStreamException ex) {
ex.printStackTrace();
logger.error(String.format("Failed to load the SS7 configuration file. \n%s", ex.getMessage()));
} catch (FileNotFoundException e) {
logger.warn(String.format("Failed to load the SS7 configuration file. \n%s", e.getMessage()));
} catch (IOException e) {
logger.error(String.format("Failed to load the SS7 configuration file. \n%s", e.getMessage()));
}
} } | public class class_name {
public void load() {
try {
File f = new File(persistFile.toString());
if (f.exists()) {
// we have V4 config
loadVer4(persistFile.toString()); // depends on control dependency: [if], data = [none]
} else {
String s1 = persistFile.toString().replace("3.xml", "2.xml");
f = new File(s1); // depends on control dependency: [if], data = [none]
if (f.exists()) {
loadVer3(s1); // depends on control dependency: [if], data = [none]
this.store(); // depends on control dependency: [if], data = [none]
f.delete(); // depends on control dependency: [if], data = [none]
} else {
s1 = persistFile.toString().replace("3.xml", ".xml"); // depends on control dependency: [if], data = [none]
f = new File(s1); // depends on control dependency: [if], data = [none]
if (f.exists()) {
if (!loadVer1(s1)) {
loadVer2(s1); // depends on control dependency: [if], data = [none]
}
}
this.store(); // depends on control dependency: [if], data = [none]
f.delete(); // depends on control dependency: [if], data = [none]
}
}
// File f = new File(persistFile.toString());
// if (f.exists()) {
// // we have V3 config
// loadVer3(persistFile.toString());
// } else {
// String s1 = persistFile.toString().replace("2.xml", ".xml");
// f = new File(s1);
//
// if (f.exists()) {
// if (!loadVer1(s1)) {
// loadVer2(s1);
// }
// }
//
// this.store();
// f.delete();
// }
} catch (XMLStreamException ex) {
ex.printStackTrace();
logger.error(String.format("Failed to load the SS7 configuration file. \n%s", ex.getMessage()));
} catch (FileNotFoundException e) { // depends on control dependency: [catch], data = [none]
logger.warn(String.format("Failed to load the SS7 configuration file. \n%s", e.getMessage()));
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
logger.error(String.format("Failed to load the SS7 configuration file. \n%s", e.getMessage()));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Value<Boolean> or (final Iterable<Value<Boolean>> values)
{
MultiMappedValue<Boolean, Boolean> mapped =
new MultiMappedValue<Boolean, Boolean>(computeOr(values)) {
@Override protected Boolean recompute (Boolean ignored) {
return computeOr(values);
}
};
for (Value<Boolean> value : values) {
value.addListener(mapped);
}
return mapped;
} } | public class class_name {
public static Value<Boolean> or (final Iterable<Value<Boolean>> values)
{
MultiMappedValue<Boolean, Boolean> mapped =
new MultiMappedValue<Boolean, Boolean>(computeOr(values)) {
@Override protected Boolean recompute (Boolean ignored) {
return computeOr(values);
}
};
for (Value<Boolean> value : values) {
value.addListener(mapped); // depends on control dependency: [for], data = [value]
}
return mapped;
} } |
public class class_name {
public char next() throws JSONException {
if (this.useLastChar) {
this.useLastChar = false;
if (this.lastChar != 0) {
this.index += 1;
}
return this.lastChar;
}
int c;
try {
c = this.reader.read();
} catch (IOException exc) {
throw new JSONException(exc);
}
if (c <= 0) { // End of stream
this.lastChar = 0;
return 0;
}
this.index += 1;
this.lastChar = (char) c;
return this.lastChar;
} } | public class class_name {
public char next() throws JSONException {
if (this.useLastChar) {
this.useLastChar = false;
if (this.lastChar != 0) {
this.index += 1; // depends on control dependency: [if], data = [none]
}
return this.lastChar;
}
int c;
try {
c = this.reader.read();
} catch (IOException exc) {
throw new JSONException(exc);
}
if (c <= 0) { // End of stream
this.lastChar = 0;
return 0;
}
this.index += 1;
this.lastChar = (char) c;
return this.lastChar;
} } |
public class class_name {
void exit(final OtpErlangPid from, final OtpErlangPid to,
final OtpErlangObject reason) {
try {
super.sendExit(from, to, reason);
} catch (final Exception e) {
}
} } | public class class_name {
void exit(final OtpErlangPid from, final OtpErlangPid to,
final OtpErlangObject reason) {
try {
super.sendExit(from, to, reason); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List<java.lang.Object> getLastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName() {
if (lastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName == null) {
lastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName = new ArrayList<java.lang.Object>();
}
return this.lastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName;
} } | public class class_name {
public List<java.lang.Object> getLastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName() {
if (lastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName == null) {
lastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName = new ArrayList<java.lang.Object>(); // depends on control dependency: [if], data = [none]
}
return this.lastNameOrForeNameOrInitialsOrSuffixOrNameIDOrCollectiveName;
} } |
public class class_name {
public static boolean matchRegex(Object left, Object right) {
if (left == null || right == null) return false;
Pattern pattern;
if (right instanceof Pattern) {
pattern = (Pattern) right;
} else {
pattern = Pattern.compile(toString(right));
}
String stringToCompare = toString(left);
Matcher matcher = pattern.matcher(stringToCompare);
RegexSupport.setLastMatcher(matcher);
return matcher.matches();
} } | public class class_name {
public static boolean matchRegex(Object left, Object right) {
if (left == null || right == null) return false;
Pattern pattern;
if (right instanceof Pattern) {
pattern = (Pattern) right; // depends on control dependency: [if], data = [none]
} else {
pattern = Pattern.compile(toString(right)); // depends on control dependency: [if], data = [none]
}
String stringToCompare = toString(left);
Matcher matcher = pattern.matcher(stringToCompare);
RegexSupport.setLastMatcher(matcher);
return matcher.matches();
} } |
public class class_name {
public void accept(TermVisitor visitor)
{
if (visitor instanceof VariableVisitor)
{
((VariableVisitor) visitor).visit(this);
}
else
{
super.accept(visitor);
}
} } | public class class_name {
public void accept(TermVisitor visitor)
{
if (visitor instanceof VariableVisitor)
{
((VariableVisitor) visitor).visit(this); // depends on control dependency: [if], data = [none]
}
else
{
super.accept(visitor); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@PreDestroy
public final void shutdown() {
this.timer.shutdownNow();
this.executor.shutdownNow();
if (this.cleanUpTimer != null) {
this.cleanUpTimer.shutdownNow();
}
} } | public class class_name {
@PreDestroy
public final void shutdown() {
this.timer.shutdownNow();
this.executor.shutdownNow();
if (this.cleanUpTimer != null) {
this.cleanUpTimer.shutdownNow(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Frame reorderColumns(Frame f) {
if ((_interactionsOnly == null) || (f == null))
return f;
Vec[] interOnlyVecs = f.vecs(_interactionsOnly);
f.remove(_interactionsOnly);
for (int i = 0; i < _interactionsOnly.length; i++) {
if (isUsed(_interactionsOnly[i])) {
f.add(_interactionsOnly[i], interOnlyVecs[i]);
} else if (! isIgnored(_interactionsOnly[i])) {
Log.warn("Column '" + _interactionsOnly[i] + "' was marked to be used for interactions only " +
"but it is not actually required in any interaction.");
}
}
return f;
} } | public class class_name {
public Frame reorderColumns(Frame f) {
if ((_interactionsOnly == null) || (f == null))
return f;
Vec[] interOnlyVecs = f.vecs(_interactionsOnly);
f.remove(_interactionsOnly);
for (int i = 0; i < _interactionsOnly.length; i++) {
if (isUsed(_interactionsOnly[i])) {
f.add(_interactionsOnly[i], interOnlyVecs[i]); // depends on control dependency: [if], data = [none]
} else if (! isIgnored(_interactionsOnly[i])) {
Log.warn("Column '" + _interactionsOnly[i] + "' was marked to be used for interactions only " +
"but it is not actually required in any interaction."); // depends on control dependency: [if], data = [none]
}
}
return f;
} } |
public class class_name {
private void sleep() {
try {
TimeUnit.MILLISECONDS.sleep(this.delay);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(
"Unexpected interruption while retrying to process request",
ex
);
}
} } | public class class_name {
private void sleep() {
try {
TimeUnit.MILLISECONDS.sleep(this.delay); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(
"Unexpected interruption while retrying to process request",
ex
);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected void _fit(Dataframe trainingData) {
StorageEngine storageEngine = knowledgeBase.getStorageEngine();
TP trainingParameters = knowledgeBase.getTrainingParameters();
MP modelParameters = knowledgeBase.getModelParameters();
Set<TypeInference.DataType> supportedXDataTypes = getSupportedXDataTypes();
Map<Object, TypeInference.DataType> xDataTypes = trainingData.getXDataTypes();
Map<Object, Integer> tmp_classCounts = new HashMap<>(); //map which stores the counts of the classes
Map<List<Object>, Integer> tmp_featureClassCounts = storageEngine.getBigMap("tmp_featureClassCounts", (Class<List<Object>>)(Class<?>)List.class, Integer.class, StorageEngine.MapType.HASHMAP, StorageEngine.StorageHint.IN_MEMORY, false, true); //map which stores the counts of feature-class combinations.
Map<Object, Double> tmp_featureCounts = storageEngine.getBigMap("tmp_featureCounts", Object.class, Double.class, StorageEngine.MapType.HASHMAP, StorageEngine.StorageHint.IN_MEMORY, false, true); //map which stores the counts of the features
//find the featureCounts
logger.debug("Estimating featureCounts");
for(Record r : trainingData) {
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object column = entry.getKey();
if(!supportedXDataTypes.contains(xDataTypes.get(column))) {
continue;
}
Double value = TypeInference.toDouble(entry.getValue());
if(value>0.0) {
double featureCounter = tmp_featureCounts.getOrDefault(column, 0.0);
tmp_featureCounts.put(column, ++featureCounter);
}
}
}
//remove rare features
Integer rareFeatureThreshold = trainingParameters.getRareFeatureThreshold();
if(rareFeatureThreshold != null && rareFeatureThreshold>0) {
removeRareFeatures(tmp_featureCounts, rareFeatureThreshold);
}
//now find the classCounts and the featureClassCounts
logger.debug("Estimating classCounts and featureClassCounts");
for(Record r : trainingData) {
Object theClass = r.getY();
Integer classCounter = tmp_classCounts.getOrDefault(theClass, 0);
tmp_classCounts.put(theClass, ++classCounter);
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object column = entry.getKey();
if(!supportedXDataTypes.contains(xDataTypes.get(column))) {
continue;
}
Double value = TypeInference.toDouble(entry.getValue());
if(value>0.0) {
List<Object> featureClassTuple = Arrays.asList(column, theClass);
Integer featureClassCounter = tmp_featureClassCounts.getOrDefault(featureClassTuple, 0);
tmp_featureClassCounts.put(featureClassTuple, ++featureClassCounter);
}
}
}
//call the overriden method to get the scores of the features.
final Map<Object, Double> featureScores = modelParameters.getFeatureScores();
estimateFeatureScores(featureScores, trainingData.size(), tmp_classCounts, tmp_featureClassCounts, tmp_featureCounts);
//drop the unnecessary stastistics tables
tmp_classCounts.clear();
storageEngine.dropBigMap("tmp_featureClassCounts", tmp_featureClassCounts);
storageEngine.dropBigMap("tmp_featureCounts", tmp_featureCounts);
//keep only the top features
Integer maxFeatures = trainingParameters.getMaxFeatures();
if(maxFeatures != null && maxFeatures<featureScores.size()) {
keepTopFeatures(featureScores, maxFeatures);
}
} } | public class class_name {
@Override
protected void _fit(Dataframe trainingData) {
StorageEngine storageEngine = knowledgeBase.getStorageEngine();
TP trainingParameters = knowledgeBase.getTrainingParameters();
MP modelParameters = knowledgeBase.getModelParameters();
Set<TypeInference.DataType> supportedXDataTypes = getSupportedXDataTypes();
Map<Object, TypeInference.DataType> xDataTypes = trainingData.getXDataTypes();
Map<Object, Integer> tmp_classCounts = new HashMap<>(); //map which stores the counts of the classes
Map<List<Object>, Integer> tmp_featureClassCounts = storageEngine.getBigMap("tmp_featureClassCounts", (Class<List<Object>>)(Class<?>)List.class, Integer.class, StorageEngine.MapType.HASHMAP, StorageEngine.StorageHint.IN_MEMORY, false, true); //map which stores the counts of feature-class combinations.
Map<Object, Double> tmp_featureCounts = storageEngine.getBigMap("tmp_featureCounts", Object.class, Double.class, StorageEngine.MapType.HASHMAP, StorageEngine.StorageHint.IN_MEMORY, false, true); //map which stores the counts of the features
//find the featureCounts
logger.debug("Estimating featureCounts");
for(Record r : trainingData) {
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object column = entry.getKey();
if(!supportedXDataTypes.contains(xDataTypes.get(column))) {
continue;
}
Double value = TypeInference.toDouble(entry.getValue());
if(value>0.0) {
double featureCounter = tmp_featureCounts.getOrDefault(column, 0.0);
tmp_featureCounts.put(column, ++featureCounter); // depends on control dependency: [if], data = [none]
}
}
}
//remove rare features
Integer rareFeatureThreshold = trainingParameters.getRareFeatureThreshold();
if(rareFeatureThreshold != null && rareFeatureThreshold>0) {
removeRareFeatures(tmp_featureCounts, rareFeatureThreshold); // depends on control dependency: [if], data = [none]
}
//now find the classCounts and the featureClassCounts
logger.debug("Estimating classCounts and featureClassCounts");
for(Record r : trainingData) {
Object theClass = r.getY();
Integer classCounter = tmp_classCounts.getOrDefault(theClass, 0);
tmp_classCounts.put(theClass, ++classCounter); // depends on control dependency: [for], data = [r]
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object column = entry.getKey();
if(!supportedXDataTypes.contains(xDataTypes.get(column))) {
continue;
}
Double value = TypeInference.toDouble(entry.getValue());
if(value>0.0) {
List<Object> featureClassTuple = Arrays.asList(column, theClass);
Integer featureClassCounter = tmp_featureClassCounts.getOrDefault(featureClassTuple, 0);
tmp_featureClassCounts.put(featureClassTuple, ++featureClassCounter); // depends on control dependency: [if], data = [none]
}
}
}
//call the overriden method to get the scores of the features.
final Map<Object, Double> featureScores = modelParameters.getFeatureScores();
estimateFeatureScores(featureScores, trainingData.size(), tmp_classCounts, tmp_featureClassCounts, tmp_featureCounts);
//drop the unnecessary stastistics tables
tmp_classCounts.clear();
storageEngine.dropBigMap("tmp_featureClassCounts", tmp_featureClassCounts);
storageEngine.dropBigMap("tmp_featureCounts", tmp_featureCounts);
//keep only the top features
Integer maxFeatures = trainingParameters.getMaxFeatures();
if(maxFeatures != null && maxFeatures<featureScores.size()) {
keepTopFeatures(featureScores, maxFeatures); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setMemberArray(StructureMembers.Member m, Array memberArray) {
m.setDataArray(memberArray);
if (memberArray instanceof ArrayStructure) { // LOOK
ArrayStructure as = (ArrayStructure) memberArray;
m.setStructureMembers(as.getStructureMembers());
}
} } | public class class_name {
public void setMemberArray(StructureMembers.Member m, Array memberArray) {
m.setDataArray(memberArray);
if (memberArray instanceof ArrayStructure) { // LOOK
ArrayStructure as = (ArrayStructure) memberArray;
m.setStructureMembers(as.getStructureMembers());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void computeSolutions(DMatrix4x4 Q) {
DMatrixRMaj w_i = new DMatrixRMaj(3,3);
for (int i = 0; i < cameras.size; i++) {
computeW(cameras.get(i),Q,w_i);
Intrinsic calib = solveForCalibration(w_i);
if( sanityCheck(calib)) {
solutions.add(calib);
}
}
} } | public class class_name {
private void computeSolutions(DMatrix4x4 Q) {
DMatrixRMaj w_i = new DMatrixRMaj(3,3);
for (int i = 0; i < cameras.size; i++) {
computeW(cameras.get(i),Q,w_i); // depends on control dependency: [for], data = [i]
Intrinsic calib = solveForCalibration(w_i);
if( sanityCheck(calib)) {
solutions.add(calib); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public String getName(boolean forcedUpdate) {
if ((name == null || forcedUpdate) && getRiotApi() != null) {
try {
name = getRiotApi().getName(connection.getUser());
} catch (final IOException e) {
e.printStackTrace();
}
}
return name;
} } | public class class_name {
public String getName(boolean forcedUpdate) {
if ((name == null || forcedUpdate) && getRiotApi() != null) {
try {
name = getRiotApi().getName(connection.getUser()); // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return name;
} } |
public class class_name {
public Integer getIntegerProperty(String property, boolean required) {
Integer integerValue = null;
String value = getProperty(property, required);
if (value != null) {
try {
integerValue = Integer.valueOf(value);
} catch (NumberFormatException e) {
throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE
+ " property file property '" + property
+ "' must be an integer");
}
}
return integerValue;
} } | public class class_name {
public Integer getIntegerProperty(String property, boolean required) {
Integer integerValue = null;
String value = getProperty(property, required);
if (value != null) {
try {
integerValue = Integer.valueOf(value); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE
+ " property file property '" + property
+ "' must be an integer");
} // depends on control dependency: [catch], data = [none]
}
return integerValue;
} } |
public class class_name {
@Pure
public ReadOnlyUnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
this.saxis.bind(Bindings.createObjectBinding(() -> {
final Vector2dfx firstAxis = firstAxisProperty().get();
return firstAxis.toOrthogonalVector();
},
firstAxisProperty()));
}
return this.saxis.getReadOnlyProperty();
} } | public class class_name {
@Pure
public ReadOnlyUnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory()); // depends on control dependency: [if], data = [none]
this.saxis.bind(Bindings.createObjectBinding(() -> {
final Vector2dfx firstAxis = firstAxisProperty().get(); // depends on control dependency: [if], data = [none]
return firstAxis.toOrthogonalVector(); // depends on control dependency: [if], data = [none]
},
firstAxisProperty()));
}
return this.saxis.getReadOnlyProperty();
} } |
public class class_name {
public static double normF( DMatrixD1 a ) {
double total = 0;
double scale = CommonOps_DDRM.elementMaxAbs(a);
if( scale == 0.0 )
return 0.0;
final int size = a.getNumElements();
for( int i = 0; i < size; i++ ) {
double val = a.get(i)/scale;
total += val*val;
}
return scale * Math.sqrt(total);
} } | public class class_name {
public static double normF( DMatrixD1 a ) {
double total = 0;
double scale = CommonOps_DDRM.elementMaxAbs(a);
if( scale == 0.0 )
return 0.0;
final int size = a.getNumElements();
for( int i = 0; i < size; i++ ) {
double val = a.get(i)/scale;
total += val*val; // depends on control dependency: [for], data = [none]
}
return scale * Math.sqrt(total);
} } |
public class class_name {
private A_CmsReportThread startThread() {
//Maximal count of versions for current resources.
int versions = ((Integer)m_numberVersionsToKeep.getValue()).intValue();
//Maximal count of versions for deleted resources.
int versionsDeleted = versions;
if (m_mode.getValue().equals(CmsFileHistoryApp.MODE_DISABLED)) {
versionsDeleted = 0;
}
if (m_mode.getValue().equals(CmsFileHistoryApp.MODE_WITHOUTVERSIONS)) {
versionsDeleted = 1;
}
long date = m_dateField.getValue() != null ? m_dateField.getDate().getTime() : 0;
CmsHistoryClearThread thread = new CmsHistoryClearThread(
A_CmsUI.getCmsObject(),
versions,
versionsDeleted,
date);
thread.start();
return thread;
} } | public class class_name {
private A_CmsReportThread startThread() {
//Maximal count of versions for current resources.
int versions = ((Integer)m_numberVersionsToKeep.getValue()).intValue();
//Maximal count of versions for deleted resources.
int versionsDeleted = versions;
if (m_mode.getValue().equals(CmsFileHistoryApp.MODE_DISABLED)) {
versionsDeleted = 0; // depends on control dependency: [if], data = [none]
}
if (m_mode.getValue().equals(CmsFileHistoryApp.MODE_WITHOUTVERSIONS)) {
versionsDeleted = 1; // depends on control dependency: [if], data = [none]
}
long date = m_dateField.getValue() != null ? m_dateField.getDate().getTime() : 0;
CmsHistoryClearThread thread = new CmsHistoryClearThread(
A_CmsUI.getCmsObject(),
versions,
versionsDeleted,
date);
thread.start();
return thread;
} } |
public class class_name {
private static List<Method> getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation, Logger log) {
List<Method> annotatedMethods = new ArrayList<Method>();
Method classMethods[] = clazz.getDeclaredMethods();
for(Method classMethod : classMethods) {
if(classMethod.isAnnotationPresent(annotation) && classMethod.getParameterTypes().length == 0) {
if(!containsMethod(classMethod, annotatedMethods)) {
annotatedMethods.add(classMethod);
}
}
}
Collections.sort(annotatedMethods, new Comparator<Method> () {
@Override
public int compare(Method method1, Method method2) {
return method1.getName().compareTo(method2.getName());
}
});
return annotatedMethods;
} } | public class class_name {
private static List<Method> getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation, Logger log) {
List<Method> annotatedMethods = new ArrayList<Method>();
Method classMethods[] = clazz.getDeclaredMethods();
for(Method classMethod : classMethods) {
if(classMethod.isAnnotationPresent(annotation) && classMethod.getParameterTypes().length == 0) {
if(!containsMethod(classMethod, annotatedMethods)) {
annotatedMethods.add(classMethod); // depends on control dependency: [if], data = [none]
}
}
}
Collections.sort(annotatedMethods, new Comparator<Method> () {
@Override
public int compare(Method method1, Method method2) {
return method1.getName().compareTo(method2.getName());
}
});
return annotatedMethods;
} } |
public class class_name {
public CompletionStage<Void> put(final Resource resource, final Instant time) {
return runAsync(() -> {
final File resourceDir = FileUtils.getResourceDirectory(directory, resource.getIdentifier());
if (!resourceDir.exists()) {
resourceDir.mkdirs();
}
FileUtils.writeMemento(resourceDir, resource, time.truncatedTo(SECONDS));
});
} } | public class class_name {
public CompletionStage<Void> put(final Resource resource, final Instant time) {
return runAsync(() -> {
final File resourceDir = FileUtils.getResourceDirectory(directory, resource.getIdentifier());
if (!resourceDir.exists()) {
resourceDir.mkdirs(); // depends on control dependency: [if], data = [none]
}
FileUtils.writeMemento(resourceDir, resource, time.truncatedTo(SECONDS));
});
} } |
public class class_name {
public SqlInfo buildInSql(String fieldText, Object[] values) {
if (values == null || values.length == 0) {
return sqlInfo;
}
// 遍历数组,并遍历添加in查询的替换符和参数
this.suffix = StringHelper.isBlank(this.suffix) ? ZealotConst.IN_SUFFIX : this.suffix;
join.append(prefix).append(fieldText).append(this.suffix).append("(");
int len = values.length;
for (int i = 0; i < len; i++) {
if (i == len - 1) {
join.append("?) ");
} else {
join.append("?, ");
}
params.add(values[i]);
}
return sqlInfo.setJoin(join).setParams(params);
} } | public class class_name {
public SqlInfo buildInSql(String fieldText, Object[] values) {
if (values == null || values.length == 0) {
return sqlInfo; // depends on control dependency: [if], data = [none]
}
// 遍历数组,并遍历添加in查询的替换符和参数
this.suffix = StringHelper.isBlank(this.suffix) ? ZealotConst.IN_SUFFIX : this.suffix;
join.append(prefix).append(fieldText).append(this.suffix).append("(");
int len = values.length;
for (int i = 0; i < len; i++) {
if (i == len - 1) {
join.append("?) "); // depends on control dependency: [if], data = [none]
} else {
join.append("?, "); // depends on control dependency: [if], data = [none]
}
params.add(values[i]); // depends on control dependency: [for], data = [i]
}
return sqlInfo.setJoin(join).setParams(params);
} } |
public class class_name {
public static List<List<IWord>> convert2CompatibleList(List<List<Word>> simpleSentenceList)
{
List<List<IWord>> compatibleList = new LinkedList<List<IWord>>();
for (List<Word> wordList : simpleSentenceList)
{
compatibleList.add(new LinkedList<IWord>(wordList));
}
return compatibleList;
} } | public class class_name {
public static List<List<IWord>> convert2CompatibleList(List<List<Word>> simpleSentenceList)
{
List<List<IWord>> compatibleList = new LinkedList<List<IWord>>();
for (List<Word> wordList : simpleSentenceList)
{
compatibleList.add(new LinkedList<IWord>(wordList)); // depends on control dependency: [for], data = [wordList]
}
return compatibleList;
} } |
public class class_name {
private final String renderContentTemplate(final ST contentTemplate, final Map<String, Object> values, final ErrorBuffer error, boolean inErrorState) {
if (contentTemplate != null) { // it has to be possible to use a layout without defining a template
try (Writer sw = new StringBuilderWriter()) {
final ErrorBuffer templateErrors = new ErrorBuffer();
renderContentTemplate(contentTemplate, sw, values/*, language*/, templateErrors);
// handle potential errors
if (!templateErrors.errors.isEmpty() && !inErrorState) {
for (STMessage err : templateErrors.errors) {
if (err.error == ErrorType.INTERNAL_ERROR) {
log.warn("Reloading GroupDir as we have found a problem during rendering of template \"{}\"\n{}",contentTemplate.getName(), templateErrors.errors.toString());
//README when errors occur, try to reload the specified templates and try the whole thing again
// this often rectifies the problem
reloadGroup();
ST reloadedContentTemplate = readTemplate(contentTemplate.getName());
return renderContentTemplate(reloadedContentTemplate, values, error, true);
}
}
}
return sw.toString();
} catch (IOException noMethodsThrowsIOE) { }
}
return "";
} } | public class class_name {
private final String renderContentTemplate(final ST contentTemplate, final Map<String, Object> values, final ErrorBuffer error, boolean inErrorState) {
if (contentTemplate != null) { // it has to be possible to use a layout without defining a template
try (Writer sw = new StringBuilderWriter()) {
final ErrorBuffer templateErrors = new ErrorBuffer();
renderContentTemplate(contentTemplate, sw, values/*, language*/, templateErrors); // depends on control dependency: [if], data = [(contentTemplate]
// handle potential errors
if (!templateErrors.errors.isEmpty() && !inErrorState) {
for (STMessage err : templateErrors.errors) {
if (err.error == ErrorType.INTERNAL_ERROR) {
log.warn("Reloading GroupDir as we have found a problem during rendering of template \"{}\"\n{}",contentTemplate.getName(), templateErrors.errors.toString()); // depends on control dependency: [if], data = [none]
//README when errors occur, try to reload the specified templates and try the whole thing again
// this often rectifies the problem
reloadGroup(); // depends on control dependency: [if], data = [none]
ST reloadedContentTemplate = readTemplate(contentTemplate.getName());
return renderContentTemplate(reloadedContentTemplate, values, error, true); // depends on control dependency: [if], data = [none]
}
}
}
return sw.toString(); // depends on control dependency: [if], data = [none]
} catch (IOException noMethodsThrowsIOE) { }
}
return "";
} } |
public class class_name {
protected static boolean writeListType(Output out, Object listType) {
log.trace("writeListType");
if (listType instanceof List<?>) {
writeList(out, (List<?>) listType);
} else {
return false;
}
return true;
} } | public class class_name {
protected static boolean writeListType(Output out, Object listType) {
log.trace("writeListType");
if (listType instanceof List<?>) {
writeList(out, (List<?>) listType); // depends on control dependency: [if], data = [)]
} else {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
protected void checkParserVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String XERCES1_VERSION_CLASS = "org.apache.xerces.framework.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES1_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 1.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces1", parserVersion);
}
catch (Exception e)
{
h.put(VERSION + "xerces1", CLASS_NOTPRESENT);
}
// Look for xerces1 and xerces2 parsers separately
try
{
final String XERCES2_VERSION_CLASS = "org.apache.xerces.impl.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 2.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces2", parserVersion);
}
catch (Exception e)
{
h.put(VERSION + "xerces2", CLASS_NOTPRESENT);
}
try
{
final String CRIMSON_CLASS = "org.apache.crimson.parser.Parser2";
Class clazz = ObjectFactory.findProviderClass(
CRIMSON_CLASS, ObjectFactory.findClassLoader(), true);
//@todo determine specific crimson version
h.put(VERSION + "crimson", CLASS_PRESENT);
}
catch (Exception e)
{
h.put(VERSION + "crimson", CLASS_NOTPRESENT);
}
} } | public class class_name {
protected void checkParserVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String XERCES1_VERSION_CLASS = "org.apache.xerces.framework.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES1_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 1.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces1", parserVersion); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
h.put(VERSION + "xerces1", CLASS_NOTPRESENT);
} // depends on control dependency: [catch], data = [none]
// Look for xerces1 and xerces2 parsers separately
try
{
final String XERCES2_VERSION_CLASS = "org.apache.xerces.impl.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 2.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces2", parserVersion); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
h.put(VERSION + "xerces2", CLASS_NOTPRESENT);
} // depends on control dependency: [catch], data = [none]
try
{
final String CRIMSON_CLASS = "org.apache.crimson.parser.Parser2";
Class clazz = ObjectFactory.findProviderClass(
CRIMSON_CLASS, ObjectFactory.findClassLoader(), true);
//@todo determine specific crimson version
h.put(VERSION + "crimson", CLASS_PRESENT); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
h.put(VERSION + "crimson", CLASS_NOTPRESENT);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List<Peer> findPeersWithServiceMask(int mask) {
lock.lock();
try {
ArrayList<Peer> results = new ArrayList<>(peers.size());
for (Peer peer : peers)
if ((peer.getPeerVersionMessage().localServices & mask) == mask)
results.add(peer);
return results;
} finally {
lock.unlock();
}
} } | public class class_name {
public List<Peer> findPeersWithServiceMask(int mask) {
lock.lock();
try {
ArrayList<Peer> results = new ArrayList<>(peers.size());
for (Peer peer : peers)
if ((peer.getPeerVersionMessage().localServices & mask) == mask)
results.add(peer);
return results; // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} } |
public class class_name {
public static String getBirthByIdCard(String idCard) {
Integer len = idCard.length();
if (len < CHINA_ID_MIN_LENGTH) {
return null;
} else if (len == CHINA_ID_MIN_LENGTH) {
idCard = conver15CardTo18(idCard);
}
return idCard.substring(6, 14);
} } | public class class_name {
public static String getBirthByIdCard(String idCard) {
Integer len = idCard.length();
if (len < CHINA_ID_MIN_LENGTH) {
return null; // depends on control dependency: [if], data = [none]
} else if (len == CHINA_ID_MIN_LENGTH) {
idCard = conver15CardTo18(idCard); // depends on control dependency: [if], data = [none]
}
return idCard.substring(6, 14);
} } |
public class class_name {
public SIMPLocalTopicSpaceControllable getLocalTopicSpaceControl()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLocalTopicSpaceControl");
SIMPLocalTopicSpaceControllable control = null;
PubSubMessageItemStream is = baseDest.getPublishPoint();
if(is != null)
{
control = (SIMPLocalTopicSpaceControllable) is.getControlAdapter();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getLocalTopicSpaceControl", control);
return control;
} } | public class class_name {
public SIMPLocalTopicSpaceControllable getLocalTopicSpaceControl()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLocalTopicSpaceControl");
SIMPLocalTopicSpaceControllable control = null;
PubSubMessageItemStream is = baseDest.getPublishPoint();
if(is != null)
{
control = (SIMPLocalTopicSpaceControllable) is.getControlAdapter(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getLocalTopicSpaceControl", control);
return control;
} } |
public class class_name {
public boolean isInParameter(String key) {
boolean isIn = false;
if (this.getDirection(processKey(key)) == Direction.INOUT || this.getDirection(processKey(key)) == Direction.IN) {
isIn = true;
}
return isIn;
} } | public class class_name {
public boolean isInParameter(String key) {
boolean isIn = false;
if (this.getDirection(processKey(key)) == Direction.INOUT || this.getDirection(processKey(key)) == Direction.IN) {
isIn = true;
// depends on control dependency: [if], data = [none]
}
return isIn;
} } |
public class class_name {
public EClass getIfcDoseEquivalentMeasure() {
if (ifcDoseEquivalentMeasureEClass == null) {
ifcDoseEquivalentMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(667);
}
return ifcDoseEquivalentMeasureEClass;
} } | public class class_name {
public EClass getIfcDoseEquivalentMeasure() {
if (ifcDoseEquivalentMeasureEClass == null) {
ifcDoseEquivalentMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(667);
// depends on control dependency: [if], data = [none]
}
return ifcDoseEquivalentMeasureEClass;
} } |
public class class_name {
private double[][] solveInplace(double[][] B) {
int rows = B.length, nx = B[0].length;
if(rows != m) {
throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);
}
if(!this.isFullRank()) {
throw new ArithmeticException(ERR_MATRIX_RANK_DEFICIENT);
}
// Compute Y = transpose(Q)*B
for(int k = 0; k < n; k++) {
for(int j = 0; j < nx; j++) {
double s = 0.0;
for(int i = k; i < m; i++) {
s += QR[i][k] * B[i][j];
}
s /= QR[k][k];
for(int i = k; i < m; i++) {
B[i][j] -= s * QR[i][k];
}
}
}
// Solve R*X = Y;
for(int k = n - 1; k >= 0; k--) {
final double[] Xk = B[k];
for(int j = 0; j < nx; j++) {
Xk[j] /= Rdiag[k];
}
for(int i = 0; i < k; i++) {
final double[] Xi = B[i];
final double QRik = QR[i][k];
for(int j = 0; j < nx; j++) {
Xi[j] -= Xk[j] * QRik;
}
}
}
return B;
} } | public class class_name {
private double[][] solveInplace(double[][] B) {
int rows = B.length, nx = B[0].length;
if(rows != m) {
throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);
}
if(!this.isFullRank()) {
throw new ArithmeticException(ERR_MATRIX_RANK_DEFICIENT);
}
// Compute Y = transpose(Q)*B
for(int k = 0; k < n; k++) {
for(int j = 0; j < nx; j++) {
double s = 0.0;
for(int i = k; i < m; i++) {
s += QR[i][k] * B[i][j]; // depends on control dependency: [for], data = [i]
}
s /= QR[k][k]; // depends on control dependency: [for], data = [none]
for(int i = k; i < m; i++) {
B[i][j] -= s * QR[i][k]; // depends on control dependency: [for], data = [i]
}
}
}
// Solve R*X = Y;
for(int k = n - 1; k >= 0; k--) {
final double[] Xk = B[k];
for(int j = 0; j < nx; j++) {
Xk[j] /= Rdiag[k]; // depends on control dependency: [for], data = [j]
}
for(int i = 0; i < k; i++) {
final double[] Xi = B[i];
final double QRik = QR[i][k];
for(int j = 0; j < nx; j++) {
Xi[j] -= Xk[j] * QRik; // depends on control dependency: [for], data = [j]
}
}
}
return B;
} } |
public class class_name {
private Set<CmsUUID> getSetFromUUIDStrings(String[] uuids) {
Set<CmsUUID> res = new HashSet<CmsUUID>();
for (String uuid : uuids) {
res.add(new CmsUUID(uuid));
}
return res;
} } | public class class_name {
private Set<CmsUUID> getSetFromUUIDStrings(String[] uuids) {
Set<CmsUUID> res = new HashSet<CmsUUID>();
for (String uuid : uuids) {
res.add(new CmsUUID(uuid)); // depends on control dependency: [for], data = [uuid]
}
return res;
} } |
public class class_name {
private void createJBossWebAppDescriptor(final Deployment dep, final JBossWebMetaData jbossWebMD) {
WSLogger.ROOT_LOGGER.trace("Creating jboss-web.xml descriptor");
// Set security domain
final String securityDomain = ejb3SecurityAccessor.getSecurityDomain(dep);
final boolean hasSecurityDomain = securityDomain != null;
if (hasSecurityDomain) {
WSLogger.ROOT_LOGGER.tracef("Setting security domain: %s", securityDomain);
jbossWebMD.setSecurityDomain(securityDomain);
}
// Set virtual host
final String virtualHost = dep.getService().getVirtualHost();
ServerHostInfo serverHostInfo = new ServerHostInfo(virtualHost);
if (serverHostInfo.getHost() != null) {
WSLogger.ROOT_LOGGER.tracef("Setting virtual host: %s", serverHostInfo.getHost());
jbossWebMD.setVirtualHosts(Arrays.asList(serverHostInfo.getHost()));
if (serverHostInfo.getServerInstanceName() != null) {
jbossWebMD.setServerInstanceName(serverHostInfo.getServerInstanceName());
}
}
} } | public class class_name {
private void createJBossWebAppDescriptor(final Deployment dep, final JBossWebMetaData jbossWebMD) {
WSLogger.ROOT_LOGGER.trace("Creating jboss-web.xml descriptor");
// Set security domain
final String securityDomain = ejb3SecurityAccessor.getSecurityDomain(dep);
final boolean hasSecurityDomain = securityDomain != null;
if (hasSecurityDomain) {
WSLogger.ROOT_LOGGER.tracef("Setting security domain: %s", securityDomain); // depends on control dependency: [if], data = [none]
jbossWebMD.setSecurityDomain(securityDomain); // depends on control dependency: [if], data = [none]
}
// Set virtual host
final String virtualHost = dep.getService().getVirtualHost();
ServerHostInfo serverHostInfo = new ServerHostInfo(virtualHost);
if (serverHostInfo.getHost() != null) {
WSLogger.ROOT_LOGGER.tracef("Setting virtual host: %s", serverHostInfo.getHost()); // depends on control dependency: [if], data = [none]
jbossWebMD.setVirtualHosts(Arrays.asList(serverHostInfo.getHost())); // depends on control dependency: [if], data = [(serverHostInfo.getHost()]
if (serverHostInfo.getServerInstanceName() != null) {
jbossWebMD.setServerInstanceName(serverHostInfo.getServerInstanceName()); // depends on control dependency: [if], data = [(serverHostInfo.getServerInstanceName()]
}
}
} } |
public class class_name {
@Override
public <R> Stream<R> slidingMap(final BiFunction<? super T, ? super T, R> mapper, final int increment, final boolean ignoreNotPaired) {
final int windowSize = 2;
checkArgPositive(increment, "increment");
return newStream(new ObjIteratorEx<R>() {
@SuppressWarnings("unchecked")
private final T NONE = (T) StreamBase.NONE;
private T prev = NONE;
private T _1 = NONE;
@Override
public boolean hasNext() {
if (increment > windowSize && prev != NONE) {
int skipNum = increment - windowSize;
while (skipNum-- > 0 && elements.hasNext()) {
elements.next();
}
prev = NONE;
}
if (ignoreNotPaired && _1 == NONE && elements.hasNext()) {
_1 = elements.next();
}
return elements.hasNext();
}
@Override
public R next() {
if (hasNext() == false) {
throw new NoSuchElementException();
}
if (ignoreNotPaired) {
final R res = mapper.apply(_1, (prev = elements.next()));
_1 = increment == 1 ? prev : NONE;
return res;
} else {
if (increment == 1) {
return mapper.apply(prev == NONE ? elements.next() : prev, (prev = (elements.hasNext() ? elements.next() : null)));
} else {
return mapper.apply(elements.next(), (prev = (elements.hasNext() ? elements.next() : null)));
}
}
}
}, false, null);
} } | public class class_name {
@Override
public <R> Stream<R> slidingMap(final BiFunction<? super T, ? super T, R> mapper, final int increment, final boolean ignoreNotPaired) {
final int windowSize = 2;
checkArgPositive(increment, "increment");
return newStream(new ObjIteratorEx<R>() {
@SuppressWarnings("unchecked")
private final T NONE = (T) StreamBase.NONE;
private T prev = NONE;
private T _1 = NONE;
@Override
public boolean hasNext() {
if (increment > windowSize && prev != NONE) {
int skipNum = increment - windowSize;
while (skipNum-- > 0 && elements.hasNext()) {
elements.next();
// depends on control dependency: [while], data = [none]
}
prev = NONE;
// depends on control dependency: [if], data = [none]
}
if (ignoreNotPaired && _1 == NONE && elements.hasNext()) {
_1 = elements.next();
// depends on control dependency: [if], data = [none]
}
return elements.hasNext();
}
@Override
public R next() {
if (hasNext() == false) {
throw new NoSuchElementException();
}
if (ignoreNotPaired) {
final R res = mapper.apply(_1, (prev = elements.next()));
_1 = increment == 1 ? prev : NONE;
// depends on control dependency: [if], data = [none]
return res;
// depends on control dependency: [if], data = [none]
} else {
if (increment == 1) {
return mapper.apply(prev == NONE ? elements.next() : prev, (prev = (elements.hasNext() ? elements.next() : null)));
// depends on control dependency: [if], data = [none]
} else {
return mapper.apply(elements.next(), (prev = (elements.hasNext() ? elements.next() : null)));
// depends on control dependency: [if], data = [none]
}
}
}
}, false, null);
} } |
public class class_name {
public void setAreas(Section... AREAS_ARRAY) {
areas.clear();
for (Section area : AREAS_ARRAY) {
areas.add(new Section(area.getStart(), area.getStop(), area.getColor()));
}
validate();
fireStateChanged();
} } | public class class_name {
public void setAreas(Section... AREAS_ARRAY) {
areas.clear();
for (Section area : AREAS_ARRAY) {
areas.add(new Section(area.getStart(), area.getStop(), area.getColor())); // depends on control dependency: [for], data = [area]
}
validate();
fireStateChanged();
} } |
public class class_name {
public void setEc2TagFilters(java.util.Collection<EC2TagFilter> ec2TagFilters) {
if (ec2TagFilters == null) {
this.ec2TagFilters = null;
return;
}
this.ec2TagFilters = new com.amazonaws.internal.SdkInternalList<EC2TagFilter>(ec2TagFilters);
} } | public class class_name {
public void setEc2TagFilters(java.util.Collection<EC2TagFilter> ec2TagFilters) {
if (ec2TagFilters == null) {
this.ec2TagFilters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.ec2TagFilters = new com.amazonaws.internal.SdkInternalList<EC2TagFilter>(ec2TagFilters);
} } |
public class class_name {
@Override
protected void readDataBlock(byte[] data, int offset, int len, int blockHandle) throws DataStoreException
{
byte[] dirtyBlock = dirtyBlockTable.get(blockHandle);
if (dirtyBlock != null)
{
// Copy data from memory-cached dirty block
System.arraycopy(dirtyBlock, 0, data, offset, len);
}
else
{
try
{
long dataOffset = (long)blockHandle*blockSize;
// Make sure we do not conflict with another async operation
synchronized (dataRandomAccessFile)
{
dataRandomAccessFile.seek(dataOffset);
if (dataRandomAccessFile.read(data,offset,len) != len)
throw new DataStoreException("Cannot read "+len+" bytes from store file");
}
}
catch (DataStoreException e)
{
throw e;
}
catch (IOException e)
{
throw new DataStoreException("Could not read data block "+blockHandle,e);
}
}
} } | public class class_name {
@Override
protected void readDataBlock(byte[] data, int offset, int len, int blockHandle) throws DataStoreException
{
byte[] dirtyBlock = dirtyBlockTable.get(blockHandle);
if (dirtyBlock != null)
{
// Copy data from memory-cached dirty block
System.arraycopy(dirtyBlock, 0, data, offset, len);
}
else
{
try
{
long dataOffset = (long)blockHandle*blockSize;
// Make sure we do not conflict with another async operation
synchronized (dataRandomAccessFile) // depends on control dependency: [try], data = [none]
{
dataRandomAccessFile.seek(dataOffset);
if (dataRandomAccessFile.read(data,offset,len) != len)
throw new DataStoreException("Cannot read "+len+" bytes from store file");
}
}
catch (DataStoreException e)
{
throw e;
} // depends on control dependency: [catch], data = [none]
catch (IOException e)
{
throw new DataStoreException("Could not read data block "+blockHandle,e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public byte getByte(long pos) {
checkOffsetAndCount(size, pos, 1);
for (Segment s = head; true; s = s.next) {
int segmentByteCount = s.limit - s.pos;
if (pos < segmentByteCount) return s.data[s.pos + (int) pos];
pos -= segmentByteCount;
}
} } | public class class_name {
public byte getByte(long pos) {
checkOffsetAndCount(size, pos, 1);
for (Segment s = head; true; s = s.next) {
int segmentByteCount = s.limit - s.pos;
if (pos < segmentByteCount) return s.data[s.pos + (int) pos];
pos -= segmentByteCount; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private void addConstructsFinalStateToTaskState(InstrumentedExtractorBase<?, ?> extractor,
Converter<?, ?, ?, ?> converter, RowLevelPolicyChecker rowChecker) {
ConstructState constructState = new ConstructState();
if (extractor != null) {
constructState.addConstructState(Constructs.EXTRACTOR, new ConstructState(extractor.getFinalState()));
}
if (converter != null) {
constructState.addConstructState(Constructs.CONVERTER, new ConstructState(converter.getFinalState()));
}
if (rowChecker != null) {
constructState.addConstructState(Constructs.ROW_QUALITY_CHECKER, new ConstructState(rowChecker.getFinalState()));
}
int forkIdx = 0;
for (Optional<Fork> fork : this.forks.keySet()) {
constructState.addConstructState(Constructs.FORK_OPERATOR, new ConstructState(fork.get().getFinalState()),
Integer.toString(forkIdx));
forkIdx++;
}
constructState.mergeIntoWorkUnitState(this.taskState);
} } | public class class_name {
private void addConstructsFinalStateToTaskState(InstrumentedExtractorBase<?, ?> extractor,
Converter<?, ?, ?, ?> converter, RowLevelPolicyChecker rowChecker) {
ConstructState constructState = new ConstructState();
if (extractor != null) {
constructState.addConstructState(Constructs.EXTRACTOR, new ConstructState(extractor.getFinalState())); // depends on control dependency: [if], data = [(extractor]
}
if (converter != null) {
constructState.addConstructState(Constructs.CONVERTER, new ConstructState(converter.getFinalState())); // depends on control dependency: [if], data = [(converter]
}
if (rowChecker != null) {
constructState.addConstructState(Constructs.ROW_QUALITY_CHECKER, new ConstructState(rowChecker.getFinalState())); // depends on control dependency: [if], data = [(rowChecker]
}
int forkIdx = 0;
for (Optional<Fork> fork : this.forks.keySet()) {
constructState.addConstructState(Constructs.FORK_OPERATOR, new ConstructState(fork.get().getFinalState()),
Integer.toString(forkIdx)); // depends on control dependency: [for], data = [none]
forkIdx++; // depends on control dependency: [for], data = [fork]
}
constructState.mergeIntoWorkUnitState(this.taskState);
} } |
public class class_name {
public static Observable<String> getPathFromUriForMediaDocument(final Context context,
final Uri mediaUri, final String mediaDocumentId) {
return Observable.fromCallable(new Func0<String>() {
@Override
public String call() {
String pathFound = null;
Cursor cursor = context.getContentResolver()
.query(mediaUri, null, Constants.ID_COLUMN_VALUE + " =?",
new String[] { mediaDocumentId }, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
pathFound =
cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA));
}
cursor.close();
logDebug("Path found:" + pathFound);
}
return pathFound;
}
});
} } | public class class_name {
public static Observable<String> getPathFromUriForMediaDocument(final Context context,
final Uri mediaUri, final String mediaDocumentId) {
return Observable.fromCallable(new Func0<String>() {
@Override
public String call() {
String pathFound = null;
Cursor cursor = context.getContentResolver()
.query(mediaUri, null, Constants.ID_COLUMN_VALUE + " =?",
new String[] { mediaDocumentId }, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
pathFound =
cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA)); // depends on control dependency: [if], data = [none]
}
cursor.close(); // depends on control dependency: [if], data = [none]
logDebug("Path found:" + pathFound); // depends on control dependency: [if], data = [none]
}
return pathFound;
}
});
} } |
public class class_name {
public static void incrementVersion(Object target) {
MetaClass metaClass = GroovySystem.getMetaClassRegistry().getMetaClass(target.getClass());
if (metaClass.hasProperty(target, GormProperties.VERSION)!=null) {
Object version = metaClass.getProperty(target, GormProperties.VERSION);
if (version instanceof Long) {
Long newVersion = (Long) version + 1;
metaClass.setProperty(target, GormProperties.VERSION, newVersion);
}
}
} } | public class class_name {
public static void incrementVersion(Object target) {
MetaClass metaClass = GroovySystem.getMetaClassRegistry().getMetaClass(target.getClass());
if (metaClass.hasProperty(target, GormProperties.VERSION)!=null) {
Object version = metaClass.getProperty(target, GormProperties.VERSION);
if (version instanceof Long) {
Long newVersion = (Long) version + 1;
metaClass.setProperty(target, GormProperties.VERSION, newVersion); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static BooleanAsciiGrid forEarthPopulation() {
try {
InputStream gridStream = BooleanAsciiGrid.class.getResourceAsStream("gpwv3-quarter-boolean.asc");
return new BooleanAsciiGrid(gridStream, false);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} } | public class class_name {
public static BooleanAsciiGrid forEarthPopulation() {
try {
InputStream gridStream = BooleanAsciiGrid.class.getResourceAsStream("gpwv3-quarter-boolean.asc");
return new BooleanAsciiGrid(gridStream, false); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void preloadChildren(Iterable<Node> nodeList) {
levels.getLast().trackNodesAsWellAsValues(true);
for (Node n : nodeList) {
visited(n);
}
levels.getLast().trackNodesAsWellAsValues(false);
} } | public class class_name {
private void preloadChildren(Iterable<Node> nodeList) {
levels.getLast().trackNodesAsWellAsValues(true);
for (Node n : nodeList) {
visited(n); // depends on control dependency: [for], data = [n]
}
levels.getLast().trackNodesAsWellAsValues(false);
} } |
public class class_name {
int pcode_128( int[] pos, int[] size, int code, int hoff, int len, String structName, String abbre, boolean isZ )
{
//int vlen = len;
ArrayList dims = new ArrayList();
Dimension sDim = new Dimension("textStringSize"+ abbre + code, len);
ncfile.addDimension( null, sDim);
dims.add( sDim);
Structure dist = new Structure(ncfile, null, null, structName + abbre);
dist.setDimensions(dims);
ncfile.addVariable(null, dist);
dist.addAttribute( new Attribute(CDM.LONG_NAME, "text and special symbol for code "+code));
if(code == 8){
Variable strVal = new Variable(ncfile, null, dist, "strValue");
strVal.setDimensions((String)null);
strVal.setDataType(DataType.SHORT);
strVal.addAttribute( new Attribute(CDM.UNITS, ""));
dist.addMemberVariable(strVal);
}
Variable i0 = new Variable(ncfile, null, dist, "x_start");
i0.setDimensions((String)null);
i0.setDataType(DataType.SHORT);
i0.addAttribute( new Attribute(CDM.UNITS, "KM"));
dist.addMemberVariable(i0);
Variable j0 = new Variable(ncfile, null, dist, "y_start");
j0.setDimensions((String)null);
j0.setDataType(DataType.SHORT);
j0.addAttribute( new Attribute(CDM.UNITS, "KM"));
dist.addMemberVariable(j0);
Variable tstr = new Variable(ncfile, null, dist, "textString" );
tstr.setDimensions((String)null);
tstr.setDataType(DataType.STRING);
tstr.addAttribute( new Attribute(CDM.UNITS, ""));
dist.addMemberVariable(tstr);
int[] pos1 = new int[len];
System.arraycopy(pos, 0, pos1, 0, len);
dist.setSPobject( new Vinfo ( 0, 0, 0, 0, hoff, 0, isR, isZ, pos1, size, code, 0));
return 1;
} } | public class class_name {
int pcode_128( int[] pos, int[] size, int code, int hoff, int len, String structName, String abbre, boolean isZ )
{
//int vlen = len;
ArrayList dims = new ArrayList();
Dimension sDim = new Dimension("textStringSize"+ abbre + code, len);
ncfile.addDimension( null, sDim);
dims.add( sDim);
Structure dist = new Structure(ncfile, null, null, structName + abbre);
dist.setDimensions(dims);
ncfile.addVariable(null, dist);
dist.addAttribute( new Attribute(CDM.LONG_NAME, "text and special symbol for code "+code));
if(code == 8){
Variable strVal = new Variable(ncfile, null, dist, "strValue");
strVal.setDimensions((String)null);
// depends on control dependency: [if], data = [none]
strVal.setDataType(DataType.SHORT);
// depends on control dependency: [if], data = [none]
strVal.addAttribute( new Attribute(CDM.UNITS, ""));
// depends on control dependency: [if], data = [none]
dist.addMemberVariable(strVal);
// depends on control dependency: [if], data = [none]
}
Variable i0 = new Variable(ncfile, null, dist, "x_start");
i0.setDimensions((String)null);
i0.setDataType(DataType.SHORT);
i0.addAttribute( new Attribute(CDM.UNITS, "KM"));
dist.addMemberVariable(i0);
Variable j0 = new Variable(ncfile, null, dist, "y_start");
j0.setDimensions((String)null);
j0.setDataType(DataType.SHORT);
j0.addAttribute( new Attribute(CDM.UNITS, "KM"));
dist.addMemberVariable(j0);
Variable tstr = new Variable(ncfile, null, dist, "textString" );
tstr.setDimensions((String)null);
tstr.setDataType(DataType.STRING);
tstr.addAttribute( new Attribute(CDM.UNITS, ""));
dist.addMemberVariable(tstr);
int[] pos1 = new int[len];
System.arraycopy(pos, 0, pos1, 0, len);
dist.setSPobject( new Vinfo ( 0, 0, 0, 0, hoff, 0, isR, isZ, pos1, size, code, 0));
return 1;
} } |
public class class_name {
private void paintForeground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) {
SeaGlassPainter foregroundPainter = style.getForegroundPainter(ctx);
if (foregroundPainter != null) {
paint(foregroundPainter, ctx, g, x, y, w, h, transform);
}
} } | public class class_name {
private void paintForeground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) {
SeaGlassPainter foregroundPainter = style.getForegroundPainter(ctx);
if (foregroundPainter != null) {
paint(foregroundPainter, ctx, g, x, y, w, h, transform); // depends on control dependency: [if], data = [(foregroundPainter]
}
} } |
public class class_name {
@Override
public String getFormattedMessage() {
// LOG4J2-763: cache formatted string in case obj changes later
if (objectString == null) {
objectString = String.valueOf(obj);
}
return objectString;
} } | public class class_name {
@Override
public String getFormattedMessage() {
// LOG4J2-763: cache formatted string in case obj changes later
if (objectString == null) {
objectString = String.valueOf(obj); // depends on control dependency: [if], data = [none]
}
return objectString;
} } |
public class class_name {
private void connect(DeviceProxy deviceProxy, String attributeName,
String eventName, DeviceData deviceData) throws DevFailed {
String deviceName = deviceProxy.fullName();
int tangoVersion = deviceData.extractLongStringArray().lvalue[0];
try {
String adminName = deviceProxy.adm_name(); //.toLowerCase();
// Since Tango 8.1, heartbeat is sent in lower case.
//tangoVersion = new DeviceProxy(adm_name).getTangoVersion();
if (tangoVersion>=810)
adminName = adminName.toLowerCase();
// If no connection exists to this channel, create it
Database database = null;
if (!channel_map.containsKey(adminName)) {
if (deviceProxy.use_db())
database = deviceProxy.get_db_obj();
ConnectionStructure connectionStructure =
new ConnectionStructure(deviceProxy.get_tango_host(),
adminName, deviceName, attributeName,
eventName, database, deviceData, false);
connect_event_channel(connectionStructure);
} else if (deviceProxy.use_db()) {
database = deviceProxy.get_db_obj();
ZMQutils.connectEvent(deviceProxy.get_tango_host(), deviceName,
attributeName, deviceData.extractLongStringArray(), eventName,false);
}
EventChannelStruct eventChannelStruct = channel_map.get(adminName);
eventChannelStruct.adm_device_proxy = new DeviceProxy(adminName);
eventChannelStruct.use_db = deviceProxy.use_db();
eventChannelStruct.dbase = database;
eventChannelStruct.setTangoRelease(tangoVersion);
device_channel_map.put(deviceName, adminName);
}
catch (DevFailed e) {
Except.throw_event_system_failed("API_BadConfigurationProperty",
"Can't subscribe to event for device " + deviceName
+ "\n Check that device server is running...",
"ZmqEventConsumer.connect");
}
} } | public class class_name {
private void connect(DeviceProxy deviceProxy, String attributeName,
String eventName, DeviceData deviceData) throws DevFailed {
String deviceName = deviceProxy.fullName();
int tangoVersion = deviceData.extractLongStringArray().lvalue[0];
try {
String adminName = deviceProxy.adm_name(); //.toLowerCase();
// Since Tango 8.1, heartbeat is sent in lower case.
//tangoVersion = new DeviceProxy(adm_name).getTangoVersion();
if (tangoVersion>=810)
adminName = adminName.toLowerCase();
// If no connection exists to this channel, create it
Database database = null;
if (!channel_map.containsKey(adminName)) {
if (deviceProxy.use_db())
database = deviceProxy.get_db_obj();
ConnectionStructure connectionStructure =
new ConnectionStructure(deviceProxy.get_tango_host(),
adminName, deviceName, attributeName,
eventName, database, deviceData, false);
connect_event_channel(connectionStructure); // depends on control dependency: [if], data = [none]
} else if (deviceProxy.use_db()) {
database = deviceProxy.get_db_obj(); // depends on control dependency: [if], data = [none]
ZMQutils.connectEvent(deviceProxy.get_tango_host(), deviceName,
attributeName, deviceData.extractLongStringArray(), eventName,false); // depends on control dependency: [if], data = [none]
}
EventChannelStruct eventChannelStruct = channel_map.get(adminName);
eventChannelStruct.adm_device_proxy = new DeviceProxy(adminName);
eventChannelStruct.use_db = deviceProxy.use_db();
eventChannelStruct.dbase = database;
eventChannelStruct.setTangoRelease(tangoVersion);
device_channel_map.put(deviceName, adminName);
}
catch (DevFailed e) {
Except.throw_event_system_failed("API_BadConfigurationProperty",
"Can't subscribe to event for device " + deviceName
+ "\n Check that device server is running...",
"ZmqEventConsumer.connect");
}
} } |
public class class_name {
public void marshall(GetMasterAccountRequest getMasterAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (getMasterAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetMasterAccountRequest getMasterAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (getMasterAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} 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 BasicTagList copyOf(Map<String, String> tags) {
SmallTagMap.Builder builder = SmallTagMap.builder();
for (Map.Entry<String, String> tag : tags.entrySet()) {
builder.add(Tags.newTag(tag.getKey(), tag.getValue()));
}
return new BasicTagList(builder.result());
} } | public class class_name {
public static BasicTagList copyOf(Map<String, String> tags) {
SmallTagMap.Builder builder = SmallTagMap.builder();
for (Map.Entry<String, String> tag : tags.entrySet()) {
builder.add(Tags.newTag(tag.getKey(), tag.getValue())); // depends on control dependency: [for], data = [tag]
}
return new BasicTagList(builder.result());
} } |
public class class_name {
public static int[] validate4(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 2 || data.length == 4,
"Need either 1, 2, or 4 %s values, got %s values: %s",
paramName, data.length, data);
if(data.length == 1){
return new int[]{data[0], data[0], data[0], data[0]};
} else if(data.length == 2){
return new int[]{data[0], data[0], data[1], data[1]};
} else {
return data;
}
} } | public class class_name {
public static int[] validate4(int[] data, String paramName){
if(data == null) {
return null; // depends on control dependency: [if], data = [none]
}
Preconditions.checkArgument(data.length == 1 || data.length == 2 || data.length == 4,
"Need either 1, 2, or 4 %s values, got %s values: %s",
paramName, data.length, data);
if(data.length == 1){
return new int[]{data[0], data[0], data[0], data[0]}; // depends on control dependency: [if], data = [none]
} else if(data.length == 2){
return new int[]{data[0], data[0], data[1], data[1]}; // depends on control dependency: [if], data = [none]
} else {
return data; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
if ((gadget_ == null) || (gadget_.getNumSamples() == 0)) {
return toByteArray(serDe, null);
} else {
return toByteArray(serDe, gadget_.getValueAtPosition(0).getClass());
}
} } | public class class_name {
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
if ((gadget_ == null) || (gadget_.getNumSamples() == 0)) {
return toByteArray(serDe, null); // depends on control dependency: [if], data = [none]
} else {
return toByteArray(serDe, gadget_.getValueAtPosition(0).getClass()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void writeGridInPmeshFormat(String outPutFileName, double cutOff) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(outPutFileName + ".pmesh"));
boolean negative = false;
if (cutOff < 0) {
negative = true;
} else {
negative = false;
}
int numberOfGridPoints = 0;
for (int z = 0; z < grid[0][0].length; z++) {
for (int y = 0; y < grid[0].length; y++) {
for (int x = 0; x < grid.length; x++) {
if (negative) {
if (grid[x][y][z] <= cutOff) {
numberOfGridPoints++;
}
} else {
if (grid[x][y][z] >= cutOff) {
numberOfGridPoints++;
}
}
}
}
}
writer.write(numberOfGridPoints + "\n");
for (int z = 0; z < grid[0][0].length; z++) {
for (int y = 0; y < grid[0].length; y++) {
for (int x = 0; x < grid.length; x++) {
Point3d coords = getCoordinatesFromGridPoint(new Point3d(x, y, z));
if (negative) {
if (grid[x][y][z] <= cutOff) {
writer.write(coords.x + "\t" + coords.y + "\t" + coords.z + "\n");
}
} else {
if (grid[x][y][z] >= cutOff) {
writer.write(coords.x + "\t" + coords.y + "\t" + coords.z + "\n");
}
}
}
}
}
writer.close();
} } | public class class_name {
public void writeGridInPmeshFormat(String outPutFileName, double cutOff) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(outPutFileName + ".pmesh"));
boolean negative = false;
if (cutOff < 0) {
negative = true;
} else {
negative = false;
}
int numberOfGridPoints = 0;
for (int z = 0; z < grid[0][0].length; z++) {
for (int y = 0; y < grid[0].length; y++) {
for (int x = 0; x < grid.length; x++) {
if (negative) {
if (grid[x][y][z] <= cutOff) {
numberOfGridPoints++; // depends on control dependency: [if], data = [none]
}
} else {
if (grid[x][y][z] >= cutOff) {
numberOfGridPoints++; // depends on control dependency: [if], data = [none]
}
}
}
}
}
writer.write(numberOfGridPoints + "\n");
for (int z = 0; z < grid[0][0].length; z++) {
for (int y = 0; y < grid[0].length; y++) {
for (int x = 0; x < grid.length; x++) {
Point3d coords = getCoordinatesFromGridPoint(new Point3d(x, y, z));
if (negative) {
if (grid[x][y][z] <= cutOff) {
writer.write(coords.x + "\t" + coords.y + "\t" + coords.z + "\n");
}
} else {
if (grid[x][y][z] >= cutOff) {
writer.write(coords.x + "\t" + coords.y + "\t" + coords.z + "\n");
}
}
}
}
}
writer.close();
} } |
public class class_name {
public void marshall(PutEventSelectorsRequest putEventSelectorsRequest, ProtocolMarshaller protocolMarshaller) {
if (putEventSelectorsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putEventSelectorsRequest.getTrailName(), TRAILNAME_BINDING);
protocolMarshaller.marshall(putEventSelectorsRequest.getEventSelectors(), EVENTSELECTORS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PutEventSelectorsRequest putEventSelectorsRequest, ProtocolMarshaller protocolMarshaller) {
if (putEventSelectorsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putEventSelectorsRequest.getTrailName(), TRAILNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putEventSelectorsRequest.getEventSelectors(), EVENTSELECTORS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void printModel() {
Util.logPrint("Model:");
for (Map.Entry<String, Map<String, Assertion>> entry : model.entrySet()) {
for (Map.Entry<String, Assertion> entry2 : entry.getValue().entrySet()) {
Util.logPrintf("%s.%s: %s", entry.getKey(), entry2.getKey(), entry2.getValue().value);
}
}
} } | public class class_name {
public void printModel() {
Util.logPrint("Model:");
for (Map.Entry<String, Map<String, Assertion>> entry : model.entrySet()) {
for (Map.Entry<String, Assertion> entry2 : entry.getValue().entrySet()) {
Util.logPrintf("%s.%s: %s", entry.getKey(), entry2.getKey(), entry2.getValue().value); // depends on control dependency: [for], data = [entry2]
}
}
} } |
public class class_name {
@Override
public String unit( CssFormatter formatter ) {
if( type == UNKNOWN ) {
eval( formatter );
}
return unit;
} } | public class class_name {
@Override
public String unit( CssFormatter formatter ) {
if( type == UNKNOWN ) {
eval( formatter ); // depends on control dependency: [if], data = [none]
}
return unit;
} } |
public class class_name {
public ActivityImpl parseSubProcess(Element subProcessElement, ScopeImpl scope) {
ActivityImpl subProcessActivity = createActivityOnScope(subProcessElement, scope);
subProcessActivity.setSubProcessScope(true);
parseAsynchronousContinuationForActivity(subProcessElement, subProcessActivity);
Boolean isTriggeredByEvent = parseBooleanAttribute(subProcessElement.attribute("triggeredByEvent"), false);
subProcessActivity.getProperties().set(BpmnProperties.TRIGGERED_BY_EVENT, isTriggeredByEvent);
subProcessActivity.setProperty(PROPERTYNAME_CONSUMES_COMPENSATION, !isTriggeredByEvent);
subProcessActivity.setScope(true);
if (isTriggeredByEvent) {
subProcessActivity.setActivityBehavior(new EventSubProcessActivityBehavior());
subProcessActivity.setEventScope(scope);
} else {
subProcessActivity.setActivityBehavior(new SubProcessActivityBehavior());
}
parseScope(subProcessElement, subProcessActivity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseSubProcess(subProcessElement, scope, subProcessActivity);
}
return subProcessActivity;
} } | public class class_name {
public ActivityImpl parseSubProcess(Element subProcessElement, ScopeImpl scope) {
ActivityImpl subProcessActivity = createActivityOnScope(subProcessElement, scope);
subProcessActivity.setSubProcessScope(true);
parseAsynchronousContinuationForActivity(subProcessElement, subProcessActivity);
Boolean isTriggeredByEvent = parseBooleanAttribute(subProcessElement.attribute("triggeredByEvent"), false);
subProcessActivity.getProperties().set(BpmnProperties.TRIGGERED_BY_EVENT, isTriggeredByEvent);
subProcessActivity.setProperty(PROPERTYNAME_CONSUMES_COMPENSATION, !isTriggeredByEvent);
subProcessActivity.setScope(true);
if (isTriggeredByEvent) {
subProcessActivity.setActivityBehavior(new EventSubProcessActivityBehavior()); // depends on control dependency: [if], data = [none]
subProcessActivity.setEventScope(scope); // depends on control dependency: [if], data = [none]
} else {
subProcessActivity.setActivityBehavior(new SubProcessActivityBehavior()); // depends on control dependency: [if], data = [none]
}
parseScope(subProcessElement, subProcessActivity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseSubProcess(subProcessElement, scope, subProcessActivity); // depends on control dependency: [for], data = [parseListener]
}
return subProcessActivity;
} } |
public class class_name {
public void init() {
numLabels = model.data.numLabels();
numFeatures = model.feaGen.numFeatures();
if (numLabels <= 0 || numFeatures <= 0) {
System.out.println("Invalid number of labels or features");
return;
}
lambda = model.lambda;
tempLambda = new double[numFeatures];
gradLogLi = new double[numFeatures];
diag = new double[numFeatures];
temp = new double[numLabels];
int wsSize = numFeatures * (2 * model.option.mForHessian + 1) +
2 * model.option.mForHessian;
ws = new double[wsSize];
iprint = new int[2];
iflag = new int[1];
} } | public class class_name {
public void init() {
numLabels = model.data.numLabels();
numFeatures = model.feaGen.numFeatures();
if (numLabels <= 0 || numFeatures <= 0) {
System.out.println("Invalid number of labels or features"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
lambda = model.lambda;
tempLambda = new double[numFeatures];
gradLogLi = new double[numFeatures];
diag = new double[numFeatures];
temp = new double[numLabels];
int wsSize = numFeatures * (2 * model.option.mForHessian + 1) +
2 * model.option.mForHessian;
ws = new double[wsSize];
iprint = new int[2];
iflag = new int[1];
} } |
public class class_name {
@Override
public void onNext(final T event) {
LOG.log(Level.FINEST, "Invoked for event: {0}", event);
lock.readLock().lock();
final List<EventHandler<? extends T>> list;
try {
list = clazzToListOfHandlersMap.get(event.getClass());
if (list == null) {
throw new WakeRuntimeException("No event " + event.getClass() + " handler");
}
for (final EventHandler<? extends T> handler : list) {
LOG.log(Level.FINEST, "Invoking {0}", handler);
((EventHandler<T>) handler).onNext(event);
}
} finally {
lock.readLock().unlock();
}
} } | public class class_name {
@Override
public void onNext(final T event) {
LOG.log(Level.FINEST, "Invoked for event: {0}", event);
lock.readLock().lock();
final List<EventHandler<? extends T>> list;
try {
list = clazzToListOfHandlersMap.get(event.getClass()); // depends on control dependency: [try], data = [none]
if (list == null) {
throw new WakeRuntimeException("No event " + event.getClass() + " handler");
}
for (final EventHandler<? extends T> handler : list) {
LOG.log(Level.FINEST, "Invoking {0}", handler); // depends on control dependency: [for], data = [handler]
((EventHandler<T>) handler).onNext(event); // depends on control dependency: [for], data = [handler]
}
} finally {
lock.readLock().unlock();
}
} } |
public class class_name {
@Override
public void rollLogs() {
summaryFile = null;
List<IncidentImpl> incidentCopies;
synchronized (incidents) {
incidentCopies = new ArrayList<IncidentImpl>(incidents.values());
}
int overage = incidentCopies.size() - 500;
if (overage > 0) {
// we have more than 500 incidents: we need to remove least-recently-seen
// incidents until we're back to 500. We do this daily to prevent unchecked growth
// in the number of incidents we remember
List<IncidentImpl> lastSeenIncidents = new ArrayList<IncidentImpl>(incidentCopies);
// sort the incidents by when they were last seen, rather than when they were added
Collections.sort(lastSeenIncidents, new Comparator<IncidentImpl>() {
@Override
public int compare(IncidentImpl o1, IncidentImpl o2) {
// static method on double does the same as Long.compareTo, and we avoid
// object allocation or auto-boxing, etc.
return Double.compare(o1.getTimeStamp(), o2.getTimeStamp());
}
});
// For each item we're over 500, remove one from the front of the list (least recently seen)
synchronized (incidents) {
for (Iterator<IncidentImpl> i = lastSeenIncidents.iterator(); i.hasNext() && overage > 0; overage--) {
IncidentImpl impl = i.next();
i.remove();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "FFDC cleanup -- removing " + impl.key);
}
// remove the incident from the map, and clean it up (remove the associated files)
incidents.remove(impl.key);
impl.cleanup();
}
}
}
for (IncidentImpl incident : incidentCopies) {
incident.roll();
}
logSummary(incidentCopies);
} } | public class class_name {
@Override
public void rollLogs() {
summaryFile = null;
List<IncidentImpl> incidentCopies;
synchronized (incidents) {
incidentCopies = new ArrayList<IncidentImpl>(incidents.values());
}
int overage = incidentCopies.size() - 500;
if (overage > 0) {
// we have more than 500 incidents: we need to remove least-recently-seen
// incidents until we're back to 500. We do this daily to prevent unchecked growth
// in the number of incidents we remember
List<IncidentImpl> lastSeenIncidents = new ArrayList<IncidentImpl>(incidentCopies);
// sort the incidents by when they were last seen, rather than when they were added
Collections.sort(lastSeenIncidents, new Comparator<IncidentImpl>() {
@Override
public int compare(IncidentImpl o1, IncidentImpl o2) {
// static method on double does the same as Long.compareTo, and we avoid
// object allocation or auto-boxing, etc.
return Double.compare(o1.getTimeStamp(), o2.getTimeStamp());
}
}); // depends on control dependency: [if], data = [none]
// For each item we're over 500, remove one from the front of the list (least recently seen)
synchronized (incidents) { // depends on control dependency: [if], data = [none]
for (Iterator<IncidentImpl> i = lastSeenIncidents.iterator(); i.hasNext() && overage > 0; overage--) {
IncidentImpl impl = i.next();
i.remove(); // depends on control dependency: [for], data = [i]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "FFDC cleanup -- removing " + impl.key); // depends on control dependency: [if], data = [none]
}
// remove the incident from the map, and clean it up (remove the associated files)
incidents.remove(impl.key); // depends on control dependency: [for], data = [none]
impl.cleanup(); // depends on control dependency: [for], data = [none]
}
}
}
for (IncidentImpl incident : incidentCopies) {
incident.roll(); // depends on control dependency: [for], data = [incident]
}
logSummary(incidentCopies);
} } |
public class class_name {
private void ajaxSetFlowLock(final Project project,
final HashMap<String, Object> ret, final HttpServletRequest req)
throws ServletException {
final String flowName = getParam(req, FLOW_NAME_PARAM);
final Flow flow = project.getFlow(flowName);
if (flow == null) {
ret.put(ERROR_PARAM,
"Flow " + flowName + " not found in project " + project.getName());
return;
}
boolean isLocked = Boolean.parseBoolean(getParam(req, FLOW_IS_LOCKED_PARAM));
// if there is a change in the locked value, then check to see if the project has a flow trigger
// that needs to be paused/resumed.
if (isLocked != flow.isLocked()) {
try {
if (projectManager.hasFlowTrigger(project, flow)) {
if (isLocked) {
if (this.scheduler.pauseFlowTriggerIfPresent(project.getId(), flow.getId())) {
logger.info("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" is paused");
} else {
logger.warn("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" doesn't exist");
}
} else {
if (this.scheduler.resumeFlowTriggerIfPresent(project.getId(), flow.getId())) {
logger.info("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" is resumed");
} else {
logger.warn("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" doesn't exist");
}
}
}
} catch (Exception e) {
ret.put(ERROR_PARAM, e);
}
}
flow.setLocked(isLocked);
ret.put(FLOW_IS_LOCKED_PARAM, flow.isLocked());
ret.put(FLOW_ID_PARAM, flow.getId());
this.projectManager.updateFlow(project, flow);
} } | public class class_name {
private void ajaxSetFlowLock(final Project project,
final HashMap<String, Object> ret, final HttpServletRequest req)
throws ServletException {
final String flowName = getParam(req, FLOW_NAME_PARAM);
final Flow flow = project.getFlow(flowName);
if (flow == null) {
ret.put(ERROR_PARAM,
"Flow " + flowName + " not found in project " + project.getName());
return;
}
boolean isLocked = Boolean.parseBoolean(getParam(req, FLOW_IS_LOCKED_PARAM));
// if there is a change in the locked value, then check to see if the project has a flow trigger
// that needs to be paused/resumed.
if (isLocked != flow.isLocked()) {
try {
if (projectManager.hasFlowTrigger(project, flow)) {
if (isLocked) {
if (this.scheduler.pauseFlowTriggerIfPresent(project.getId(), flow.getId())) {
logger.info("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" is paused"); // depends on control dependency: [if], data = [none]
} else {
logger.warn("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" doesn't exist");
}
} else {
if (this.scheduler.resumeFlowTriggerIfPresent(project.getId(), flow.getId())) {
logger.info("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" is resumed");
} else {
logger.warn("Flow trigger for flow " + project.getName() + "." + flow.getId() +
" doesn't exist"); // depends on control dependency: [if], data = [none]
}
}
}
} catch (Exception e) {
ret.put(ERROR_PARAM, e);
} // depends on control dependency: [catch], data = [none]
}
flow.setLocked(isLocked);
ret.put(FLOW_IS_LOCKED_PARAM, flow.isLocked());
ret.put(FLOW_ID_PARAM, flow.getId());
this.projectManager.updateFlow(project, flow);
} } |
public class class_name {
public static String toXml(Object object) {
if (object == null) {
throw new NullPointerException("object对象不存在!");
}
JAXBContext jc = null;
Marshaller m = null;
String xml = null;
try {
jc = JAXBContext.newInstance(object.getClass());
m = jc.createMarshaller();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
m.marshal(object, bos);
xml = new String(bos.toByteArray());
} catch (Exception e) {
throw new RuntimeException(e);
}
return xml;
} } | public class class_name {
public static String toXml(Object object) {
if (object == null) {
throw new NullPointerException("object对象不存在!");
}
JAXBContext jc = null;
Marshaller m = null;
String xml = null;
try {
jc = JAXBContext.newInstance(object.getClass()); // depends on control dependency: [try], data = [none]
m = jc.createMarshaller(); // depends on control dependency: [try], data = [none]
ByteArrayOutputStream bos = new ByteArrayOutputStream();
m.marshal(object, bos); // depends on control dependency: [try], data = [none]
xml = new String(bos.toByteArray()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return xml;
} } |
public class class_name {
private static void computeTreeGraph(SharedTreeSubgraph sg, SharedTreeNode node, byte[] tree, ByteBufferWrapper ab, HashMap<Integer, AuxInfo> auxMap,
String names[], String[][] domains) {
int nodeType = ab.get1U();
int colId = ab.get2();
if (colId == 65535) {
float leafValue = ab.get4f();
node.setPredValue(leafValue);
return;
}
String colName = names[colId];
node.setCol(colId, colName);
int naSplitDir = ab.get1U();
boolean naVsRest = naSplitDir == NsdNaVsRest;
boolean leftward = naSplitDir == NsdNaLeft || naSplitDir == NsdLeft;
node.setLeftward(leftward);
node.setNaVsRest(naVsRest);
int lmask = (nodeType & 51);
int equal = (nodeType & 12); // Can be one of 0, 8, 12
assert equal != 4; // no longer supported
if (!naVsRest) {
// Extract value or group to split on
if (equal == 0) {
// Standard float-compare test (either < or ==)
float splitVal = ab.get4f(); // Get the float to compare
node.setSplitValue(splitVal);
} else {
// Bitset test
GenmodelBitSet bs = new GenmodelBitSet(0);
if (equal == 8)
bs.fill2(tree, ab);
else
bs.fill3(tree, ab);
node.setBitset(domains[colId], bs);
}
}
AuxInfo auxInfo = auxMap.get(node.getNodeNumber());
// go RIGHT
{
ByteBufferWrapper ab2 = new ByteBufferWrapper(tree);
ab2.skip(ab.position());
switch (lmask) {
case 0:
ab2.skip(ab2.get1U());
break;
case 1:
ab2.skip(ab2.get2());
break;
case 2:
ab2.skip(ab2.get3());
break;
case 3:
ab2.skip(ab2.get4());
break;
case 48:
ab2.skip(4);
break; // skip the prediction
default:
assert false : "illegal lmask value " + lmask + " in tree " + Arrays.toString(tree);
}
int lmask2 = (nodeType & 0xC0) >> 2; // Replace leftmask with the rightmask
SharedTreeNode newNode = sg.makeRightChildNode(node);
newNode.setWeight(auxInfo.weightR);
newNode.setNodeNumber(auxInfo.nidR);
newNode.setPredValue(auxInfo.predR);
newNode.setSquaredError(auxInfo.sqErrR);
if ((lmask2 & 16) != 0) {
float leafValue = ab2.get4f();
newNode.setPredValue(leafValue);
auxInfo.predR = leafValue;
}
else {
computeTreeGraph(sg, newNode, tree, ab2, auxMap, names, domains);
}
}
// go LEFT
{
ByteBufferWrapper ab2 = new ByteBufferWrapper(tree);
ab2.skip(ab.position());
if (lmask <= 3)
ab2.skip(lmask + 1);
SharedTreeNode newNode = sg.makeLeftChildNode(node);
newNode.setWeight(auxInfo.weightL);
newNode.setNodeNumber(auxInfo.nidL);
newNode.setPredValue(auxInfo.predL);
newNode.setSquaredError(auxInfo.sqErrL);
if ((lmask & 16) != 0) {
float leafValue = ab2.get4f();
newNode.setPredValue(leafValue);
auxInfo.predL = leafValue;
}
else {
computeTreeGraph(sg, newNode, tree, ab2, auxMap, names, domains);
}
}
if (node.getNodeNumber() == 0) {
float p = (float)(((double)auxInfo.predL*(double)auxInfo.weightL + (double)auxInfo.predR*(double)auxInfo.weightR)/((double)auxInfo.weightL + (double)auxInfo.weightR));
if (Math.abs(p) < 1e-7) p = 0;
node.setPredValue(p);
node.setSquaredError(auxInfo.sqErrR + auxInfo.sqErrL);
node.setWeight(auxInfo.weightL + auxInfo.weightR);
}
checkConsistency(auxInfo, node);
} } | public class class_name {
private static void computeTreeGraph(SharedTreeSubgraph sg, SharedTreeNode node, byte[] tree, ByteBufferWrapper ab, HashMap<Integer, AuxInfo> auxMap,
String names[], String[][] domains) {
int nodeType = ab.get1U();
int colId = ab.get2();
if (colId == 65535) {
float leafValue = ab.get4f();
node.setPredValue(leafValue); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
String colName = names[colId];
node.setCol(colId, colName);
int naSplitDir = ab.get1U();
boolean naVsRest = naSplitDir == NsdNaVsRest;
boolean leftward = naSplitDir == NsdNaLeft || naSplitDir == NsdLeft;
node.setLeftward(leftward);
node.setNaVsRest(naVsRest);
int lmask = (nodeType & 51);
int equal = (nodeType & 12); // Can be one of 0, 8, 12
assert equal != 4; // no longer supported
if (!naVsRest) {
// Extract value or group to split on
if (equal == 0) {
// Standard float-compare test (either < or ==)
float splitVal = ab.get4f(); // Get the float to compare
node.setSplitValue(splitVal); // depends on control dependency: [if], data = [none]
} else {
// Bitset test
GenmodelBitSet bs = new GenmodelBitSet(0);
if (equal == 8)
bs.fill2(tree, ab);
else
bs.fill3(tree, ab);
node.setBitset(domains[colId], bs); // depends on control dependency: [if], data = [none]
}
}
AuxInfo auxInfo = auxMap.get(node.getNodeNumber());
// go RIGHT
{
ByteBufferWrapper ab2 = new ByteBufferWrapper(tree);
ab2.skip(ab.position());
switch (lmask) {
case 0:
ab2.skip(ab2.get1U());
break;
case 1:
ab2.skip(ab2.get2());
break;
case 2:
ab2.skip(ab2.get3());
break;
case 3:
ab2.skip(ab2.get4());
break;
case 48:
ab2.skip(4);
break; // skip the prediction
default:
assert false : "illegal lmask value " + lmask + " in tree " + Arrays.toString(tree);
}
int lmask2 = (nodeType & 0xC0) >> 2; // Replace leftmask with the rightmask
SharedTreeNode newNode = sg.makeRightChildNode(node);
newNode.setWeight(auxInfo.weightR);
newNode.setNodeNumber(auxInfo.nidR);
newNode.setPredValue(auxInfo.predR);
newNode.setSquaredError(auxInfo.sqErrR);
if ((lmask2 & 16) != 0) {
float leafValue = ab2.get4f();
newNode.setPredValue(leafValue); // depends on control dependency: [if], data = [none]
auxInfo.predR = leafValue; // depends on control dependency: [if], data = [none]
}
else {
computeTreeGraph(sg, newNode, tree, ab2, auxMap, names, domains); // depends on control dependency: [if], data = [none]
}
}
// go LEFT
{
ByteBufferWrapper ab2 = new ByteBufferWrapper(tree);
ab2.skip(ab.position());
if (lmask <= 3)
ab2.skip(lmask + 1);
SharedTreeNode newNode = sg.makeLeftChildNode(node);
newNode.setWeight(auxInfo.weightL);
newNode.setNodeNumber(auxInfo.nidL);
newNode.setPredValue(auxInfo.predL);
newNode.setSquaredError(auxInfo.sqErrL);
if ((lmask & 16) != 0) {
float leafValue = ab2.get4f();
newNode.setPredValue(leafValue); // depends on control dependency: [if], data = [none]
auxInfo.predL = leafValue; // depends on control dependency: [if], data = [none]
}
else {
computeTreeGraph(sg, newNode, tree, ab2, auxMap, names, domains); // depends on control dependency: [if], data = [none]
}
}
if (node.getNodeNumber() == 0) {
float p = (float)(((double)auxInfo.predL*(double)auxInfo.weightL + (double)auxInfo.predR*(double)auxInfo.weightR)/((double)auxInfo.weightL + (double)auxInfo.weightR));
if (Math.abs(p) < 1e-7) p = 0;
node.setPredValue(p); // depends on control dependency: [if], data = [none]
node.setSquaredError(auxInfo.sqErrR + auxInfo.sqErrL); // depends on control dependency: [if], data = [none]
node.setWeight(auxInfo.weightL + auxInfo.weightR); // depends on control dependency: [if], data = [none]
}
checkConsistency(auxInfo, node);
} } |
public class class_name {
private static String replaceAll(String source, String search, String replace) {
if (USE_REPLACE_ALL) {
return source.replaceAll(search, replace);
} else {
Pattern p = Pattern.compile(search);
Matcher m = p.matcher(source);
StringBuffer sb = new StringBuffer();
boolean atLeastOneFound = false;
while (m.find()) {
m.appendReplacement(sb, replace);
atLeastOneFound = true;
}
if (atLeastOneFound) {
m.appendTail(sb);
return sb.toString();
} else {
return source;
}
}
} } | public class class_name {
private static String replaceAll(String source, String search, String replace) {
if (USE_REPLACE_ALL) {
return source.replaceAll(search, replace); // depends on control dependency: [if], data = [none]
} else {
Pattern p = Pattern.compile(search);
Matcher m = p.matcher(source);
StringBuffer sb = new StringBuffer();
boolean atLeastOneFound = false;
while (m.find()) {
m.appendReplacement(sb, replace); // depends on control dependency: [while], data = [none]
atLeastOneFound = true; // depends on control dependency: [while], data = [none]
}
if (atLeastOneFound) {
m.appendTail(sb); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
} else {
return source; // depends on control dependency: [if], data = [none]
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.