The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Java Code
Posted by: jule | May 18, 2011 @ 8:15am
Java Code
[
Download
]
package service; /** * @author Julija */ import model.Alarm; import model.Location; import model.Product; import model.Stack; import model.Stack.DryState; import dao.AlarmDao; import dao.LocationDao; import dao.ProductDao; public class Service { private static final Service INSTANCE = new Service(); private Service() { } public static Service getInstance() { return INSTANCE; } public boolean isNumber(String input) { boolean isNumber = false; for (int i = 0; i < input.length(); i++) { // Goes through the string char by char if(isCharNumber(input.charAt(i))){ isNumber = true; } else { return false; } } return isNumber; } boolean isCharNumber(char cha){ char[] number = {'0','1','2','3','4','5','6','7','8','9'}; for (int i = 0; i < 10; i++){ // Compares specific char in the string with every number as a char to test wether it is a number if (cha == number[i]){ return true; } } return false; } public void createObjects() { Location area1 = new Location("Area1", "AR1"); LocationDao.storeLocation(area1); Location area2 = new Location("Area2", "AR2"); LocationDao.storeLocation(area2); Location area3 = new Location("Area3", "AR3"); LocationDao.storeLocation(area3); Alarm alarm1 = new Alarm(5, 5); AlarmDao.storeAlarm(alarm1); Alarm alarm2 = new Alarm(5, 5); AlarmDao.storeAlarm(alarm2); Alarm alarm3 = new Alarm(0, 0); AlarmDao.storeAlarm(alarm3); for (int i=0;i<=20;i++) { ProductDao.storeProduct(new Product("SK"+i, "Candy made of liqorice in the middle with "+i+" coatings of colored sugar.", null)); ProductDao.storeProduct(new Product("AB"+i, "Candy made of liqorice in the middle with "+i+" coatings of colored sugar.", null)); ProductDao.storeProduct(new Product("ZF"+i, "Candy made of liqorice in the middle with "+i+" coatings of colored sugar.", null)); } System.out.println(ProductDao.getAllProducts()); } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
5.16 / 8
152 Votes
http://codebin.yi.org/1272
page generated in 0.01 seconds