code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static boolean areStringEquals(String string1, String string2) { /* string1 string2 outcome * null null true * null x false * x null false * x y false * x x true */ // XXX both null must be unequal? If yes, boolean must be too? if (string1 == null && string2 == null) { return false; } else if (string1 != null && !string1.equals(string2)) { return false; } else if (string2 != null && !string2.equals(string1)) { return false; } return true; } }
public class class_name { public static boolean areStringEquals(String string1, String string2) { /* string1 string2 outcome * null null true * null x false * x null false * x y false * x x true */ // XXX both null must be unequal? If yes, boolean must be too? if (string1 == null && string2 == null) { return false; // depends on control dependency: [if], data = [none] } else if (string1 != null && !string1.equals(string2)) { return false; // depends on control dependency: [if], data = [none] } else if (string2 != null && !string2.equals(string1)) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static boolean isValid(ClassLoader classLoader, String className, int methodId, int continuationPointId) { if (className == null) { throw new NullPointerException(); } if (continuationPointId < 0) { throw new IllegalArgumentException(); } Class cls = null; if (classLoader == null) { // Try to find the class from this object's classloader try { cls = MethodState.class.getClassLoader().loadClass(className); } catch (ClassNotFoundException cnfe) { // do nothing } // Try to find the class from this Thread's classloader if (cls == null) { try { cls = Thread.currentThread().getContextClassLoader().loadClass(className); } catch (ClassNotFoundException cnfe) { // do nothing } } } else { // Try to find the class the classloader provided try { cls = classLoader.loadClass(className); } catch (ClassNotFoundException cnfe) { // do nothing } } if (cls == null) { throw new IllegalStateException("Class this state is being deserialized for is missing: " + className); } String versionField = getIdentifyingFieldName(methodId, continuationPointId); try { cls.getDeclaredField(versionField); } catch (NoSuchFieldException nsfe) { return false; } return true; } }
public class class_name { public static boolean isValid(ClassLoader classLoader, String className, int methodId, int continuationPointId) { if (className == null) { throw new NullPointerException(); } if (continuationPointId < 0) { throw new IllegalArgumentException(); } Class cls = null; if (classLoader == null) { // Try to find the class from this object's classloader try { cls = MethodState.class.getClassLoader().loadClass(className); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { // do nothing } // depends on control dependency: [catch], data = [none] // Try to find the class from this Thread's classloader if (cls == null) { try { cls = Thread.currentThread().getContextClassLoader().loadClass(className); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { // do nothing } // depends on control dependency: [catch], data = [none] } } else { // Try to find the class the classloader provided try { cls = classLoader.loadClass(className); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { // do nothing } // depends on control dependency: [catch], data = [none] } if (cls == null) { throw new IllegalStateException("Class this state is being deserialized for is missing: " + className); } String versionField = getIdentifyingFieldName(methodId, continuationPointId); try { cls.getDeclaredField(versionField); // depends on control dependency: [try], data = [none] } catch (NoSuchFieldException nsfe) { return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { private void scanFraction(int pos) { skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); } int sp1 = reader.sp; if (reader.ch == 'e' || reader.ch == 'E') { reader.putChar(true); skipIllegalUnderscores(); if (reader.ch == '+' || reader.ch == '-') { reader.putChar(true); } skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); return; } lexError(pos, "malformed.fp.lit"); reader.sp = sp1; } } }
public class class_name { private void scanFraction(int pos) { skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); // depends on control dependency: [if], data = [none] } int sp1 = reader.sp; if (reader.ch == 'e' || reader.ch == 'E') { reader.putChar(true); // depends on control dependency: [if], data = [none] skipIllegalUnderscores(); // depends on control dependency: [if], data = [none] if (reader.ch == '+' || reader.ch == '-') { reader.putChar(true); // depends on control dependency: [if], data = [none] } skipIllegalUnderscores(); // depends on control dependency: [if], data = [none] if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } lexError(pos, "malformed.fp.lit"); reader.sp = sp1; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean skipOneLine() { if (!undecodedChunk.isReadable()) { return false; } byte nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { if (!undecodedChunk.isReadable()) { undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1); return false; } nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.LF) { return true; } undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2); return false; } if (nextByte == HttpConstants.LF) { return true; } undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1); return false; } }
public class class_name { private boolean skipOneLine() { if (!undecodedChunk.isReadable()) { return false; // depends on control dependency: [if], data = [none] } byte nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { if (!undecodedChunk.isReadable()) { undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } nextByte = undecodedChunk.readByte(); // depends on control dependency: [if], data = [none] if (nextByte == HttpConstants.LF) { return true; // depends on control dependency: [if], data = [none] } undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (nextByte == HttpConstants.LF) { return true; // depends on control dependency: [if], data = [none] } undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1); return false; } }
public class class_name { protected synchronized ManagedObject setManagedObject(ManagedObject managedObject) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "setManagedObject" + "managedObject=" + managedObject + "(ManagedObject)" + toString() ); ManagedObject managedObjectSet; // For return. // Has any ManagedObject ever been associated with tis Token? if (managedObjectReference == null) { // Nothing currently known so use the version given. managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); managedObjectSet = managedObject; } else { ManagedObject existingManagedObject = (ManagedObject) managedObjectReference.get(); if (existingManagedObject == null) { // Is it still accessible? managedObject.owningToken = this; // PM22584 Set the owning token first managedObjectReference = new java.lang.ref.WeakReference(managedObject); managedObjectSet = managedObject; } else { // In memory and accessible. // During recovery another object already recovered may have refered // to this one causing it to already be resident in memory. // Replace what we already have with this version. existingManagedObject.becomeCloneOf(managedObject); managedObjectSet = existingManagedObject; } // if (existingManagedObject == null). } // if(managedObjectReference == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "setManagedObject" , new Object[] { managedObjectSet }); return managedObjectSet; } }
public class class_name { protected synchronized ManagedObject setManagedObject(ManagedObject managedObject) throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass , "setManagedObject" + "managedObject=" + managedObject + "(ManagedObject)" + toString() ); ManagedObject managedObjectSet; // For return. // Has any ManagedObject ever been associated with tis Token? if (managedObjectReference == null) { // Nothing currently known so use the version given. managedObject.owningToken = this; // PM22584 Set the owning token first // depends on control dependency: [if], data = [none] managedObjectReference = new java.lang.ref.WeakReference(managedObject); // depends on control dependency: [if], data = [none] managedObjectSet = managedObject; // depends on control dependency: [if], data = [none] } else { ManagedObject existingManagedObject = (ManagedObject) managedObjectReference.get(); if (existingManagedObject == null) { // Is it still accessible? managedObject.owningToken = this; // PM22584 Set the owning token first // depends on control dependency: [if], data = [none] managedObjectReference = new java.lang.ref.WeakReference(managedObject); // depends on control dependency: [if], data = [none] managedObjectSet = managedObject; // depends on control dependency: [if], data = [none] } else { // In memory and accessible. // During recovery another object already recovered may have refered // to this one causing it to already be resident in memory. // Replace what we already have with this version. existingManagedObject.becomeCloneOf(managedObject); // depends on control dependency: [if], data = [none] managedObjectSet = existingManagedObject; // depends on control dependency: [if], data = [none] } // if (existingManagedObject == null). } // if(managedObjectReference == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass , "setManagedObject" , new Object[] { managedObjectSet }); return managedObjectSet; } }
public class class_name { public String getRequestID() { if(requestID == null) { requestID = UUID.randomUUID().toString().replace("-", ""); } return requestID; } }
public class class_name { public String getRequestID() { if(requestID == null) { requestID = UUID.randomUUID().toString().replace("-", ""); // depends on control dependency: [if], data = [none] } return requestID; } }
public class class_name { private static JSONObject createJSONObject(final Logger.LEVEL level, final String pkg, final String message, long timestamp, final JSONObject jsonMetadata, final Throwable t) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put ("timestamp", timestamp); jsonObject.put ("level", level.toString()); jsonObject.put ("pkg", pkg); jsonObject.put ("msg", message); jsonObject.put ("threadid", Thread.currentThread ().getId()); if (null != jsonMetadata) { jsonObject.put ("metadata", jsonMetadata); } if (null != t) { jsonObject.put ("metadata", appendFullStackTrace(jsonMetadata, t)); } } catch (JSONException e) { Log.e(LOG_TAG_NAME, "Error adding JSONObject key/value pairs", e); } return jsonObject; } }
public class class_name { private static JSONObject createJSONObject(final Logger.LEVEL level, final String pkg, final String message, long timestamp, final JSONObject jsonMetadata, final Throwable t) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put ("timestamp", timestamp); // depends on control dependency: [try], data = [none] jsonObject.put ("level", level.toString()); // depends on control dependency: [try], data = [none] jsonObject.put ("pkg", pkg); // depends on control dependency: [try], data = [none] jsonObject.put ("msg", message); // depends on control dependency: [try], data = [none] jsonObject.put ("threadid", Thread.currentThread ().getId()); // depends on control dependency: [try], data = [none] if (null != jsonMetadata) { jsonObject.put ("metadata", jsonMetadata); // depends on control dependency: [if], data = [jsonMetadata)] } if (null != t) { jsonObject.put ("metadata", appendFullStackTrace(jsonMetadata, t)); // depends on control dependency: [if], data = [t)] } } catch (JSONException e) { Log.e(LOG_TAG_NAME, "Error adding JSONObject key/value pairs", e); } // depends on control dependency: [catch], data = [none] return jsonObject; } }
public class class_name { @Override public void validate(Class<?> clazz) { if (log.isDebugEnabled()) log.debug("Validating " + clazz.getName()); // Is Entity? if (!checkValidClass(clazz)) { throw new RuleValidationException(clazz.getName() + " is not a valid jpa entity."); } // must have a default no-argument constructor boolean flag = false; try { Constructor[] constructors = clazz.getDeclaredConstructors(); for (Constructor constructor : constructors) { if ((Modifier.isPublic(constructor.getModifiers()) || Modifier.isProtected(constructor.getModifiers())) && constructor.getParameterTypes().length == 0) { flag = true; break; } } if (!flag) { throw new Exception(); } } catch (Exception e) { throw new RuleValidationException(clazz.getName() + " must have a default public or protected no-argument constructor."); } } }
public class class_name { @Override public void validate(Class<?> clazz) { if (log.isDebugEnabled()) log.debug("Validating " + clazz.getName()); // Is Entity? if (!checkValidClass(clazz)) { throw new RuleValidationException(clazz.getName() + " is not a valid jpa entity."); } // must have a default no-argument constructor boolean flag = false; try { Constructor[] constructors = clazz.getDeclaredConstructors(); for (Constructor constructor : constructors) { if ((Modifier.isPublic(constructor.getModifiers()) || Modifier.isProtected(constructor.getModifiers())) && constructor.getParameterTypes().length == 0) { flag = true; // depends on control dependency: [if], data = [none] break; } } if (!flag) { throw new Exception(); } } catch (Exception e) { throw new RuleValidationException(clazz.getName() + " must have a default public or protected no-argument constructor."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String runContainer(DockerSlaveTemplate slaveTemplate) throws DockerException, IOException { final DockerCreateContainer dockerCreateContainer = slaveTemplate.getDockerContainerLifecycle().getCreateContainer(); final String image = slaveTemplate.getDockerContainerLifecycle().getImage(); CreateContainerCmd containerConfig = getClient().createContainerCmd(image); // template specific options dockerCreateContainer.fillContainerConfig(containerConfig, null); // launcher specific options slaveTemplate.getLauncher().appendContainerConfig(slaveTemplate, containerConfig); // cloud specific options appendContainerConfig(slaveTemplate, containerConfig); // create CreateContainerResponse response = containerConfig.exec(); String containerId = response.getId(); LOG.debug("Created container {}, for {}", containerId, getDisplayName()); slaveTemplate.getLauncher().afterContainerCreate(getClient(), containerId); // start StartContainerCmd startCommand = getClient().startContainerCmd(containerId); try { startCommand.exec(); LOG.debug("Running container {}, for {}", containerId, getDisplayName()); } catch (Exception ex) { try { getClient().logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .exec(new MyLogContainerResultCallback()) .awaitCompletion(); } catch (Throwable t) { LOG.warn("Can't get logs for container start", t); } throw ex; } return containerId; } }
public class class_name { public String runContainer(DockerSlaveTemplate slaveTemplate) throws DockerException, IOException { final DockerCreateContainer dockerCreateContainer = slaveTemplate.getDockerContainerLifecycle().getCreateContainer(); final String image = slaveTemplate.getDockerContainerLifecycle().getImage(); CreateContainerCmd containerConfig = getClient().createContainerCmd(image); // template specific options dockerCreateContainer.fillContainerConfig(containerConfig, null); // launcher specific options slaveTemplate.getLauncher().appendContainerConfig(slaveTemplate, containerConfig); // cloud specific options appendContainerConfig(slaveTemplate, containerConfig); // create CreateContainerResponse response = containerConfig.exec(); String containerId = response.getId(); LOG.debug("Created container {}, for {}", containerId, getDisplayName()); slaveTemplate.getLauncher().afterContainerCreate(getClient(), containerId); // start StartContainerCmd startCommand = getClient().startContainerCmd(containerId); try { startCommand.exec(); LOG.debug("Running container {}, for {}", containerId, getDisplayName()); } catch (Exception ex) { try { getClient().logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .exec(new MyLogContainerResultCallback()) .awaitCompletion(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { LOG.warn("Can't get logs for container start", t); } // depends on control dependency: [catch], data = [none] throw ex; } return containerId; } }
public class class_name { @SuppressWarnings("deprecation") public /*abstract*/ void parseAssociatedNames(Item item, Collection<GitHubRepositoryName> result) { if (Util.isOverridden( GitHubRepositoryNameContributor.class, getClass(), "parseAssociatedNames", Job.class, Collection.class )) { // if this impl is legacy, it cannot contribute to non-jobs, so not an error if (item instanceof Job) { parseAssociatedNames((Job<?, ?>) item, result); } } else if (Util.isOverridden( GitHubRepositoryNameContributor.class, getClass(), "parseAssociatedNames", AbstractProject.class, Collection.class )) { // if this impl is legacy, it cannot contribute to non-projects, so not an error if (item instanceof AbstractProject) { parseAssociatedNames((AbstractProject<?, ?>) item, result); } } else { throw new AbstractMethodError("you must override the new overload of parseAssociatedNames"); } } }
public class class_name { @SuppressWarnings("deprecation") public /*abstract*/ void parseAssociatedNames(Item item, Collection<GitHubRepositoryName> result) { if (Util.isOverridden( GitHubRepositoryNameContributor.class, getClass(), "parseAssociatedNames", Job.class, Collection.class )) { // if this impl is legacy, it cannot contribute to non-jobs, so not an error if (item instanceof Job) { parseAssociatedNames((Job<?, ?>) item, result); // depends on control dependency: [if], data = [none] } } else if (Util.isOverridden( GitHubRepositoryNameContributor.class, getClass(), "parseAssociatedNames", AbstractProject.class, Collection.class )) { // if this impl is legacy, it cannot contribute to non-projects, so not an error if (item instanceof AbstractProject) { parseAssociatedNames((AbstractProject<?, ?>) item, result); // depends on control dependency: [if], data = [none] } } else { throw new AbstractMethodError("you must override the new overload of parseAssociatedNames"); } } }
public class class_name { public static String getDurationFormattedString(final long startMillis, final long endMillis, final VaadinMessageSource i18N) { final String formatDuration = DurationFormatUtils.formatPeriod(startMillis, endMillis, DURATION_FORMAT, false, getBrowserTimeZone()); final StringBuilder formattedDuration = new StringBuilder(); final String[] split = formatDuration.split(","); for (int index = 0; index < split.length; index++) { if (index != 0 && formattedDuration.length() > 0) { formattedDuration.append(' '); } final int value = Integer.parseInt(split[index]); if (value != 0) { final String suffix = (value == 1) ? i18N.getMessage(DURATION_I18N.get(index).getSingle()) : i18N.getMessage(DURATION_I18N.get(index).getPlural()); formattedDuration.append(value).append(' ').append(suffix); } } return formattedDuration.toString(); } }
public class class_name { public static String getDurationFormattedString(final long startMillis, final long endMillis, final VaadinMessageSource i18N) { final String formatDuration = DurationFormatUtils.formatPeriod(startMillis, endMillis, DURATION_FORMAT, false, getBrowserTimeZone()); final StringBuilder formattedDuration = new StringBuilder(); final String[] split = formatDuration.split(","); for (int index = 0; index < split.length; index++) { if (index != 0 && formattedDuration.length() > 0) { formattedDuration.append(' '); // depends on control dependency: [if], data = [none] } final int value = Integer.parseInt(split[index]); if (value != 0) { final String suffix = (value == 1) ? i18N.getMessage(DURATION_I18N.get(index).getSingle()) : i18N.getMessage(DURATION_I18N.get(index).getPlural()); formattedDuration.append(value).append(' ').append(suffix); // depends on control dependency: [if], data = [(value] } } return formattedDuration.toString(); } }
public class class_name { public static String decodeHtml(String s) { int firstAmp = s.indexOf('&'); int safeLimit = longestPrefixOfGoodCodeunits(s); if ((firstAmp & safeLimit) < 0) { return s; } StringBuilder sb; { int n = s.length(); sb = new StringBuilder(n); int pos = 0; int amp = firstAmp; while (amp >= 0) { long endAndCodepoint = HtmlEntities.decodeEntityAt(s, amp, n); int end = (int) (endAndCodepoint >>> 32); int codepoint = (int) endAndCodepoint; sb.append(s, pos, amp).appendCodePoint(codepoint); pos = end; amp = s.indexOf('&', end); } sb.append(s, pos, n); } stripBannedCodeunits( sb, firstAmp < 0 ? safeLimit : safeLimit < 0 ? firstAmp : Math.min(firstAmp, safeLimit)); return sb.toString(); } }
public class class_name { public static String decodeHtml(String s) { int firstAmp = s.indexOf('&'); int safeLimit = longestPrefixOfGoodCodeunits(s); if ((firstAmp & safeLimit) < 0) { return s; } // depends on control dependency: [if], data = [none] StringBuilder sb; { int n = s.length(); sb = new StringBuilder(n); int pos = 0; int amp = firstAmp; while (amp >= 0) { long endAndCodepoint = HtmlEntities.decodeEntityAt(s, amp, n); int end = (int) (endAndCodepoint >>> 32); int codepoint = (int) endAndCodepoint; sb.append(s, pos, amp).appendCodePoint(codepoint); // depends on control dependency: [while], data = [none] pos = end; // depends on control dependency: [while], data = [none] amp = s.indexOf('&', end); // depends on control dependency: [while], data = [none] } sb.append(s, pos, n); } stripBannedCodeunits( sb, firstAmp < 0 ? safeLimit : safeLimit < 0 ? firstAmp : Math.min(firstAmp, safeLimit)); return sb.toString(); } }
public class class_name { public DescribeMatchmakingRequest withTicketIds(String... ticketIds) { if (this.ticketIds == null) { setTicketIds(new java.util.ArrayList<String>(ticketIds.length)); } for (String ele : ticketIds) { this.ticketIds.add(ele); } return this; } }
public class class_name { public DescribeMatchmakingRequest withTicketIds(String... ticketIds) { if (this.ticketIds == null) { setTicketIds(new java.util.ArrayList<String>(ticketIds.length)); // depends on control dependency: [if], data = [none] } for (String ele : ticketIds) { this.ticketIds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public ImmutableList<TargetAtom> getCQ(DatabaseRelationDefinition table) { ImmutableList.Builder<TargetAtom> atoms = ImmutableList.builder(); //Class Atom ImmutableTerm sub = generateSubject(table, false); atoms.add(getAtom(getTableIRI(table.getID()), sub)); //DataType Atoms for (Attribute att : table.getAttributes()) { // TODO: revisit this RDFDatatype type = (RDFDatatype) att.getTermType(); Variable objV = termFactory.getVariable(att.getID().getName()); ImmutableTerm obj = termFactory.getImmutableTypedTerm(objV, type); atoms.add(getAtom(getLiteralPropertyIRI(att), sub, obj)); } return atoms.build(); } }
public class class_name { public ImmutableList<TargetAtom> getCQ(DatabaseRelationDefinition table) { ImmutableList.Builder<TargetAtom> atoms = ImmutableList.builder(); //Class Atom ImmutableTerm sub = generateSubject(table, false); atoms.add(getAtom(getTableIRI(table.getID()), sub)); //DataType Atoms for (Attribute att : table.getAttributes()) { // TODO: revisit this RDFDatatype type = (RDFDatatype) att.getTermType(); Variable objV = termFactory.getVariable(att.getID().getName()); ImmutableTerm obj = termFactory.getImmutableTypedTerm(objV, type); atoms.add(getAtom(getLiteralPropertyIRI(att), sub, obj)); // depends on control dependency: [for], data = [att] } return atoms.build(); } }
public class class_name { public static IAtomContainerSet getAllProducts(IReaction reaction) { IAtomContainerSet moleculeSet = reaction.getBuilder().newInstance(IAtomContainerSet.class); IAtomContainerSet products = reaction.getProducts(); for (int i = 0; i < products.getAtomContainerCount(); i++) { moleculeSet.addAtomContainer(products.getAtomContainer(i)); } return moleculeSet; } }
public class class_name { public static IAtomContainerSet getAllProducts(IReaction reaction) { IAtomContainerSet moleculeSet = reaction.getBuilder().newInstance(IAtomContainerSet.class); IAtomContainerSet products = reaction.getProducts(); for (int i = 0; i < products.getAtomContainerCount(); i++) { moleculeSet.addAtomContainer(products.getAtomContainer(i)); // depends on control dependency: [for], data = [i] } return moleculeSet; } }
public class class_name { Zxid getSnapshotZxid() { File snapshot = getSnapshotFile(); if (snapshot == null) { return Zxid.ZXID_NOT_EXIST; } String fileName = snapshot.getName(); String strZxid = fileName.substring(fileName.indexOf('.') + 1); return Zxid.fromSimpleString(strZxid); } }
public class class_name { Zxid getSnapshotZxid() { File snapshot = getSnapshotFile(); if (snapshot == null) { return Zxid.ZXID_NOT_EXIST; // depends on control dependency: [if], data = [none] } String fileName = snapshot.getName(); String strZxid = fileName.substring(fileName.indexOf('.') + 1); return Zxid.fromSimpleString(strZxid); } }
public class class_name { @GuardedBy("lock") private Request findOverlappingRequest(Request request) { Map.Entry<Long, Request> previousEntry = this.pendingRequests.floorEntry(request.getOffset()); if (previousEntry != null && request.getOffset() < previousEntry.getValue().getEndOffset()) { // Found one. return previousEntry.getValue(); } // Either no previous entry, or the highest previous entry does not overlap. return null; } }
public class class_name { @GuardedBy("lock") private Request findOverlappingRequest(Request request) { Map.Entry<Long, Request> previousEntry = this.pendingRequests.floorEntry(request.getOffset()); if (previousEntry != null && request.getOffset() < previousEntry.getValue().getEndOffset()) { // Found one. return previousEntry.getValue(); // depends on control dependency: [if], data = [none] } // Either no previous entry, or the highest previous entry does not overlap. return null; } }
public class class_name { public static int mapPointRound(float x, float sourceStart, float sourceEnd, int targetStart, int targetEnd) { if (x <= sourceStart) { return targetStart; } if (x >= sourceEnd) { return targetEnd; } float fRes = (x - sourceStart) / (sourceEnd - sourceStart) * (targetEnd - targetStart) + targetStart; return (int) (fRes + 0.5f); } }
public class class_name { public static int mapPointRound(float x, float sourceStart, float sourceEnd, int targetStart, int targetEnd) { if (x <= sourceStart) { return targetStart; // depends on control dependency: [if], data = [none] } if (x >= sourceEnd) { return targetEnd; // depends on control dependency: [if], data = [none] } float fRes = (x - sourceStart) / (sourceEnd - sourceStart) * (targetEnd - targetStart) + targetStart; return (int) (fRes + 0.5f); } }
public class class_name { public File getDirectory(String sPath) { File directory = new File(sPath); if (!directory.isDirectory()) { URL resource = FilterFileManager.class.getClassLoader().getResource(sPath); try { directory = new File(resource.toURI()); } catch (Exception e) { LOG.error("Error accessing directory in classloader. path=" + sPath, e); } if (!directory.isDirectory()) { throw new RuntimeException(directory.getAbsolutePath() + " is not a valid directory"); } } return directory; } }
public class class_name { public File getDirectory(String sPath) { File directory = new File(sPath); if (!directory.isDirectory()) { URL resource = FilterFileManager.class.getClassLoader().getResource(sPath); try { directory = new File(resource.toURI()); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("Error accessing directory in classloader. path=" + sPath, e); } // depends on control dependency: [catch], data = [none] if (!directory.isDirectory()) { throw new RuntimeException(directory.getAbsolutePath() + " is not a valid directory"); } } return directory; } }
public class class_name { private void addExtraClasses(final InMemoryJarfile jarOutput) throws VoltCompilerException { List<String> addedClasses = new ArrayList<>(); for (String className : m_addedClasses) { /* * Only add the class if it isn't already in the output jar. * The jar will be pre-populated when performing an automatic * catalog version upgrade. */ if (!jarOutput.containsKey(className)) { try { Class<?> clz = Class.forName(className, true, m_classLoader); if (addClassToJar(jarOutput, clz)) { addedClasses.add(className); } } catch (Exception e) { String msg = "Class %s could not be loaded/found/added to the jar."; msg = String.format(msg, className); throw new VoltCompilerException(msg); } // reset the added classes to the actual added classes } } m_addedClasses = addedClasses.toArray(new String[0]); } }
public class class_name { private void addExtraClasses(final InMemoryJarfile jarOutput) throws VoltCompilerException { List<String> addedClasses = new ArrayList<>(); for (String className : m_addedClasses) { /* * Only add the class if it isn't already in the output jar. * The jar will be pre-populated when performing an automatic * catalog version upgrade. */ if (!jarOutput.containsKey(className)) { try { Class<?> clz = Class.forName(className, true, m_classLoader); if (addClassToJar(jarOutput, clz)) { addedClasses.add(className); // depends on control dependency: [if], data = [none] } } catch (Exception e) { String msg = "Class %s could not be loaded/found/added to the jar."; msg = String.format(msg, className); throw new VoltCompilerException(msg); } // depends on control dependency: [catch], data = [none] // reset the added classes to the actual added classes } } m_addedClasses = addedClasses.toArray(new String[0]); } }
public class class_name { public void marshall(HyperParameterTuningJobObjective hyperParameterTuningJobObjective, ProtocolMarshaller protocolMarshaller) { if (hyperParameterTuningJobObjective == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hyperParameterTuningJobObjective.getType(), TYPE_BINDING); protocolMarshaller.marshall(hyperParameterTuningJobObjective.getMetricName(), METRICNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(HyperParameterTuningJobObjective hyperParameterTuningJobObjective, ProtocolMarshaller protocolMarshaller) { if (hyperParameterTuningJobObjective == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hyperParameterTuningJobObjective.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hyperParameterTuningJobObjective.getMetricName(), METRICNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean init(JobHistoryObserver jobTracker, JobConf conf, String hostname, long jobTrackerStartTime){ try { LOG_DIR = conf.get("hadoop.job.history.location" , "file:///" + new File( System.getProperty("hadoop.log.dir", "/tmp")).getAbsolutePath() + File.separator + "history"); JOBTRACKER_UNIQUE_STRING = hostname + "_" + String.valueOf(jobTrackerStartTime) + "_"; jobtrackerHostname = hostname; Path logDir = new Path(LOG_DIR); LOGDIR_FS = logDir.getFileSystem(conf); if (!LOGDIR_FS.exists(logDir)){ if (!LOGDIR_FS.mkdirs(logDir, new FsPermission(HISTORY_DIR_PERMISSION))) { throw new IOException("Mkdirs failed to create " + logDir.toString()); } } conf.set("hadoop.job.history.location", LOG_DIR); disableHistory = false; // set the job history block size (default is 3MB) jobHistoryBlockSize = conf.getLong("mapred.jobtracker.job.history.block.size", 3 * 1024 * 1024); jtConf = conf; // initialize the file manager fileManager = new JobHistoryFilesManager(conf, jobTracker, logDir); } catch(IOException e) { LOG.error("Failed to initialize JobHistory log file", e); disableHistory = true; } fileManager.startIOExecutor(); return !(disableHistory); } }
public class class_name { public static boolean init(JobHistoryObserver jobTracker, JobConf conf, String hostname, long jobTrackerStartTime){ try { LOG_DIR = conf.get("hadoop.job.history.location" , "file:///" + new File( System.getProperty("hadoop.log.dir", "/tmp")).getAbsolutePath() + File.separator + "history"); // depends on control dependency: [try], data = [none] JOBTRACKER_UNIQUE_STRING = hostname + "_" + String.valueOf(jobTrackerStartTime) + "_"; // depends on control dependency: [try], data = [none] jobtrackerHostname = hostname; // depends on control dependency: [try], data = [none] Path logDir = new Path(LOG_DIR); LOGDIR_FS = logDir.getFileSystem(conf); // depends on control dependency: [try], data = [none] if (!LOGDIR_FS.exists(logDir)){ if (!LOGDIR_FS.mkdirs(logDir, new FsPermission(HISTORY_DIR_PERMISSION))) { throw new IOException("Mkdirs failed to create " + logDir.toString()); } } conf.set("hadoop.job.history.location", LOG_DIR); // depends on control dependency: [try], data = [none] disableHistory = false; // depends on control dependency: [try], data = [none] // set the job history block size (default is 3MB) jobHistoryBlockSize = conf.getLong("mapred.jobtracker.job.history.block.size", 3 * 1024 * 1024); // depends on control dependency: [try], data = [none] jtConf = conf; // depends on control dependency: [try], data = [none] // initialize the file manager fileManager = new JobHistoryFilesManager(conf, jobTracker, logDir); // depends on control dependency: [try], data = [none] } catch(IOException e) { LOG.error("Failed to initialize JobHistory log file", e); disableHistory = true; } // depends on control dependency: [catch], data = [none] fileManager.startIOExecutor(); return !(disableHistory); } }
public class class_name { private static boolean linearPathIntersectsMultiPoint_( MultiPath multipathA, MultiPoint multipoint_b, double tolerance, boolean b_intersects_all) { SegmentIteratorImpl segIterA = ((MultiPathImpl) multipathA._getImpl()) .querySegmentIterator(); boolean bContained = true; boolean bInteriorHitFound = false; Envelope2D env_a = new Envelope2D(); Envelope2D env_b = new Envelope2D(); Envelope2D envInter = new Envelope2D(); multipathA.queryEnvelope2D(env_a); multipoint_b.queryEnvelope2D(env_b); env_a.inflate(tolerance, tolerance); if (!env_a.contains(env_b)) { bContained = false; } env_b.inflate(tolerance, tolerance); envInter.setCoords(env_a); envInter.intersect(env_b); QuadTreeImpl qtA = null; QuadTreeImpl quadTreeA = null; QuadTreeImpl quadTreePathsA = null; GeometryAccelerators accel = ((MultiPathImpl) multipathA._getImpl()) ._getAccelerators(); if (accel != null) { quadTreeA = accel.getQuadTree(); if (quadTreeA == null) { qtA = InternalUtils.buildQuadTree( (MultiPathImpl) multipathA._getImpl(), envInter); quadTreeA = qtA; } } else { qtA = InternalUtils.buildQuadTree( (MultiPathImpl) multipathA._getImpl(), envInter); quadTreeA = qtA; } QuadTreeImpl.QuadTreeIteratorImpl qtIterA = quadTreeA.getIterator(); QuadTreeImpl.QuadTreeIteratorImpl qtIterPathsA = null; if (quadTreePathsA != null) qtIterPathsA = quadTreePathsA.getIterator(); Point2D ptB = new Point2D(), closest = new Point2D(); boolean b_intersects = false; double toleranceSq = tolerance * tolerance; for (int i = 0; i < multipoint_b.getPointCount(); i++) { multipoint_b.getXY(i, ptB); if (!envInter.contains(ptB)) { continue; } env_b.setCoords(ptB.x, ptB.y, ptB.x, ptB.y); if (qtIterPathsA != null) { qtIterPathsA.resetIterator(env_b, tolerance); if (qtIterPathsA.next() == -1) continue; } qtIterA.resetIterator(env_b, tolerance); boolean b_covered = false; for (int elementHandleA = qtIterA.next(); elementHandleA != -1; elementHandleA = qtIterA .next()) { int vertex_a = quadTreeA.getElement(elementHandleA); segIterA.resetToVertex(vertex_a); Segment segmentA = segIterA.nextSegment(); double t = segmentA.getClosestCoordinate(ptB, false); segmentA.getCoord2D(t, closest); if (Point2D.sqrDistance(closest, ptB) <= toleranceSq) { b_covered = true; break; } } if (b_intersects_all) { if (!b_covered) { return false; } } else { if (b_covered) { return true; } } } if (b_intersects_all) { return true; } return false; } }
public class class_name { private static boolean linearPathIntersectsMultiPoint_( MultiPath multipathA, MultiPoint multipoint_b, double tolerance, boolean b_intersects_all) { SegmentIteratorImpl segIterA = ((MultiPathImpl) multipathA._getImpl()) .querySegmentIterator(); boolean bContained = true; boolean bInteriorHitFound = false; Envelope2D env_a = new Envelope2D(); Envelope2D env_b = new Envelope2D(); Envelope2D envInter = new Envelope2D(); multipathA.queryEnvelope2D(env_a); multipoint_b.queryEnvelope2D(env_b); env_a.inflate(tolerance, tolerance); if (!env_a.contains(env_b)) { bContained = false; // depends on control dependency: [if], data = [none] } env_b.inflate(tolerance, tolerance); envInter.setCoords(env_a); envInter.intersect(env_b); QuadTreeImpl qtA = null; QuadTreeImpl quadTreeA = null; QuadTreeImpl quadTreePathsA = null; GeometryAccelerators accel = ((MultiPathImpl) multipathA._getImpl()) ._getAccelerators(); if (accel != null) { quadTreeA = accel.getQuadTree(); // depends on control dependency: [if], data = [none] if (quadTreeA == null) { qtA = InternalUtils.buildQuadTree( (MultiPathImpl) multipathA._getImpl(), envInter); // depends on control dependency: [if], data = [none] quadTreeA = qtA; // depends on control dependency: [if], data = [none] } } else { qtA = InternalUtils.buildQuadTree( (MultiPathImpl) multipathA._getImpl(), envInter); // depends on control dependency: [if], data = [none] quadTreeA = qtA; // depends on control dependency: [if], data = [none] } QuadTreeImpl.QuadTreeIteratorImpl qtIterA = quadTreeA.getIterator(); QuadTreeImpl.QuadTreeIteratorImpl qtIterPathsA = null; if (quadTreePathsA != null) qtIterPathsA = quadTreePathsA.getIterator(); Point2D ptB = new Point2D(), closest = new Point2D(); boolean b_intersects = false; double toleranceSq = tolerance * tolerance; for (int i = 0; i < multipoint_b.getPointCount(); i++) { multipoint_b.getXY(i, ptB); // depends on control dependency: [for], data = [i] if (!envInter.contains(ptB)) { continue; } env_b.setCoords(ptB.x, ptB.y, ptB.x, ptB.y); // depends on control dependency: [for], data = [none] if (qtIterPathsA != null) { qtIterPathsA.resetIterator(env_b, tolerance); // depends on control dependency: [if], data = [none] if (qtIterPathsA.next() == -1) continue; } qtIterA.resetIterator(env_b, tolerance); // depends on control dependency: [for], data = [none] boolean b_covered = false; for (int elementHandleA = qtIterA.next(); elementHandleA != -1; elementHandleA = qtIterA .next()) { int vertex_a = quadTreeA.getElement(elementHandleA); segIterA.resetToVertex(vertex_a); // depends on control dependency: [for], data = [none] Segment segmentA = segIterA.nextSegment(); double t = segmentA.getClosestCoordinate(ptB, false); segmentA.getCoord2D(t, closest); // depends on control dependency: [for], data = [none] if (Point2D.sqrDistance(closest, ptB) <= toleranceSq) { b_covered = true; // depends on control dependency: [if], data = [none] break; } } if (b_intersects_all) { if (!b_covered) { return false; // depends on control dependency: [if], data = [none] } } else { if (b_covered) { return true; // depends on control dependency: [if], data = [none] } } } if (b_intersects_all) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { @Override public void onFileCreate(Path rawPath) { try { JobSpec newJobSpec = this.converter.apply(loader.loadPullFile(rawPath, sysConfig, false)); listeners.onAddJob(newJobSpec); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } }
public class class_name { @Override public void onFileCreate(Path rawPath) { try { JobSpec newJobSpec = this.converter.apply(loader.loadPullFile(rawPath, sysConfig, false)); listeners.onAddJob(newJobSpec); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static int getFinalTarget(CFG cfg, int myPos, Collection<InstructionHandle> prevs) { int maxGoto = 0; BasicBlock myBB = null; // note: InstructionHandle doesn't override equals(), so use // prevs.contains() with caution. Iterator<BasicBlock> bbi = cfg.blockIterator(); while (bbi.hasNext()) { BasicBlock bb = bbi.next(); InstructionHandle last = bb.getLastInstruction(); // may be null if (prevs.contains(last)) { // danger will robinson Iterator<Edge> iei = cfg.outgoingEdgeIterator(bb); while (iei.hasNext()) { Edge e = iei.next(); int eType = e.getType(); if (eType == EdgeTypes.GOTO_EDGE) { BasicBlock target = e.getTarget(); InstructionHandle targetFirst = getDeepFirstInstruction(cfg, target); if (targetFirst != null) { int targetPos = targetFirst.getPosition(); if (targetPos > maxGoto) { maxGoto = targetPos; } } } } } else if (last != null && myPos == bb.getFirstInstruction().getPosition()) { // note: getFirstInstruction() may return null, but won't if // last!=null. myBB = bb; // used in case (c) below } } /* * ok, there are three cases: a) maxGoto == myPos: There is no default * case within the switch. b) maxGoto > myPos: maxGoto is the end * (exclusive) of the default case c) maxGoto < myPos: all the cases do * something like return or throw, so who knows if there is a default * case (and it's length)? */ if (maxGoto < myPos && myBB != null) { /* * We're in case (c), so let's guess that the end of the basic block * is the end of the default case (if it exists). This may give * false negatives (if the default case has branches, for example) * but shouldn't give false negatives (because if it matches one of * the cases, then it has also matched that case's return/throw). */ InstructionHandle last = myBB.getLastInstruction(); if (last != null) { // note: last.getNext() may return null, so do it this way return last.getPosition() + last.getInstruction().getLength(); } } return maxGoto; } }
public class class_name { private static int getFinalTarget(CFG cfg, int myPos, Collection<InstructionHandle> prevs) { int maxGoto = 0; BasicBlock myBB = null; // note: InstructionHandle doesn't override equals(), so use // prevs.contains() with caution. Iterator<BasicBlock> bbi = cfg.blockIterator(); while (bbi.hasNext()) { BasicBlock bb = bbi.next(); InstructionHandle last = bb.getLastInstruction(); // may be null if (prevs.contains(last)) { // danger will robinson Iterator<Edge> iei = cfg.outgoingEdgeIterator(bb); while (iei.hasNext()) { Edge e = iei.next(); int eType = e.getType(); if (eType == EdgeTypes.GOTO_EDGE) { BasicBlock target = e.getTarget(); InstructionHandle targetFirst = getDeepFirstInstruction(cfg, target); if (targetFirst != null) { int targetPos = targetFirst.getPosition(); if (targetPos > maxGoto) { maxGoto = targetPos; // depends on control dependency: [if], data = [none] } } } } } else if (last != null && myPos == bb.getFirstInstruction().getPosition()) { // note: getFirstInstruction() may return null, but won't if // last!=null. myBB = bb; // used in case (c) below // depends on control dependency: [if], data = [none] } } /* * ok, there are three cases: a) maxGoto == myPos: There is no default * case within the switch. b) maxGoto > myPos: maxGoto is the end * (exclusive) of the default case c) maxGoto < myPos: all the cases do * something like return or throw, so who knows if there is a default * case (and it's length)? */ if (maxGoto < myPos && myBB != null) { /* * We're in case (c), so let's guess that the end of the basic block * is the end of the default case (if it exists). This may give * false negatives (if the default case has branches, for example) * but shouldn't give false negatives (because if it matches one of * the cases, then it has also matched that case's return/throw). */ InstructionHandle last = myBB.getLastInstruction(); if (last != null) { // note: last.getNext() may return null, so do it this way return last.getPosition() + last.getInstruction().getLength(); // depends on control dependency: [if], data = [none] } } return maxGoto; } }
public class class_name { public String toPayloadString() { String digits = "0123456789ABCDEF"; StringBuilder retval = new StringBuilder("DataSlice@"); retval.append(hashCode()); retval.append("["); for (int i=_offset; i<(_offset+_length); i++) { retval.append(digits.charAt((_bytes[i] >> 4) & 0xf)); retval.append(digits.charAt(_bytes[i] & 0xf)); } retval.append("]"); return retval.toString(); } }
public class class_name { public String toPayloadString() { String digits = "0123456789ABCDEF"; StringBuilder retval = new StringBuilder("DataSlice@"); retval.append(hashCode()); retval.append("["); for (int i=_offset; i<(_offset+_length); i++) { retval.append(digits.charAt((_bytes[i] >> 4) & 0xf)); // depends on control dependency: [for], data = [i] retval.append(digits.charAt(_bytes[i] & 0xf)); // depends on control dependency: [for], data = [i] } retval.append("]"); return retval.toString(); } }
public class class_name { private void saveContainers() { String workingDir = getMain().getFileSystemManager().getSystemDataLocation().getAbsolutePath(); final String containerFile = workingDir + File.separator + "containers.ser"; try { FileOutputStream fileOut = new FileOutputStream(containerFile); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(containers); out.close(); fileOut.close(); } catch(IOException e) { logger.error("Unable to save containers to file", e); } } }
public class class_name { private void saveContainers() { String workingDir = getMain().getFileSystemManager().getSystemDataLocation().getAbsolutePath(); final String containerFile = workingDir + File.separator + "containers.ser"; try { FileOutputStream fileOut = new FileOutputStream(containerFile); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(containers); // depends on control dependency: [try], data = [none] out.close(); // depends on control dependency: [try], data = [none] fileOut.close(); // depends on control dependency: [try], data = [none] } catch(IOException e) { logger.error("Unable to save containers to file", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public INDArray inferVector(String text, double learningRate, double minLearningRate, int iterations) { if (tokenizerFactory == null) throw new IllegalStateException("TokenizerFactory should be defined, prior to predict() call"); if (this.vocab == null || this.vocab.numWords() == 0) reassignExistingModel(); List<String> tokens = tokenizerFactory.create(text).getTokens(); List<VocabWord> document = new ArrayList<>(); for (String token : tokens) { if (vocab.containsWord(token)) { document.add(vocab.wordFor(token)); } } if (document.isEmpty()) throw new ND4JIllegalStateException("Text passed for inference has no matches in model vocabulary."); return inferVector(document, learningRate, minLearningRate, iterations); } }
public class class_name { public INDArray inferVector(String text, double learningRate, double minLearningRate, int iterations) { if (tokenizerFactory == null) throw new IllegalStateException("TokenizerFactory should be defined, prior to predict() call"); if (this.vocab == null || this.vocab.numWords() == 0) reassignExistingModel(); List<String> tokens = tokenizerFactory.create(text).getTokens(); List<VocabWord> document = new ArrayList<>(); for (String token : tokens) { if (vocab.containsWord(token)) { document.add(vocab.wordFor(token)); // depends on control dependency: [if], data = [none] } } if (document.isEmpty()) throw new ND4JIllegalStateException("Text passed for inference has no matches in model vocabulary."); return inferVector(document, learningRate, minLearningRate, iterations); } }
public class class_name { protected static double[][] randomInitialSolution(final int size, final int dim, Random random) { double[][] sol = new double[size][dim]; for(int i = 0; i < size; i++) { for(int j = 0; j < dim; j++) { sol[i][j] = random.nextGaussian() * INITIAL_SOLUTION_SCALE; } } return sol; } }
public class class_name { protected static double[][] randomInitialSolution(final int size, final int dim, Random random) { double[][] sol = new double[size][dim]; for(int i = 0; i < size; i++) { for(int j = 0; j < dim; j++) { sol[i][j] = random.nextGaussian() * INITIAL_SOLUTION_SCALE; // depends on control dependency: [for], data = [j] } } return sol; } }
public class class_name { @Override public void removeByG_A(long groupId, boolean active) { for (CommerceShippingMethod commerceShippingMethod : findByG_A( groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceShippingMethod); } } }
public class class_name { @Override public void removeByG_A(long groupId, boolean active) { for (CommerceShippingMethod commerceShippingMethod : findByG_A( groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceShippingMethod); // depends on control dependency: [for], data = [commerceShippingMethod] } } }
public class class_name { public Observable<ServiceResponse<Page<IdentifierInner>>> listSiteIdentifiersAssignedToHostNameNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listSiteIdentifiersAssignedToHostNameNext(nextUrl, this.acceptLanguage(), this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<IdentifierInner>>>>() { @Override public Observable<ServiceResponse<Page<IdentifierInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<IdentifierInner>> result = listSiteIdentifiersAssignedToHostNameNextDelegate(response); return Observable.just(new ServiceResponse<Page<IdentifierInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<Page<IdentifierInner>>> listSiteIdentifiersAssignedToHostNameNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listSiteIdentifiersAssignedToHostNameNext(nextUrl, this.acceptLanguage(), this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<IdentifierInner>>>>() { @Override public Observable<ServiceResponse<Page<IdentifierInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<IdentifierInner>> result = listSiteIdentifiersAssignedToHostNameNextDelegate(response); return Observable.just(new ServiceResponse<Page<IdentifierInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { @Override public void removeNeighbors(final Collection<TrustGraphNodeId> neighbors) { synchronized(this) { // remove the neighbors from the ordering in bulk removeNeighborsFromOrdering(neighbors); // just loop over the neighbors and use the single removal operation. for (TrustGraphNodeId n : neighbors) { removeNeighborFromRoutingTable(n); } } } }
public class class_name { @Override public void removeNeighbors(final Collection<TrustGraphNodeId> neighbors) { synchronized(this) { // remove the neighbors from the ordering in bulk removeNeighborsFromOrdering(neighbors); // just loop over the neighbors and use the single removal operation. for (TrustGraphNodeId n : neighbors) { removeNeighborFromRoutingTable(n); } // depends on control dependency: [for], data = [n] } } }
public class class_name { public Map<String, List<String>> listCommands() { Map<String, List<String>> result = new HashMap<String, List<String>>(); for (String cat : restMetadataJson.keySet()) { JsonObject commands = restMetadataJson.getJsonObject(cat); List<String> names = new ArrayList<String>(); for (String commandName: commands.keySet()) { names.add(commandName); } result.put(cat, names); } return result; } }
public class class_name { public Map<String, List<String>> listCommands() { Map<String, List<String>> result = new HashMap<String, List<String>>(); for (String cat : restMetadataJson.keySet()) { JsonObject commands = restMetadataJson.getJsonObject(cat); List<String> names = new ArrayList<String>(); for (String commandName: commands.keySet()) { names.add(commandName); // depends on control dependency: [for], data = [commandName] } result.put(cat, names); // depends on control dependency: [for], data = [cat] } return result; } }
public class class_name { public Obj buildObject(Object... members) { Obj o = newObject(); for (int i = 0; i < members.length; i+=2) { o.put((String)members[i], members[i+1]); } return o; } }
public class class_name { public Obj buildObject(Object... members) { Obj o = newObject(); for (int i = 0; i < members.length; i+=2) { o.put((String)members[i], members[i+1]); // depends on control dependency: [for], data = [i] } return o; } }
public class class_name { protected List getList(Object criteria) { if (this.dataProvider.supportsBaseCriteria()) { this.dataProvider.setBaseCriteria(getBaseCriteria()); } try { List dataSet = this.dataProvider.getList(criteria); setRows(dataSet); setMessage(null); return dataSet; } catch (MaximumRowsExceededException mre) { setRows(Collections.EMPTY_LIST); setMessage(new DefaultMessage(getApplicationConfig().messageResolver() .getMessage( "dataeditor.maximumRowsExceededException.notice", new Object[] { mre.getNumberOfRows(), mre.getMaxRows() }), Severity.WARNING)); if (getToggleFilterCommand() != null) { getToggleFilterCommand().doShow(); } return null; } } }
public class class_name { protected List getList(Object criteria) { if (this.dataProvider.supportsBaseCriteria()) { this.dataProvider.setBaseCriteria(getBaseCriteria()); // depends on control dependency: [if], data = [none] } try { List dataSet = this.dataProvider.getList(criteria); setRows(dataSet); // depends on control dependency: [try], data = [none] setMessage(null); // depends on control dependency: [try], data = [none] return dataSet; // depends on control dependency: [try], data = [none] } catch (MaximumRowsExceededException mre) { setRows(Collections.EMPTY_LIST); setMessage(new DefaultMessage(getApplicationConfig().messageResolver() .getMessage( "dataeditor.maximumRowsExceededException.notice", new Object[] { mre.getNumberOfRows(), mre.getMaxRows() }), Severity.WARNING)); if (getToggleFilterCommand() != null) { getToggleFilterCommand().doShow(); // depends on control dependency: [if], data = [none] } return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(TelephonySettings telephonySettings, ProtocolMarshaller protocolMarshaller) { if (telephonySettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(telephonySettings.getInboundCalling(), INBOUNDCALLING_BINDING); protocolMarshaller.marshall(telephonySettings.getOutboundCalling(), OUTBOUNDCALLING_BINDING); protocolMarshaller.marshall(telephonySettings.getSMS(), SMS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(TelephonySettings telephonySettings, ProtocolMarshaller protocolMarshaller) { if (telephonySettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(telephonySettings.getInboundCalling(), INBOUNDCALLING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(telephonySettings.getOutboundCalling(), OUTBOUNDCALLING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(telephonySettings.getSMS(), SMS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ArrayList<Integer> findDistinctIndexesOf( String string, String substringToLookFor ) { ArrayList<Integer> positions = new ArrayList<Integer>(); if( GosuStringUtil.isEmpty( substringToLookFor ) ) { return positions; } int i = 0; i = GosuStringUtil.indexOf( string, substringToLookFor, i ); while( i != -1 ) { positions.add( i ); i += substringToLookFor.length(); i = GosuStringUtil.indexOf( string, substringToLookFor, i ); } return positions; } }
public class class_name { public static ArrayList<Integer> findDistinctIndexesOf( String string, String substringToLookFor ) { ArrayList<Integer> positions = new ArrayList<Integer>(); if( GosuStringUtil.isEmpty( substringToLookFor ) ) { return positions; // depends on control dependency: [if], data = [none] } int i = 0; i = GosuStringUtil.indexOf( string, substringToLookFor, i ); while( i != -1 ) { positions.add( i ); // depends on control dependency: [while], data = [( i] i += substringToLookFor.length(); // depends on control dependency: [while], data = [none] i = GosuStringUtil.indexOf( string, substringToLookFor, i ); // depends on control dependency: [while], data = [none] } return positions; } }
public class class_name { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (!isPaddingSet && mViewPager != null) { int paddingForViewPager = this.getMeasuredWidth() / mPaddingRatio; mViewPager.setPadding(paddingForViewPager, mViewPager.getPaddingTop(), paddingForViewPager, mViewPager.getPaddingBottom()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mViewPager.setPageMargin(-(int) (((float) mViewPager.getPaddingLeft() + (float) mViewPager.getPaddingRight()) * 2.0f)); } isPaddingSet = true; } } }
public class class_name { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (!isPaddingSet && mViewPager != null) { int paddingForViewPager = this.getMeasuredWidth() / mPaddingRatio; mViewPager.setPadding(paddingForViewPager, mViewPager.getPaddingTop(), paddingForViewPager, mViewPager.getPaddingBottom()); // depends on control dependency: [if], data = [none] if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mViewPager.setPageMargin(-(int) (((float) mViewPager.getPaddingLeft() + (float) mViewPager.getPaddingRight()) * 2.0f)); // depends on control dependency: [if], data = [none] } isPaddingSet = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void parseText(char[] text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor) { if (trie != null) { trie.parseText(text, processor); } DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(text, 0); while (searcher.next()) { processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value); } } }
public class class_name { public static void parseText(char[] text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor) { if (trie != null) { trie.parseText(text, processor); // depends on control dependency: [if], data = [none] } DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(text, 0); while (searcher.next()) { processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static String getPhrase(String name, String memberValue) { String rslt = null; // We can cut & run now if the element is a <literal>... if (name.equals("literal")) { return memberValue; } try { // Next see if it's a <channel> element... if (name.equals("channel")) { IPortletDefinition def = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry() .getPortletDefinitionByFname(memberValue); return String.valueOf(def.getPortletDefinitionId().getStringId()); } // Must be a group... Class[] leafTypes = new Class[] {IPerson.class, IPortletDefinition.class}; for (int i = 0; i < leafTypes.length && rslt == null; i++) { EntityIdentifier[] eis = GroupService.searchForGroups( memberValue, IGroupConstants.SearchMethod.DISCRETE, leafTypes[i]); if (eis.length == 1) { // Match! IEntityGroup g = GroupService.findGroup(eis[0].getKey()); rslt = g.getLocalKey(); break; } else if (eis.length > 1) { String msg = "Ambiguous member name: " + memberValue; throw new RuntimeException(msg); } } } catch (Throwable t) { String msg = "Error looking up the specified member: " + memberValue; throw new RuntimeException(msg, t); } if (rslt == null) { String msg = "The specified member was not found: " + memberValue; throw new RuntimeException(msg); } return rslt; } }
public class class_name { public static String getPhrase(String name, String memberValue) { String rslt = null; // We can cut & run now if the element is a <literal>... if (name.equals("literal")) { return memberValue; // depends on control dependency: [if], data = [none] } try { // Next see if it's a <channel> element... if (name.equals("channel")) { IPortletDefinition def = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry() .getPortletDefinitionByFname(memberValue); return String.valueOf(def.getPortletDefinitionId().getStringId()); // depends on control dependency: [if], data = [none] } // Must be a group... Class[] leafTypes = new Class[] {IPerson.class, IPortletDefinition.class}; // depends on control dependency: [try], data = [none] for (int i = 0; i < leafTypes.length && rslt == null; i++) { EntityIdentifier[] eis = GroupService.searchForGroups( memberValue, IGroupConstants.SearchMethod.DISCRETE, leafTypes[i]); if (eis.length == 1) { // Match! IEntityGroup g = GroupService.findGroup(eis[0].getKey()); rslt = g.getLocalKey(); // depends on control dependency: [if], data = [none] break; } else if (eis.length > 1) { String msg = "Ambiguous member name: " + memberValue; throw new RuntimeException(msg); } } } catch (Throwable t) { String msg = "Error looking up the specified member: " + memberValue; throw new RuntimeException(msg, t); } // depends on control dependency: [catch], data = [none] if (rslt == null) { String msg = "The specified member was not found: " + memberValue; throw new RuntimeException(msg); } return rslt; } }
public class class_name { @Override public boolean isValid(Object input) { Float d; try { d = (Float) input; } catch (Exception e) { return false; } if (allowNaN && Float.isNaN(d)) return true; if (allowInfinite && Float.isInfinite(d)) return true; if (minAllowedValue != null && d < minAllowedValue) return false; if (maxAllowedValue != null && d > maxAllowedValue) return false; return true; } }
public class class_name { @Override public boolean isValid(Object input) { Float d; try { d = (Float) input; // depends on control dependency: [try], data = [none] } catch (Exception e) { return false; } // depends on control dependency: [catch], data = [none] if (allowNaN && Float.isNaN(d)) return true; if (allowInfinite && Float.isInfinite(d)) return true; if (minAllowedValue != null && d < minAllowedValue) return false; if (maxAllowedValue != null && d > maxAllowedValue) return false; return true; } }
public class class_name { public static XAbstractFeatureCall getRootFeatureCall(XAbstractFeatureCall featureCall) { final EObject container = featureCall.eContainer(); final XAbstractFeatureCall rootFeatureCall; if (container instanceof XMemberFeatureCall || container instanceof XFeatureCall) { rootFeatureCall = (XAbstractFeatureCall) getFirstContainerForPredicate(featureCall, it -> it.eContainer() != null && !(it.eContainer() instanceof XMemberFeatureCall || it.eContainer() instanceof XFeatureCall)); } else { rootFeatureCall = featureCall; } return rootFeatureCall; } }
public class class_name { public static XAbstractFeatureCall getRootFeatureCall(XAbstractFeatureCall featureCall) { final EObject container = featureCall.eContainer(); final XAbstractFeatureCall rootFeatureCall; if (container instanceof XMemberFeatureCall || container instanceof XFeatureCall) { rootFeatureCall = (XAbstractFeatureCall) getFirstContainerForPredicate(featureCall, it -> it.eContainer() != null && !(it.eContainer() instanceof XMemberFeatureCall || it.eContainer() instanceof XFeatureCall)); // depends on control dependency: [if], data = [none] } else { rootFeatureCall = featureCall; // depends on control dependency: [if], data = [none] } return rootFeatureCall; } }
public class class_name { public byte[] getKeyFromRawBlock (ByteBuffer rawByteBuffer) { rawByteBuffer.mark(); byte[] magicNo=new byte[4]; byte[] hashMerkleRoot=new byte[32]; byte[] hashPrevBlock=new byte[32]; // magic no (skip) rawByteBuffer.get(magicNo,0,4); // blocksize (skip) rawByteBuffer.getInt(); // version (skip) rawByteBuffer.getInt(); // hashPrevBlock rawByteBuffer.get(hashPrevBlock,0,32); // hashMerkleRoot rawByteBuffer.get(hashMerkleRoot,0,32); byte[] result=new byte[hashMerkleRoot.length+hashPrevBlock.length]; for (int i=0;i<hashMerkleRoot.length;i++) { result[i]=hashMerkleRoot[i]; } for (int j=0;j<hashPrevBlock.length;j++) { result[j+hashMerkleRoot.length]=hashPrevBlock[j]; } rawByteBuffer.reset(); return result; } }
public class class_name { public byte[] getKeyFromRawBlock (ByteBuffer rawByteBuffer) { rawByteBuffer.mark(); byte[] magicNo=new byte[4]; byte[] hashMerkleRoot=new byte[32]; byte[] hashPrevBlock=new byte[32]; // magic no (skip) rawByteBuffer.get(magicNo,0,4); // blocksize (skip) rawByteBuffer.getInt(); // version (skip) rawByteBuffer.getInt(); // hashPrevBlock rawByteBuffer.get(hashPrevBlock,0,32); // hashMerkleRoot rawByteBuffer.get(hashMerkleRoot,0,32); byte[] result=new byte[hashMerkleRoot.length+hashPrevBlock.length]; for (int i=0;i<hashMerkleRoot.length;i++) { result[i]=hashMerkleRoot[i]; // depends on control dependency: [for], data = [i] } for (int j=0;j<hashPrevBlock.length;j++) { result[j+hashMerkleRoot.length]=hashPrevBlock[j]; // depends on control dependency: [for], data = [j] } rawByteBuffer.reset(); return result; } }
public class class_name { public static float max( float []array , int offset , int length ) { float max = -Float.MAX_VALUE; for (int i = 0; i < length; i++) { float tmp = array[offset+i]; if( tmp > max ) { max = tmp; } } return max; } }
public class class_name { public static float max( float []array , int offset , int length ) { float max = -Float.MAX_VALUE; for (int i = 0; i < length; i++) { float tmp = array[offset+i]; if( tmp > max ) { max = tmp; // depends on control dependency: [if], data = [none] } } return max; } }
public class class_name { private static String mungeCharName(String source) { source = PatternProps.trimWhiteSpace(source); StringBuilder buf = null; for (int i=0; i<source.length(); ++i) { char ch = source.charAt(i); if (PatternProps.isWhiteSpace(ch)) { if (buf == null) { buf = new StringBuilder().append(source, 0, i); } else if (buf.charAt(buf.length() - 1) == ' ') { continue; } ch = ' '; // convert to ' ' } if (buf != null) { buf.append(ch); } } return buf == null ? source : buf.toString(); } }
public class class_name { private static String mungeCharName(String source) { source = PatternProps.trimWhiteSpace(source); StringBuilder buf = null; for (int i=0; i<source.length(); ++i) { char ch = source.charAt(i); if (PatternProps.isWhiteSpace(ch)) { if (buf == null) { buf = new StringBuilder().append(source, 0, i); // depends on control dependency: [if], data = [none] } else if (buf.charAt(buf.length() - 1) == ' ') { continue; } ch = ' '; // convert to ' ' // depends on control dependency: [if], data = [none] } if (buf != null) { buf.append(ch); // depends on control dependency: [if], data = [none] } } return buf == null ? source : buf.toString(); } }
public class class_name { static public int match(String s1, String s2) { int i = 0; while ((i < s1.length()) && (i < s2.length())) { if (s1.charAt(i) != s2.charAt(i)) { break; } i++; } return i; } }
public class class_name { static public int match(String s1, String s2) { int i = 0; while ((i < s1.length()) && (i < s2.length())) { if (s1.charAt(i) != s2.charAt(i)) { break; } i++; // depends on control dependency: [while], data = [none] } return i; } }
public class class_name { public String getString(final String key) { if (containsKey(key)) { return get(key); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } } }
public class class_name { public String getString(final String key) { if (containsKey(key)) { return get(key); // depends on control dependency: [if], data = [none] } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } } }
public class class_name { public void init(CmsAccountsApp app, CmsObject cms, CmsUser user, List<CmsGroup> groups) { m_app = app; if (m_container == null) { m_container = new IndexedContainer(); for (TableProperty prop : TableProperty.values()) { m_container.addContainerProperty(prop, prop.getType(), prop.getDefault()); setColumnHeader(prop, prop.getName()); } m_app.addGroupContainerProperties(m_container); setContainerDataSource(m_container); setItemIconPropertyId(TableProperty.Icon); setRowHeaderMode(RowHeaderMode.ICON_ONLY); setColumnWidth(null, 40); setSelectable(false); setMultiSelect(false); setVisibleColumns(TableProperty.Name, TableProperty.OU); } m_container.removeAllItems(); for (CmsGroup group : groups) { Item item = m_container.addItem(group); m_app.fillGroupItem(item, group, new ArrayList<CmsGroup>()); } } }
public class class_name { public void init(CmsAccountsApp app, CmsObject cms, CmsUser user, List<CmsGroup> groups) { m_app = app; if (m_container == null) { m_container = new IndexedContainer(); // depends on control dependency: [if], data = [none] for (TableProperty prop : TableProperty.values()) { m_container.addContainerProperty(prop, prop.getType(), prop.getDefault()); // depends on control dependency: [for], data = [prop] setColumnHeader(prop, prop.getName()); // depends on control dependency: [for], data = [prop] } m_app.addGroupContainerProperties(m_container); // depends on control dependency: [if], data = [(m_container] setContainerDataSource(m_container); // depends on control dependency: [if], data = [(m_container] setItemIconPropertyId(TableProperty.Icon); // depends on control dependency: [if], data = [none] setRowHeaderMode(RowHeaderMode.ICON_ONLY); // depends on control dependency: [if], data = [none] setColumnWidth(null, 40); // depends on control dependency: [if], data = [none] setSelectable(false); // depends on control dependency: [if], data = [none] setMultiSelect(false); // depends on control dependency: [if], data = [none] setVisibleColumns(TableProperty.Name, TableProperty.OU); // depends on control dependency: [if], data = [none] } m_container.removeAllItems(); for (CmsGroup group : groups) { Item item = m_container.addItem(group); m_app.fillGroupItem(item, group, new ArrayList<CmsGroup>()); // depends on control dependency: [for], data = [group] } } }
public class class_name { public CellFormatResult format(final Cell cell, final Locale locale, final boolean isStartDate1904) { ArgUtils.notNull(cell, "cell"); final Locale runtimeLocale = locale != null ? locale : Locale.getDefault(); final CellType cellType = cell.getType(); if(cellType == CellType.EMPTY) { final CellFormatResult result = new CellFormatResult(); result.setCellType(FormatCellType.Blank); result.setText(""); return result; } else if(cellType == CellType.LABEL || cellType == CellType.STRING_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); } else if(cellType == CellType.BOOLEAN || cellType == CellType.BOOLEAN_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); } else if(cellType == CellType.ERROR || cellType == CellType.FORMULA_ERROR) { return getErrorCellValue(cell, runtimeLocale, isStartDate1904); } else if(cellType == CellType.DATE || cellType == CellType.DATE_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); } else if(cellType == CellType.NUMBER || cellType == CellType.NUMBER_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); } else { final CellFormatResult result = new CellFormatResult(); result.setCellType(FormatCellType.Unknown); result.setText(""); return result; } } }
public class class_name { public CellFormatResult format(final Cell cell, final Locale locale, final boolean isStartDate1904) { ArgUtils.notNull(cell, "cell"); final Locale runtimeLocale = locale != null ? locale : Locale.getDefault(); final CellType cellType = cell.getType(); if(cellType == CellType.EMPTY) { final CellFormatResult result = new CellFormatResult(); result.setCellType(FormatCellType.Blank); // depends on control dependency: [if], data = [none] result.setText(""); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } else if(cellType == CellType.LABEL || cellType == CellType.STRING_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); // depends on control dependency: [if], data = [none] } else if(cellType == CellType.BOOLEAN || cellType == CellType.BOOLEAN_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); // depends on control dependency: [if], data = [none] } else if(cellType == CellType.ERROR || cellType == CellType.FORMULA_ERROR) { return getErrorCellValue(cell, runtimeLocale, isStartDate1904); // depends on control dependency: [if], data = [none] } else if(cellType == CellType.DATE || cellType == CellType.DATE_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); // depends on control dependency: [if], data = [none] } else if(cellType == CellType.NUMBER || cellType == CellType.NUMBER_FORMULA) { return getCellValue(cell, runtimeLocale, isStartDate1904); // depends on control dependency: [if], data = [none] } else { final CellFormatResult result = new CellFormatResult(); result.setCellType(FormatCellType.Unknown); // depends on control dependency: [if], data = [none] result.setText(""); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } } }
public class class_name { private UsernamePasswordToken usernamePassword(ServiceRequestContext ctx, AggregatedHttpMessage req) { // check the Basic HTTP authentication first (https://tools.ietf.org/html/rfc7617) final BasicToken basicToken = AuthTokenExtractors.BASIC.apply(req.headers()); if (basicToken != null) { return new UsernamePasswordToken(basicToken.username(), basicToken.password()); } final MediaType mediaType = req.headers().contentType(); if (mediaType != MediaType.FORM_DATA) { return throwResponse(ctx, HttpStatus.BAD_REQUEST, "The content type of a login request must be '%s'.", MediaType.FORM_DATA); } final Map<String, List<String>> parameters = new QueryStringDecoder(req.contentUtf8(), false).parameters(); // assume that the grant_type is "password" final List<String> usernames = parameters.get("username"); final List<String> passwords = parameters.get("password"); if (usernames != null && passwords != null) { final String username = usernames.get(0); final String password = passwords.get(0); return new UsernamePasswordToken(loginNameNormalizer.apply(username), password); } return throwResponse(ctx, HttpStatus.BAD_REQUEST, "A login request must contain username and password."); } }
public class class_name { private UsernamePasswordToken usernamePassword(ServiceRequestContext ctx, AggregatedHttpMessage req) { // check the Basic HTTP authentication first (https://tools.ietf.org/html/rfc7617) final BasicToken basicToken = AuthTokenExtractors.BASIC.apply(req.headers()); if (basicToken != null) { return new UsernamePasswordToken(basicToken.username(), basicToken.password()); // depends on control dependency: [if], data = [(basicToken] } final MediaType mediaType = req.headers().contentType(); if (mediaType != MediaType.FORM_DATA) { return throwResponse(ctx, HttpStatus.BAD_REQUEST, "The content type of a login request must be '%s'.", MediaType.FORM_DATA); // depends on control dependency: [if], data = [none] } final Map<String, List<String>> parameters = new QueryStringDecoder(req.contentUtf8(), false).parameters(); // assume that the grant_type is "password" final List<String> usernames = parameters.get("username"); final List<String> passwords = parameters.get("password"); if (usernames != null && passwords != null) { final String username = usernames.get(0); final String password = passwords.get(0); return new UsernamePasswordToken(loginNameNormalizer.apply(username), password); // depends on control dependency: [if], data = [none] } return throwResponse(ctx, HttpStatus.BAD_REQUEST, "A login request must contain username and password."); } }
public class class_name { public static <T> T[] removeDuplicates(T[] items) { int count = 0; // First, identify duplicates and store this information in a bitset. BitSet duplicates = new BitSet(items.length); for (int i = 0; i != items.length; ++i) { T ith = items[i]; for (int j = i + 1; j < items.length; ++j) { T jth = items[j]; if(ith == null) { if(jth == null) { duplicates.set(i); count = count + 1; break; } } else if (ith.equals(jth)) { duplicates.set(i); count = count + 1; break; } } } // Second, eliminate duplicates (if any) if (count == 0) { // nothing actually needs to be removed return items; } else { T[] nItems = Arrays.copyOf(items, items.length - count); for (int i = 0, j = 0; i != items.length; ++i) { if (duplicates.get(i)) { // this is a duplicate, ignore } else { nItems[j++] = items[i]; } } return nItems; } } }
public class class_name { public static <T> T[] removeDuplicates(T[] items) { int count = 0; // First, identify duplicates and store this information in a bitset. BitSet duplicates = new BitSet(items.length); for (int i = 0; i != items.length; ++i) { T ith = items[i]; for (int j = i + 1; j < items.length; ++j) { T jth = items[j]; if(ith == null) { if(jth == null) { duplicates.set(i); // depends on control dependency: [if], data = [none] count = count + 1; // depends on control dependency: [if], data = [none] break; } } else if (ith.equals(jth)) { duplicates.set(i); // depends on control dependency: [if], data = [none] count = count + 1; // depends on control dependency: [if], data = [none] break; } } } // Second, eliminate duplicates (if any) if (count == 0) { // nothing actually needs to be removed return items; // depends on control dependency: [if], data = [none] } else { T[] nItems = Arrays.copyOf(items, items.length - count); for (int i = 0, j = 0; i != items.length; ++i) { if (duplicates.get(i)) { // this is a duplicate, ignore } else { nItems[j++] = items[i]; // depends on control dependency: [if], data = [none] } } return nItems; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void forceDecreaseKeyToMinimum(Node<K, V> n) { Node<K, V> y = n.parent; if (y != null) { cut(n, y); root.mark = false; cascadingRankChange(y); root = link(root, n); } } }
public class class_name { private void forceDecreaseKeyToMinimum(Node<K, V> n) { Node<K, V> y = n.parent; if (y != null) { cut(n, y); // depends on control dependency: [if], data = [none] root.mark = false; // depends on control dependency: [if], data = [none] cascadingRankChange(y); // depends on control dependency: [if], data = [(y] root = link(root, n); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected File findFile(List<String> loadPaths, String moduleName) { String fileName = normalizeName(moduleName); File file = new File( moduleName ); if ( file.isAbsolute() ) { if ( file.exists() ) { return file; } } for (String loadPath : loadPaths) { // require('foo'); file = new File(loadPath, fileName); // foo.js is in the require path if (file.exists()) break; } return file; } }
public class class_name { protected File findFile(List<String> loadPaths, String moduleName) { String fileName = normalizeName(moduleName); File file = new File( moduleName ); if ( file.isAbsolute() ) { if ( file.exists() ) { return file; // depends on control dependency: [if], data = [none] } } for (String loadPath : loadPaths) { // require('foo'); file = new File(loadPath, fileName); // depends on control dependency: [for], data = [loadPath] // foo.js is in the require path if (file.exists()) break; } return file; } }
public class class_name { private static void close(InputSource source) { if (source != null) { if (source.getByteStream() != null) { close(source.getByteStream()); } if (source.getCharacterStream() != null) { close(source.getCharacterStream()); } } } }
public class class_name { private static void close(InputSource source) { if (source != null) { if (source.getByteStream() != null) { close(source.getByteStream()); // depends on control dependency: [if], data = [(source.getByteStream()] } if (source.getCharacterStream() != null) { close(source.getCharacterStream()); // depends on control dependency: [if], data = [(source.getCharacterStream()] } } } }
public class class_name { public void setCrawlerNames(java.util.Collection<String> crawlerNames) { if (crawlerNames == null) { this.crawlerNames = null; return; } this.crawlerNames = new java.util.ArrayList<String>(crawlerNames); } }
public class class_name { public void setCrawlerNames(java.util.Collection<String> crawlerNames) { if (crawlerNames == null) { this.crawlerNames = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.crawlerNames = new java.util.ArrayList<String>(crawlerNames); } }
public class class_name { public void setCursor(Object parent, String name, String cursor) { if (isAttached()) { helper.setCursor(parent, name, cursor); } } }
public class class_name { public void setCursor(Object parent, String name, String cursor) { if (isAttached()) { helper.setCursor(parent, name, cursor); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Map<Key<?>, String> getAllInvalidKeys(DependencyExplorerOutput output) { Map<Key<?>, String> invalidKeys = new LinkedHashMap<Key<?>, String>(); // Look for errors in the nodes, and either report the error (if its required) or remove the // node (if its optional). for (Entry<Key<?>, String> error : output.getBindingErrors()) { invalidKeys.put(error.getKey(), "Unable to create or inherit binding: " + error.getValue()); } GinjectorBindings origin = output.getGraph().getOrigin(); for (Key<?> key : output.getImplicitlyBoundKeys()) { if (origin.isBoundLocallyInChild(key)) { GinjectorBindings child = origin.getChildWhichBindsLocally(key); Binding childBinding = child.getBinding(key); PrettyPrinter.log(logger, TreeLogger.DEBUG, "Marking the key %s as bound in the ginjector %s (implicitly), and in the child" + " %s (%s)", key, origin, child, childBinding.getContext()); // TODO(schmitt): Determine path to binding in child ginjector (requires // different DependencyExplorerOutput). invalidKeys.put(key, PrettyPrinter.format("Already bound in child Ginjector %s. Consider exposing it?", child)); } } return invalidKeys; } }
public class class_name { private Map<Key<?>, String> getAllInvalidKeys(DependencyExplorerOutput output) { Map<Key<?>, String> invalidKeys = new LinkedHashMap<Key<?>, String>(); // Look for errors in the nodes, and either report the error (if its required) or remove the // node (if its optional). for (Entry<Key<?>, String> error : output.getBindingErrors()) { invalidKeys.put(error.getKey(), "Unable to create or inherit binding: " + error.getValue()); // depends on control dependency: [for], data = [error] } GinjectorBindings origin = output.getGraph().getOrigin(); for (Key<?> key : output.getImplicitlyBoundKeys()) { if (origin.isBoundLocallyInChild(key)) { GinjectorBindings child = origin.getChildWhichBindsLocally(key); Binding childBinding = child.getBinding(key); PrettyPrinter.log(logger, TreeLogger.DEBUG, "Marking the key %s as bound in the ginjector %s (implicitly), and in the child" + " %s (%s)", key, origin, child, childBinding.getContext()); // depends on control dependency: [if], data = [none] // TODO(schmitt): Determine path to binding in child ginjector (requires // different DependencyExplorerOutput). invalidKeys.put(key, PrettyPrinter.format("Already bound in child Ginjector %s. Consider exposing it?", child)); // depends on control dependency: [if], data = [none] } } return invalidKeys; } }
public class class_name { public java.util.List<String> getInstanceIds() { if (instanceIds == null) { instanceIds = new com.amazonaws.internal.SdkInternalList<String>(); } return instanceIds; } }
public class class_name { public java.util.List<String> getInstanceIds() { if (instanceIds == null) { instanceIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return instanceIds; } }
public class class_name { public <T> T get(@NonNull String key, @NonNull Class<T> classOfT, T defaultValue) { Preconditions.checkNotNull(key, KEY_IS_NULL); Preconditions.checkNotNull(classOfT, CLASS_OF_T_IS_NULL); if (!contains(key) && defaultValue == null) { return null; } return get(key, TypeToken.fromClass(classOfT), defaultValue); } }
public class class_name { public <T> T get(@NonNull String key, @NonNull Class<T> classOfT, T defaultValue) { Preconditions.checkNotNull(key, KEY_IS_NULL); Preconditions.checkNotNull(classOfT, CLASS_OF_T_IS_NULL); if (!contains(key) && defaultValue == null) { return null; // depends on control dependency: [if], data = [none] } return get(key, TypeToken.fromClass(classOfT), defaultValue); } }
public class class_name { public void ratifyLockAction (ClientObject caller, NodeObject.Lock lock, boolean acquire) { LockHandler handler = _locks.get(lock); if (handler != null && Objects.equal(handler.getNodeName(), _nodeName)) { handler.ratify(caller, acquire); } else { // this is not an error condition, as we may have cancelled the handler or // allowed another to take priority } } }
public class class_name { public void ratifyLockAction (ClientObject caller, NodeObject.Lock lock, boolean acquire) { LockHandler handler = _locks.get(lock); if (handler != null && Objects.equal(handler.getNodeName(), _nodeName)) { handler.ratify(caller, acquire); // depends on control dependency: [if], data = [none] } else { // this is not an error condition, as we may have cancelled the handler or // allowed another to take priority } } }
public class class_name { @ProblemFactCollectionProperty private List<MrServiceDependency> getServiceDependencyList() { List<MrServiceDependency> serviceDependencyList = new ArrayList<>(serviceList.size() * 5); for (MrService service : serviceList) { for (MrService toService : service.getToDependencyServiceList()) { MrServiceDependency serviceDependency = new MrServiceDependency(); serviceDependency.setFromService(service); serviceDependency.setToService(toService); serviceDependencyList.add(serviceDependency); } } return serviceDependencyList; } }
public class class_name { @ProblemFactCollectionProperty private List<MrServiceDependency> getServiceDependencyList() { List<MrServiceDependency> serviceDependencyList = new ArrayList<>(serviceList.size() * 5); for (MrService service : serviceList) { for (MrService toService : service.getToDependencyServiceList()) { MrServiceDependency serviceDependency = new MrServiceDependency(); serviceDependency.setFromService(service); // depends on control dependency: [for], data = [none] serviceDependency.setToService(toService); // depends on control dependency: [for], data = [toService] serviceDependencyList.add(serviceDependency); // depends on control dependency: [for], data = [none] } } return serviceDependencyList; } }
public class class_name { private static int toSeleniumCoordinate(Object openCVCoordinate) { if (openCVCoordinate instanceof Long) { return ((Long) openCVCoordinate).intValue(); } if (openCVCoordinate instanceof Double) { return ((Double) openCVCoordinate).intValue(); } return (int) openCVCoordinate; } }
public class class_name { private static int toSeleniumCoordinate(Object openCVCoordinate) { if (openCVCoordinate instanceof Long) { return ((Long) openCVCoordinate).intValue(); // depends on control dependency: [if], data = [none] } if (openCVCoordinate instanceof Double) { return ((Double) openCVCoordinate).intValue(); // depends on control dependency: [if], data = [none] } return (int) openCVCoordinate; } }
public class class_name { private <T> Provider<T> lookupProvider(Key<T> key) { BindingInject<T> bean = findBean(key); if (bean != null) { return bean.provider(); } BindingAmp<T> binding = findBinding(key); if (binding != null) { return binding.provider(); } binding = findObjectBinding(key); if (binding != null) { return binding.provider(InjectionPoint.of(key)); } return null; } }
public class class_name { private <T> Provider<T> lookupProvider(Key<T> key) { BindingInject<T> bean = findBean(key); if (bean != null) { return bean.provider(); // depends on control dependency: [if], data = [none] } BindingAmp<T> binding = findBinding(key); if (binding != null) { return binding.provider(); // depends on control dependency: [if], data = [none] } binding = findObjectBinding(key); if (binding != null) { return binding.provider(InjectionPoint.of(key)); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void setWebDriver(WebDriver aWebDriver, int defaultTimeout) { if (webDriver != null && !webDriver.equals(aWebDriver)) { webDriver.quit(); } webDriver = aWebDriver; if (webDriver == null) { webDriverWait = null; } else { webDriverWait = new WebDriverWait(webDriver, defaultTimeout); } } }
public class class_name { public void setWebDriver(WebDriver aWebDriver, int defaultTimeout) { if (webDriver != null && !webDriver.equals(aWebDriver)) { webDriver.quit(); // depends on control dependency: [if], data = [none] } webDriver = aWebDriver; if (webDriver == null) { webDriverWait = null; // depends on control dependency: [if], data = [none] } else { webDriverWait = new WebDriverWait(webDriver, defaultTimeout); // depends on control dependency: [if], data = [(webDriver] } } }
public class class_name { public static void tar(Path inputPath, Path outputPath, boolean gZipped, boolean childrenOnly) throws IOException { if (!Files.exists(inputPath)) { throw new FileNotFoundException("File not found " + inputPath); } FileUtils.touch(outputPath.toFile()); try (TarArchiveOutputStream tarArchiveOutputStream = buildTarStream(outputPath, gZipped)) { if (!Files.isDirectory(inputPath)) { TarArchiveEntry tarEntry = new TarArchiveEntry(inputPath.getFileName().toString()); if (inputPath.toFile().canExecute()) { tarEntry.setMode(tarEntry.getMode() | 0755); } putTarEntry(tarArchiveOutputStream, tarEntry, inputPath); } else { Path sourcePath = inputPath; if (!childrenOnly) { // In order to have the dossier as the root entry sourcePath = inputPath.getParent(); } Files.walkFileTree(inputPath, EnumSet.of(FOLLOW_LINKS), Integer.MAX_VALUE, new TarDirWalker(sourcePath, tarArchiveOutputStream)); } tarArchiveOutputStream.flush(); } } }
public class class_name { public static void tar(Path inputPath, Path outputPath, boolean gZipped, boolean childrenOnly) throws IOException { if (!Files.exists(inputPath)) { throw new FileNotFoundException("File not found " + inputPath); } FileUtils.touch(outputPath.toFile()); try (TarArchiveOutputStream tarArchiveOutputStream = buildTarStream(outputPath, gZipped)) { if (!Files.isDirectory(inputPath)) { TarArchiveEntry tarEntry = new TarArchiveEntry(inputPath.getFileName().toString()); if (inputPath.toFile().canExecute()) { tarEntry.setMode(tarEntry.getMode() | 0755); // depends on control dependency: [if], data = [none] } putTarEntry(tarArchiveOutputStream, tarEntry, inputPath); // depends on control dependency: [if], data = [none] } else { Path sourcePath = inputPath; if (!childrenOnly) { // In order to have the dossier as the root entry sourcePath = inputPath.getParent(); // depends on control dependency: [if], data = [none] } Files.walkFileTree(inputPath, EnumSet.of(FOLLOW_LINKS), Integer.MAX_VALUE, new TarDirWalker(sourcePath, tarArchiveOutputStream)); // depends on control dependency: [if], data = [none] } tarArchiveOutputStream.flush(); } } }
public class class_name { List<I_CmsSimpleContextMenuEntry<Set<String>>> getMenuEntries() { if (m_menuEntries == null) { m_menuEntries = new ArrayList<I_CmsSimpleContextMenuEntry<Set<String>>>(); m_menuEntries.add(new EntryOpen()); m_menuEntries.add(new EntryEdit()); m_menuEntries.add(new EntryShowResources()); m_menuEntries.add(new ImExport()); m_menuEntries.add(new EntryDelete()); } return m_menuEntries; } }
public class class_name { List<I_CmsSimpleContextMenuEntry<Set<String>>> getMenuEntries() { if (m_menuEntries == null) { m_menuEntries = new ArrayList<I_CmsSimpleContextMenuEntry<Set<String>>>(); // depends on control dependency: [if], data = [none] m_menuEntries.add(new EntryOpen()); // depends on control dependency: [if], data = [none] m_menuEntries.add(new EntryEdit()); // depends on control dependency: [if], data = [none] m_menuEntries.add(new EntryShowResources()); // depends on control dependency: [if], data = [none] m_menuEntries.add(new ImExport()); // depends on control dependency: [if], data = [none] m_menuEntries.add(new EntryDelete()); // depends on control dependency: [if], data = [none] } return m_menuEntries; } }
public class class_name { protected void createEdge( String src , String dst , FastQueue<AssociatedPair> pairs , FastQueue<AssociatedIndex> matches ) { // Fitting Essential/Fundamental works when the scene is not planar and not pure rotation int countF = 0; if( ransac3D.process(pairs.toList()) ) { countF = ransac3D.getMatchSet().size(); } // Fitting homography will work when all or part of the scene is planar or motion is pure rotation int countH = 0; if( ransacH.process(pairs.toList()) ) { countH = ransacH.getMatchSet().size(); } // fail if not enough features are remaining after RANSAC if( Math.max(countF,countH) < minimumInliers ) return; // The idea here is that if the number features for F is greater than H then it's a 3D scene. // If they are similar then it might be a plane boolean is3D = countF > countH*ratio3D; PairwiseImageGraph2.Motion edge = graph.edges.grow(); edge.is3D = is3D; edge.countF = countF; edge.countH = countH; edge.index = graph.edges.size-1; edge.src = graph.lookupNode(src); edge.dst = graph.lookupNode(dst); edge.src.connections.add(edge); edge.dst.connections.add(edge); if( is3D ) { saveInlierMatches(ransac3D, matches,edge); edge.F.set(ransac3D.getModelParameters()); } else { saveInlierMatches(ransacH, matches,edge); Homography2D_F64 H = ransacH.getModelParameters(); ConvertDMatrixStruct.convert(H,edge.F); } } }
public class class_name { protected void createEdge( String src , String dst , FastQueue<AssociatedPair> pairs , FastQueue<AssociatedIndex> matches ) { // Fitting Essential/Fundamental works when the scene is not planar and not pure rotation int countF = 0; if( ransac3D.process(pairs.toList()) ) { countF = ransac3D.getMatchSet().size(); // depends on control dependency: [if], data = [none] } // Fitting homography will work when all or part of the scene is planar or motion is pure rotation int countH = 0; if( ransacH.process(pairs.toList()) ) { countH = ransacH.getMatchSet().size(); // depends on control dependency: [if], data = [none] } // fail if not enough features are remaining after RANSAC if( Math.max(countF,countH) < minimumInliers ) return; // The idea here is that if the number features for F is greater than H then it's a 3D scene. // If they are similar then it might be a plane boolean is3D = countF > countH*ratio3D; PairwiseImageGraph2.Motion edge = graph.edges.grow(); edge.is3D = is3D; edge.countF = countF; edge.countH = countH; edge.index = graph.edges.size-1; edge.src = graph.lookupNode(src); edge.dst = graph.lookupNode(dst); edge.src.connections.add(edge); edge.dst.connections.add(edge); if( is3D ) { saveInlierMatches(ransac3D, matches,edge); // depends on control dependency: [if], data = [none] edge.F.set(ransac3D.getModelParameters()); // depends on control dependency: [if], data = [none] } else { saveInlierMatches(ransacH, matches,edge); // depends on control dependency: [if], data = [none] Homography2D_F64 H = ransacH.getModelParameters(); ConvertDMatrixStruct.convert(H,edge.F); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean isPrimitiveLike(Type t) { if(isNumber(t)) { return true; } if(isBoolean(t)) { return true; } if(isEnum(t)) { return true; } if(isCharacter(t)) { return true; } if(isDate(t)) { return true; } if(t == String.class) { return true; } return false; } }
public class class_name { public static boolean isPrimitiveLike(Type t) { if(isNumber(t)) { return true; // depends on control dependency: [if], data = [none] } if(isBoolean(t)) { return true; // depends on control dependency: [if], data = [none] } if(isEnum(t)) { return true; // depends on control dependency: [if], data = [none] } if(isCharacter(t)) { return true; // depends on control dependency: [if], data = [none] } if(isDate(t)) { return true; // depends on control dependency: [if], data = [none] } if(t == String.class) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private static Currency createCurrency( String commonCode, String name, String unicode, String... alternativeCodes) { CurrencyAttributes attributes = new CurrencyAttributes(commonCode, name, unicode, alternativeCodes); Currency currency = new Currency(commonCode, attributes); for (String code : attributes.codes) { if (commonCode.equals(code)) { // common code will always be part of the currencies map currencies.put(code, currency); } else if (!currencies.containsKey(code)) { // alternative codes will never overwrite common codes currencies.put(code, new Currency(code, attributes)); } } return currency; } }
public class class_name { private static Currency createCurrency( String commonCode, String name, String unicode, String... alternativeCodes) { CurrencyAttributes attributes = new CurrencyAttributes(commonCode, name, unicode, alternativeCodes); Currency currency = new Currency(commonCode, attributes); for (String code : attributes.codes) { if (commonCode.equals(code)) { // common code will always be part of the currencies map currencies.put(code, currency); // depends on control dependency: [if], data = [none] } else if (!currencies.containsKey(code)) { // alternative codes will never overwrite common codes currencies.put(code, new Currency(code, attributes)); // depends on control dependency: [if], data = [none] } } return currency; } }
public class class_name { private static double absDiffOfMeans(double[] A, double[] B, boolean randomize) { Random random = new Random(); double aTotal = 0.0; double bTotal = 0.0; for (int i = 0; i < A.length; i++) { if (randomize && random.nextBoolean()) { aTotal += B[i]; bTotal += A[i]; } else { aTotal += A[i]; bTotal += B[i]; } } double aMean = aTotal / A.length; double bMean = bTotal / B.length; return Math.abs(aMean - bMean); } }
public class class_name { private static double absDiffOfMeans(double[] A, double[] B, boolean randomize) { Random random = new Random(); double aTotal = 0.0; double bTotal = 0.0; for (int i = 0; i < A.length; i++) { if (randomize && random.nextBoolean()) { aTotal += B[i]; // depends on control dependency: [if], data = [none] bTotal += A[i]; // depends on control dependency: [if], data = [none] } else { aTotal += A[i]; // depends on control dependency: [if], data = [none] bTotal += B[i]; // depends on control dependency: [if], data = [none] } } double aMean = aTotal / A.length; double bMean = bTotal / B.length; return Math.abs(aMean - bMean); } }
public class class_name { private boolean matchesServiceUuids(ParcelUuid uuid, ParcelUuid parcelUuidMask, List<ParcelUuid> uuids) { if (uuid == null) { return true; } if (uuids == null) { return false; } for (ParcelUuid parcelUuid : uuids) { UUID uuidMask = parcelUuidMask == null ? null : parcelUuidMask.getUuid(); if (matchesServiceUuid(uuid.getUuid(), uuidMask, parcelUuid.getUuid())) { return true; } } return false; } }
public class class_name { private boolean matchesServiceUuids(ParcelUuid uuid, ParcelUuid parcelUuidMask, List<ParcelUuid> uuids) { if (uuid == null) { return true; // depends on control dependency: [if], data = [none] } if (uuids == null) { return false; // depends on control dependency: [if], data = [none] } for (ParcelUuid parcelUuid : uuids) { UUID uuidMask = parcelUuidMask == null ? null : parcelUuidMask.getUuid(); if (matchesServiceUuid(uuid.getUuid(), uuidMask, parcelUuid.getUuid())) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public <E> List<E> find(Class<E> entityClass, Map<String, String> superColumnMap, CassandraDataHandler dataHandler) { List<E> entities = null; String entityId = null; try { EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, getPersistenceUnit(), entityClass); entities = new ArrayList<E>(); for (String superColumnName : superColumnMap.keySet()) { entityId = superColumnMap.get(superColumnName); List<SuperColumn> superColumnList = loadSuperColumns(entityMetadata.getSchema(), entityMetadata.getTableName(), entityId, new String[] { superColumnName.substring(0, superColumnName.indexOf("|")) }); E e = (E) dataHandler.fromThriftRow(entityMetadata.getEntityClazz(), entityMetadata, new DataRow<SuperColumn>(entityId, entityMetadata.getTableName(), superColumnList)); if (e != null) { entities.add(e); } } } catch (Exception e) { log.error("Error while retrieving records from database for entity {} and key {}, Caused by: . ", entityClass, entityId, e); throw new KunderaException(e); } return entities; } }
public class class_name { public <E> List<E> find(Class<E> entityClass, Map<String, String> superColumnMap, CassandraDataHandler dataHandler) { List<E> entities = null; String entityId = null; try { EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, getPersistenceUnit(), entityClass); entities = new ArrayList<E>(); // depends on control dependency: [try], data = [none] for (String superColumnName : superColumnMap.keySet()) { entityId = superColumnMap.get(superColumnName); // depends on control dependency: [for], data = [superColumnName] List<SuperColumn> superColumnList = loadSuperColumns(entityMetadata.getSchema(), entityMetadata.getTableName(), entityId, new String[] { superColumnName.substring(0, superColumnName.indexOf("|")) }); E e = (E) dataHandler.fromThriftRow(entityMetadata.getEntityClazz(), entityMetadata, new DataRow<SuperColumn>(entityId, entityMetadata.getTableName(), superColumnList)); if (e != null) { entities.add(e); // depends on control dependency: [if], data = [(e] } } } catch (Exception e) { log.error("Error while retrieving records from database for entity {} and key {}, Caused by: . ", entityClass, entityId, e); throw new KunderaException(e); } // depends on control dependency: [catch], data = [none] return entities; } }
public class class_name { private File getTempFolder(String tempPath) { if (tempPath != null) { File folder = new File(tempPath); if (folder.exists()) { return folder; } } return null; } }
public class class_name { private File getTempFolder(String tempPath) { if (tempPath != null) { File folder = new File(tempPath); if (folder.exists()) { return folder; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public String sql() { if (sb == null) { throw new AbacusException("This SQLBuilder has been closed after sql() was called previously"); } init(true); String sql = null; try { sql = sb.toString(); } finally { Objectory.recycle(sb); sb = null; activeStringBuilderCounter.decrementAndGet(); } if (logger.isDebugEnabled()) { logger.debug(sql); } return sql; } }
public class class_name { public String sql() { if (sb == null) { throw new AbacusException("This SQLBuilder has been closed after sql() was called previously"); } init(true); String sql = null; try { sql = sb.toString(); // depends on control dependency: [try], data = [none] } finally { Objectory.recycle(sb); sb = null; activeStringBuilderCounter.decrementAndGet(); } if (logger.isDebugEnabled()) { logger.debug(sql); // depends on control dependency: [if], data = [none] } return sql; } }
public class class_name { @VisibleForTesting void removeAllCacheEntries() { List<CacheEntry> entries; synchronized (this.cacheEntries) { entries = new ArrayList<>(this.cacheEntries.values()); this.cacheEntries.clear(); } removeFromCache(entries); if (entries.size() > 0) { log.debug("{}: Cleared all cache entries ({}).", this.traceObjectId, entries.size()); } } }
public class class_name { @VisibleForTesting void removeAllCacheEntries() { List<CacheEntry> entries; synchronized (this.cacheEntries) { entries = new ArrayList<>(this.cacheEntries.values()); this.cacheEntries.clear(); } removeFromCache(entries); if (entries.size() > 0) { log.debug("{}: Cleared all cache entries ({}).", this.traceObjectId, entries.size()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void setCurrentTraceId(String id) { if (id == null) { traceId.remove(); } else { traceId.set(id); } } }
public class class_name { public static void setCurrentTraceId(String id) { if (id == null) { traceId.remove(); // depends on control dependency: [if], data = [none] } else { traceId.set(id); // depends on control dependency: [if], data = [(id] } } }
public class class_name { protected static long getId4UUID(final UUID _typeUUID) throws CacheReloadException { long ret = 0; final Cache<UUID, Type> cache = InfinispanCache.get().<UUID, Type>getCache(Type.UUIDCACHE); if (cache.containsKey(_typeUUID)) { ret = cache.get(_typeUUID).getId(); } else { Connection con = null; try { con = Context.getConnection(); PreparedStatement stmt = null; try { stmt = con.prepareStatement(Type.SQL_UUID); stmt.setObject(1, _typeUUID.toString()); final ResultSet rs = stmt.executeQuery(); while (rs.next()) { ret = rs.getLong(1); } rs.close(); } finally { if (stmt != null) { stmt.close(); } } con.commit(); } catch (final SQLException e) { throw new CacheReloadException("could not read child type ids", e); } catch (final EFapsException e) { throw new CacheReloadException("could not read child type ids", e); } finally { try { if (con != null && !con.isClosed()) { con.close(); } } catch (final SQLException e) { throw new CacheReloadException("could not read child type ids", e); } } } return ret; } }
public class class_name { protected static long getId4UUID(final UUID _typeUUID) throws CacheReloadException { long ret = 0; final Cache<UUID, Type> cache = InfinispanCache.get().<UUID, Type>getCache(Type.UUIDCACHE); if (cache.containsKey(_typeUUID)) { ret = cache.get(_typeUUID).getId(); } else { Connection con = null; try { con = Context.getConnection(); // depends on control dependency: [try], data = [none] PreparedStatement stmt = null; try { stmt = con.prepareStatement(Type.SQL_UUID); // depends on control dependency: [try], data = [none] stmt.setObject(1, _typeUUID.toString()); // depends on control dependency: [try], data = [none] final ResultSet rs = stmt.executeQuery(); while (rs.next()) { ret = rs.getLong(1); // depends on control dependency: [while], data = [none] } rs.close(); // depends on control dependency: [try], data = [none] } finally { if (stmt != null) { stmt.close(); // depends on control dependency: [if], data = [none] } } con.commit(); // depends on control dependency: [try], data = [none] } catch (final SQLException e) { throw new CacheReloadException("could not read child type ids", e); } catch (final EFapsException e) { // depends on control dependency: [catch], data = [none] throw new CacheReloadException("could not read child type ids", e); } finally { // depends on control dependency: [catch], data = [none] try { if (con != null && !con.isClosed()) { con.close(); // depends on control dependency: [if], data = [none] } } catch (final SQLException e) { throw new CacheReloadException("could not read child type ids", e); } // depends on control dependency: [catch], data = [none] } } return ret; } }
public class class_name { @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof DataSource) { // on ne teste isExcludedDataSource que si on est sur une datasource if (isExcludedDataSource(beanName) || Parameters.isNoDatabase() || isDelegatingDataSourceAndAlreadyProxied(bean, beanName)) { return bean; } final DataSource dataSource = (DataSource) bean; JdbcWrapper.registerSpringDataSource(beanName, dataSource); final DataSource result = JdbcWrapper.SINGLETON.createDataSourceProxy(beanName, dataSource); LOG.debug("Spring datasource wrapped: " + beanName); return result; } else if (bean instanceof JndiObjectFactoryBean) { // ou sur un JndiObjectFactoryBean if (isExcludedDataSource(beanName) || Parameters.isNoDatabase()) { return bean; } // fix issue 20 final Object result = createProxy(bean, beanName); LOG.debug("Spring JNDI factory wrapped: " + beanName); return result; } // I tried here in the post-processor to fix "quartz jobs which are scheduled with spring // are not displayed in javamelody, except if there is the following property for // SchedulerFactoryBean in spring xml: // <property name="exposeSchedulerInRepository" value="true" /> ", // but I had some problem with Spring creating the scheduler // twice and so registering the scheduler in SchedulerRepository with the same name // as the one registered below (and Quartz wants not) // else if (bean != null // && "org.springframework.scheduling.quartz.SchedulerFactoryBean".equals(bean // .getClass().getName())) { // try { // // Remarque: on ajoute nous même le scheduler de Spring dans le SchedulerRepository // // de Quartz, car l'appel ici de schedulerFactoryBean.setExposeSchedulerInRepository(true) // // est trop tard et ne fonctionnerait pas // final Method method = bean.getClass().getMethod("getScheduler", (Class<?>[]) null); // final Scheduler scheduler = (Scheduler) method.invoke(bean, (Object[]) null); // // final SchedulerRepository schedulerRepository = SchedulerRepository.getInstance(); // synchronized (schedulerRepository) { // if (schedulerRepository.lookup(scheduler.getSchedulerName()) == null) { // schedulerRepository.bind(scheduler); // scheduler.addGlobalJobListener(new JobGlobalListener()); // } // } // } catch (final NoSuchMethodException e) { // // si la méthode n'existe pas (avant spring 2.5.6), alors cela marche sans rien faire // return bean; // } catch (final InvocationTargetException e) { // // tant pis // return bean; // } catch (final IllegalAccessException e) { // // tant pis // return bean; // } catch (SchedulerException e) { // // tant pis // return bean; // } // } return bean; } }
public class class_name { @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof DataSource) { // on ne teste isExcludedDataSource que si on est sur une datasource if (isExcludedDataSource(beanName) || Parameters.isNoDatabase() || isDelegatingDataSourceAndAlreadyProxied(bean, beanName)) { return bean; // depends on control dependency: [if], data = [none] } final DataSource dataSource = (DataSource) bean; JdbcWrapper.registerSpringDataSource(beanName, dataSource); // depends on control dependency: [if], data = [none] final DataSource result = JdbcWrapper.SINGLETON.createDataSourceProxy(beanName, dataSource); LOG.debug("Spring datasource wrapped: " + beanName); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } else if (bean instanceof JndiObjectFactoryBean) { // ou sur un JndiObjectFactoryBean if (isExcludedDataSource(beanName) || Parameters.isNoDatabase()) { return bean; // depends on control dependency: [if], data = [none] } // fix issue 20 final Object result = createProxy(bean, beanName); LOG.debug("Spring JNDI factory wrapped: " + beanName); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } // I tried here in the post-processor to fix "quartz jobs which are scheduled with spring // are not displayed in javamelody, except if there is the following property for // SchedulerFactoryBean in spring xml: // <property name="exposeSchedulerInRepository" value="true" /> ", // but I had some problem with Spring creating the scheduler // twice and so registering the scheduler in SchedulerRepository with the same name // as the one registered below (and Quartz wants not) // else if (bean != null // && "org.springframework.scheduling.quartz.SchedulerFactoryBean".equals(bean // .getClass().getName())) { // try { // // Remarque: on ajoute nous même le scheduler de Spring dans le SchedulerRepository // // de Quartz, car l'appel ici de schedulerFactoryBean.setExposeSchedulerInRepository(true) // // est trop tard et ne fonctionnerait pas // final Method method = bean.getClass().getMethod("getScheduler", (Class<?>[]) null); // final Scheduler scheduler = (Scheduler) method.invoke(bean, (Object[]) null); // // final SchedulerRepository schedulerRepository = SchedulerRepository.getInstance(); // synchronized (schedulerRepository) { // if (schedulerRepository.lookup(scheduler.getSchedulerName()) == null) { // schedulerRepository.bind(scheduler); // scheduler.addGlobalJobListener(new JobGlobalListener()); // } // } // } catch (final NoSuchMethodException e) { // // si la méthode n'existe pas (avant spring 2.5.6), alors cela marche sans rien faire // return bean; // } catch (final InvocationTargetException e) { // // tant pis // return bean; // } catch (final IllegalAccessException e) { // // tant pis // return bean; // } catch (SchedulerException e) { // // tant pis // return bean; // } // } return bean; } }
public class class_name { public int compareTo(WordTag wordTag) { int first = (word != null ? word().compareTo(wordTag.word()) : 0); if(first != 0) return first; else { if (tag() == null) { if (wordTag.tag() == null) return 0; else return -1; } return tag().compareTo(wordTag.tag()); } } }
public class class_name { public int compareTo(WordTag wordTag) { int first = (word != null ? word().compareTo(wordTag.word()) : 0); if(first != 0) return first; else { if (tag() == null) { if (wordTag.tag() == null) return 0; else return -1; } return tag().compareTo(wordTag.tag()); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void reconfigure() { // Update the messaging client this.logger.info( "Reconfiguration requested in the DM." ); if( this.messagingClient != null ) { this.messagingClient.setDomain( this.domain ); this.messagingClient.switchMessagingType( this.messagingType ); try { if( this.messagingClient.isConnected()) this.messagingClient.listenToTheDm( ListenerCommand.START ); } catch ( IOException e ) { this.logger.log( Level.WARNING, "Cannot start to listen to the debug queue", e ); } } // We must update instance states after we switched the messaging configuration. restoreAllInstances(); this.logger.info( "The DM was successfully (re)configured." ); } }
public class class_name { @Override public void reconfigure() { // Update the messaging client this.logger.info( "Reconfiguration requested in the DM." ); if( this.messagingClient != null ) { this.messagingClient.setDomain( this.domain ); // depends on control dependency: [if], data = [none] this.messagingClient.switchMessagingType( this.messagingType ); // depends on control dependency: [if], data = [none] try { if( this.messagingClient.isConnected()) this.messagingClient.listenToTheDm( ListenerCommand.START ); } catch ( IOException e ) { this.logger.log( Level.WARNING, "Cannot start to listen to the debug queue", e ); } // depends on control dependency: [catch], data = [none] } // We must update instance states after we switched the messaging configuration. restoreAllInstances(); this.logger.info( "The DM was successfully (re)configured." ); } }
public class class_name { private synchronized void endLookup(Map<String, String> pending, String name) { String canonical = pending.remove(name); if (canonical != null) { canonical.notifyAll(); } } }
public class class_name { private synchronized void endLookup(Map<String, String> pending, String name) { String canonical = pending.remove(name); if (canonical != null) { canonical.notifyAll(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int consistentHash(long input, int buckets) { checkArgument(buckets > 0, "buckets must be positive: %s", buckets); LinearCongruentialGenerator generator = new LinearCongruentialGenerator(input); int candidate = 0; int next; // Jump from bucket to bucket until we go out of range while (true) { next = (int) ((candidate + 1) / generator.nextDouble()); if (next >= 0 && next < buckets) { candidate = next; } else { return candidate; } } } }
public class class_name { public static int consistentHash(long input, int buckets) { checkArgument(buckets > 0, "buckets must be positive: %s", buckets); LinearCongruentialGenerator generator = new LinearCongruentialGenerator(input); int candidate = 0; int next; // Jump from bucket to bucket until we go out of range while (true) { next = (int) ((candidate + 1) / generator.nextDouble()); // depends on control dependency: [while], data = [none] if (next >= 0 && next < buckets) { candidate = next; // depends on control dependency: [if], data = [none] } else { return candidate; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public java.util.List<java.nio.ByteBuffer> getBinaryListValues() { if (binaryListValues == null) { binaryListValues = new com.amazonaws.internal.SdkInternalList<java.nio.ByteBuffer>(); } return binaryListValues; } }
public class class_name { public java.util.List<java.nio.ByteBuffer> getBinaryListValues() { if (binaryListValues == null) { binaryListValues = new com.amazonaws.internal.SdkInternalList<java.nio.ByteBuffer>(); // depends on control dependency: [if], data = [none] } return binaryListValues; } }
public class class_name { @Override public void dump(FormattedWriter fw, String arg) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dump", arg); if (arg != null) { if (arg.equalsIgnoreCase("raw")) { dumpRaw(fw); } else if (arg.equalsIgnoreCase("all")) { dumpAll(fw); } else { dump(fw); } } else { dump(fw); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dump"); } }
public class class_name { @Override public void dump(FormattedWriter fw, String arg) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dump", arg); if (arg != null) { if (arg.equalsIgnoreCase("raw")) { dumpRaw(fw); // depends on control dependency: [if], data = [none] } else if (arg.equalsIgnoreCase("all")) { dumpAll(fw); // depends on control dependency: [if], data = [none] } else { dump(fw); // depends on control dependency: [if], data = [none] } } else { dump(fw); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dump"); } }
public class class_name { public ListGroupResourcesResult withQueryErrors(QueryError... queryErrors) { if (this.queryErrors == null) { setQueryErrors(new java.util.ArrayList<QueryError>(queryErrors.length)); } for (QueryError ele : queryErrors) { this.queryErrors.add(ele); } return this; } }
public class class_name { public ListGroupResourcesResult withQueryErrors(QueryError... queryErrors) { if (this.queryErrors == null) { setQueryErrors(new java.util.ArrayList<QueryError>(queryErrors.length)); // depends on control dependency: [if], data = [none] } for (QueryError ele : queryErrors) { this.queryErrors.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private static String toSource( Node root, Format outputFormat, CompilerOptions options, SourceMap sourceMap, boolean tagAsTypeSummary, boolean tagAsStrict, boolean lineBreak, CodeGeneratorFactory codeGeneratorFactory) { checkState(options.sourceMapDetailLevel != null); boolean createSourceMap = (sourceMap != null); MappedCodePrinter mcp = outputFormat == Format.COMPACT ? new CompactCodePrinter( lineBreak, options.preferLineBreakAtEndOfFile, options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel) : new PrettyCodePrinter( options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel); CodeGenerator cg = codeGeneratorFactory.getCodeGenerator(outputFormat, mcp); if (tagAsTypeSummary) { cg.tagAsTypeSummary(); } if (tagAsStrict) { cg.tagAsStrict(); } cg.add(root); mcp.endFile(); String code = mcp.getCode(); if (createSourceMap) { mcp.generateSourceMap(code, sourceMap); } return code; } }
public class class_name { private static String toSource( Node root, Format outputFormat, CompilerOptions options, SourceMap sourceMap, boolean tagAsTypeSummary, boolean tagAsStrict, boolean lineBreak, CodeGeneratorFactory codeGeneratorFactory) { checkState(options.sourceMapDetailLevel != null); boolean createSourceMap = (sourceMap != null); MappedCodePrinter mcp = outputFormat == Format.COMPACT ? new CompactCodePrinter( lineBreak, options.preferLineBreakAtEndOfFile, options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel) : new PrettyCodePrinter( options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel); CodeGenerator cg = codeGeneratorFactory.getCodeGenerator(outputFormat, mcp); if (tagAsTypeSummary) { cg.tagAsTypeSummary(); // depends on control dependency: [if], data = [none] } if (tagAsStrict) { cg.tagAsStrict(); // depends on control dependency: [if], data = [none] } cg.add(root); mcp.endFile(); String code = mcp.getCode(); if (createSourceMap) { mcp.generateSourceMap(code, sourceMap); // depends on control dependency: [if], data = [none] } return code; } }
public class class_name { public CreateReplicationGroupRequest withPreferredCacheClusterAZs(String... preferredCacheClusterAZs) { if (this.preferredCacheClusterAZs == null) { setPreferredCacheClusterAZs(new com.amazonaws.internal.SdkInternalList<String>(preferredCacheClusterAZs.length)); } for (String ele : preferredCacheClusterAZs) { this.preferredCacheClusterAZs.add(ele); } return this; } }
public class class_name { public CreateReplicationGroupRequest withPreferredCacheClusterAZs(String... preferredCacheClusterAZs) { if (this.preferredCacheClusterAZs == null) { setPreferredCacheClusterAZs(new com.amazonaws.internal.SdkInternalList<String>(preferredCacheClusterAZs.length)); // depends on control dependency: [if], data = [none] } for (String ele : preferredCacheClusterAZs) { this.preferredCacheClusterAZs.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public boolean start(final FileDownloadListener listener, final boolean isSerial) { if (listener == null) { Util.w(TAG, "Tasks with the listener can't start, because the listener " + "provided is null: [null, " + isSerial + "]"); return false; } List<DownloadTaskAdapter> originalTasks = FileDownloadList.getImpl().assembleTasksToStart(listener); if (originalTasks.isEmpty()) { Util.w(TAG, "no task for listener: " + listener + " to start"); return false; } ArrayList<DownloadTask> downloadTasks = new ArrayList<>(); for (DownloadTaskAdapter task : originalTasks) { downloadTasks.add(task.getDownloadTask()); } final DownloadContext downloadContext = new DownloadContext.Builder(new DownloadContext.QueueSet(), downloadTasks) .setListener(new DownloadContextListener() { @Override public void taskEnd(@NonNull DownloadContext context, @NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, int remainCount) { Util.d(TAG, "task " + task.getId() + "end"); final DownloadTaskAdapter downloadTaskAdapter = FileDownloadUtils.findDownloadTaskAdapter(task); if (downloadTaskAdapter != null) { FileDownloadList.getImpl().remove(downloadTaskAdapter); } } @Override public void queueEnd(@NonNull DownloadContext context) { Util.d(TAG, "queue end"); } }) .build(); final CompatListenerAdapter compatListenerAdapter = CompatListenerAdapter.create(listener); downloadContext.start(compatListenerAdapter, isSerial); return true; } }
public class class_name { public boolean start(final FileDownloadListener listener, final boolean isSerial) { if (listener == null) { Util.w(TAG, "Tasks with the listener can't start, because the listener " + "provided is null: [null, " + isSerial + "]"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } List<DownloadTaskAdapter> originalTasks = FileDownloadList.getImpl().assembleTasksToStart(listener); if (originalTasks.isEmpty()) { Util.w(TAG, "no task for listener: " + listener + " to start"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } ArrayList<DownloadTask> downloadTasks = new ArrayList<>(); for (DownloadTaskAdapter task : originalTasks) { downloadTasks.add(task.getDownloadTask()); // depends on control dependency: [for], data = [task] } final DownloadContext downloadContext = new DownloadContext.Builder(new DownloadContext.QueueSet(), downloadTasks) .setListener(new DownloadContextListener() { @Override public void taskEnd(@NonNull DownloadContext context, @NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, int remainCount) { Util.d(TAG, "task " + task.getId() + "end"); final DownloadTaskAdapter downloadTaskAdapter = FileDownloadUtils.findDownloadTaskAdapter(task); if (downloadTaskAdapter != null) { FileDownloadList.getImpl().remove(downloadTaskAdapter); // depends on control dependency: [if], data = [(downloadTaskAdapter] } } @Override public void queueEnd(@NonNull DownloadContext context) { Util.d(TAG, "queue end"); } }) .build(); final CompatListenerAdapter compatListenerAdapter = CompatListenerAdapter.create(listener); downloadContext.start(compatListenerAdapter, isSerial); return true; } }
public class class_name { @SuppressWarnings("unchecked") Entry<K,V> removeMapping(Object o) { if (!(o instanceof Map.Entry)) return null; Map.Entry<K,V> entry = (Map.Entry<K,V>)o; Object k = maskNull(entry.getKey()); int hash = hash(k); int i = indexFor(hash, table.length); Entry<K,V> prev = table[i]; Entry<K,V> e = prev; while (e != null) { Entry<K,V> next = e.next; if (e.hash == hash && validEntry(e) && e.equals(entry)) { if (auto_commit) { modCount++; size--; if (prev == e) table[i] = next; else prev.next = next; } else e.setStatus(Entry.DELETED, getCurrentThreadId()); return e; } prev = e; e = next; } return e; } }
public class class_name { @SuppressWarnings("unchecked") Entry<K,V> removeMapping(Object o) { if (!(o instanceof Map.Entry)) return null; Map.Entry<K,V> entry = (Map.Entry<K,V>)o; Object k = maskNull(entry.getKey()); int hash = hash(k); int i = indexFor(hash, table.length); Entry<K,V> prev = table[i]; Entry<K,V> e = prev; while (e != null) { Entry<K,V> next = e.next; if (e.hash == hash && validEntry(e) && e.equals(entry)) { if (auto_commit) { modCount++; // depends on control dependency: [if], data = [none] size--; // depends on control dependency: [if], data = [none] if (prev == e) table[i] = next; else prev.next = next; } else e.setStatus(Entry.DELETED, getCurrentThreadId()); return e; // depends on control dependency: [if], data = [none] } prev = e; // depends on control dependency: [while], data = [none] e = next; // depends on control dependency: [while], data = [none] } return e; } }
public class class_name { public void findEdgesInShape(final GHIntHashSet edgeIds, final Shape shape, EdgeFilter filter) { GHPoint center = shape.getCenter(); QueryResult qr = locationIndex.findClosest(center.getLat(), center.getLon(), filter); // TODO: if there is no street close to the center it'll fail although there are roads covered. Maybe we should check edge points or some random points in the Shape instead? if (!qr.isValid()) throw new IllegalArgumentException("Shape " + shape + " does not cover graph"); if (shape.contains(qr.getSnappedPoint().lat, qr.getSnappedPoint().lon)) edgeIds.add(qr.getClosestEdge().getEdge()); final boolean isPolygon = shape instanceof Polygon; BreadthFirstSearch bfs = new BreadthFirstSearch() { final NodeAccess na = graph.getNodeAccess(); final Shape localShape = shape; @Override protected boolean goFurther(int nodeId) { if (isPolygon) return isInsideBBox(nodeId); return localShape.contains(na.getLatitude(nodeId), na.getLongitude(nodeId)); } @Override protected boolean checkAdjacent(EdgeIteratorState edge) { int adjNodeId = edge.getAdjNode(); if (localShape.contains(na.getLatitude(adjNodeId), na.getLongitude(adjNodeId))) { edgeIds.add(edge.getEdge()); return true; } return isPolygon && isInsideBBox(adjNodeId); } private boolean isInsideBBox(int nodeId) { BBox bbox = localShape.getBounds(); double lat = na.getLatitude(nodeId); double lon = na.getLongitude(nodeId); return lat <= bbox.maxLat && lat >= bbox.minLat && lon <= bbox.maxLon && lon >= bbox.minLon; } }; bfs.start(graph.createEdgeExplorer(filter), qr.getClosestNode()); } }
public class class_name { public void findEdgesInShape(final GHIntHashSet edgeIds, final Shape shape, EdgeFilter filter) { GHPoint center = shape.getCenter(); QueryResult qr = locationIndex.findClosest(center.getLat(), center.getLon(), filter); // TODO: if there is no street close to the center it'll fail although there are roads covered. Maybe we should check edge points or some random points in the Shape instead? if (!qr.isValid()) throw new IllegalArgumentException("Shape " + shape + " does not cover graph"); if (shape.contains(qr.getSnappedPoint().lat, qr.getSnappedPoint().lon)) edgeIds.add(qr.getClosestEdge().getEdge()); final boolean isPolygon = shape instanceof Polygon; BreadthFirstSearch bfs = new BreadthFirstSearch() { final NodeAccess na = graph.getNodeAccess(); final Shape localShape = shape; @Override protected boolean goFurther(int nodeId) { if (isPolygon) return isInsideBBox(nodeId); return localShape.contains(na.getLatitude(nodeId), na.getLongitude(nodeId)); } @Override protected boolean checkAdjacent(EdgeIteratorState edge) { int adjNodeId = edge.getAdjNode(); if (localShape.contains(na.getLatitude(adjNodeId), na.getLongitude(adjNodeId))) { edgeIds.add(edge.getEdge()); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return isPolygon && isInsideBBox(adjNodeId); } private boolean isInsideBBox(int nodeId) { BBox bbox = localShape.getBounds(); double lat = na.getLatitude(nodeId); double lon = na.getLongitude(nodeId); return lat <= bbox.maxLat && lat >= bbox.minLat && lon <= bbox.maxLon && lon >= bbox.minLon; } }; bfs.start(graph.createEdgeExplorer(filter), qr.getClosestNode()); } }
public class class_name { public String getPagePath() { if (pageReference != null && !pageReference.isEmpty()) { return page + PAGE_SEPARATOR + pageReference; } else { return page; } } }
public class class_name { public String getPagePath() { if (pageReference != null && !pageReference.isEmpty()) { return page + PAGE_SEPARATOR + pageReference; // depends on control dependency: [if], data = [none] } else { return page; // depends on control dependency: [if], data = [none] } } }
public class class_name { public Collection<T> createAll(final Object... arguments) { Collection<T> instances = new ArrayList<T>(classes.size()); for (String className : classes) { T instance = createInstance(className, arguments); if (instance != null) { instances.add(instance); } } return instances; } }
public class class_name { public Collection<T> createAll(final Object... arguments) { Collection<T> instances = new ArrayList<T>(classes.size()); for (String className : classes) { T instance = createInstance(className, arguments); if (instance != null) { instances.add(instance); // depends on control dependency: [if], data = [(instance] } } return instances; } }
public class class_name { public void uncheck() { getDispatcher().beforeUncheck(this); RemoteWebElement e = (RemoteWebElement) getElement(); while (e.isSelected()) { e.click(); } if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) { logUIAction(UIActions.UNCHECKED); } getDispatcher().afterUncheck(this); } }
public class class_name { public void uncheck() { getDispatcher().beforeUncheck(this); RemoteWebElement e = (RemoteWebElement) getElement(); while (e.isSelected()) { e.click(); // depends on control dependency: [while], data = [none] } if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) { logUIAction(UIActions.UNCHECKED); // depends on control dependency: [if], data = [none] } getDispatcher().afterUncheck(this); } }
public class class_name { @Override public DurationFormatterFactory setPeriodFormatter( PeriodFormatter formatter) { if (formatter != this.formatter) { this.formatter = formatter; reset(); } return this; } }
public class class_name { @Override public DurationFormatterFactory setPeriodFormatter( PeriodFormatter formatter) { if (formatter != this.formatter) { this.formatter = formatter; // depends on control dependency: [if], data = [none] reset(); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public static List<Parameter> collectConstructorParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes) { if (cls.isLocalClass() || (cls.isMemberClass() && !Modifier.isStatic(cls.getModifiers()))) { return Collections.emptyList(); } List<Parameter> selected = Collections.emptyList(); int maxParamsCount = 0; for (Constructor<?> constructor : cls.getDeclaredConstructors()) { if (!ReflectionUtils.isConstructorCompatible(constructor) && !ReflectionUtils.isInject(Arrays.asList(constructor.getDeclaredAnnotations()))) { continue; } final Type[] genericParameterTypes = constructor.getGenericParameterTypes(); final Annotation[][] annotations = constructor.getParameterAnnotations(); int paramsCount = 0; final List<Parameter> parameters = new ArrayList<Parameter>(); for (int i = 0; i < genericParameterTypes.length; i++) { final List<Annotation> tmpAnnotations = Arrays.asList(annotations[i]); if (isContext(tmpAnnotations)) { paramsCount++; } else { final Type genericParameterType = genericParameterTypes[i]; final List<Parameter> tmpParameters = collectParameters(genericParameterType, tmpAnnotations, components, classConsumes); if (tmpParameters.size() >= 1) { for (Parameter tmpParameter : tmpParameters) { if (ParameterProcessor.applyAnnotations( tmpParameter, genericParameterType, tmpAnnotations, components, classConsumes == null ? new String[0] : classConsumes.value(), null) != null) { parameters.add(tmpParameter); } } paramsCount++; } } } if (paramsCount >= maxParamsCount) { maxParamsCount = paramsCount; selected = parameters; } } return selected; } }
public class class_name { public static List<Parameter> collectConstructorParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes) { if (cls.isLocalClass() || (cls.isMemberClass() && !Modifier.isStatic(cls.getModifiers()))) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<Parameter> selected = Collections.emptyList(); int maxParamsCount = 0; for (Constructor<?> constructor : cls.getDeclaredConstructors()) { if (!ReflectionUtils.isConstructorCompatible(constructor) && !ReflectionUtils.isInject(Arrays.asList(constructor.getDeclaredAnnotations()))) { continue; } final Type[] genericParameterTypes = constructor.getGenericParameterTypes(); final Annotation[][] annotations = constructor.getParameterAnnotations(); int paramsCount = 0; final List<Parameter> parameters = new ArrayList<Parameter>(); for (int i = 0; i < genericParameterTypes.length; i++) { final List<Annotation> tmpAnnotations = Arrays.asList(annotations[i]); if (isContext(tmpAnnotations)) { paramsCount++; // depends on control dependency: [if], data = [none] } else { final Type genericParameterType = genericParameterTypes[i]; final List<Parameter> tmpParameters = collectParameters(genericParameterType, tmpAnnotations, components, classConsumes); if (tmpParameters.size() >= 1) { for (Parameter tmpParameter : tmpParameters) { if (ParameterProcessor.applyAnnotations( tmpParameter, genericParameterType, tmpAnnotations, components, classConsumes == null ? new String[0] : classConsumes.value(), null) != null) { parameters.add(tmpParameter); // depends on control dependency: [if], data = [none] } } paramsCount++; // depends on control dependency: [if], data = [none] } } } if (paramsCount >= maxParamsCount) { maxParamsCount = paramsCount; // depends on control dependency: [if], data = [none] selected = parameters; // depends on control dependency: [if], data = [none] } } return selected; } }
public class class_name { @Override public void shutdown() { try { verifyMaintainability(); } catch (VerificationFailedException ex) { throw new RuntimeException("Can not shutdown " + this + "!", ex); } this.shutdownInitiated = true; try { dataObservable.shutdown(); } finally { try { deactivate(); } catch (CouldNotPerformException | InterruptedException ex) { ExceptionPrinter.printHistory("Could not shutdown " + this + "!", ex, logger); } } } }
public class class_name { @Override public void shutdown() { try { verifyMaintainability(); // depends on control dependency: [try], data = [none] } catch (VerificationFailedException ex) { throw new RuntimeException("Can not shutdown " + this + "!", ex); } // depends on control dependency: [catch], data = [none] this.shutdownInitiated = true; try { dataObservable.shutdown(); // depends on control dependency: [try], data = [none] } finally { try { deactivate(); // depends on control dependency: [try], data = [none] } catch (CouldNotPerformException | InterruptedException ex) { ExceptionPrinter.printHistory("Could not shutdown " + this + "!", ex, logger); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private void clearEdit() { m_fileTable.setEditable(false); if (m_editItemId != null) { updateItem(m_editItemId, false); } m_editItemId = null; m_editProperty = null; m_editHandler = null; updateSorting(); } }
public class class_name { private void clearEdit() { m_fileTable.setEditable(false); if (m_editItemId != null) { updateItem(m_editItemId, false); // depends on control dependency: [if], data = [(m_editItemId] } m_editItemId = null; m_editProperty = null; m_editHandler = null; updateSorting(); } }
public class class_name { public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; } int ix = (start+count)%buffer.length; buffer[ix] = record; if (count < buffer.length) { count++; } else { start++; start %= buffer.length; } if (record.getLevel().intValue() >= pushLevel.intValue()) { push(); } } }
public class class_name { public synchronized void publish(LogRecord record) { if (!isLoggable(record)) { return; // depends on control dependency: [if], data = [none] } int ix = (start+count)%buffer.length; buffer[ix] = record; if (count < buffer.length) { count++; // depends on control dependency: [if], data = [none] } else { start++; // depends on control dependency: [if], data = [none] start %= buffer.length; // depends on control dependency: [if], data = [none] } if (record.getLevel().intValue() >= pushLevel.intValue()) { push(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String join(Collection strings, String delimiter) { StringBuilder builder = new StringBuilder(); Iterator<String> iter = strings.iterator(); while (iter.hasNext()) { builder.append(iter.next()); if (!iter.hasNext()) { break; } builder.append(delimiter); } return builder.toString(); } }
public class class_name { public static String join(Collection strings, String delimiter) { StringBuilder builder = new StringBuilder(); Iterator<String> iter = strings.iterator(); while (iter.hasNext()) { builder.append(iter.next()); // depends on control dependency: [while], data = [none] if (!iter.hasNext()) { break; } builder.append(delimiter); // depends on control dependency: [while], data = [none] } return builder.toString(); } }
public class class_name { protected String getMetricNamePrefix(Map<String, Object> tags){ String currentContextName = (String) tags.get(MetricContext.METRIC_CONTEXT_NAME_TAG_NAME); if (metricContextName == null || (currentContextName.indexOf(metricContextName) > -1)) { return currentContextName; } return JOINER.join(Strings.emptyToNull(metricsPrefix), metricContextName, tags.get("taskId"), tags.get("forkBranchName"), tags.get("class")); } }
public class class_name { protected String getMetricNamePrefix(Map<String, Object> tags){ String currentContextName = (String) tags.get(MetricContext.METRIC_CONTEXT_NAME_TAG_NAME); if (metricContextName == null || (currentContextName.indexOf(metricContextName) > -1)) { return currentContextName; // depends on control dependency: [if], data = [none] } return JOINER.join(Strings.emptyToNull(metricsPrefix), metricContextName, tags.get("taskId"), tags.get("forkBranchName"), tags.get("class")); } }