id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
393fe57b-e40c-4b22-a263-548bdec6d846 | public int getRpmForBlinking() {
return rpmForBlinking;
} |
a781259e-8240-4f91-b12a-709550ab62ba | public void setRpmForBlinking(int rpmForBlinking) {
this.rpmForBlinking = rpmForBlinking;
} |
a36ed56a-4bae-4cd5-83bc-1cabe2f3280d | public LcdManager(Pin rsPin, Pin strobePin, Pin dataBit1, Pin dataBit2,
Pin dataBit3, Pin dataBit4, F1Data data) {
lcd = new GpioLcdDisplay(LCD_ROWS, LCD_COLUMNS, rsPin, strobePin,
dataBit1, dataBit2, dataBit3, dataBit4);
lcdString = new char[LCD_ROWS][LCD_COLUMNS];
this.f1data = data;
} |
a786b6d5-3233-4558-94e2-d1a75494e63a | public void setCustomRefreshTime(int refreshTime)
{
if(refreshTime > 0)
this.refreshTime = refreshTime;
else
throw new NumberFormatException("Refresh time must be greater than 0");
} |
a602704e-edb5-45f4-b20f-4ac3fc21464c | public void startRefresh() {
if (screenThread == null || !screenThread.isAlive()) {
screenThread = new Thread(new Runnable() {
@Override
public void run() {
while (!stopThread) {
try {
lcdWrite(String.format("%3d", f1data.getSpeed())
+ "km/h " + " G : " + f1data.getGear(), 0);
... |
5a792009-9e96-41c5-80ed-86a2e35128d7 | @Override
public void run() {
while (!stopThread) {
try {
lcdWrite(String.format("%3d", f1data.getSpeed())
+ "km/h " + " G : " + f1data.getGear(), 0);
lcdWrite(Utils.doubleToTime(f1data.getTime()) + " "
+ "P : " + f1data.getPosition(), 1);
Thread.sleep(refreshTime);... |
6c431974-f18d-4938-9195-339774e68810 | public void lcdWrite(String string) {
for (int i = 0; i < string.length() && i < LCD_COLUMNS * LCD_ROWS; i++) {
if (string.charAt(i) != lcdString[(int) (i / LCD_COLUMNS)][i
% LCD_COLUMNS]) {
lcdString[(int) (i / LCD_COLUMNS)][i % LCD_COLUMNS] = string
.charAt(i);
lcd.write((int) (i / LCD_COLUMNS... |
aff4bb54-7f5c-461c-9917-70d04eddcb71 | public void lcdWrite(String string, int row) {
if (row < LCD_ROWS) {
for (int i = 0; i < string.length() && i < LCD_COLUMNS; i++) {
if (string.charAt(i) != lcdString[row][i]) {
lcdString[row][i] = string.charAt(i);
lcd.write(row, i, string.charAt(i));
}
}
if (string.length() < LCD_COLUMNS) ... |
6558a436-3acc-411a-a3ec-bf2378d51876 | public void finishThread() {
if (screenThread != null && screenThread.isAlive()) {
this.stopThread = true;
try {
screenThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
lcd.clear();
}
} |
9b57cfb6-67ba-4fb8-8322-b38f381bc549 | private LcdParameter() {
} |
efb96016-e8a3-42f7-a8de-4857b9aea5b9 | public BlinkRunnable(List<GpioPinDigitalOutput> listLed) {
this.listLed = listLed;
} |
74cd4e14-5fd7-4fe2-933a-614622ecd752 | @Override
public void run() {
while (!stopThread) {
for (GpioPinDigitalOutput led : listLed) {
if (ledStatus) {
led.high();
} else {
led.low();
}
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
ledStatus = !ledStatus;
}
stopThre... |
6ac7d34c-ef3c-438a-acf3-3c65d29d5f88 | public synchronized void stopBlinking() {
this.stopThread = true;
} |
6699323b-b5e9-4407-abd3-55ecada2f830 | public LedBlinking(List<GpioPinDigitalOutput> listLed) {
this.runnable = new BlinkRunnable(listLed);
} |
1f0c83e5-aa48-4712-9d0d-94c2f0ef21cd | public void startThread() {
t = new Thread(runnable);
t.start();
} |
9f079355-3106-45b2-98ee-8df762160174 | public void stopThread() {
runnable.stopBlinking();
} |
cdad5a42-df5b-4976-a6d3-c60b3748766d | public void waitForThread() throws InterruptedException {
t.join();
} |
dbe76ac2-b233-4183-844c-d2c1c12b1096 | public boolean isAlive() {
if(t != null)
return t.isAlive();
else
return false;
} |
f883efb9-8eb8-4204-bb0c-2366c4725068 | public void updateDataWithDoubleArray(double[] arrayOfDouble)
{
engineRpm = arrayOfDouble[37];
speed = (int) (arrayOfDouble[7] * 3.6); // Multiply by 3.6 to get in km/h
gear = (int) arrayOfDouble[33];
time = arrayOfDouble[1];
position = (int) arrayOfDouble[39];
} |
49f95c92-c946-49cf-8a24-89a9f104ef52 | public int getGear() {
return gear;
} |
8ef91172-ae17-4bd2-969a-9e7a646e6ca8 | public void setGear(int gear) {
this.gear = gear;
} |
0181aaa8-924b-4dd5-8b24-5241149dc45c | public int getSpeed() {
return speed;
} |
449f6827-a2ba-4358-8437-c31db329c66f | public void setSpeed(int speed) {
this.speed = speed;
} |
97d9dd93-a9b9-4e25-b92f-88ee2bbde349 | public double getTime() {
return time;
} |
6c48c4c5-14a9-4222-802f-da8ce2fbde02 | public void setTime(double time) {
this.time = time;
} |
65a1807d-f5f9-42b6-9e87-b34fbaa1c7f4 | public double getEngineRpm() {
return engineRpm;
} |
63437f9b-34ee-4ed3-9a3a-d1a9bda5bada | public void setEngineRpm(double engineRpm) {
this.engineRpm = engineRpm;
} |
55a2471d-4de0-4bc3-b390-b6421434d09a | public int getPosition() {
return position;
} |
e6322de5-82b5-4ff2-bd49-452e0bbcc233 | public void setPosition(int position) {
this.position = position;
} |
cfba70d9-d05d-4b92-bd62-51a0980bde69 | public static String doubleToTime(double time) {
int ms = (int) (time * 1000 % 1000);
int s = (int) (time % 60);
int min = (int) (time / 60);
return min + ":" + String.format("%02d", s) + ":"
+ String.format("%03d", ms);
} |
55130726-3358-4b98-afbb-3ca0b210073e | public static double[] byteToDouble(byte[] paramArrayOfByte) {
double[] arrayOfDouble = new double[paramArrayOfByte.length / 4];
for (int i3 = 0; i3 < arrayOfDouble.length; i3++) {
double d1 = Float.intBitsToFloat(paramArrayOfByte[(i3 << 2)] & 0xFF
| (paramArrayOfByte[((i3 << 2) + 1)] & 0xFF) << 8
| (p... |
3f978e56-e313-432c-85d4-1ce0530218c4 | public F1TelemetryProperties(String fileName) {
properties = new Properties();
FileInputStream input;
try {
input = new FileInputStream(fileName);
properties.load(input);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
8887633c-4f39-418d-8944-555a3e5bdfa1 | public Pin getGpioPinFor(String param, Pin defaultPin) {
Pin pin = defaultPin;
int pinNumber = getIntProperties(param, -1);
if (pinNumber != -1) {
switch (pinNumber) {
case 0:
pin = RaspiPin.GPIO_00;
break;
case 1:
pin = RaspiPin.GPIO_01;
break;
case 2:
pin = RaspiPin.GPIO_02;
... |
5fcc0f39-7aff-4fd1-871d-689645d0add7 | public int getIntProperties(String param, int defaultValue) {
try {
return Integer.parseInt(properties.getProperty(param));
} catch (NumberFormatException e) {
e.printStackTrace();
return defaultValue;
}
} |
cffce2ff-cf3b-4620-b276-f84f6f5152fb | public boolean getBooleanProperties(String param) {
return "true".equals(properties.getProperty(param));
} |
1f752281-1b85-41d4-a770-ec81f139f339 | public Model(Controller controller) {
this.controller = controller;
setSelectedSourceDir(defaultSourceDir);
} |
6e67ee18-b219-4b17-97cb-29fc64035136 | public File getDefaultSourceDir() {
return defaultSourceDir;
} |
7aba1452-06ab-4f9e-a86d-fe3dad1789a0 | public void setDefaultSourceDir(File defaultSourceDir) {
this.defaultSourceDir = defaultSourceDir;
} |
b6f5572c-a4be-4b49-aeed-7eac268e2a66 | public File getSelectedSourceDir() {
return selectedSourceDir;
} |
0e032892-af1a-4d03-a9a6-fa0744ad7d92 | public void setSelectedSourceDir(File selectedSourceDir) {
this.selectedSourceDir = selectedSourceDir;
controller.updateSelectedSourceDir(selectedSourceDir);
} |
9ae434c4-dc06-4391-a70d-6e14f3f70e91 | public List<RemovableDrive> getRemovableDrives() {
return removableDrives;
} |
d5e877f8-547f-4628-9363-9224a4bd5556 | public void setRemovableDrives(List<RemovableDrive> drives) {
isRemovableDrivesChanged = false;
if (!CollectionUtils.isEqualCollection(drives, removableDrives)) {
// TODO controller aufrufen
isRemovableDrivesChanged = true;
}
// TODO sync-status beibehalten
this.removableDrives = drives;
} |
2efa15c8-751e-466f-b243-369c9e5e2214 | public boolean isRemovableDrivesChanged() {
return isRemovableDrivesChanged;
} |
903c04c0-d832-4cfa-aee2-88c67c6b3f8c | public void setRemovableDrivesChanged(boolean isRemovableDrivesChanged) {
this.isRemovableDrivesChanged = isRemovableDrivesChanged;
} |
4ff39084-8221-4207-b5cf-00d2b1167c3c | @Override
protected Task<List<RemovableDrive>> createTask() {
return new Task<List<RemovableDrive>>() {
@Override
protected List<RemovableDrive> call() {
List<RemovableDrive> drives = new ArrayList<RemovableDrive>();
File[] f = File.listRoots();
for (int i = 0; i < f.length; i++) {
if (isRemov... |
87150238-ac84-4333-b764-080c237a7e99 | @Override
protected List<RemovableDrive> call() {
List<RemovableDrive> drives = new ArrayList<RemovableDrive>();
File[] f = File.listRoots();
for (int i = 0; i < f.length; i++) {
if (isRemovableDisk(f[i])) {
String displayName = fsv.getSystemDisplayName(f[i]);
RemovableDrive drive = new ... |
fb7b047d-926c-49c4-992d-c63702bdaec2 | private boolean isRemovableDisk(File f) {
String description = fsv.getSystemTypeDescription(f);
LOG.debug(f + " = " + description);
return description.equals(REMOVABLE_DISK);
} |
01a3852d-72d0-481c-b8ff-ac3f45111fc5 | Type(String fileName) {
this.fileName = fileName;
} |
3066cfdd-bfea-4d6c-8604-a6f97c3ec953 | public String getFileName() {
return fileName;
} |
c892f90e-d624-4019-bc82-25823017a6d4 | public static boolean isKnownType(RemovableDrive drive) {
return getType(drive.getName()) != UNDEFINED;
} |
1d28a5b0-40a7-40ae-88ee-ff9a62603be3 | public static RemovableDrive.Type getType(RemovableDrive drive) {
return getType(drive.getName());
} |
62436ed6-dede-426a-afe0-a875a9addc1c | public static RemovableDrive.Type getType(String displayName) {
for (RemovableDrive.Type type : Type.values()) {
if (displayName.toUpperCase().contains(type.toString())) {
return type;
}
}
return UNDEFINED;
} |
44b90e1d-bc9d-423e-b100-13eba19affe7 | public RemovableDrive(RemovableDrive.Type type, File drivePath, String name) {
this.type = type;
this.drivePath = drivePath;
this.name = name;
} |
513f24d4-0c05-4143-a60a-d0f956186e38 | public RemovableDrive.Type getType() {
return type;
} |
d028202c-0a58-4c53-a972-16204c8b97de | public File getDriveLetter() {
return drivePath;
} |
fd1b0ac4-f45b-4399-abdf-fd59cd8ce063 | public String getName() {
return name;
} |
dc39b1f0-4444-437f-bf01-23b044e374d8 | public boolean isInSync() {
return inSync;
} |
c601e357-7516-4d22-a686-2059adfe6a2d | public void setInSync(boolean inSync) {
this.inSync = inSync;
} |
4726b068-4bf4-4d0e-aa5c-8aae1276232b | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((drivePath == null) ? 0 : drivePath.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
} |
f4549718-f68b-4bb9-8d51-ae0432ced017 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RemovableDrive other = (RemovableDrive) obj;
if (drivePath == null) {
if (other.drivePath != null)
return false;
} else if (!drivePath.e... |
a807a139-8797-462f-a997-e34422f67b54 | @Override
public String toString() {
return "RemovableDrive [name=" + name + "]";
} |
02e5601a-901d-4cb0-9ac9-be37bc7bd4c4 | public static void main(String[] args) {
launch(args);
} |
6605e20d-31db-4347-a4cf-f7bba74b6e01 | @Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("usbdesign.fxml"));
Scene scene = new Scene(root, 1024, 600);
stage.setTitle("Mass USB Copier");
stage.setScene(scene);
stage.show();
heartbeatSticks();
// heartbeatFilesystem();
} |
cde9bcb3-be28-4f57-92e7-af580ab97535 | private void heartbeatSticks() {
RemovableDriveService removableDriveService = new RemovableDriveService();
removableDriveService.setPeriod(Duration.seconds(3));
removableDriveService.start();
// Timeline targetUpdater = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
//
// ... |
22790fd3-a7bc-44f3-98e2-b5f79bca4124 | @FXML
public void initialize() {
instance = this;
model = new Model(this);
// TODO später über CSS setzen
sourcePane.setPadding(new Insets(10));
targetPane.setPadding(new Insets(10));
updateTargets();
} |
1e318976-4fd0-4ea3-9c29-8beacffb454f | public static Controller getInstance() {
return instance;
} |
37395697-f239-4a2b-9da7-e34e5c32c673 | @FXML
protected void chooseSourcePath() {
DirectoryChooser dirChooser = new DirectoryChooser();
dirChooser.setTitle("Wähle das Quellverzeichnis");
dirChooser.setInitialDirectory(model.getSelectedSourceDir());
File file = dirChooser.showDialog(getStage());
if (file != null) {
model.setSelectedSourceDir(fil... |
65da8f16-bb61-431f-9772-501c4b69eda6 | public void updateSelectedSourceDir(File sourceDir) {
sourceText.setText(sourceDir.getAbsolutePath());
} |
6c5c3b63-83ab-4c51-a3dd-79829e04292b | protected void updateTargets() {
long now = System.currentTimeMillis();
List<RemovableDrive> removableDrives = model.getRemovableDrives();
LOG.debug("Zeit für holen der Laufwerke: {} ms.", (System.currentTimeMillis() - now));
boolean changed = model.isRemovableDrivesChanged();
LOG.debug("Laufwerke haben sich ... |
6caf4866-3824-4753-bf2c-b2677980df97 | private void addTargetToTargetPane(RemovableDrive drive, int pos) {
targetPane.add(getImage(drive), 0, pos);
Label label = new Label(drive.getName());
GridPane.setConstraints(label, 1, pos, 3, 1);
targetPane.getChildren().add(label);
Button copyButton = new Button("Kopieren");
copyButton.setId("Copy" + po... |
afb9a417-eeaf-4fed-a616-af59c7013863 | private void copy(ActionEvent event) {
// TODO Achtung: getRemovableDrives holt die Liste neu, es kann sich
// also der Index ändern!
RemovableDrive drive = model.getRemovableDrives().get(getIndexOfButton(event));
File path = drive.getDriveLetter();
// TODO Dialog auf Deutsch umstellen
Action response = Di... |
b5a0e376-4d03-4fb2-9441-1fd0a05efd53 | @Override
protected Void call() throws Exception {
try {
System.out.println("copying to " + path);
if (RemovableDrive.Type.isKnownType(drive)) {
FileUtils.cleanDirectory(path);
}
FileUtils.copyDirectoryToDirectory(model.getSelectedSourceDir(), path);
} catch (IOException e) ... |
f9639863-444f-4f53-953c-6c7f45619016 | private void setSync(ActionEvent event) {
ToggleButton syncButton = (ToggleButton)event.getSource();
int id = getIndexOfButton(event);
boolean sync = syncButton.isSelected();
//TODO im Model setzen
LOG.info("Sync für {} wurde {}aktiviert.", id, sync ? "" : "de");
} |
731900c5-294c-4dec-ad30-6008c774539d | private int getIndexOfButton(ActionEvent event) {
String buttonId = ((Button) event.getSource()).getId();
int endIndex = buttonId.length() - 1;
// wenn das vorletzte Zeichen eine Zahl ist, ist dies ein zweistelliger
// Index
if (Character.isDigit(buttonId.charAt(endIndex - 1))) {
endIndex--;
}
return I... |
22c6622b-5b73-4363-914b-aec6132d3bfa | private ImageView getImage(RemovableDrive drive) {
return getImage(drive.getType().getFileName());
} |
0fcd35d4-fc24-4488-b2b7-eff7365ea7d8 | private ImageView getImage(String fileName) {
URL file = getClass().getResource(fileName);
return new ImageView(file.toString());
} |
8cb3de30-df28-450b-a957-ed28ee24fcfe | private Stage getStage() {
return (Stage) sourceText.getScene().getWindow();
} |
98280ecd-cbd0-4404-8a41-2d3acb6cfebc | public DirectedEdge(int startNode, int endNode)
{
this.startNode = startNode;
this.endNode = endNode;
} |
4bb42f02-22c2-4583-a50e-58df69dfe129 | public int getStart()
{
return this.startNode;
} |
ae65c4f3-4b1b-4392-9c5a-1aa09011ef24 | public int getEnd()
{
return this.endNode;
} |
8d5b4e05-8f1d-4327-ba9a-f33a1f3f62de | @Override
public boolean equals(Object e)
{
if (!(e instanceof DirectedEdge))
return false;
DirectedEdge _e = (DirectedEdge) e;
return this.startNode == _e.getStart() && this.endNode == _e.getEnd();
} |
13b6d074-7c56-4a31-9303-53058416b47d | @Override
public String toString()
{
return "(" + this.startNode + ", " + this.endNode + ")";
} |
94c5433c-5702-49bb-93a8-41eb2f2b32eb | public VotingRound(Episode ep)
{
this.ep = ep;
this.votes = new ArrayList<Vote>();
} |
9614c892-9c60-4952-8559-65c5d4d03f6d | public void addVote(Vote v)
{
this.votes.add(v);
} |
d2224b58-5f0c-42e5-9a3c-879edb4cf19a | public void addVote(int keepThisGuy, int kickThisGuy, VoteType forCatOrDog)
{
this.votes.add(new Vote(this.ep, keepThisGuy, kickThisGuy, forCatOrDog));
} |
ae7842ff-62a6-45a9-bc2f-9e2b79a65dfe | public List<Vote> getVotes()
{
return this.votes;
} |
2da28b74-e9bb-46d4-b98f-b8c34da307fa | public int getNumCats()
{
return this.ep.getNumCats();
} |
41dfbae3-2fb9-45e9-8b6d-a42fa15e6774 | public int getNumDogs()
{
return this.ep.getNumDogs();
} |
5562ad52-bc38-41ef-ba72-65f230cfae40 | public DirectedGraph(int nodeCount, List<DirectedEdge> edges)
{
this.nodeCount = nodeCount;
this.adjacencyList = new ArrayList<List<Integer>>();
// Initialize adjacency list
for (int i = 0; i < nodeCount; i++)
{
List<Integer> edgeList = new ArrayList<... |
4d43b521-611a-4d28-ab2f-a308a2954758 | public int nodeCount()
{
return this.nodeCount;
} |
ad77b18f-15f7-4d8a-b156-dafeaabae9c5 | public boolean hasNode(int node)
{
return node >= 0 && node < this.nodeCount;
} |
f4c09700-bd6b-4768-9ea0-bbde8f51ae58 | public void printAdjacencyList()
{
for (int i = 0; i < this.adjacencyList.size(); i++)
{
System.out.print(i + ": ");
List<Integer> adjacentNodes = this.adjacencyList.get(i);
Iterator<Integer> iter = adjacentNodes.iterator();
w... |
70db2d66-37eb-4d82-8f80-1d54a721e656 | public List<Integer> findShortestPath(int departure, int destination)
{
// Validate input node values
int badNode = -1;
boolean hasBadNode = false;
if (!this.hasNode(departure))
{
badNode = departure;
hasBadNode = true;
}
else if... |
72b86b77-da38-4790-b182-b69b8ea4175d | public void addEdge(DirectedEdge edge)
{
addEdge(edge.getStart(), edge.getEnd());
} |
40e2a5a8-bae3-4fb0-9840-53c7c073790e | public void addEdge(int start, int end)
{
if (!this.hasNode(start) || !this.hasNode(end))
{
throw new IllegalArgumentException("Invalid edge: (" + start + ", " + end
+ "). Nodes referenced in edges must be numbered betweed 0 and one less than # "
... |
38853978-2cfa-4270-bd5d-d0fafc9c15e8 | public void removeEdge(DirectedEdge edge)
{
removeEdge(edge.getStart(), edge.getEnd());
} |
772b419c-5e7b-40c0-b178-f0783b8b30c2 | void removeEdge(int start, int end)
{
if (this.adjacencyList.get(start).contains(end))
this.adjacencyList.get(start).remove((Integer) end);
} |
a4e8b2dc-cc59-4d98-9db8-151f7aede2f0 | public List<Integer> getAdjacentNodes(int node)
{
return this.adjacencyList.get(node);
} |
a343891e-27c3-42c6-b44e-338af1368ecc | public static void main(String[] args)
{
runInCommandLineMode();
// runTestCase();
} |
f30c5d15-14c0-4906-aa69-017544d6c13e | private static void runInCommandLineMode()
{
Scanner s = new Scanner(System.in);
// get number of voting rounds
int episodes = s.nextInt();
VotingRound[] rounds = new VotingRound[episodes];
while (episodes > 0)
{
// get number of cats/dogs/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.