with some changes to fit running bundled in SQ
505113
private static Map<String, String> mandatoryOptions(System2 system2, EsInstallation esInstallation) {
    Map<String, String> res = new LinkedHashMap<>(16);
    // GC configuration
    res.put("-XX:+UseConcMarkSweepGC", "");
    res.put("-XX:CMSInitiatingOccupancyFraction=", "75");
    res.put("-XX:+UseCMSInitiatingOccupancyOnly", "");

    // DNS cache policy
    // cache ttl in seconds for positive DNS lookups noting that this overrides the
    // JDK security property networkaddress.cache.ttl; set to -1 to cache forever
    res.put("-Des.networkaddress.cache.ttl=", "60");
    // cache ttl in seconds for negative DNS lookups noting that this overrides the
    // JDK security property networkaddress.cache.negative ttl; set to -1 to cache
    // forever
    res.put("-Des.networkaddress.cache.negative.ttl=", "10");

    // optimizations

    // pre-touch memory pages used by the JVM during initialization
    res.put("-XX:+AlwaysPreTouch", "");

    // basic
    // explicitly set the stack size
    res.put("-Xss1m", "");
    // set to headless, just in case
    res.put("-Djava.awt.headless=", "true");
    // ensure UTF-8 encoding by default (e.g. filenames)
    res.put("-Dfile.encoding=", "UTF-8");
    // use our provided JNA always versus the system one
    res.put("-Djna.nosys=", "true");

    // turn off a JDK optimization that throws away stack traces for common
    // exceptions because stack traces are important for debugging
    res.put("-XX:-OmitStackTraceInFastThrow", "");

    // flags to configure Netty
    res.put("-Dio.netty.noUnsafe=", "true");
    res.put("-Dio.netty.noKeySetOptimization=", "true");
    res.put("-Dio.netty.recycler.maxCapacityPerThread=", "0");

    // log4j 2
    res.put("-Dlog4j.shutdownHookEnabled=", "false");
    res.put("-Dlog4j2.disable.jmx=", "true");

    // (by default ES 6.6.1 uses variable ${ES_TMPDIR} which is replaced by start scripts. Since we start JAR file
    // directly on windows, we specify absolute file as URL (to support space in path) instead
    res.put("-Djava.io.tmpdir=", esInstallation.getTmpDirectory().getAbsolutePath());

    // heap dumps (enable by default in ES 6.6.1, we don't enable them, no one will analyze them anyway)
    // generate a heap dump when an allocation from the Java heap fails
    // heap dumps are created in the working directory of the JVM
    // res.put("-XX:+HeapDumpOnOutOfMemoryError", "");
    // specify an alternative path for heap dumps; ensure the directory exists and
    // has sufficient space
    // res.put("-XX:HeapDumpPath", "data");
    // specify an alternative path for JVM fatal error logs (ES 6.6.1 default is "logs/hs_err_pid%p.log")
    res.put("-XX:ErrorFile=", new File(esInstallation.getLogDirectory(), "es_hs_err_pid%p.log").getAbsolutePath());

    // JDK 8 GC logging (by default ES 6.6.1 enables them, we don't want to do that in SQ, no one will analyze them anyway)
    // res.put("8:-XX:+PrintGCDetails", "");
    // res.put("8:-XX:+PrintGCDateStamps", "");
    // res.put("8:-XX:+PrintTenuringDistribution", "");
    // res.put("8:-XX:+PrintGCApplicationStoppedTime", "");
    // res.put("8:-Xloggc:logs/gc.log", "");
    // res.put("8:-XX:+UseGCLogFileRotation", "");
    // res.put("8:-XX:NumberOfGCLogFiles", "32");
    // res.put("8:-XX:GCLogFileSize", "64m");
    // JDK 9+ GC logging
    // res.put("9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m", "");
    // due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
    // time/date parsing will break in an incompatible way for some date patterns and locals
    if (system2.isJava9()) {
      res.put("-Djava.locale.providers=", "COMPAT");
    }

    if (system2.isJava10()) {
      // temporary workaround for C2 bug with JDK 10 on hardware with AVX-512
      res.put("-XX:UseAVX=", "2");
    }

    return res;
  }
1106556
def _muaprocessnew(self):
        """"""
        foldername = self._foldername("new")
        files = self.filesystem.listdir(foldername)
        for filename in files:
            if filename == "":
                continue
            curfilename = self._foldername(joinpath("new", filename))
            newfilename = joinpath(
                self._cur,
                "%s:2,%s" % (filename, "")
                )
            self.filesystem.rename(curfilename, newfilename)
