This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void printArray(int * array, int size){ | |
int i; | |
printf("[ "); | |
for (i = 0; i < size; i++) | |
printf("%d ", array[i]); | |
printf("]\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (Index * 5 seconds) + (20 seconds * (Index - PrevIndex)) | |
# If previous elevators loops/stops add up to be greater than, | |
# (timePerFloor * 2) + timePerWait, then increase floor of previous | |
# elevators loop. i.e. elevator[2]+=1 | |
# e represents elevatorArray | |
def addFloor(e): | |
best = 99999 | |
for i in range(1, len(e)): | |
cirTime, avgCarry = eleLoop(e, i) | |
if cirTime + ((cirTime / 100) * avgCarry) < best: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allocate elevators | |
# Elevator[] represents the starting | |
# group of stops. | |
def elevatorAllocation(building, elevatorCount): | |
elevator = [] | |
for i in range(elevatorCount + 1): | |
elevator.append(0) | |
for i in range(1, floorCount): | |
elevator = addFloor(elevator) | |
printeleLoop(elevator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sets up the building, filling all the floors with people | |
def fillBuilding(): | |
building = [] | |
for i in range(floorCount - 1): | |
building.append(peoplePerFloor) | |
return building | |
# Determines the time for circuit (cirTime), | |
# as well as average carrying capacity per circuit. | |
# Given e - array of elevators, which holds the highest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class javaScriptHandler : public QObject { | |
Q_OBJECT | |
public slots: | |
Q_INVOKABLE void webElement(QString str); | |
public: | |
javaScriptHandler(); | |
void injectJavaScript(QWebFrame *); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: javaScriptHandler * api is a variable in the MainWindow class | |
void MainWindow::on_webView_loadProgress(int progress){ | |
ui->urlLineEdit->setVisible(false); | |
ui->progressBar->setValue(progress); | |
QWebFrame * frame= ui->webView->page()->mainFrame(); | |
if(progress == 100){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clickHandler(e){ | |
var alertString, elem, evt = e ? e:event; | |
if (evt.srcElement) { | |
elem = evt.srcElement; | |
}else if (evt.target) { | |
elem = evt.target; | |
} | |
alertString = 'Tag=<'+ elem.tagName + '>'; | |
if(elem.hasAttribute('id')) { | |
alertString += '\\nId=' + elem.getAttribute('id'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Generate{ | |
public: | |
Generate(); | |
void push(std::string); | |
std::string pop(); | |
void outPut(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Generate::Generate(){ | |
objects = new std::queue<std::string>; | |
} | |
void Generate::push(std::string obj){ | |
std::cout << "Size: " << objects->size() << std::endl; | |
std::cout << "Pushing:\n" << obj << std::endl; | |
objects->push(obj); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "generate.h" | |
class javaScriptHandler : public QObject { | |
Q_OBJECT | |
public slots: | |
Q_INVOKABLE void webElement(QString); | |
public: | |
javaScriptHandler(); |