code
stringlengths
73
34.1k
label
stringclasses
1 value
public String evaluate(Features features, Set<String> discovered, boolean coerceUndefinedToFalse) { if (feature != null && discovered != null) { discovered.add(feature); } if (feature == null) { return nodeName; } else if (!coerceUndefinedToFalse && !features.contains(feature)) { return null; ...
java
public void replaceWith(HasNode node) { feature = node.feature; nodeName = node.nodeName; trueNode = node.trueNode; falseNode = node.falseNode; }
java
public void replaceWith(String nodeName) { feature = null; this.nodeName = nodeName; trueNode = falseNode = null; }
java
protected String invoke(CommandProvider provider, CommandInterpreterWrapper interpreter) throws Exception { Method method = provider.getClass().getMethod("_aggregator", new Class[]{CommandInterpreter.class}); //$NON-NLS-1$ method.invoke(provider, new Object[]{interpreter}); return interpreter.getOutput(); }
java
public static final void setWriter(String format, TreeWriter writer) { String key = format.toLowerCase(); writers.put(key, writer); if (JSON.equals(key)) { cachedJsonWriter = writer; } }
java
public static <T> Predicate<T> TRUE() { return new Predicate<T>() { public boolean check(T obj) { return true; } }; }
java
public static <T> Predicate<T> FALSE() { return Predicate.<T>NOT(Predicate.<T>TRUE()); }
java
public static <T> Predicate<T> NOT(final Predicate<T> pred) { return new Predicate<T>() { public boolean check(T obj) { return !pred.check(obj); } }; }
java
public static <T> Predicate<T> AND(final Predicate<T> a, final Predicate<T> b) { return new Predicate<T>() { public boolean check(T obj) { return a.check(obj) && b.check(obj); } }; }
java
public static <T> Predicate<T> OR(final Predicate<T> a, final Predicate<T> b) { return new Predicate<T>() { public boolean check(T obj) { return a.check(obj) || b.check(obj); } }; }
java
public void fillVMIndex(TIntIntHashMap index, int p) { for (Node n : scope) { for (VM v : parent.getRunningVMs(n)) { index.put(v.id(), p); } for (VM v : parent.getSleepingVMs(n)) { index.put(v.id(), p); } } for (VM v...
java
public Boolean getIncludeStatus() { if (formula.isTrue()) { return Boolean.TRUE; } else if (formula.isFalse()) { return Boolean.FALSE; } return null; }
java
public ModuleDepInfo andWith(ModuleDepInfo other) { if (other == null) { return this; } formula.andWith(other.formula); if (!isPluginNameDeclared && other.isPluginNameDeclared) { pluginName = other.pluginName; isPluginNameDeclared = true; } else if (pluginName == null) { pluginName = othe...
java
public boolean add(ModuleDepInfo other) { Boolean modified = false; if (formula.isTrue()) { // No terms added to a true formula will change the evaluation. return false; } if (other.formula.isTrue()) { // Adding true to this formula makes this formula true. modified = !formula.isTrue(); ...
java
public void setMinMaxLength(int[] lengths) { Arrays.sort(lengths); this.minLength = lengths[0]; this.maxLength = lengths[lengths.length - 1]; }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) protected AbstractGenericType<T> create(Type genericType, GenericType<?> genericDefiningType) { return new GenericTypeImpl(genericType, genericDefiningType); }
java
public static <T> void inOrder(T root, BinTreeNavigator<T> binTreeNav, Action<T> action) { for(Iterator<T> it = inOrder(root, binTreeNav); it.hasNext(); ) { T treeVertex = it.next(); action.action(treeVertex); } }
java
private Map<Link, Boolean> getFirstPhysicalPath(Map<Link, Boolean> currentPath, Switch sw, Node dst) { // Iterate through the current switch's links for (Link l : net.getConnectedLinks(sw)) { // Wrong link if (currentPath.containsKey(l)) { continue; }...
java
public Bundle getBundle(String symbolicName) { final String sourceMethod = "getBundle"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(FrameworkWiringBundleResolver.class.getName(), sourceMethod, new Object[]{symbolicName}); } Bundle[] candidate...
java
protected String getSourcesMappingEpilogue() { String root = ""; //$NON-NLS-1$ String contextPath = request.getRequestURI(); if (contextPath != null) { // We may be re-building a layer for a source map request where the layer // has been flushed from the cache. If that's the case, then the context ...
java
protected List<ModuleBuildFuture> collectFutures(ModuleList moduleList, HttpServletRequest request) throws IOException { final String sourceMethod = "collectFutures"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod...
java
protected String notifyLayerListeners(ILayerListener.EventType type, HttpServletRequest request, IModule module) throws IOException { StringBuffer sb = new StringBuffer(); // notify any listeners that the config has been updated List<IServiceReference> refs = null; if(aggr.getPlatformServices() != null){ ...
java
public static String getModuleName(URI uri) { String name = uri.getPath(); if (name.endsWith("/")) { //$NON-NLS-1$ name = name.substring(0, name.length()-1); } int idx = name.lastIndexOf("/"); //$NON-NLS-1$ if (idx != -1) { name = name.substring(idx+1); } if (name.endsWith(".js")) { //$NON-...
java
public static String getExtension(String path) { int idx = path.lastIndexOf("/"); //$NON-NLS-1$ String filename = idx == -1 ? path : path.substring(idx+1); idx = filename.lastIndexOf("."); //$NON-NLS-1$ return idx == -1 ? "" : filename.substring(idx+1); //$NON-NLS-1$ }
java
private boolean tryAddModule( IAggregator aggregator, List<String> list, String bundleRoot, IResource bundleRootRes, String locale, String resource, Collection<String> availableLocales) throws IOException { if (availableLocales != null && !availableLocales.contains(locale)) { re...
java
private static <A> ForwardNavigator<RegExp<A>> unionNav() { return new ForwardNavigator<RegExp<A>>() { private Visitor<A,List<RegExp<A>>> unionVis = new Visitor<A,List<RegExp<A>>>() { public List<RegExp<A>> visit(Union<A> ure) { return Arrays.<RegExp<A>>asList(ure.left, ure.right); } public List<RegEx...
java
private static <A> ForwardNavigator<RegExp<A>> concatNav() { return new ForwardNavigator<RegExp<A>>() { private Visitor<A,List<RegExp<A>>> concatVis = new Visitor<A,List<RegExp<A>>>() { public List<RegExp<A>> visit(Concat<A> ure) { return Arrays.<RegExp<A>>asList(ure.left, ure.right); } public List<Re...
java
private Transformer createTransformer(boolean indent) { try { Transformer result = this.transformerFactory.newTransformer(); if (indent) { result.setOutputProperty(OutputKeys.INDENT, "yes"); } return result; } catch (TransformerConfigurationException e) { throw new Illegal...
java
public Parameters parameters() { Parameters ps = new DefaultParameters() .setTimeLimit(timeout) .doRepair(repair) .doOptimize(optimize); if (single()) { ps.setVerbosity(verbosity); } if (chunk) { ps.setEnvironmentFa...
java
public Stream<LabelledInstance> instances() throws IOException { if (single()) { return Collections.singletonList(instance(new File(instance))).stream(); } @SuppressWarnings("resource") Stream<String> s = Files.lines(Paths.get(instances), StandardCharsets.UTF_8); ret...
java
public File output() throws IOException { File o = new File(output); if (!o.exists() && !o.mkdirs()) { throw new IOException("Unable to create output folder '" + output + "'"); } return o; }
java
public static LabelledInstance instance(File f) { String path = f.getAbsolutePath(); return new LabelledInstance(path, JSON.readInstance(f)); }
java
public static <T1,T2,T3> Function<T1,T3> comp(final Function<T2,T3> func1, final Function<T1,T2> func2) { return new Function<T1,T3>() { public T3 f(T1 x) { return func1.f(func2.f(x)); } }; }
java
public Collection<VM> getAssociatedVGroup(VM u) { for (Collection<VM> vGrp : sets) { if (vGrp.contains(u)) { return vGrp; } } return Collections.emptySet(); }
java
protected Properties loadProps(Properties props) { // try to load the properties file first from the user's home directory File file = getPropsFile(); if (file != null) { // Try to load the file from the user's home directory if (file.exists()) { try { URL url = file.toURI().toURL(); ...
java
protected void saveProps(Properties props) throws IOException { if (loadFromPropertiesFile) { // Persist the change to the properties file. File file = getPropsFile(); if (file != null) { FileWriter writer = new FileWriter(file); try { props.store(writer, null); } finally { w...
java
protected void updateNotify (long sequence) { IServiceReference[] refs = null; try { if(aggregator != null && aggregator.getPlatformServices() != null){ refs = aggregator.getPlatformServices().getServiceReferences(IOptionsListener.class.getName(),"(name=" + registrationName + ")"); //$NON-NLS-1$ //$NON...
java
protected void propertiesFileUpdated(Properties updated, long sequence) { Properties newProps = new Properties(getDefaultOptions()); Enumeration<?> propsEnum = updated.propertyNames(); while (propsEnum.hasMoreElements()) { String name = (String)propsEnum.nextElement(); newProps.setProperty(name, update...
java
protected void propsFileUpdateNotify(Properties updatedProps, long sequence) { if(aggregator == null || aggregator.getPlatformServices() == null // unit tests? || !loadFromPropertiesFile) return; IPlatformServices platformServices = aggregator.getPlatformServices(); try { IServiceReference[] refs = ...
java
protected Properties initDefaultOptions() { Properties defaultValues = new Properties(); defaultValues.putAll(defaults); // See if there's an aggregator.properties in the class loader's root ClassLoader cl = OptionsImpl.class.getClassLoader(); URL url = cl.getResource(getPropsFilename()); if (url !=...
java
void setFromFractions(final double latFraction, final double lonFraction, final double latFractionDelta, final double lonFractionDelta) { assert (lonFractionDelta >= 0.0); assert (latFractionDelta != 0.0); lonFractionMin = lonFraction; lonFractionMax = lonFracti...
java
@Override public boolean applyAction(Model c) { Mapping map = c.getMapping(); return !map.isOffline(node) && map.addOfflineNode(node); }
java
public static void join(SAXSymbol left, SAXSymbol right) { // System.out.println(" performing the join of " + getPayload(left) + " and " // + getPayload(right)); // check for an OLD digram existence - i.e. left must have a next symbol // if .n exists then we are joining TERMINAL symbols within t...
java
public void substitute(SAXRule r) { // System.out.println("[sequitur debug] *substitute* " + this.value + " with rule " // + r.asDebugLine()); // clean up this place and the next // here we keep the original position in the input string // r.addIndex(this.originalPosition); this.c...
java
public void match(SAXSymbol theDigram, SAXSymbol matchingDigram) { SAXRule rule; SAXSymbol first, second; // System.out.println("[sequitur debug] *match* newDigram [" + newDigram.value + "," // + newDigram.n.value + "], old matching one [" + matchingDigram.value + "," // + matchingDigram.n....
java
protected static String getPayload(SAXSymbol symbol) { if (symbol.isGuard()) { return "guard of the rule " + ((SAXGuard) symbol).r.ruleIndex; } else if (symbol.isNonTerminal()) { return "nonterminal " + ((SAXNonTerminal) symbol).value; } return "symbol " + symbol.value; }
java
public List<String> getExtraModules() { return extraModules == null ? Collections.<String>emptyList() : Collections.unmodifiableList(extraModules); }
java
public DefaultReconfigurationProblemBuilder setNextVMsStates(Set<VM> ready, Set<VM> running, Set<VM> sleeping, Set<VM> killed...
java
public DefaultReconfigurationProblem build() throws SchedulerException { if (runs == null) { //The others are supposed to be null too as they are set using the same method Mapping map = model.getMapping(); runs = new HashSet<>(); sleep = new HashSet<>(); ...
java
public static String inputStreamToString(InputStream in) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(in)); StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line); } return buffer.toString(); }
java
@Override public int compareTo(RepairDigramRecord o) { if (this.freq > o.freq) { return 1; } else if (this.freq < o.freq) { return -1; } return 0; }
java
protected Class<?> getNIOFileResourceClass() { final String method = "getNIOFileResourceClass"; //$NON-NLS-1$ if (tryNIO && nioFileResourceClass == null) { try { nioFileResourceClass = classLoader .loadClass("com.ibm.jaggr.core.impl.resource.NIOFileResource"); //$NON-NLS-1$ } catch (ClassNot...
java
protected Constructor<?> getNIOFileResourceConstructor(Class<?>... args) { final String method = "getNIOFileResourceConstructor"; //$NON-NLS-1$ if (tryNIO && nioFileResourceConstructor == null) { try { Class<?> clazz = getNIOFileResourceClass(); if (clazz != null) nioFileResourceConstructor ...
java
protected Object getNIOInstance(Constructor<?> constructor, Object... args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { final String method = "getInstance"; //$NON-NLS-1$ Object ret = null; if (tryNIO) { if (constructor != null) { try ...
java
@SuppressWarnings({ "rawtypes", "unchecked" }) void complete() { if (this.range != null) { AbstractValidatorRange validator = null; if (this.valueType != null) { Class<?> valueClass = this.valueType.getAssignmentClass(); if (this.valueType.isCollection()) { validator = new V...
java
protected void handleNoGetterForSetter(PojoPropertyAccessorOneArg setter, Class<?> targetClass, Object sourceObject, Class<?> sourceClass) { throw new PojoPropertyNotFoundException(sourceClass, setter.getName()); }
java
private void appendConsoleLogging(Node root) { if (logDebug && consoleDebugOutput.size() > 0) { // Emit code to call console.log on the client Node node = root; if (node.getType() == Token.BLOCK) { node = node.getFirstChild(); } if (node.getType() == Token.SCRIPT) { if (source == null) ...
java
public void close() throws IOException { if (dataStream != null) dataStream.close(); byteStream = null; dataStream = null; }
java
protected Collection<String> getRequestedLocales(HttpServletRequest request) { final String sourceMethod = "getRequestedLocales"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()}); } ...
java
protected String getHasConditionsFromRequest(HttpServletRequest request) throws IOException { final String sourceMethod = "getHasConditionsFromRequest"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{request})...
java
protected static String getParameter(HttpServletRequest request, String[] aliases) { final String sourceMethod = "getParameter"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString(), Arrays.as...
java
protected OptimizationLevel getOptimizationLevelFromRequest(HttpServletRequest request) { final String sourceMethod = "getOptimizationLevelFromRequest"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{request.get...
java
protected String getDynamicLoaderExtensionJavaScript(HttpServletRequest request) { final String sourceMethod = "getDynamicLoaderExtensionJavaScript"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod); } StringBuffer sb = ...
java
protected FeatureListResourceFactory newFeatureListResourceFactory(URI resourceUri) { final String methodName = "newFeatureMapJSResourceFactory"; //$NON-NLS-1$ boolean traceLogging = log.isLoggable(Level.FINER); if (traceLogging) { log.entering(sourceClass, methodName, new Object[]{resourceUri}); } F...
java
protected String clientRegisterSyntheticModules() { final String methodName = "clientRegisterSyntheticModules"; //$NON-NLS-1$ boolean traceLogging = log.isLoggable(Level.FINER); if (traceLogging) { log.entering(sourceClass, methodName); } StringBuffer sb = new StringBuffer(); Map<String, Integer> ...
java
public static void main(String[] args) { System.out.println(LONG_NAME + " - Release " + RELEASE); System.out.println(); System.out.println(" " + CREDO); System.out.println(); System.out.println("Project maintainer: " + MAINTAINER); System.out.println("Javadoc accessible from the official website on SourceForge:\...
java
private static int[] toBoundaries(String str) { int[] res = new int[9]; String[] split = str.split("\\s+"); for (int i = 0; i < 9; i++) { res[i] = Integer.valueOf(split[i]).intValue(); } return res; }
java
public Slice build() throws SchedulerException { if (hoster == null) { hoster = rp.makeHostVariable(lblPrefix, "_hoster"); } if (start == null) { start = rp.getStart(); } if (end == null) { end = rp.getEnd(); } if (duration == n...
java
private IntVar makeDuration() throws SchedulerException { if (start.isInstantiated() && end.isInstantiated()) { int d = end.getValue() - start.getValue(); return rp.makeDuration(d, d, lblPrefix, "_duration"); } else if (start.isInstantiated()) { if (start.isInstantiat...
java
public String generateSourceMap() throws IOException { final String sourceMethod = "generateSourceMap"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{name}); } String result = null; lineLengths =...
java
private void processNode(Node node) throws IOException { for (Node cursor = node.getFirstChild(); cursor != null; cursor = cursor.getNext()) { int lineno = cursor.getLineno()-1; // adjust for rhino line numbers being 1 based int charno = cursor.getCharno(); if (lineno > currentLine || lineno == currentLi...
java
protected void dispatchEvents() { while (true) { Object event = this.eventQueue.poll(); if (event == null) { return; } Collection<Throwable> errors = new LinkedList<>(); dispatchEvent(event, errors); if (!errors.isEmpty()) { handleErrors(errors, event); } ...
java
protected void handleErrors(Collection<Throwable> errors, Object event) { if (this.globalExceptionHandler == null) { for (Throwable error : errors) { LOG.error("Failed to dispatch event {}", event, error); } } else { this.globalExceptionHandler.handleErrors(event, errors.toArray(new T...
java
public BtrpOperand go(BtrPlaceTree parent) { append(token, "Unhandled token " + token.getText() + " (type=" + token.getType() + ")"); return IgnorableOperand.getInstance(); }
java
public IgnorableOperand ignoreError(Exception e) { append(token, e.getMessage()); return IgnorableOperand.getInstance(); }
java
public IgnorableOperand ignoreErrors(ErrorReporter err) { errors.getErrors().addAll(err.getErrors()); return IgnorableOperand.getInstance(); }
java
public IgnorableOperand ignoreError(Token t, String msg) { append(t, msg); return IgnorableOperand.getInstance(); }
java
public void append(Token t, String msg) { errors.append(t.getLine(), t.getCharPositionInLine(), msg); }
java
public T execute() { if (isWindows()) { return onWindows(); } else if (isMac()) { return onMac(); } else if (isUnix()) { return onUnix(); } else if (isSolaris()) { return onSolaris(); } else { throw new IllegalStateExcep...
java
public BtrpOperand expand() { String head = getChild(0).getText().substring(0, getChild(0).getText().length() - 1); String tail = getChild(getChildCount() - 1).getText().substring(1); BtrpSet res = new BtrpSet(1, BtrpOperand.Type.STRING); for (int i = 1; i < getChildCount() - 1; i++) { ...
java
public void add(DepTreeNode child) { if (children == null) { children = new HashMap<String, DepTreeNode>(); } children.put(child.getName(), child); child.setParent(this); }
java
public void overlay(DepTreeNode node) { if (node.defineDependencies != null || node.requireDependencies != null) { setDependencies(node.defineDependencies, node.requireDependencies, node.dependentFeatures, node.lastModified(), node.lastModifiedDep()); } node.uri = uri; if (node.getChildren() == null) { ...
java
public DepTreeNode createOrGet(String path, URI uri) { if (path.startsWith("/")) { //$NON-NLS-1$ throw new IllegalArgumentException(path); } if (path.length() == 0) return this; String[] pathComps = path.split("/"); //$NON-NLS-1$ DepTreeNode node = this; int i = 0; for (String comp : path...
java
public void remove(DepTreeNode child) { if (children != null) { DepTreeNode node = children.get(child.getName()); if (node == child) { children.remove(child.getName()); } } child.setParent(null); }
java
public void prune() { if (children != null) { List<String> removeList = new ArrayList<String>(); for (Entry<String, DepTreeNode> entry : children.entrySet()) { DepTreeNode child = entry.getValue(); child.prune(); if ((child.defineDependencies == null && child.requireDependencies == null && chi...
java
public void setDependencies(String[] defineDependencies, String[] requireDependencies, String[] dependentFeatures, long lastModifiedFile, long lastModifiedDep) { this.defineDependencies = defineDependencies; this.requireDependencies = requireDependencies; this.dependentFeatures = dependentFeatures; this.las...
java
private long lastModifiedDepTree(long lm) { long result = (defineDependencies == null && requireDependencies == null) ? lm : Math.max(lm, this.lastModifiedDep); if (children != null) { for (Entry<String, DepTreeNode> entry : this.children.entrySet()) { result = entry.getValue().lastModifiedDepTree(result...
java
void populateDepMap(Map<String, DependencyInfo> depMap) { if (uri != null) { depMap.put(getFullPathName(), new DependencyInfo(defineDependencies, requireDependencies, dependentFeatures, uri)); } if (children != null) { for (Entry<String, DepTreeNode> entry : children.entrySet()) { entry.getValue()...
java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // Call the default implementation to de-serialize our object in.defaultReadObject(); parent = new WeakReference<DepTreeNode>(null); // restore parent reference on all children if (children != null) { f...
java
protected ServiceTracker<IOptions, ?> getOptionsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException { ServiceTracker<IOptions, ?> tracker = new ServiceTracker<IOptions, Object>( bundleContext, bundleContext.createFilter( "(&(" + Constants.OBJECTCLASS + "=" + IOptions.class.getN...
java
protected ServiceTracker<IExecutors, ?> getExecutorsServiceTracker(BundleContext bundleContext) throws InvalidSyntaxException { ServiceTracker<IExecutors, ?> tracker = new ServiceTracker<IExecutors, Object>( bundleContext, bundleContext.createFilter( "(&(" + Constants.OBJECTCLASS + "=" + IExecutors....
java
public String createCacheBundle(String bundleSymbolicName, String bundleFileName) throws IOException { final String sourceMethod = "createCacheBundle"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{bundle...
java
public String processRequestUrl(String requestUrl) throws IOException, ServletException { ConsoleHttpServletRequest req = new ConsoleHttpServletRequest(getServletConfig().getServletContext(), requestUrl); OutputStream nulOutputStream = new OutputStream() { @Override public void write(int b) throws IOException...
java
public void add(VMTransitionBuilder b) { Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState()); for (VMState src : b.getSourceStates()) { m.put(src, b); } }
java
public boolean remove(VMTransitionBuilder b) { Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState()); for (VMState src : b.getSourceStates()) { m.remove(src); } return true; }
java
public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) { Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState); if (dstCompliant == null) { return null; } return dstCompliant.get(srcState); }
java
public static TransitionFactory newBundle() { TransitionFactory f = new TransitionFactory(); f.add(new BootVM.Builder()); f.add(new ShutdownVM.Builder()); f.add(new SuspendVM.Builder()); f.add(new ResumeVM.Builder()); f.add(new KillVM.Builder()); f.add(new Relocat...
java
public int getMaxBW(Node n1, Node n2) { int max = Integer.MAX_VALUE; for (Link inf : getPath(n1, n2)) { if (inf.getCapacity() < max) { max = inf.getCapacity(); } Switch sw = inf.getSwitch(); if (sw.getCapacity() >= 0 && sw.getCapacity() < m...
java
protected List<Link> getFirstPhysicalPath(List<Link> currentPath, Switch sw, Node dst) { // Iterate through the current switch's links for (Link l : net.getConnectedLinks(sw)) { // Wrong link if (currentPath.contains(l)) { continue; } // G...
java
private int loadSlack(int dim, int bin) { return p.loads[dim][bin].getUB() - p.loads[dim][bin].getLB(); }
java