1047582
private void addSwitchConstraints(ReconfigurationProblem rp) {
        
        // Switches capacity limitation
        List<Task> tasksList = new ArrayList<>();
        List<IntVar> heightsList = new ArrayList<>();
        
        for(Switch sw : net.getSwitches()) {


            // Only if the capacity is limited
            if (sw.getCapacity() != Integer.MAX_VALUE) {

                for (VM vm : rp.getVMs()) {
                    VMTransition a = rp.getVMAction(vm);

                    if (a != null && a instanceof RelocatableVM) {

                        if (a.getDSlice().getHoster().isInstantiated()) {

                            if (a.getCSlice().getHoster().getValue() != a.getDSlice().getHoster().getValue()) {

                                Node src = source.getMapping().getVMLocation(vm);
                                Node dst = rp.getNode(a.getDSlice().getHoster().getValue());

                                if (!Collections.disjoint(net.getConnectedLinks(sw), net.getRouting().getPath(src, dst))) {
                                    tasksList.add(new Task(a.getStart(), a.getDuration(), a.getEnd()));
                                    heightsList.add(((RelocatableVM) a).getBandwidth());
                                }
                            }
                        }
                    }
                }

                if (!tasksList.isEmpty()) {
                    // Post the cumulative constraint for the current switch
                    csp.post(csp.cumulative(
                            tasksList.toArray(new Task[tasksList.size()]),
                            heightsList.toArray(new IntVar[heightsList.size()]),
                            csp.intVar(sw.getCapacity()),
                            true
                    ));

                    tasksList.clear();
                    heightsList.clear();
                }
            }
        }
    }
289922
def run_on_changes(modified, added, removed)
      types = {
        MODIFICATION_TASKS => modified,
        ADDITION_TASKS => added,
        REMOVAL_TASKS => removed
      }

      UI.clearable

      Guard.state.scope.grouped_plugins.each do |_group, plugins|
        _run_group_plugins(plugins) do |plugin|
          UI.clear
          types.each do |tasks, unmatched_paths|
            next if unmatched_paths.empty?
            match_result = Watcher.match_files(plugin, unmatched_paths)
            next if match_result.empty?
            task = tasks.detect { |meth| plugin.respond_to?(meth) }
            _supervise(plugin, task, match_result) if task
          end
        end
      end
    end
470138
def accept(self):
        """"""
        configurations = []
        for index in range(self.stack.count()):
            filename = to_text_string(self.combo.itemText(index))
            runconfigoptions = self.stack.widget(index)
            if index == self.stack.currentIndex() and\
               not runconfigoptions.is_valid():
                return
            options = runconfigoptions.get()
            configurations.append( (filename, options) )
        _set_run_configurations(configurations)
        QDialog.accept(self)
701941
final void resize(int newWidth, int newHeight)
    {
        final int oldWidth = widthInTile;
        final int oldheight = heightInTile;

        // Adjust height
        for (int v = 0; v < newHeight - oldheight; v++)
        {
            tiles.add(new ArrayList<Tile>(newWidth));
        }
        // Adjust width
        for (int v = 0; v < newHeight; v++)
        {
            final int width;
            if (v < oldheight)
            {
                width = newWidth - oldWidth;
            }
            else
            {
                width = newWidth;
            }
            for (int h = 0; h < width; h++)
            {
                tiles.get(v).add(null);
            }
        }

        widthInTile = newWidth;
        heightInTile = newHeight;
        radius = (int) Math.ceil(StrictMath.sqrt(newWidth * (double) newWidth + newHeight * (double) newHeight));
    }
118955
private void updateTransitive(Collection<Tile> resolved, Tile tile, Tile neighbor, GroupTransition transitive)
    {
        final String transitiveOut = transitive.getOut();
        final Transition transition = new Transition(TransitionType.CENTER, transitiveOut, transitiveOut);
        final Collection<TileRef> refs = getTiles(transition);
        if (!refs.isEmpty())
        {
            final TileRef ref = refs.iterator().next();

            // Replace user tile with the needed tile to solve transition (restored later)
            final Tile newTile = map.createTile(ref.getSheet(), ref.getNumber(), tile.getX(), tile.getY());
            map.setTile(newTile);

            // Replace neighbor with the needed tile to solve transition
            final Tile newTile2 = map.createTile(ref.getSheet(), ref.getNumber(), neighbor.getX(), neighbor.getY());
            map.setTile(newTile2);
            resolved.addAll(resolve(newTile2));
        }
    }
