code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
@GwtIncompatible("incompatible method")
private static void register(final Object value) {
Set<IDKey> registry = getRegistry();
if (registry == null) {
registry = new HashSet<>();
REGISTRY.set(registry);
}
registry.add(new IDKey(value));
} } | public class class_name {
@GwtIncompatible("incompatible method")
private static void register(final Object value) {
Set<IDKey> registry = getRegistry();
if (registry == null) {
registry = new HashSet<>(); // depends on control dependency: [if], data = [none]
REGISTRY.set(registry); // depends on control dependency: [if], data = [(registry]
}
registry.add(new IDKey(value));
} } |
public class class_name {
protected void injectInstance(ManagedObject<?> managedObject, Object instance, InjectionTargetContext injectionContext) throws EJBException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "injectInstance : " + Util.identity(managedObject) + ", " + injectionContext);
// Its valid to just check the InjectionTargets visible to the bean itself,
// because any InjectionTargets visible to the interceptors were already
// processed when the interceptors were created.
BeanMetaData bmd = home.beanMetaData;
if (bmd.ivBeanInjectionTargets != null) {
try {
//if CDI is enabled then there will be a managedObject and it should be used for injection, otherwise go directly to the injection enging
if (managedObject != null) {
managedObject.inject(bmd.ivBeanInjectionTargets, injectionContext);
} else {
InjectionEngine injectionEngine = getInjectionEngine();
for (InjectionTarget injectionTarget : bmd.ivBeanInjectionTargets) {
injectionEngine.inject(ivEjbInstance, injectionTarget, injectionContext);
}
}
} catch (Throwable t) {
if (! (t instanceof ManagedObjectException)) {
FFDCFilter.processException(t, CLASS_NAME + ".injectInstance", "151", this);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "injectInstance : Injection failure", t);
throw ExceptionUtil.EJBException("Injection failure", t);
} else {
Throwable cause = t.getCause();
FFDCFilter.processException(cause, CLASS_NAME + ".injectInstance", "157", this);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "injectInstance : Injection failure", cause);
throw ExceptionUtil.EJBException("Injection failure", cause);
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "injectInstance");
} } | public class class_name {
protected void injectInstance(ManagedObject<?> managedObject, Object instance, InjectionTargetContext injectionContext) throws EJBException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "injectInstance : " + Util.identity(managedObject) + ", " + injectionContext);
// Its valid to just check the InjectionTargets visible to the bean itself,
// because any InjectionTargets visible to the interceptors were already
// processed when the interceptors were created.
BeanMetaData bmd = home.beanMetaData;
if (bmd.ivBeanInjectionTargets != null) {
try {
//if CDI is enabled then there will be a managedObject and it should be used for injection, otherwise go directly to the injection enging
if (managedObject != null) {
managedObject.inject(bmd.ivBeanInjectionTargets, injectionContext);
} else {
InjectionEngine injectionEngine = getInjectionEngine();
for (InjectionTarget injectionTarget : bmd.ivBeanInjectionTargets) {
injectionEngine.inject(ivEjbInstance, injectionTarget, injectionContext); // depends on control dependency: [for], data = [injectionTarget]
}
}
} catch (Throwable t) {
if (! (t instanceof ManagedObjectException)) {
FFDCFilter.processException(t, CLASS_NAME + ".injectInstance", "151", this);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "injectInstance : Injection failure", t);
throw ExceptionUtil.EJBException("Injection failure", t);
} else {
Throwable cause = t.getCause();
FFDCFilter.processException(cause, CLASS_NAME + ".injectInstance", "157", this);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "injectInstance : Injection failure", cause);
throw ExceptionUtil.EJBException("Injection failure", cause);
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "injectInstance");
} } |
public class class_name {
@Override
public EClass getIfcCompressor() {
if (ifcCompressorEClass == null) {
ifcCompressorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(115);
}
return ifcCompressorEClass;
} } | public class class_name {
@Override
public EClass getIfcCompressor() {
if (ifcCompressorEClass == null) {
ifcCompressorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(115);
// depends on control dependency: [if], data = [none]
}
return ifcCompressorEClass;
} } |
public class class_name {
public void setBackupIds(java.util.Collection<String> backupIds) {
if (backupIds == null) {
this.backupIds = null;
return;
}
this.backupIds = new java.util.ArrayList<String>(backupIds);
} } | public class class_name {
public void setBackupIds(java.util.Collection<String> backupIds) {
if (backupIds == null) {
this.backupIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.backupIds = new java.util.ArrayList<String>(backupIds);
} } |
public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY);
keyArea.addKeyField(ID, DBConstants.ASCENDING);
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.SECONDARY_KEY, NAME_KEY);
keyArea.addKeyField(NAME, DBConstants.ASCENDING);
}
if (iKeyArea == 2)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CODE_KEY);
keyArea.addKeyField(CODE, DBConstants.ASCENDING);
}
if (iKeyArea == 3)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, EXTERNAL_QUEUE_NAME_KEY);
keyArea.addKeyField(EXTERNAL_QUEUE_NAME, DBConstants.ASCENDING);
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} } | public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.SECONDARY_KEY, NAME_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 2)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CODE_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(CODE, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 3)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, EXTERNAL_QUEUE_NAME_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(EXTERNAL_QUEUE_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} } |
public class class_name {
public static String readString(ByteBuffer byteBuffer) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int read;
while ((read = byteBuffer.get()) != 0) {
out.write(read);
}
return Utf8.convert(out.toByteArray());
} } | public class class_name {
public static String readString(ByteBuffer byteBuffer) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int read;
while ((read = byteBuffer.get()) != 0) {
out.write(read); // depends on control dependency: [while], data = [none]
}
return Utf8.convert(out.toByteArray());
} } |
public class class_name {
private static boolean maybeInitMetaDataFromJsDoc(Builder builder, Node node) {
boolean messageHasDesc = false;
JSDocInfo info = node.getJSDocInfo();
if (info != null) {
String desc = info.getDescription();
if (desc != null) {
builder.setDesc(desc);
messageHasDesc = true;
}
if (info.isHidden()) {
builder.setIsHidden(true);
}
if (info.getMeaning() != null) {
builder.setMeaning(info.getMeaning());
}
}
return messageHasDesc;
} } | public class class_name {
private static boolean maybeInitMetaDataFromJsDoc(Builder builder, Node node) {
boolean messageHasDesc = false;
JSDocInfo info = node.getJSDocInfo();
if (info != null) {
String desc = info.getDescription();
if (desc != null) {
builder.setDesc(desc); // depends on control dependency: [if], data = [(desc]
messageHasDesc = true; // depends on control dependency: [if], data = [none]
}
if (info.isHidden()) {
builder.setIsHidden(true); // depends on control dependency: [if], data = [none]
}
if (info.getMeaning() != null) {
builder.setMeaning(info.getMeaning()); // depends on control dependency: [if], data = [(info.getMeaning()]
}
}
return messageHasDesc;
} } |
public class class_name {
public static void sendMimeMessage(MimeMessage mimeMessage) {
try {
Transport.send(mimeMessage);
} catch (MessagingException e) {
throw new IllegalStateException("Can not send message " + mimeMessage, e);
}
} } | public class class_name {
public static void sendMimeMessage(MimeMessage mimeMessage) {
try {
Transport.send(mimeMessage);
// depends on control dependency: [try], data = [none]
} catch (MessagingException e) {
throw new IllegalStateException("Can not send message " + mimeMessage, e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void init(RecordOwnerParent parent, String strSourcePrefix)
{
super.init(parent, strSourcePrefix);
if (this.getProperty("dayOffset") != null)
dayOffset = Integer.parseInt(this.getProperty("dayOffset"));
if (this.getProperty("monthOffset") != null)
monthOffset = Integer.parseInt(this.getProperty("monthOffset"));
if (this.getProperty("yearOffset") != null)
yearOffset = Integer.parseInt(this.getProperty("yearOffset"));
if (this.getProperty("endOfMonthFields") != null)
{
String fields = this.getProperty("endOfMonthFields");
eomFields = fields.split(",");
}
} } | public class class_name {
public void init(RecordOwnerParent parent, String strSourcePrefix)
{
super.init(parent, strSourcePrefix);
if (this.getProperty("dayOffset") != null)
dayOffset = Integer.parseInt(this.getProperty("dayOffset"));
if (this.getProperty("monthOffset") != null)
monthOffset = Integer.parseInt(this.getProperty("monthOffset"));
if (this.getProperty("yearOffset") != null)
yearOffset = Integer.parseInt(this.getProperty("yearOffset"));
if (this.getProperty("endOfMonthFields") != null)
{
String fields = this.getProperty("endOfMonthFields");
eomFields = fields.split(","); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void install(@Observes(precedence = 90) CubeDockerConfiguration configuration,
ArquillianDescriptor arquillianDescriptor) {
DockerCompositions cubes = configuration.getDockerContainersContent();
final SeleniumContainers seleniumContainers =
SeleniumContainers.create(getBrowser(arquillianDescriptor), cubeDroneConfigurationInstance.get());
cubes.add(seleniumContainers.getSeleniumContainerName(), seleniumContainers.getSeleniumContainer());
final boolean recording = cubeDroneConfigurationInstance.get().isRecording();
if (recording) {
cubes.add(seleniumContainers.getVncContainerName(), seleniumContainers.getVncContainer());
cubes.add(seleniumContainers.getVideoConverterContainerName(),
seleniumContainers.getVideoConverterContainer());
}
seleniumContainersInstanceProducer.set(seleniumContainers);
System.out.println("SELENIUM INSTALLED");
System.out.println(ConfigUtil.dump(cubes));
} } | public class class_name {
public void install(@Observes(precedence = 90) CubeDockerConfiguration configuration,
ArquillianDescriptor arquillianDescriptor) {
DockerCompositions cubes = configuration.getDockerContainersContent();
final SeleniumContainers seleniumContainers =
SeleniumContainers.create(getBrowser(arquillianDescriptor), cubeDroneConfigurationInstance.get());
cubes.add(seleniumContainers.getSeleniumContainerName(), seleniumContainers.getSeleniumContainer());
final boolean recording = cubeDroneConfigurationInstance.get().isRecording();
if (recording) {
cubes.add(seleniumContainers.getVncContainerName(), seleniumContainers.getVncContainer()); // depends on control dependency: [if], data = [none]
cubes.add(seleniumContainers.getVideoConverterContainerName(),
seleniumContainers.getVideoConverterContainer()); // depends on control dependency: [if], data = [none]
}
seleniumContainersInstanceProducer.set(seleniumContainers);
System.out.println("SELENIUM INSTALLED");
System.out.println(ConfigUtil.dump(cubes));
} } |
public class class_name {
public Document makeGridForm() {
Element rootElem = new Element("gridForm");
Document doc = new Document(rootElem);
rootElem.setAttribute("location", gds.getLocation());
if (null != path)
rootElem.setAttribute("path", path);
// its all about grids
List<GridDatatype> grids = gds.getGrids();
Collections.sort(grids, new GridComparator()); // sort by time axis, vert axis, grid name
CoordinateAxis currentTime = null;
CoordinateAxis currentVert = null;
Element timeElem = null;
Element vertElem = null;
boolean newTime;
for (int i = 0; i < grids.size(); i++) {
GeoGrid grid = (GeoGrid) grids.get(i);
GridCoordSystem gcs = grid.getCoordinateSystem();
CoordinateAxis time = gcs.getTimeAxis();
CoordinateAxis vert = gcs.getVerticalAxis();
/* System.out.println(" grid "+grid.getName()
+" time="+(time == null ? " null" : time.hashCode())
+" vert="+(vert == null ? " null" : vert.hashCode())); */
//Assuming all variables in dataset has ensemble dim if one has
if(i==0){
CoordinateAxis1D ens = gcs.getEnsembleAxis();
if(ens != null){
Element ensAxisEl = writeAxis2(ens, "ensemble");
rootElem.addContent(ensAxisEl);
}
}
if ((i == 0) || !compareAxis(time, currentTime)) {
timeElem = new Element("timeSet");
rootElem.addContent(timeElem);
Element timeAxisElement = writeAxis2(time, "time");
if (timeAxisElement != null)
timeElem.addContent(timeAxisElement);
currentTime = time;
newTime = true;
} else {
newTime = false;
}
if (newTime || !compareAxis(vert, currentVert)) {
vertElem = new Element("vertSet");
timeElem.addContent(vertElem);
Element vertAxisElement = writeAxis2(vert, "vert");
if (vertAxisElement != null)
vertElem.addContent(vertAxisElement);
currentVert = vert;
}
vertElem.addContent(writeGrid(grid));
}
// add lat/lon bounding box
LatLonRect bb = gds.getBoundingBox();
if (bb != null)
rootElem.addContent(writeBoundingBox(bb));
// add projected bounding box
//--> Asuming all gridSets have the same coordinates and bbox
ProjectionRect rect = grids.get(0).getCoordinateSystem().getBoundingBox();
Element projBBOX =new Element("projectionBox");
Element minx = new Element("minx");
minx.addContent( Double.valueOf(rect.getMinX()).toString() );
projBBOX.addContent(minx);
Element maxx = new Element("maxx");
maxx.addContent( Double.valueOf(rect.getMaxX()).toString() );
projBBOX.addContent(maxx);
Element miny = new Element("miny");
miny.addContent( Double.valueOf(rect.getMinY()).toString() );
projBBOX.addContent(miny);
Element maxy = new Element("maxy");
maxy.addContent( Double.valueOf(rect.getMaxY()).toString() );
projBBOX.addContent(maxy);
rootElem.addContent(projBBOX);
// add date range
CalendarDate start = gds.getCalendarDateStart();
CalendarDate end = gds.getCalendarDateEnd();
if ((start != null) && (end != null)) {
Element dateRange = new Element("TimeSpan");
dateRange.addContent(new Element("begin").addContent(start.toString()));
dateRange.addContent(new Element("end").addContent(end.toString()));
rootElem.addContent(dateRange);
}
// add accept list
addAcceptList(rootElem);
// Element elem = new Element("AcceptList");
// elem.addContent(new Element("accept").addContent("xml"));
// elem.addContent(new Element("accept").addContent("csv"));
// elem.addContent(new Element("accept").addContent("netcdf"));
// rootElem.addContent(elem);
return doc;
} } | public class class_name {
public Document makeGridForm() {
Element rootElem = new Element("gridForm");
Document doc = new Document(rootElem);
rootElem.setAttribute("location", gds.getLocation());
if (null != path)
rootElem.setAttribute("path", path);
// its all about grids
List<GridDatatype> grids = gds.getGrids();
Collections.sort(grids, new GridComparator()); // sort by time axis, vert axis, grid name
CoordinateAxis currentTime = null;
CoordinateAxis currentVert = null;
Element timeElem = null;
Element vertElem = null;
boolean newTime;
for (int i = 0; i < grids.size(); i++) {
GeoGrid grid = (GeoGrid) grids.get(i);
GridCoordSystem gcs = grid.getCoordinateSystem();
CoordinateAxis time = gcs.getTimeAxis();
CoordinateAxis vert = gcs.getVerticalAxis();
/* System.out.println(" grid "+grid.getName()
+" time="+(time == null ? " null" : time.hashCode())
+" vert="+(vert == null ? " null" : vert.hashCode())); */
//Assuming all variables in dataset has ensemble dim if one has
if(i==0){
CoordinateAxis1D ens = gcs.getEnsembleAxis();
if(ens != null){
Element ensAxisEl = writeAxis2(ens, "ensemble");
rootElem.addContent(ensAxisEl);
// depends on control dependency: [if], data = [(ens]
}
}
if ((i == 0) || !compareAxis(time, currentTime)) {
timeElem = new Element("timeSet");
// depends on control dependency: [if], data = [none]
rootElem.addContent(timeElem);
// depends on control dependency: [if], data = [none]
Element timeAxisElement = writeAxis2(time, "time");
if (timeAxisElement != null)
timeElem.addContent(timeAxisElement);
currentTime = time;
// depends on control dependency: [if], data = [none]
newTime = true;
// depends on control dependency: [if], data = [none]
} else {
newTime = false;
// depends on control dependency: [if], data = [none]
}
if (newTime || !compareAxis(vert, currentVert)) {
vertElem = new Element("vertSet");
// depends on control dependency: [if], data = [none]
timeElem.addContent(vertElem);
// depends on control dependency: [if], data = [none]
Element vertAxisElement = writeAxis2(vert, "vert");
if (vertAxisElement != null)
vertElem.addContent(vertAxisElement);
currentVert = vert;
// depends on control dependency: [if], data = [none]
}
vertElem.addContent(writeGrid(grid));
// depends on control dependency: [for], data = [none]
}
// add lat/lon bounding box
LatLonRect bb = gds.getBoundingBox();
if (bb != null)
rootElem.addContent(writeBoundingBox(bb));
// add projected bounding box
//--> Asuming all gridSets have the same coordinates and bbox
ProjectionRect rect = grids.get(0).getCoordinateSystem().getBoundingBox();
Element projBBOX =new Element("projectionBox");
Element minx = new Element("minx");
minx.addContent( Double.valueOf(rect.getMinX()).toString() );
projBBOX.addContent(minx);
Element maxx = new Element("maxx");
maxx.addContent( Double.valueOf(rect.getMaxX()).toString() );
projBBOX.addContent(maxx);
Element miny = new Element("miny");
miny.addContent( Double.valueOf(rect.getMinY()).toString() );
projBBOX.addContent(miny);
Element maxy = new Element("maxy");
maxy.addContent( Double.valueOf(rect.getMaxY()).toString() );
projBBOX.addContent(maxy);
rootElem.addContent(projBBOX);
// add date range
CalendarDate start = gds.getCalendarDateStart();
CalendarDate end = gds.getCalendarDateEnd();
if ((start != null) && (end != null)) {
Element dateRange = new Element("TimeSpan");
dateRange.addContent(new Element("begin").addContent(start.toString()));
// depends on control dependency: [if], data = [none]
dateRange.addContent(new Element("end").addContent(end.toString()));
// depends on control dependency: [if], data = [none]
rootElem.addContent(dateRange);
// depends on control dependency: [if], data = [none]
}
// add accept list
addAcceptList(rootElem);
// Element elem = new Element("AcceptList");
// elem.addContent(new Element("accept").addContent("xml"));
// elem.addContent(new Element("accept").addContent("csv"));
// elem.addContent(new Element("accept").addContent("netcdf"));
// rootElem.addContent(elem);
return doc;
} } |
public class class_name {
public void get(final String path, final HttpResponseCallback callback) {
if (path == null) {
postCallbackOnMainThread(callback, new IllegalArgumentException("Path cannot be null"));
return;
}
final String url;
if (path.startsWith("http")) {
url = path;
} else {
url = mBaseUrl + path;
}
mThreadPool.submit(new Runnable() {
@Override
public void run() {
HttpURLConnection connection = null;
try {
connection = init(url);
connection.setRequestMethod(METHOD_GET);
postCallbackOnMainThread(callback, parseResponse(connection));
} catch (Exception e) {
postCallbackOnMainThread(callback, e);
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
});
} } | public class class_name {
public void get(final String path, final HttpResponseCallback callback) {
if (path == null) {
postCallbackOnMainThread(callback, new IllegalArgumentException("Path cannot be null")); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final String url;
if (path.startsWith("http")) {
url = path; // depends on control dependency: [if], data = [none]
} else {
url = mBaseUrl + path; // depends on control dependency: [if], data = [none]
}
mThreadPool.submit(new Runnable() {
@Override
public void run() {
HttpURLConnection connection = null;
try {
connection = init(url); // depends on control dependency: [try], data = [none]
connection.setRequestMethod(METHOD_GET); // depends on control dependency: [try], data = [none]
postCallbackOnMainThread(callback, parseResponse(connection)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
postCallbackOnMainThread(callback, e);
} finally { // depends on control dependency: [catch], data = [none]
if (connection != null) {
connection.disconnect(); // depends on control dependency: [if], data = [none]
}
}
}
});
} } |
public class class_name {
private void onTokenRefresh() {
if (enabledPushTypes == null) {
enabledPushTypes = this.deviceInfo.getEnabledPushTypes();
}
if (enabledPushTypes == null) return;
for (PushType pushType : enabledPushTypes) {
switch (pushType) {
case GCM:
doGCMRefresh();
break;
case FCM:
doFCMRefresh();
break;
default:
//no-op
break;
}
}
} } | public class class_name {
private void onTokenRefresh() {
if (enabledPushTypes == null) {
enabledPushTypes = this.deviceInfo.getEnabledPushTypes(); // depends on control dependency: [if], data = [none]
}
if (enabledPushTypes == null) return;
for (PushType pushType : enabledPushTypes) {
switch (pushType) {
case GCM:
doGCMRefresh();
break;
case FCM:
doFCMRefresh();
break;
default:
//no-op
break;
}
}
} } |
public class class_name {
private void removeInstancesFromContainers(PackingPlanBuilder packingPlanBuilder,
Map<String, Integer> componentsToScaleDown) {
for (String componentName : componentsToScaleDown.keySet()) {
int numInstancesToRemove = -componentsToScaleDown.get(componentName);
for (int j = 0; j < numInstancesToRemove; j++) {
removeRRInstance(packingPlanBuilder, componentName);
}
}
} } | public class class_name {
private void removeInstancesFromContainers(PackingPlanBuilder packingPlanBuilder,
Map<String, Integer> componentsToScaleDown) {
for (String componentName : componentsToScaleDown.keySet()) {
int numInstancesToRemove = -componentsToScaleDown.get(componentName);
for (int j = 0; j < numInstancesToRemove; j++) {
removeRRInstance(packingPlanBuilder, componentName); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void to(WebContext context) {
if (entity == null) {
return;
}
HttpServletResponse response = context.response();
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Type", mediaType);
if (status > 0) {
response.setStatus(status);
}
if (entity instanceof String) {
response.getWriter().write((String) entity);
return;
}
GsonBuilder builder = new GsonBuilder();
Set<Class<?>> classes = new HashSet<Class<?>>();
parse(entity.getClass(), classes);
for (Class<?> clazz : classes) {
builder.registerTypeAdapter(clazz, new ValueTypeJsonSerializer<Object>());
}
// XXX: Any options?
Gson gson = builder.create();
response.getWriter().write(gson.toJson(entity));
} catch (IOException e) {
throw new UncheckedException(e);
}
} } | public class class_name {
public void to(WebContext context) {
if (entity == null) {
return; // depends on control dependency: [if], data = [none]
}
HttpServletResponse response = context.response();
try {
response.setCharacterEncoding("UTF-8"); // depends on control dependency: [try], data = [none]
response.setHeader("Content-Type", mediaType); // depends on control dependency: [try], data = [none]
if (status > 0) {
response.setStatus(status); // depends on control dependency: [if], data = [(status]
}
if (entity instanceof String) {
response.getWriter().write((String) entity); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
GsonBuilder builder = new GsonBuilder();
Set<Class<?>> classes = new HashSet<Class<?>>(); // depends on control dependency: [try], data = [none]
parse(entity.getClass(), classes); // depends on control dependency: [try], data = [none]
for (Class<?> clazz : classes) {
builder.registerTypeAdapter(clazz, new ValueTypeJsonSerializer<Object>()); // depends on control dependency: [for], data = [clazz]
}
// XXX: Any options?
Gson gson = builder.create();
response.getWriter().write(gson.toJson(entity)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new UncheckedException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Fraction of(final int whole, final int numerator, final int denominator, boolean reduce) {
if (denominator == 0) {
throw new ArithmeticException("The denominator must not be zero");
}
if (denominator < 0) {
throw new ArithmeticException("The denominator must not be negative");
}
if (numerator < 0) {
throw new ArithmeticException("The numerator must not be negative");
}
long numeratorValue;
if (whole < 0) {
numeratorValue = whole * (long) denominator - numerator;
} else {
numeratorValue = whole * (long) denominator + numerator;
}
if (numeratorValue < Integer.MIN_VALUE || numeratorValue > Integer.MAX_VALUE) {
throw new ArithmeticException("Numerator too large to represent as an Integer.");
}
return of((int) numeratorValue, denominator, reduce);
} } | public class class_name {
public static Fraction of(final int whole, final int numerator, final int denominator, boolean reduce) {
if (denominator == 0) {
throw new ArithmeticException("The denominator must not be zero");
}
if (denominator < 0) {
throw new ArithmeticException("The denominator must not be negative");
}
if (numerator < 0) {
throw new ArithmeticException("The numerator must not be negative");
}
long numeratorValue;
if (whole < 0) {
numeratorValue = whole * (long) denominator - numerator; // depends on control dependency: [if], data = [none]
} else {
numeratorValue = whole * (long) denominator + numerator; // depends on control dependency: [if], data = [none]
}
if (numeratorValue < Integer.MIN_VALUE || numeratorValue > Integer.MAX_VALUE) {
throw new ArithmeticException("Numerator too large to represent as an Integer.");
}
return of((int) numeratorValue, denominator, reduce);
} } |
public class class_name {
private static <L extends Annotation> String defineLimitStatement(final SQLiteModelMethod method, final JQL result, Class<L> annotation, Map<JQLDynamicStatementType, String> dynamicReplace) {
StringBuilder builder = new StringBuilder();
int pageSize = AnnotationUtility.extractAsInt(method.getElement(), annotation, AnnotationAttributeType.PAGE_SIZE);
if (pageSize > 0) {
result.annotatedPageSize = true;
}
final One<String> pageDynamicName = new One<String>(null);
forEachParameter(method, new OnMethodParameterListener() {
@Override
public void onMethodParameter(VariableElement methodParam) {
if (methodParam.getAnnotation(BindSqlPageSize.class) != null) {
pageDynamicName.value0 = methodParam.getSimpleName().toString();
result.paramPageSize = pageDynamicName.value0;
// CONSTRAINT: @BindSqlWhereArgs can be used only on
// String[] parameter type
AssertKripton.assertTrueOrInvalidTypeForAnnotationMethodParameterException(TypeUtility.isEquals(TypeName.INT, TypeUtility.typeName(methodParam)), method.getParent().getElement(),
method.getElement(), methodParam, BindSqlPageSize.class);
}
}
});
if (pageSize > 0 || StringUtils.hasText(pageDynamicName.value0) || method.isPagedLiveData()) {
builder.append(" " + LIMIT_KEYWORD + " ");
if (pageSize > 0) {
builder.append(pageSize);
} else {
String temp0 = "#{" + JQLDynamicStatementType.DYNAMIC_PAGE_SIZE + "}";
builder.append(temp0);
dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_SIZE, temp0);
}
// define replacement string for PAGE_SIZE
String temp1 = " " + OFFSET_KEYWORD + " #{" + JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET + "}";
builder.append(temp1);
dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET, temp1);
}
return builder.toString();
} } | public class class_name {
private static <L extends Annotation> String defineLimitStatement(final SQLiteModelMethod method, final JQL result, Class<L> annotation, Map<JQLDynamicStatementType, String> dynamicReplace) {
StringBuilder builder = new StringBuilder();
int pageSize = AnnotationUtility.extractAsInt(method.getElement(), annotation, AnnotationAttributeType.PAGE_SIZE);
if (pageSize > 0) {
result.annotatedPageSize = true; // depends on control dependency: [if], data = [none]
}
final One<String> pageDynamicName = new One<String>(null);
forEachParameter(method, new OnMethodParameterListener() {
@Override
public void onMethodParameter(VariableElement methodParam) {
if (methodParam.getAnnotation(BindSqlPageSize.class) != null) {
pageDynamicName.value0 = methodParam.getSimpleName().toString(); // depends on control dependency: [if], data = [none]
result.paramPageSize = pageDynamicName.value0; // depends on control dependency: [if], data = [none]
// CONSTRAINT: @BindSqlWhereArgs can be used only on
// String[] parameter type
AssertKripton.assertTrueOrInvalidTypeForAnnotationMethodParameterException(TypeUtility.isEquals(TypeName.INT, TypeUtility.typeName(methodParam)), method.getParent().getElement(),
method.getElement(), methodParam, BindSqlPageSize.class); // depends on control dependency: [if], data = [none]
}
}
});
if (pageSize > 0 || StringUtils.hasText(pageDynamicName.value0) || method.isPagedLiveData()) {
builder.append(" " + LIMIT_KEYWORD + " "); // depends on control dependency: [if], data = [none]
if (pageSize > 0) {
builder.append(pageSize); // depends on control dependency: [if], data = [(pageSize]
} else {
String temp0 = "#{" + JQLDynamicStatementType.DYNAMIC_PAGE_SIZE + "}";
builder.append(temp0);
dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_SIZE, temp0);
}
// define replacement string for PAGE_SIZE
String temp1 = " " + OFFSET_KEYWORD + " #{" + JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET + "}";
builder.append(temp1); // depends on control dependency: [if], data = [none]
dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET, temp1); // depends on control dependency: [if], data = [none]
}
return builder.toString();
} } |
public class class_name {
public void marshall(SourceCredentialsInfo sourceCredentialsInfo, ProtocolMarshaller protocolMarshaller) {
if (sourceCredentialsInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sourceCredentialsInfo.getArn(), ARN_BINDING);
protocolMarshaller.marshall(sourceCredentialsInfo.getServerType(), SERVERTYPE_BINDING);
protocolMarshaller.marshall(sourceCredentialsInfo.getAuthType(), AUTHTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(SourceCredentialsInfo sourceCredentialsInfo, ProtocolMarshaller protocolMarshaller) {
if (sourceCredentialsInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sourceCredentialsInfo.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sourceCredentialsInfo.getServerType(), SERVERTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sourceCredentialsInfo.getAuthType(), AUTHTYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(ListPhoneNumberOrdersRequest listPhoneNumberOrdersRequest, ProtocolMarshaller protocolMarshaller) {
if (listPhoneNumberOrdersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listPhoneNumberOrdersRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listPhoneNumberOrdersRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListPhoneNumberOrdersRequest listPhoneNumberOrdersRequest, ProtocolMarshaller protocolMarshaller) {
if (listPhoneNumberOrdersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listPhoneNumberOrdersRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listPhoneNumberOrdersRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public int getBaseline(int width, int height) {
if (timeTextField.isVisible()) {
return timeTextField.getBaseline(width, height);
}
return super.getBaseline(width, height);
} } | public class class_name {
@Override
public int getBaseline(int width, int height) {
if (timeTextField.isVisible()) {
return timeTextField.getBaseline(width, height); // depends on control dependency: [if], data = [none]
}
return super.getBaseline(width, height);
} } |
public class class_name {
public static void generateInstructionsToUnpackArrayAccordingToDescriptor(MethodVisitor mv,
String toCallDescriptor,
int arrayVariableIndex) {
int arrayIndex = 0;
int descriptorIndex = 1;
char ch;
while ((ch = toCallDescriptor.charAt(descriptorIndex)) != ')') {
mv.visitVarInsn(ALOAD, arrayVariableIndex);
mv.visitLdcInsn(arrayIndex++);
mv.visitInsn(AALOAD);
switch (ch) {
case 'L':
int semicolon = toCallDescriptor.indexOf(';', descriptorIndex + 1);
String descriptor = toCallDescriptor.substring(descriptorIndex + 1, semicolon);
if (!descriptor.equals("java/lang/Object")) {
mv.visitTypeInsn(CHECKCAST, descriptor);
}
descriptorIndex = semicolon + 1;
break;
case '[':
int idx = descriptorIndex;
// maybe a primitive array or an reference type array
while (toCallDescriptor.charAt(++descriptorIndex) == '[') {
}
// next char is either a primitive or L
if (toCallDescriptor.charAt(descriptorIndex) == 'L') {
int semicolon2 = toCallDescriptor.indexOf(';', descriptorIndex + 1);
descriptorIndex = semicolon2 + 1;
mv.visitTypeInsn(CHECKCAST, toCallDescriptor.substring(idx, semicolon2 + 1));
}
else {
mv.visitTypeInsn(CHECKCAST, toCallDescriptor.substring(idx, descriptorIndex + 1));
descriptorIndex++;
}
break;
case 'I':
case 'Z':
case 'S':
case 'F':
case 'J':
case 'D':
case 'C':
case 'B':
Utils.insertUnboxInsns(mv, ch, true);
descriptorIndex++;
break;
default:
throw new IllegalStateException("Unexpected type descriptor character: " + ch);
}
}
} } | public class class_name {
public static void generateInstructionsToUnpackArrayAccordingToDescriptor(MethodVisitor mv,
String toCallDescriptor,
int arrayVariableIndex) {
int arrayIndex = 0;
int descriptorIndex = 1;
char ch;
while ((ch = toCallDescriptor.charAt(descriptorIndex)) != ')') {
mv.visitVarInsn(ALOAD, arrayVariableIndex); // depends on control dependency: [while], data = [none]
mv.visitLdcInsn(arrayIndex++); // depends on control dependency: [while], data = [none]
mv.visitInsn(AALOAD); // depends on control dependency: [while], data = [none]
switch (ch) {
case 'L':
int semicolon = toCallDescriptor.indexOf(';', descriptorIndex + 1);
String descriptor = toCallDescriptor.substring(descriptorIndex + 1, semicolon);
if (!descriptor.equals("java/lang/Object")) {
mv.visitTypeInsn(CHECKCAST, descriptor); // depends on control dependency: [if], data = [none]
}
descriptorIndex = semicolon + 1;
break;
case '[':
int idx = descriptorIndex;
// maybe a primitive array or an reference type array
while (toCallDescriptor.charAt(++descriptorIndex) == '[') {
}
// next char is either a primitive or L
if (toCallDescriptor.charAt(descriptorIndex) == 'L') {
int semicolon2 = toCallDescriptor.indexOf(';', descriptorIndex + 1);
descriptorIndex = semicolon2 + 1; // depends on control dependency: [if], data = [none]
mv.visitTypeInsn(CHECKCAST, toCallDescriptor.substring(idx, semicolon2 + 1)); // depends on control dependency: [if], data = [none]
}
else {
mv.visitTypeInsn(CHECKCAST, toCallDescriptor.substring(idx, descriptorIndex + 1)); // depends on control dependency: [if], data = [none]
descriptorIndex++; // depends on control dependency: [if], data = [none]
}
break;
case 'I':
case 'Z':
case 'S':
case 'F':
case 'J':
case 'D':
case 'C':
case 'B':
Utils.insertUnboxInsns(mv, ch, true);
descriptorIndex++;
break;
default:
throw new IllegalStateException("Unexpected type descriptor character: " + ch);
}
}
} } |
public class class_name {
public EClass getIfcPile() {
if (ifcPileEClass == null) {
ifcPileEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(354);
}
return ifcPileEClass;
} } | public class class_name {
public EClass getIfcPile() {
if (ifcPileEClass == null) {
ifcPileEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(354);
// depends on control dependency: [if], data = [none]
}
return ifcPileEClass;
} } |
public class class_name {
public DescribeFpgaImagesResult withFpgaImages(FpgaImage... fpgaImages) {
if (this.fpgaImages == null) {
setFpgaImages(new com.amazonaws.internal.SdkInternalList<FpgaImage>(fpgaImages.length));
}
for (FpgaImage ele : fpgaImages) {
this.fpgaImages.add(ele);
}
return this;
} } | public class class_name {
public DescribeFpgaImagesResult withFpgaImages(FpgaImage... fpgaImages) {
if (this.fpgaImages == null) {
setFpgaImages(new com.amazonaws.internal.SdkInternalList<FpgaImage>(fpgaImages.length)); // depends on control dependency: [if], data = [none]
}
for (FpgaImage ele : fpgaImages) {
this.fpgaImages.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private static Method findMatchingMethod(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) {
// Check self
Method result = findMethodOnClass(originalMethod, methodName, classToSearch, ctx, originalClass);
// Check interfaces
if (result == null) {
for (Type iface : getClass(classToSearch).getGenericInterfaces()) {
ctx.push(iface);
result = findMatchingMethod(originalMethod, methodName, iface, ctx, originalClass);
ctx.pop();
if (result != null) {
break;
}
}
}
// Check superclass
if (result == null) {
Type superclass = getClass(classToSearch).getGenericSuperclass();
if (superclass != null) {
ctx.push(superclass);
result = findMatchingMethod(originalMethod, methodName, superclass, ctx, originalClass);
ctx.pop();
}
}
return result;
} } | public class class_name {
private static Method findMatchingMethod(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) {
// Check self
Method result = findMethodOnClass(originalMethod, methodName, classToSearch, ctx, originalClass);
// Check interfaces
if (result == null) {
for (Type iface : getClass(classToSearch).getGenericInterfaces()) {
ctx.push(iface); // depends on control dependency: [for], data = [iface]
result = findMatchingMethod(originalMethod, methodName, iface, ctx, originalClass); // depends on control dependency: [for], data = [iface]
ctx.pop(); // depends on control dependency: [for], data = [none]
if (result != null) {
break;
}
}
}
// Check superclass
if (result == null) {
Type superclass = getClass(classToSearch).getGenericSuperclass();
if (superclass != null) {
ctx.push(superclass); // depends on control dependency: [if], data = [(superclass]
result = findMatchingMethod(originalMethod, methodName, superclass, ctx, originalClass); // depends on control dependency: [if], data = [none]
ctx.pop(); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void setConf(Configuration conf) {
this.conf = conf;
String proxyStr = conf.get("hadoop.socks.server");
if ((proxyStr != null) && (proxyStr.length() > 0)) {
setProxy(proxyStr);
}
} } | public class class_name {
public void setConf(Configuration conf) {
this.conf = conf;
String proxyStr = conf.get("hadoop.socks.server");
if ((proxyStr != null) && (proxyStr.length() > 0)) {
setProxy(proxyStr); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public URL convert(String value) {
URL converted = null;
if (value != null) {
try {
converted = new URL(value);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e);
}
}
return converted;
} } | public class class_name {
@Override
public URL convert(String value) {
URL converted = null;
if (value != null) {
try {
converted = new URL(value); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
}
return converted;
} } |
public class class_name {
public void setValue(String columnName, Object value) {
D6ModelClassFieldInfo fieldInfo = mFieldMap.get(columnName);
if (fieldInfo != null) {
fieldInfo.value = value;
}
else {
// case field info is null
final String[] parts = columnName.split("__");
if (parts.length > 0 && mFieldMap.containsKey(parts[0])) {
// check is field composit type like MySQL's Geometry
D6ModelClassFieldInfo compositTypeFieldInfo = mFieldMap.get(parts[0]);
if (compositTypeFieldInfo.valuesForSpecialType == null) {
compositTypeFieldInfo.valuesForSpecialType = new ArrayList<Object>();
}
compositTypeFieldInfo.valuesForSpecialType.add(value);
}
}
} } | public class class_name {
public void setValue(String columnName, Object value) {
D6ModelClassFieldInfo fieldInfo = mFieldMap.get(columnName);
if (fieldInfo != null) {
fieldInfo.value = value;
// depends on control dependency: [if], data = [none]
}
else {
// case field info is null
final String[] parts = columnName.split("__");
if (parts.length > 0 && mFieldMap.containsKey(parts[0])) {
// check is field composit type like MySQL's Geometry
D6ModelClassFieldInfo compositTypeFieldInfo = mFieldMap.get(parts[0]);
if (compositTypeFieldInfo.valuesForSpecialType == null) {
compositTypeFieldInfo.valuesForSpecialType = new ArrayList<Object>();
// depends on control dependency: [if], data = [none]
}
compositTypeFieldInfo.valuesForSpecialType.add(value);
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void addLocalizedFolder(String uri) {
m_localizedFolders.add(uri);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_LOCALIZED_1, uri));
}
} } | public class class_name {
public void addLocalizedFolder(String uri) {
m_localizedFolders.add(uri);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_LOCALIZED_1, uri)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static String nameWithoutPrefix(String name) {
if (name.startsWith("get")) {
name = name.substring(3);
} else {
assert name.startsWith("is");
name = name.substring(2);
}
return PropertyNames.decapitalizeLikeJavaBeans(name);
} } | public class class_name {
private static String nameWithoutPrefix(String name) {
if (name.startsWith("get")) {
name = name.substring(3); // depends on control dependency: [if], data = [none]
} else {
assert name.startsWith("is");
name = name.substring(2); // depends on control dependency: [if], data = [none]
}
return PropertyNames.decapitalizeLikeJavaBeans(name);
} } |
public class class_name {
private StructureInterface findNcsRef(StructureInterface interf) {
if (!this.hasNcsOps()) {
return null;
}
String chainIName = interf.getMoleculeIds().getFirst();
String iOrigName = chainOrigNames.get(chainIName);
String chainJName = interf.getMoleculeIds().getSecond();
String jOrigName = chainOrigNames.get(chainJName);
Matrix4d mJCryst;
if(this.searchBeyondAU) {
mJCryst = interf.getTransforms().getSecond().getMatTransform();
mJCryst = crystallographicInfo.getCrystalCell().transfToOrthonormal(mJCryst);
} else {
mJCryst = IDENTITY;
}
// Let X1,...Xn be the original coords, before NCS transforms (M1...Mk)
// current chain i: M_i * X_i
// current chain j: Cn * M_j * X_j
// transformation to bring chain j near X_i: M_i^(-1) * Cn * M_j
// transformation to bring chain i near X_j: (Cn * M_j)^(-1) * M_i = (M_i^(-1) * Cn * M_j)^(-1)
Matrix4d mChainIInv = new Matrix4d(chainNcsOps.get(chainIName));
mChainIInv.invert();
Matrix4d mJNcs = new Matrix4d(chainNcsOps.get(chainJName));
Matrix4d j2iNcsOrigin = new Matrix4d(mChainIInv);
j2iNcsOrigin.mul(mJCryst);
//overall transformation to bring current chainj from its NCS origin to i's
j2iNcsOrigin.mul(mJNcs);
//overall transformation to bring current chaini from its NCS origin to j's
Matrix4d i2jNcsOrigin = new Matrix4d(j2iNcsOrigin);
i2jNcsOrigin.invert();
String matchChainIdsIJ = iOrigName + jOrigName;
String matchChainIdsJI = jOrigName + iOrigName;
// same original chain names
Optional<Matrix4d> matchDirect =
visitedNcsChainPairs.computeIfAbsent(matchChainIdsIJ, k-> new HashMap<>()).entrySet().stream().
map(r->r.getKey()).
filter(r->r.epsilonEquals(j2iNcsOrigin,0.01)).
findFirst();
Matrix4d matchMatrix = matchDirect.orElse(null);
String matchChainIds = matchChainIdsIJ;
if(matchMatrix == null) {
// reversed original chain names with inverted transform
Optional<Matrix4d> matchInverse =
visitedNcsChainPairs.computeIfAbsent(matchChainIdsJI, k-> new HashMap<>()).entrySet().stream().
map(r->r.getKey()).
filter(r->r.epsilonEquals(i2jNcsOrigin,0.01)).
findFirst();
matchMatrix = matchInverse.orElse(null);
matchChainIds = matchChainIdsJI;
}
StructureInterface matchInterface = null;
if (matchMatrix == null) {
visitedNcsChainPairs.get(matchChainIdsIJ).put(j2iNcsOrigin,interf);
} else {
matchInterface = visitedNcsChainPairs.get(matchChainIds).get(matchMatrix);
}
return matchInterface;
} } | public class class_name {
private StructureInterface findNcsRef(StructureInterface interf) {
if (!this.hasNcsOps()) {
return null; // depends on control dependency: [if], data = [none]
}
String chainIName = interf.getMoleculeIds().getFirst();
String iOrigName = chainOrigNames.get(chainIName);
String chainJName = interf.getMoleculeIds().getSecond();
String jOrigName = chainOrigNames.get(chainJName);
Matrix4d mJCryst;
if(this.searchBeyondAU) {
mJCryst = interf.getTransforms().getSecond().getMatTransform(); // depends on control dependency: [if], data = [none]
mJCryst = crystallographicInfo.getCrystalCell().transfToOrthonormal(mJCryst); // depends on control dependency: [if], data = [none]
} else {
mJCryst = IDENTITY; // depends on control dependency: [if], data = [none]
}
// Let X1,...Xn be the original coords, before NCS transforms (M1...Mk)
// current chain i: M_i * X_i
// current chain j: Cn * M_j * X_j
// transformation to bring chain j near X_i: M_i^(-1) * Cn * M_j
// transformation to bring chain i near X_j: (Cn * M_j)^(-1) * M_i = (M_i^(-1) * Cn * M_j)^(-1)
Matrix4d mChainIInv = new Matrix4d(chainNcsOps.get(chainIName));
mChainIInv.invert();
Matrix4d mJNcs = new Matrix4d(chainNcsOps.get(chainJName));
Matrix4d j2iNcsOrigin = new Matrix4d(mChainIInv);
j2iNcsOrigin.mul(mJCryst);
//overall transformation to bring current chainj from its NCS origin to i's
j2iNcsOrigin.mul(mJNcs);
//overall transformation to bring current chaini from its NCS origin to j's
Matrix4d i2jNcsOrigin = new Matrix4d(j2iNcsOrigin);
i2jNcsOrigin.invert();
String matchChainIdsIJ = iOrigName + jOrigName;
String matchChainIdsJI = jOrigName + iOrigName;
// same original chain names
Optional<Matrix4d> matchDirect =
visitedNcsChainPairs.computeIfAbsent(matchChainIdsIJ, k-> new HashMap<>()).entrySet().stream().
map(r->r.getKey()).
filter(r->r.epsilonEquals(j2iNcsOrigin,0.01)).
findFirst();
Matrix4d matchMatrix = matchDirect.orElse(null);
String matchChainIds = matchChainIdsIJ;
if(matchMatrix == null) {
// reversed original chain names with inverted transform
Optional<Matrix4d> matchInverse =
visitedNcsChainPairs.computeIfAbsent(matchChainIdsJI, k-> new HashMap<>()).entrySet().stream().
map(r->r.getKey()).
filter(r->r.epsilonEquals(i2jNcsOrigin,0.01)).
findFirst();
matchMatrix = matchInverse.orElse(null); // depends on control dependency: [if], data = [null)]
matchChainIds = matchChainIdsJI; // depends on control dependency: [if], data = [none]
}
StructureInterface matchInterface = null;
if (matchMatrix == null) {
visitedNcsChainPairs.get(matchChainIdsIJ).put(j2iNcsOrigin,interf); // depends on control dependency: [if], data = [none]
} else {
matchInterface = visitedNcsChainPairs.get(matchChainIds).get(matchMatrix); // depends on control dependency: [if], data = [(matchMatrix]
}
return matchInterface;
} } |
public class class_name {
@Override
public int size() {
Iterator<E> iter = iterator();
int count = 0;
while (iter.hasNext()) {
iter.next();
count++;
}
return count;
} } | public class class_name {
@Override
public int size() {
Iterator<E> iter = iterator();
int count = 0;
while (iter.hasNext()) {
iter.next(); // depends on control dependency: [while], data = [none]
count++; // depends on control dependency: [while], data = [none]
}
return count;
} } |
public class class_name {
public static String createSign(Map<String, String> packageParams, String signKey) {
SortedMap<String, String> sortedMap = new TreeMap<String, String>();
sortedMap.putAll(packageParams);
List<String> keys = new ArrayList<String>(packageParams.keySet());
Collections.sort(keys);
StringBuffer toSign = new StringBuffer();
for (String key : keys) {
String value = packageParams.get(key);
if (null != value && !"".equals(value) && !"sign".equals(key)
&& !"key".equals(key)) {
toSign.append(key + "=" + value + "&");
}
}
toSign.append("key=" + signKey);
String sign = DigestUtils.md5Hex(toSign.toString())
.toUpperCase();
return sign;
} } | public class class_name {
public static String createSign(Map<String, String> packageParams, String signKey) {
SortedMap<String, String> sortedMap = new TreeMap<String, String>();
sortedMap.putAll(packageParams);
List<String> keys = new ArrayList<String>(packageParams.keySet());
Collections.sort(keys);
StringBuffer toSign = new StringBuffer();
for (String key : keys) {
String value = packageParams.get(key);
if (null != value && !"".equals(value) && !"sign".equals(key)
&& !"key".equals(key)) {
toSign.append(key + "=" + value + "&");
// depends on control dependency: [if], data = [none]
}
}
toSign.append("key=" + signKey);
String sign = DigestUtils.md5Hex(toSign.toString())
.toUpperCase();
return sign;
} } |
public class class_name {
@PublicEvolving
public void setCharset(String charset) {
this.charsetName = Preconditions.checkNotNull(charset);
this.charset = null;
if (this.delimiterString != null) {
this.delimiter = delimiterString.getBytes(getCharset());
}
} } | public class class_name {
@PublicEvolving
public void setCharset(String charset) {
this.charsetName = Preconditions.checkNotNull(charset);
this.charset = null;
if (this.delimiterString != null) {
this.delimiter = delimiterString.getBytes(getCharset()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void create(Insets defInsets) {
setLayout(new BorderLayout());
addKeyListener(this);
Panel p = new Panel(new GridLayout(6, 2, 10, 10));
p.addKeyListener(this);
p.setBackground(SystemColor.control);
p.add(createLabel("Type:"));
Choice types = new Choice();
types.addItemListener(this);
types.addKeyListener(this);
for (int i = 0; i < sJDBCTypes.length; i++) {
types.add(sJDBCTypes[i][0]);
}
p.add(types);
p.add(createLabel("Driver:"));
mDriver = new TextField("org.hsqldb_voltpatches.jdbcDriver");
mDriver.addKeyListener(this);
p.add(mDriver);
p.add(createLabel("URL:"));
mURL = new TextField("jdbc:hsqldb:mem:.");
mURL.addKeyListener(this);
p.add(mURL);
p.add(createLabel("User:"));
mUser = new TextField("SA");
mUser.addKeyListener(this);
p.add(mUser);
p.add(createLabel("Password:"));
mPassword = new TextField("");
mPassword.addKeyListener(this);
mPassword.setEchoChar('*');
p.add(mPassword);
Button b;
b = new Button("Cancel");
b.setActionCommand("ConnectCancel");
b.addActionListener(this);
b.addKeyListener(this);
p.add(b);
b = new Button("Ok");
b.setActionCommand("ConnectOk");
b.addActionListener(this);
b.addKeyListener(this);
p.add(b);
setLayout(new BorderLayout());
add("East", createLabel(" "));
add("West", createLabel(" "));
mError = new Label("");
Panel pMessage = createBorderPanel(mError);
pMessage.addKeyListener(this);
add("South", pMessage);
add("North", createLabel(""));
add("Center", p);
doLayout();
pack();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Dimension size = getSize();
if (d.width > 640) {
setLocation((d.width - size.width) / 2,
(d.height - size.height) / 2);
} else if (defInsets.top > 0 && defInsets.left > 0) {
setLocation(defInsets.bottom, defInsets.right);
setSize(defInsets.top, defInsets.left);
// full size on screen with less than 640 width
} else {
setLocation(0, 0);
setSize(d);
}
show();
} } | public class class_name {
void create(Insets defInsets) {
setLayout(new BorderLayout());
addKeyListener(this);
Panel p = new Panel(new GridLayout(6, 2, 10, 10));
p.addKeyListener(this);
p.setBackground(SystemColor.control);
p.add(createLabel("Type:"));
Choice types = new Choice();
types.addItemListener(this);
types.addKeyListener(this);
for (int i = 0; i < sJDBCTypes.length; i++) {
types.add(sJDBCTypes[i][0]); // depends on control dependency: [for], data = [i]
}
p.add(types);
p.add(createLabel("Driver:"));
mDriver = new TextField("org.hsqldb_voltpatches.jdbcDriver");
mDriver.addKeyListener(this);
p.add(mDriver);
p.add(createLabel("URL:"));
mURL = new TextField("jdbc:hsqldb:mem:.");
mURL.addKeyListener(this);
p.add(mURL);
p.add(createLabel("User:"));
mUser = new TextField("SA");
mUser.addKeyListener(this);
p.add(mUser);
p.add(createLabel("Password:"));
mPassword = new TextField("");
mPassword.addKeyListener(this);
mPassword.setEchoChar('*');
p.add(mPassword);
Button b;
b = new Button("Cancel");
b.setActionCommand("ConnectCancel");
b.addActionListener(this);
b.addKeyListener(this);
p.add(b);
b = new Button("Ok");
b.setActionCommand("ConnectOk");
b.addActionListener(this);
b.addKeyListener(this);
p.add(b);
setLayout(new BorderLayout());
add("East", createLabel(" "));
add("West", createLabel(" "));
mError = new Label("");
Panel pMessage = createBorderPanel(mError);
pMessage.addKeyListener(this);
add("South", pMessage);
add("North", createLabel(""));
add("Center", p);
doLayout();
pack();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Dimension size = getSize();
if (d.width > 640) {
setLocation((d.width - size.width) / 2,
(d.height - size.height) / 2); // depends on control dependency: [if], data = [(d.width]
} else if (defInsets.top > 0 && defInsets.left > 0) {
setLocation(defInsets.bottom, defInsets.right); // depends on control dependency: [if], data = [none]
setSize(defInsets.top, defInsets.left); // depends on control dependency: [if], data = [(defInsets.top]
// full size on screen with less than 640 width
} else {
setLocation(0, 0); // depends on control dependency: [if], data = [none]
setSize(d); // depends on control dependency: [if], data = [none]
}
show();
} } |
public class class_name {
@Override
public void processMessage() {
VectorAggregation aggregation = new VectorAggregation(rowIndex, (short) voidConfiguration.getNumberOfShards(),
getShardIndex(), storage.getArray(key).getRow(rowIndex).dup());
aggregation.setOriginatorId(this.getOriginatorId());
clipboard.pin(aggregation);
DistributedVectorMessage dvm = new DistributedVectorMessage(key, rowIndex);
dvm.setOriginatorId(this.originatorId);
if (voidConfiguration.getNumberOfShards() > 1)
transport.sendMessageToAllShards(dvm);
else {
aggregation.extractContext(this);
aggregation.processMessage();
}
} } | public class class_name {
@Override
public void processMessage() {
VectorAggregation aggregation = new VectorAggregation(rowIndex, (short) voidConfiguration.getNumberOfShards(),
getShardIndex(), storage.getArray(key).getRow(rowIndex).dup());
aggregation.setOriginatorId(this.getOriginatorId());
clipboard.pin(aggregation);
DistributedVectorMessage dvm = new DistributedVectorMessage(key, rowIndex);
dvm.setOriginatorId(this.originatorId);
if (voidConfiguration.getNumberOfShards() > 1)
transport.sendMessageToAllShards(dvm);
else {
aggregation.extractContext(this); // depends on control dependency: [if], data = [none]
aggregation.processMessage(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Object convert(Object model) {
if (model == null)
return null;
if (type == null)
return model;
// obj是基本数据类型或String
if (!(model instanceof Map) && !(model instanceof Iterable)) {
return Castors.me().castTo(model, Lang.getTypeClass(type));
}
return inject(model, type);
} } | public class class_name {
public Object convert(Object model) {
if (model == null)
return null;
if (type == null)
return model;
// obj是基本数据类型或String
if (!(model instanceof Map) && !(model instanceof Iterable)) {
return Castors.me().castTo(model, Lang.getTypeClass(type)); // depends on control dependency: [if], data = [none]
}
return inject(model, type);
} } |
public class class_name {
public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
if (statsStorageProvider != null) {
this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider);
}
} } | public class class_name {
public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
if (statsStorageProvider != null) {
this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider); // depends on control dependency: [if], data = [(statsStorageProvider]
}
} } |
public class class_name {
public static void load(
final CmsUUID structureId,
final boolean includeTargets,
final CmsUUID detailContentId,
final String startTab,
final Map<String, String> context,
final CloseHandler<PopupPanel> closeHandler) {
CmsRpcAction<CmsResourceStatusBean> action = new CmsRpcAction<CmsResourceStatusBean>() {
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getVfsService().getResourceStatus(
structureId,
CmsCoreProvider.get().getLocale(),
includeTargets,
detailContentId,
context,
this);
}
@Override
protected void onResponse(CmsResourceStatusBean result) {
stop(false);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(startTab)) {
result.setStartTab(CmsResourceStatusTabId.valueOf(startTab));
}
CmsResourceInfoDialog dialog = new CmsResourceInfoDialog(result, includeTargets, detailContentId);
if (closeHandler != null) {
dialog.addCloseHandler(closeHandler);
}
dialog.centerHorizontally(150);
}
};
action.execute();
} } | public class class_name {
public static void load(
final CmsUUID structureId,
final boolean includeTargets,
final CmsUUID detailContentId,
final String startTab,
final Map<String, String> context,
final CloseHandler<PopupPanel> closeHandler) {
CmsRpcAction<CmsResourceStatusBean> action = new CmsRpcAction<CmsResourceStatusBean>() {
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getVfsService().getResourceStatus(
structureId,
CmsCoreProvider.get().getLocale(),
includeTargets,
detailContentId,
context,
this);
}
@Override
protected void onResponse(CmsResourceStatusBean result) {
stop(false);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(startTab)) {
result.setStartTab(CmsResourceStatusTabId.valueOf(startTab));
// depends on control dependency: [if], data = [none]
}
CmsResourceInfoDialog dialog = new CmsResourceInfoDialog(result, includeTargets, detailContentId);
if (closeHandler != null) {
dialog.addCloseHandler(closeHandler);
// depends on control dependency: [if], data = [(closeHandler]
}
dialog.centerHorizontally(150);
}
};
action.execute();
} } |
public class class_name {
public boolean detectBlackBerryHigh() {
//Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser
if (detectBlackBerryWebKit()) {
return false;
}
if (detectBlackBerry()) {
if (detectBlackBerryTouch()
|| (userAgent.indexOf(deviceBBBold) != -1)
|| (userAgent.indexOf(deviceBBTour) != -1)
|| (userAgent.indexOf(deviceBBCurve) != -1)) {
return true;
} else {
return false;
}
} else {
return false;
}
} } | public class class_name {
public boolean detectBlackBerryHigh() {
//Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser
if (detectBlackBerryWebKit()) {
return false;
// depends on control dependency: [if], data = [none]
}
if (detectBlackBerry()) {
if (detectBlackBerryTouch()
|| (userAgent.indexOf(deviceBBBold) != -1)
|| (userAgent.indexOf(deviceBBTour) != -1)
|| (userAgent.indexOf(deviceBBCurve) != -1)) {
return true;
// depends on control dependency: [if], data = [none]
} else {
return false;
// depends on control dependency: [if], data = [none]
}
} else {
return false;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean isCompleteRequest(ByteBuffer buffer) {
DataInputStream inputStream = new DataInputStream(new ByteBufferBackedInputStream(buffer));
try {
int dataSize = inputStream.readInt();
if(logger.isTraceEnabled())
logger.trace("In isCompleteRequest, dataSize: " + dataSize + ", buffer position: "
+ buffer.position());
if(dataSize == -1)
return true;
// Here we skip over the data (without reading it in) and
// move our position to just past it.
buffer.position(buffer.position() + dataSize);
return true;
} catch(Exception e) {
// This could also occur if the various methods we call into
// re-throw a corrupted value error as some other type of exception.
// For example, updating the position on a buffer past its limit
// throws an InvalidArgumentException.
if(logger.isTraceEnabled())
logger.trace("In isCompleteRequest, probable partial read occurred: " + e);
return false;
}
} } | public class class_name {
@Override
public boolean isCompleteRequest(ByteBuffer buffer) {
DataInputStream inputStream = new DataInputStream(new ByteBufferBackedInputStream(buffer));
try {
int dataSize = inputStream.readInt();
if(logger.isTraceEnabled())
logger.trace("In isCompleteRequest, dataSize: " + dataSize + ", buffer position: "
+ buffer.position());
if(dataSize == -1)
return true;
// Here we skip over the data (without reading it in) and
// move our position to just past it.
buffer.position(buffer.position() + dataSize); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch(Exception e) {
// This could also occur if the various methods we call into
// re-throw a corrupted value error as some other type of exception.
// For example, updating the position on a buffer past its limit
// throws an InvalidArgumentException.
if(logger.isTraceEnabled())
logger.trace("In isCompleteRequest, probable partial read occurred: " + e);
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <X, Y> Map<Y, X> invert(Map<X, Y> map) {
Map<Y, X> invertedMap = new HashMap<Y, X>();
for (Map.Entry<X, Y> entry : map.entrySet()) {
X key = entry.getKey();
Y value = entry.getValue();
invertedMap.put(value, key);
}
return invertedMap;
} } | public class class_name {
public static <X, Y> Map<Y, X> invert(Map<X, Y> map) {
Map<Y, X> invertedMap = new HashMap<Y, X>();
for (Map.Entry<X, Y> entry : map.entrySet()) {
X key = entry.getKey();
Y value = entry.getValue();
invertedMap.put(value, key);
// depends on control dependency: [for], data = [none]
}
return invertedMap;
} } |
public class class_name {
protected boolean updateFileWindow(Dim.SourceInfo sourceInfo) {
String fileName = sourceInfo.url();
FileWindow w = getFileWindow(fileName);
if (w != null) {
w.updateText(sourceInfo);
w.show();
return true;
}
return false;
} } | public class class_name {
protected boolean updateFileWindow(Dim.SourceInfo sourceInfo) {
String fileName = sourceInfo.url();
FileWindow w = getFileWindow(fileName);
if (w != null) {
w.updateText(sourceInfo); // depends on control dependency: [if], data = [none]
w.show(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected final void indexSubclasses(Class<?>... classes) {
for (Class<?> klass : classes) {
indexedSuperclasses.add(klass.getCanonicalName());
}
annotationDriven = false;
} } | public class class_name {
protected final void indexSubclasses(Class<?>... classes) {
for (Class<?> klass : classes) {
indexedSuperclasses.add(klass.getCanonicalName()); // depends on control dependency: [for], data = [klass]
}
annotationDriven = false;
} } |
public class class_name {
public static Class<?> loadClass(String className,
ClassLoader classLoader) {
Class cls = (Class) classes.get( className );
if ( cls == null ) {
try {
cls = Class.forName( className );
} catch ( Exception e ) {
//swallow
}
//ConfFileFinder
if ( cls == null && classLoader != null ) {
try {
cls = classLoader.loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls == null ) {
try {
cls = ClassUtils.class.getClassLoader().loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls == null ) {
try {
cls = Thread.currentThread().getContextClassLoader().loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls == null ) {
try {
cls = ClassLoader.getSystemClassLoader().loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls != null ) {
classes.put( className, cls );
} else {
throw new RuntimeException( "Unable to load class '" + className + "'" );
}
}
return cls;
} } | public class class_name {
public static Class<?> loadClass(String className,
ClassLoader classLoader) {
Class cls = (Class) classes.get( className );
if ( cls == null ) {
try {
cls = Class.forName( className );
} catch ( Exception e ) {
//swallow
}
//ConfFileFinder
if ( cls == null && classLoader != null ) {
try {
cls = classLoader.loadClass( className ); // depends on control dependency: [try], data = [none]
} catch ( Exception e ) {
//swallow
} // depends on control dependency: [catch], data = [none]
}
if ( cls == null ) {
try {
cls = ClassUtils.class.getClassLoader().loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls == null ) {
try {
cls = Thread.currentThread().getContextClassLoader().loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls == null ) {
try {
cls = ClassLoader.getSystemClassLoader().loadClass( className );
} catch ( Exception e ) {
//swallow
}
}
if ( cls != null ) {
classes.put( className, cls );
} else {
throw new RuntimeException( "Unable to load class '" + className + "'" );
}
}
return cls;
} } |
public class class_name {
public static void initExceptionHandler(Context context) {
Log.d("AppRate", "Init AppRate ExceptionHandler");
Thread.UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
// Don't register again if already registered.
if (!(currentHandler instanceof ExceptionHandler)) {
// Register default exceptions handler.
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(currentHandler, context));
}
} } | public class class_name {
public static void initExceptionHandler(Context context) {
Log.d("AppRate", "Init AppRate ExceptionHandler");
Thread.UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
// Don't register again if already registered.
if (!(currentHandler instanceof ExceptionHandler)) {
// Register default exceptions handler.
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(currentHandler, context)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ImmutableNode toNode(final Builder builder, final Object obj) {
assert !(obj instanceof List);
if (obj instanceof Map) {
return mapToNode(builder, (Map<String, Object>) obj);
} else {
return valueToNode(builder, obj);
}
} } | public class class_name {
private ImmutableNode toNode(final Builder builder, final Object obj) {
assert !(obj instanceof List);
if (obj instanceof Map) {
return mapToNode(builder, (Map<String, Object>) obj); // depends on control dependency: [if], data = [none]
} else {
return valueToNode(builder, obj); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static int mergeBasicConstraints(X509Certificate cert, int maxPathLength) {
int pathLenConstraint = cert.getBasicConstraints();
if (!X509CertImpl.isSelfIssued(cert)) {
maxPathLength--;
}
if (pathLenConstraint < maxPathLength) {
maxPathLength = pathLenConstraint;
}
return maxPathLength;
} } | public class class_name {
static int mergeBasicConstraints(X509Certificate cert, int maxPathLength) {
int pathLenConstraint = cert.getBasicConstraints();
if (!X509CertImpl.isSelfIssued(cert)) {
maxPathLength--; // depends on control dependency: [if], data = [none]
}
if (pathLenConstraint < maxPathLength) {
maxPathLength = pathLenConstraint; // depends on control dependency: [if], data = [none]
}
return maxPathLength;
} } |
public class class_name {
@Override
void encode(byte[] in, int inPos, int inAvail) {
if (eof) {
return;
}
// inAvail < 0 is how we're informed of EOF in the underlying data we're
// encoding.
if (inAvail < 0) {
eof = true;
if (0 == modulus && lineLength == 0) {
return; // no leftovers to process and not using chunking
}
ensureBufferSize(encodeSize);
int savedPos = pos;
switch (modulus) { // 0-2
case 1: // 8 bits = 6 + 2
buffer[pos++] = encodeTable[(bitWorkArea >> 2) & MASK_6BITS]; // top 6 bits
buffer[pos++] = encodeTable[(bitWorkArea << 4) & MASK_6BITS]; // remaining 2
// URL-SAFE skips the padding to further reduce size.
if (encodeTable == STANDARD_ENCODE_TABLE) {
buffer[pos++] = PAD;
buffer[pos++] = PAD;
}
break;
case 2: // 16 bits = 6 + 6 + 4
buffer[pos++] = encodeTable[(bitWorkArea >> 10) & MASK_6BITS];
buffer[pos++] = encodeTable[(bitWorkArea >> 4) & MASK_6BITS];
buffer[pos++] = encodeTable[(bitWorkArea << 2) & MASK_6BITS];
// URL-SAFE skips the padding to further reduce size.
if (encodeTable == STANDARD_ENCODE_TABLE) {
buffer[pos++] = PAD;
}
break;
}
currentLinePos += pos - savedPos; // keep track of current line position
// if currentPos == 0 we are at the start of a line, so don't add CRLF
if (lineLength > 0 && currentLinePos > 0) {
System.arraycopy(lineSeparator, 0, buffer, pos, lineSeparator.length);
pos += lineSeparator.length;
}
} else {
for (int i = 0; i < inAvail; i++) {
ensureBufferSize(encodeSize);
modulus = (modulus + 1) % BYTES_PER_UNENCODED_BLOCK;
int b = in[inPos++];
if (b < 0) {
b += 256;
}
bitWorkArea = (bitWorkArea << 8) + b; // BITS_PER_BYTE
if (0 == modulus) { // 3 bytes = 24 bits = 4 * 6 bits to extract
buffer[pos++] = encodeTable[(bitWorkArea >> 18) & MASK_6BITS];
buffer[pos++] = encodeTable[(bitWorkArea >> 12) & MASK_6BITS];
buffer[pos++] = encodeTable[(bitWorkArea >> 6) & MASK_6BITS];
buffer[pos++] = encodeTable[bitWorkArea & MASK_6BITS];
currentLinePos += BYTES_PER_ENCODED_BLOCK;
if (lineLength > 0 && lineLength <= currentLinePos) {
System.arraycopy(lineSeparator, 0, buffer, pos, lineSeparator.length);
pos += lineSeparator.length;
currentLinePos = 0;
}
}
}
}
} } | public class class_name {
@Override
void encode(byte[] in, int inPos, int inAvail) {
if (eof) {
return; // depends on control dependency: [if], data = [none]
}
// inAvail < 0 is how we're informed of EOF in the underlying data we're
// encoding.
if (inAvail < 0) {
eof = true; // depends on control dependency: [if], data = [none]
if (0 == modulus && lineLength == 0) {
return; // no leftovers to process and not using chunking // depends on control dependency: [if], data = [none]
}
ensureBufferSize(encodeSize); // depends on control dependency: [if], data = [none]
int savedPos = pos;
switch (modulus) { // 0-2
case 1: // 8 bits = 6 + 2
buffer[pos++] = encodeTable[(bitWorkArea >> 2) & MASK_6BITS]; // top 6 bits
buffer[pos++] = encodeTable[(bitWorkArea << 4) & MASK_6BITS]; // remaining 2
// URL-SAFE skips the padding to further reduce size.
if (encodeTable == STANDARD_ENCODE_TABLE) {
buffer[pos++] = PAD; // depends on control dependency: [if], data = [none]
buffer[pos++] = PAD; // depends on control dependency: [if], data = [none]
}
break;
case 2: // 16 bits = 6 + 6 + 4
buffer[pos++] = encodeTable[(bitWorkArea >> 10) & MASK_6BITS];
buffer[pos++] = encodeTable[(bitWorkArea >> 4) & MASK_6BITS];
buffer[pos++] = encodeTable[(bitWorkArea << 2) & MASK_6BITS];
// URL-SAFE skips the padding to further reduce size.
if (encodeTable == STANDARD_ENCODE_TABLE) {
buffer[pos++] = PAD; // depends on control dependency: [if], data = [none]
}
break;
}
currentLinePos += pos - savedPos; // keep track of current line position // depends on control dependency: [if], data = [none]
// if currentPos == 0 we are at the start of a line, so don't add CRLF
if (lineLength > 0 && currentLinePos > 0) {
System.arraycopy(lineSeparator, 0, buffer, pos, lineSeparator.length); // depends on control dependency: [if], data = [none]
pos += lineSeparator.length; // depends on control dependency: [if], data = [none]
}
} else {
for (int i = 0; i < inAvail; i++) {
ensureBufferSize(encodeSize); // depends on control dependency: [for], data = [none]
modulus = (modulus + 1) % BYTES_PER_UNENCODED_BLOCK; // depends on control dependency: [for], data = [none]
int b = in[inPos++];
if (b < 0) {
b += 256; // depends on control dependency: [if], data = [none]
}
bitWorkArea = (bitWorkArea << 8) + b; // BITS_PER_BYTE // depends on control dependency: [for], data = [none]
if (0 == modulus) { // 3 bytes = 24 bits = 4 * 6 bits to extract
buffer[pos++] = encodeTable[(bitWorkArea >> 18) & MASK_6BITS]; // depends on control dependency: [if], data = [none]
buffer[pos++] = encodeTable[(bitWorkArea >> 12) & MASK_6BITS]; // depends on control dependency: [if], data = [none]
buffer[pos++] = encodeTable[(bitWorkArea >> 6) & MASK_6BITS]; // depends on control dependency: [if], data = [none]
buffer[pos++] = encodeTable[bitWorkArea & MASK_6BITS]; // depends on control dependency: [if], data = [none]
currentLinePos += BYTES_PER_ENCODED_BLOCK; // depends on control dependency: [if], data = [none]
if (lineLength > 0 && lineLength <= currentLinePos) {
System.arraycopy(lineSeparator, 0, buffer, pos, lineSeparator.length); // depends on control dependency: [if], data = [none]
pos += lineSeparator.length; // depends on control dependency: [if], data = [none]
currentLinePos = 0; // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public final Object get(String key) {
try {
this.mutex.acquire();
return this.valueMap.get(key);
} finally {
try {
this.mutex.release();
} catch (Exception ignore) {
}
}
} } | public class class_name {
public final Object get(String key) {
try {
this.mutex.acquire(); // depends on control dependency: [try], data = [none]
return this.valueMap.get(key); // depends on control dependency: [try], data = [none]
} finally {
try {
this.mutex.release(); // depends on control dependency: [try], data = [none]
} catch (Exception ignore) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public final String getConfigurationValue(String key)
{
//format property key
String propertyKey=key;
if(this.PROPERTY_PART!=null)
{
propertyKey=MessageFormat.format(key,new Object[]{this.PROPERTY_PART});
}
//get value
String value=this.CONFIGURATION.get(propertyKey);
//trim value
if(value!=null)
{
value=value.trim();
//set as null if empty string
if(value.length()==0)
{
value=null;
}
}
this.LOGGER.logDebug(new Object[]{"Extracted configuration for key: ",propertyKey," value: ",value},null);
return value;
} } | public class class_name {
public final String getConfigurationValue(String key)
{
//format property key
String propertyKey=key;
if(this.PROPERTY_PART!=null)
{
propertyKey=MessageFormat.format(key,new Object[]{this.PROPERTY_PART}); // depends on control dependency: [if], data = [none]
}
//get value
String value=this.CONFIGURATION.get(propertyKey);
//trim value
if(value!=null)
{
value=value.trim(); // depends on control dependency: [if], data = [none]
//set as null if empty string
if(value.length()==0)
{
value=null; // depends on control dependency: [if], data = [none]
}
}
this.LOGGER.logDebug(new Object[]{"Extracted configuration for key: ",propertyKey," value: ",value},null);
return value;
} } |
public class class_name {
protected final ClassFile getClassFile(String className)
{
ClassFile cf=null;
String filePath=null;
if(className!=null && !className.isEmpty())
{
String rootPath=getClassRootDir();
if(rootPath.endsWith("/")||rootPath.endsWith("\\"))
{
}else
{
rootPath=rootPath+File.separator;
}
filePath=rootPath+className.replace('.', File.separatorChar)+".class";
}
File file=new File(filePath);
if(file.exists() && file.isFile())
{
cf=new ClassFile(className, file.getPath());
cf.setLastModifyTime(file.lastModified());
}
return cf;
} } | public class class_name {
protected final ClassFile getClassFile(String className)
{
ClassFile cf=null;
String filePath=null;
if(className!=null && !className.isEmpty())
{
String rootPath=getClassRootDir();
if(rootPath.endsWith("/")||rootPath.endsWith("\\"))
{
}else
{
rootPath=rootPath+File.separator; // depends on control dependency: [if], data = [none]
}
filePath=rootPath+className.replace('.', File.separatorChar)+".class"; // depends on control dependency: [if], data = [none]
}
File file=new File(filePath);
if(file.exists() && file.isFile())
{
cf=new ClassFile(className, file.getPath()); // depends on control dependency: [if], data = [none]
cf.setLastModifyTime(file.lastModified()); // depends on control dependency: [if], data = [none]
}
return cf;
} } |
public class class_name {
public synchronized boolean freeSegment(Segment seg) throws IOException {
if (seg == null)
return false;
int segId = seg.getSegmentId();
if (segId < _segList.size() && _segList.get(segId) == seg) {
_segList.set(segId, null);
seg.close(false);
if(segId == (_segList.size() - 1)) {
try {
// Delete last segment.
_segList.remove(segId);
File segFile = seg.getSegmentFile();
if(segFile.exists()) segFile.delete();
File sibFile = getSegmentIndexBufferFile(segId);
if(sibFile.exists()) sibFile.delete();
_log.info("Segment " + seg.getSegmentId() + " deleted");
} catch(Exception e) {
_log.warn("Segment " + seg.getSegmentId() + " not deleted", e);
}
} else {
if (seg.isRecyclable() && recycle(seg)) {
_log.info("Segment " + seg.getSegmentId() + " recycled");
} else {
_log.info("Segment " + seg.getSegmentId() + " freed");
}
}
return true;
}
return false;
} } | public class class_name {
public synchronized boolean freeSegment(Segment seg) throws IOException {
if (seg == null)
return false;
int segId = seg.getSegmentId();
if (segId < _segList.size() && _segList.get(segId) == seg) {
_segList.set(segId, null);
seg.close(false);
if(segId == (_segList.size() - 1)) {
try {
// Delete last segment.
_segList.remove(segId); // depends on control dependency: [try], data = [none]
File segFile = seg.getSegmentFile();
if(segFile.exists()) segFile.delete();
File sibFile = getSegmentIndexBufferFile(segId);
if(sibFile.exists()) sibFile.delete();
_log.info("Segment " + seg.getSegmentId() + " deleted"); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
_log.warn("Segment " + seg.getSegmentId() + " not deleted", e);
} // depends on control dependency: [catch], data = [none]
} else {
if (seg.isRecyclable() && recycle(seg)) {
_log.info("Segment " + seg.getSegmentId() + " recycled"); // depends on control dependency: [if], data = [none]
} else {
_log.info("Segment " + seg.getSegmentId() + " freed"); // depends on control dependency: [if], data = [none]
}
}
return true;
}
return false;
} } |
public class class_name {
public final void primitiveType() throws RecognitionException {
int primitiveType_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 51) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:537:5: ( 'boolean' | 'char' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( input.LA(1)==65||input.LA(1)==67||input.LA(1)==71||input.LA(1)==77||input.LA(1)==85||input.LA(1)==92||input.LA(1)==94||input.LA(1)==105 ) {
input.consume();
state.errorRecovery=false;
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 51, primitiveType_StartIndex); }
}
} } | public class class_name {
public final void primitiveType() throws RecognitionException {
int primitiveType_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 51) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:537:5: ( 'boolean' | 'char' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( input.LA(1)==65||input.LA(1)==67||input.LA(1)==71||input.LA(1)==77||input.LA(1)==85||input.LA(1)==92||input.LA(1)==94||input.LA(1)==105 ) {
input.consume(); // depends on control dependency: [if], data = [none]
state.errorRecovery=false; // depends on control dependency: [if], data = [none]
state.failed=false; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 51, primitiveType_StartIndex); } // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void changeState() {
if (m_state == State.RESTORE) {
fetchSnapshotTxnId();
exitRestore();
m_state = State.REPLAY;
/*
* Add the interest here so that we can use the barriers in replay
* agent to synchronize.
*/
m_snapshotMonitor.addInterest(this);
m_replayAgent.replay();
} else if (m_state == State.REPLAY) {
m_state = State.TRUNCATE;
} else if (m_state == State.TRUNCATE) {
m_snapshotMonitor.removeInterest(this);
if (m_callback != null) {
m_callback.onReplayCompletion(m_truncationSnapshot, m_truncationSnapshotPerPartition);
}
// Call balance partitions after enabling transactions on the node to shorten the recovery time
if (m_isLeader) {
m_replayAgent.resumeElasticOperationIfNecessary();
}
}
} } | public class class_name {
private void changeState() {
if (m_state == State.RESTORE) {
fetchSnapshotTxnId(); // depends on control dependency: [if], data = [none]
exitRestore(); // depends on control dependency: [if], data = [none]
m_state = State.REPLAY; // depends on control dependency: [if], data = [none]
/*
* Add the interest here so that we can use the barriers in replay
* agent to synchronize.
*/
m_snapshotMonitor.addInterest(this); // depends on control dependency: [if], data = [none]
m_replayAgent.replay(); // depends on control dependency: [if], data = [none]
} else if (m_state == State.REPLAY) {
m_state = State.TRUNCATE; // depends on control dependency: [if], data = [none]
} else if (m_state == State.TRUNCATE) {
m_snapshotMonitor.removeInterest(this); // depends on control dependency: [if], data = [none]
if (m_callback != null) {
m_callback.onReplayCompletion(m_truncationSnapshot, m_truncationSnapshotPerPartition); // depends on control dependency: [if], data = [none]
}
// Call balance partitions after enabling transactions on the node to shorten the recovery time
if (m_isLeader) {
m_replayAgent.resumeElasticOperationIfNecessary(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public RetrievalPerformanceResult run(Database database, Relation<O> relation, Relation<?> lrelation) {
final DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
final DBIDs ids = DBIDUtil.randomSample(relation.getDBIDs(), sampling, random);
// For storing the positive neighbors.
ModifiableDBIDs posn = DBIDUtil.newHashSet();
// Distance storage.
ModifiableDoubleDBIDList nlist = DBIDUtil.newDistanceDBIDList(relation.size());
// For counting labels seen in kNN
Object2IntOpenHashMap<Object> counters = new Object2IntOpenHashMap<>();
// Statistics tracking
double map = 0., mroc = 0.;
double[] knnperf = new double[maxk];
int samples = 0;
FiniteProgress objloop = LOG.isVerbose() ? new FiniteProgress("Processing query objects", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
Object label = lrelation.get(iter);
findMatches(posn, lrelation, label);
if(posn.size() > 0) {
computeDistances(nlist, iter, distQuery, relation);
if(nlist.size() != relation.size() - (includeSelf ? 0 : 1)) {
LOG.warning("Neighbor list does not have the desired size: " + nlist.size());
}
map += AveragePrecisionEvaluation.STATIC.evaluate(posn, nlist);
mroc += ROCEvaluation.STATIC.evaluate(posn, nlist);
KNNEvaluator.STATIC.evaluateKNN(knnperf, nlist, lrelation, counters, label);
samples += 1;
}
LOG.incrementProcessed(objloop);
}
LOG.ensureCompleted(objloop);
if(samples < 1) {
throw new AbortException("No object matched - are labels parsed correctly?");
}
if(!(map >= 0) || !(mroc >= 0)) {
throw new AbortException("NaN in MAP/ROC.");
}
map /= samples;
mroc /= samples;
LOG.statistics(new DoubleStatistic(PREFIX + ".map", map));
LOG.statistics(new DoubleStatistic(PREFIX + ".rocauc", mroc));
LOG.statistics(new DoubleStatistic(PREFIX + ".samples", samples));
for(int k = 0; k < maxk; k++) {
knnperf[k] = knnperf[k] / samples;
LOG.statistics(new DoubleStatistic(PREFIX + ".knn-" + (k + 1), knnperf[k]));
}
return new RetrievalPerformanceResult(samples, map, mroc, knnperf);
} } | public class class_name {
public RetrievalPerformanceResult run(Database database, Relation<O> relation, Relation<?> lrelation) {
final DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
final DBIDs ids = DBIDUtil.randomSample(relation.getDBIDs(), sampling, random);
// For storing the positive neighbors.
ModifiableDBIDs posn = DBIDUtil.newHashSet();
// Distance storage.
ModifiableDoubleDBIDList nlist = DBIDUtil.newDistanceDBIDList(relation.size());
// For counting labels seen in kNN
Object2IntOpenHashMap<Object> counters = new Object2IntOpenHashMap<>();
// Statistics tracking
double map = 0., mroc = 0.;
double[] knnperf = new double[maxk];
int samples = 0;
FiniteProgress objloop = LOG.isVerbose() ? new FiniteProgress("Processing query objects", ids.size(), LOG) : null;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
Object label = lrelation.get(iter);
findMatches(posn, lrelation, label); // depends on control dependency: [for], data = [none]
if(posn.size() > 0) {
computeDistances(nlist, iter, distQuery, relation); // depends on control dependency: [if], data = [none]
if(nlist.size() != relation.size() - (includeSelf ? 0 : 1)) {
LOG.warning("Neighbor list does not have the desired size: " + nlist.size()); // depends on control dependency: [if], data = [none]
}
map += AveragePrecisionEvaluation.STATIC.evaluate(posn, nlist); // depends on control dependency: [if], data = [none]
mroc += ROCEvaluation.STATIC.evaluate(posn, nlist); // depends on control dependency: [if], data = [none]
KNNEvaluator.STATIC.evaluateKNN(knnperf, nlist, lrelation, counters, label); // depends on control dependency: [if], data = [none]
samples += 1; // depends on control dependency: [if], data = [none]
}
LOG.incrementProcessed(objloop); // depends on control dependency: [for], data = [none]
}
LOG.ensureCompleted(objloop);
if(samples < 1) {
throw new AbortException("No object matched - are labels parsed correctly?");
}
if(!(map >= 0) || !(mroc >= 0)) {
throw new AbortException("NaN in MAP/ROC.");
}
map /= samples;
mroc /= samples;
LOG.statistics(new DoubleStatistic(PREFIX + ".map", map));
LOG.statistics(new DoubleStatistic(PREFIX + ".rocauc", mroc));
LOG.statistics(new DoubleStatistic(PREFIX + ".samples", samples));
for(int k = 0; k < maxk; k++) {
knnperf[k] = knnperf[k] / samples; // depends on control dependency: [for], data = [k]
LOG.statistics(new DoubleStatistic(PREFIX + ".knn-" + (k + 1), knnperf[k])); // depends on control dependency: [for], data = [k]
}
return new RetrievalPerformanceResult(samples, map, mroc, knnperf);
} } |
public class class_name {
public boolean isOnSameRack( Node node1, Node node2) {
if (node1 == null || node2 == null) {
return false;
}
netlock.readLock().lock();
try {
return node1.getParent()==node2.getParent();
} finally {
netlock.readLock().unlock();
}
} } | public class class_name {
public boolean isOnSameRack( Node node1, Node node2) {
if (node1 == null || node2 == null) {
return false; // depends on control dependency: [if], data = [none]
}
netlock.readLock().lock();
try {
return node1.getParent()==node2.getParent(); // depends on control dependency: [try], data = [none]
} finally {
netlock.readLock().unlock();
}
} } |
public class class_name {
public static Multimap<String, PathOperation> groupOperationsByTag(List<PathOperation> allOperations, Comparator<PathOperation> operationOrdering) {
Multimap<String, PathOperation> operationsGroupedByTag;
if (operationOrdering == null) {
operationsGroupedByTag = LinkedHashMultimap.create();
} else {
operationsGroupedByTag = MultimapBuilder.linkedHashKeys().treeSetValues(operationOrdering).build();
}
for (PathOperation operation : allOperations) {
List<String> tags = operation.getOperation().getTags();
Validate.notEmpty(tags, "Can't GroupBy.TAGS. Operation '%s' has no tags", operation);
for (String tag : tags) {
if (logger.isDebugEnabled()) {
logger.debug("Added path operation '{}' to tag '{}'", operation, tag);
}
operationsGroupedByTag.put(tag, operation);
}
}
return operationsGroupedByTag;
} } | public class class_name {
public static Multimap<String, PathOperation> groupOperationsByTag(List<PathOperation> allOperations, Comparator<PathOperation> operationOrdering) {
Multimap<String, PathOperation> operationsGroupedByTag;
if (operationOrdering == null) {
operationsGroupedByTag = LinkedHashMultimap.create(); // depends on control dependency: [if], data = [none]
} else {
operationsGroupedByTag = MultimapBuilder.linkedHashKeys().treeSetValues(operationOrdering).build(); // depends on control dependency: [if], data = [(operationOrdering]
}
for (PathOperation operation : allOperations) {
List<String> tags = operation.getOperation().getTags();
Validate.notEmpty(tags, "Can't GroupBy.TAGS. Operation '%s' has no tags", operation);
for (String tag : tags) {
if (logger.isDebugEnabled()) {
logger.debug("Added path operation '{}' to tag '{}'", operation, tag); // depends on control dependency: [for], data = [none]
}
operationsGroupedByTag.put(tag, operation);
}
}
return operationsGroupedByTag;
} } |
public class class_name {
@Override
public EEnum getIfcConstraintEnum() {
if (ifcConstraintEnumEEnum == null) {
ifcConstraintEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(942);
}
return ifcConstraintEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcConstraintEnum() {
if (ifcConstraintEnumEEnum == null) {
ifcConstraintEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(942);
// depends on control dependency: [if], data = [none]
}
return ifcConstraintEnumEEnum;
} } |
public class class_name {
@Override
public Object fromString(Class targetClass, String s)
{
try
{
if (s == null)
{
return null;
}
Object o = (Object) s;
return o;
}
catch (NumberFormatException e)
{
log.error("Number format exception, Caused by {}.", e);
throw new PropertyAccessException(e);
}
} } | public class class_name {
@Override
public Object fromString(Class targetClass, String s)
{
try
{
if (s == null)
{
return null;
// depends on control dependency: [if], data = [none]
}
Object o = (Object) s;
return o;
// depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e)
{
log.error("Number format exception, Caused by {}.", e);
throw new PropertyAccessException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String toMethodDescriptor(Method method, boolean ignoreFirstParameter) {
Class<?>[] params = method.getParameterTypes();
if (ignoreFirstParameter && params.length < 1) {
throw new IllegalStateException("Cannot ignore the first parameter when there are none. method=" + method);
}
StringBuilder s = new StringBuilder();
if (!ignoreFirstParameter) {
s.append("(");
}
for (int i = (ignoreFirstParameter ? 1 : 0), max = params.length; i < max; i++) {
appendDescriptor(params[i], s);
}
s.append(")");
appendDescriptor(method.getReturnType(), s);
return s.toString();
} } | public class class_name {
public static String toMethodDescriptor(Method method, boolean ignoreFirstParameter) {
Class<?>[] params = method.getParameterTypes();
if (ignoreFirstParameter && params.length < 1) {
throw new IllegalStateException("Cannot ignore the first parameter when there are none. method=" + method);
}
StringBuilder s = new StringBuilder();
if (!ignoreFirstParameter) {
s.append("("); // depends on control dependency: [if], data = [none]
}
for (int i = (ignoreFirstParameter ? 1 : 0), max = params.length; i < max; i++) {
appendDescriptor(params[i], s); // depends on control dependency: [for], data = [i]
}
s.append(")");
appendDescriptor(method.getReturnType(), s);
return s.toString();
} } |
public class class_name {
protected void highlightNode(IHighlightedPositionAcceptor acceptor, INode node, String... styleIds) {
if (node == null)
return;
if (node instanceof ILeafNode) {
ITextRegion textRegion = node.getTextRegion();
acceptor.addPosition(textRegion.getOffset(), textRegion.getLength(), styleIds);
} else {
for (ILeafNode leaf : node.getLeafNodes()) {
if (!leaf.isHidden()) {
ITextRegion leafRegion = leaf.getTextRegion();
acceptor.addPosition(leafRegion.getOffset(), leafRegion.getLength(), styleIds);
}
}
}
} } | public class class_name {
protected void highlightNode(IHighlightedPositionAcceptor acceptor, INode node, String... styleIds) {
if (node == null)
return;
if (node instanceof ILeafNode) {
ITextRegion textRegion = node.getTextRegion();
acceptor.addPosition(textRegion.getOffset(), textRegion.getLength(), styleIds); // depends on control dependency: [if], data = [none]
} else {
for (ILeafNode leaf : node.getLeafNodes()) {
if (!leaf.isHidden()) {
ITextRegion leafRegion = leaf.getTextRegion();
acceptor.addPosition(leafRegion.getOffset(), leafRegion.getLength(), styleIds); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
org.robolectric.res.android.ZipFileRO.ZipEntryRO findEntryByName(final String entryName)
{
ZipEntryRO data = new ZipEntryRO();
data.name = String(entryName);
final Ref<ZipEntry> zipEntryRef = new Ref<>(data.entry);
final int error = FindEntry(mHandle, data.name, zipEntryRef);
if (isTruthy(error)) {
return null;
}
data.entry = zipEntryRef.get();
return data;
} } | public class class_name {
org.robolectric.res.android.ZipFileRO.ZipEntryRO findEntryByName(final String entryName)
{
ZipEntryRO data = new ZipEntryRO();
data.name = String(entryName);
final Ref<ZipEntry> zipEntryRef = new Ref<>(data.entry);
final int error = FindEntry(mHandle, data.name, zipEntryRef);
if (isTruthy(error)) {
return null; // depends on control dependency: [if], data = [none]
}
data.entry = zipEntryRef.get();
return data;
} } |
public class class_name {
public static void main(String[] args) {
// Add a shutdown hook
final Thread mainThread = Thread.currentThread();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
progress.cancel();
try {
mainThread.join();
} catch (InterruptedException e) {
LOGGER.log(Level.WARNING,
"Failed to wait for the main thread to finish", e);
}
}
});
boolean valid = true;
boolean requiredArguments = false;
for (int i = 0; valid && i < args.length; i++) {
String arg = args[i];
// Handle optional arguments
if (arg.startsWith(ARGUMENT_PREFIX)) {
String argument = arg.substring(ARGUMENT_PREFIX.length());
switch (argument) {
case ARGUMENT_MAX_FEATURES_PER_TILE:
if (i < args.length) {
int max = Integer.valueOf(args[++i]);
if (max >= 0) {
maxFeaturesPerTile = max;
} else {
maxFeaturesPerTile = null;
}
} else {
valid = false;
System.out
.println("Error: Max Features Per Tile argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_COMPRESS_FORMAT:
if (i < args.length) {
compressFormat = args[++i];
} else {
valid = false;
System.out
.println("Error: Compress Format argument '"
+ arg
+ "' must be followed by an image format");
}
break;
case ARGUMENT_COMPRESS_QUALITY:
if (i < args.length) {
compressQuality = Float.valueOf(args[++i]);
} else {
valid = false;
System.out
.println("Error: Compress Quality argument '"
+ arg
+ "' must be followed by a value between 0.0 and 1.0");
}
break;
case ARGUMENT_GOOGLE_TILES:
googleTiles = true;
break;
case ARGUMENT_BOUNDING_BOX:
if (i < args.length) {
String bbox = args[++i];
String[] bboxParts = bbox.split(",");
if (bboxParts.length != 4) {
valid = false;
System.out
.println("Error: Bounding Box argument '"
+ arg
+ "' value must be in the format: minLon,minLat,maxLon,maxLat");
} else {
double minLon = Double.valueOf(bboxParts[0]);
double minLat = Double.valueOf(bboxParts[1]);
double maxLon = Double.valueOf(bboxParts[2]);
double maxLat = Double.valueOf(bboxParts[3]);
boundingBox = new BoundingBox(minLon, minLat,
maxLon, maxLat);
}
} else {
valid = false;
System.out
.println("Error: Bounding Box argument '"
+ arg
+ "' must be followed by bbox values: minLon,minLat,maxLon,maxLat");
}
break;
case ARGUMENT_EPSG:
if (i < args.length) {
epsg = Long.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: EPSG argument '" + arg
+ "' must be followed by a value");
}
break;
case ARGUMENT_TILE_WIDTH:
if (i < args.length) {
tileWidth = Integer.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: Tile Width argument '" + arg
+ "' must be followed by a value");
}
break;
case ARGUMENT_TILE_HEIGHT:
if (i < args.length) {
tileHeight = Integer.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: Tile Height argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_TILE_SCALE:
if (i < args.length) {
tileScale = Float.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: Tile Scale argument '" + arg
+ "' must be followed by a value");
}
break;
case ARGUMENT_POINT_RADIUS:
if (i < args.length) {
pointRadius = Float.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: Point Radius argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_POINT_COLOR:
if (i < args.length) {
pointColor = getColor(args[++i]);
} else {
valid = false;
System.out.println("Error: Point Color argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_POINT_ICON:
if (i < args.length) {
File pointIconFile = new File(args[++i]);
try {
BufferedImage iconImage = ImageIO
.read(pointIconFile);
icon = new FeatureTilePointIcon(iconImage);
} catch (IOException e) {
throw new GeoPackageException(
"Failed to create point icon from image file: "
+ pointIconFile.getAbsolutePath(),
e);
}
} else {
valid = false;
System.out.println("Error: Point Icon argument '" + arg
+ "' must be followed by a point image file");
}
break;
case ARGUMENT_ICON_WIDTH:
if (i < args.length) {
iconWidth = Integer.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: Icon Width argument '" + arg
+ "' must be followed by a value");
}
break;
case ARGUMENT_ICON_HEIGHT:
if (i < args.length) {
iconHeight = Integer.valueOf(args[++i]);
} else {
valid = false;
System.out.println("Error: Icon Height argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_POINT_CENTER_ICON:
centerIcon = true;
break;
case ARGUMENT_LINE_STROKE_WIDTH:
if (i < args.length) {
lineStrokeWidth = Float.valueOf(args[++i]);
} else {
valid = false;
System.out
.println("Error: Line Stroke Width argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_LINE_COLOR:
if (i < args.length) {
lineColor = getColor(args[++i]);
} else {
valid = false;
System.out.println("Error: Line Color argument '" + arg
+ "' must be followed by a value");
}
break;
case ARGUMENT_POLYGON_STROKE_WIDTH:
if (i < args.length) {
polygonStrokeWidth = Float.valueOf(args[++i]);
} else {
valid = false;
System.out
.println("Error: Polygon Stroke Width argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_POLYGON_COLOR:
if (i < args.length) {
polygonColor = getColor(args[++i]);
} else {
valid = false;
System.out.println("Error: Polygon Color argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_FILL_POLYGON:
fillPolygon = true;
break;
case ARGUMENT_POLYGON_FILL_COLOR:
if (i < args.length) {
polygonFillColor = getColor(args[++i]);
} else {
valid = false;
System.out
.println("Error: Polygon Fill Color argument '"
+ arg + "' must be followed by a value");
}
break;
case ARGUMENT_SIMPLIFY_GEOMETRIES:
if (i < args.length) {
simplifyGeometries = Boolean.valueOf(args[++i]);
} else {
valid = false;
System.out
.println("Error: Simplify Geometries argument '"
+ arg
+ "' must be followed by a boolean value");
}
break;
case ARGUMENT_IGNORE_GEOPACKAGE_STYLES:
if (i < args.length) {
ignoreGeoPackageStyles = Boolean.valueOf(args[++i]);
} else {
valid = false;
System.out
.println("Error: Ignore GeoPackage Styles argument '"
+ arg
+ "' must be followed by a boolean value");
}
break;
default:
valid = false;
System.out.println("Error: Unsupported arg: '" + arg + "'");
}
} else {
// Set required arguments in order
if (featureGeoPackageFile == null) {
featureGeoPackageFile = new File(arg);
} else if (featureTable == null) {
featureTable = arg;
} else if (tileGeoPackageFile == null) {
tileGeoPackageFile = new File(arg);
} else if (tileTable == null) {
tileTable = arg;
} else if (minZoom == null) {
minZoom = Integer.valueOf(arg);
} else if (maxZoom == null) {
maxZoom = Integer.valueOf(arg);
requiredArguments = true;
} else {
valid = false;
System.out.println("Error: Unsupported extra argument: "
+ arg);
}
}
}
if (compressFormat == null && compressQuality != null) {
System.out
.println("Error: Compress quality requires a compress format");
valid = false;
} else if (boundingBox == null && epsg != null) {
System.out.println("Error: EPSG requires a bounding box");
valid = false;
}
if ((pointRadius != null || pointColor != null) && icon != null) {
System.out
.println("Error: Point radius and/or color can not be specified together with a point icon");
valid = false;
}
if (iconWidth != null || iconHeight != null) {
if (icon == null) {
System.out
.println("Error: Point icon file must be specified when attempting to set an icon width or height");
valid = false;
} else {
if (iconWidth == null) {
iconWidth = Math.round(icon.getWidth()
* (iconHeight / (float) icon.getHeight()));
} else if (iconHeight == null) {
iconHeight = Math.round(icon.getHeight()
* (iconWidth / (float) icon.getWidth()));
}
icon.setWidth(iconWidth);
icon.setHeight(iconHeight);
}
}
if (centerIcon) {
if (icon == null) {
System.out
.println("Error: Point icon file must be specified when attempting to center it");
valid = false;
} else {
icon.centerIcon();
}
}
if ((fillPolygon == null || !fillPolygon) && polygonFillColor != null) {
System.out
.println("Error: Polygon Fill Color can only be specified when Fill Polygon is enabled");
valid = false;
}
if (!valid || !requiredArguments) {
printUsage();
} else {
// Read the tiles
try {
generate();
} catch (Exception e) {
printUsage();
throw e;
}
}
} } | public class class_name {
public static void main(String[] args) {
// Add a shutdown hook
final Thread mainThread = Thread.currentThread();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
progress.cancel();
try {
mainThread.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
LOGGER.log(Level.WARNING,
"Failed to wait for the main thread to finish", e);
} // depends on control dependency: [catch], data = [none]
}
});
boolean valid = true;
boolean requiredArguments = false;
for (int i = 0; valid && i < args.length; i++) {
String arg = args[i];
// Handle optional arguments
if (arg.startsWith(ARGUMENT_PREFIX)) {
String argument = arg.substring(ARGUMENT_PREFIX.length());
switch (argument) {
case ARGUMENT_MAX_FEATURES_PER_TILE:
if (i < args.length) {
int max = Integer.valueOf(args[++i]);
if (max >= 0) {
maxFeaturesPerTile = max; // depends on control dependency: [if], data = [none]
} else {
maxFeaturesPerTile = null; // depends on control dependency: [if], data = [none]
}
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Max Features Per Tile argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_COMPRESS_FORMAT:
if (i < args.length) {
compressFormat = args[++i]; // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Compress Format argument '"
+ arg
+ "' must be followed by an image format"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_COMPRESS_QUALITY:
if (i < args.length) {
compressQuality = Float.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Compress Quality argument '"
+ arg
+ "' must be followed by a value between 0.0 and 1.0"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_GOOGLE_TILES:
googleTiles = true;
break;
case ARGUMENT_BOUNDING_BOX:
if (i < args.length) {
String bbox = args[++i];
String[] bboxParts = bbox.split(",");
if (bboxParts.length != 4) {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Bounding Box argument '"
+ arg
+ "' value must be in the format: minLon,minLat,maxLon,maxLat"); // depends on control dependency: [if], data = [none]
} else {
double minLon = Double.valueOf(bboxParts[0]);
double minLat = Double.valueOf(bboxParts[1]);
double maxLon = Double.valueOf(bboxParts[2]);
double maxLat = Double.valueOf(bboxParts[3]);
boundingBox = new BoundingBox(minLon, minLat,
maxLon, maxLat); // depends on control dependency: [if], data = [none]
}
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Bounding Box argument '"
+ arg
+ "' must be followed by bbox values: minLon,minLat,maxLon,maxLat"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_EPSG:
if (i < args.length) {
epsg = Long.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: EPSG argument '" + arg
+ "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_TILE_WIDTH:
if (i < args.length) {
tileWidth = Integer.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Tile Width argument '" + arg
+ "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_TILE_HEIGHT:
if (i < args.length) {
tileHeight = Integer.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Tile Height argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_TILE_SCALE:
if (i < args.length) {
tileScale = Float.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Tile Scale argument '" + arg
+ "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_POINT_RADIUS:
if (i < args.length) {
pointRadius = Float.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Point Radius argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_POINT_COLOR:
if (i < args.length) {
pointColor = getColor(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Point Color argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_POINT_ICON:
if (i < args.length) {
File pointIconFile = new File(args[++i]);
try {
BufferedImage iconImage = ImageIO
.read(pointIconFile);
icon = new FeatureTilePointIcon(iconImage); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new GeoPackageException(
"Failed to create point icon from image file: "
+ pointIconFile.getAbsolutePath(),
e);
} // depends on control dependency: [catch], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Point Icon argument '" + arg
+ "' must be followed by a point image file"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_ICON_WIDTH:
if (i < args.length) {
iconWidth = Integer.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Icon Width argument '" + arg
+ "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_ICON_HEIGHT:
if (i < args.length) {
iconHeight = Integer.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Icon Height argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_POINT_CENTER_ICON:
centerIcon = true;
break;
case ARGUMENT_LINE_STROKE_WIDTH:
if (i < args.length) {
lineStrokeWidth = Float.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Line Stroke Width argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_LINE_COLOR:
if (i < args.length) {
lineColor = getColor(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Line Color argument '" + arg
+ "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_POLYGON_STROKE_WIDTH:
if (i < args.length) {
polygonStrokeWidth = Float.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Polygon Stroke Width argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_POLYGON_COLOR:
if (i < args.length) {
polygonColor = getColor(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Polygon Color argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_FILL_POLYGON:
fillPolygon = true;
break;
case ARGUMENT_POLYGON_FILL_COLOR:
if (i < args.length) {
polygonFillColor = getColor(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Polygon Fill Color argument '"
+ arg + "' must be followed by a value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_SIMPLIFY_GEOMETRIES:
if (i < args.length) {
simplifyGeometries = Boolean.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Simplify Geometries argument '"
+ arg
+ "' must be followed by a boolean value"); // depends on control dependency: [if], data = [none]
}
break;
case ARGUMENT_IGNORE_GEOPACKAGE_STYLES:
if (i < args.length) {
ignoreGeoPackageStyles = Boolean.valueOf(args[++i]); // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out
.println("Error: Ignore GeoPackage Styles argument '"
+ arg
+ "' must be followed by a boolean value"); // depends on control dependency: [if], data = [none]
}
break;
default:
valid = false;
System.out.println("Error: Unsupported arg: '" + arg + "'");
}
} else {
// Set required arguments in order
if (featureGeoPackageFile == null) {
featureGeoPackageFile = new File(arg); // depends on control dependency: [if], data = [none]
} else if (featureTable == null) {
featureTable = arg; // depends on control dependency: [if], data = [none]
} else if (tileGeoPackageFile == null) {
tileGeoPackageFile = new File(arg); // depends on control dependency: [if], data = [none]
} else if (tileTable == null) {
tileTable = arg; // depends on control dependency: [if], data = [none]
} else if (minZoom == null) {
minZoom = Integer.valueOf(arg); // depends on control dependency: [if], data = [none]
} else if (maxZoom == null) {
maxZoom = Integer.valueOf(arg); // depends on control dependency: [if], data = [none]
requiredArguments = true; // depends on control dependency: [if], data = [none]
} else {
valid = false; // depends on control dependency: [if], data = [none]
System.out.println("Error: Unsupported extra argument: "
+ arg); // depends on control dependency: [if], data = [none]
}
}
}
if (compressFormat == null && compressQuality != null) {
System.out
.println("Error: Compress quality requires a compress format"); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
} else if (boundingBox == null && epsg != null) {
System.out.println("Error: EPSG requires a bounding box"); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
}
if ((pointRadius != null || pointColor != null) && icon != null) {
System.out
.println("Error: Point radius and/or color can not be specified together with a point icon"); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
}
if (iconWidth != null || iconHeight != null) {
if (icon == null) {
System.out
.println("Error: Point icon file must be specified when attempting to set an icon width or height"); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
} else {
if (iconWidth == null) {
iconWidth = Math.round(icon.getWidth()
* (iconHeight / (float) icon.getHeight())); // depends on control dependency: [if], data = [none]
} else if (iconHeight == null) {
iconHeight = Math.round(icon.getHeight()
* (iconWidth / (float) icon.getWidth())); // depends on control dependency: [if], data = [none]
}
icon.setWidth(iconWidth); // depends on control dependency: [if], data = [(icon]
icon.setHeight(iconHeight); // depends on control dependency: [if], data = [(icon]
}
}
if (centerIcon) {
if (icon == null) {
System.out
.println("Error: Point icon file must be specified when attempting to center it"); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
} else {
icon.centerIcon(); // depends on control dependency: [if], data = [none]
}
}
if ((fillPolygon == null || !fillPolygon) && polygonFillColor != null) {
System.out
.println("Error: Polygon Fill Color can only be specified when Fill Polygon is enabled"); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
}
if (!valid || !requiredArguments) {
printUsage(); // depends on control dependency: [if], data = [none]
} else {
// Read the tiles
try {
generate(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
printUsage();
throw e;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
final int lastSlash = name.lastIndexOf('/');
this.thisReference = name;
this.superName = superName;
this.nextSupername = superName;
this.targetPackage = lastSlash == -1 ? StringPool.EMPTY : name.substring(0, lastSlash).replace('/', '.');
this.targetClassname = name.substring(lastSlash + 1);
this.isTargetInterface = (access & AsmUtil.ACC_INTERFACE) != 0;
if (this.isTargetInterface) {
nextInterfaces = new HashSet<>();
if (interfaces != null) {
Collections.addAll(nextInterfaces, interfaces);
}
}
generics = new GenericsReader().parseSignatureForGenerics(signature, isTargetInterface);
} } | public class class_name {
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
final int lastSlash = name.lastIndexOf('/');
this.thisReference = name;
this.superName = superName;
this.nextSupername = superName;
this.targetPackage = lastSlash == -1 ? StringPool.EMPTY : name.substring(0, lastSlash).replace('/', '.');
this.targetClassname = name.substring(lastSlash + 1);
this.isTargetInterface = (access & AsmUtil.ACC_INTERFACE) != 0;
if (this.isTargetInterface) {
nextInterfaces = new HashSet<>(); // depends on control dependency: [if], data = [none]
if (interfaces != null) {
Collections.addAll(nextInterfaces, interfaces); // depends on control dependency: [if], data = [none]
}
}
generics = new GenericsReader().parseSignatureForGenerics(signature, isTargetInterface);
} } |
public class class_name {
private void registerMBean() {
if (wroConfiguration.isJmxEnabled()) {
try {
mbeanServer = getMBeanServer();
final ObjectName name = getMBeanObjectName();
if (!mbeanServer.isRegistered(name)) {
mbeanServer.registerMBean(wroConfiguration, name);
}
} catch (final JMException e) {
LOG.error("Exception occured while registering MBean", e);
}
}
} } | public class class_name {
private void registerMBean() {
if (wroConfiguration.isJmxEnabled()) {
try {
mbeanServer = getMBeanServer(); // depends on control dependency: [try], data = [none]
final ObjectName name = getMBeanObjectName();
if (!mbeanServer.isRegistered(name)) {
mbeanServer.registerMBean(wroConfiguration, name); // depends on control dependency: [if], data = [none]
}
} catch (final JMException e) {
LOG.error("Exception occured while registering MBean", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public FlowItemExecuteResult compileFlowStepViewRuleAndExecute(
String viewRuleSyntaxParam, FluidItem fluidItemToExecuteOnParam)
{
FlowStepRule flowStepRule = new FlowStepRule();
flowStepRule.setRule(viewRuleSyntaxParam);
FlowItemExecutePacket toPost = new FlowItemExecutePacket();
if(this.serviceTicket != null)
{
toPost.setServiceTicket(this.serviceTicket);
}
toPost.setFlowStepRule(flowStepRule);
toPost.setFluidItem(fluidItemToExecuteOnParam);
return new FlowItemExecuteResult(this.postJson(
toPost, WS.Path.FlowStepRule.Version1.compileViewSyntaxAndExecute()));
} } | public class class_name {
public FlowItemExecuteResult compileFlowStepViewRuleAndExecute(
String viewRuleSyntaxParam, FluidItem fluidItemToExecuteOnParam)
{
FlowStepRule flowStepRule = new FlowStepRule();
flowStepRule.setRule(viewRuleSyntaxParam);
FlowItemExecutePacket toPost = new FlowItemExecutePacket();
if(this.serviceTicket != null)
{
toPost.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket]
}
toPost.setFlowStepRule(flowStepRule);
toPost.setFluidItem(fluidItemToExecuteOnParam);
return new FlowItemExecuteResult(this.postJson(
toPost, WS.Path.FlowStepRule.Version1.compileViewSyntaxAndExecute()));
} } |
public class class_name {
public JobPriority getJobPriority() {
String prio = get("mapred.job.priority");
if(prio == null) {
return JobPriority.NORMAL;
}
return JobPriority.valueOf(prio);
} } | public class class_name {
public JobPriority getJobPriority() {
String prio = get("mapred.job.priority");
if(prio == null) {
return JobPriority.NORMAL; // depends on control dependency: [if], data = [none]
}
return JobPriority.valueOf(prio);
} } |
public class class_name {
public void compute()
{
if (!computable) {
throw new RuntimeException("can't re-'compute' experiment results after a 'restore'");
}
expt = new MatchExpt[blockers.size()][learners.size()][datasets.size()];
for (int i=0; i<blockers.size(); i++) {
Blocker blocker = (Blocker)blockers.get(i);
for (int j=0; j<learners.size(); j++) {
StringDistanceLearner distance = (StringDistanceLearner)learners.get(j);
for (int k=0; k<datasets.size(); k++) {
MatchData dataset = (MatchData)datasets.get(k);
expt[i][j][k] = new MatchExpt(dataset,distance,blocker);
}
}
}
} } | public class class_name {
public void compute()
{
if (!computable) {
throw new RuntimeException("can't re-'compute' experiment results after a 'restore'");
}
expt = new MatchExpt[blockers.size()][learners.size()][datasets.size()];
for (int i=0; i<blockers.size(); i++) {
Blocker blocker = (Blocker)blockers.get(i);
for (int j=0; j<learners.size(); j++) {
StringDistanceLearner distance = (StringDistanceLearner)learners.get(j);
for (int k=0; k<datasets.size(); k++) {
MatchData dataset = (MatchData)datasets.get(k);
expt[i][j][k] = new MatchExpt(dataset,distance,blocker); // depends on control dependency: [for], data = [k]
}
}
}
} } |
public class class_name {
private void loadFeatureWeight(BufferedReader br, int[] statusCoven,
TreeMap<Integer, Pair<String, String>> featureNames) throws Exception {
featureTree = new SmartForest<float[]>();
int tag = 0; // 赏析按标签为用来转换
int len = 0; // 权重数组的大小
String name = null; // 特征名称
float[] tempW = null; // 每一个特征的权重
String temp = null;
for (Pair<String, String> pair : featureNames.values()) {
char fc = Character.toUpperCase(pair.getValue0().charAt(0));
len = fc == 'B' ? Config.TAG_NUM * Config.TAG_NUM
: fc == 'U' ? Config.TAG_NUM
: fc == '*' ? (Config.TAG_NUM + Config.TAG_NUM * Config.TAG_NUM) : 0;
if (len == 0) {
throw new Exception("unknow feature type " + pair.getValue0());
}
if (fc == 'B') { // 特殊处理转换特征数组
for (int i = 0; i < len; i++) {
temp = br.readLine();
int from = statusCoven[i / Config.TAG_NUM];
int to = statusCoven[i % Config.TAG_NUM];
status[from][to] = ObjConver.getFloatValue(temp);
}
} else {
name = pair.getValue1();
tempW = new float[len];
for (int i = 0; i < len; i++) {
temp = br.readLine();
tag = statusCoven[i];
tempW[tag] = ObjConver.getFloatValue(temp);
}
this.featureTree.add(name, tempW); // 将特征增加到特征🌲中
// printFeatureTree(name, tempW);
}
}
} } | public class class_name {
private void loadFeatureWeight(BufferedReader br, int[] statusCoven,
TreeMap<Integer, Pair<String, String>> featureNames) throws Exception {
featureTree = new SmartForest<float[]>();
int tag = 0; // 赏析按标签为用来转换
int len = 0; // 权重数组的大小
String name = null; // 特征名称
float[] tempW = null; // 每一个特征的权重
String temp = null;
for (Pair<String, String> pair : featureNames.values()) {
char fc = Character.toUpperCase(pair.getValue0().charAt(0));
len = fc == 'B' ? Config.TAG_NUM * Config.TAG_NUM
: fc == 'U' ? Config.TAG_NUM
: fc == '*' ? (Config.TAG_NUM + Config.TAG_NUM * Config.TAG_NUM) : 0;
if (len == 0) {
throw new Exception("unknow feature type " + pair.getValue0());
}
if (fc == 'B') { // 特殊处理转换特征数组
for (int i = 0; i < len; i++) {
temp = br.readLine(); // depends on control dependency: [for], data = [none]
int from = statusCoven[i / Config.TAG_NUM];
int to = statusCoven[i % Config.TAG_NUM];
status[from][to] = ObjConver.getFloatValue(temp); // depends on control dependency: [for], data = [none]
}
} else {
name = pair.getValue1();
tempW = new float[len];
for (int i = 0; i < len; i++) {
temp = br.readLine(); // depends on control dependency: [for], data = [none]
tag = statusCoven[i]; // depends on control dependency: [for], data = [i]
tempW[tag] = ObjConver.getFloatValue(temp); // depends on control dependency: [for], data = [none]
}
this.featureTree.add(name, tempW); // 将特征增加到特征🌲中
// printFeatureTree(name, tempW);
}
}
} } |
public class class_name {
public void closeReader(BitReader reader) throws IllegalArgumentException, BitStreamException {
if (reader == null) throw new IllegalArgumentException("null reader");
if (reader instanceof InputStreamBitReader) {
try {
((InputStreamBitReader) reader).getInputStream().close();
} catch (IOException e) {
throw new BitStreamException(e);
}
} else if (reader instanceof FileChannelBitReader) {
try {
((FileChannelBitReader) reader).getChannel().close();
} catch (IOException e) {
throw new BitStreamException(e);
}
}
} } | public class class_name {
public void closeReader(BitReader reader) throws IllegalArgumentException, BitStreamException {
if (reader == null) throw new IllegalArgumentException("null reader");
if (reader instanceof InputStreamBitReader) {
try {
((InputStreamBitReader) reader).getInputStream().close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new BitStreamException(e);
} // depends on control dependency: [catch], data = [none]
} else if (reader instanceof FileChannelBitReader) {
try {
((FileChannelBitReader) reader).getChannel().close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new BitStreamException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public boolean isValid (Object target)
{
TileSet set = (TileSet)target;
boolean valid = true;
// check for the 'name' attribute
if (StringUtil.isBlank(set.getName())) {
log.warning("Tile set definition missing 'name' attribute " +
"[set=" + set + "].");
valid = false;
}
// check for an <imagePath> element
if (StringUtil.isBlank(set.getImagePath())) {
log.warning("Tile set definition missing <imagePath> element " +
"[set=" + set + "].");
valid = false;
}
return valid;
} } | public class class_name {
public boolean isValid (Object target)
{
TileSet set = (TileSet)target;
boolean valid = true;
// check for the 'name' attribute
if (StringUtil.isBlank(set.getName())) {
log.warning("Tile set definition missing 'name' attribute " +
"[set=" + set + "]."); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
}
// check for an <imagePath> element
if (StringUtil.isBlank(set.getImagePath())) {
log.warning("Tile set definition missing <imagePath> element " +
"[set=" + set + "]."); // depends on control dependency: [if], data = [none]
valid = false; // depends on control dependency: [if], data = [none]
}
return valid;
} } |
public class class_name {
protected static String getFinalTarget(ResourceHandle resource, List<String> trace)
throws RedirectLoopException {
String finalTarget = null;
if (resource.isValid()) {
String path = resource.getPath();
if (trace.contains(path)) {
// throw an exception if a loop has been detected
throw new RedirectLoopException(trace, path);
}
// search for redirects and resolve them...
String redirect = resource.getProperty(PROP_TARGET);
if (StringUtils.isBlank(redirect)) {
redirect = resource.getProperty(PROP_REDIRECT);
}
if (StringUtils.isBlank(redirect)) {
// try to use the properties of a 'jcr:content' child instead of the target resource itself
ResourceHandle contentResource = resource.getContentResource();
if (resource != contentResource) {
redirect = contentResource.getProperty(PROP_TARGET);
if (StringUtils.isBlank(redirect)) {
redirect = contentResource.getProperty(PROP_REDIRECT);
}
}
}
if (StringUtils.isNotBlank(redirect)) {
trace.add(path);
finalTarget = redirect; // use the redirect target as the link URL
if (!URL_PATTERN.matcher(finalTarget).matches()) {
// look forward if the redirect found points to another resource
ResourceResolver resolver = resource.getResourceResolver();
Resource targetResource = resolver.getResource(finalTarget);
if (targetResource != null) {
String target = getFinalTarget(ResourceHandle.use(targetResource), trace);
if (StringUtils.isNotBlank(target)) {
finalTarget = target;
}
}
}
}
}
return finalTarget;
} } | public class class_name {
protected static String getFinalTarget(ResourceHandle resource, List<String> trace)
throws RedirectLoopException {
String finalTarget = null;
if (resource.isValid()) {
String path = resource.getPath();
if (trace.contains(path)) {
// throw an exception if a loop has been detected
throw new RedirectLoopException(trace, path);
}
// search for redirects and resolve them...
String redirect = resource.getProperty(PROP_TARGET);
if (StringUtils.isBlank(redirect)) {
redirect = resource.getProperty(PROP_REDIRECT);
}
if (StringUtils.isBlank(redirect)) {
// try to use the properties of a 'jcr:content' child instead of the target resource itself
ResourceHandle contentResource = resource.getContentResource();
if (resource != contentResource) {
redirect = contentResource.getProperty(PROP_TARGET); // depends on control dependency: [if], data = [none]
if (StringUtils.isBlank(redirect)) {
redirect = contentResource.getProperty(PROP_REDIRECT); // depends on control dependency: [if], data = [none]
}
}
}
if (StringUtils.isNotBlank(redirect)) {
trace.add(path);
finalTarget = redirect; // use the redirect target as the link URL
if (!URL_PATTERN.matcher(finalTarget).matches()) {
// look forward if the redirect found points to another resource
ResourceResolver resolver = resource.getResourceResolver();
Resource targetResource = resolver.getResource(finalTarget);
if (targetResource != null) {
String target = getFinalTarget(ResourceHandle.use(targetResource), trace);
if (StringUtils.isNotBlank(target)) {
finalTarget = target; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return finalTarget;
} } |
public class class_name {
public ArrayList<ProgressSource> getProgressSources() {
ArrayList<ProgressSource> snapshot = new ArrayList<ProgressSource>();
try {
synchronized(progressSourceList) {
for (Iterator<ProgressSource> iter = progressSourceList.iterator(); iter.hasNext();) {
ProgressSource pi = iter.next();
// Clone ProgressSource and add to snapshot
snapshot.add((ProgressSource)pi.clone());
}
}
}
catch(CloneNotSupportedException e) {
e.printStackTrace();
}
return snapshot;
} } | public class class_name {
public ArrayList<ProgressSource> getProgressSources() {
ArrayList<ProgressSource> snapshot = new ArrayList<ProgressSource>();
try {
synchronized(progressSourceList) { // depends on control dependency: [try], data = [none]
for (Iterator<ProgressSource> iter = progressSourceList.iterator(); iter.hasNext();) {
ProgressSource pi = iter.next();
// Clone ProgressSource and add to snapshot
snapshot.add((ProgressSource)pi.clone()); // depends on control dependency: [for], data = [none]
}
}
}
catch(CloneNotSupportedException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return snapshot;
} } |
public class class_name {
public int getZoomLevel() {
Projection projection = getProjection();
if (projection == null) {
throw new GeoPackageException(
"No projection was set which is required to determine the zoom level");
}
int zoomLevel = 0;
BoundingBox boundingBox = getBoundingBox();
if (boundingBox != null) {
if (projection.isUnit(Units.DEGREES)) {
boundingBox = TileBoundingBoxUtils
.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
}
ProjectionTransform webMercatorTransform = projection
.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
BoundingBox webMercatorBoundingBox = boundingBox
.transform(webMercatorTransform);
zoomLevel = TileBoundingBoxUtils
.getZoomLevel(webMercatorBoundingBox);
}
return zoomLevel;
} } | public class class_name {
public int getZoomLevel() {
Projection projection = getProjection();
if (projection == null) {
throw new GeoPackageException(
"No projection was set which is required to determine the zoom level");
}
int zoomLevel = 0;
BoundingBox boundingBox = getBoundingBox();
if (boundingBox != null) {
if (projection.isUnit(Units.DEGREES)) {
boundingBox = TileBoundingBoxUtils
.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox); // depends on control dependency: [if], data = [none]
}
ProjectionTransform webMercatorTransform = projection
.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
BoundingBox webMercatorBoundingBox = boundingBox
.transform(webMercatorTransform);
zoomLevel = TileBoundingBoxUtils
.getZoomLevel(webMercatorBoundingBox); // depends on control dependency: [if], data = [none]
}
return zoomLevel;
} } |
public class class_name {
public void invokeErrorListener(int what, int extra) {
// Calling doStop() un-schedules the next event and
// stops normal event flow from continuing.
doStop();
state = ERROR;
boolean handled = errorListener != null
&& errorListener.onError(player, what, extra);
if (!handled) {
// The documentation isn't very clear if onCompletion is
// supposed to be called from non-playing states
// (ie, states other than STARTED or PAUSED). Testing
// revealed that onCompletion is invoked even if playback
// hasn't started or is not in progress.
invokeCompletionListener();
// Need to set this again because
// invokeCompletionListener() will set the state
// to PLAYBACK_COMPLETED
state = ERROR;
}
} } | public class class_name {
public void invokeErrorListener(int what, int extra) {
// Calling doStop() un-schedules the next event and
// stops normal event flow from continuing.
doStop();
state = ERROR;
boolean handled = errorListener != null
&& errorListener.onError(player, what, extra);
if (!handled) {
// The documentation isn't very clear if onCompletion is
// supposed to be called from non-playing states
// (ie, states other than STARTED or PAUSED). Testing
// revealed that onCompletion is invoked even if playback
// hasn't started or is not in progress.
invokeCompletionListener(); // depends on control dependency: [if], data = [none]
// Need to set this again because
// invokeCompletionListener() will set the state
// to PLAYBACK_COMPLETED
state = ERROR; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void handleLeadershipChange(NotificationContext changeContext) {
if (this.helixManager.isPresent() && this.helixManager.get().isLeader()) {
LOGGER.info("Leader notification for {} HM.isLeader {}", this.helixManager.get().getInstanceName(),
this.helixManager.get().isLeader());
if (this.isSchedulerEnabled) {
LOGGER.info("Gobblin Service is now running in master instance mode, enabling Scheduler.");
this.scheduler.setActive(true);
}
if (this.isGitConfigMonitorEnabled) {
this.gitConfigMonitor.setActive(true);
}
if (this.isDagManagerEnabled) {
//Activate DagManager only if TopologyCatalog is initialized. If not; skip activation.
if (this.topologyCatalog.getInitComplete().getCount() == 0) {
this.dagManager.setActive(true);
}
}
} else if (this.helixManager.isPresent()) {
LOGGER.info("Leader lost notification for {} HM.isLeader {}", this.helixManager.get().getInstanceName(),
this.helixManager.get().isLeader());
if (this.isSchedulerEnabled) {
LOGGER.info("Gobblin Service is now running in slave instance mode, disabling Scheduler.");
this.scheduler.setActive(false);
}
if (this.isGitConfigMonitorEnabled) {
this.gitConfigMonitor.setActive(false);
}
if (this.isDagManagerEnabled) {
this.dagManager.setActive(false);
}
}
} } | public class class_name {
private void handleLeadershipChange(NotificationContext changeContext) {
if (this.helixManager.isPresent() && this.helixManager.get().isLeader()) {
LOGGER.info("Leader notification for {} HM.isLeader {}", this.helixManager.get().getInstanceName(),
this.helixManager.get().isLeader()); // depends on control dependency: [if], data = [none]
if (this.isSchedulerEnabled) {
LOGGER.info("Gobblin Service is now running in master instance mode, enabling Scheduler."); // depends on control dependency: [if], data = [none]
this.scheduler.setActive(true); // depends on control dependency: [if], data = [none]
}
if (this.isGitConfigMonitorEnabled) {
this.gitConfigMonitor.setActive(true); // depends on control dependency: [if], data = [none]
}
if (this.isDagManagerEnabled) {
//Activate DagManager only if TopologyCatalog is initialized. If not; skip activation.
if (this.topologyCatalog.getInitComplete().getCount() == 0) {
this.dagManager.setActive(true); // depends on control dependency: [if], data = [none]
}
}
} else if (this.helixManager.isPresent()) {
LOGGER.info("Leader lost notification for {} HM.isLeader {}", this.helixManager.get().getInstanceName(),
this.helixManager.get().isLeader()); // depends on control dependency: [if], data = [none]
if (this.isSchedulerEnabled) {
LOGGER.info("Gobblin Service is now running in slave instance mode, disabling Scheduler."); // depends on control dependency: [if], data = [none]
this.scheduler.setActive(false); // depends on control dependency: [if], data = [none]
}
if (this.isGitConfigMonitorEnabled) {
this.gitConfigMonitor.setActive(false); // depends on control dependency: [if], data = [none]
}
if (this.isDagManagerEnabled) {
this.dagManager.setActive(false); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public synchronized void writeToLog(Session session, String statement) {
if (logStatements && log != null) {
log.writeStatement(session, statement);
}
} } | public class class_name {
public synchronized void writeToLog(Session session, String statement) {
if (logStatements && log != null) {
log.writeStatement(session, statement); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public FutureData<Identity> create(String label, boolean active, boolean master) {
if (label == null || label.isEmpty()) {
throw new IllegalArgumentException("A label is required");
}
String activeStr = active ? "active" : "disabled";
FutureData<Identity> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(IDENTITY));
try {
Request request = config.http()
.postJSON(uri, new PageReader(newRequestCallback(future, new Identity(), config)))
.setData(new NewIdentity(label, activeStr, master));
performRequest(future, request);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return future;
} } | public class class_name {
public FutureData<Identity> create(String label, boolean active, boolean master) {
if (label == null || label.isEmpty()) {
throw new IllegalArgumentException("A label is required");
}
String activeStr = active ? "active" : "disabled";
FutureData<Identity> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(IDENTITY));
try {
Request request = config.http()
.postJSON(uri, new PageReader(newRequestCallback(future, new Identity(), config)))
.setData(new NewIdentity(label, activeStr, master));
performRequest(future, request); // depends on control dependency: [try], data = [none]
} catch (JsonProcessingException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return future;
} } |
public class class_name {
@Override
public synchronized void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException {
this.setResolveInit();
for (TransportCandidate candidate : this.getCandidatesList()) {
if (candidate instanceof ICECandidate) {
ICECandidate iceCandidate = (ICECandidate) candidate;
iceCandidate.removeCandidateEcho();
}
}
this.clear();
// Create a transport candidate for each ICE negotiator candidate we have.
ICENegociator iceNegociator = negociatorsMap.get(server);
for (Candidate candidate : iceNegociator.getSortedCandidates())
try {
Candidate.CandidateType type = candidate.getCandidateType();
ICECandidate.Type iceType;
if (type.equals(Candidate.CandidateType.ServerReflexive))
iceType = ICECandidate.Type.srflx;
else if (type.equals(Candidate.CandidateType.PeerReflexive))
iceType = ICECandidate.Type.prflx;
else if (type.equals(Candidate.CandidateType.Relayed))
iceType = ICECandidate.Type.relay;
else
iceType = ICECandidate.Type.host;
// JBW/GW - 17JUL08: Figure out the zero-based NIC number for this candidate.
short nicNum = 0;
try {
Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
short i = 0;
NetworkInterface nic = NetworkInterface.getByInetAddress(candidate.getAddress().getInetAddress());
while (nics.hasMoreElements()) {
NetworkInterface checkNIC = nics.nextElement();
if (checkNIC.equals(nic)) {
nicNum = i;
break;
}
i++;
}
} catch (SocketException e1) {
LOGGER.log(Level.WARNING, "exeption", e1);
}
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(random.nextInt(Integer.MAX_VALUE)), candidate.getPort(), "1", candidate.getPriority(), iceType);
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
transportCandidate.setPort(getFreePort());
try {
transportCandidate.addCandidateEcho(session);
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
this.addCandidate(transportCandidate);
LOGGER.fine("Candidate addr: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " Priority:" + candidate.getPriority());
}
catch (UtilityException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
catch (UnknownHostException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
// Get a Relay Candidate from XMPP Server
if (RTPBridge.serviceAvailable(connection)) {
// try {
String localIp;
int network;
// JBW/GW - 17JUL08: ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now the API doesn't exist in JSTUN 1.7.1
// if (iceNegociator.getPublicCandidate() != null) {
// localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
// network = iceNegociator.getPublicCandidate().getNetwork();
// }
// else {
{
localIp = BridgedResolver.getLocalHost();
network = 0;
}
sid = random.nextInt(Integer.MAX_VALUE);
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
TransportCandidate localCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(random.nextInt(Integer.MAX_VALUE)), rtpBridge.getPortA(), "1", 0, ICECandidate.Type.relay);
localCandidate.setLocalIp(localIp);
TransportCandidate remoteCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(random.nextInt(Integer.MAX_VALUE)), rtpBridge.getPortB(), "1", 0, ICECandidate.Type.relay);
remoteCandidate.setLocalIp(localIp);
localCandidate.setSymmetric(remoteCandidate);
remoteCandidate.setSymmetric(localCandidate);
localCandidate.setPassword(rtpBridge.getPass());
remoteCandidate.setPassword(rtpBridge.getPass());
localCandidate.setSessionId(rtpBridge.getSid());
remoteCandidate.setSessionId(rtpBridge.getSid());
localCandidate.setConnection(this.connection);
remoteCandidate.setConnection(this.connection);
addCandidate(localCandidate);
// }
// catch (UtilityException e) {
// LOGGER.log(Level.WARNING, "exception", e);
// }
// catch (UnknownHostException e) {
// LOGGER.log(Level.WARNING, "exception", e);
// }
// Get Public Candidate From XMPP Server
// JBW/GW - 17JUL08 - ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now it doesn't exist in JSTUN 1.7.1
// if (iceNegociator.getPublicCandidate() == null) {
if (true) {
String publicIp = RTPBridge.getPublicIP(connection);
if (publicIp != null && !publicIp.equals("")) {
Enumeration<NetworkInterface> ifaces = null;
try {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
// If detect this address in local machine, don't use it.
boolean found = false;
while (ifaces.hasMoreElements() && !false) {
NetworkInterface iface = ifaces.nextElement();
Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
while (iaddresses.hasMoreElements()) {
InetAddress iaddress = iaddresses.nextElement();
if (iaddress.getHostAddress().indexOf(publicIp) > -1) {
found = true;
break;
}
}
}
if (!found) {
try {
TransportCandidate publicCandidate = new ICECandidate(
publicIp, 1, 0, String.valueOf(random.nextInt(Integer.MAX_VALUE)), getFreePort(), "1", 0, ICECandidate.Type.srflx);
publicCandidate.setLocalIp(InetAddress.getLocalHost().getHostAddress());
try {
publicCandidate.addCandidateEcho(session);
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
addCandidate(publicCandidate);
}
catch (UnknownHostException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
}
}
this.setResolveEnd();
} } | public class class_name {
@Override
public synchronized void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException {
this.setResolveInit();
for (TransportCandidate candidate : this.getCandidatesList()) {
if (candidate instanceof ICECandidate) {
ICECandidate iceCandidate = (ICECandidate) candidate;
iceCandidate.removeCandidateEcho(); // depends on control dependency: [if], data = [none]
}
}
this.clear();
// Create a transport candidate for each ICE negotiator candidate we have.
ICENegociator iceNegociator = negociatorsMap.get(server);
for (Candidate candidate : iceNegociator.getSortedCandidates())
try {
Candidate.CandidateType type = candidate.getCandidateType();
ICECandidate.Type iceType;
if (type.equals(Candidate.CandidateType.ServerReflexive))
iceType = ICECandidate.Type.srflx;
else if (type.equals(Candidate.CandidateType.PeerReflexive))
iceType = ICECandidate.Type.prflx;
else if (type.equals(Candidate.CandidateType.Relayed))
iceType = ICECandidate.Type.relay;
else
iceType = ICECandidate.Type.host;
// JBW/GW - 17JUL08: Figure out the zero-based NIC number for this candidate.
short nicNum = 0;
try {
Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
short i = 0;
NetworkInterface nic = NetworkInterface.getByInetAddress(candidate.getAddress().getInetAddress());
while (nics.hasMoreElements()) {
NetworkInterface checkNIC = nics.nextElement();
if (checkNIC.equals(nic)) {
nicNum = i; // depends on control dependency: [if], data = [none]
break;
}
i++; // depends on control dependency: [while], data = [none]
}
} catch (SocketException e1) {
LOGGER.log(Level.WARNING, "exeption", e1);
}
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(random.nextInt(Integer.MAX_VALUE)), candidate.getPort(), "1", candidate.getPriority(), iceType);
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
transportCandidate.setPort(getFreePort());
try {
transportCandidate.addCandidateEcho(session);
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
this.addCandidate(transportCandidate);
LOGGER.fine("Candidate addr: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " Priority:" + candidate.getPriority());
}
catch (UtilityException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
catch (UnknownHostException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
// Get a Relay Candidate from XMPP Server
if (RTPBridge.serviceAvailable(connection)) {
// try {
String localIp;
int network;
// JBW/GW - 17JUL08: ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now the API doesn't exist in JSTUN 1.7.1
// if (iceNegociator.getPublicCandidate() != null) {
// localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
// network = iceNegociator.getPublicCandidate().getNetwork();
// }
// else {
{
localIp = BridgedResolver.getLocalHost();
network = 0;
}
sid = random.nextInt(Integer.MAX_VALUE);
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
TransportCandidate localCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(random.nextInt(Integer.MAX_VALUE)), rtpBridge.getPortA(), "1", 0, ICECandidate.Type.relay);
localCandidate.setLocalIp(localIp);
TransportCandidate remoteCandidate = new ICECandidate(
rtpBridge.getIp(), 1, network, String.valueOf(random.nextInt(Integer.MAX_VALUE)), rtpBridge.getPortB(), "1", 0, ICECandidate.Type.relay);
remoteCandidate.setLocalIp(localIp);
localCandidate.setSymmetric(remoteCandidate);
remoteCandidate.setSymmetric(localCandidate);
localCandidate.setPassword(rtpBridge.getPass());
remoteCandidate.setPassword(rtpBridge.getPass());
localCandidate.setSessionId(rtpBridge.getSid());
remoteCandidate.setSessionId(rtpBridge.getSid());
localCandidate.setConnection(this.connection);
remoteCandidate.setConnection(this.connection);
addCandidate(localCandidate);
// }
// catch (UtilityException e) {
// LOGGER.log(Level.WARNING, "exception", e);
// }
// catch (UnknownHostException e) {
// LOGGER.log(Level.WARNING, "exception", e);
// }
// Get Public Candidate From XMPP Server
// JBW/GW - 17JUL08 - ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now it doesn't exist in JSTUN 1.7.1
// if (iceNegociator.getPublicCandidate() == null) {
if (true) {
String publicIp = RTPBridge.getPublicIP(connection);
if (publicIp != null && !publicIp.equals("")) {
Enumeration<NetworkInterface> ifaces = null;
try {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
// If detect this address in local machine, don't use it.
boolean found = false;
while (ifaces.hasMoreElements() && !false) {
NetworkInterface iface = ifaces.nextElement();
Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
while (iaddresses.hasMoreElements()) {
InetAddress iaddress = iaddresses.nextElement();
if (iaddress.getHostAddress().indexOf(publicIp) > -1) {
found = true;
break;
}
}
}
if (!found) {
try {
TransportCandidate publicCandidate = new ICECandidate(
publicIp, 1, 0, String.valueOf(random.nextInt(Integer.MAX_VALUE)), getFreePort(), "1", 0, ICECandidate.Type.srflx);
publicCandidate.setLocalIp(InetAddress.getLocalHost().getHostAddress());
try {
publicCandidate.addCandidateEcho(session);
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
addCandidate(publicCandidate);
}
catch (UnknownHostException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
}
}
this.setResolveEnd();
} } |
public class class_name {
static void onNullInjectedIntoNonNullableDependency(Object source, Dependency<?> dependency)
throws InternalProvisionException {
// Hack to allow null parameters to @Provides methods, for backwards compatibility.
if (dependency.getInjectionPoint().getMember() instanceof Method) {
Method annotated = (Method) dependency.getInjectionPoint().getMember();
if (annotated.isAnnotationPresent(Provides.class)) {
switch (InternalFlags.getNullableProvidesOption()) {
case ERROR:
break; // break out & let the below exception happen
case IGNORE:
return; // user doesn't care about injecting nulls to non-@Nullables.
case WARN:
// Warn only once, otherwise we spam logs too much.
if (warnedDependencies.add(dependency)) {
logger.log(
Level.WARNING,
"Guice injected null into {0} (a {1}), please mark it @Nullable."
+ " Use -Dguice_check_nullable_provides_params=ERROR to turn this into an"
+ " error.",
new Object[] {
Messages.formatParameter(dependency), Messages.convert(dependency.getKey())
});
}
return;
}
}
}
Object formattedDependency =
(dependency.getParameterIndex() != -1)
? Messages.formatParameter(dependency)
: StackTraceElements.forMember(dependency.getInjectionPoint().getMember());
throw InternalProvisionException.create(
"null returned by binding at %s%n but %s is not @Nullable", source, formattedDependency)
.addSource(source);
} } | public class class_name {
static void onNullInjectedIntoNonNullableDependency(Object source, Dependency<?> dependency)
throws InternalProvisionException {
// Hack to allow null parameters to @Provides methods, for backwards compatibility.
if (dependency.getInjectionPoint().getMember() instanceof Method) {
Method annotated = (Method) dependency.getInjectionPoint().getMember();
if (annotated.isAnnotationPresent(Provides.class)) {
switch (InternalFlags.getNullableProvidesOption()) {
case ERROR:
break; // break out & let the below exception happen
case IGNORE:
return; // user doesn't care about injecting nulls to non-@Nullables.
case WARN:
// Warn only once, otherwise we spam logs too much.
if (warnedDependencies.add(dependency)) {
logger.log(
Level.WARNING,
"Guice injected null into {0} (a {1}), please mark it @Nullable."
+ " Use -Dguice_check_nullable_provides_params=ERROR to turn this into an"
+ " error.",
new Object[] {
Messages.formatParameter(dependency), Messages.convert(dependency.getKey())
}); // depends on control dependency: [if], data = [none]
}
return;
}
}
}
Object formattedDependency =
(dependency.getParameterIndex() != -1)
? Messages.formatParameter(dependency)
: StackTraceElements.forMember(dependency.getInjectionPoint().getMember());
throw InternalProvisionException.create(
"null returned by binding at %s%n but %s is not @Nullable", source, formattedDependency)
.addSource(source);
} } |
public class class_name {
@Override
public T transformElement(Tuple2<AerospikeKey, AerospikeRecord> tuple, DeepJobConfig<T, ? extends DeepJobConfig> config) {
try {
return (T) UtilAerospike.getObjectFromAerospikeRecord(config.getEntityClass(), tuple._2(),
(AerospikeDeepJobConfig) this.deepJobConfig);
} catch (Exception e) {
LOG.error("Cannot convert AerospikeRecord: ", e);
throw new DeepTransformException("Could not transform from AerospikeRecord to Entity " + e.getMessage(), e);
}
} } | public class class_name {
@Override
public T transformElement(Tuple2<AerospikeKey, AerospikeRecord> tuple, DeepJobConfig<T, ? extends DeepJobConfig> config) {
try {
return (T) UtilAerospike.getObjectFromAerospikeRecord(config.getEntityClass(), tuple._2(),
(AerospikeDeepJobConfig) this.deepJobConfig); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Cannot convert AerospikeRecord: ", e);
throw new DeepTransformException("Could not transform from AerospikeRecord to Entity " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void elemAdd(MVec addend) {
if (addend instanceof VTensor) {
elemAdd((VTensor)addend);
} else {
throw new IllegalArgumentException("Addend must be of type " + this.getClass());
}
} } | public class class_name {
@Override
public void elemAdd(MVec addend) {
if (addend instanceof VTensor) {
elemAdd((VTensor)addend); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Addend must be of type " + this.getClass());
}
} } |
public class class_name {
public static String getChineseZodiac(Calendar calendar) {
if (null == calendar) {
return null;
}
return getChineseZodiac(calendar.get(Calendar.YEAR));
} } | public class class_name {
public static String getChineseZodiac(Calendar calendar) {
if (null == calendar) {
return null;
// depends on control dependency: [if], data = [none]
}
return getChineseZodiac(calendar.get(Calendar.YEAR));
} } |
public class class_name {
public static Date lastModifiedTime(File file) {
if (!exist(file)) {
return null;
}
return new Date(file.lastModified());
} } | public class class_name {
public static Date lastModifiedTime(File file) {
if (!exist(file)) {
return null;
// depends on control dependency: [if], data = [none]
}
return new Date(file.lastModified());
} } |
public class class_name {
@NullSafe
public static boolean isLetters(String value) {
for (char chr : toCharArray(value)) {
if (!Character.isLetter(chr)) {
return false;
}
}
return hasText(value);
} } | public class class_name {
@NullSafe
public static boolean isLetters(String value) {
for (char chr : toCharArray(value)) {
if (!Character.isLetter(chr)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return hasText(value);
} } |
public class class_name {
public static byte[] bytes(String s) {
try {
return s.getBytes(ENCODING);
} catch (UnsupportedEncodingException e) {
log.error("UnsupportedEncodingException ", e);
throw new RuntimeException(e);
}
} } | public class class_name {
public static byte[] bytes(String s) {
try {
return s.getBytes(ENCODING); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
log.error("UnsupportedEncodingException ", e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public final boolean hasNext() {
// assure, that preceding is not evaluated on an attribute or a
// namespace
if (mIsFirst) {
mIsFirst = false;
if (getNode().getKind() == IConstants.ATTRIBUTE
// || getTransaction().isNamespaceKind()
) {
resetToStartKey();
return false;
}
}
resetToLastKey();
if (!mStack.empty()) {
// return all nodes of the current subtree in reverse document order
moveTo(mStack.pop());
return true;
}
if (((ITreeStructData)getNode()).hasLeftSibling()) {
moveTo(((ITreeStructData)getNode()).getLeftSiblingKey());
// because this axis return the precedings in reverse document
// order, we
// need to travel to the node in the subtree, that comes last in
// document
// order.
getLastChild();
return true;
}
while (getNode().hasParent()) {
// ancestors are not part of the preceding set
moveTo(getNode().getParentKey());
if (((ITreeStructData)getNode()).hasLeftSibling()) {
moveTo(((ITreeStructData)getNode()).getLeftSiblingKey());
// move to last node in the subtree
getLastChild();
return true;
}
}
resetToStartKey();
return false;
} } | public class class_name {
@Override
public final boolean hasNext() {
// assure, that preceding is not evaluated on an attribute or a
// namespace
if (mIsFirst) {
mIsFirst = false; // depends on control dependency: [if], data = [none]
if (getNode().getKind() == IConstants.ATTRIBUTE
// || getTransaction().isNamespaceKind()
) {
resetToStartKey(); // depends on control dependency: [if], data = []
return false; // depends on control dependency: [if], data = []
}
}
resetToLastKey();
if (!mStack.empty()) {
// return all nodes of the current subtree in reverse document order
moveTo(mStack.pop()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (((ITreeStructData)getNode()).hasLeftSibling()) {
moveTo(((ITreeStructData)getNode()).getLeftSiblingKey()); // depends on control dependency: [if], data = [none]
// because this axis return the precedings in reverse document
// order, we
// need to travel to the node in the subtree, that comes last in
// document
// order.
getLastChild(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
while (getNode().hasParent()) {
// ancestors are not part of the preceding set
moveTo(getNode().getParentKey()); // depends on control dependency: [while], data = [none]
if (((ITreeStructData)getNode()).hasLeftSibling()) {
moveTo(((ITreeStructData)getNode()).getLeftSiblingKey()); // depends on control dependency: [if], data = [none]
// move to last node in the subtree
getLastChild(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
resetToStartKey();
return false;
} } |
public class class_name {
public ConnectionListener getConnectionListener(Credential credential) throws ResourceException
{
log.tracef("getConnectionListener(%s)", credential);
ConnectionListener cl = null;
ManagedConnectionPool mcp = getManagedConnectionPool(credential);
if (isShutdown())
throw new ResourceException();
if (cm.getTransactionSupport() == TransactionSupportLevel.LocalTransaction
|| cm.getTransactionSupport() == TransactionSupportLevel.XATransaction)
{
try
{
TransactionalConnectionManager txCM = (TransactionalConnectionManager) cm;
Transaction tx = txCM.getTransactionIntegration().getTransactionManager().getTransaction();
if (TxUtils.isUncommitted(tx))
{
Object id = txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().getTransactionKey();
Map<ManagedConnectionPool, ConnectionListener> currentMap = transactionMap.get(id);
if (currentMap == null)
{
Map<ManagedConnectionPool, ConnectionListener> map = new HashMap<>();
currentMap = transactionMap.putIfAbsent(id, map);
if (currentMap == null)
{
currentMap = map;
}
}
cl = currentMap.get(mcp);
if (cl == null)
{
if (TxUtils.isActive(tx))
{
cl = mcp.getConnectionListener();
currentMap.put(mcp, cl);
txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().
registerInterposedSynchronization(new TransactionMapCleanup(id, transactionMap));
}
else
{
throw new ResourceException();
}
}
}
}
catch (ResourceException re)
{
throw re;
}
catch (Exception e)
{
throw new ResourceException(e);
}
}
if (cl == null)
cl = mcp.getConnectionListener();
return cl;
} } | public class class_name {
public ConnectionListener getConnectionListener(Credential credential) throws ResourceException
{
log.tracef("getConnectionListener(%s)", credential);
ConnectionListener cl = null;
ManagedConnectionPool mcp = getManagedConnectionPool(credential);
if (isShutdown())
throw new ResourceException();
if (cm.getTransactionSupport() == TransactionSupportLevel.LocalTransaction
|| cm.getTransactionSupport() == TransactionSupportLevel.XATransaction)
{
try
{
TransactionalConnectionManager txCM = (TransactionalConnectionManager) cm;
Transaction tx = txCM.getTransactionIntegration().getTransactionManager().getTransaction();
if (TxUtils.isUncommitted(tx))
{
Object id = txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().getTransactionKey();
Map<ManagedConnectionPool, ConnectionListener> currentMap = transactionMap.get(id);
if (currentMap == null)
{
Map<ManagedConnectionPool, ConnectionListener> map = new HashMap<>();
currentMap = transactionMap.putIfAbsent(id, map); // depends on control dependency: [if], data = [none]
if (currentMap == null)
{
currentMap = map; // depends on control dependency: [if], data = [none]
}
}
cl = currentMap.get(mcp); // depends on control dependency: [if], data = [none]
if (cl == null)
{
if (TxUtils.isActive(tx))
{
cl = mcp.getConnectionListener(); // depends on control dependency: [if], data = [none]
currentMap.put(mcp, cl); // depends on control dependency: [if], data = [none]
txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().
registerInterposedSynchronization(new TransactionMapCleanup(id, transactionMap)); // depends on control dependency: [if], data = [none]
}
else
{
throw new ResourceException();
}
}
}
}
catch (ResourceException re)
{
throw re;
} // depends on control dependency: [catch], data = [none]
catch (Exception e)
{
throw new ResourceException(e);
} // depends on control dependency: [catch], data = [none]
}
if (cl == null)
cl = mcp.getConnectionListener();
return cl;
} } |
public class class_name {
public File newStagingFile(String entryName, long modTime) {
File file = new File(stagingDirectory, entryName);
if (modTime != 0) {
file.setLastModified(modTime);
}
file.getParentFile().mkdirs();
return file;
} } | public class class_name {
public File newStagingFile(String entryName, long modTime) {
File file = new File(stagingDirectory, entryName);
if (modTime != 0) {
file.setLastModified(modTime); // depends on control dependency: [if], data = [(modTime]
}
file.getParentFile().mkdirs();
return file;
} } |
public class class_name {
public synchronized void removeElement(T element) {
List<T> origList = ref.get().list;
boolean isPresent = origList.contains(element);
if (!isPresent) {
return;
}
List<T> newList = new ArrayList<T>(origList);
newList.remove(element);
swapWithList(newList);
} } | public class class_name {
public synchronized void removeElement(T element) {
List<T> origList = ref.get().list;
boolean isPresent = origList.contains(element);
if (!isPresent) {
return; // depends on control dependency: [if], data = [none]
}
List<T> newList = new ArrayList<T>(origList);
newList.remove(element);
swapWithList(newList);
} } |
public class class_name {
private boolean checkPattern(Mtp2Buffer frame, int sltmLen, byte[] pattern) {
if (sltmLen != pattern.length) {
return false;
}
for (int i = 0; i < pattern.length; i++) {
if (frame.frame[i + PATTERN_OFFSET] != pattern[i]) {
return false;
}
}
return true;
} } | public class class_name {
private boolean checkPattern(Mtp2Buffer frame, int sltmLen, byte[] pattern) {
if (sltmLen != pattern.length) {
return false; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < pattern.length; i++) {
if (frame.frame[i + PATTERN_OFFSET] != pattern[i]) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
protected static DataBuffer createValueBuffer(float[] values) {
checkNotNull(values);
if (values.length == 0){
return Nd4j.createBuffer(1);
}
return Nd4j.createBuffer(values);
} } | public class class_name {
protected static DataBuffer createValueBuffer(float[] values) {
checkNotNull(values);
if (values.length == 0){
return Nd4j.createBuffer(1); // depends on control dependency: [if], data = [none]
}
return Nd4j.createBuffer(values);
} } |
public class class_name {
public static List<CSNodeWrapper> getAllChildrenNodes(final CSNodeWrapper csNode) {
final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>();
if (csNode.getChildren() != null) {
final List<CSNodeWrapper> childrenNodes = csNode.getChildren().getItems();
for (final CSNodeWrapper childNode : childrenNodes) {
nodes.add(childNode);
nodes.addAll(getAllChildrenNodes(childNode));
}
}
return nodes;
} } | public class class_name {
public static List<CSNodeWrapper> getAllChildrenNodes(final CSNodeWrapper csNode) {
final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>();
if (csNode.getChildren() != null) {
final List<CSNodeWrapper> childrenNodes = csNode.getChildren().getItems();
for (final CSNodeWrapper childNode : childrenNodes) {
nodes.add(childNode); // depends on control dependency: [for], data = [childNode]
nodes.addAll(getAllChildrenNodes(childNode)); // depends on control dependency: [for], data = [childNode]
}
}
return nodes;
} } |
public class class_name {
@Override
public Account verify(Credential credential) {
assertMechanism(AuthMechanism.CLIENT_CERT, AuthMechanism.KERBEROS);
final AuthorizingCallbackHandler ach;
final Principal user;
if (credential instanceof X509CertificateCredential) {
X509CertificateCredential certCred = (X509CertificateCredential) credential;
ach = securityRealm.getAuthorizingCallbackHandler(AuthMechanism.CLIENT_CERT);
user = certCred.getCertificate().getSubjectDN();
} else if (credential instanceof GSSContextCredential) {
GSSContextCredential gssCred = (GSSContextCredential) credential;
try {
user = new KerberosPrincipal(gssCred.getGssContext().getSrcName().toString());
} catch (GSSException e) {
// By this point this should not be able to happen.
ROOT_LOGGER.debug("Unexpected authentication failure", e);
return null;
}
ach = securityRealm.getAuthorizingCallbackHandler(AuthMechanism.KERBEROS);
} else {
return null;
}
try {
ach.handle(new Callback[] { new AuthorizeCallback(user.getName(), user.getName()) });
} catch (IOException e) {
ROOT_LOGGER.debug("Unexpected authentication failure", e);
return null;
} catch (UnsupportedCallbackException e) {
ROOT_LOGGER.debug("Unexpected authentication failure", e);
return null;
}
Collection<Principal> userCol = Collections.singleton(user);
SubjectUserInfo supplemental;
try {
supplemental = ach.createSubjectUserInfo(userCol);
} catch (IOException e) {
return null;
}
addInetPrincipal(supplemental.getSubject().getPrincipals());
return new RealmIdentityAccount(supplemental.getSubject(), user);
} } | public class class_name {
@Override
public Account verify(Credential credential) {
assertMechanism(AuthMechanism.CLIENT_CERT, AuthMechanism.KERBEROS);
final AuthorizingCallbackHandler ach;
final Principal user;
if (credential instanceof X509CertificateCredential) {
X509CertificateCredential certCred = (X509CertificateCredential) credential;
ach = securityRealm.getAuthorizingCallbackHandler(AuthMechanism.CLIENT_CERT); // depends on control dependency: [if], data = [none]
user = certCred.getCertificate().getSubjectDN(); // depends on control dependency: [if], data = [none]
} else if (credential instanceof GSSContextCredential) {
GSSContextCredential gssCred = (GSSContextCredential) credential;
try {
user = new KerberosPrincipal(gssCred.getGssContext().getSrcName().toString()); // depends on control dependency: [try], data = [none]
} catch (GSSException e) {
// By this point this should not be able to happen.
ROOT_LOGGER.debug("Unexpected authentication failure", e);
return null;
} // depends on control dependency: [catch], data = [none]
ach = securityRealm.getAuthorizingCallbackHandler(AuthMechanism.KERBEROS); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
try {
ach.handle(new Callback[] { new AuthorizeCallback(user.getName(), user.getName()) }); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
ROOT_LOGGER.debug("Unexpected authentication failure", e);
return null;
} catch (UnsupportedCallbackException e) { // depends on control dependency: [catch], data = [none]
ROOT_LOGGER.debug("Unexpected authentication failure", e);
return null;
} // depends on control dependency: [catch], data = [none]
Collection<Principal> userCol = Collections.singleton(user);
SubjectUserInfo supplemental;
try {
supplemental = ach.createSubjectUserInfo(userCol); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return null;
} // depends on control dependency: [catch], data = [none]
addInetPrincipal(supplemental.getSubject().getPrincipals());
return new RealmIdentityAccount(supplemental.getSubject(), user);
} } |
public class class_name {
public void open() {
acquireWriteLock();
try {
if (!Files.exists(osFile)) {
throw new FileNotFoundException("File: " + osFile);
}
acquireExclusiveAccess();
openChannel();
init();
OLogManager.instance().debug(this, "Checking file integrity of " + osFile.getFileName() + "...");
if (version < CURRENT_VERSION) {
setVersion(CURRENT_VERSION);
version = CURRENT_VERSION;
}
initAllocationMode();
} catch (final IOException e) {
throw OException.wrapException(new OIOException("Error during file open"), e);
} finally {
releaseWriteLock();
}
} } | public class class_name {
public void open() {
acquireWriteLock();
try {
if (!Files.exists(osFile)) {
throw new FileNotFoundException("File: " + osFile);
}
acquireExclusiveAccess(); // depends on control dependency: [try], data = [none]
openChannel(); // depends on control dependency: [try], data = [none]
init(); // depends on control dependency: [try], data = [none]
OLogManager.instance().debug(this, "Checking file integrity of " + osFile.getFileName() + "..."); // depends on control dependency: [try], data = [none]
if (version < CURRENT_VERSION) {
setVersion(CURRENT_VERSION); // depends on control dependency: [if], data = [CURRENT_VERSION)]
version = CURRENT_VERSION; // depends on control dependency: [if], data = [none]
}
initAllocationMode(); // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
throw OException.wrapException(new OIOException("Error during file open"), e);
} finally { // depends on control dependency: [catch], data = [none]
releaseWriteLock();
}
} } |
public class class_name {
public void addListeners()
{
super.addListeners();
Record record = this.getMainRecord();
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
if (recClassInfo != null)
{
record.setKeyArea(FieldData.FIELD_FILE_NAME_KEY);
SubFileFilter listener = new SubFileFilter(recClassInfo.getField(ClassInfo.CLASS_NAME), FieldData.FIELD_FILE_NAME, null, null, null, null, true);
record.addListener(listener);
recClassInfo.getField(ClassInfo.CLASS_NAME).addListener(new FieldReSelectHandler(this));
}
} } | public class class_name {
public void addListeners()
{
super.addListeners();
Record record = this.getMainRecord();
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
if (recClassInfo != null)
{
record.setKeyArea(FieldData.FIELD_FILE_NAME_KEY); // depends on control dependency: [if], data = [none]
SubFileFilter listener = new SubFileFilter(recClassInfo.getField(ClassInfo.CLASS_NAME), FieldData.FIELD_FILE_NAME, null, null, null, null, true);
record.addListener(listener); // depends on control dependency: [if], data = [none]
recClassInfo.getField(ClassInfo.CLASS_NAME).addListener(new FieldReSelectHandler(this)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException
{
RendererUtils.checkParamValidity(facesContext, component, null);
Map<String, List<ClientBehavior>> behaviors = null;
if (component instanceof ClientBehaviorHolder)
{
behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
if (!behaviors.isEmpty())
{
ResourceUtils.renderDefaultJsfJsInlineIfNecessary(
facesContext, facesContext.getResponseWriter());
}
}
if (component instanceof UISelectMany)
{
renderMenu(facesContext,
(UISelectMany)component,
isDisabled(facesContext, component),
getConverter(facesContext, component));
}
else if (component instanceof UISelectOne)
{
renderMenu(facesContext,
(UISelectOne)component,
isDisabled(facesContext, component),
getConverter(facesContext, component));
}
else
{
throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
}
} } | public class class_name {
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException
{
RendererUtils.checkParamValidity(facesContext, component, null);
Map<String, List<ClientBehavior>> behaviors = null;
if (component instanceof ClientBehaviorHolder)
{
behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
if (!behaviors.isEmpty())
{
ResourceUtils.renderDefaultJsfJsInlineIfNecessary(
facesContext, facesContext.getResponseWriter()); // depends on control dependency: [if], data = [none]
}
}
if (component instanceof UISelectMany)
{
renderMenu(facesContext,
(UISelectMany)component,
isDisabled(facesContext, component),
getConverter(facesContext, component));
}
else if (component instanceof UISelectOne)
{
renderMenu(facesContext,
(UISelectOne)component,
isDisabled(facesContext, component),
getConverter(facesContext, component));
}
else
{
throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
}
} } |
public class class_name {
@Override
public List<EnhanceEntity> populateRelation(EntityMetadata m, Client client, int maxResults)
{
if (log.isInfoEnabled())
{
log.info("On populate relation via JPQL");
}
List<EnhanceEntity> ls = null;
List<String> relationNames = m.getRelationNames();
boolean isParent = m.isParent();
boolean isRowKeyQuery = conditions != null ? conditions.keySet().iterator().next() : false;
// If Query is not for find by range.
if (!isRowKeyQuery)
{
// If holding associations.
if (!isParent)
{
// In case need to use secondary indexes.
if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata()))
{
ls = ((CassandraClientBase) client).find(m, relationNames, this.conditions.get(isRowKeyQuery),
maxResults, null);
}
else
{
// prepare lucene query and find.
Set<String> rSet = fetchDataFromLucene(m.getEntityClazz(), client);
try
{
ls = (List<EnhanceEntity>) ((CassandraClientBase) client).find(m.getEntityClazz(),
relationNames, true, m, rSet.toArray(new Object[] {}));
}
catch (Exception e)
{
log.error("Error while executing handleAssociation for cassandra, Caused by: ", e);
throw new QueryHandlerException(e);
}
}
}
else
{
if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata()))
{
// in case need to search on secondry columns and it is not
// set
// to true!
ls = ((CassandraClientBase) client).find(this.conditions.get(isRowKeyQuery), m, true,
m.getRelationNames(), maxResults, null);
}
else
{
ls = onAssociationUsingLucene(m, client, ls);
}
}
}
else
{
ls = handleFindByRange(m, client, ls, conditions, isRowKeyQuery, null, maxResults);
}
return ls;
} } | public class class_name {
@Override
public List<EnhanceEntity> populateRelation(EntityMetadata m, Client client, int maxResults)
{
if (log.isInfoEnabled())
{
log.info("On populate relation via JPQL"); // depends on control dependency: [if], data = [none]
}
List<EnhanceEntity> ls = null;
List<String> relationNames = m.getRelationNames();
boolean isParent = m.isParent();
boolean isRowKeyQuery = conditions != null ? conditions.keySet().iterator().next() : false;
// If Query is not for find by range.
if (!isRowKeyQuery)
{
// If holding associations.
if (!isParent)
{
// In case need to use secondary indexes.
if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata()))
{
ls = ((CassandraClientBase) client).find(m, relationNames, this.conditions.get(isRowKeyQuery),
maxResults, null); // depends on control dependency: [if], data = [none]
}
else
{
// prepare lucene query and find.
Set<String> rSet = fetchDataFromLucene(m.getEntityClazz(), client);
try
{
ls = (List<EnhanceEntity>) ((CassandraClientBase) client).find(m.getEntityClazz(),
relationNames, true, m, rSet.toArray(new Object[] {})); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.error("Error while executing handleAssociation for cassandra, Caused by: ", e);
throw new QueryHandlerException(e);
} // depends on control dependency: [catch], data = [none]
}
}
else
{
if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata()))
{
// in case need to search on secondry columns and it is not
// set
// to true!
ls = ((CassandraClientBase) client).find(this.conditions.get(isRowKeyQuery), m, true,
m.getRelationNames(), maxResults, null); // depends on control dependency: [if], data = [none]
}
else
{
ls = onAssociationUsingLucene(m, client, ls); // depends on control dependency: [if], data = [none]
}
}
}
else
{
ls = handleFindByRange(m, client, ls, conditions, isRowKeyQuery, null, maxResults); // depends on control dependency: [if], data = [none]
}
return ls;
} } |
public class class_name {
public void createObjectPool(final ServiceID serviceID, final SbbComponent sbbComponent,
final SleeTransactionManager sleeTransactionManager) {
if (logger.isTraceEnabled()) {
logger.trace("Creating Pool for " + serviceID +" and "+ sbbComponent);
}
createObjectPool(serviceID,sbbComponent);
if (sleeTransactionManager != null && sleeTransactionManager.getTransactionContext() != null) {
// add a rollback action to remove sbb object pool
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isDebugEnabled()) {
logger
.debug("Due to tx rollback, removing pool for " + serviceID +" and "+ sbbComponent);
}
try {
removeObjectPool(serviceID,sbbComponent.getSbbID());
} catch (Throwable e) {
logger.error("Failed to remove " + serviceID +" and "+ sbbComponent + " object pool", e);
}
}
};
sleeTransactionManager.getTransactionContext().getAfterRollbackActions().add(action);
}
} } | public class class_name {
public void createObjectPool(final ServiceID serviceID, final SbbComponent sbbComponent,
final SleeTransactionManager sleeTransactionManager) {
if (logger.isTraceEnabled()) {
logger.trace("Creating Pool for " + serviceID +" and "+ sbbComponent); // depends on control dependency: [if], data = [none]
}
createObjectPool(serviceID,sbbComponent);
if (sleeTransactionManager != null && sleeTransactionManager.getTransactionContext() != null) {
// add a rollback action to remove sbb object pool
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isDebugEnabled()) {
logger
.debug("Due to tx rollback, removing pool for " + serviceID +" and "+ sbbComponent); // depends on control dependency: [if], data = [none]
}
try {
removeObjectPool(serviceID,sbbComponent.getSbbID()); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logger.error("Failed to remove " + serviceID +" and "+ sbbComponent + " object pool", e);
} // depends on control dependency: [catch], data = [none]
}
};
sleeTransactionManager.getTransactionContext().getAfterRollbackActions().add(action); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("static-method")
protected void printDetailedDescription(SynopsisHelpAppender out, String detailedDescription) {
if (!Strings.isNullOrEmpty(detailedDescription)) {
out.printSectionName(DETAILED_DESCRIPTION);
out.printLongDescription(detailedDescription.split("[\r\n\f]+")); //$NON-NLS-1$
}
} } | public class class_name {
@SuppressWarnings("static-method")
protected void printDetailedDescription(SynopsisHelpAppender out, String detailedDescription) {
if (!Strings.isNullOrEmpty(detailedDescription)) {
out.printSectionName(DETAILED_DESCRIPTION); // depends on control dependency: [if], data = [none]
out.printLongDescription(detailedDescription.split("[\r\n\f]+")); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.