code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static int copy(Reader in, Writer out) throws IOException { assert in != null : "No input Reader specified"; assert out != null : "No output Writer specified"; try { int byteCount = 0; char[] buffer = new char[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); byteCount += bytesRead; } out.flush(); return byteCount; } finally { try { in.close(); } catch (IOException ex) { } try { out.close(); } catch (IOException ex) { } } } }
public class class_name { public static int copy(Reader in, Writer out) throws IOException { assert in != null : "No input Reader specified"; assert out != null : "No output Writer specified"; try { int byteCount = 0; char[] buffer = new char[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); // depends on control dependency: [while], data = [none] byteCount += bytesRead; // depends on control dependency: [while], data = [none] } out.flush(); return byteCount; } finally { try { in.close(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { } // depends on control dependency: [catch], data = [none] try { out.close(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static String getConfigParam(String key, String defaultValue) { if (config == null) { init(null); } if (StringUtils.isBlank(key)) { return defaultValue; } String keyVar = key.replaceAll("\\.", "_"); String env = System.getenv(keyVar) == null ? System.getenv(PARA + "_" + keyVar) : System.getenv(keyVar); String sys = System.getProperty(key, System.getProperty(PARA + "." + key)); if (!StringUtils.isBlank(sys)) { return sys; } else if (!StringUtils.isBlank(env)) { return env; } else { return (!StringUtils.isBlank(key) && config.hasPath(key)) ? config.getString(key) : defaultValue; } } }
public class class_name { public static String getConfigParam(String key, String defaultValue) { if (config == null) { init(null); // depends on control dependency: [if], data = [null)] } if (StringUtils.isBlank(key)) { return defaultValue; // depends on control dependency: [if], data = [none] } String keyVar = key.replaceAll("\\.", "_"); String env = System.getenv(keyVar) == null ? System.getenv(PARA + "_" + keyVar) : System.getenv(keyVar); String sys = System.getProperty(key, System.getProperty(PARA + "." + key)); if (!StringUtils.isBlank(sys)) { return sys; // depends on control dependency: [if], data = [none] } else if (!StringUtils.isBlank(env)) { return env; // depends on control dependency: [if], data = [none] } else { return (!StringUtils.isBlank(key) && config.hasPath(key)) ? config.getString(key) : defaultValue; // depends on control dependency: [if], data = [none] } } }
public class class_name { public final String getTextOrField() { final String text = getText(); if (text == null) { return field.getName(); } return text; } }
public class class_name { public final String getTextOrField() { final String text = getText(); if (text == null) { return field.getName(); // depends on control dependency: [if], data = [none] } return text; } }
public class class_name { private void processAtmostRequestMappingInfo() { Context cx = Context.enter(); global = new Global(cx); // javascript library loading /* * List<String> modulePath = new ArrayList<String>(); * modulePath.add(getServletContextPath() + atmosLibraryLocation); * global.installRequire(cx, modulePath, false); */ try { // optimization level -1 means interpret mode cx.setOptimizationLevel(-1); if (debugger == null) { debugger = RhinoDebuggerFactory.create(); } //Debugger debugger = RhinoDebuggerFactory.create(); cx.setDebugger(debugger, new Dim.ContextData()); atmosLibraryStream = getClass().getClassLoader() .getResourceAsStream(ATMOS_JS_FILE_NAME); InputStreamReader isr = new InputStreamReader(atmosLibraryStream); // define Spring application context to context variable global.defineProperty("context", getApplicationContext(), 0); cx.evaluateReader(global, isr, ATMOS_JS_FILE_NAME, 1, null); /* * execute all user scripting javascript files in configured * location, then url-handler informations gotta be stored in * memory. */ for (String userSourceLocation : userSourceLocations) { File dir = new File(getServletContextPath() + userSourceLocation); if (dir.isDirectory()) { String[] fileArray = dir.list(); for (String fileName : fileArray) { File jsFile = new File(dir.getAbsolutePath() + "/" + fileName); if (jsFile.isFile()) { FileReader reader = new FileReader(jsFile); global.defineProperty("mappingInfo", handlerMappingInfoStorage, 0); cx.evaluateReader(global, reader, fileName, 1, null); } } } else { FileReader reader = new FileReader(dir); global.defineProperty("mappingInfo", handlerMappingInfoStorage, 0); cx.evaluateReader(global, reader, dir.getName(), 1, null); } } atmosLibraryStream.close(); } catch (Exception ex) { ex.printStackTrace(); } } }
public class class_name { private void processAtmostRequestMappingInfo() { Context cx = Context.enter(); global = new Global(cx); // javascript library loading /* * List<String> modulePath = new ArrayList<String>(); * modulePath.add(getServletContextPath() + atmosLibraryLocation); * global.installRequire(cx, modulePath, false); */ try { // optimization level -1 means interpret mode cx.setOptimizationLevel(-1); // depends on control dependency: [try], data = [none] if (debugger == null) { debugger = RhinoDebuggerFactory.create(); // depends on control dependency: [if], data = [none] } //Debugger debugger = RhinoDebuggerFactory.create(); cx.setDebugger(debugger, new Dim.ContextData()); // depends on control dependency: [try], data = [none] atmosLibraryStream = getClass().getClassLoader() .getResourceAsStream(ATMOS_JS_FILE_NAME); // depends on control dependency: [try], data = [none] InputStreamReader isr = new InputStreamReader(atmosLibraryStream); // define Spring application context to context variable global.defineProperty("context", getApplicationContext(), 0); cx.evaluateReader(global, isr, ATMOS_JS_FILE_NAME, 1, null); // depends on control dependency: [try], data = [none] /* * execute all user scripting javascript files in configured * location, then url-handler informations gotta be stored in * memory. */ for (String userSourceLocation : userSourceLocations) { File dir = new File(getServletContextPath() + userSourceLocation); if (dir.isDirectory()) { String[] fileArray = dir.list(); for (String fileName : fileArray) { File jsFile = new File(dir.getAbsolutePath() + "/" + fileName); if (jsFile.isFile()) { FileReader reader = new FileReader(jsFile); global.defineProperty("mappingInfo", handlerMappingInfoStorage, 0); cx.evaluateReader(global, reader, fileName, 1, null); // depends on control dependency: [if], data = [none] } } } else { FileReader reader = new FileReader(dir); global.defineProperty("mappingInfo", handlerMappingInfoStorage, 0); cx.evaluateReader(global, reader, dir.getName(), 1, null); // depends on control dependency: [if], data = [none] } } atmosLibraryStream.close(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Long getNanos() { if (isBlank(myFractionalSeconds)) { return null; } String retVal = StringUtils.rightPad(myFractionalSeconds, 9, '0'); retVal = retVal.substring(0, 9); return Long.parseLong(retVal); } }
public class class_name { public Long getNanos() { if (isBlank(myFractionalSeconds)) { return null; // depends on control dependency: [if], data = [none] } String retVal = StringUtils.rightPad(myFractionalSeconds, 9, '0'); retVal = retVal.substring(0, 9); return Long.parseLong(retVal); } }
public class class_name { public void commitAddedRules() { // commit changes in the context initialization rules ChainableContextInitRule nextContextInitRule; Chain<ChainableContextInitRule> contextInitRuleChain; nextContextInitRule = addedContextInitRules_; contextInitRuleChain = getContextInitRuleChain(); while (nextContextInitRule != null) { nextContextInitRule.addTo(contextInitRuleChain); nextContextInitRule = nextContextInitRule.next(); } // commit changes in rules for IndexedClassExpression ChainableSubsumerRule nextClassExpressionRule; Chain<ChainableSubsumerRule> classExpressionRuleChain; for (ModifiableIndexedClassExpression target : addedContextRuleHeadByClassExpressions_ .keySet()) { LOGGER_.trace("{}: committing context rule additions", target); nextClassExpressionRule = addedContextRuleHeadByClassExpressions_ .get(target); classExpressionRuleChain = target.getCompositionRuleChain(); while (nextClassExpressionRule != null) { nextClassExpressionRule.addTo(classExpressionRuleChain); nextClassExpressionRule = nextClassExpressionRule.next(); } } for (ModifiableIndexedClass target : addedDefinitions_.keySet()) { ModifiableIndexedClassExpression definition = addedDefinitions_ .get(target); ElkAxiom reason = addedDefinitionReasons_.get(target); LOGGER_.trace("{}: committing definition addition {}", target, definition); if (!target.setDefinition(definition, reason)) throw new ElkUnexpectedIndexingException(target); } initAdditions(); } }
public class class_name { public void commitAddedRules() { // commit changes in the context initialization rules ChainableContextInitRule nextContextInitRule; Chain<ChainableContextInitRule> contextInitRuleChain; nextContextInitRule = addedContextInitRules_; contextInitRuleChain = getContextInitRuleChain(); while (nextContextInitRule != null) { nextContextInitRule.addTo(contextInitRuleChain); // depends on control dependency: [while], data = [none] nextContextInitRule = nextContextInitRule.next(); // depends on control dependency: [while], data = [none] } // commit changes in rules for IndexedClassExpression ChainableSubsumerRule nextClassExpressionRule; Chain<ChainableSubsumerRule> classExpressionRuleChain; for (ModifiableIndexedClassExpression target : addedContextRuleHeadByClassExpressions_ .keySet()) { LOGGER_.trace("{}: committing context rule additions", target); // depends on control dependency: [for], data = [target] nextClassExpressionRule = addedContextRuleHeadByClassExpressions_ .get(target); // depends on control dependency: [for], data = [none] classExpressionRuleChain = target.getCompositionRuleChain(); // depends on control dependency: [for], data = [target] while (nextClassExpressionRule != null) { nextClassExpressionRule.addTo(classExpressionRuleChain); // depends on control dependency: [while], data = [none] nextClassExpressionRule = nextClassExpressionRule.next(); // depends on control dependency: [while], data = [none] } } for (ModifiableIndexedClass target : addedDefinitions_.keySet()) { ModifiableIndexedClassExpression definition = addedDefinitions_ .get(target); ElkAxiom reason = addedDefinitionReasons_.get(target); LOGGER_.trace("{}: committing definition addition {}", target, definition); if (!target.setDefinition(definition, reason)) throw new ElkUnexpectedIndexingException(target); } initAdditions(); } }
public class class_name { public static synchronized void unregisterModule(PmiModule instance) { if (disabled) return; if (instance == null) // || instance.getPath().length<=1) return; return; // check if the path has null in it. if a module is unregistered twice // the path will have null String[] path = instance.getPath(); if (path == null || path.length == 0) return; for (int k = 0; k < path.length; k++) { if (path[k] == null) return; } if (tc.isEntryEnabled()) Tr.entry(tc, "unregisterModule: " + instance.getModuleID() + ", " + instance.getName()); // unregister itself String[] parentPath = new String[path.length - 1]; System.arraycopy(path, 0, parentPath, 0, parentPath.length); // locate parent ModuleItem parent = moduleRoot.find(parentPath, 0); if (parent != null) { // remove "instance" from parent parent.remove(parent.find(path[path.length - 1])); // do not remove the empty parent group in custom pmi // in custom PMI groups/instances are explicitly created and // should be remove explicitly // in pre-custom groups are create IMPLICITYLY when needed if (instance.isCustomModule()) return; // check if parent is empty if (parent.children == null || parent.children.size() == 0) { if (parent.getInstance() != null) { String[] mypath = parent.getInstance().getPath(); // TODO: ask Wenjian about this? // exclude WEBAPP_MODULE because it is created explicitly and // should be removed explictly by calling PmiFactory.removePmiModule if (!(mypath.length == 2 && (mypath[0].equals(WEBSERVICES_MODULE)))) { // recursive call?: unregisterModule (parent.getInstance()); parent.getInstance().unregister(); } } } } if (tc.isEntryEnabled()) Tr.exit(tc, "unregisterModule"); } }
public class class_name { public static synchronized void unregisterModule(PmiModule instance) { if (disabled) return; if (instance == null) // || instance.getPath().length<=1) return; return; // check if the path has null in it. if a module is unregistered twice // the path will have null String[] path = instance.getPath(); if (path == null || path.length == 0) return; for (int k = 0; k < path.length; k++) { if (path[k] == null) return; } if (tc.isEntryEnabled()) Tr.entry(tc, "unregisterModule: " + instance.getModuleID() + ", " + instance.getName()); // unregister itself String[] parentPath = new String[path.length - 1]; System.arraycopy(path, 0, parentPath, 0, parentPath.length); // locate parent ModuleItem parent = moduleRoot.find(parentPath, 0); if (parent != null) { // remove "instance" from parent parent.remove(parent.find(path[path.length - 1])); // depends on control dependency: [if], data = [(parent] // do not remove the empty parent group in custom pmi // in custom PMI groups/instances are explicitly created and // should be remove explicitly // in pre-custom groups are create IMPLICITYLY when needed if (instance.isCustomModule()) return; // check if parent is empty if (parent.children == null || parent.children.size() == 0) { if (parent.getInstance() != null) { String[] mypath = parent.getInstance().getPath(); // TODO: ask Wenjian about this? // exclude WEBAPP_MODULE because it is created explicitly and // should be removed explictly by calling PmiFactory.removePmiModule if (!(mypath.length == 2 && (mypath[0].equals(WEBSERVICES_MODULE)))) { // recursive call?: unregisterModule (parent.getInstance()); parent.getInstance().unregister(); // depends on control dependency: [if], data = [none] } } } } if (tc.isEntryEnabled()) Tr.exit(tc, "unregisterModule"); } }
public class class_name { private void register(RegisterAttempt attempt) { state.getLogger().debug("Registering session: attempt {}", attempt.attempt); RegisterRequest request = RegisterRequest.builder() .withClient(state.getClientId()) .withTimeout(sessionTimeout.toMillis()) .build(); state.getLogger().trace("Sending {}", request); connection.reset().<RegisterRequest, RegisterResponse>sendAndReceive(request).whenComplete((response, error) -> { if (error == null) { state.getLogger().trace("Received {}", response); if (response.status() == Response.Status.OK) { interval = Duration.ofMillis(response.timeout()).dividedBy(2); connection.reset(response.leader(), response.members()); state.setSessionId(response.session()) .setState(Session.State.OPEN); state.getLogger().info("Registered session {}", response.session()); attempt.complete(); keepAlive(); } else { strategy.attemptFailed(attempt); } } else { strategy.attemptFailed(attempt); } }); } }
public class class_name { private void register(RegisterAttempt attempt) { state.getLogger().debug("Registering session: attempt {}", attempt.attempt); RegisterRequest request = RegisterRequest.builder() .withClient(state.getClientId()) .withTimeout(sessionTimeout.toMillis()) .build(); state.getLogger().trace("Sending {}", request); connection.reset().<RegisterRequest, RegisterResponse>sendAndReceive(request).whenComplete((response, error) -> { if (error == null) { state.getLogger().trace("Received {}", response); // depends on control dependency: [if], data = [none] if (response.status() == Response.Status.OK) { interval = Duration.ofMillis(response.timeout()).dividedBy(2); // depends on control dependency: [if], data = [none] connection.reset(response.leader(), response.members()); // depends on control dependency: [if], data = [none] state.setSessionId(response.session()) .setState(Session.State.OPEN); // depends on control dependency: [if], data = [none] state.getLogger().info("Registered session {}", response.session()); // depends on control dependency: [if], data = [none] attempt.complete(); // depends on control dependency: [if], data = [none] keepAlive(); // depends on control dependency: [if], data = [none] } else { strategy.attemptFailed(attempt); // depends on control dependency: [if], data = [none] } } else { strategy.attemptFailed(attempt); // depends on control dependency: [if], data = [none] } }); } }
public class class_name { private void doFindGroup(final Message<JsonObject> message) { String group = message.body().getString("group"); if (group == null) { message.reply(new JsonObject().putString("status", "error").putString("message", "Invalid group name.")); return; } final String address = String.format("%s.%s", cluster, group); context.execute(new Action<Boolean>() { @Override public Boolean perform() { return groups.containsKey(address); } }, new Handler<AsyncResult<Boolean>>() { @Override public void handle(AsyncResult<Boolean> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); } else if (!result.result()) { message.reply(new JsonObject().putString("status", "error").putString("message", "Invalid group.")); } else { message.reply(new JsonObject().putString("status", "ok").putString("result", address)); } } }); } }
public class class_name { private void doFindGroup(final Message<JsonObject> message) { String group = message.body().getString("group"); if (group == null) { message.reply(new JsonObject().putString("status", "error").putString("message", "Invalid group name.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } final String address = String.format("%s.%s", cluster, group); context.execute(new Action<Boolean>() { @Override public Boolean perform() { return groups.containsKey(address); } }, new Handler<AsyncResult<Boolean>>() { @Override public void handle(AsyncResult<Boolean> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none] } else if (!result.result()) { message.reply(new JsonObject().putString("status", "error").putString("message", "Invalid group.")); // depends on control dependency: [if], data = [none] } else { message.reply(new JsonObject().putString("status", "ok").putString("result", address)); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { protected byte[] ensure128BitMD5(byte[] digest) { if(digest.length == MD5_LENGTH) { return digest; } else if(digest.length > MD5_LENGTH) { byte[] b = new byte[MD5_LENGTH]; System.arraycopy(digest, 0, b, 0, MD5_LENGTH); return b; } else { byte[] b = new byte[MD5_LENGTH]; System.arraycopy(digest, 0, b, 0, digest.length); Arrays.fill(b, digest.length, b.length, (byte)0); return b; } } }
public class class_name { protected byte[] ensure128BitMD5(byte[] digest) { if(digest.length == MD5_LENGTH) { return digest; // depends on control dependency: [if], data = [none] } else if(digest.length > MD5_LENGTH) { byte[] b = new byte[MD5_LENGTH]; System.arraycopy(digest, 0, b, 0, MD5_LENGTH); // depends on control dependency: [if], data = [MD5_LENGTH)] return b; // depends on control dependency: [if], data = [none] } else { byte[] b = new byte[MD5_LENGTH]; System.arraycopy(digest, 0, b, 0, digest.length); // depends on control dependency: [if], data = [none] Arrays.fill(b, digest.length, b.length, (byte)0); // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Object objectArrayGet(Object[] a, int i) { try { return a[i]; } catch (Throwable t) { return a[DefaultGroovyMethodsSupport.normaliseIndex(i,a.length)]; } } }
public class class_name { public static Object objectArrayGet(Object[] a, int i) { try { return a[i]; // depends on control dependency: [try], data = [none] } catch (Throwable t) { return a[DefaultGroovyMethodsSupport.normaliseIndex(i,a.length)]; } // depends on control dependency: [catch], data = [none] } }
public class class_name { Map<String, String> parseJsStringMap(String input) throws ParseException { input = CharMatcher.whitespace().trimFrom(input); check( !input.isEmpty() && input.charAt(0) == '{' && input.charAt(input.length() - 1) == '}', "Syntax error when parsing JS object"); input = input.substring(1, input.length() - 1).trim(); Map<String, String> results = new LinkedHashMap<>(); boolean done = input.isEmpty(); valueMatcher.reset(input); while (!done) { // Parse the next key (TODO(sdh): need to support non-quoted keys?). check(valueMatcher.lookingAt(), "Bad key in JS object literal"); String key = valueMatcher.group(1) != null ? valueMatcher.group(1) : valueMatcher.group(2); check(!valueMatcher.hitEnd(), "Missing value in JS object literal"); check(input.charAt(valueMatcher.end()) == ':', "Missing colon in JS object literal"); valueMatcher.region(valueMatcher.end() + 1, valueMatcher.regionEnd()); // Parse the corresponding value. check(valueMatcher.lookingAt(), "Bad value in JS object literal"); String val = valueMatcher.group(1) != null ? valueMatcher.group(1) : valueMatcher.group(2); results.put(key, val); if (!valueMatcher.hitEnd()) { check(input.charAt(valueMatcher.end()) == ',', "Missing comma in JS object literal"); valueMatcher.region(valueMatcher.end() + 1, valueMatcher.regionEnd()); } else { done = true; } } return results; } }
public class class_name { Map<String, String> parseJsStringMap(String input) throws ParseException { input = CharMatcher.whitespace().trimFrom(input); check( !input.isEmpty() && input.charAt(0) == '{' && input.charAt(input.length() - 1) == '}', "Syntax error when parsing JS object"); input = input.substring(1, input.length() - 1).trim(); Map<String, String> results = new LinkedHashMap<>(); boolean done = input.isEmpty(); valueMatcher.reset(input); while (!done) { // Parse the next key (TODO(sdh): need to support non-quoted keys?). check(valueMatcher.lookingAt(), "Bad key in JS object literal"); // depends on control dependency: [while], data = [none] String key = valueMatcher.group(1) != null ? valueMatcher.group(1) : valueMatcher.group(2); check(!valueMatcher.hitEnd(), "Missing value in JS object literal"); // depends on control dependency: [while], data = [none] check(input.charAt(valueMatcher.end()) == ':', "Missing colon in JS object literal"); // depends on control dependency: [while], data = [none] valueMatcher.region(valueMatcher.end() + 1, valueMatcher.regionEnd()); // depends on control dependency: [while], data = [none] // Parse the corresponding value. check(valueMatcher.lookingAt(), "Bad value in JS object literal"); // depends on control dependency: [while], data = [none] String val = valueMatcher.group(1) != null ? valueMatcher.group(1) : valueMatcher.group(2); results.put(key, val); // depends on control dependency: [while], data = [none] if (!valueMatcher.hitEnd()) { check(input.charAt(valueMatcher.end()) == ',', "Missing comma in JS object literal"); // depends on control dependency: [if], data = [none] valueMatcher.region(valueMatcher.end() + 1, valueMatcher.regionEnd()); // depends on control dependency: [if], data = [none] } else { done = true; // depends on control dependency: [if], data = [none] } } return results; } }
public class class_name { public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = world.getX() - falseEasting; double fromY = world.getY() - falseNorthing; double rrho0 = rho0; if (n < 0) { rrho0 *= -1.0; fromX *= -1.0; fromY *= -1.0; } double yd = rrho0 - fromY; double rho = Math.sqrt(fromX * fromX + yd * yd); double theta = Math.atan2(fromX, yd); if (n < 0) { rho *= -1.0; } toLat = Math.toDegrees(Math.asin((C - Math.pow((rho * n / earth_radius), 2)) / (2 * n))); toLon = Math.toDegrees(theta / n + lon0); result.setLatitude(toLat); result.setLongitude(toLon); return result; } }
public class class_name { public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = world.getX() - falseEasting; double fromY = world.getY() - falseNorthing; double rrho0 = rho0; if (n < 0) { rrho0 *= -1.0; // depends on control dependency: [if], data = [none] fromX *= -1.0; // depends on control dependency: [if], data = [none] fromY *= -1.0; // depends on control dependency: [if], data = [none] } double yd = rrho0 - fromY; double rho = Math.sqrt(fromX * fromX + yd * yd); double theta = Math.atan2(fromX, yd); if (n < 0) { rho *= -1.0; // depends on control dependency: [if], data = [none] } toLat = Math.toDegrees(Math.asin((C - Math.pow((rho * n / earth_radius), 2)) / (2 * n))); toLon = Math.toDegrees(theta / n + lon0); result.setLatitude(toLat); result.setLongitude(toLon); return result; } }
public class class_name { void hoistNoCompileFiles() { boolean staleInputs = false; maybeDoThreadedParsing(); // Iterate a copy because hoisting modifies what we're iterating over. for (CompilerInput input : ImmutableList.copyOf(moduleGraph.getAllInputs())) { if (input.getHasNoCompileAnnotation()) { input.getModule().remove(input); staleInputs = true; } } if (staleInputs) { repartitionInputs(); } } }
public class class_name { void hoistNoCompileFiles() { boolean staleInputs = false; maybeDoThreadedParsing(); // Iterate a copy because hoisting modifies what we're iterating over. for (CompilerInput input : ImmutableList.copyOf(moduleGraph.getAllInputs())) { if (input.getHasNoCompileAnnotation()) { input.getModule().remove(input); // depends on control dependency: [if], data = [none] staleInputs = true; // depends on control dependency: [if], data = [none] } } if (staleInputs) { repartitionInputs(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static <T> T loadAndInstantiateClassImpl( AddOnClassLoader addOnClassLoader, String classname, Class<T> clazz, String type) { Class<?> cls; try { cls = addOnClassLoader.loadClass(classname); } catch (ClassNotFoundException e) { LOGGER.error("Declared \"" + type + "\" was not found: " + classname, e); return null; } catch (LinkageError e) { LOGGER.error("Declared \"" + type + "\" could not be loaded: " + classname, e); return null; } if (Modifier.isAbstract(cls.getModifiers()) || Modifier.isInterface(cls.getModifiers())) { LOGGER.error("Declared \"" + type + "\" is abstract or an interface: " + classname); return null; } if (!clazz.isAssignableFrom(cls)) { LOGGER.error("Declared \"" + type + "\" is not of type \"" + clazz.getName() + "\": " + classname); return null; } try { @SuppressWarnings("unchecked") Constructor<T> c = (Constructor<T>) cls.getConstructor(); return c.newInstance(); } catch (LinkageError | Exception e) { LOGGER.error("Failed to initialise: " + classname, e); } return null; } }
public class class_name { private static <T> T loadAndInstantiateClassImpl( AddOnClassLoader addOnClassLoader, String classname, Class<T> clazz, String type) { Class<?> cls; try { cls = addOnClassLoader.loadClass(classname); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { LOGGER.error("Declared \"" + type + "\" was not found: " + classname, e); return null; } catch (LinkageError e) { // depends on control dependency: [catch], data = [none] LOGGER.error("Declared \"" + type + "\" could not be loaded: " + classname, e); return null; } // depends on control dependency: [catch], data = [none] if (Modifier.isAbstract(cls.getModifiers()) || Modifier.isInterface(cls.getModifiers())) { LOGGER.error("Declared \"" + type + "\" is abstract or an interface: " + classname); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if (!clazz.isAssignableFrom(cls)) { LOGGER.error("Declared \"" + type + "\" is not of type \"" + clazz.getName() + "\": " + classname); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } try { @SuppressWarnings("unchecked") Constructor<T> c = (Constructor<T>) cls.getConstructor(); return c.newInstance(); // depends on control dependency: [try], data = [none] } catch (LinkageError | Exception e) { LOGGER.error("Failed to initialise: " + classname, e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private String buildCacheKey(final String[] objectIds, final String namespace) { if (objectIds.length == 1) { checkKeyPart(objectIds[0]); return namespace + SEPARATOR + objectIds[0]; } StringBuilder cacheKey = new StringBuilder(namespace); cacheKey.append(SEPARATOR); for (String id : objectIds) { checkKeyPart(id); cacheKey.append(id); cacheKey.append(ID_SEPARATOR); } cacheKey.deleteCharAt(cacheKey.length() - 1); return cacheKey.toString(); } }
public class class_name { private String buildCacheKey(final String[] objectIds, final String namespace) { if (objectIds.length == 1) { checkKeyPart(objectIds[0]); // depends on control dependency: [if], data = [none] return namespace + SEPARATOR + objectIds[0]; // depends on control dependency: [if], data = [none] } StringBuilder cacheKey = new StringBuilder(namespace); cacheKey.append(SEPARATOR); for (String id : objectIds) { checkKeyPart(id); // depends on control dependency: [for], data = [id] cacheKey.append(id); // depends on control dependency: [for], data = [id] cacheKey.append(ID_SEPARATOR); // depends on control dependency: [for], data = [none] } cacheKey.deleteCharAt(cacheKey.length() - 1); return cacheKey.toString(); } }
public class class_name { public static Object getProp( Object object, final String property ) { if ( object == null ) { return null; } if ( isDigits( property ) ) { /* We can index numbers and names. */ object = idx(object, StringScanner.parseInt(property)); } Class<?> cls = object.getClass(); /** Tries the getters first. */ Map<String, FieldAccess> fields = Reflection.getPropertyFieldAccessors( cls ); if ( !fields.containsKey( property ) ) { fields = Reflection.getAllAccessorFields( cls ); } if ( !fields.containsKey( property ) ) { return null; } else { return fields.get( property ).getValue( object ); } } }
public class class_name { public static Object getProp( Object object, final String property ) { if ( object == null ) { return null; // depends on control dependency: [if], data = [none] } if ( isDigits( property ) ) { /* We can index numbers and names. */ object = idx(object, StringScanner.parseInt(property)); // depends on control dependency: [if], data = [none] } Class<?> cls = object.getClass(); /** Tries the getters first. */ Map<String, FieldAccess> fields = Reflection.getPropertyFieldAccessors( cls ); if ( !fields.containsKey( property ) ) { fields = Reflection.getAllAccessorFields( cls ); // depends on control dependency: [if], data = [none] } if ( !fields.containsKey( property ) ) { return null; // depends on control dependency: [if], data = [none] } else { return fields.get( property ).getValue( object ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Colorization getColorization (String className, int colorId) { ClassRecord crec = getClassRecord(className); if (crec != null) { ColorRecord color = crec.colors.get(colorId); if (color != null) { return color.getColorization(); } } return null; } }
public class class_name { public Colorization getColorization (String className, int colorId) { ClassRecord crec = getClassRecord(className); if (crec != null) { ColorRecord color = crec.colors.get(colorId); if (color != null) { return color.getColorization(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public Interval<C> behind() { if(this.hasNone()) { return new Interval(this.dimension, Range.all()); } if(this.range.equals(Range.all())) { return new Interval(this.dimension); } return new Interval(this.dimension, Range.upTo(this.range.lowerEndpoint(), reverse(this.range.lowerBoundType()))); } }
public class class_name { public Interval<C> behind() { if(this.hasNone()) { return new Interval(this.dimension, Range.all()); // depends on control dependency: [if], data = [none] } if(this.range.equals(Range.all())) { return new Interval(this.dimension); // depends on control dependency: [if], data = [none] } return new Interval(this.dimension, Range.upTo(this.range.lowerEndpoint(), reverse(this.range.lowerBoundType()))); } }
public class class_name { public static String getElementName(ENamedElement element) { String value = getValue(element, "JsonProperty", "value"); if (value == null) { value = getValue(element, EXTENDED_METADATA, "name"); } return value == null ? element.getName(): value; } }
public class class_name { public static String getElementName(ENamedElement element) { String value = getValue(element, "JsonProperty", "value"); if (value == null) { value = getValue(element, EXTENDED_METADATA, "name"); // depends on control dependency: [if], data = [none] } return value == null ? element.getName(): value; } }
public class class_name { public void cleanTables() { try { DefaultTableModel algModel = (DefaultTableModel) jTableAlgorithms.getModel(); DefaultTableModel strModel = (DefaultTableModel) jTableStreams.getModel(); int rows = jTableAlgorithms.getRowCount(); int srow = jTableStreams.getRowCount(); int trow = this.taskList.size(); for (int i = 0; i < rows; i++) { algModel.removeRow(0); } for (int i = 0; i < srow; i++) { strModel.removeRow(0); } for (int i = 0; i < trow; i++) { this.taskList.remove(0); } this.taskTableModel.fireTableDataChanged(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error al limpiar la tabla."); } } }
public class class_name { public void cleanTables() { try { DefaultTableModel algModel = (DefaultTableModel) jTableAlgorithms.getModel(); DefaultTableModel strModel = (DefaultTableModel) jTableStreams.getModel(); int rows = jTableAlgorithms.getRowCount(); int srow = jTableStreams.getRowCount(); int trow = this.taskList.size(); for (int i = 0; i < rows; i++) { algModel.removeRow(0); // depends on control dependency: [for], data = [none] } for (int i = 0; i < srow; i++) { strModel.removeRow(0); // depends on control dependency: [for], data = [none] } for (int i = 0; i < trow; i++) { this.taskList.remove(0); // depends on control dependency: [for], data = [none] } this.taskTableModel.fireTableDataChanged(); // depends on control dependency: [try], data = [none] } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error al limpiar la tabla."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void applyHiddenRegionFormatting(List<ITextReplacer> replacers) { IHiddenRegionFormatting separator = findWhitespaceThatSeparatesSemanticRegions(replacers).getFormatting(); // 1. apply indentation Integer inc = formatting.getIndentationIncrease(); Integer dec = formatting.getIndentationDecrease(); if (inc != null && dec != null) { ((WhitespaceReplacer) replacers.get(0)).getFormatting().setIndentationIncrease(inc); ((WhitespaceReplacer) replacers.get(replacers.size() - 1)).getFormatting().setIndentationDecrease(dec); } else if (inc != null) { separator.setIndentationIncrease(inc); } else if (dec != null) { separator.setIndentationDecrease(dec); } // 2. apply NewLine and space configuration to the first whitespace region that follows or contains a linewrap. separator.setNewLinesDefault(formatting.getNewLineDefault()); separator.setNewLinesMax(formatting.getNewLineMax()); separator.setNewLinesMin(formatting.getNewLineMin()); separator.setSpace(formatting.getSpace()); // 3. apply the 'priority' configuration for all and set a default formatting for (ITextReplacer replacer : replacers) if (replacer instanceof WhitespaceReplacer) { IHiddenRegionFormatting formatting2 = ((WhitespaceReplacer) replacer).getFormatting(); formatting2.setPriority(formatting.getPriority()); if (formatting2 != separator) { formatting2.setSpace(replacer.getRegion().getOffset() > 0 ? " " : ""); formatting2.setNewLinesMin(0); formatting2.setNewLinesMax(1); } } // 4. make sure whitespace before and after multiline comments introduce a NewLine for (int i = 0; i < replacers.size(); i++) { ITextReplacer replacer = replacers.get(i); if (replacer instanceof CommentReplacer) { CommentReplacer commentReplacer = ((CommentReplacer) replacer); WhitespaceReplacer leading = (WhitespaceReplacer) replacers.get(i - 1); WhitespaceReplacer trailing = (WhitespaceReplacer) replacers.get(i + 1); commentReplacer.configureWhitespace(leading, trailing); } } } }
public class class_name { protected void applyHiddenRegionFormatting(List<ITextReplacer> replacers) { IHiddenRegionFormatting separator = findWhitespaceThatSeparatesSemanticRegions(replacers).getFormatting(); // 1. apply indentation Integer inc = formatting.getIndentationIncrease(); Integer dec = formatting.getIndentationDecrease(); if (inc != null && dec != null) { ((WhitespaceReplacer) replacers.get(0)).getFormatting().setIndentationIncrease(inc); // depends on control dependency: [if], data = [(inc] ((WhitespaceReplacer) replacers.get(replacers.size() - 1)).getFormatting().setIndentationDecrease(dec); // depends on control dependency: [if], data = [none] } else if (inc != null) { separator.setIndentationIncrease(inc); // depends on control dependency: [if], data = [(inc] } else if (dec != null) { separator.setIndentationDecrease(dec); // depends on control dependency: [if], data = [(dec] } // 2. apply NewLine and space configuration to the first whitespace region that follows or contains a linewrap. separator.setNewLinesDefault(formatting.getNewLineDefault()); separator.setNewLinesMax(formatting.getNewLineMax()); separator.setNewLinesMin(formatting.getNewLineMin()); separator.setSpace(formatting.getSpace()); // 3. apply the 'priority' configuration for all and set a default formatting for (ITextReplacer replacer : replacers) if (replacer instanceof WhitespaceReplacer) { IHiddenRegionFormatting formatting2 = ((WhitespaceReplacer) replacer).getFormatting(); formatting2.setPriority(formatting.getPriority()); // depends on control dependency: [if], data = [none] if (formatting2 != separator) { formatting2.setSpace(replacer.getRegion().getOffset() > 0 ? " " : ""); // depends on control dependency: [if], data = [none] formatting2.setNewLinesMin(0); // depends on control dependency: [if], data = [none] formatting2.setNewLinesMax(1); // depends on control dependency: [if], data = [none] } } // 4. make sure whitespace before and after multiline comments introduce a NewLine for (int i = 0; i < replacers.size(); i++) { ITextReplacer replacer = replacers.get(i); if (replacer instanceof CommentReplacer) { CommentReplacer commentReplacer = ((CommentReplacer) replacer); WhitespaceReplacer leading = (WhitespaceReplacer) replacers.get(i - 1); WhitespaceReplacer trailing = (WhitespaceReplacer) replacers.get(i + 1); commentReplacer.configureWhitespace(leading, trailing); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static Collection<String> getPropertyGuard() { Collection<String> propertyGuard = propertyGuardThreadLocal.get(); if (propertyGuard == null) { propertyGuard = new HashSet<String>(); propertyGuardThreadLocal.set(propertyGuard); } return propertyGuard; } }
public class class_name { private static Collection<String> getPropertyGuard() { Collection<String> propertyGuard = propertyGuardThreadLocal.get(); if (propertyGuard == null) { propertyGuard = new HashSet<String>(); // depends on control dependency: [if], data = [none] propertyGuardThreadLocal.set(propertyGuard); // depends on control dependency: [if], data = [(propertyGuard] } return propertyGuard; } }
public class class_name { private void amk(final EncodingResult result, final Variable[] vars, int rhs) { if (rhs < 0) throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs); if (rhs >= vars.length) // there is no constraint return; if (rhs == 0) { // no variable can be true for (final Variable var : vars) result.addClause(var.negate()); return; } switch (this.config().amkEncoder) { case TOTALIZER: if (this.amkTotalizer == null) this.amkTotalizer = new CCAMKTotalizer(); this.amkTotalizer.build(result, vars, rhs); break; case MODULAR_TOTALIZER: if (this.amkModularTotalizer == null) this.amkModularTotalizer = new CCAMKModularTotalizer(this.f); this.amkModularTotalizer.build(result, vars, rhs); break; case CARDINALITY_NETWORK: if (this.amkCardinalityNetwork == null) this.amkCardinalityNetwork = new CCAMKCardinalityNetwork(); this.amkCardinalityNetwork.build(result, vars, rhs); break; case BEST: this.bestAMK(vars.length).build(result, vars, rhs); break; default: throw new IllegalStateException("Unknown at-most-k encoder: " + this.config().amkEncoder); } } }
public class class_name { private void amk(final EncodingResult result, final Variable[] vars, int rhs) { if (rhs < 0) throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs); if (rhs >= vars.length) // there is no constraint return; if (rhs == 0) { // no variable can be true for (final Variable var : vars) result.addClause(var.negate()); return; // depends on control dependency: [if], data = [none] } switch (this.config().amkEncoder) { case TOTALIZER: if (this.amkTotalizer == null) this.amkTotalizer = new CCAMKTotalizer(); this.amkTotalizer.build(result, vars, rhs); break; case MODULAR_TOTALIZER: if (this.amkModularTotalizer == null) this.amkModularTotalizer = new CCAMKModularTotalizer(this.f); this.amkModularTotalizer.build(result, vars, rhs); break; case CARDINALITY_NETWORK: if (this.amkCardinalityNetwork == null) this.amkCardinalityNetwork = new CCAMKCardinalityNetwork(); this.amkCardinalityNetwork.build(result, vars, rhs); break; case BEST: this.bestAMK(vars.length).build(result, vars, rhs); break; default: throw new IllegalStateException("Unknown at-most-k encoder: " + this.config().amkEncoder); } } }
public class class_name { public void verifyProxyAccess() throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>verifyProxyAccess"); try { Logger logger = Logger.getLogger(PeachProxy.class.getName()); HttpResponse<JsonNode> ret = null; try { ret = Unirest .get(String.format("%s/", _proxyUrl)) .asJson(); } catch (UnirestException ex) { logger.log(Level.SEVERE, "Error validating access to Peach API Security proxy port.", ex); logger.log(Level.SEVERE, "Please verify correct access to %s. This error is typically"); logger.log(Level.SEVERE, "due to incorrect deployment of Peach API Security or a network issue."); logger.log(Level.SEVERE, "Verify access to the port in this URL: %s", _proxyUrl); throw new PeachApiException( String.format("Error validating access to Peach API Security proxy port: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionSetup: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error verifying proxy port access, incorrect status code via %s: %s %s", _proxyUrl, ret.getStatus(), ret.getStatusText()); logger.log(Level.SEVERE, errorMsg); logger.log(Level.SEVERE, "Please verify correct access to %s. This error is typically", _proxyUrl); logger.log(Level.SEVERE, "due to incorrect deployment of Peach API Security or network issues."); throw new PeachApiException(errorMsg, null); } try { if(ret.getBody().getObject().getString("ping").equals("pong")) { throw new Exception(); } } catch(Exception ex) { String errorMsg = String.format("Error verifying proxy port access, unexpected body: %s", ret.getBody().toString()); logger.log(Level.SEVERE, errorMsg); logger.log(Level.SEVERE, "Please verify correct access to %s. This error is typically", _proxyUrl); logger.log(Level.SEVERE, "due to incorrect deployment of Peach API Security or network issues."); throw new PeachApiException(errorMsg, null); } } finally { revertUnirestProxy(); } } }
public class class_name { public void verifyProxyAccess() throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>verifyProxyAccess"); try { Logger logger = Logger.getLogger(PeachProxy.class.getName()); HttpResponse<JsonNode> ret = null; try { ret = Unirest .get(String.format("%s/", _proxyUrl)) .asJson(); // depends on control dependency: [try], data = [none] } catch (UnirestException ex) { logger.log(Level.SEVERE, "Error validating access to Peach API Security proxy port.", ex); logger.log(Level.SEVERE, "Please verify correct access to %s. This error is typically"); logger.log(Level.SEVERE, "due to incorrect deployment of Peach API Security or a network issue."); logger.log(Level.SEVERE, "Verify access to the port in this URL: %s", _proxyUrl); throw new PeachApiException( String.format("Error validating access to Peach API Security proxy port: %s", ex.getMessage()), ex); } // depends on control dependency: [catch], data = [none] if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionSetup: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error verifying proxy port access, incorrect status code via %s: %s %s", _proxyUrl, ret.getStatus(), ret.getStatusText()); logger.log(Level.SEVERE, errorMsg); // depends on control dependency: [if], data = [none] logger.log(Level.SEVERE, "Please verify correct access to %s. This error is typically", _proxyUrl); // depends on control dependency: [if], data = [none] logger.log(Level.SEVERE, "due to incorrect deployment of Peach API Security or network issues."); // depends on control dependency: [if], data = [none] throw new PeachApiException(errorMsg, null); } try { if(ret.getBody().getObject().getString("ping").equals("pong")) { throw new Exception(); } } catch(Exception ex) { String errorMsg = String.format("Error verifying proxy port access, unexpected body: %s", ret.getBody().toString()); logger.log(Level.SEVERE, errorMsg); logger.log(Level.SEVERE, "Please verify correct access to %s. This error is typically", _proxyUrl); logger.log(Level.SEVERE, "due to incorrect deployment of Peach API Security or network issues."); throw new PeachApiException(errorMsg, null); } // depends on control dependency: [catch], data = [none] } finally { revertUnirestProxy(); } } }
public class class_name { public void update(final int[] data) { if ((data == null) || (data.length == 0)) { return; } final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); } }
public class class_name { public void update(final int[] data) { if ((data == null) || (data.length == 0)) { return; } // depends on control dependency: [if], data = [none] final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); } }
public class class_name { public static String getColumnSharedPrefix(String[] associationKeyColumns) { String prefix = null; for ( String column : associationKeyColumns ) { String newPrefix = getPrefix( column ); if ( prefix == null ) { // first iteration prefix = newPrefix; if ( prefix == null ) { // no prefix, quit break; } } else { // subsequent iterations if ( ! equals( prefix, newPrefix ) ) { // different prefixes prefix = null; break; } } } return prefix; } }
public class class_name { public static String getColumnSharedPrefix(String[] associationKeyColumns) { String prefix = null; for ( String column : associationKeyColumns ) { String newPrefix = getPrefix( column ); if ( prefix == null ) { // first iteration prefix = newPrefix; // depends on control dependency: [if], data = [none] if ( prefix == null ) { // no prefix, quit break; } } else { // subsequent iterations if ( ! equals( prefix, newPrefix ) ) { // different prefixes prefix = null; // depends on control dependency: [if], data = [none] break; } } } return prefix; } }
public class class_name { public Iterable<Path> getPaths( CachedNode node ) { NodeKey key = node.getKey(); List<Path> pathList = paths.get(key); if (pathList == null) { // Compute the node's path ... Segment nodeSegment = node.getSegment(cache); NodeKey parentKey = node.getParentKey(cache); if (parentKey == null) { // This is the root node ... pathList = Collections.singletonList(node.getPath(cache)); } else { // This is not the root node, so add a path for each of the parent's valid paths ... CachedNode parent = cache.getNode(parentKey); if (parent == null && removedCache != null) { // This is a removed node, so check the removed cache ... parent = removedCache.getNode(parentKey); } pathList = new LinkedList<Path>(); for (Path parentPath : getPaths(parent)) { Path path = pathFactory.create(parentPath, nodeSegment); pathList.add(path); } // Get the additional parents ... Set<NodeKey> additionalParentKeys = getAdditionalParentKeys(node, cache); // There is at least one additional parent ... for (NodeKey additionalParentKey : additionalParentKeys) { parent = cache.getNode(additionalParentKey); for (Path parentPath : getPaths(parent)) { Path path = pathFactory.create(parentPath, nodeSegment); pathList.add(path); } } } assert pathList != null; pathList = Collections.unmodifiableList(pathList); paths.put(key, pathList); } return pathList; } }
public class class_name { public Iterable<Path> getPaths( CachedNode node ) { NodeKey key = node.getKey(); List<Path> pathList = paths.get(key); if (pathList == null) { // Compute the node's path ... Segment nodeSegment = node.getSegment(cache); NodeKey parentKey = node.getParentKey(cache); if (parentKey == null) { // This is the root node ... pathList = Collections.singletonList(node.getPath(cache)); // depends on control dependency: [if], data = [none] } else { // This is not the root node, so add a path for each of the parent's valid paths ... CachedNode parent = cache.getNode(parentKey); if (parent == null && removedCache != null) { // This is a removed node, so check the removed cache ... parent = removedCache.getNode(parentKey); // depends on control dependency: [if], data = [(parent] } pathList = new LinkedList<Path>(); // depends on control dependency: [if], data = [none] for (Path parentPath : getPaths(parent)) { Path path = pathFactory.create(parentPath, nodeSegment); pathList.add(path); // depends on control dependency: [for], data = [none] } // Get the additional parents ... Set<NodeKey> additionalParentKeys = getAdditionalParentKeys(node, cache); // There is at least one additional parent ... for (NodeKey additionalParentKey : additionalParentKeys) { parent = cache.getNode(additionalParentKey); // depends on control dependency: [for], data = [additionalParentKey] for (Path parentPath : getPaths(parent)) { Path path = pathFactory.create(parentPath, nodeSegment); pathList.add(path); // depends on control dependency: [for], data = [none] } } } assert pathList != null; pathList = Collections.unmodifiableList(pathList); // depends on control dependency: [if], data = [(pathList] paths.put(key, pathList); // depends on control dependency: [if], data = [none] } return pathList; } }
public class class_name { protected ClassElement mirrorToClassElement(TypeMirror returnType, JavaVisitorContext visitorContext) { if (returnType instanceof NoType) { return new JavaVoidElement(); } else if (returnType instanceof DeclaredType) { DeclaredType dt = (DeclaredType) returnType; Element e = dt.asElement(); List<? extends TypeMirror> typeArguments = dt.getTypeArguments(); if (e instanceof TypeElement) { TypeElement typeElement = (TypeElement) e; if (JavaModelUtils.resolveKind(typeElement, ElementKind.ENUM).isPresent()) { return new JavaEnumElement( typeElement, visitorContext.getAnnotationUtils().getAnnotationMetadata(typeElement), visitorContext, typeArguments ); } else { return new JavaClassElement( typeElement, visitorContext.getAnnotationUtils().getAnnotationMetadata(typeElement), visitorContext, typeArguments ); } } } else if (returnType instanceof TypeVariable) { TypeVariable tv = (TypeVariable) returnType; TypeMirror upperBound = tv.getUpperBound(); ClassElement classElement = mirrorToClassElement(upperBound, visitorContext); if (classElement != null) { return classElement; } else { return mirrorToClassElement(tv.getLowerBound(), visitorContext); } } else if (returnType instanceof ArrayType) { ArrayType at = (ArrayType) returnType; TypeMirror componentType = at.getComponentType(); ClassElement arrayType = mirrorToClassElement(componentType, visitorContext); if (arrayType != null) { if (arrayType instanceof JavaPrimitiveElement) { JavaPrimitiveElement jpe = (JavaPrimitiveElement) arrayType; return jpe.toArray(); } else { return new JavaClassElement((TypeElement) arrayType.getNativeType(), arrayType, visitorContext) { @Override public boolean isArray() { return true; } }; } } } else if (returnType instanceof PrimitiveType) { PrimitiveType pt = (PrimitiveType) returnType; return JavaPrimitiveElement.valueOf(pt.getKind().name()); } return null; } }
public class class_name { protected ClassElement mirrorToClassElement(TypeMirror returnType, JavaVisitorContext visitorContext) { if (returnType instanceof NoType) { return new JavaVoidElement(); // depends on control dependency: [if], data = [none] } else if (returnType instanceof DeclaredType) { DeclaredType dt = (DeclaredType) returnType; Element e = dt.asElement(); List<? extends TypeMirror> typeArguments = dt.getTypeArguments(); // depends on control dependency: [if], data = [none] if (e instanceof TypeElement) { TypeElement typeElement = (TypeElement) e; if (JavaModelUtils.resolveKind(typeElement, ElementKind.ENUM).isPresent()) { return new JavaEnumElement( typeElement, visitorContext.getAnnotationUtils().getAnnotationMetadata(typeElement), visitorContext, typeArguments ); // depends on control dependency: [if], data = [none] } else { return new JavaClassElement( typeElement, visitorContext.getAnnotationUtils().getAnnotationMetadata(typeElement), visitorContext, typeArguments ); // depends on control dependency: [if], data = [none] } } } else if (returnType instanceof TypeVariable) { TypeVariable tv = (TypeVariable) returnType; TypeMirror upperBound = tv.getUpperBound(); ClassElement classElement = mirrorToClassElement(upperBound, visitorContext); if (classElement != null) { return classElement; // depends on control dependency: [if], data = [none] } else { return mirrorToClassElement(tv.getLowerBound(), visitorContext); // depends on control dependency: [if], data = [none] } } else if (returnType instanceof ArrayType) { ArrayType at = (ArrayType) returnType; TypeMirror componentType = at.getComponentType(); ClassElement arrayType = mirrorToClassElement(componentType, visitorContext); if (arrayType != null) { if (arrayType instanceof JavaPrimitiveElement) { JavaPrimitiveElement jpe = (JavaPrimitiveElement) arrayType; return jpe.toArray(); // depends on control dependency: [if], data = [none] } else { return new JavaClassElement((TypeElement) arrayType.getNativeType(), arrayType, visitorContext) { @Override public boolean isArray() { return true; } }; // depends on control dependency: [if], data = [none] } } } else if (returnType instanceof PrimitiveType) { PrimitiveType pt = (PrimitiveType) returnType; return JavaPrimitiveElement.valueOf(pt.getKind().name()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static <T> HttpMethod retrieveMethod(Request<T> request) { if (request == null) { return null; } Class<?> clazz = request.getClass(); Method method = clazz.getAnnotation(Method.class); HttpMethod httpMethod = method.value(); return httpMethod; } }
public class class_name { public static <T> HttpMethod retrieveMethod(Request<T> request) { if (request == null) { return null; // depends on control dependency: [if], data = [none] } Class<?> clazz = request.getClass(); Method method = clazz.getAnnotation(Method.class); HttpMethod httpMethod = method.value(); return httpMethod; } }
public class class_name { protected void createRecursiveIncidents(String rootCauseIncidentId, List<IncidentEntity> createdIncidents) { final ExecutionEntity execution = getExecution(); if(execution != null) { ExecutionEntity superExecution = execution.getProcessInstance().getSuperExecution(); if (superExecution != null) { // create a new incident IncidentEntity newIncident = create(incidentType); newIncident.setExecution(superExecution); newIncident.setActivityId(superExecution.getCurrentActivityId()); newIncident.setProcessDefinitionId(superExecution.getProcessDefinitionId()); newIncident.setTenantId(superExecution.getTenantId()); // set cause and root cause newIncident.setCauseIncidentId(id); newIncident.setRootCauseIncidentId(rootCauseIncidentId); // insert new incident (and create a new historic incident) insert(newIncident); // add new incident to result set createdIncidents.add(newIncident); newIncident.createRecursiveIncidents(rootCauseIncidentId, createdIncidents); } } } }
public class class_name { protected void createRecursiveIncidents(String rootCauseIncidentId, List<IncidentEntity> createdIncidents) { final ExecutionEntity execution = getExecution(); if(execution != null) { ExecutionEntity superExecution = execution.getProcessInstance().getSuperExecution(); if (superExecution != null) { // create a new incident IncidentEntity newIncident = create(incidentType); newIncident.setExecution(superExecution); // depends on control dependency: [if], data = [(superExecution] newIncident.setActivityId(superExecution.getCurrentActivityId()); // depends on control dependency: [if], data = [(superExecution] newIncident.setProcessDefinitionId(superExecution.getProcessDefinitionId()); // depends on control dependency: [if], data = [(superExecution] newIncident.setTenantId(superExecution.getTenantId()); // depends on control dependency: [if], data = [(superExecution] // set cause and root cause newIncident.setCauseIncidentId(id); // depends on control dependency: [if], data = [none] newIncident.setRootCauseIncidentId(rootCauseIncidentId); // depends on control dependency: [if], data = [none] // insert new incident (and create a new historic incident) insert(newIncident); // depends on control dependency: [if], data = [none] // add new incident to result set createdIncidents.add(newIncident); // depends on control dependency: [if], data = [none] newIncident.createRecursiveIncidents(rootCauseIncidentId, createdIncidents); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public boolean isSubtypesUnchecked(List<Type> ts, List<Type> ss, Warner warn) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtypeUnchecked(ts.head, ss.head, warn)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ } }
public class class_name { public boolean isSubtypesUnchecked(List<Type> ts, List<Type> ss, Warner warn) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtypeUnchecked(ts.head, ss.head, warn)) { ts = ts.tail; // depends on control dependency: [while], data = [none] ss = ss.tail; // depends on control dependency: [while], data = [none] } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ } }
public class class_name { public static String generateState(CmsSearchReplaceSettings settings) { String state = ""; state = A_CmsWorkplaceApp.addParamToState(state, SITE_ROOT, settings.getSiteRoot()); state = A_CmsWorkplaceApp.addParamToState(state, SEARCH_TYPE, settings.getType().name()); state = A_CmsWorkplaceApp.addParamToState(state, SEARCH_PATTERN, settings.getSearchpattern()); if (!settings.getPaths().isEmpty()) { state = A_CmsWorkplaceApp.addParamToState(state, FOLDER, settings.getPaths().get(0)); } state = A_CmsWorkplaceApp.addParamToState(state, RESOURCE_TYPE, settings.getTypes()); state = A_CmsWorkplaceApp.addParamToState(state, LOCALE, settings.getLocale()); state = A_CmsWorkplaceApp.addParamToState(state, QUERY, settings.getQuery()); state = A_CmsWorkplaceApp.addParamToState(state, INDEX, settings.getSource()); state = A_CmsWorkplaceApp.addParamToState(state, XPATH, settings.getXpath()); state = A_CmsWorkplaceApp.addParamToState(state, IGNORE_SUBSITES, String.valueOf(settings.ignoreSubSites())); state = A_CmsWorkplaceApp.addParamToState(state, PROPERTY, settings.getProperty().getName()); return state; } }
public class class_name { public static String generateState(CmsSearchReplaceSettings settings) { String state = ""; state = A_CmsWorkplaceApp.addParamToState(state, SITE_ROOT, settings.getSiteRoot()); state = A_CmsWorkplaceApp.addParamToState(state, SEARCH_TYPE, settings.getType().name()); state = A_CmsWorkplaceApp.addParamToState(state, SEARCH_PATTERN, settings.getSearchpattern()); if (!settings.getPaths().isEmpty()) { state = A_CmsWorkplaceApp.addParamToState(state, FOLDER, settings.getPaths().get(0)); // depends on control dependency: [if], data = [none] } state = A_CmsWorkplaceApp.addParamToState(state, RESOURCE_TYPE, settings.getTypes()); state = A_CmsWorkplaceApp.addParamToState(state, LOCALE, settings.getLocale()); state = A_CmsWorkplaceApp.addParamToState(state, QUERY, settings.getQuery()); state = A_CmsWorkplaceApp.addParamToState(state, INDEX, settings.getSource()); state = A_CmsWorkplaceApp.addParamToState(state, XPATH, settings.getXpath()); state = A_CmsWorkplaceApp.addParamToState(state, IGNORE_SUBSITES, String.valueOf(settings.ignoreSubSites())); state = A_CmsWorkplaceApp.addParamToState(state, PROPERTY, settings.getProperty().getName()); return state; } }
public class class_name { public void restoreFromFile(File file) throws IOException { byte[] rawData = new byte[(int) file.length()]; ByteBuffer bufData = null; FileInputStream fis = null; DataInputStream dis = null; try { fis = new FileInputStream(file); dis = new DataInputStream(fis); dis.readFully(rawData); bufData = ByteBuffer.wrap(rawData); restoreFromBuffer(bufData); } finally { if (dis != null) { dis.close(); } if (fis != null) { fis.close(); } } } }
public class class_name { public void restoreFromFile(File file) throws IOException { byte[] rawData = new byte[(int) file.length()]; ByteBuffer bufData = null; FileInputStream fis = null; DataInputStream dis = null; try { fis = new FileInputStream(file); dis = new DataInputStream(fis); dis.readFully(rawData); bufData = ByteBuffer.wrap(rawData); restoreFromBuffer(bufData); } finally { if (dis != null) { dis.close(); // depends on control dependency: [if], data = [none] } if (fis != null) { fis.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Date nextGivenMinuteDate (final Date date, final int minuteBase) { if (minuteBase < 0 || minuteBase > 59) { throw new IllegalArgumentException ("minuteBase must be >=0 and <= 59"); } final Calendar c = PDTFactory.createCalendar (); c.setTime (date != null ? date : new Date ()); c.setLenient (true); if (minuteBase == 0) { c.set (Calendar.HOUR_OF_DAY, c.get (Calendar.HOUR_OF_DAY) + 1); c.set (Calendar.MINUTE, 0); c.set (Calendar.SECOND, 0); c.set (Calendar.MILLISECOND, 0); } else { final int minute = c.get (Calendar.MINUTE); final int arItr = minute / minuteBase; final int nextMinuteOccurance = minuteBase * (arItr + 1); if (nextMinuteOccurance < 60) { c.set (Calendar.MINUTE, nextMinuteOccurance); c.set (Calendar.SECOND, 0); c.set (Calendar.MILLISECOND, 0); } else { c.set (Calendar.HOUR_OF_DAY, c.get (Calendar.HOUR_OF_DAY) + 1); c.set (Calendar.MINUTE, 0); c.set (Calendar.SECOND, 0); c.set (Calendar.MILLISECOND, 0); } } return c.getTime (); } }
public class class_name { public static Date nextGivenMinuteDate (final Date date, final int minuteBase) { if (minuteBase < 0 || minuteBase > 59) { throw new IllegalArgumentException ("minuteBase must be >=0 and <= 59"); } final Calendar c = PDTFactory.createCalendar (); c.setTime (date != null ? date : new Date ()); c.setLenient (true); if (minuteBase == 0) { c.set (Calendar.HOUR_OF_DAY, c.get (Calendar.HOUR_OF_DAY) + 1); // depends on control dependency: [if], data = [none] c.set (Calendar.MINUTE, 0); // depends on control dependency: [if], data = [0)] c.set (Calendar.SECOND, 0); // depends on control dependency: [if], data = [0)] c.set (Calendar.MILLISECOND, 0); // depends on control dependency: [if], data = [0)] } else { final int minute = c.get (Calendar.MINUTE); final int arItr = minute / minuteBase; final int nextMinuteOccurance = minuteBase * (arItr + 1); if (nextMinuteOccurance < 60) { c.set (Calendar.MINUTE, nextMinuteOccurance); // depends on control dependency: [if], data = [none] c.set (Calendar.SECOND, 0); // depends on control dependency: [if], data = [none] c.set (Calendar.MILLISECOND, 0); // depends on control dependency: [if], data = [none] } else { c.set (Calendar.HOUR_OF_DAY, c.get (Calendar.HOUR_OF_DAY) + 1); // depends on control dependency: [if], data = [none] c.set (Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none] c.set (Calendar.SECOND, 0); // depends on control dependency: [if], data = [none] c.set (Calendar.MILLISECOND, 0); // depends on control dependency: [if], data = [none] } } return c.getTime (); } }
public class class_name { public String getNextAvailableNodeId(final String nodeId) { String result = nodeId; do { result = _primaryNodeIds.getNextNodeId(result); if(result != null && result.equals(nodeId)) { result = null; } } while(result != null && !isNodeAvailable(result)); return result; } }
public class class_name { public String getNextAvailableNodeId(final String nodeId) { String result = nodeId; do { result = _primaryNodeIds.getNextNodeId(result); if(result != null && result.equals(nodeId)) { result = null; // depends on control dependency: [if], data = [none] } } while(result != null && !isNodeAvailable(result)); return result; } }
public class class_name { public GL createSurface(SurfaceHolder holder) { /* * The window size has changed, so we need to create a new surface. */ if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { /* * Unbind and destroy the old EGL surface, if there is one. */ mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); } /* * Create an EGL surface we can render into. */ mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, holder); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { throw new RuntimeException("createWindowSurface failed"); } /* * Before we can issue GL commands, we need to make sure the context is current and bound to a surface. */ if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throw new RuntimeException("eglMakeCurrent failed."); } GL gl = mEglContext.getGL(); if (mGLWrapper != null) { gl = mGLWrapper.wrap(gl); } /* * if ((mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS))!= 0) { int configFlags = 0; Writer log = * null; if ((mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } * if ((mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, * configFlags, log); } */ return gl; } }
public class class_name { public GL createSurface(SurfaceHolder holder) { /* * The window size has changed, so we need to create a new surface. */ if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { /* * Unbind and destroy the old EGL surface, if there is one. */ mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); // depends on control dependency: [if], data = [none] mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface); // depends on control dependency: [if], data = [none] } /* * Create an EGL surface we can render into. */ mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, holder); if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { throw new RuntimeException("createWindowSurface failed"); } /* * Before we can issue GL commands, we need to make sure the context is current and bound to a surface. */ if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throw new RuntimeException("eglMakeCurrent failed."); } GL gl = mEglContext.getGL(); if (mGLWrapper != null) { gl = mGLWrapper.wrap(gl); // depends on control dependency: [if], data = [none] } /* * if ((mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS))!= 0) { int configFlags = 0; Writer log = * null; if ((mDebugFlags & DEBUG_CHECK_GL_ERROR) != 0) { configFlags |= GLDebugHelper.CONFIG_CHECK_GL_ERROR; } * if ((mDebugFlags & DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl = GLDebugHelper.wrap(gl, * configFlags, log); } */ return gl; } }
public class class_name { public double[] solveLInplace(double[] X) { final int n = L.length; X[0] /= L[0][0]; // First iteration, simplified. for(int k = 1; k < n; k++) { final double[] Lk = L[k]; for(int i = 0; i < k; i++) { X[k] -= X[i] * Lk[i]; } X[k] /= Lk[k]; } return X; } }
public class class_name { public double[] solveLInplace(double[] X) { final int n = L.length; X[0] /= L[0][0]; // First iteration, simplified. for(int k = 1; k < n; k++) { final double[] Lk = L[k]; for(int i = 0; i < k; i++) { X[k] -= X[i] * Lk[i]; // depends on control dependency: [for], data = [i] } X[k] /= Lk[k]; // depends on control dependency: [for], data = [k] } return X; } }
public class class_name { public static VoltTable tableFromShorthand(String schema) { String name = "T"; VoltTable.ColumnInfo[] columns = null; // get a name Matcher nameMatcher = m_namePattern.matcher(schema); if (nameMatcher.find()) { name = nameMatcher.group().trim(); } // get the column schema Matcher columnDataMatcher = m_columnsPattern.matcher(schema); if (!columnDataMatcher.find()) { throw new IllegalArgumentException("No column data found in shorthand"); } String[] columnData = columnDataMatcher.group().trim().split("\\s*,\\s*"); int columnCount = columnData.length; columns = new VoltTable.ColumnInfo[columnCount]; for (int i = 0; i < columnCount; i++) { columns[i] = parseColumnShorthand(columnData[i], i); } // get the pkey Matcher pkeyMatcher = m_pkeyPattern.matcher(schema); int[] pkeyIndexes = new int[0]; // default no pkey if (pkeyMatcher.find()) { String[] pkeyColData = pkeyMatcher.group().trim().split("\\s*,\\s*"); pkeyIndexes = new int[pkeyColData.length]; for (int pkeyIndex = 0; pkeyIndex < pkeyColData.length; pkeyIndex++) { String pkeyCol = pkeyColData[pkeyIndex]; // numeric means index of column if (Character.isDigit(pkeyCol.charAt(0))) { int colIndex = Integer.parseInt(pkeyCol); pkeyIndexes[pkeyIndex] = colIndex; } else { for (int colIndex = 0; colIndex < columnCount; colIndex++) { if (columns[colIndex].name.equals(pkeyCol)) { pkeyIndexes[pkeyIndex] = colIndex; break; } } } } } // get any partitioning Matcher partitionMatcher = m_partitionPattern.matcher(schema); int partitionColumnIndex = -1; // default to replicated if (partitionMatcher.find()) { String partitionColStr = partitionMatcher.group().trim(); // numeric means index of column if (Character.isDigit(partitionColStr.charAt(0))) { partitionColumnIndex = Integer.parseInt(partitionColStr); } else { for (int colIndex = 0; colIndex < columnCount; colIndex++) { if (columns[colIndex].name.equals(partitionColStr)) { partitionColumnIndex = colIndex; break; } } } assert(partitionColumnIndex != -1) : "Regex match here means there is a partitioning column"; } VoltTable table = new VoltTable( new VoltTable.ExtraMetadata(name, partitionColumnIndex, pkeyIndexes, columns), columns, columns.length); return table; } }
public class class_name { public static VoltTable tableFromShorthand(String schema) { String name = "T"; VoltTable.ColumnInfo[] columns = null; // get a name Matcher nameMatcher = m_namePattern.matcher(schema); if (nameMatcher.find()) { name = nameMatcher.group().trim(); // depends on control dependency: [if], data = [none] } // get the column schema Matcher columnDataMatcher = m_columnsPattern.matcher(schema); if (!columnDataMatcher.find()) { throw new IllegalArgumentException("No column data found in shorthand"); } String[] columnData = columnDataMatcher.group().trim().split("\\s*,\\s*"); int columnCount = columnData.length; columns = new VoltTable.ColumnInfo[columnCount]; for (int i = 0; i < columnCount; i++) { columns[i] = parseColumnShorthand(columnData[i], i); // depends on control dependency: [for], data = [i] } // get the pkey Matcher pkeyMatcher = m_pkeyPattern.matcher(schema); int[] pkeyIndexes = new int[0]; // default no pkey if (pkeyMatcher.find()) { String[] pkeyColData = pkeyMatcher.group().trim().split("\\s*,\\s*"); pkeyIndexes = new int[pkeyColData.length]; // depends on control dependency: [if], data = [none] for (int pkeyIndex = 0; pkeyIndex < pkeyColData.length; pkeyIndex++) { String pkeyCol = pkeyColData[pkeyIndex]; // numeric means index of column if (Character.isDigit(pkeyCol.charAt(0))) { int colIndex = Integer.parseInt(pkeyCol); pkeyIndexes[pkeyIndex] = colIndex; // depends on control dependency: [if], data = [none] } else { for (int colIndex = 0; colIndex < columnCount; colIndex++) { if (columns[colIndex].name.equals(pkeyCol)) { pkeyIndexes[pkeyIndex] = colIndex; // depends on control dependency: [if], data = [none] break; } } } } } // get any partitioning Matcher partitionMatcher = m_partitionPattern.matcher(schema); int partitionColumnIndex = -1; // default to replicated if (partitionMatcher.find()) { String partitionColStr = partitionMatcher.group().trim(); // numeric means index of column if (Character.isDigit(partitionColStr.charAt(0))) { partitionColumnIndex = Integer.parseInt(partitionColStr); // depends on control dependency: [if], data = [none] } else { for (int colIndex = 0; colIndex < columnCount; colIndex++) { if (columns[colIndex].name.equals(partitionColStr)) { partitionColumnIndex = colIndex; // depends on control dependency: [if], data = [none] break; } } } assert(partitionColumnIndex != -1) : "Regex match here means there is a partitioning column"; } VoltTable table = new VoltTable( new VoltTable.ExtraMetadata(name, partitionColumnIndex, pkeyIndexes, columns), columns, columns.length); return table; } }
public class class_name { @Deprecated public Set<AbstractTagBase> getRebuiltTags(final Object accessObject) { // TODO remove this method later if (accessObject == null || !(SecurityClassConstants.ABSTRACT_HTML .equals(accessObject.getClass().getName()))) { throw new WffSecurityException( "Not allowed to consume this method. This method is for internal use."); } if (rebuiltTags == null) { synchronized (this) { if (rebuiltTags == null) { rebuiltTags = Collections.newSetFromMap( new WeakHashMap<AbstractTagBase, Boolean>()); } } } return rebuiltTags; } }
public class class_name { @Deprecated public Set<AbstractTagBase> getRebuiltTags(final Object accessObject) { // TODO remove this method later if (accessObject == null || !(SecurityClassConstants.ABSTRACT_HTML .equals(accessObject.getClass().getName()))) { throw new WffSecurityException( "Not allowed to consume this method. This method is for internal use."); } if (rebuiltTags == null) { synchronized (this) { // depends on control dependency: [if], data = [none] if (rebuiltTags == null) { rebuiltTags = Collections.newSetFromMap( new WeakHashMap<AbstractTagBase, Boolean>()); // depends on control dependency: [if], data = [none] } } } return rebuiltTags; } }
public class class_name { @Override public synchronized BooleanQuery doQuery(Schema schema) { int oldMaxClauses= BooleanQuery.getMaxClauseCount(); BooleanQuery.setMaxClauseCount(maxClauses); BooleanQuery.Builder builder = new BooleanQuery.Builder(); must.forEach(condition -> builder.add(condition.query(schema), MUST)); should.forEach(condition -> builder.add(condition.query(schema), SHOULD)); not.forEach(condition -> builder.add(condition.query(schema), MUST_NOT)); if (must.isEmpty() && should.isEmpty() && !not.isEmpty()) { logger.warn("Performing resource-intensive pure negation query {}", this); builder.add(new MatchAllDocsQuery(), FILTER); } BooleanQuery out=builder.build(); BooleanQuery.setMaxClauseCount(oldMaxClauses); return out; } }
public class class_name { @Override public synchronized BooleanQuery doQuery(Schema schema) { int oldMaxClauses= BooleanQuery.getMaxClauseCount(); BooleanQuery.setMaxClauseCount(maxClauses); BooleanQuery.Builder builder = new BooleanQuery.Builder(); must.forEach(condition -> builder.add(condition.query(schema), MUST)); should.forEach(condition -> builder.add(condition.query(schema), SHOULD)); not.forEach(condition -> builder.add(condition.query(schema), MUST_NOT)); if (must.isEmpty() && should.isEmpty() && !not.isEmpty()) { logger.warn("Performing resource-intensive pure negation query {}", this); // depends on control dependency: [if], data = [none] builder.add(new MatchAllDocsQuery(), FILTER); // depends on control dependency: [if], data = [none] } BooleanQuery out=builder.build(); BooleanQuery.setMaxClauseCount(oldMaxClauses); return out; } }
public class class_name { private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) { repositories.put(repositoryId, repositoryHolder); try { numRepos = getNumberOfRepositories(); } catch (WIMException e) { // okay } } }
public class class_name { private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) { repositories.put(repositoryId, repositoryHolder); try { numRepos = getNumberOfRepositories(); // depends on control dependency: [try], data = [none] } catch (WIMException e) { // okay } // depends on control dependency: [catch], data = [none] } }
public class class_name { void computeDescriptor(int row, int col) { // set location to top-left pixel locations.grow().set(col* pixelsPerCell,row* pixelsPerCell); TupleDesc_F64 d = descriptions.grow(); int indexDesc = 0; for (int i = 0; i < cellsPerBlockY; i++) { for (int j = 0; j < cellsPerBlockX; j++) { Cell c = cells[(row+i)*cellCols + (col+j)]; for (int k = 0; k < c.histogram.length; k++) { d.value[indexDesc++] = c.histogram[k]; } } } // Apply SIFT style L2-Hys normalization DescribeSiftCommon.normalizeDescriptor(d,0.2); } }
public class class_name { void computeDescriptor(int row, int col) { // set location to top-left pixel locations.grow().set(col* pixelsPerCell,row* pixelsPerCell); TupleDesc_F64 d = descriptions.grow(); int indexDesc = 0; for (int i = 0; i < cellsPerBlockY; i++) { for (int j = 0; j < cellsPerBlockX; j++) { Cell c = cells[(row+i)*cellCols + (col+j)]; for (int k = 0; k < c.histogram.length; k++) { d.value[indexDesc++] = c.histogram[k]; // depends on control dependency: [for], data = [k] } } } // Apply SIFT style L2-Hys normalization DescribeSiftCommon.normalizeDescriptor(d,0.2); } }
public class class_name { public static SDDL userCannotChangePassword(final SDDL sddl, final Boolean cannot) { final AceType type = cannot ? AceType.ACCESS_DENIED_OBJECT_ACE_TYPE : AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE; ACE self = null; ACE all = null; final List<ACE> aces = sddl.getDacl().getAces(); for (int i = 0; (all == null || self == null) && i < aces.size(); i++) { final ACE ace = aces.get(i); if ((ace.getType() == AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE || ace.getType() == AceType.ACCESS_DENIED_OBJECT_ACE_TYPE) && ace.getObjectFlags().getFlags().contains(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)) { if (GUID.getGuidAsString(ace.getObjectType()).equals(UCP_OBJECT_GUID)) { final SID sid = ace.getSid(); if (sid.getSubAuthorities().size() == 1) { if (self == null && Arrays.equals( sid.getIdentifierAuthority(), new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }) && Arrays.equals( sid.getSubAuthorities().get(0), new byte[] { 0x00, 0x00, 0x00, 0x00 })) { self = ace; self.setType(type); } else if (all == null && Arrays.equals( sid.getIdentifierAuthority(), new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 }) && Arrays.equals( sid.getSubAuthorities().get(0), new byte[] { 0x00, 0x00, 0x00, 0x0a })) { all = ace; all.setType(type); } } } } } if (self == null) { // prepare aces self = ACE.newInstance(type); self.setObjectFlags(new AceObjectFlags(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)); self.setObjectType(GUID.getGuidAsByteArray(UCP_OBJECT_GUID)); self.setRights(new AceRights().addOjectRight(AceRights.ObjectRight.CR)); SID sid = SID.newInstance(NumberFacility.getBytes(0x000000000001, 6)); sid.addSubAuthority(NumberFacility.getBytes(0)); self.setSid(sid); sddl.getDacl().getAces().add(self); } if (all == null) { all = ACE.newInstance(type); all.setObjectFlags(new AceObjectFlags(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)); all.setObjectType(GUID.getGuidAsByteArray(UCP_OBJECT_GUID)); all.setRights(new AceRights().addOjectRight(AceRights.ObjectRight.CR)); final SID sid = SID.newInstance(NumberFacility.getBytes(0x000000000005, 6)); sid.addSubAuthority(NumberFacility.getBytes(0x0A)); all.setSid(sid); sddl.getDacl().getAces().add(all); } return sddl; } }
public class class_name { public static SDDL userCannotChangePassword(final SDDL sddl, final Boolean cannot) { final AceType type = cannot ? AceType.ACCESS_DENIED_OBJECT_ACE_TYPE : AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE; ACE self = null; ACE all = null; final List<ACE> aces = sddl.getDacl().getAces(); for (int i = 0; (all == null || self == null) && i < aces.size(); i++) { final ACE ace = aces.get(i); if ((ace.getType() == AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE || ace.getType() == AceType.ACCESS_DENIED_OBJECT_ACE_TYPE) && ace.getObjectFlags().getFlags().contains(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)) { if (GUID.getGuidAsString(ace.getObjectType()).equals(UCP_OBJECT_GUID)) { final SID sid = ace.getSid(); if (sid.getSubAuthorities().size() == 1) { if (self == null && Arrays.equals( sid.getIdentifierAuthority(), new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }) && Arrays.equals( sid.getSubAuthorities().get(0), new byte[] { 0x00, 0x00, 0x00, 0x00 })) { self = ace; // depends on control dependency: [if], data = [none] self.setType(type); // depends on control dependency: [if], data = [none] } else if (all == null && Arrays.equals( sid.getIdentifierAuthority(), new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 }) && Arrays.equals( sid.getSubAuthorities().get(0), new byte[] { 0x00, 0x00, 0x00, 0x0a })) { all = ace; // depends on control dependency: [if], data = [none] all.setType(type); // depends on control dependency: [if], data = [none] } } } } } if (self == null) { // prepare aces self = ACE.newInstance(type); // depends on control dependency: [if], data = [none] self.setObjectFlags(new AceObjectFlags(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)); // depends on control dependency: [if], data = [none] self.setObjectType(GUID.getGuidAsByteArray(UCP_OBJECT_GUID)); // depends on control dependency: [if], data = [none] self.setRights(new AceRights().addOjectRight(AceRights.ObjectRight.CR)); // depends on control dependency: [if], data = [none] SID sid = SID.newInstance(NumberFacility.getBytes(0x000000000001, 6)); sid.addSubAuthority(NumberFacility.getBytes(0)); // depends on control dependency: [if], data = [none] self.setSid(sid); // depends on control dependency: [if], data = [none] sddl.getDacl().getAces().add(self); // depends on control dependency: [if], data = [(self] } if (all == null) { all = ACE.newInstance(type); // depends on control dependency: [if], data = [none] all.setObjectFlags(new AceObjectFlags(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)); // depends on control dependency: [if], data = [none] all.setObjectType(GUID.getGuidAsByteArray(UCP_OBJECT_GUID)); // depends on control dependency: [if], data = [none] all.setRights(new AceRights().addOjectRight(AceRights.ObjectRight.CR)); // depends on control dependency: [if], data = [none] final SID sid = SID.newInstance(NumberFacility.getBytes(0x000000000005, 6)); sid.addSubAuthority(NumberFacility.getBytes(0x0A)); // depends on control dependency: [if], data = [none] all.setSid(sid); // depends on control dependency: [if], data = [none] sddl.getDacl().getAces().add(all); // depends on control dependency: [if], data = [(all] } return sddl; } }
public class class_name { public void setInputType(InputType input) { if (this.stateMachine.currentMissionBehaviour() != null && this.stateMachine.currentMissionBehaviour().commandHandler != null) this.stateMachine.currentMissionBehaviour().commandHandler.setOverriding(input == InputType.AI); if (this.mouseHook != null) this.mouseHook.isOverriding = (input == InputType.AI); // This stops Minecraft from doing the annoying thing of stealing your mouse. System.setProperty("fml.noGrab", input == InputType.AI ? "true" : "false"); inputType = input; if (input == InputType.HUMAN) { Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); } else { Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor(); } this.stateMachine.getScreenHelper().addFragment("Mouse: " + input, TextCategory.TXT_INFO, INFO_MOUSE_CONTROL); } }
public class class_name { public void setInputType(InputType input) { if (this.stateMachine.currentMissionBehaviour() != null && this.stateMachine.currentMissionBehaviour().commandHandler != null) this.stateMachine.currentMissionBehaviour().commandHandler.setOverriding(input == InputType.AI); if (this.mouseHook != null) this.mouseHook.isOverriding = (input == InputType.AI); // This stops Minecraft from doing the annoying thing of stealing your mouse. System.setProperty("fml.noGrab", input == InputType.AI ? "true" : "false"); inputType = input; if (input == InputType.HUMAN) { Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); // depends on control dependency: [if], data = [none] } else { Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor(); // depends on control dependency: [if], data = [none] } this.stateMachine.getScreenHelper().addFragment("Mouse: " + input, TextCategory.TXT_INFO, INFO_MOUSE_CONTROL); } }
public class class_name { private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) { final WebAppErrorPage errorPage = new WebAppErrorPage(); if (errorPageType.getErrorCode() != null) { errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString()); } if (errorPageType.getExceptionType() != null) { errorPage.setExceptionType(errorPageType.getExceptionType().getValue()); } if (errorPageType.getLocation() != null) { errorPage.setLocation(errorPageType.getLocation().getValue()); } if (errorPage.getErrorCode() == null && errorPage.getExceptionType() == null) { errorPage.setExceptionType(ErrorPageModel.ERROR_PAGE); } webApp.addErrorPage(errorPage); } }
public class class_name { private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) { final WebAppErrorPage errorPage = new WebAppErrorPage(); if (errorPageType.getErrorCode() != null) { errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString()); // depends on control dependency: [if], data = [(errorPageType.getErrorCode()] } if (errorPageType.getExceptionType() != null) { errorPage.setExceptionType(errorPageType.getExceptionType().getValue()); // depends on control dependency: [if], data = [(errorPageType.getExceptionType()] } if (errorPageType.getLocation() != null) { errorPage.setLocation(errorPageType.getLocation().getValue()); // depends on control dependency: [if], data = [(errorPageType.getLocation()] } if (errorPage.getErrorCode() == null && errorPage.getExceptionType() == null) { errorPage.setExceptionType(ErrorPageModel.ERROR_PAGE); // depends on control dependency: [if], data = [none] } webApp.addErrorPage(errorPage); } }
public class class_name { private synchronized void checkShutDownRunningProcesses() { smtpRequestsPhaser.arriveAndDeregister(); LOGGER.trace("SMTP request threads left: {}", smtpRequestsPhaser.getUnarrivedParties()); // if this thread is the last one finishing if (smtpRequestsPhaser.getUnarrivedParties() == 0) { LOGGER.trace("all threads have finished processing"); //noinspection ConstantConditions if (needsAuthenticatedProxy() && proxyServer.isRunning() && !proxyServer.isStopping()) { LOGGER.trace("stopping proxy bridge..."); proxyServer.stop(); } // shutdown the threadpool, or else the Mailer will keep any JVM alive forever // executor is only available in async mode if (executor != null) { executor.shutdown(); } } } }
public class class_name { private synchronized void checkShutDownRunningProcesses() { smtpRequestsPhaser.arriveAndDeregister(); LOGGER.trace("SMTP request threads left: {}", smtpRequestsPhaser.getUnarrivedParties()); // if this thread is the last one finishing if (smtpRequestsPhaser.getUnarrivedParties() == 0) { LOGGER.trace("all threads have finished processing"); // depends on control dependency: [if], data = [none] //noinspection ConstantConditions if (needsAuthenticatedProxy() && proxyServer.isRunning() && !proxyServer.isStopping()) { LOGGER.trace("stopping proxy bridge..."); // depends on control dependency: [if], data = [none] proxyServer.stop(); // depends on control dependency: [if], data = [none] } // shutdown the threadpool, or else the Mailer will keep any JVM alive forever // executor is only available in async mode if (executor != null) { executor.shutdown(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) { Field[] declaredFields = classType.getDeclaredFields(); for (Field field : declaredFields) { if (field.getType().isAssignableFrom(fieldType)) { return field.getName(); } } if (classType.getSuperclass() != null) { return getFieldNameByType(classType.getSuperclass(), fieldType); } return null; } }
public class class_name { public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) { Field[] declaredFields = classType.getDeclaredFields(); for (Field field : declaredFields) { if (field.getType().isAssignableFrom(fieldType)) { return field.getName(); // depends on control dependency: [if], data = [none] } } if (classType.getSuperclass() != null) { return getFieldNameByType(classType.getSuperclass(), fieldType); // depends on control dependency: [if], data = [(classType.getSuperclass()] } return null; } }
public class class_name { public static URL getResource(String resource, Class<?> context, boolean checkParent) { URL url = Thread.currentThread().getContextClassLoader().getResource(resource); if (url != null) return url; if (context != null) { ClassLoader loader = context.getClassLoader(); while (loader != null) { url = loader.getResource(resource); if (url != null) return url; loader = checkParent ? loader.getParent() : null; } } return ClassLoader.getSystemResource(resource); } }
public class class_name { public static URL getResource(String resource, Class<?> context, boolean checkParent) { URL url = Thread.currentThread().getContextClassLoader().getResource(resource); if (url != null) return url; if (context != null) { ClassLoader loader = context.getClassLoader(); while (loader != null) { url = loader.getResource(resource); // depends on control dependency: [while], data = [none] if (url != null) return url; loader = checkParent ? loader.getParent() : null; // depends on control dependency: [while], data = [none] } } return ClassLoader.getSystemResource(resource); } }
public class class_name { public static ConfigurationElement getConfigurationElement(Configuration config, String... names) { if (config != null && names.length > 0) { String first = names[0]; ConfigurationElement root = findConfigurationElement(config, first); if (root != null) { if (names.length == 1) { return root; } else { int remainingLength = names.length - 1; String[] remaining = new String[remainingLength]; System.arraycopy(names, 1, remaining, 0, remainingLength); return getConfigurationElement(root, remaining); } } } return null; } }
public class class_name { public static ConfigurationElement getConfigurationElement(Configuration config, String... names) { if (config != null && names.length > 0) { String first = names[0]; ConfigurationElement root = findConfigurationElement(config, first); if (root != null) { if (names.length == 1) { return root; // depends on control dependency: [if], data = [none] } else { int remainingLength = names.length - 1; String[] remaining = new String[remainingLength]; System.arraycopy(names, 1, remaining, 0, remainingLength); // depends on control dependency: [if], data = [none] return getConfigurationElement(root, remaining); // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { public static Status valueOf(String name) { if (name == null) { return UNDEFINED; } for (Status status : INSTANCES.values()) { if (name.equals(status.getName())) { return status; } } return UNDEFINED; } }
public class class_name { public static Status valueOf(String name) { if (name == null) { return UNDEFINED; // depends on control dependency: [if], data = [none] } for (Status status : INSTANCES.values()) { if (name.equals(status.getName())) { return status; // depends on control dependency: [if], data = [none] } } return UNDEFINED; } }
public class class_name { public void marshall(UpdateNumberOfDomainControllersRequest updateNumberOfDomainControllersRequest, ProtocolMarshaller protocolMarshaller) { if (updateNumberOfDomainControllersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateNumberOfDomainControllersRequest.getDirectoryId(), DIRECTORYID_BINDING); protocolMarshaller.marshall(updateNumberOfDomainControllersRequest.getDesiredNumber(), DESIREDNUMBER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateNumberOfDomainControllersRequest updateNumberOfDomainControllersRequest, ProtocolMarshaller protocolMarshaller) { if (updateNumberOfDomainControllersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateNumberOfDomainControllersRequest.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateNumberOfDomainControllersRequest.getDesiredNumber(), DESIREDNUMBER_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 final EObject entryRuleXAndExpression() throws RecognitionException { EObject current = null; EObject iv_ruleXAndExpression = null; try { // InternalPureXbase.g:1121:55: (iv_ruleXAndExpression= ruleXAndExpression EOF ) // InternalPureXbase.g:1122:2: iv_ruleXAndExpression= ruleXAndExpression EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXAndExpressionRule()); } pushFollow(FOLLOW_1); iv_ruleXAndExpression=ruleXAndExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleXAndExpression; } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject entryRuleXAndExpression() throws RecognitionException { EObject current = null; EObject iv_ruleXAndExpression = null; try { // InternalPureXbase.g:1121:55: (iv_ruleXAndExpression= ruleXAndExpression EOF ) // InternalPureXbase.g:1122:2: iv_ruleXAndExpression= ruleXAndExpression EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXAndExpressionRule()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_1); iv_ruleXAndExpression=ruleXAndExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleXAndExpression; // depends on control dependency: [if], data = [none] } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public static void writeTo(String html, Writer writer) throws IOException { int index = html.indexOf('#'); if (index == -1) { writer.write(html); } else { final ResourceBundle resourceBundle = getResourceBundle(); int begin = 0; while (index != -1) { writer.write(html, begin, index - begin); final int nextIndex = html.indexOf('#', index + 1); final String key = html.substring(index + 1, nextIndex); writer.write(resourceBundle.getString(key)); begin = nextIndex + 1; index = html.indexOf('#', begin); } writer.write(html, begin, html.length() - begin); } } }
public class class_name { public static void writeTo(String html, Writer writer) throws IOException { int index = html.indexOf('#'); if (index == -1) { writer.write(html); } else { final ResourceBundle resourceBundle = getResourceBundle(); int begin = 0; while (index != -1) { writer.write(html, begin, index - begin); // depends on control dependency: [while], data = [none] final int nextIndex = html.indexOf('#', index + 1); final String key = html.substring(index + 1, nextIndex); writer.write(resourceBundle.getString(key)); // depends on control dependency: [while], data = [none] begin = nextIndex + 1; // depends on control dependency: [while], data = [none] index = html.indexOf('#', begin); // depends on control dependency: [while], data = [none] } writer.write(html, begin, html.length() - begin); } } }
public class class_name { public static void mergeAttributes( java.util.jar.Attributes target, java.util.jar.Attributes section ) { for ( Object o : section.keySet() ) { java.util.jar.Attributes.Name key = (Attributes.Name) o; final Object value = section.get( o ); // the merge file always wins target.put( key, value ); } } }
public class class_name { public static void mergeAttributes( java.util.jar.Attributes target, java.util.jar.Attributes section ) { for ( Object o : section.keySet() ) { java.util.jar.Attributes.Name key = (Attributes.Name) o; final Object value = section.get( o ); // the merge file always wins target.put( key, value ); // depends on control dependency: [for], data = [none] } } }
public class class_name { public TechnologyTagModel addTagToFileModel(FileModel fileModel, String tagName, TechnologyTagLevel level) { Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class) .traverse(g -> g.has(TechnologyTagModel.NAME, tagName)); TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal()); if (technologyTag == null) { technologyTag = create(); technologyTag.setName(tagName); technologyTag.setLevel(level); } if (level == TechnologyTagLevel.IMPORTANT && fileModel instanceof SourceFileModel) ((SourceFileModel) fileModel).setGenerateSourceReport(true); technologyTag.addFileModel(fileModel); return technologyTag; } }
public class class_name { public TechnologyTagModel addTagToFileModel(FileModel fileModel, String tagName, TechnologyTagLevel level) { Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class) .traverse(g -> g.has(TechnologyTagModel.NAME, tagName)); TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal()); if (technologyTag == null) { technologyTag = create(); // depends on control dependency: [if], data = [none] technologyTag.setName(tagName); // depends on control dependency: [if], data = [none] technologyTag.setLevel(level); // depends on control dependency: [if], data = [none] } if (level == TechnologyTagLevel.IMPORTANT && fileModel instanceof SourceFileModel) ((SourceFileModel) fileModel).setGenerateSourceReport(true); technologyTag.addFileModel(fileModel); return technologyTag; } }
public class class_name { public List<Interval<T>> complement(final Interval<T> op) throws MIDDException { final boolean disJoined = (this.lowerBound.compareTo(op.upperBound) >= 0) || (this.upperBound.compareTo(op.lowerBound) <= 0); if (disJoined) { Interval<T> newInterval = new Interval<>(this.lowerBound, this.upperBound); final boolean isLowerClosed; if (this.lowerBound.compareTo(op.upperBound) == 0) { isLowerClosed = this.lowerBoundClosed && !op.upperBoundClosed; } else { isLowerClosed = this.lowerBoundClosed; } newInterval.closeLeft(isLowerClosed); final boolean isUpperClosed; if (this.upperBound.compareTo(op.lowerBound) == 0) { isUpperClosed = this.upperBoundClosed && !op.upperBoundClosed; } else { isUpperClosed = this.upperBoundClosed; } newInterval.closeRight(isUpperClosed); // return empty if new interval is invalid if (!newInterval.validate()) { return ImmutableList.of(); } return ImmutableList.of(newInterval); } else { final Interval<T> interval1 = new Interval<>(this.lowerBound, op.lowerBound); final Interval<T> interval2 = new Interval<>(op.upperBound, this.upperBound); interval1.closeLeft(!interval1.isLowerInfinite() && this.lowerBoundClosed); interval1.closeRight(!interval1.isUpperInfinite() && !op.lowerBoundClosed); interval2.closeLeft(!interval2.isLowerInfinite() && !op.upperBoundClosed); interval2.closeRight(!interval2.isUpperInfinite() && this.upperBoundClosed); final List<Interval<T>> result = new ArrayList<>(); if (interval1.validate()) { result.add(interval1); } if (interval2.validate()) { result.add(interval2); } return ImmutableList.copyOf(result); } } }
public class class_name { public List<Interval<T>> complement(final Interval<T> op) throws MIDDException { final boolean disJoined = (this.lowerBound.compareTo(op.upperBound) >= 0) || (this.upperBound.compareTo(op.lowerBound) <= 0); if (disJoined) { Interval<T> newInterval = new Interval<>(this.lowerBound, this.upperBound); final boolean isLowerClosed; if (this.lowerBound.compareTo(op.upperBound) == 0) { isLowerClosed = this.lowerBoundClosed && !op.upperBoundClosed; // depends on control dependency: [if], data = [none] } else { isLowerClosed = this.lowerBoundClosed; // depends on control dependency: [if], data = [none] } newInterval.closeLeft(isLowerClosed); final boolean isUpperClosed; if (this.upperBound.compareTo(op.lowerBound) == 0) { isUpperClosed = this.upperBoundClosed && !op.upperBoundClosed; // depends on control dependency: [if], data = [none] } else { isUpperClosed = this.upperBoundClosed; // depends on control dependency: [if], data = [none] } newInterval.closeRight(isUpperClosed); // return empty if new interval is invalid if (!newInterval.validate()) { return ImmutableList.of(); // depends on control dependency: [if], data = [none] } return ImmutableList.of(newInterval); } else { final Interval<T> interval1 = new Interval<>(this.lowerBound, op.lowerBound); final Interval<T> interval2 = new Interval<>(op.upperBound, this.upperBound); interval1.closeLeft(!interval1.isLowerInfinite() && this.lowerBoundClosed); interval1.closeRight(!interval1.isUpperInfinite() && !op.lowerBoundClosed); interval2.closeLeft(!interval2.isLowerInfinite() && !op.upperBoundClosed); interval2.closeRight(!interval2.isUpperInfinite() && this.upperBoundClosed); final List<Interval<T>> result = new ArrayList<>(); if (interval1.validate()) { result.add(interval1); // depends on control dependency: [if], data = [none] } if (interval2.validate()) { result.add(interval2); // depends on control dependency: [if], data = [none] } return ImmutableList.copyOf(result); } } }
public class class_name { public void setAliasAttributes(java.util.Collection<String> aliasAttributes) { if (aliasAttributes == null) { this.aliasAttributes = null; return; } this.aliasAttributes = new java.util.ArrayList<String>(aliasAttributes); } }
public class class_name { public void setAliasAttributes(java.util.Collection<String> aliasAttributes) { if (aliasAttributes == null) { this.aliasAttributes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.aliasAttributes = new java.util.ArrayList<String>(aliasAttributes); } }
public class class_name { private int processWrite(int state, final Object userData, int pos, int length) throws IOException { if (done || exchange == null) { throw new ClosedChannelException(); } try { assert state != STATE_BODY; if (state == STATE_BUF_FLUSH) { final ByteBuffer byteBuffer = pooledBuffer.getBuffer(); do { long res = 0; ByteBuffer[] data; if (userData == null || length == 0) { res = next.write(byteBuffer); } else if (userData instanceof ByteBuffer) { data = writevBuffer; if (data == null) { data = writevBuffer = new ByteBuffer[2]; } data[0] = byteBuffer; data[1] = (ByteBuffer) userData; res = next.write(data, 0, 2); } else { data = writevBuffer; if (data == null || data.length < length + 1) { data = writevBuffer = new ByteBuffer[length + 1]; } data[0] = byteBuffer; System.arraycopy(userData, pos, data, 1, length); res = next.write(data, 0, length + 1); } if (res == 0) { return STATE_BUF_FLUSH; } } while (byteBuffer.hasRemaining()); bufferDone(); return STATE_BODY; } else if (state != STATE_START) { return processStatefulWrite(state, userData, pos, length); } //merge the cookies into the header map Connectors.flattenCookies(exchange); if (pooledBuffer == null) { pooledBuffer = pool.allocate(); } ByteBuffer buffer = pooledBuffer.getBuffer(); assert buffer.remaining() >= 50; Protocols.HTTP_1_1.appendTo(buffer); buffer.put((byte) ' '); int code = exchange.getStatusCode(); assert 999 >= code && code >= 100; buffer.put((byte) (code / 100 + '0')); buffer.put((byte) (code / 10 % 10 + '0')); buffer.put((byte) (code % 10 + '0')); buffer.put((byte) ' '); String string = exchange.getReasonPhrase(); if(string == null) { string = StatusCodes.getReason(code); } if(string.length() > buffer.remaining()) { pooledBuffer.close(); pooledBuffer = null; truncateWrites(); throw UndertowMessages.MESSAGES.reasonPhraseToLargeForBuffer(string); } writeString(buffer, string); buffer.put((byte) '\r').put((byte) '\n'); int remaining = buffer.remaining(); HeaderMap headers = exchange.getResponseHeaders(); long fiCookie = headers.fastIterateNonEmpty(); while (fiCookie != -1) { HeaderValues headerValues = headers.fiCurrent(fiCookie); HttpString header = headerValues.getHeaderName(); int headerSize = header.length(); int valueIdx = 0; while (valueIdx < headerValues.size()) { remaining -= (headerSize + 2); if (remaining < 0) { this.fiCookie = fiCookie; this.string = string; this.headerValues = headerValues; this.valueIdx = valueIdx; this.charIndex = 0; this.state = STATE_HDR_NAME; buffer.flip(); return processStatefulWrite(STATE_HDR_NAME, userData, pos, length); } header.appendTo(buffer); buffer.put((byte) ':').put((byte) ' '); string = headerValues.get(valueIdx++); remaining -= (string.length() + 2); if (remaining < 2) {//we use 2 here, to make sure we always have room for the final \r\n this.fiCookie = fiCookie; this.string = string; this.headerValues = headerValues; this.valueIdx = valueIdx; this.charIndex = 0; this.state = STATE_HDR_VAL; buffer.flip(); return processStatefulWrite(STATE_HDR_VAL, userData, pos, length); } writeString(buffer, string); buffer.put((byte) '\r').put((byte) '\n'); } fiCookie = headers.fiNextNonEmpty(fiCookie); } buffer.put((byte) '\r').put((byte) '\n'); buffer.flip(); do { long res = 0; ByteBuffer[] data; if (userData == null) { res = next.write(buffer); } else if (userData instanceof ByteBuffer) { data = writevBuffer; if (data == null) { data = writevBuffer = new ByteBuffer[2]; } data[0] = buffer; data[1] = (ByteBuffer) userData; res = next.write(data, 0, 2); } else { data = writevBuffer; if (data == null || data.length < length + 1) { data = writevBuffer = new ByteBuffer[length + 1]; } data[0] = buffer; System.arraycopy(userData, pos, data, 1, length); res = next.write(data, 0, length + 1); } if (res == 0) { return STATE_BUF_FLUSH; } } while (buffer.hasRemaining()); bufferDone(); return STATE_BODY; } catch (IOException | RuntimeException | Error e) { //WFLY-4696, just to be safe if (pooledBuffer != null) { pooledBuffer.close(); pooledBuffer = null; } throw e; } } }
public class class_name { private int processWrite(int state, final Object userData, int pos, int length) throws IOException { if (done || exchange == null) { throw new ClosedChannelException(); } try { assert state != STATE_BODY; if (state == STATE_BUF_FLUSH) { final ByteBuffer byteBuffer = pooledBuffer.getBuffer(); do { long res = 0; ByteBuffer[] data; if (userData == null || length == 0) { res = next.write(byteBuffer); // depends on control dependency: [if], data = [none] } else if (userData instanceof ByteBuffer) { data = writevBuffer; // depends on control dependency: [if], data = [none] if (data == null) { data = writevBuffer = new ByteBuffer[2]; // depends on control dependency: [if], data = [none] } data[0] = byteBuffer; // depends on control dependency: [if], data = [none] data[1] = (ByteBuffer) userData; // depends on control dependency: [if], data = [none] res = next.write(data, 0, 2); // depends on control dependency: [if], data = [none] } else { data = writevBuffer; // depends on control dependency: [if], data = [none] if (data == null || data.length < length + 1) { data = writevBuffer = new ByteBuffer[length + 1]; // depends on control dependency: [if], data = [none] } data[0] = byteBuffer; // depends on control dependency: [if], data = [none] System.arraycopy(userData, pos, data, 1, length); // depends on control dependency: [if], data = [none] res = next.write(data, 0, length + 1); // depends on control dependency: [if], data = [none] } if (res == 0) { return STATE_BUF_FLUSH; // depends on control dependency: [if], data = [none] } } while (byteBuffer.hasRemaining()); bufferDone(); // depends on control dependency: [if], data = [none] return STATE_BODY; // depends on control dependency: [if], data = [none] } else if (state != STATE_START) { return processStatefulWrite(state, userData, pos, length); // depends on control dependency: [if], data = [(state] } //merge the cookies into the header map Connectors.flattenCookies(exchange); if (pooledBuffer == null) { pooledBuffer = pool.allocate(); // depends on control dependency: [if], data = [none] } ByteBuffer buffer = pooledBuffer.getBuffer(); assert buffer.remaining() >= 50; Protocols.HTTP_1_1.appendTo(buffer); buffer.put((byte) ' '); int code = exchange.getStatusCode(); assert 999 >= code && code >= 100; buffer.put((byte) (code / 100 + '0')); buffer.put((byte) (code / 10 % 10 + '0')); buffer.put((byte) (code % 10 + '0')); buffer.put((byte) ' '); String string = exchange.getReasonPhrase(); if(string == null) { string = StatusCodes.getReason(code); // depends on control dependency: [if], data = [none] } if(string.length() > buffer.remaining()) { pooledBuffer.close(); // depends on control dependency: [if], data = [none] pooledBuffer = null; // depends on control dependency: [if], data = [none] truncateWrites(); // depends on control dependency: [if], data = [none] throw UndertowMessages.MESSAGES.reasonPhraseToLargeForBuffer(string); } writeString(buffer, string); buffer.put((byte) '\r').put((byte) '\n'); int remaining = buffer.remaining(); HeaderMap headers = exchange.getResponseHeaders(); long fiCookie = headers.fastIterateNonEmpty(); while (fiCookie != -1) { HeaderValues headerValues = headers.fiCurrent(fiCookie); HttpString header = headerValues.getHeaderName(); int headerSize = header.length(); int valueIdx = 0; while (valueIdx < headerValues.size()) { remaining -= (headerSize + 2); // depends on control dependency: [while], data = [none] if (remaining < 0) { this.fiCookie = fiCookie; // depends on control dependency: [if], data = [none] this.string = string; // depends on control dependency: [if], data = [none] this.headerValues = headerValues; // depends on control dependency: [if], data = [none] this.valueIdx = valueIdx; // depends on control dependency: [if], data = [none] this.charIndex = 0; // depends on control dependency: [if], data = [none] this.state = STATE_HDR_NAME; // depends on control dependency: [if], data = [none] buffer.flip(); // depends on control dependency: [if], data = [none] return processStatefulWrite(STATE_HDR_NAME, userData, pos, length); // depends on control dependency: [if], data = [none] } header.appendTo(buffer); // depends on control dependency: [while], data = [none] buffer.put((byte) ':').put((byte) ' '); // depends on control dependency: [while], data = [none] string = headerValues.get(valueIdx++); // depends on control dependency: [while], data = [(valueIdx] remaining -= (string.length() + 2); // depends on control dependency: [while], data = [none] if (remaining < 2) {//we use 2 here, to make sure we always have room for the final \r\n this.fiCookie = fiCookie; // depends on control dependency: [if], data = [none] this.string = string; // depends on control dependency: [if], data = [none] this.headerValues = headerValues; // depends on control dependency: [if], data = [none] this.valueIdx = valueIdx; // depends on control dependency: [if], data = [none] this.charIndex = 0; // depends on control dependency: [if], data = [none] this.state = STATE_HDR_VAL; // depends on control dependency: [if], data = [none] buffer.flip(); // depends on control dependency: [if], data = [none] return processStatefulWrite(STATE_HDR_VAL, userData, pos, length); // depends on control dependency: [if], data = [none] } writeString(buffer, string); // depends on control dependency: [while], data = [none] buffer.put((byte) '\r').put((byte) '\n'); // depends on control dependency: [while], data = [none] } fiCookie = headers.fiNextNonEmpty(fiCookie); // depends on control dependency: [while], data = [(fiCookie] } buffer.put((byte) '\r').put((byte) '\n'); buffer.flip(); do { long res = 0; ByteBuffer[] data; if (userData == null) { res = next.write(buffer); // depends on control dependency: [if], data = [none] } else if (userData instanceof ByteBuffer) { data = writevBuffer; // depends on control dependency: [if], data = [none] if (data == null) { data = writevBuffer = new ByteBuffer[2]; // depends on control dependency: [if], data = [none] } data[0] = buffer; // depends on control dependency: [if], data = [none] data[1] = (ByteBuffer) userData; // depends on control dependency: [if], data = [none] res = next.write(data, 0, 2); // depends on control dependency: [if], data = [none] } else { data = writevBuffer; // depends on control dependency: [if], data = [none] if (data == null || data.length < length + 1) { data = writevBuffer = new ByteBuffer[length + 1]; // depends on control dependency: [if], data = [none] } data[0] = buffer; // depends on control dependency: [if], data = [none] System.arraycopy(userData, pos, data, 1, length); // depends on control dependency: [if], data = [none] res = next.write(data, 0, length + 1); // depends on control dependency: [if], data = [none] } if (res == 0) { return STATE_BUF_FLUSH; // depends on control dependency: [if], data = [none] } } while (buffer.hasRemaining()); bufferDone(); return STATE_BODY; } catch (IOException | RuntimeException | Error e) { //WFLY-4696, just to be safe if (pooledBuffer != null) { pooledBuffer.close(); // depends on control dependency: [if], data = [none] pooledBuffer = null; // depends on control dependency: [if], data = [none] } throw e; } } }
public class class_name { private static int distance(final Class<?>[] classArray, final Class<?>[] toClassArray) { int answer = 0; if (!ClassUtils.isAssignable(classArray, toClassArray, true)) { return -1; } for (int offset = 0; offset < classArray.length; offset++) { // Note InheritanceUtils.distance() uses different scoring system. if (classArray[offset].equals(toClassArray[offset])) { continue; } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], true) && !ClassUtils.isAssignable(classArray[offset], toClassArray[offset], false)) { answer++; } else { answer = answer + 2; } } return answer; } }
public class class_name { private static int distance(final Class<?>[] classArray, final Class<?>[] toClassArray) { int answer = 0; if (!ClassUtils.isAssignable(classArray, toClassArray, true)) { return -1; // depends on control dependency: [if], data = [none] } for (int offset = 0; offset < classArray.length; offset++) { // Note InheritanceUtils.distance() uses different scoring system. if (classArray[offset].equals(toClassArray[offset])) { continue; } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], true) && !ClassUtils.isAssignable(classArray[offset], toClassArray[offset], false)) { answer++; // depends on control dependency: [if], data = [none] } else { answer = answer + 2; // depends on control dependency: [if], data = [none] } } return answer; } }
public class class_name { public static ChangeLog parse(Context ctx, @XmlRes int license){ ChangeLog clog = new ChangeLog(); // Get the XMLParser XmlPullParser parser = ctx.getResources().getXml(license); // Begin parsing try { parser.next(); parser.require(XmlPullParser.START_DOCUMENT, null, null); parser.nextTag(); parser.require(XmlPullParser.START_TAG, null, DOCUMENT_TAG); while(parser.next() != XmlPullParser.END_TAG){ if (parser.getEventType() != XmlPullParser.START_TAG) { continue; } String name = parser.getName(); if(name.equals(TAG_VERSION)){ clog.addVersion(readVersion(parser)); }else{ skip(parser); } } } catch (XmlPullParserException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return clog; } }
public class class_name { public static ChangeLog parse(Context ctx, @XmlRes int license){ ChangeLog clog = new ChangeLog(); // Get the XMLParser XmlPullParser parser = ctx.getResources().getXml(license); // Begin parsing try { parser.next(); // depends on control dependency: [try], data = [none] parser.require(XmlPullParser.START_DOCUMENT, null, null); // depends on control dependency: [try], data = [none] parser.nextTag(); // depends on control dependency: [try], data = [none] parser.require(XmlPullParser.START_TAG, null, DOCUMENT_TAG); // depends on control dependency: [try], data = [none] while(parser.next() != XmlPullParser.END_TAG){ if (parser.getEventType() != XmlPullParser.START_TAG) { continue; } String name = parser.getName(); if(name.equals(TAG_VERSION)){ clog.addVersion(readVersion(parser)); // depends on control dependency: [if], data = [none] }else{ skip(parser); // depends on control dependency: [if], data = [none] } } } catch (XmlPullParserException e) { e.printStackTrace(); } catch (IOException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return clog; } }
public class class_name { public void marshall(DataRetrievalPolicy dataRetrievalPolicy, ProtocolMarshaller protocolMarshaller) { if (dataRetrievalPolicy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dataRetrievalPolicy.getRules(), RULES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DataRetrievalPolicy dataRetrievalPolicy, ProtocolMarshaller protocolMarshaller) { if (dataRetrievalPolicy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dataRetrievalPolicy.getRules(), RULES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void visitCode(final Code obj) { try { if (methodSignatureIsConstrained) { return; } if (obj.getCode() == null) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (m.getName().startsWith("access$")) { return; } methodIsStatic = m.isStatic(); parmCount = m.getArgumentTypes().length; if (parmCount == 0) { return; } parameterDefiners.clear(); usedParameters.clear(); stack.resetForMethodEntry(this); if (buildParameterDefiners()) { try { super.visitCode(obj); reportBugs(); } catch (StopOpcodeParsingException e) { // no more possible parameter definers } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } }
public class class_name { @Override public void visitCode(final Code obj) { try { if (methodSignatureIsConstrained) { return; // depends on control dependency: [if], data = [none] } if (obj.getCode() == null) { return; // depends on control dependency: [if], data = [none] } Method m = getMethod(); if (m.isSynthetic()) { return; // depends on control dependency: [if], data = [none] } if (m.getName().startsWith("access$")) { return; // depends on control dependency: [if], data = [none] } methodIsStatic = m.isStatic(); // depends on control dependency: [try], data = [none] parmCount = m.getArgumentTypes().length; // depends on control dependency: [try], data = [none] if (parmCount == 0) { return; // depends on control dependency: [if], data = [none] } parameterDefiners.clear(); // depends on control dependency: [try], data = [none] usedParameters.clear(); // depends on control dependency: [try], data = [none] stack.resetForMethodEntry(this); // depends on control dependency: [try], data = [none] if (buildParameterDefiners()) { try { super.visitCode(obj); // depends on control dependency: [try], data = [none] reportBugs(); // depends on control dependency: [try], data = [none] } catch (StopOpcodeParsingException e) { // no more possible parameter definers } // depends on control dependency: [catch], data = [none] } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int size(Iterator self) { int count = 0; while (self.hasNext()) { self.next(); count++; } return count; } }
public class class_name { public static int size(Iterator self) { int count = 0; while (self.hasNext()) { self.next(); // depends on control dependency: [while], data = [none] count++; // depends on control dependency: [while], data = [none] } return count; } }
public class class_name { public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(ThinMenuConstants.CLOSE)) { this.free(); return true; } return super.doCommand(strCommand, sourceSField, iCommandOptions); } }
public class class_name { public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(ThinMenuConstants.CLOSE)) { this.free(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return super.doCommand(strCommand, sourceSField, iCommandOptions); } }
public class class_name { private Object parseValue(String value) { // Try to parse value as number try { return Double.valueOf(value); } catch (NumberFormatException ignored){} if (value.equals("true") || value.equals("false")) return Boolean.valueOf(value); throw new IllegalArgumentException("Only number or boolean stats values allowed"); } }
public class class_name { private Object parseValue(String value) { // Try to parse value as number try { return Double.valueOf(value); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ignored){} // depends on control dependency: [catch], data = [none] if (value.equals("true") || value.equals("false")) return Boolean.valueOf(value); throw new IllegalArgumentException("Only number or boolean stats values allowed"); } }
public class class_name { public void addSearchResult(CaptureSearchResult result, boolean append) { String resultDate = result.getCaptureTimestamp(); if ((firstResultTimestamp == null) || (firstResultTimestamp.compareTo(resultDate) > 0)) { firstResultTimestamp = resultDate; } if ((lastResultTimestamp == null) || (lastResultTimestamp.compareTo(resultDate) < 0)) { lastResultTimestamp = resultDate; } if (append) { if (!results.isEmpty()) { results.getLast().setNextResult(result); result.setPrevResult(results.getLast()); } results.add(result); } else { if (!results.isEmpty()) { results.getFirst().setPrevResult(result); result.setNextResult(results.getFirst()); } results.add(0, result); } } }
public class class_name { public void addSearchResult(CaptureSearchResult result, boolean append) { String resultDate = result.getCaptureTimestamp(); if ((firstResultTimestamp == null) || (firstResultTimestamp.compareTo(resultDate) > 0)) { firstResultTimestamp = resultDate; // depends on control dependency: [if], data = [none] } if ((lastResultTimestamp == null) || (lastResultTimestamp.compareTo(resultDate) < 0)) { lastResultTimestamp = resultDate; // depends on control dependency: [if], data = [none] } if (append) { if (!results.isEmpty()) { results.getLast().setNextResult(result); // depends on control dependency: [if], data = [none] result.setPrevResult(results.getLast()); // depends on control dependency: [if], data = [none] } results.add(result); // depends on control dependency: [if], data = [none] } else { if (!results.isEmpty()) { results.getFirst().setPrevResult(result); // depends on control dependency: [if], data = [none] result.setNextResult(results.getFirst()); // depends on control dependency: [if], data = [none] } results.add(0, result); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void slmget(final String keyspace, final String uid, final String serviceCode, final String... keys) { final byte[][] bkeys = new byte[keys.length][]; for (int i = 0; i < keys.length; i++) { bkeys[i] = SafeEncoder.encode(keys[i]); } slmget(SafeEncoder.encode(keyspace), SafeEncoder.encode(uid), SafeEncoder.encode(serviceCode), bkeys); } }
public class class_name { public void slmget(final String keyspace, final String uid, final String serviceCode, final String... keys) { final byte[][] bkeys = new byte[keys.length][]; for (int i = 0; i < keys.length; i++) { bkeys[i] = SafeEncoder.encode(keys[i]); // depends on control dependency: [for], data = [i] } slmget(SafeEncoder.encode(keyspace), SafeEncoder.encode(uid), SafeEncoder.encode(serviceCode), bkeys); } }
public class class_name { float[] getBandFactors() { float[] factors = new float[BANDS]; for (int i=0, maxCount=BANDS; i<maxCount; i++) { factors[i] = getBandFactor(settings[i]); } return factors; } }
public class class_name { float[] getBandFactors() { float[] factors = new float[BANDS]; for (int i=0, maxCount=BANDS; i<maxCount; i++) { factors[i] = getBandFactor(settings[i]); // depends on control dependency: [for], data = [i] } return factors; } }
public class class_name { public static Symmetry454Date from(TemporalAccessor temporal) { if (temporal instanceof Symmetry454Date) { return (Symmetry454Date) temporal; } return Symmetry454Date.ofEpochDay(temporal.getLong(ChronoField.EPOCH_DAY)); } }
public class class_name { public static Symmetry454Date from(TemporalAccessor temporal) { if (temporal instanceof Symmetry454Date) { return (Symmetry454Date) temporal; // depends on control dependency: [if], data = [none] } return Symmetry454Date.ofEpochDay(temporal.getLong(ChronoField.EPOCH_DAY)); } }
public class class_name { private IDataSet performReplacements(IDataSet dataSet, List<Replacer> replacersList) { if (replacersList == null || replacersList.isEmpty()) return dataSet; ReplacementDataSet replacementSet = new ReplacementDataSet(dataSet); // convert to set to remove duplicates Set<Replacer> replacers = new HashSet<>((List<Replacer>) replacersList); for (Replacer replacer : replacers) { replacer.addReplacements(replacementSet); } return replacementSet; } }
public class class_name { private IDataSet performReplacements(IDataSet dataSet, List<Replacer> replacersList) { if (replacersList == null || replacersList.isEmpty()) return dataSet; ReplacementDataSet replacementSet = new ReplacementDataSet(dataSet); // convert to set to remove duplicates Set<Replacer> replacers = new HashSet<>((List<Replacer>) replacersList); for (Replacer replacer : replacers) { replacer.addReplacements(replacementSet); // depends on control dependency: [for], data = [replacer] } return replacementSet; } }
public class class_name { public final void saveDataInContext(final Cell poiCell, final String strValue) { String saveAttr = SaveAttrsUtility.prepareContextAndAttrsForCell(poiCell, ConfigurationUtility.getFullNameFromRow(poiCell.getRow()), this); if (saveAttr!= null) { SaveAttrsUtility.saveDataToObjectInContext( parent.getSerialDataContext().getDataContext(), saveAttr, strValue, parent.getExpEngine()); parent.getHelper().getWebSheetLoader().setUnsavedStatus( RequestContext.getCurrentInstance(), true); } } }
public class class_name { public final void saveDataInContext(final Cell poiCell, final String strValue) { String saveAttr = SaveAttrsUtility.prepareContextAndAttrsForCell(poiCell, ConfigurationUtility.getFullNameFromRow(poiCell.getRow()), this); if (saveAttr!= null) { SaveAttrsUtility.saveDataToObjectInContext( parent.getSerialDataContext().getDataContext(), saveAttr, strValue, parent.getExpEngine()); // depends on control dependency: [if], data = [none] parent.getHelper().getWebSheetLoader().setUnsavedStatus( RequestContext.getCurrentInstance(), true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Attributes withExpires(DateTime expires) { if (expires == null) { this.expires = null; } else { this.expires = expires.toDateTime(DateTimeZone.UTC).getMillis() / 1000; } return this; } }
public class class_name { public Attributes withExpires(DateTime expires) { if (expires == null) { this.expires = null; // depends on control dependency: [if], data = [none] } else { this.expires = expires.toDateTime(DateTimeZone.UTC).getMillis() / 1000; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { @Override public void onRegistered(Context context, String registrationId) { try { if(notificationCallback != null) { notificationCallback.onRegister(context, registrationId); } else { logWarn("No notificationCallback found in GCM receiver. Initialization may have failed."); } } catch (Exception e) { logError("GCM registration failed", e); } } }
public class class_name { @Override public void onRegistered(Context context, String registrationId) { try { if(notificationCallback != null) { notificationCallback.onRegister(context, registrationId); // depends on control dependency: [if], data = [none] } else { logWarn("No notificationCallback found in GCM receiver. Initialization may have failed."); // depends on control dependency: [if], data = [none] } } catch (Exception e) { logError("GCM registration failed", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isActiveNamingContext(final WComponent component) { if (component instanceof NamingContextable) { NamingContextable naming = (NamingContextable) component; boolean active = naming.isNamingContext() && naming.getIdName() != null; return active; } return false; } }
public class class_name { public static boolean isActiveNamingContext(final WComponent component) { if (component instanceof NamingContextable) { NamingContextable naming = (NamingContextable) component; boolean active = naming.isNamingContext() && naming.getIdName() != null; return active; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public java.util.List<Tag> getAddTags() { if (addTags == null) { addTags = new com.amazonaws.internal.SdkInternalList<Tag>(); } return addTags; } }
public class class_name { public java.util.List<Tag> getAddTags() { if (addTags == null) { addTags = new com.amazonaws.internal.SdkInternalList<Tag>(); // depends on control dependency: [if], data = [none] } return addTags; } }
public class class_name { public final void setServicePid(String servicePid) { synchronized (lock) { if (servicePid == null) { serviceProperties.remove(SERVICE_PID); } else { serviceProperties.put(SERVICE_PID, servicePid); } if (serviceRegistration != null) { serviceRegistration.setProperties(serviceProperties); } } } }
public class class_name { public final void setServicePid(String servicePid) { synchronized (lock) { if (servicePid == null) { serviceProperties.remove(SERVICE_PID); // depends on control dependency: [if], data = [none] } else { serviceProperties.put(SERVICE_PID, servicePid); // depends on control dependency: [if], data = [none] } if (serviceRegistration != null) { serviceRegistration.setProperties(serviceProperties); // depends on control dependency: [if], data = [none] } } } }
public class class_name { void processPendingReplications() { BlockInfo[] timedOutItems = pendingReplications.getTimedOutBlocks(); if (timedOutItems != null) { writeLock(); try { for (int i = 0; i < timedOutItems.length; i++) { NumberReplicas num = countNodes(timedOutItems[i]); neededReplications.add( timedOutItems[i], num.liveReplicas(), num.decommissionedReplicas(), getReplication(timedOutItems[i])); } } finally { writeUnlock(); } /* If we know the target datanodes where the replication timedout, * we could invoke decBlocksScheduled() on it. Its ok for now. */ } } }
public class class_name { void processPendingReplications() { BlockInfo[] timedOutItems = pendingReplications.getTimedOutBlocks(); if (timedOutItems != null) { writeLock(); // depends on control dependency: [if], data = [none] try { for (int i = 0; i < timedOutItems.length; i++) { NumberReplicas num = countNodes(timedOutItems[i]); neededReplications.add( timedOutItems[i], num.liveReplicas(), num.decommissionedReplicas(), getReplication(timedOutItems[i])); // depends on control dependency: [for], data = [none] } } finally { writeUnlock(); } /* If we know the target datanodes where the replication timedout, * we could invoke decBlocksScheduled() on it. Its ok for now. */ } } }
public class class_name { void generateSerializeOnJacksonInternal(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property, boolean onString) { // define key and value type ParameterizedTypeName mapTypeName=(ParameterizedTypeName) property.getPropertyType().getTypeName(); TypeName keyTypeName = mapTypeName.typeArguments.get(0); TypeName valueTypeName = mapTypeName.typeArguments.get(1); //@formatter:off methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); if (property.isProperty()) { methodBuilder.addStatement("fieldCount++"); } // fields are in objects, no in collection BindTransform transformKey=BindTransformer.lookup(keyTypeName); BindProperty elementKeyProperty=BindProperty.builder(keyTypeName, property).nullable(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).inCollection(false).elementName(property.mapKeyName).build(); BindTransform transformValue=BindTransformer.lookup(valueTypeName); BindProperty elementValueProperty=BindProperty.builder(valueTypeName, property).nullable(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).inCollection(false).elementName(property.mapValueName).build(); methodBuilder.addCode("// write wrapper tag\n"); // BEGIN - if map has elements methodBuilder.beginControlFlow("if ($L.size()>0)",getter(beanName, beanClass, property)); methodBuilder.addStatement("$L.writeFieldName($S)", serializerName, property.label); methodBuilder.addStatement("$L.writeStartArray()", serializerName); methodBuilder.beginControlFlow("for ($T<$T, $T> item: $L.entrySet())", Entry.class, keyTypeName, valueTypeName, getter(beanName, beanClass, property)); methodBuilder.addStatement("$L.writeStartObject()", serializerName); if (onString) { transformKey.generateSerializeOnJacksonAsString(context, methodBuilder, serializerName, null, "item.getKey()", elementKeyProperty); } else { transformKey.generateSerializeOnJackson(context, methodBuilder, serializerName, null, "item.getKey()", elementKeyProperty); } // field is always nullable methodBuilder.beginControlFlow("if (item.getValue()==null)"); // KRITPON-38: in a collection, for null object we write "null" string if (onString) { methodBuilder.addStatement("$L.writeStringField($S, \"null\")",serializerName, property.mapValueName); } else { methodBuilder.addStatement("$L.writeNullField($S)", serializerName, property.mapValueName); } methodBuilder.nextControlFlow("else"); if (onString) { transformValue.generateSerializeOnJacksonAsString(context, methodBuilder, serializerName, null, "item.getValue()", elementValueProperty); } else { transformValue.generateSerializeOnJackson(context, methodBuilder, serializerName, null, "item.getValue()", elementValueProperty); } methodBuilder.endControlFlow(); methodBuilder.addStatement("$L.writeEndObject()", serializerName); methodBuilder.endControlFlow(); methodBuilder.addStatement("$L.writeEndArray()", serializerName); // ELSE - if map has elements methodBuilder.nextControlFlow("else"); if (onString) { methodBuilder.addStatement("$L.writeStringField($S, \"null\")",serializerName, property.label); } else { methodBuilder.addStatement("$L.writeNullField($S)", serializerName, property.label); } // END - if map has elements methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); //@formatter:on } }
public class class_name { void generateSerializeOnJacksonInternal(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property, boolean onString) { // define key and value type ParameterizedTypeName mapTypeName=(ParameterizedTypeName) property.getPropertyType().getTypeName(); TypeName keyTypeName = mapTypeName.typeArguments.get(0); TypeName valueTypeName = mapTypeName.typeArguments.get(1); //@formatter:off methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); if (property.isProperty()) { methodBuilder.addStatement("fieldCount++"); // depends on control dependency: [if], data = [none] } // fields are in objects, no in collection BindTransform transformKey=BindTransformer.lookup(keyTypeName); BindProperty elementKeyProperty=BindProperty.builder(keyTypeName, property).nullable(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).inCollection(false).elementName(property.mapKeyName).build(); BindTransform transformValue=BindTransformer.lookup(valueTypeName); BindProperty elementValueProperty=BindProperty.builder(valueTypeName, property).nullable(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).inCollection(false).elementName(property.mapValueName).build(); methodBuilder.addCode("// write wrapper tag\n"); // BEGIN - if map has elements methodBuilder.beginControlFlow("if ($L.size()>0)",getter(beanName, beanClass, property)); methodBuilder.addStatement("$L.writeFieldName($S)", serializerName, property.label); methodBuilder.addStatement("$L.writeStartArray()", serializerName); methodBuilder.beginControlFlow("for ($T<$T, $T> item: $L.entrySet())", Entry.class, keyTypeName, valueTypeName, getter(beanName, beanClass, property)); methodBuilder.addStatement("$L.writeStartObject()", serializerName); if (onString) { transformKey.generateSerializeOnJacksonAsString(context, methodBuilder, serializerName, null, "item.getKey()", elementKeyProperty); // depends on control dependency: [if], data = [none] } else { transformKey.generateSerializeOnJackson(context, methodBuilder, serializerName, null, "item.getKey()", elementKeyProperty); // depends on control dependency: [if], data = [none] } // field is always nullable methodBuilder.beginControlFlow("if (item.getValue()==null)"); // KRITPON-38: in a collection, for null object we write "null" string if (onString) { methodBuilder.addStatement("$L.writeStringField($S, \"null\")",serializerName, property.mapValueName); // depends on control dependency: [if], data = [none] } else { methodBuilder.addStatement("$L.writeNullField($S)", serializerName, property.mapValueName); // depends on control dependency: [if], data = [none] } methodBuilder.nextControlFlow("else"); if (onString) { transformValue.generateSerializeOnJacksonAsString(context, methodBuilder, serializerName, null, "item.getValue()", elementValueProperty); // depends on control dependency: [if], data = [none] } else { transformValue.generateSerializeOnJackson(context, methodBuilder, serializerName, null, "item.getValue()", elementValueProperty); // depends on control dependency: [if], data = [none] } methodBuilder.endControlFlow(); methodBuilder.addStatement("$L.writeEndObject()", serializerName); methodBuilder.endControlFlow(); methodBuilder.addStatement("$L.writeEndArray()", serializerName); // ELSE - if map has elements methodBuilder.nextControlFlow("else"); if (onString) { methodBuilder.addStatement("$L.writeStringField($S, \"null\")",serializerName, property.label); // depends on control dependency: [if], data = [none] } else { methodBuilder.addStatement("$L.writeNullField($S)", serializerName, property.label); // depends on control dependency: [if], data = [none] } // END - if map has elements methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); //@formatter:on } }
public class class_name { public static boolean hasValidContentAdditionParameterDefined(ModelNode operation) { for (String s : DeploymentAttributes.MANAGED_CONTENT_ATTRIBUTES.keySet()) { if (operation.hasDefined(s)) { return true; } } return false; } }
public class class_name { public static boolean hasValidContentAdditionParameterDefined(ModelNode operation) { for (String s : DeploymentAttributes.MANAGED_CONTENT_ATTRIBUTES.keySet()) { if (operation.hasDefined(s)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public PendingCloudwatchLogsExports withLogTypesToEnable(String... logTypesToEnable) { if (this.logTypesToEnable == null) { setLogTypesToEnable(new com.amazonaws.internal.SdkInternalList<String>(logTypesToEnable.length)); } for (String ele : logTypesToEnable) { this.logTypesToEnable.add(ele); } return this; } }
public class class_name { public PendingCloudwatchLogsExports withLogTypesToEnable(String... logTypesToEnable) { if (this.logTypesToEnable == null) { setLogTypesToEnable(new com.amazonaws.internal.SdkInternalList<String>(logTypesToEnable.length)); // depends on control dependency: [if], data = [none] } for (String ele : logTypesToEnable) { this.logTypesToEnable.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void parse(Node node) { queryable = isQueryable(node); styleInfo.clear(); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); String nodeName = child.getNodeName(); if ("Name".equalsIgnoreCase(nodeName)) { name = getValueRecursive(child); } else if ("Title".equalsIgnoreCase(nodeName)) { title = getValueRecursive(child); } else if ("Abstract".equalsIgnoreCase(nodeName)) { abstractt = getValueRecursive(child); } else if ("KeywordList".equalsIgnoreCase(nodeName)) { addKeyWords(child); } else if ("SRS".equalsIgnoreCase(nodeName)) { crs.add(getValueRecursive(child)); } else if ("BoundingBox".equalsIgnoreCase(nodeName)) { addBoundingBox(child); } else if ("LatLonBoundingBox".equalsIgnoreCase(nodeName)) { addLatLonBoundingBox(child); } else if ("MetadataURL".equalsIgnoreCase(nodeName)) { metadataUrls.add(new WmsLayerMetadataUrlInfo111(child)); } else if ("Style".equalsIgnoreCase(nodeName)) { styleInfo.add(new WmsLayerStyleInfo111(child)); } else if ("ScaleHint".equalsIgnoreCase(nodeName)) { if (hasAttribute(child, "min")) { minScaleDenominator = getAttributeAsDouble(child, "min"); } if (hasAttribute(child, "max")) { maxScaleDenominator = getAttributeAsDouble(child, "max"); } } } parsed = true; } }
public class class_name { protected void parse(Node node) { queryable = isQueryable(node); styleInfo.clear(); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); String nodeName = child.getNodeName(); if ("Name".equalsIgnoreCase(nodeName)) { name = getValueRecursive(child); // depends on control dependency: [if], data = [none] } else if ("Title".equalsIgnoreCase(nodeName)) { title = getValueRecursive(child); // depends on control dependency: [if], data = [none] } else if ("Abstract".equalsIgnoreCase(nodeName)) { abstractt = getValueRecursive(child); // depends on control dependency: [if], data = [none] } else if ("KeywordList".equalsIgnoreCase(nodeName)) { addKeyWords(child); // depends on control dependency: [if], data = [none] } else if ("SRS".equalsIgnoreCase(nodeName)) { crs.add(getValueRecursive(child)); // depends on control dependency: [if], data = [none] } else if ("BoundingBox".equalsIgnoreCase(nodeName)) { addBoundingBox(child); // depends on control dependency: [if], data = [none] } else if ("LatLonBoundingBox".equalsIgnoreCase(nodeName)) { addLatLonBoundingBox(child); // depends on control dependency: [if], data = [none] } else if ("MetadataURL".equalsIgnoreCase(nodeName)) { metadataUrls.add(new WmsLayerMetadataUrlInfo111(child)); // depends on control dependency: [if], data = [none] } else if ("Style".equalsIgnoreCase(nodeName)) { styleInfo.add(new WmsLayerStyleInfo111(child)); // depends on control dependency: [if], data = [none] } else if ("ScaleHint".equalsIgnoreCase(nodeName)) { if (hasAttribute(child, "min")) { minScaleDenominator = getAttributeAsDouble(child, "min"); // depends on control dependency: [if], data = [none] } if (hasAttribute(child, "max")) { maxScaleDenominator = getAttributeAsDouble(child, "max"); // depends on control dependency: [if], data = [none] } } } parsed = true; } }
public class class_name { private void renderMask(SVG.Mask mask, SvgElement obj, Box originalObjBBox) { debug("Mask render"); boolean maskUnitsAreUser = (mask.maskUnitsAreUser != null && mask.maskUnitsAreUser); float w, h; if (maskUnitsAreUser) { w = (mask.width != null) ? mask.width.floatValueX(this): originalObjBBox.width; h = (mask.height != null) ? mask.height.floatValueY(this): originalObjBBox.height; //x = (mask.x != null) ? mask.x.floatValueX(this): (float)(obj.boundingBox.minX - 0.1 * obj.boundingBox.width); //y = (mask.y != null) ? mask.y.floatValueY(this): (float)(obj.boundingBox.minY - 0.1 * obj.boundingBox.height); } else { // Convert objectBoundingBox space to user space //x = (mask.x != null) ? mask.x.floatValue(this, 1f): -0.1f; //y = (mask.y != null) ? mask.y.floatValue(this, 1f): -0.1f; w = (mask.width != null) ? mask.width.floatValue(this, 1f): 1.2f; h = (mask.height != null) ? mask.height.floatValue(this, 1f): 1.2f; //x = originalObjBBox.minX + x * originalObjBBox.width; //y = originalObjBBox.minY + y * originalObjBBox.height; w *= originalObjBBox.width; h *= originalObjBBox.height; } if (w == 0 || h == 0) return; // Push the state statePush(); state = findInheritFromAncestorState(mask); // Set the style for the mask (inherits from its own ancestors, not from callee's state) // The 'opacity', 'filter' and 'display' properties do not apply to the 'mask' element" (sect 14.4) state.style.opacity = 1f; //state.style.filter = null; boolean compositing = pushLayer(); // Save the current transform matrix, as we need to undo the following transform straight away canvas.save(); boolean maskContentUnitsAreUser = (mask.maskContentUnitsAreUser == null || mask.maskContentUnitsAreUser); if (!maskContentUnitsAreUser) { canvas.translate(originalObjBBox.minX, originalObjBBox.minY); canvas.scale(originalObjBBox.width, originalObjBBox.height); } // Render the mask renderChildren(mask, false); // Restore the matrix so that, if this mask has a mask, it is not affected by the objectBoundingBox transform canvas.restore(); if (compositing) popLayer(obj, originalObjBBox); // Pop the state statePop(); } }
public class class_name { private void renderMask(SVG.Mask mask, SvgElement obj, Box originalObjBBox) { debug("Mask render"); boolean maskUnitsAreUser = (mask.maskUnitsAreUser != null && mask.maskUnitsAreUser); float w, h; if (maskUnitsAreUser) { w = (mask.width != null) ? mask.width.floatValueX(this): originalObjBBox.width; // depends on control dependency: [if], data = [none] h = (mask.height != null) ? mask.height.floatValueY(this): originalObjBBox.height; // depends on control dependency: [if], data = [none] //x = (mask.x != null) ? mask.x.floatValueX(this): (float)(obj.boundingBox.minX - 0.1 * obj.boundingBox.width); //y = (mask.y != null) ? mask.y.floatValueY(this): (float)(obj.boundingBox.minY - 0.1 * obj.boundingBox.height); } else { // Convert objectBoundingBox space to user space //x = (mask.x != null) ? mask.x.floatValue(this, 1f): -0.1f; //y = (mask.y != null) ? mask.y.floatValue(this, 1f): -0.1f; w = (mask.width != null) ? mask.width.floatValue(this, 1f): 1.2f; // depends on control dependency: [if], data = [none] h = (mask.height != null) ? mask.height.floatValue(this, 1f): 1.2f; // depends on control dependency: [if], data = [none] //x = originalObjBBox.minX + x * originalObjBBox.width; //y = originalObjBBox.minY + y * originalObjBBox.height; w *= originalObjBBox.width; // depends on control dependency: [if], data = [none] h *= originalObjBBox.height; // depends on control dependency: [if], data = [none] } if (w == 0 || h == 0) return; // Push the state statePush(); state = findInheritFromAncestorState(mask); // Set the style for the mask (inherits from its own ancestors, not from callee's state) // The 'opacity', 'filter' and 'display' properties do not apply to the 'mask' element" (sect 14.4) state.style.opacity = 1f; //state.style.filter = null; boolean compositing = pushLayer(); // Save the current transform matrix, as we need to undo the following transform straight away canvas.save(); boolean maskContentUnitsAreUser = (mask.maskContentUnitsAreUser == null || mask.maskContentUnitsAreUser); if (!maskContentUnitsAreUser) { canvas.translate(originalObjBBox.minX, originalObjBBox.minY); // depends on control dependency: [if], data = [none] canvas.scale(originalObjBBox.width, originalObjBBox.height); // depends on control dependency: [if], data = [none] } // Render the mask renderChildren(mask, false); // Restore the matrix so that, if this mask has a mask, it is not affected by the objectBoundingBox transform canvas.restore(); if (compositing) popLayer(obj, originalObjBBox); // Pop the state statePop(); } }
public class class_name { public void help(String command) { if ("*".equalsIgnoreCase(command)) { m_shell.help(null); } else if ("help".equalsIgnoreCase(command)) { help(); } else { m_shell.help(command); } } }
public class class_name { public void help(String command) { if ("*".equalsIgnoreCase(command)) { m_shell.help(null); // depends on control dependency: [if], data = [none] } else if ("help".equalsIgnoreCase(command)) { help(); // depends on control dependency: [if], data = [none] } else { m_shell.help(command); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <ColumnSelectorStrategyClass extends ColumnSelectorStrategy> //CHECKSTYLE.OFF: Indentation ColumnSelectorPlus<ColumnSelectorStrategyClass>[] createColumnSelectorPluses( //CHECKSTYLE.ON: Indentation ColumnSelectorStrategyFactory<ColumnSelectorStrategyClass> strategyFactory, List<DimensionSpec> dimensionSpecs, ColumnSelectorFactory columnSelectorFactory ) { int dimCount = dimensionSpecs.size(); @SuppressWarnings("unchecked") ColumnSelectorPlus<ColumnSelectorStrategyClass>[] dims = new ColumnSelectorPlus[dimCount]; for (int i = 0; i < dimCount; i++) { final DimensionSpec dimSpec = dimensionSpecs.get(i); final String dimName = dimSpec.getDimension(); final ColumnValueSelector selector = getColumnValueSelectorFromDimensionSpec( dimSpec, columnSelectorFactory ); ColumnSelectorStrategyClass strategy = makeStrategy( strategyFactory, dimSpec, columnSelectorFactory.getColumnCapabilities(dimSpec.getDimension()), selector ); final ColumnSelectorPlus<ColumnSelectorStrategyClass> selectorPlus = new ColumnSelectorPlus<>( dimName, dimSpec.getOutputName(), strategy, selector ); dims[i] = selectorPlus; } return dims; } }
public class class_name { public static <ColumnSelectorStrategyClass extends ColumnSelectorStrategy> //CHECKSTYLE.OFF: Indentation ColumnSelectorPlus<ColumnSelectorStrategyClass>[] createColumnSelectorPluses( //CHECKSTYLE.ON: Indentation ColumnSelectorStrategyFactory<ColumnSelectorStrategyClass> strategyFactory, List<DimensionSpec> dimensionSpecs, ColumnSelectorFactory columnSelectorFactory ) { int dimCount = dimensionSpecs.size(); @SuppressWarnings("unchecked") ColumnSelectorPlus<ColumnSelectorStrategyClass>[] dims = new ColumnSelectorPlus[dimCount]; for (int i = 0; i < dimCount; i++) { final DimensionSpec dimSpec = dimensionSpecs.get(i); final String dimName = dimSpec.getDimension(); final ColumnValueSelector selector = getColumnValueSelectorFromDimensionSpec( dimSpec, columnSelectorFactory ); ColumnSelectorStrategyClass strategy = makeStrategy( strategyFactory, dimSpec, columnSelectorFactory.getColumnCapabilities(dimSpec.getDimension()), selector ); final ColumnSelectorPlus<ColumnSelectorStrategyClass> selectorPlus = new ColumnSelectorPlus<>( dimName, dimSpec.getOutputName(), strategy, selector ); dims[i] = selectorPlus; // depends on control dependency: [for], data = [i] } return dims; } }
public class class_name { public Client build(String name) { if ((environment == null) && ((executorService == null) || (objectMapper == null))) { throw new IllegalStateException("Must have either an environment or both " + "an executor service and an object mapper"); } if (executorService == null) { // Create an ExecutorService based on the provided // configuration. The DisposableExecutorService decorator // is used to ensure that the service is shut down if the // Jersey client disposes of it. executorService = requireNonNull(environment).lifecycle() .executorService("jersey-client-" + name + "-%d") .minThreads(configuration.getMinThreads()) .maxThreads(configuration.getMaxThreads()) .workQueue(new ArrayBlockingQueue<>(configuration.getWorkQueueSize())) .build(); } if (objectMapper == null) { objectMapper = requireNonNull(environment).getObjectMapper(); } if (environment != null) { validator = environment.getValidator(); } return build(name, executorService, objectMapper, validator); } }
public class class_name { public Client build(String name) { if ((environment == null) && ((executorService == null) || (objectMapper == null))) { throw new IllegalStateException("Must have either an environment or both " + "an executor service and an object mapper"); } if (executorService == null) { // Create an ExecutorService based on the provided // configuration. The DisposableExecutorService decorator // is used to ensure that the service is shut down if the // Jersey client disposes of it. executorService = requireNonNull(environment).lifecycle() .executorService("jersey-client-" + name + "-%d") .minThreads(configuration.getMinThreads()) .maxThreads(configuration.getMaxThreads()) .workQueue(new ArrayBlockingQueue<>(configuration.getWorkQueueSize())) .build(); // depends on control dependency: [if], data = [none] } if (objectMapper == null) { objectMapper = requireNonNull(environment).getObjectMapper(); // depends on control dependency: [if], data = [none] } if (environment != null) { validator = environment.getValidator(); // depends on control dependency: [if], data = [none] } return build(name, executorService, objectMapper, validator); } }
public class class_name { private List<Integer> alternatesToHash(List<AlternateCoordinate> alternates) { List<Integer> list = new ArrayList<>(alternates.size()); for (AlternateCoordinate a : alternates) { // list.add(Objects.hash(a.getChromosome(), a.getStart(), a.getEnd(), a.getReference(), a.getAlternate(), a.getType())); int result = 1; result = 31 * result + a.getChromosome().hashCode(); result = 31 * result + a.getStart().hashCode(); result = 31 * result + a.getEnd().hashCode(); result = 31 * result + a.getReference().hashCode(); result = 31 * result + a.getAlternate().hashCode(); result = 31 * result + a.getType().hashCode(); list.add(result); } return list; } }
public class class_name { private List<Integer> alternatesToHash(List<AlternateCoordinate> alternates) { List<Integer> list = new ArrayList<>(alternates.size()); for (AlternateCoordinate a : alternates) { // list.add(Objects.hash(a.getChromosome(), a.getStart(), a.getEnd(), a.getReference(), a.getAlternate(), a.getType())); int result = 1; result = 31 * result + a.getChromosome().hashCode(); // depends on control dependency: [for], data = [a] result = 31 * result + a.getStart().hashCode(); // depends on control dependency: [for], data = [a] result = 31 * result + a.getEnd().hashCode(); // depends on control dependency: [for], data = [a] result = 31 * result + a.getReference().hashCode(); // depends on control dependency: [for], data = [a] result = 31 * result + a.getAlternate().hashCode(); // depends on control dependency: [for], data = [a] result = 31 * result + a.getType().hashCode(); // depends on control dependency: [for], data = [a] list.add(result); // depends on control dependency: [for], data = [a] } return list; } }
public class class_name { public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser) throws Exception { DefaultPacketExtension extension = new DefaultPacketExtension( elementName, namespace); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { String name = parser.getName(); // If an empty element, set the value with the empty string. if (parser.isEmptyElementTag()) { extension.setValue(name, ""); } // Otherwise, get the the element text. else { eventType = parser.next(); if (eventType == XmlPullParser.TEXT) { String value = parser.getText(); extension.setValue(name, value); } } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(elementName)) { done = true; } } } return extension; } }
public class class_name { public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser) throws Exception { DefaultPacketExtension extension = new DefaultPacketExtension( elementName, namespace); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { String name = parser.getName(); // If an empty element, set the value with the empty string. if (parser.isEmptyElementTag()) { extension.setValue(name, ""); // depends on control dependency: [if], data = [none] } // Otherwise, get the the element text. else { eventType = parser.next(); // depends on control dependency: [if], data = [none] if (eventType == XmlPullParser.TEXT) { String value = parser.getText(); extension.setValue(name, value); // depends on control dependency: [if], data = [none] } } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(elementName)) { done = true; // depends on control dependency: [if], data = [none] } } } return extension; } }
public class class_name { private void addFieldToLayout(final WComponent input, final String labelText, final String labelHint) { WField field = layout.addField(labelText, input); if (labelHint != null) { field.getLabel().setHint(labelHint); } } }
public class class_name { private void addFieldToLayout(final WComponent input, final String labelText, final String labelHint) { WField field = layout.addField(labelText, input); if (labelHint != null) { field.getLabel().setHint(labelHint); // depends on control dependency: [if], data = [(labelHint] } } }
public class class_name { public static void main(String[] args) { int width = 6; int height = 10; Pentomino model = new Pentomino(width, height); List splits = model.getSplits(2); for(Iterator splitItr=splits.iterator(); splitItr.hasNext(); ) { int[] choices = (int[]) splitItr.next(); System.out.print("split:"); for(int i=0; i < choices.length; ++i) { System.out.print(" " + choices[i]); } System.out.println(); System.out.println(model.solve(choices) + " solutions found."); } } }
public class class_name { public static void main(String[] args) { int width = 6; int height = 10; Pentomino model = new Pentomino(width, height); List splits = model.getSplits(2); for(Iterator splitItr=splits.iterator(); splitItr.hasNext(); ) { int[] choices = (int[]) splitItr.next(); System.out.print("split:"); // depends on control dependency: [for], data = [none] for(int i=0; i < choices.length; ++i) { System.out.print(" " + choices[i]); // depends on control dependency: [for], data = [i] } System.out.println(); // depends on control dependency: [for], data = [none] System.out.println(model.solve(choices) + " solutions found."); // depends on control dependency: [for], data = [none] } } }
public class class_name { @FormatMethod private void reportError(ParseTree parseTree, @FormatString String message, Object... arguments) { if (parseTree == null) { reportError(message, arguments); } else { errorReporter.reportError(parseTree.location.start, message, arguments); } } }
public class class_name { @FormatMethod private void reportError(ParseTree parseTree, @FormatString String message, Object... arguments) { if (parseTree == null) { reportError(message, arguments); // depends on control dependency: [if], data = [none] } else { errorReporter.reportError(parseTree.location.start, message, arguments); // depends on control dependency: [if], data = [(parseTree] } } }
public class class_name { public String getDescription() throws ProgramInvocationException { if (ProgramDescription.class.isAssignableFrom(this.mainClass)) { ProgramDescription descr; if (this.program != null) { descr = (ProgramDescription) this.program; } else { try { descr = InstantiationUtil.instantiate( this.mainClass.asSubclass(ProgramDescription.class), ProgramDescription.class); } catch (Throwable t) { return null; } } try { return descr.getDescription(); } catch (Throwable t) { throw new ProgramInvocationException("Error while getting the program description" + (t.getMessage() == null ? "." : ": " + t.getMessage()), t); } } else { return null; } } }
public class class_name { public String getDescription() throws ProgramInvocationException { if (ProgramDescription.class.isAssignableFrom(this.mainClass)) { ProgramDescription descr; if (this.program != null) { descr = (ProgramDescription) this.program; // depends on control dependency: [if], data = [none] } else { try { descr = InstantiationUtil.instantiate( this.mainClass.asSubclass(ProgramDescription.class), ProgramDescription.class); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return null; } // depends on control dependency: [catch], data = [none] } try { return descr.getDescription(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { throw new ProgramInvocationException("Error while getting the program description" + (t.getMessage() == null ? "." : ": " + t.getMessage()), t); } // depends on control dependency: [catch], data = [none] } else { return null; } } }
public class class_name { private SiftsResidue getResidue(Element residue) { SiftsResidue res = new SiftsResidue(); String dbResNumS = residue.getAttribute("dbResNum"); res.setNaturalPos(Integer.parseInt(dbResNumS)); String seqResName = residue.getAttribute("dbResName"); res.setSeqResName(seqResName); boolean observed = true; List<String> details = getTextValues(residue, "residueDetail"); if ( details != null && details.contains("Not_Observed")){ observed = false; } res.setNotObserved(! observed); //else if ( detail != null && detail.trim().equalsIgnoreCase("Conflict")){ // //} NodeList nl = residue.getElementsByTagName("crossRefDb"); if(nl != null && nl.getLength() > 0) { for(int i = 0 ; i < nl.getLength();i++) { //get the entity element Element crossRefEl = (Element)nl.item(i); String dbSource = crossRefEl.getAttribute("dbSource"); String dbCoordSys = crossRefEl.getAttribute("dbCoordSys"); String dbAccessionId = crossRefEl.getAttribute("dbAccessionId"); String dbResNum = crossRefEl.getAttribute("dbResNum"); String dbResName = crossRefEl.getAttribute("dbResName"); String dbChainId = crossRefEl.getAttribute("dbChainId"); // System.out.println(dbSource + " " + dbCoordSys + " " + dbAccessionId + " " + dbResNum + " " + dbResName + " " + dbChainId); if ( dbSource.equals("PDB") && ( dbCoordSys.equals("PDBresnum"))){ res.setPdbResNum(dbResNum); res.setPdbResName(dbResName); res.setChainId(dbChainId); res.setPdbId(dbAccessionId); } else if ( dbSource.equals("UniProt")){ res.setUniProtPos(Integer.parseInt(dbResNum)); res.setUniProtResName(dbResName); res.setUniProtAccessionId(dbAccessionId); } } } return res; } }
public class class_name { private SiftsResidue getResidue(Element residue) { SiftsResidue res = new SiftsResidue(); String dbResNumS = residue.getAttribute("dbResNum"); res.setNaturalPos(Integer.parseInt(dbResNumS)); String seqResName = residue.getAttribute("dbResName"); res.setSeqResName(seqResName); boolean observed = true; List<String> details = getTextValues(residue, "residueDetail"); if ( details != null && details.contains("Not_Observed")){ observed = false; // depends on control dependency: [if], data = [none] } res.setNotObserved(! observed); //else if ( detail != null && detail.trim().equalsIgnoreCase("Conflict")){ // //} NodeList nl = residue.getElementsByTagName("crossRefDb"); if(nl != null && nl.getLength() > 0) { for(int i = 0 ; i < nl.getLength();i++) { //get the entity element Element crossRefEl = (Element)nl.item(i); String dbSource = crossRefEl.getAttribute("dbSource"); String dbCoordSys = crossRefEl.getAttribute("dbCoordSys"); String dbAccessionId = crossRefEl.getAttribute("dbAccessionId"); String dbResNum = crossRefEl.getAttribute("dbResNum"); String dbResName = crossRefEl.getAttribute("dbResName"); String dbChainId = crossRefEl.getAttribute("dbChainId"); // System.out.println(dbSource + " " + dbCoordSys + " " + dbAccessionId + " " + dbResNum + " " + dbResName + " " + dbChainId); if ( dbSource.equals("PDB") && ( dbCoordSys.equals("PDBresnum"))){ res.setPdbResNum(dbResNum); // depends on control dependency: [if], data = [none] res.setPdbResName(dbResName); // depends on control dependency: [if], data = [none] res.setChainId(dbChainId); // depends on control dependency: [if], data = [none] res.setPdbId(dbAccessionId); // depends on control dependency: [if], data = [none] } else if ( dbSource.equals("UniProt")){ res.setUniProtPos(Integer.parseInt(dbResNum)); // depends on control dependency: [if], data = [none] res.setUniProtResName(dbResName); // depends on control dependency: [if], data = [none] res.setUniProtAccessionId(dbAccessionId); // depends on control dependency: [if], data = [none] } } } return res; } }
public class class_name { public List<ParserToken> consumeWhile(ParserTokenType... types) { List<ParserToken> tokens = new ArrayList<>(); while (isOfType(lookAheadType(0), types)) { tokens.add(consume()); } return tokens; } }
public class class_name { public List<ParserToken> consumeWhile(ParserTokenType... types) { List<ParserToken> tokens = new ArrayList<>(); while (isOfType(lookAheadType(0), types)) { tokens.add(consume()); // depends on control dependency: [while], data = [none] } return tokens; } }
public class class_name { public static final Renderer<Long> instance() { // NOPMD it's thread save! if (LongRendererWithoutSeparator.instanceRenderer == null) { synchronized (LongRendererWithoutSeparator.class) { if (LongRendererWithoutSeparator.instanceRenderer == null) { LongRendererWithoutSeparator.instanceRenderer = new LongRendererWithoutSeparator(); } } } return LongRendererWithoutSeparator.instanceRenderer; } }
public class class_name { public static final Renderer<Long> instance() { // NOPMD it's thread save! if (LongRendererWithoutSeparator.instanceRenderer == null) { synchronized (LongRendererWithoutSeparator.class) { // depends on control dependency: [if], data = [none] if (LongRendererWithoutSeparator.instanceRenderer == null) { LongRendererWithoutSeparator.instanceRenderer = new LongRendererWithoutSeparator(); // depends on control dependency: [if], data = [none] } } } return LongRendererWithoutSeparator.instanceRenderer; } }
public class class_name { @Override public void workerPreempted(final String id) { final Optional<Collection<Tasklet>> preemptedTasklets = runningWorkers.removeWorker(id); if (preemptedTasklets.isPresent()) { for (final Tasklet tasklet : preemptedTasklets.get()) { pendingTasklets.addFirst(tasklet); } } } }
public class class_name { @Override public void workerPreempted(final String id) { final Optional<Collection<Tasklet>> preemptedTasklets = runningWorkers.removeWorker(id); if (preemptedTasklets.isPresent()) { for (final Tasklet tasklet : preemptedTasklets.get()) { pendingTasklets.addFirst(tasklet); // depends on control dependency: [for], data = [tasklet] } } } }
public class class_name { public DescribeTagsResult withTagDescriptions(TagDescription... tagDescriptions) { if (this.tagDescriptions == null) { setTagDescriptions(new java.util.ArrayList<TagDescription>(tagDescriptions.length)); } for (TagDescription ele : tagDescriptions) { this.tagDescriptions.add(ele); } return this; } }
public class class_name { public DescribeTagsResult withTagDescriptions(TagDescription... tagDescriptions) { if (this.tagDescriptions == null) { setTagDescriptions(new java.util.ArrayList<TagDescription>(tagDescriptions.length)); // depends on control dependency: [if], data = [none] } for (TagDescription ele : tagDescriptions) { this.tagDescriptions.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public PondLife get(int timeoutMs) throws Exception { PondLife pl=null; // Defer to other threads before locking if (_available<_min) Thread.yield(); int new_id=-1; // Try to get pondlife without creating new one. synchronized(this) { // Wait if none available. if (_running>0 && _available==0 && _size==_pondLife.length && timeoutMs>0) wait(timeoutMs); // If still running if (_running>0) { // if pondlife available if (_available>0) { int id=_index[--_available]; pl=_pondLife[id]; } else if (_size<_pondLife.length) { // Reserve spot for a new one new_id=reservePondLife(false); } } // create reserved pondlife if (pl==null && new_id>=0) pl=newPondLife(new_id); } return pl; } }
public class class_name { public PondLife get(int timeoutMs) throws Exception { PondLife pl=null; // Defer to other threads before locking if (_available<_min) Thread.yield(); int new_id=-1; // Try to get pondlife without creating new one. synchronized(this) { // Wait if none available. if (_running>0 && _available==0 && _size==_pondLife.length && timeoutMs>0) wait(timeoutMs); // If still running if (_running>0) { // if pondlife available if (_available>0) { int id=_index[--_available]; pl=_pondLife[id]; // depends on control dependency: [if], data = [none] } else if (_size<_pondLife.length) { // Reserve spot for a new one new_id=reservePondLife(false); // depends on control dependency: [if], data = [none] } } // create reserved pondlife if (pl==null && new_id>=0) pl=newPondLife(new_id); } return pl; } }
public class class_name { public static void monitor(Object handle, ReleaseListener listener) { if (logger.isDebugEnabled()) { logger.debug("Monitoring handle [" + handle + "] with release listener [" + listener + "]"); } // Make weak reference to this handle, so we can say when // handle is not used any more by polling on handleQueue. WeakReference<Object> weakRef = new WeakReference<Object>(handle, handleQueue); // Add monitored entry to internal map of all monitored entries. addEntry(weakRef, listener); } }
public class class_name { public static void monitor(Object handle, ReleaseListener listener) { if (logger.isDebugEnabled()) { logger.debug("Monitoring handle [" + handle + "] with release listener [" + listener + "]"); // depends on control dependency: [if], data = [none] } // Make weak reference to this handle, so we can say when // handle is not used any more by polling on handleQueue. WeakReference<Object> weakRef = new WeakReference<Object>(handle, handleQueue); // Add monitored entry to internal map of all monitored entries. addEntry(weakRef, listener); } }
public class class_name { @Override public void publish(String channel, Tree message) { if (status.get() == STATUS_CONNECTED) { try { if (debug && (debugHeartbeats || !channel.endsWith(heartbeatChannel))) { logger.info("Submitting message to channel \"" + channel + "\":\r\n" + message.toString()); } clientPub.publish(channel, serializer.write(message)); } catch (Exception cause) { logger.warn("Unable to send message to Redis!", cause); reconnect(); } } } }
public class class_name { @Override public void publish(String channel, Tree message) { if (status.get() == STATUS_CONNECTED) { try { if (debug && (debugHeartbeats || !channel.endsWith(heartbeatChannel))) { logger.info("Submitting message to channel \"" + channel + "\":\r\n" + message.toString()); // depends on control dependency: [if], data = [none] } clientPub.publish(channel, serializer.write(message)); // depends on control dependency: [try], data = [none] } catch (Exception cause) { logger.warn("Unable to send message to Redis!", cause); reconnect(); } // depends on control dependency: [catch], data = [none] } } }