1317310
function updateXCConfigs(configItems, platformPath){
        xcconfigs.forEach(function(fileName){
            updateXCConfig(platformPath, fileName, configItems);
        });
    }
1195357
def alter(m_wfid, m_error, m_action, msg, tracker)

      case tracker['msg'].delete('_alter')
        when 'merge' then msg.merge!(tracker['msg'])
        #else ...
      end
    end
283522
def run(self):
        
        self.find_new()
        for n in self.news:
            print("{0}".format(n))
        print("")
        self.msg.template(78)
        print("| Installed {0} new configuration files:".format(
            len(self.news)))
        self.msg.template(78)
        self.choices()
166518
def run(self):
        
        with open('src/lsqfit/__init__.py', 'a') as lsfile:
            lsfile.write("\n__version__ = '%s'\n" % LSQFIT_VERSION)
        _build_py.run(self)
761668
boolean fitLinesUsingCorners( int numLines , GrowQueue_I32 cornerIndexes) {
		for (int i = 1; i <= numLines; i++) {
			int index0 = cornerIndexes.get(CircularIndex.addOffset(anchor0, i - 1, cornerIndexes.size));
			int index1 = cornerIndexes.get(CircularIndex.addOffset(anchor0, i, cornerIndexes.size));

			if( index0 == index1 )
				return false;

			if (!fitLine(index0, index1, lines.get(i - 1))) {
				// TODO do something more intelligent here.  Just leave the corners as is?
				return false;
			}
			LineGeneral2D_F64 l = lines.get(i-1);
			if( Double.isNaN(l.A) || Double.isNaN(l.B) || Double.isNaN(l.C)) {
				throw new RuntimeException("This should be impossible");
			}
		}
		return true;
	}
263490
public void addQuad (int tint, float m00, float m01, float m10, float m11, float tx, float ty,
                       float left, float top, float right, float bottom,
                       float sl, float st, float sr, float sb) {
    addQuad(tint, m00, m01, m10, m11, tx, ty,
            left,  top,    sl, st,
            right, top,    sr, st,
            left,  bottom, sl, sb,
            right, bottom, sr, sb);
  }
955870
function ( conf ) {
    templateConfig = sqsUtil.copy( conf );

    delete templateConfig.server;

    sqsTemplate.setConfig( "template", templateConfig );
}
532131
function bundleDTS() {
    const DST_PATH = path.join(__dirname, '..', config.dir.pkg);
    const TYPE_DEF_FILE = path.join(DST_PATH, config.dir.types, config.main.bundle_d_ts);
    const SRC_DEF_FILE = path.join(__dirname, '..', config.dir.built, config.main.basename + '-all.d.ts');

    let src = '\ufeff' + banner('.d.ts', config.main.basename) + fs.readFileSync(SRC_DEF_FILE).toString()
            .replace(/^\ufeff/gm, '')
            .replace(/\r\n/gm, '\n')
    ;

    const refPathInfo = [];
    const refPathDefs = src.match(/<reference path="[\s\S]*?"/g);

    if (null != refPathDefs) {
        refPathDefs.forEach((refpath) => {
            const filePath = refpath.match(/("|')[\s\S]*?("|')/)[0].replace(/("|')/g, '');
            const fileName = path.basename(filePath);
            refPathInfo.push({
                refpath: refpath,
                path: filePath,
                file: fileName,
            });
        });
        refPathInfo.forEach((target) => {
            src = src.replace(target.refpath, '<reference path="' + target.file + '"');
        });
        // remove '_dev.dependencies.d.ts' reference.
        src = src.replace(/\/\/\/ <reference path="_dev.dependencies.d.ts"[\s\S]*?\n/g, '');
    }

    if (!fs.existsSync(path.join(DST_PATH, config.dir.types))) {
        fs.mkdirSync(path.join(DST_PATH, config.dir.types));
    }
    fs.writeFileSync(TYPE_DEF_FILE, src);
}
647914
def update(self, **kwargs):
        
        self.configure(**kwargs)
        self.get_all_requirements()
        self.apply_updates(
            initial=kwargs.get("initial", False),
            scheduled=kwargs.get("scheduled", False)
        )

        return self.req_bundle
1248709
private void changeReplicas(PrimaryTerm term) {
    threadContext.execute(() -> {
      if (this.term == null || term.term() > this.term.term()) {
        this.term = term;
        consumer.register(term.primary().memberId());
      }
    });
  }