Created
January 11, 2011 21:01
-
-
Save chtitux/775135 to your computer and use it in GitHub Desktop.
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
// src/hassen/automation/configurator/Document.java | |
package hassen.automation.server; | |
public class Document implements IDeviceManager, IEventProcessor { | |
// ... | |
private Mapping getMapping (int id) { | |
for (Mapping m : getMappings()) { | |
if (m.getId() == id) return m; | |
} | |
return null; | |
} | |
// ... | |
} |
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
package hassen.automation.configurator; | |
public class Main { | |
// ... | |
private int getInteger (int max) { | |
int number = -1; | |
while (number == -1) { | |
System.out.print("Chose # : "); | |
try { | |
String text = input.readLine(); | |
number = Integer.parseInt(text); | |
if (number >= max) number = -1; | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
return number; | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment