method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
680344f1-44bf-4879-82c9-85d47fda818b | 9 | public ChineseLine(int x1, int x2, int y1, int y2) {
this.x1 = x1;//sets the value of the first x coordinate in the line
this.x2 = x2;//sets the value of the second x coordinate in the line
this.y1 = y1;//sets the value of the first y coordinate in the line
this.y2 = y2;//sets the value of the second y coordinate in the line
if((x2-x1) == 0)//if the line is vertical
degrees = 90;//the line is going up or down 90 degrees
else//otherwise
degrees = Math.toDegrees(Math.abs(Math.atan((y2-y1)/(x2-x1))));
//the degrees is equal to the arctangent(Δy/Δx), but remember,
//this depends on which quadrant we are in.
//we figure out which quadrant we are in by comparing the x
//and y values
totaldegrees = degrees;//setting the initial degrees
if(x2>x1&&y2>y1){//if the x and y values get larger
quadrant = FIRST_QUADRANT;//we are in the first quadrant
//we adjust the total angle by adding nothing
}
if(x2<x1&&y2>y1){
//if the x values get smaller and y the values get larger
quadrant = SECOND_QUADRANT;//we are in the second quadrant
totaldegrees+=90;//we adjust the total angle by adding 90 degrees
}
if(x2<x1&&y2<y1){//if the x and y values get smaller
quadrant = THIRD_QUADRANT;//we are in the third quadrant
totaldegrees+=180;//we adjust the total angle by adding 180 degrees
}
if(x2>x1&&y2<y1){
//if the x values get larger and y the values get smaller
quadrant = FOURTH_QUADRANT;//we are in the fourh quadrant
totaldegrees+=270;//we adjust the total angle by adding 270 degrees
}
magnitude = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
//sets the magnitude o the line by using the distance formula
} |
25143036-0489-4dfb-b573-1a85c1251815 | 1 | public void doFixedLengthHeaderAndTrailer() {
try {
final String mapping = ConsoleMenu.getString("Mapping ", FixedLengthHeaderAndTrailer.getDefaultMapping());
final String data = ConsoleMenu.getString("Data ", FixedLengthHeaderAndTrailer.getDefaultDataFile());
FixedLengthHeaderAndTrailer.call(mapping, data);
} catch (final Exception e) {
e.printStackTrace();
}
} |
7b3b226d-328a-4d20-8b65-eb804032693b | 0 | public int getSize() {
return items.length;
} |
54b5d9ea-37b6-4d36-9e8a-84458f1b88fb | 4 | public static Class compile(final String className, final String classString) {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
JavaFileManager fileManager = new ClassFileManager(compiler.getStandardFileManager(null, null, null));
JavaFileObject file = new CharSequenceJavaFileObject(className, classString);
Iterable<? extends JavaFileObject> compilationUnits = Arrays.asList(file);
CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits);
boolean success = task.call();
for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
System.out.println(diagnostic.getCode());
System.out.println(diagnostic.getKind());
System.out.println(diagnostic.getPosition());
System.out.println(diagnostic.getStartPosition());
System.out.println(diagnostic.getEndPosition());
System.out.println(diagnostic.getSource());
System.out.println(diagnostic.getMessage(null));
}
if (success) {
Class result = null;
try {
result = fileManager.getClassLoader(null).loadClass(className);
} catch (ClassNotFoundException e) { }
return result;
}
return null;
} |
aee3d56c-aaf6-4812-9405-1490acf5abfa | 9 | public void chooseTrainAndTestSignatures(String database)
{
ArrayList<LabeledSignature> signatures = parseDatabaseFile(database);
if (database == null) return;
ArrayList<ArrayList<LabeledSignature>> userGenuineSignatures = new ArrayList<ArrayList<LabeledSignature>>(numberOfUsers);
ArrayList<ArrayList<LabeledSignature>> userForgerySignatures = new ArrayList<ArrayList<LabeledSignature>>(numberOfUsers);
this.userGenuineTrainSignatures = new ArrayList<ArrayList<LabeledSignature>>(numberOfUsers);
this.userForgeryTrainSignatures = new ArrayList<ArrayList<LabeledSignature>>(numberOfUsers);
this.testSignatures = new ArrayList<LabeledSignature>();
// Initialize lists
for (int i = 0; i < numberOfUsers; i++) {
userGenuineSignatures.add(new ArrayList<LabeledSignature>());
userForgerySignatures.add(new ArrayList<LabeledSignature>());
}
// Class signatures according to their userID
for (LabeledSignature s : signatures) {
if (s.isGenuine())
userGenuineSignatures.get(s.getUserID() - 1).add(s);
else
userForgerySignatures.get(s.getUserID() - 1).add(s);
}
// Select random train signatures for each user
int genuineTrainSize = (int)(6.0 * userGenuineSignatures.get(0).size() / 10.0);
int forgeryTrainSize = (int)(6.0 * userGenuineSignatures.get(0).size() / 10.0);
for (int i = 0; i < numberOfUsers; i++)
{
boolean[] checkGenuine = new boolean[userGenuineSignatures.get(i).size()];
this.userGenuineTrainSignatures.add(chooseRandomSignature(userGenuineSignatures.get(i), genuineTrainSize, checkGenuine));
// Store test signatures
for (int k = 0; k < checkGenuine.length; k++) {
if (!checkGenuine[k]) {
this.testSignatures.add(userGenuineSignatures.get(i).get(k));
}
}
boolean[] checkForgery = new boolean[userForgerySignatures.get(i).size()];
this.userForgeryTrainSignatures.add(chooseRandomSignature(userForgerySignatures.get(i), forgeryTrainSize, checkForgery));
// Store test signatures
for (int k = 0; k < checkForgery.length; k++) {
if (!checkForgery[k]) {
this.testSignatures.add(userForgerySignatures.get(i).get(k));
}
}
}
} |
e5073628-c988-4a39-aeb5-c49d8d771bae | 3 | @Override
public void setInstructionList(ArrayList<Instruction> instructions) {
this.instructions = instructions;
instructionList = new ArrayList<String>();
for (Instruction instruction : instructions) {
if (instruction != null && instruction.getName() != null) {
instructionList.add(instruction.getName());
}
}
drawFrame();
} |
f4f032ea-5ecc-4835-be11-e7491388508f | 5 | private void updateForDragOver(Point where) {
int count = getComponentCount();
int insertAt = count;
for (int i = 0; i < count; i++) {
Component child = getComponent(i);
if (child instanceof DockTab) {
Rectangle bounds = child.getBounds();
if (where.x < bounds.x + bounds.width / 2) {
insertAt = i;
break;
}
if (where.x < bounds.x + bounds.width) {
insertAt = i + 1;
break;
}
} else {
insertAt = i;
break;
}
}
if (insertAt != mDragInsertIndex) {
mDragInsertIndex = insertAt;
repaint();
}
} |
6348581e-cc5f-4b35-bc50-9088bf6a7b25 | 1 | @Override
public final void write(final String text) throws OutputException {
FileWriter fileWriter = null;
BufferedWriter writer = null;
try {
fileWriter = new FileWriter(path, true);
writer = new BufferedWriter(fileWriter);
writer.append(text);
writer.newLine();
writer.close();
} catch (IOException e) {
e.printStackTrace();
throw new OutputException();
}
} |
a2c90704-6567-4ec9-9a6e-fcb212167c6b | 5 | @SuppressWarnings({ "unchecked", "unused" })
@ApiMethod(name = "listMessages")
public CollectionResponse<MessageData> listMessages(
@Nullable @Named("cursor") String cursorString,
@Nullable @Named("limit") Integer limit) {
EntityManager mgr = null;
Cursor cursor = null;
List<MessageData> execute = null;
try {
mgr = getEntityManager();
// query for messages, newest message first
Query query = mgr
.createQuery("select from MessageData as MessageData order by timestamp desc");
if (cursorString != null && cursorString != "") {
cursor = Cursor.fromWebSafeString(cursorString);
query.setHint(JPACursorHelper.CURSOR_HINT, cursor);
}
if (limit != null) {
query.setFirstResult(0);
query.setMaxResults(limit);
}
execute = (List<MessageData>) query.getResultList();
cursor = JPACursorHelper.getCursor(execute);
if (cursor != null)
cursorString = cursor.toWebSafeString();
// Tight loop for fetching all entities from datastore and accomodate
// for lazy fetch.
for (MessageData obj : execute) {
;
}
} finally {
mgr.close();
}
return CollectionResponse.<MessageData> builder().setItems(execute)
.setNextPageToken(cursorString).build();
} |
353f9211-5c34-4e47-bf53-d1f291639c3b | 6 | public A2Ifs() {
System.out.println("Enter the number of your birth month:");
// birthMonth = inputInt() - 1;
while ((birthMonth = inputInt()) > 12 || birthMonth < 1) {
System.out
.println("You must have forgotten your birthmonth, ask your mum then try again:");
}
birthMonth--;
System.out.println("Enter the number of your birth day");
// birthDay = inputInt() - 1;
while ((birthDay = inputInt()) > monthLength[birthMonth]
|| birthDay < 1) {
System.out
.println("You must have forgotten your birthday, ask your mum then try again:");
}
birthDay--;
System.out.println("Your birthday is: " + month[birthMonth] + " the "
+ number[birthDay]);
int yourSign;
// if(birthDay >= startingBound[birthMonth])
yourSign = birthDay < startingBound[birthMonth] ? birthMonth
: (birthMonth == 11) ? 0 : birthMonth + 1;
System.out.println(sign[yourSign] + ": " + predictions[yourSign]);
} |
06be7e70-64bf-4aae-a091-1cc58b164c68 | 4 | private void printGridletList(GridletList list, String name,
boolean detail, double gridletLatencyTime[])
{
int size = list.size();
Gridlet gridlet = null;
String indent = " ";
StringBuffer buffer = new StringBuffer(1000);
buffer.append("\n\n============== OUTPUT for " + name + " ===========");
buffer.append("\nGridlet ID" + indent + "STATUS" + indent +
"Resource ID" + indent + indent + "Cost" + indent +
indent + "CPU Time" + indent + indent + "Latency");
// a loop to print the overall result
int i = 0;
boolean header = true;
for (i = 0; i < size; i++)
{
gridlet = (Gridlet) list.get(i);
buffer.append("\n");
buffer.append(indent + gridlet.getGridletID() + indent + indent);
buffer.append( gridlet.getGridletStatusString() );
buffer.append(indent + indent + gridlet.getResourceID() +
indent + gridlet.getProcessingCost() +
indent + gridlet.getActualCPUTime() +
indent + gridletLatencyTime[gridlet.getGridletID()]);
if (i != 0) {
header = false;
}
writeFin(name, gridlet.getGridletID(),
GridSim.getEntityName(gridlet.getResourceID()),
gridlet.getProcessingCost(), gridlet.getActualCPUTime(),
GridSim.clock(), header);
}
if (detail == true)
{
// a loop to print each Gridlet's history
for (i = 0; i < size; i++)
{
gridlet = (Gridlet) list.get(i);
buffer.append( gridlet.getGridletHistory() );
buffer.append("Gridlet #" + gridlet.getGridletID());
buffer.append(", length = " + gridlet.getGridletLength()
+ ", finished so far = " +
gridlet.getGridletFinishedSoFar());
buffer.append("===========================================");
}
}
buffer.append("\n====================================================");
System.out.println( buffer.toString() );
} |
ae40e600-c991-479d-b5a7-b7fb86aa870b | 3 | JarDirClassPath(String dirName) throws NotFoundException {
File[] files = new File(dirName).listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
name = name.toLowerCase();
return name.endsWith(".jar") || name.endsWith(".zip");
}
});
if (files != null) {
jars = new JarClassPath[files.length];
for (int i = 0; i < files.length; i++)
jars[i] = new JarClassPath(files[i].getPath());
}
} |
92bbe6a9-4987-4963-a18c-946ab5374146 | 0 | public ConfigurationReader() throws ReaderException {
_parseFile();
} |
a682044f-2d8b-4e49-ac69-6dd1477b6246 | 2 | public static void confirmExit (final JFrame fen){
fen.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
int reponse = JOptionPane.showConfirmDialog(fen,
"Voulez-allez quitter l'application, Voulez-vous enregistrer",
"Confirmation",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (reponse==JOptionPane.YES_OPTION){
Dialogue.serialiserPartie(p, "Partie.txt");
fen.dispose();
fen.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
if (reponse==JOptionPane.NO_OPTION){
fen.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
});
} |
55f29b47-bab6-4f9b-b137-df8bf556810a | 0 | public Level(Game game, Tileset tileset) {
this.game = game;
this.tileset = tileset;
} |
d0604961-b5dc-42f0-9bbe-886dc7dfbcf8 | 4 | private void protectServer(int level, String[] keywords) {
if (isAccountTypeOf(level, ADMIN, MODERATOR)) {
if (keywords.length == 2) {
if (Functions.isNumeric(keywords[1])) {
Server s = getServer(Integer.parseInt(keywords[1]));
if (s.protected_server) {
s.protected_server = false;
sendMessage(cfg_data.irc_channel, "Kill protection disabled.");
}
else {
s.protected_server = true;
sendMessage(cfg_data.irc_channel, "Kill protection enabled.");
}
}
}
else
sendMessage(cfg_data.irc_channel, "Correct usage is .protect <port>");
}
else
sendMessage(cfg_data.irc_channel, "You do not have permission to use this command.");
} |
d5787f6e-5565-4da8-b26f-cc644f960f8b | 8 | public static void main( String[ ] args ) throws IOException {
BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
String line = "";
StringBuilder out = new StringBuilder( );
int n = Integer.parseInt( in.readLine( ) );
for ( int p = 0; p < n; p++ ) {
int index = 0;
cube = new char[ 54 ];
for ( int i = 0; i < 9; i++ ) {
line = in.readLine( );
char arr[] = line.toCharArray( );
for ( int j = 0; j < arr.length; j++ ) {
if ( arr[ j ] != ' ' )
cube[ index++ ] = arr[ j ];
}
}
String cad[] = in.readLine( ).split( " " );
for ( int i = 0; i < cad.length; i++ ) {
if ( cad[ i ].equals( "0" ) )
break;
if ( Integer.parseInt( cad[ i ] ) > 0 ) {
rotate( cube, Integer.parseInt( cad[ i ] ) - 1, 0 );
} else {
rotate( cube, (Integer.parseInt( cad[ i ] ) * -1) - 1, 1 );
}
}
if ( win( ) ) {
System.out.println( "Yes, grandpa!" );
} else {
System.out.println( "No, you are wrong!" );
}
}
} |
3d817bec-3a1a-4bf5-9b17-ac94d1c895d5 | 9 | public static void main(String[] args) {
LinkedList filterList = new LinkedList();
IntegerFilter f = null;
int actualFilters = 0;
if (args.length == 0) {
System.err
.println("USAGE: java polimi.reds.examples.ClientTester [reds-tcp | reds-udp]:<brokerAddress>:<brokerPort>"
+ " <localPort> <publishProbability> <mean> <stdDev> <minSubscriptions> <maxSubscriptions>");
System.exit(0);
}
int localPort = Integer.parseInt(args[1]);
// configuring logging facility
Logger logger = Logger.getLogger("polimi.reds");
ConsoleHandler ch = new ConsoleHandler();
logger.addHandler(ch);
logger.setLevel(Level.ALL);
ch.setLevel(Level.CONFIG);
DispatchingService ds = null;
String[] transportProtocol = args[0].split(":");
if (transportProtocol[0].equals("reds-tcp"))
ds = new TCPDispatchingService(transportProtocol[1], Integer.parseInt(transportProtocol[2]));
else if (transportProtocol[0].equals("reds-udp"))
ds = new UDPDispatchingService(transportProtocol[1], Integer.parseInt(transportProtocol[2]), localPort);
else
throw new IllegalArgumentException();
try {
ds.open();
} catch (ConnectException e) {
e.printStackTrace();
}
long startTime = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
// publish probability
Random rnd = new Random();
if (rnd.nextGaussian() <= Double.parseDouble(args[2])) {
ds.publish(new IntegerMessage(rnd.nextInt()));
} else {// subscribe
if (actualFilters < Integer.parseInt(args[5])) {// subs less
// than minimum
double meanInterv = Double.parseDouble(args[3]) + Double.parseDouble(args[4]) * rnd.nextGaussian();
f = getFilter(meanInterv, Double.parseDouble(args[4]) / 4);
filterList.addLast(f);
actualFilters++;
ds.subscribe(f);
} else if (actualFilters > Integer.parseInt(args[6])) {// subs
// more
// than
// max
ds.unsubscribe((Filter) filterList.getFirst());
actualFilters--;
} else {// random
if (rnd.nextGaussian() <= Double.parseDouble(args[2])) {
// subscribe
double meanInterv = Double.parseDouble(args[3]) + Double.parseDouble(args[4])
* rnd.nextGaussian();
f = getFilter(meanInterv, Double.parseDouble(args[4]) / 4);
filterList.addLast(f);
actualFilters++;
ds.subscribe(f);
} else {// unsubscribe
ds.unsubscribe((Filter) filterList.getFirst());
actualFilters--;
}
}
}
}
ds.close();
System.out.println("Exit after " + (System.currentTimeMillis() - startTime) + " milliseconds");
} |
a79d60b2-50ce-466b-bf29-19bec3f47d38 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PreferencesFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PreferencesFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PreferencesFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PreferencesFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PreferencesFrame().setVisible(true);
}
});
} |
55c19f14-5077-49c8-b1df-fe9b8fce4fae | 6 | public Creator() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader("Kills.txt"));
String lol = null;
int i = 0;
while((lol = reader.readLine()) != null)
{
System.out.println(++i);
String name = lol.substring(1,lol.indexOf("]"));
String[] rest = lol.substring(lol.indexOf("]")+1,lol.length()).split(",");
Sound sound = new Sound(name);
for(String rs : rest)
sound.stringList.add(rs);
list.add(sound);
}
for(Sound d:list)
{
JFileChooser chooser = new JFileChooser("Input");
chooser.setPreferredSize(new Dimension(1600,1000));
chooser.setDialogTitle(d.name);
int rueckgabeWert = chooser.showOpenDialog(null);
if (rueckgabeWert == JFileChooser.APPROVE_OPTION) {
}
for(String s : d.stringList)
{
if(chooser.getSelectedFile() != null)
Misc.copyFile(chooser.getSelectedFile(), new File("Output\\" + s + ".mp3"));
}
}
} |
612aed3e-911f-4b0b-be2d-c3c9b0d1a63c | 3 | @Override
public JavaFileObject getJavaFileForInput(Location location,
String className, Kind kind) throws IOException {
JavaFileObject result;
if (StandardLocation.CLASS_OUTPUT == location && Kind.CLASS == kind) {
result = outputMap.get(className);
if (result == null) {
result = super.getJavaFileForInput(location, className, kind);
}
} else {
result = super.getJavaFileForInput(location, className, kind);
}
return result;
} |
7cee43cd-3341-4058-958b-38944b04aca9 | 1 | public DNode getLast() throws IllegalStateException{
if(isEmpty()) throw new IllegalStateException("List is empty");
return trailer.getPrev();
} |
2079354f-208d-4949-9d55-46b39c55cdb7 | 1 | public void endTurn()
{
for (Unit unit : units) {
unit.endTurn();
}
} |
548b77a0-86b0-4a3f-a542-52021d05b0f3 | 0 | public String getName() {
return name;
} |
694aa80f-cda7-4601-9e94-beaf00a82891 | 0 | @Override
public synchronized void stop() throws Exception {
doStop();
} |
e5890e9c-9352-4c2c-b5c7-d0a1fb0dc0a0 | 9 | public void getTicketContents(String ticketId) {
data = new HashMap<String, String>();
try {
if(user != null && pass != null) {
Authenticator.setDefault(new TracAuthenticator());
}
URL url = new URL(prop.getProperty("trac_url") + combo.getSelectedItem() + "/ticket/" + ticketId + "?format=tab");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String header = in.readLine();
String[] keys = header.split("\t");
String complete = "";
String line = in.readLine();
while(line != null) {
complete += (line + " ");
line = in.readLine();
}
String[] values = complete.split("\t");
for(int i=0; i<keys.length; i++) {
if(i < values.length) {
data.put(keys[i], values[i]);
}
}
String field_header = prop.getProperty("field_header");
String field_description = prop.getProperty("field_description");
String field_footer = prop.getProperty("field_footer");
for (String key : keys) {
field_header = field_header.replaceAll("\\{" + key + "\\}", data.get(key));
field_description = field_description.replaceAll("\\{" + key + "\\}", data.get(key));
field_footer = field_footer.replaceAll("\\{" + key + "\\}", data.get(key));
}
Map<String, String> d = new HashMap<String, String>();
d.put("field_header", field_header);
d.put("field_description", field_description);
d.put("field_footer", field_footer);
d.put("ticketId", ticketId);
d.put("projectName", combo.getSelectedItem().toString());
toPrint.add(d);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
} |
443e12e8-b31a-4d11-98e1-ab303e3de316 | 9 | public String listSocials(Session viewerS, List<String> commands)
{
WikiFlag wiki = getWikiFlagRemoved(commands);
final StringBuilder buf=new StringBuilder("^xAll Defined Socials: ^N\n\r");
final int COL_LEN=CMLib.lister().fixColWidth(18.0,viewerS);
int col=0;
Set<String> baseDone = new HashSet<String>();
for(String social : CMLib.socials().getSocialsList())
{
final Social soc=CMLib.socials().fetchSocial(social,true);
if(baseDone.contains(soc.baseName()))
continue;
baseDone.add(soc.baseName());
if(wiki == WikiFlag.WIKILIST)
buf.append("*[["+social+"|"+social+"]]\n\r");
else
if(wiki == WikiFlag.WIKIHELP)
{
final String TargetNoneYouSee;
final String TargetNoneOthersSee;
final String TargetSomeoneNoTarget;
final String TargetSomeoneYouSee;
final String TargetSomeoneTargetSees;
final String TargetSomeoneOthersSee;
final String TargetSelfYouSee;
final String TargetSelfOthersSee;
final Social TargetNoneSoc = CMLib.socials().fetchSocial(soc.baseName(), true);
if(TargetNoneSoc!=null)
{
TargetNoneYouSee = TargetNoneSoc.You_see();
TargetNoneOthersSee = TargetNoneSoc.Third_party_sees();
}
else
{
TargetNoneYouSee = "";
TargetNoneOthersSee = "";
}
final Social TargetSomeoneSoc = CMLib.socials().fetchSocial(soc.baseName()+" <T-NAME>", true);
if(TargetSomeoneSoc!=null)
{
TargetSomeoneNoTarget = TargetSomeoneSoc.See_when_no_target();
TargetSomeoneYouSee = TargetSomeoneSoc.You_see();
TargetSomeoneOthersSee = TargetSomeoneSoc.Third_party_sees();
TargetSomeoneTargetSees=TargetSomeoneSoc.Target_sees();
}
else
{
TargetSomeoneNoTarget = "";
TargetSomeoneYouSee = "";
TargetSomeoneOthersSee = "";
TargetSomeoneTargetSees= "";
}
final Social TargetSelfSoc = CMLib.socials().fetchSocial(soc.baseName()+" SELF", true);
if(TargetSelfSoc!=null)
{
TargetSelfYouSee = TargetSelfSoc.You_see();
TargetSelfOthersSee = TargetSelfSoc.Third_party_sees();
}
else
{
TargetSelfYouSee = "";
TargetSelfOthersSee = "";
}
buf.append("{{SocialTemplate"
+ "|Name="+CMStrings.capitalizeAndLower(soc.baseName())
+ "|TargetNoneUSee="+TargetNoneYouSee
+ "|TargetNoneTheySee="+TargetNoneOthersSee
+ "|TargetSomeoneNoTarget="+TargetSomeoneNoTarget
+ "|TargetSomeoneUSee="+TargetSomeoneYouSee
+ "|TargetSomeoneTargetSees="+TargetSomeoneTargetSees
+ "|TargetSomeoneOthersSee="+TargetSomeoneOthersSee
+ "|TargetSelfUSee="+TargetSelfYouSee
+ "|TargetSelfOthersSee="+TargetSelfOthersSee
+ "}}\n\r");
}
else
{
buf.append(CMStrings.padRight(social,COL_LEN)+" ");
col++;
if(col==4)
{
col=0;
buf.append("\n\r");
}
}
}
if(buf.length()==0)
return "None defined.";
return buf.toString();
} |
22815d77-cd8f-43ee-8f0b-2d832afdf038 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
answersGroup = new javax.swing.ButtonGroup();
mainPanel = new javax.swing.JPanel();
eventsPanel = new javax.swing.JPanel();
eventsLabel = new javax.swing.JLabel();
czajowniaButton = new javax.swing.JButton();
renomaButton = new javax.swing.JButton();
odZmierzchuDoŚwituButton = new javax.swing.JButton();
galeriaDominikańskaButton = new javax.swing.JButton();
magnoliaButton = new javax.swing.JButton();
monopolRoofButton = new javax.swing.JButton();
arkadyButton = new javax.swing.JButton();
upButton = new javax.swing.JButton();
czarnyKotButton = new javax.swing.JButton();
daytonaButton = new javax.swing.JButton();
teatrWspolczesnyButton = new javax.swing.JButton();
gafaButton = new javax.swing.JButton();
polishTheatreButton = new javax.swing.JButton();
sombreroButton = new javax.swing.JButton();
teatrKomediaButton = new javax.swing.JButton();
aquaparkButton = new javax.swing.JButton();
casaDeLaMusicaButton = new javax.swing.JButton();
gliniankiButton = new javax.swing.JButton();
puzzleButton = new javax.swing.JButton();
wroclawskieCentrumSpaButton = new javax.swing.JButton();
stadionMiejski_soccerButton = new javax.swing.JButton();
halaOrbita_basketballButton = new javax.swing.JButton();
stadionMiejski_speedwayButton = new javax.swing.JButton();
mundoButton = new javax.swing.JButton();
stadionMiejski_footballButton = new javax.swing.JButton();
zooButton = new javax.swing.JButton();
padBarButton = new javax.swing.JButton();
capitolButton = new javax.swing.JButton();
kasynoOlimpiqueButton = new javax.swing.JButton();
sushi77Button = new javax.swing.JButton();
chaczapuriButton = new javax.swing.JButton();
amalfiButton = new javax.swing.JButton();
capriPizzaButton = new javax.swing.JButton();
rodeoBarButton = new javax.swing.JButton();
hastaLaVistaButton = new javax.swing.JButton();
sportwerkButton = new javax.swing.JButton();
fugaMundiButton = new javax.swing.JButton();
sezamButton = new javax.swing.JButton();
skyBowlingButton = new javax.swing.JButton();
mirazBowlingButton = new javax.swing.JButton();
creatorBowlingButton = new javax.swing.JButton();
skyTowerFitnessButton = new javax.swing.JButton();
classicFitnessButton = new javax.swing.JButton();
pureJatomiFitnessRenoma = new javax.swing.JButton();
pureJatomiFitnessPasazGrunwaldzkiButton = new javax.swing.JButton();
questionPanel = new javax.swing.JPanel();
questionTitleLabel = new javax.swing.JLabel();
questionNumberLabel = new javax.swing.JLabel();
questionLabel = new javax.swing.JLabel();
answersPanel = new javax.swing.JPanel();
answersLabel = new javax.swing.JLabel();
radioButton1 = new javax.swing.JRadioButton();
radioButton2 = new javax.swing.JRadioButton();
radioButton3 = new javax.swing.JRadioButton();
radioButton4 = new javax.swing.JRadioButton();
radioButton5 = new javax.swing.JRadioButton();
radioButton6 = new javax.swing.JRadioButton();
radioButton7 = new javax.swing.JRadioButton();
radioButton8 = new javax.swing.JRadioButton();
radioButton9 = new javax.swing.JRadioButton();
radioButton10 = new javax.swing.JRadioButton();
radioButton11 = new javax.swing.JRadioButton();
radioButton12 = new javax.swing.JRadioButton();
radioButton13 = new javax.swing.JRadioButton();
radioButton14 = new javax.swing.JRadioButton();
nextQuestionButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Wroclove Event Expert");
setForeground(java.awt.Color.lightGray);
setLocation(new java.awt.Point(100, 100));
setMaximumSize(new java.awt.Dimension(1100, 600));
setName("Wroclove Event Expert"); // NOI18N
setPreferredSize(new java.awt.Dimension(1050, 700));
setResizable(false);
setSize(new java.awt.Dimension(1050, 700));
mainPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
mainPanel.setMaximumSize(new java.awt.Dimension(1000, 600));
mainPanel.setPreferredSize(new java.awt.Dimension(1000, 600));
mainPanel.setSize(new java.awt.Dimension(1000, 600));
eventsPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
eventsLabel.setText("Events");
czajowniaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
czajowniaButton.setText("Czajownia");
czajowniaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
czajowniaButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
czajowniaButtonActionPerformed(evt);
}
});
renomaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
renomaButton.setText("Renoma");
renomaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
odZmierzchuDoŚwituButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
odZmierzchuDoŚwituButton.setText("Od Zmierzchu do Świtu");
odZmierzchuDoŚwituButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
galeriaDominikańskaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
galeriaDominikańskaButton.setText("Dominikańska Gallery");
galeriaDominikańskaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
magnoliaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
magnoliaButton.setText("Magnolia Park");
magnoliaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
monopolRoofButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
monopolRoofButton.setText("Monopol's Roof");
monopolRoofButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
arkadyButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
arkadyButton.setText("Arkady");
arkadyButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
upButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
upButton.setText("Up");
upButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
czarnyKotButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
czarnyKotButton.setText("Czarny Kot");
czarnyKotButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
daytonaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
daytonaButton.setText("Daytona");
daytonaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
daytonaButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
daytonaButtonActionPerformed(evt);
}
});
teatrWspolczesnyButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
teatrWspolczesnyButton.setText("Modern Theatre");
teatrWspolczesnyButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
gafaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
gafaButton.setText("Gafa");
gafaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
polishTheatreButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
polishTheatreButton.setText("Polish Theatre");
polishTheatreButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
sombreroButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
sombreroButton.setText("Sombrero");
sombreroButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
teatrKomediaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
teatrKomediaButton.setText("Comedy Theatre");
teatrKomediaButton.setActionCommand("");
teatrKomediaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
aquaparkButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
aquaparkButton.setText("Aquapark");
aquaparkButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
casaDeLaMusicaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
casaDeLaMusicaButton.setText("Casa De La Musica");
casaDeLaMusicaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
gliniankiButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
gliniankiButton.setText("Glinianki");
gliniankiButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
puzzleButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
puzzleButton.setText("Puzzle");
puzzleButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
wroclawskieCentrumSpaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
wroclawskieCentrumSpaButton.setText("SPA Center");
wroclawskieCentrumSpaButton.setToolTipText("");
wroclawskieCentrumSpaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
stadionMiejski_soccerButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
stadionMiejski_soccerButton.setText("City's Stadium (soccer)");
stadionMiejski_soccerButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
halaOrbita_basketballButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
halaOrbita_basketballButton.setText("Orbit's Hall");
halaOrbita_basketballButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
stadionMiejski_speedwayButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
stadionMiejski_speedwayButton.setText("City's Stadium (speedway)");
stadionMiejski_speedwayButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
mundoButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
mundoButton.setText("Mundo71");
mundoButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
mundoButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mundoButtonActionPerformed(evt);
}
});
stadionMiejski_footballButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
stadionMiejski_footballButton.setText("City's Stadium (football)");
stadionMiejski_footballButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
zooButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
zooButton.setText("Zoo");
zooButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
padBarButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
padBarButton.setText("Pad Bar");
padBarButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
capitolButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
capitolButton.setText("Capitol Theatre");
capitolButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
kasynoOlimpiqueButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
kasynoOlimpiqueButton.setText("Casino Olimpique");
kasynoOlimpiqueButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
sushi77Button.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
sushi77Button.setText("Sushi77");
sushi77Button.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
chaczapuriButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
chaczapuriButton.setText("Chaczapuri");
chaczapuriButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
amalfiButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
amalfiButton.setText("Amalfi");
amalfiButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
capriPizzaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
capriPizzaButton.setText("Capri Pizza");
capriPizzaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
rodeoBarButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
rodeoBarButton.setText("Rodeo Bar");
rodeoBarButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
hastaLaVistaButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
hastaLaVistaButton.setText("Hasta La Vista");
hastaLaVistaButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
sportwerkButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
sportwerkButton.setText("Sportwerk");
sportwerkButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
fugaMundiButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
fugaMundiButton.setText("Fuga Mundi");
fugaMundiButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
sezamButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
sezamButton.setText("Sezam");
sezamButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
skyBowlingButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
skyBowlingButton.setText("SkyBowling");
skyBowlingButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
mirazBowlingButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
mirazBowlingButton.setText("Miraż Bowling");
mirazBowlingButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
creatorBowlingButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
creatorBowlingButton.setText("Creator Bowling");
creatorBowlingButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
skyTowerFitnessButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
skyTowerFitnessButton.setText("Sky Tower Fitness");
skyTowerFitnessButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
classicFitnessButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
classicFitnessButton.setText("Classic Fitness");
classicFitnessButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
pureJatomiFitnessRenoma.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
pureJatomiFitnessRenoma.setText("Pure Jatomi Fitness Renoma");
pureJatomiFitnessRenoma.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
pureJatomiFitnessPasazGrunwaldzkiButton.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
pureJatomiFitnessPasazGrunwaldzkiButton.setText("Pure Jatomi Fitness Pasaż Grunwaldzki");
pureJatomiFitnessPasazGrunwaldzkiButton.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "0%"));
javax.swing.GroupLayout eventsPanelLayout = new javax.swing.GroupLayout(eventsPanel);
eventsPanel.setLayout(eventsPanelLayout);
eventsPanelLayout.setHorizontalGroup(
eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(eventsPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addComponent(monopolRoofButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(arkadyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(upButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(czarnyKotButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(daytonaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addComponent(teatrWspolczesnyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(gafaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(polishTheatreButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sombreroButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(teatrKomediaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addComponent(aquaparkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(casaDeLaMusicaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(gliniankiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(puzzleButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(wroclawskieCentrumSpaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addComponent(stadionMiejski_soccerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(halaOrbita_basketballButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stadionMiejski_speedwayButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mundoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stadionMiejski_footballButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addComponent(zooButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(padBarButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(capitolButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(kasynoOlimpiqueButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sushi77Button, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, eventsPanelLayout.createSequentialGroup()
.addComponent(creatorBowlingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(skyTowerFitnessButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(classicFitnessButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pureJatomiFitnessRenoma, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pureJatomiFitnessPasazGrunwaldzkiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(eventsPanelLayout.createSequentialGroup()
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(eventsLabel)
.addGroup(eventsPanelLayout.createSequentialGroup()
.addComponent(czajowniaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(renomaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(odZmierzchuDoŚwituButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(galeriaDominikańskaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(magnoliaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(eventsPanelLayout.createSequentialGroup()
.addComponent(chaczapuriButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(amalfiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(capriPizzaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rodeoBarButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hastaLaVistaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(eventsPanelLayout.createSequentialGroup()
.addComponent(sportwerkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(fugaMundiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sezamButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(skyBowlingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mirazBowlingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
eventsPanelLayout.setVerticalGroup(
eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(eventsPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(eventsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(czajowniaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(renomaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(odZmierzchuDoŚwituButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(galeriaDominikańskaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(magnoliaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(monopolRoofButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(arkadyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(upButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(czarnyKotButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(daytonaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(teatrWspolczesnyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(gafaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(polishTheatreButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sombreroButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(teatrKomediaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(aquaparkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(casaDeLaMusicaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(gliniankiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(puzzleButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(wroclawskieCentrumSpaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(stadionMiejski_soccerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(halaOrbita_basketballButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(stadionMiejski_speedwayButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(mundoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(stadionMiejski_footballButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(zooButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(padBarButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(capitolButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(kasynoOlimpiqueButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sushi77Button, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(chaczapuriButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(amalfiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(capriPizzaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rodeoBarButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hastaLaVistaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(sportwerkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fugaMundiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sezamButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(skyBowlingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(mirazBowlingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(creatorBowlingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(skyTowerFitnessButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(classicFitnessButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pureJatomiFitnessRenoma, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pureJatomiFitnessPasazGrunwaldzkiButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(154, Short.MAX_VALUE))
);
questionPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
questionTitleLabel.setText("Question");
questionNumberLabel.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
questionNumberLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
questionNumberLabel.setText("1");
questionLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
questionLabel.setText("How are you feeling today?");
javax.swing.GroupLayout questionPanelLayout = new javax.swing.GroupLayout(questionPanel);
questionPanel.setLayout(questionPanelLayout);
questionPanelLayout.setHorizontalGroup(
questionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(questionPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(questionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(questionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE)
.addGroup(questionPanelLayout.createSequentialGroup()
.addComponent(questionTitleLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(questionNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
questionPanelLayout.setVerticalGroup(
questionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(questionPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(questionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(questionNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(questionTitleLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(questionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
.addContainerGap())
);
answersPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
answersLabel.setText("Answers");
answersGroup.add(radioButton1);
radioButton1.setText("jRadioButton1");
radioButton1.setActionCommand("radioButton1");
answersGroup.add(radioButton2);
radioButton2.setText("jRadioButton2");
radioButton2.setActionCommand("radioButton2");
answersGroup.add(radioButton3);
radioButton3.setText("jRadioButton3");
radioButton3.setActionCommand("radioButton3");
answersGroup.add(radioButton4);
radioButton4.setText("jRadioButton13");
radioButton4.setActionCommand("radioButton4");
answersGroup.add(radioButton5);
radioButton5.setText("jRadioButton14");
radioButton5.setActionCommand("radioButton5");
answersGroup.add(radioButton6);
radioButton6.setText("jRadioButton15");
radioButton6.setActionCommand("radioButton6");
answersGroup.add(radioButton7);
radioButton7.setText("jRadioButton16");
radioButton7.setActionCommand("radioButton7");
answersGroup.add(radioButton8);
radioButton8.setText("jRadioButton17");
radioButton8.setActionCommand("radioButton8");
answersGroup.add(radioButton9);
radioButton9.setText("jRadioButton18");
radioButton9.setActionCommand("radioButton9");
answersGroup.add(radioButton10);
radioButton10.setText("jRadioButton19");
radioButton10.setActionCommand("radioButton10");
answersGroup.add(radioButton11);
radioButton11.setText("jRadioButton20");
radioButton11.setActionCommand("radioButton11");
answersGroup.add(radioButton12);
radioButton12.setText("jRadioButton21");
radioButton12.setActionCommand("radioButton12");
answersGroup.add(radioButton13);
radioButton13.setText("jRadioButton22");
radioButton13.setActionCommand("radioButton13");
answersGroup.add(radioButton14);
radioButton14.setText("jRadioButton23");
radioButton14.setActionCommand("radioButton14");
nextQuestionButton.setText("Next question");
nextQuestionButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nextQuestionButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout answersPanelLayout = new javax.swing.GroupLayout(answersPanel);
answersPanel.setLayout(answersPanelLayout);
answersPanelLayout.setHorizontalGroup(
answersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(answersPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(answersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(answersPanelLayout.createSequentialGroup()
.addGroup(answersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(radioButton8)
.addComponent(radioButton9)
.addComponent(radioButton7)
.addComponent(radioButton6)
.addComponent(radioButton5)
.addComponent(radioButton4)
.addComponent(radioButton3)
.addComponent(radioButton2)
.addComponent(answersLabel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(answersPanelLayout.createSequentialGroup()
.addGroup(answersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(radioButton10)
.addComponent(radioButton11)
.addComponent(radioButton1)
.addComponent(radioButton12)
.addComponent(radioButton13)
.addComponent(radioButton14))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, answersPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nextQuestionButton, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
answersPanelLayout.setVerticalGroup(
answersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(answersPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(answersLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButton14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nextQuestionButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(answersPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(questionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(eventsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(questionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(answersPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(eventsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addGap(6, 6, 6))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 1051, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 700, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents |
6b0e00c0-efda-4586-8157-165e8abd5340 | 5 | public boolean canJump(int[] A) {
int[] minJump = new int[A.length];
Arrays.fill(minJump, Integer.MAX_VALUE);
minJump[0] = 0;
int currentMax = 0;
for (int i = 0; i < A.length; i++) {
if (minJump[i] == Integer.MAX_VALUE)
break;
for (int j = currentMax + 1; j <= i + A[i]; j++) {
if (j > A.length - 1)
break;
minJump[j] = Math.min(minJump[j], minJump[i] + 1);
}
if (i + A[i] > currentMax)
currentMax = i + A[i];
}
return minJump[A.length - 1] != Integer.MAX_VALUE;
} |
1ff1c6ab-dbe0-4afc-83ab-9333b377a230 | 6 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("SelectNoneAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c instanceof OutlineLineNumber) {
textArea = ((OutlineLineNumber) c).renderer;
} else if (c instanceof OutlineCommentIndicator) {
textArea = ((OutlineCommentIndicator) c).renderer;
} else if (c instanceof OutlinerCellRendererImpl) {
textArea = (OutlinerCellRendererImpl) c;
isIconFocused = false;
}
// Shorthand
Node node = textArea.node;
JoeTree tree = node.getTree();
OutlineLayoutManager layout = tree.getDocument().panel.layout;
//System.out.println(e.getModifiers());
switch (e.getModifiers()) {
case 2:
if (isIconFocused) {
selectNone(node, tree, layout);
} else {
selectNoneText(textArea, tree, layout);
}
break;
}
} |
ba847b0e-a45a-4398-8409-6d8ff5c4bc45 | 4 | int getRoomFitness(RoomScheme r){
int roomFitness = maxFitness(r);
for (Subject[] room : r.rooms) {
for (Subject room1 : room) {
if (room1.getCode() == 0) roomFitness --;
if (classCount(r, room1.getCode()) > 2) roomFitness --;
}
} return roomFitness;
} |
1d2ea7fb-f28b-4157-a13e-9a2b2a487745 | 2 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int length = in.nextInt();
int testCases = in.nextInt();
int[] laneWidth = new int[length];
for (int i = 0; i < length; i++) {
laneWidth[i] = in.nextInt();
}
while (testCases > 0) {
System.out.println(serLane(laneWidth, in.nextInt(), in.nextInt()));
testCases--;
}
} |
1fe6c196-b698-45b3-9889-5366e66831a5 | 9 | public static void newMap() {
Writer writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(MazeMaker.mapName), "utf-8"));
for(int y = 0; y < MazeMaker.gridSize; y++) {
for(int x = 0; x < MazeMaker.gridSize; x++) {
if(MazeMaker.border == true && (y == 0 || y == MazeMaker.gridSize-1 || x == 0 || x == MazeMaker.gridSize-1)) {
writer.write("w");
} else {
writer.write("g");
}
}
writer.write("\n");
}
} catch (IOException e){
e.printStackTrace();
} finally {
try {
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} |
f74c5d26-c69b-44b6-b2f7-4853d47404b9 | 3 | public Matrix4f initIdentity() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
int entry;
if (i == j) {
entry = 1;
} else {
entry = 0;
}
m[i][j] = entry;
}
}
return this;
} |
1d6f84f6-db40-4729-b850-b7130af72012 | 1 | private void notifyListeners()
{
for (PriceListener listener : listeners)
listener.onPriceChanged(price);
} |
4fc3cd4c-83a0-4b9b-bb8f-7677404aae85 | 6 | public SoundPlayer() {
try {
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
} catch (SoundSystemException ex) {
oggPlaybackSupport = false;
}
try {
SoundSystemConfig.setCodec("wav", CodecWav.class);
} catch (SoundSystemException ex) {
wavPlaybackSupport = false;
}
boolean isOPenAL = Options.getAsBoolean(Options.OPEN_AL, Options.VALUE_TRUE);
if (isOPenAL) {
boolean aLCompatible = SoundSystem.libraryCompatible(LibraryLWJGLOpenAL.class);
if (aLCompatible) {
libraryType = LibraryLWJGLOpenAL.class; // OpenAL
} else {
libraryType = LibraryJavaSound.class; // Java Sound
}
} else {
libraryType = LibraryJavaSound.class; // Java Sound
}
try {
setSoundSystem(new SoundSystem(libraryType));
} catch (SoundSystemException ex) {
setSoundSystem(null);
}
if (getSoundSystem() != null) {
getSoundSystem().setMasterVolume(volume);
getSoundSystem().setVolume(BACKGROUND_TRACK, musicVolume);
}
} |
f3956e4b-c307-417e-9585-34377267f2bd | 5 | private static void simulateMove(Robot r, int x2, int y2) throws InterruptedException {
int x1 = MouseInfo.getPointerInfo().getLocation().x, y1 = MouseInfo.getPointerInfo().getLocation().y;
long starttime = System.currentTimeMillis();
while (Math.abs(x1 - x2) > 5 || Math.abs(y1 - y2) > 5) {
if (System.currentTimeMillis() - starttime > 11000) { //11 second timeout
System.out.println("Timeout on Mouse-Click.");
break;
}
if (x1 > x2)
x1 -= (int)(Math.random() * 5);
else
x1 += (int)(Math.random() * 5);
if (y1 > y2)
y1 -= (int)(Math.random() * 5);
else
y1 += (int)(Math.random() * 5);
r.mouseMove(x1, y1);
Thread.sleep(10);
x1 = MouseInfo.getPointerInfo().getLocation().x;
y1 = MouseInfo.getPointerInfo().getLocation().y;
}
r.mouseMove(x2, y2);
} |
d17e29c2-f3f5-4901-9cb5-038343c1fa2f | 1 | private int startY( Side side ){
if( side == Side.SOUTH ){
return boundaries.y + boundaries.height;
}
else{
return boundaries.y;
}
} |
76f5d57a-f9aa-46df-a56e-c94b1cf6f0ff | 1 | public static String stripTrailingBlanks(final String string) {
//// Preconditons
if (string == null)
throw new InvalidParameterException("string cannot be null");
return stripTrailing(string, ' ');
} |
478e0520-6674-4152-9a37-6776d5042d90 | 1 | protected void drawState(Graphics g, State state) {
statedrawer.drawState(g, getAutomaton(), state);
if (drawLabels) {
statedrawer.drawStateLabel(g, state, state.getPoint(),
StateDrawer.STATE_COLOR);
}
} |
b6d436ac-8edf-4a81-bcd4-32964bae3fb3 | 1 | private void processMoveFromHand(MouseEvent e) {
List<Card> hand = game.getHand().getList();
if (hand.size() > 0) {
final double handXGap = handXGap(hand.size());
int index = (int) ((e.getX() - handXStart()) / (handXGap + CARD_WIDTH));
activeMove = new CardMoveImpl(index, CardMoveImpl.MOVE_TYPE_FROM.FROM_HAND);
}
} |
33b158c6-1b5c-40ef-a48a-de6c18e5c08a | 7 | public void cleanNotWin(){
boolean win = false;
//Controllo se c'è una mossa che mi fa vincere
for(int i=0;i<desmosse.length;i++)
if(desmosse[i]!=null)
if(desmosse[i].isWinner()){
win = true;
break;
}
System.out.println("Variabile che controlla se ci sono vincite: "+win);
//Se c'è una mossa che mi fa vincere cancello le altre
if(win)
for(int i=0;i<desmosse.length;i++)
if(desmosse[i]!=null)
if(!desmosse[i].isWinner())
desmosse[i]=null;
} |
6c80c578-b7b9-482a-9943-8ab26bb470ef | 9 | public Behaviour jobFor(Actor actor) {
if ((! structure.intact()) || (! personnel.onShift(actor))) return null ;
final Choice choice = new Choice(actor) ;
//
// Return a hunting expedition. And... just explore the place. You'll
// want to make this a bit more nuanced later.
if (still != null && ! still.destroyed()) {
final Delivery d = Deliveries.nextDeliveryFor(
actor, still, still.services(), 5, world
) ;
choice.add(d) ;
final Actor p = Hunting.nextPreyFor(actor, true) ;
if (p != null) {
final Hunting h = Hunting.asProcess(actor, p, still) ;
choice.add(h) ;
}
}
final Tile t = Exploring.getUnexplored(actor.base().intelMap, actor) ;
if (t != null) {
I.say("TILE FOUND IS: "+t) ;
final Exploring e = new Exploring(actor, actor.base(), t) ;
e.priorityMod = Plan.ROUTINE ;
choice.add(e) ;
}
//else I.say("NOTHING LEFT TO EXPLORE?") ;
if (structure.upgradeLevel(CAPTIVE_BREEDING) > 0) {
final Fauna toTend = AnimalHusbandry.nextHandled(this) ;
if (toTend != null) {
choice.add(new AnimalHusbandry(actor, this, toTend)) ;
}
}
final SensorPost newPost = SensorPost.locateNewPost(this) ;
if (newPost != null) {
final Action collects = new Action(
actor, newPost,
this, "actionCollectSensor",
Action.REACH_DOWN, "Collecting sensor"
) ;
collects.setMoveTarget(this) ;
final Action plants = new Action(
actor, newPost.origin(),
this, "actionPlantSensor",
Action.REACH_DOWN, "Planting sensor"
) ;
plants.setMoveTarget(Spacing.pickFreeTileAround(newPost, actor)) ;
choice.add(new Steps(actor, this, Plan.ROUTINE, collects, plants)) ;
}
return choice.weightedPick() ;
} |
0224d046-e38a-40a2-88d9-d465c1173a28 | 8 | public RelativeCombinedStream(final ArchiveDataStream[] streamsToCombine, ArchiveDataSpecification spec) {
// Siehe de.bsvrz.ars.ars.mgmt.tasks.ArchiveQueryTask.Query.maxInterval
long maxSize = Math.min(spec.getTimeSpec().getIntervalStart(), 16000);
// Erstmal alle Stream wie gewohnt verketten
ArchiveDataStream parent = new CombinedStream(streamsToCombine, spec);
// dann alle Datensätze nacheinander in den (begrenzten) Puffer schieben
// sodass am Schluss nur die aktuellsten Datensätze übrig bleiben
_spec = spec;
_buffer = new ArrayDeque<ArchiveData>();
try {
ArchiveData aData;
int currentDataSets = 0;
while((aData = parent.take()) != null){
_buffer.addLast(aData);
if(shouldCount(aData)){
currentDataSets++;
}
while(currentDataSets > maxSize){
ArchiveData first = _buffer.removeFirst();
if(shouldCount(first)){
currentDataSets--;
}
while(_buffer.peekFirst() != null && _buffer.peekFirst().getDataType() == DataState.POSSIBLE_GAP){
// Potentielle Lücken am Anfang trimmen
first = _buffer.removeFirst();
if(shouldCount(first)){
currentDataSets--;
}
}
}
}
}
catch(Exception e) {
_exception = e;
}
} |
fcd9998d-ce1f-4019-baea-dcb0ce187757 | 1 | public void update() {
if (active){
vy+=Player.ACCELERATION/Level.speed();
vx=(float) Math.max(Math.min(12, vx), -12);
vy=Math.max(Math.min(7/Level.speed(), vy), -7/Level.speed());
vx*=Math.pow(.9,1/Level.speed());
x+=vx;
y+=vy;
}
} |
542688dd-cf9c-490c-a213-4e0f4fe72620 | 4 | private Declaration declaration() throws RequiredTokenException
{
enterRule(NonTerminal.DECLARATION);
Declaration declaration = null;
try
{
if(firstSetSatisfied(NonTerminal.VARIABLE_DECLARATION))
declaration = variable_declaration();
else if(firstSetSatisfied(NonTerminal.ARRAY_DECLARATION))
declaration = array_declaration();
else if(firstSetSatisfied(NonTerminal.FUNCTION_DEFINITION))
declaration = function_definition();
else
{
declaration = new Error(
reader.token().getLineNumber(),
reader.token().getCharPos(),
String.format("First sets unsatisfied by token of kind \"%s\".", reader.token().getKind()));
}
}
catch(SymbolRedefinitionException e)
{
declaration = new Error(
e.DuplicateToken.getLineNumber(),
e.DuplicateToken.getCharPos(),
String.format("Attempted to redefine symbol \"%s\".", e.DuplicateToken.getLexeme()));
}
exitRule();
return declaration;
} |
01d5ff66-9502-4b0a-a4d8-75954afcdb32 | 3 | public boolean isLastRow(boolean isWhite) {
return (isWhite && this.rank == '8') || (!isWhite && this.rank == '1');
} |
25dfe8d8-37a6-4537-be0f-99f18502545b | 1 | protected void fireChangedMostRecentDocumentTouchedEvent(Document doc) {
changedMostRecentDocumentTouchedEvent.setDocument(doc);
for (int i = 0, limit = documentRepositoryListeners.size(); i < limit; i++) {
((DocumentRepositoryListener) documentRepositoryListeners.get(i)).changedMostRecentDocumentTouched(changedMostRecentDocumentTouchedEvent);
}
// Cleanup
changedMostRecentDocumentTouchedEvent.setDocument(null);
} |
5f37894b-e610-4fd7-8dea-49a4dd5802ad | 0 | static void changeLevel(Tank t) {
t.level = 55;
} |
6392899e-15f3-46ef-b598-a429acce3619 | 7 | @SuppressWarnings({ "unchecked", "rawtypes" })
public RoomBooking() {
setBackground(UIManager.getColor("CheckBoxMenuItem.selectionBackground"));
setForeground(Color.WHITE);
setFont(new Font("Cordia New", Font.BOLD, 14));
setTitle("Conference Room Booking System");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
SpringLayout sl_contentPane = new SpringLayout();
sl_contentPane.putConstraint(SpringLayout.EAST, dateChooser, -153, SpringLayout.EAST, contentPane);
sl_contentPane.putConstraint(SpringLayout.WEST, timelist, 15, SpringLayout.WEST, contentPane);
sl_contentPane.putConstraint(SpringLayout.EAST, timelist, -277, SpringLayout.EAST, contentPane);
sl_contentPane.putConstraint(SpringLayout.NORTH, dateChooser, 10, SpringLayout.NORTH, contentPane);
sl_contentPane.putConstraint(SpringLayout.NORTH, timelist, 72, SpringLayout.NORTH, contentPane);
contentPane.setLayout(sl_contentPane);
JLabel lblSelectTheDate = new JLabel("Select the Date");
sl_contentPane.putConstraint(SpringLayout.WEST, dateChooser, 12, SpringLayout.EAST, lblSelectTheDate);
sl_contentPane.putConstraint(SpringLayout.SOUTH, lblSelectTheDate, 0, SpringLayout.SOUTH, dateChooser);
sl_contentPane.putConstraint(SpringLayout.NORTH, lblSelectTheDate, 0, SpringLayout.NORTH, dateChooser);
sl_contentPane.putConstraint(SpringLayout.EAST, lblSelectTheDate, -292, SpringLayout.EAST, contentPane);
contentPane.add(lblSelectTheDate);
dateChooser.setDate(sysdate);
contentPane.add(dateChooser);
JLabel lblSelectTheTime = new JLabel("Select the Time");
sl_contentPane.putConstraint(SpringLayout.NORTH, lblSelectTheTime, 15, SpringLayout.SOUTH, lblSelectTheDate);
sl_contentPane.putConstraint(SpringLayout.SOUTH, lblSelectTheTime, -13, SpringLayout.NORTH, timelist);
sl_contentPane.putConstraint(SpringLayout.WEST, lblSelectTheDate, 0, SpringLayout.WEST, lblSelectTheTime);
sl_contentPane.putConstraint(SpringLayout.WEST, lblSelectTheTime, 10, SpringLayout.WEST, contentPane);
contentPane.add(lblSelectTheTime);
JButton btnBook = new JButton("Book");
sl_contentPane.putConstraint(SpringLayout.WEST, btnBook, 65, SpringLayout.EAST, timelist);
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnBook, -101, SpringLayout.SOUTH, contentPane);
sl_contentPane.putConstraint(SpringLayout.EAST, btnBook, -70, SpringLayout.EAST, contentPane);
btnBook.setFont(new Font("Tahoma", Font.BOLD, 11));
btnBook.addActionListener(new ActionListener() {// book button actions
public void actionPerformed(ActionEvent arg0) {
Date date =dateChooser.getDate(); //get the date from datechooser
int timeslot = Integer.valueOf(timelist.getSelectedValue().toString().substring(0, 1));// get the time from the list
Booking newBooking = new Booking();
String uname =Login.myUser.getUserName();//get the logged user
newBooking.setName(uname);
newBooking.setDate(date);
newBooking.setTime(timeslot);
try {
newBooking.AddBooking();//call the method from booking class
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
contentPane.add(btnBook);
JButton btnExit = new JButton("Exit");
sl_contentPane.putConstraint(SpringLayout.WEST, btnExit, 65, SpringLayout.EAST, timelist);
sl_contentPane.putConstraint(SpringLayout.EAST, btnExit, -70, SpringLayout.EAST, contentPane);
sl_contentPane.putConstraint(SpringLayout.SOUTH, timelist, 0, SpringLayout.SOUTH, btnExit);
sl_contentPane.putConstraint(SpringLayout.NORTH, btnExit, 195, SpringLayout.NORTH, contentPane);
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnExit, -23, SpringLayout.SOUTH, contentPane);
btnExit.setFont(new Font("Tahoma", Font.BOLD, 11));
btnExit.addActionListener(new ActionListener() {//exit button actions
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
contentPane.add(btnExit);
contentPane.add(timelist);
JButton btnViewAvailable = new JButton("View Availables");
sl_contentPane.putConstraint(SpringLayout.EAST, lblSelectTheTime, -98, SpringLayout.WEST, btnViewAvailable);
sl_contentPane.putConstraint(SpringLayout.WEST, btnViewAvailable, 0, SpringLayout.WEST, btnBook);
sl_contentPane.putConstraint(SpringLayout.EAST, btnViewAvailable, -70, SpringLayout.EAST, contentPane);
sl_contentPane.putConstraint(SpringLayout.NORTH, btnViewAvailable, 15, SpringLayout.SOUTH, dateChooser);
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnViewAvailable, -174, SpringLayout.SOUTH, contentPane);
btnViewAvailable.addActionListener(new ActionListener() {//viewavailable button actions
public void actionPerformed(ActionEvent e) {
String times;
try {
times = actions.getAvailableTimes(dateChooser.getDate());//call the method by date and assign to a string variable
//System.out.println(times.toString());
listModel.clear();
String[] available = times.split(",");//split the string
int j=0;
for (String s:available){
listModel.add(j,s.toString()); //add values to list
j=j++;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnViewAvailable.setFont(new Font("Tahoma", Font.BOLD, 11));
contentPane.add(btnViewAvailable);
JButton btnViewBooked = new JButton("View Booked");
sl_contentPane.putConstraint(SpringLayout.NORTH, btnViewBooked, 1, SpringLayout.SOUTH, btnViewAvailable);
sl_contentPane.putConstraint(SpringLayout.WEST, btnViewBooked, 65, SpringLayout.EAST, timelist);
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnViewBooked, -139, SpringLayout.SOUTH, contentPane);
sl_contentPane.putConstraint(SpringLayout.EAST, btnViewBooked, -70, SpringLayout.EAST, contentPane);
sl_contentPane.putConstraint(SpringLayout.NORTH, btnBook, 6, SpringLayout.SOUTH, btnViewBooked);
btnViewBooked.addActionListener(new ActionListener() {//viewbooked button actions to get the booked time slots
public void actionPerformed(ActionEvent e) {
String bookings;
try {
bookings = actions.getBookedTimes(dateChooser.getDate());
//System.out.println(bookings.toString());
listModel.clear();
String[] booked = bookings.split(",");
int j=0;
for (String s:booked){
listModel.add(j,s.toString()); // add them to the list
j=j++;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnViewBooked.setFont(new Font("Tahoma", Font.BOLD, 11));
contentPane.add(btnViewBooked);
JButton btnDeleteBooking = new JButton("Delete Booking");
sl_contentPane.putConstraint(SpringLayout.WEST, btnDeleteBooking, 65, SpringLayout.EAST, timelist);
sl_contentPane.putConstraint(SpringLayout.EAST, btnDeleteBooking, -70, SpringLayout.EAST, contentPane);
btnDeleteBooking.addActionListener(new ActionListener() {//deletebooking button actions
public void actionPerformed(ActionEvent e) {
String name = Login.myUser.getUserName();
Date date = dateChooser.getDate();
int time = Integer.valueOf(timelist.getSelectedValue().toString().substring(0, 1));//select the time from list
int endIndex = timelist.getSelectedValue().toString().lastIndexOf(";");
String bookingUser=timelist.getSelectedValue().toString().substring(2, endIndex);//get the booking user
try {
if(name.equals(bookingUser)){// check if the booking is belong to the logged user
actions.deleteBooking( name,date,time);// call the method to delete
}
else{//if not error message
Component frame = null;
JOptionPane.showMessageDialog(frame,
"You do not have rights to delete this booking",
"access error",
JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnDeleteBooking.setFont(new Font("Tahoma", Font.BOLD, 11));
sl_contentPane.putConstraint(SpringLayout.NORTH, btnDeleteBooking, 44, SpringLayout.SOUTH, btnViewBooked);
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnDeleteBooking, -6, SpringLayout.NORTH, btnExit);
contentPane.add(btnDeleteBooking);
} |
76fed4c0-6ce5-468d-9f66-32492768dd06 | 6 | @Override
public void run() {
//if(initConnection()) {
while(connected && !socket.isClosed()) { //read in commands
//TODO: try/catch for badly formatted commands
Command cmd = null;
try {
String inputStr = in.readLine();
if(inputStr == null) {
System.out.println("null input");
disconnect();
break;
}
cmd = Command.parseCommand(server.getGame(), inputStr);
server.getGame().registerPlayerCommand(this, cmd);
} catch(IllegalMessageException e) {
System.out.println(e);
disconnect();
} catch(IOException ioe) {
disconnect();
} catch(NoFactoryFoundException e) {
}
}
//}
System.out.println("client done");
disconnect();
synchronized(this) { notify(); }
} |
d854f1f5-10d5-407b-ad46-5461cad48199 | 0 | public static void main(String[] args) throws IOException, ClassNotFoundException {
System.out.println("Creating objects: ");
Blip3 b3 = new Blip3("String ", 47);
System.out.println(b3);
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("Blip3.out"));
System.out.println("Saving object: ");
out.writeObject(b3);
out.close();
b3 = null;
ObjectInput in = new ObjectInputStream(new FileInputStream("Blip3.out"));
System.out.println("Restoring object: ");
Blip3 b4 = (Blip3)in.readObject();
System.out.println(b4);
} |
010c75f5-845c-4006-8534-374067753d73 | 6 | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Object instantiate( ObjectBinder context, Object value, Type targetType, Class targetClass )
{
if( value instanceof Map && targetClass == User.class )
{
Map<String, ?> map = (Map<String, ?>) value;
User u = new User();
u.name = stringVal( map.get( "username" ) );
u.mail = stringVal( map.get( "mail" ) );
u.friendsCount = 0;
u.bwAvailLastMonth = 0L;
u.sharedSpace = 0L;
u.sharedItems = 0L;
Map<String, ?> mapDisk = (Map<String, ?>) map.get( "disk" );
u.diskQuota = longVal( mapDisk.get( "size" ) );
u.diskQuotaAvailable = longVal( mapDisk.get( "avail" ) );
u.bwQuota = longVal( mapDisk.get( "used" ) );
return u;
}
throw context.cannotConvertValueToTargetType( value, targetClass );
} |
7cf68c9d-0fb7-411b-9adf-ac49f15245fb | 1 | public double calculateOvershootCosts(AbstractStochasticLotSizingProblem problem, double[] periodOvershoot){
AbstractLotSizingPeriod[] periods = problem.getPeriods();
double overshoot = 0.0;
double costs = 0.0;
for (int i = 0; i < periodOvershoot.length; i++){
overshoot += periodOvershoot[i];
costs += periods[i].getInventoryHoldingCost()*overshoot;
}
return costs;
} |
4c509fbf-2e1b-4173-9ef6-6af88782540d | 0 | public void flush() throws IOException
{
target.flush();
} |
fce75b3a-2b64-47e9-a3ea-d88994c058bd | 9 | private void createDragOperations(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
final Button moveButton = new Button(parent, SWT.CHECK);
moveButton.setText("DND.DROP_MOVE");
moveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (Button)e.widget;
if (b.getSelection()) {
dragOperation |= DND.DROP_MOVE;
} else {
dragOperation = dragOperation &~DND.DROP_MOVE;
if (dragOperation == 0) {
dragOperation = DND.DROP_MOVE;
moveButton.setSelection(true);
}
}
if (dragEnabled) {
createDragSource();
}
}
});
Button copyButton = new Button(parent, SWT.CHECK);
copyButton.setText("DND.DROP_COPY");
copyButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (Button)e.widget;
if (b.getSelection()) {
dragOperation |= DND.DROP_COPY;
} else {
dragOperation = dragOperation &~DND.DROP_COPY;
if (dragOperation == 0) {
dragOperation = DND.DROP_MOVE;
moveButton.setSelection(true);
}
}
if (dragEnabled) {
createDragSource();
}
}
});
Button linkButton = new Button(parent, SWT.CHECK);
linkButton.setText("DND.DROP_LINK");
linkButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (Button)e.widget;
if (b.getSelection()) {
dragOperation |= DND.DROP_LINK;
} else {
dragOperation = dragOperation &~DND.DROP_LINK;
if (dragOperation == 0) {
dragOperation = DND.DROP_MOVE;
moveButton.setSelection(true);
}
}
if (dragEnabled) {
createDragSource();
}
}
});
//initialize state
moveButton.setSelection(true);
copyButton.setSelection(true);
linkButton.setSelection(true);
dragOperation |= DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
} |
ac22350d-a8af-42fa-ba8b-6caf79dd702c | 4 | public ArrayList stepConfiguration(Configuration config) {
ArrayList list = new ArrayList();
PDAConfiguration configuration = (PDAConfiguration) config;
/** get all information from configuration. */
String unprocessedInput = configuration.getUnprocessedInput();
String totalInput = configuration.getInput();
State currentState = configuration.getCurrentState();
Transition[] transitions = myAutomaton
.getTransitionsFromState(currentState);
for (int k = 0; k < transitions.length; k++) {
PDATransition transition = (PDATransition) transitions[k];
/** get all information from transition. */
String inputToRead = transition.getInputToRead();
String stringToPop = transition.getStringToPop();
CharacterStack tempStack = configuration.getStack();
/** copy stack object so as to not alter original. */
CharacterStack stack = new CharacterStack(tempStack);
String stackContents = stack.pop(stringToPop.length());
if (unprocessedInput.startsWith(inputToRead)
&& stringToPop.equals(stackContents)) {
String input = "";
if (inputToRead.length() < unprocessedInput.length()) {
input = unprocessedInput.substring(inputToRead.length());
}
State toState = transition.getToState();
stack.push(transition.getStringToPush());
PDAConfiguration configurationToAdd = new PDAConfiguration(
toState, configuration, totalInput, input, stack, myAcceptance);
list.add(configurationToAdd);
}
}
return list;
} |
3892f1f6-1473-4e87-9a4f-daeb64b885e6 | 3 | public static float pedir_saldo_retirar(){
float retirar=0;
do{
try{
System.out.print("Saldo a retirar => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
retirar=Float.parseFloat(stdin.readLine());
if(retirar<1){
System.out.println("El saldo a retirar debe ser mayor a 0€");
}
}catch(Exception e){
System.out.println("Se espera un valor numerico "+e);
}
}while(retirar<1);
return retirar;
} |
e314ef65-4e0c-4bed-8abc-2231e3d2cb14 | 0 | public String readPassword()
{
String result = "";
result = SourceLoader.loadFile(PASSWORDFILE).trim();
return result;
} |
6c484777-7d3a-4063-a03f-c38ab49f5ee2 | 9 | public void prepareAttributes() throws XPathException {
String selectAtt = null;
String disableAtt = null;
String separatorAtt = null;
AttributeCollection atts = getAttributeList();
for (int a=0; a<atts.getLength(); a++) {
int nc = atts.getNameCode(a);
String f = getNamePool().getClarkName(nc);
if (f.equals(StandardNames.DISABLE_OUTPUT_ESCAPING)) {
disableAtt = Whitespace.trim(atts.getValue(a));
} else if (f.equals(StandardNames.SELECT)) {
selectAtt = atts.getValue(a);
} else if (f.equals(StandardNames.SEPARATOR)) {
separatorAtt = atts.getValue(a);
} else {
checkUnknownAttribute(nc);
}
}
if (selectAtt!=null) {
select = makeExpression(selectAtt);
}
if (separatorAtt != null) {
separator = makeAttributeValueTemplate(separatorAtt);
}
if (disableAtt != null) {
if (disableAtt.equals("yes")) {
disable = true;
} else if (disableAtt.equals("no")) {
disable = false;
} else {
compileError("disable-output-escaping attribute must be either 'yes' or 'no'", "XTSE0020");
}
}
} |
3cf1f1e0-c29a-4c77-9c2a-50c833bd6f99 | 5 | public static void editLine(Player p, String line) {
if (line == null) {
editLine = false;
editLineN = 0;
editLineText = null;
MessageManager.getInstance().info(p, t.get("t_disabledEditLine"));
return;
}
int l = 0;
try {
l = Integer.parseInt(line);
} catch (Exception e) {
MessageManager.getInstance().error(p, t.get("t_mostTypeNumber"));
return;
}
if (l < 1 || l > 4) {
MessageManager.getInstance().error(p, t.get("t_wrongNumber14"));
return;
}
if (editLine) {
editLine = true;
canChat = false;
editLineN = getLine(l);
MessageManager.getInstance().info(p, t.get("t_typeText"));
} else {
editLine = true;
editLineN = getLine(l);
canChat = false;
MessageManager.getInstance().info(p, t.get("t_enabledEditLine"));
MessageManager.getInstance().info(p, t.get("t_typeText"));
}
} |
cb7483fb-6fd9-49ec-9a17-ee117c29aeed | 1 | static public SolicitudCertificado instancia() {
if (UnicaInstancia == null) {
UnicaInstancia = new SolicitudCertificado();
}
return UnicaInstancia;
} |
8524c17a-1a9c-4c98-8932-3015df90a7c5 | 2 | public void copyRect(int x, int y, int w, int h, int srcX, int srcY) {
int dest = (width_ * y) + x;
int src = (width_ * srcY) + srcX;
int inc = width_;
if (y > srcY) {
src += (h - 1) * inc;
dest += (h - 1) * inc;
inc = -inc;
}
int destEnd = dest + h * inc;
while (dest != destEnd) {
System.arraycopy(data, src, data, dest, w);
src += inc;
dest += inc;
}
} |
fc006249-06ea-4a07-8cc1-837d1179bc4b | 5 | public void save(String fileName,boolean rewrite){
try{
File outFile = new File(fileName);
if(outFile.exists()&&rewrite){
if(JOptionPane.showConfirmDialog(null, "File already exists. Rewrite it?","File exits",JOptionPane.YES_NO_OPTION)==JOptionPane.NO_OPTION)
return;
}
FileWriter fw = new FileWriter(outFile);
fw.write(String.valueOf(shapeList.size())+"\n");
for(TextBox t:shapeList){
fw.write(t.saveData()+"\n");
}
fw.close();
}catch(Exception ex){
ex.printStackTrace();
}
} |
d5a244dc-21aa-4bb4-b7aa-87cb56893919 | 3 | final Entry<V> removeEntryForKey(int key) {
int hash = hash(key);
int i = indexFor(hash, this.table.length);
Entry prev = this.table[i];
Entry e = prev;
while (e != null) {
Entry next = e.next;
if (e.key == key) {
this.modCount += 1;
this.size -= 1;
if (prev == e) this.table[i] = next; else
prev.next = next;
return e;
}
prev = e;
e = next;
}
return e;
} |
727207ea-1d73-413a-88a7-29d8d4cff67a | 8 | private boolean isMatch(BSTNode<T> haysack, BSTNode<T> needle) {
// if both the nodes are null its considered as match
if(haysack == null && needle == null) {
return true;
}
// if one of them is null and other one is not .. consider it as not match
if((haysack == null && needle!= null)|| (needle == null && haysack != null)) {
return false;
}
// finally compare the data .. if the data does not match return right from here
if(haysack.data.compareTo(needle.data) != 0){
return false;
}
// if everything has been succeded till this far .. procedd to left and right subtree of both
return isMatch(haysack.left, needle.left) && isMatch(haysack.right, needle.right);
} |
0e2f3f4b-c8f0-4094-ad7d-088233d4e8ae | 4 | public void getMultiplier() throws Exception {
Object st = null;
st = JOptionPane.showInputDialog(null,
"Increase tempo by how many times?\n" +
"Please type an integer.", "File Splitter",
JOptionPane.INFORMATION_MESSAGE, null, null, "1");
if (st == null)
return;
multiplier = Integer.parseInt((String)st);
if(multiplier==1)
throw new SingleMultiplierException();
Object [] op = {"96 measures", "Equal Spacing", "Cancel"};
int st1 = JOptionPane.showOptionDialog(null, "96 measures per file" +
" or equally-sized files?", "File Splitter",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE, null, op, op[1]);
switch (st1) {
case 0:
splitLine = 384;
break;
case 1:
splitLine = totalLines(text);
break;
default:
throw new CancelException();
}
} |
5ae9b417-0110-4da5-90b7-34b9f32289a8 | 8 | public void CriarCompeticao(String Nome, String escalao, Collection<String> equipa, int tipo, String torneio, String date) throws Exception {
int year = Calendar.getInstance().get(Calendar.YEAR);
if (tipo == 0) {
if (!DAOCompeticao.containsKey(escalao)) {
Competicao comp = new Campeonato(escalao, Nome, escalao, Integer.toString(year));
DAOCompeticao.put(escalao, comp);
Campeonato comp1 = (Campeonato) comp;
comp1.setEquipa(equipa, escalao);
int i = comp1.geraCalendario(date);
if (i == 0) {
DAOCompeticao.remove(comp1.getCod_competicao());
throw new Exception("Não foi possivel criar o competicao");
}
} else {
throw new Exception("Competicao ja existe");
}
} else {
if (torneio.equals("Eliminatórias")) {
Competicao comp = new Eliminatorias(Nome, Nome, escalao, Integer.toString(year));
if (!ExisteCompeticao(Nome)) {
DAOCompeticao.put(Nome, comp);
Torneio comp1 = (Torneio) comp;
comp1.setEquipa(equipa, Nome);
int i = comp1.geraCalendario(date);
if (i == 0) {
DAOCompeticao.remove(comp1.getCod_competicao());
throw new Exception("Não foi possivel criar o competicao");
}
} else {
throw new Exception("Competicao ja existe");
}
}else{
Competicao comp = new EliminatoriaDupla(Nome, Nome, escalao, Integer.toString(year));
if (!ExisteCompeticao(Nome)) {
DAOCompeticao.put(Nome, comp);
Torneio comp1 = (Torneio) comp;
comp1.setEquipa(equipa, Nome);
int i = comp1.geraCalendario(date);
if (i == 0) {
DAOCompeticao.remove(comp1.getCod_competicao());
throw new Exception("Não foi possivel criar o competicao");
}
} else {
throw new Exception("Competicao ja existe");
}
}
}
} |
ca677e44-893f-4ba9-91b2-92323abfb14d | 1 | public void removePropertyChangeListener(PropertyChangeListener listener) {
this.riverChangeSupport.removePropertyChangeListener(listener);
for (River r: rivers) {
r.removePropertyChangeListener(this);
}
} |
a5154a34-42a0-445a-b7c7-3a734f3436c1 | 3 | public String[] interpret(String[] result, Symtab st, Taccount account) {
if (pm != null) {
result = pm.interpret(result, st, account);
} if (pmc.f != null)
result[1] += pmc.interpret(st, account);
else if (pmc.sd != null)
result[0] += pmc.interpret(st, account);
return result;
} |
f484dd2d-86b3-4534-b243-d697675fe244 | 8 | public Boolean getSignForPointInSpace(Point p) throws OctNodeException {
if (p.getDimensions() != this.getDimensions())
throw new InvalidArgumentOctNodeException();
try {
if (this.getBoundingBox().pointInBox(p) == false) return false;
} catch (GeometryException ge) { throw new InvalidArgumentOctNodeException(); }
switch (type) {
case OCTNODE_EMPTY:
return this.getSign();
case OCTNODE_INTERMEDIATE:
for (OctNode on: this.children)
if (on.getSignForPointInSpace(p)) return true;
return false;
case OCTNODE_LEAF:
return this.getSign();
default:
throw new UnrecognizedOctNodeTypeException();
}
} |
f8980f9d-ab4b-4312-895e-c8b694e92e7d | 1 | public void setPublic(final boolean flag) {
int modifiers = classInfo.modifiers();
if (flag) {
modifiers |= Modifiers.PUBLIC;
} else {
modifiers &= ~Modifiers.PUBLIC;
}
classInfo.setModifiers(modifiers);
this.setDirty(true);
} |
d140fb84-bf4d-423b-af3e-d0fb3503568d | 7 | public boolean AttackNPC(int NPCID) {
if(server.npcHandler.npcs[npcs[NPCID].attacknpc] != null) {
int EnemyX = server.npcHandler.npcs[npcs[NPCID].attacknpc].absX;
int EnemyY = server.npcHandler.npcs[npcs[NPCID].attacknpc].absY;
int EnemyHP = server.npcHandler.npcs[npcs[NPCID].attacknpc].HP;
int hitDiff = 0;
int Npchitdiff = 0;
int wepdelay = 0;
hitDiff = misc.random(npcs[NPCID].MaxHit);
if (GoodDistance(EnemyX, EnemyY, npcs[NPCID].absX, npcs[NPCID].absY, 1) == true) {
if (server.npcHandler.npcs[npcs[NPCID].attacknpc].IsDead == true) {
ResetAttackNPC(NPCID);
npcs[NPCID].textUpdate = "Oh yeah I win bitch!";
npcs[NPCID].textUpdateRequired = true;
npcs[NPCID].animNumber = 2103;
npcs[NPCID].animUpdateRequired = true;
npcs[NPCID].updateRequired = true;
} else {
if ((EnemyHP - hitDiff) < 0) {
hitDiff = EnemyHP;
}
if(npcs[NPCID].npcType == 9)
npcs[NPCID].animNumber = 386;
if(npcs[NPCID].npcType == 3200)
npcs[NPCID].animNumber = 0x326; // drags: chaos ele emote ( YESSS )
if(npcs[NPCID].npcType == 1605) {
npcs[NPCID].animNumber = 386; // drags: abberant spector death ( YAY )
}
npcs[NPCID].animUpdateRequired = true;
npcs[NPCID].updateRequired = true;
server.npcHandler.npcs[npcs[NPCID].attacknpc].hitDiff = hitDiff;
server.npcHandler.npcs[npcs[NPCID].attacknpc].attacknpc = NPCID;
server.npcHandler.npcs[npcs[NPCID].attacknpc].updateRequired = true;
server.npcHandler.npcs[npcs[NPCID].attacknpc].hitUpdateRequired = true;
npcs[NPCID].actionTimer = 7;
return true;
}
}
}
return false;
} |
6f37f2c2-c1bd-404a-a527-10cc8d1d8518 | 5 | private void cmdJOIN(ArrayList<String> args) {
if (status == HANDSHAKE_SUCCESFULL) {
if (args.size() >= 0 && args.size() <= 1) {
int slots = server.getBestLobby();
try {
if (args.size() == 1) {
slots = Integer.parseInt(args.get(0));
}
} catch (NumberFormatException e) {
// if args.get(0) cannot be casted to an Integer, it will
// leave the slots variable to 0, meaning this client has no
// Preferences
}
server.getLobby(slots, this);
} else {
sendError(util.Protocol.ERR_INVALID_COMMAND);
}
} else {
sendError(util.Protocol.ERR_COMMAND_UNEXPECTED);
}
} |
f97ebfca-e0ee-4cd3-8cf9-27c4fba8b294 | 2 | CPGreyBmp makeHorizLinesTexture(int lineSize, int size) {
CPGreyBmp texture = new CPGreyBmp(size, size);
for (int i = 0; i < size * size; i++) {
if (i / size >= lineSize) {
texture.data[i] = (byte) 255;
}
}
return texture;
} |
4ee29a45-ef0c-4dec-947b-074906cf4313 | 0 | @Override
public int getHeight() { return height; } |
1656e905-6e3b-412d-8410-8fd6afff9718 | 7 | public static void main(String[] args) {
String friendsFile = "/Users/matthiasfelix/git/RecommenderSystem/RecommenderSystem/artificial/friendsA01.txt";
String ratingsFile = "/Users/matthiasfelix/git/RecommenderSystem/RecommenderSystem/artificial/";
String rootPath = "/Users/matthiasfelix/git/RecommenderSystem/RecommenderSystem/";
String parameterFile = "src/parameters.txt";
int[] numberOfCommunityItems = { 50, 100, 200, 400 };
double[] as = { 0.0, 1 / 3.0, 2 / 3.0, 1.0 };
double[] bs = { 0.0, 1 / 3.0, 2 / 3.0, 1.0 };
double[] ps = { 0.05, 1 / 3.0, 2 / 3.0, 1.0 };
for (int n : numberOfCommunityItems) {
for (double a : as) {
for (double b : bs) {
for (double p : ps) {
RatingGenerator
.main(new String[] {
friendsFile,
ratingsFile + "Rating2_" + n + "_" + a + "_" + b + "_" + p
+ ".txt", Integer.toString(n), Double.toString(a),
Double.toString(b), Double.toString(p) });
if (a + b <= 1) {
Recommender.main(new String[] { rootPath, parameterFile,
"Result2_" + n + "_" + a + "_" + b + "_" + p + ".txt",
"Rating2_" + n + "_" + a + "_" + b + "_" + p + ".txt" });
}
}
}
}
}
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 9; j += 2) {
Recommender.main(new String[] { rootPath, parameterFile,
"Result_040814_" + i + "_" + j + ".txt",
"RATINGS_040814_" + i + "_" + j + ".txt" });
}
}
} |
0e4b96ed-b356-4f8c-b455-66624728668a | 2 | private boolean isClassInFolder(String fileName)
{
String[] files;
//check if file is in the folder
files = folderFile.list();
for (int i = 0; i < files.length; i++)
{
if (this.className.equals(files[i]))
{
return true;
}
}
return false;
} |
efefe39b-605a-4576-a887-61fa111a7966 | 1 | public void endTag() throws XMLStreamException {
mDepth--;
if (!mHadText) {
eol();
} else {
mHadText = false;
}
mWriter.writeEndElement();
} |
735503d2-a63b-4db8-a8c1-c63a8c9f31e0 | 4 | @Override
public void keyPressed(KeyEvent ke) {
if(ke.getKeyCode() == KeyEvent.VK_LEFT){
left = true;
} else if(ke.getKeyCode() == KeyEvent.VK_RIGHT){
right = true;
}
if(ke.getKeyCode() == KeyEvent.VK_UP){
up = true;
} else if(ke.getKeyCode() == KeyEvent.VK_DOWN){
down = true;
}
} |
f53aec8d-2cdd-48fc-b991-95a6e8bc508e | 0 | @Test
public void shouldReturnAreaOfTwelveForThreeByFourRectangle(){
Rectangle rectangle = new Rectangle(3, 4, 0, 0);
assertEquals(12, rectangle.area());
} |
bb3fef7e-6671-45d1-851c-6b57ea0c7a88 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((accessToken == null) ? 0 : accessToken.hashCode());
result = prime * result
+ ((expireIn == null) ? 0 : expireIn.hashCode());
result = prime * result
+ ((refreshToken == null) ? 0 : refreshToken.hashCode());
return result;
} |
740dfe50-7d14-4d5a-83b6-7581d3d87581 | 1 | private static String m(long n, String s) {
return n + " " + s + (n == 1 ? "" : "s");
} |
34e8439e-f776-4c10-ae3a-8c27d280ef81 | 4 | @Override
public void deserialize(Buffer buf) {
position = buf.readUByte();
if (position < 0 || position > 255)
throw new RuntimeException("Forbidden value on position = " + position + ", it doesn't respect the following condition : position < 0 || position > 255");
objGid = buf.readInt();
if (objGid < 0)
throw new RuntimeException("Forbidden value on objGid = " + objGid + ", it doesn't respect the following condition : objGid < 0");
objUid = buf.readInt();
if (objUid < 0)
throw new RuntimeException("Forbidden value on objUid = " + objUid + ", it doesn't respect the following condition : objUid < 0");
} |
f557a8b7-5dd0-4482-97a7-a4a3422af2d7 | 6 | public void allocateStats() {
String s;
try {
while (mc.getStatPoints() > 0) {
System.out.println("You must use all stat points.");
System.out.println("Stat Points Remaining: "
+ mc.getStatPoints());
System.out.println("Current Stats: ");
System.out.println("Agi: " + mc.getAgi() + " Intel: "
+ mc.getIntel() + " Sta: " + mc.getSta() + " Str: "
+ mc.getStr());
tb.printStatOptions();
s = is.readLine();
switch (Integer.parseInt(s)) {
case 1:
mc.incrementAgi();
break;
case 2:
mc.incrementIntel();
break;
case 3:
mc.incrementSta();
break;
case 4:
mc.incrementStr();
break;
default:
break;
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
77744a59-72cd-4024-8f9e-9a50fec0972a | 6 | public void run(){
//Run until interrupted.
while(true){
try{
System.out.println("processing");
ref = queue.remove();//ref:reference to a key
res = null;
synchronized(ResourceManager.this){
res = refs.get(ref);//res:an object mapping by the key of "ref"
refs.remove(ref);
}
res.release();
ref.clear();
}catch(InterruptedException ex){//Only in the case of waiting in the middle of "remove()".
ex.printStackTrace();
System.out.println("interrupted");
//do nothing
}
finally{
if(shutdown){
while(true){
if(queue.poll() != null){//Without this, this thread may stop in the process of "remove()".
try {
ref = queue.remove();
} catch (InterruptedException e) {
e.printStackTrace();
}//ref:reference to a key
res = null;
synchronized(ResourceManager.this){
res = refs.get(ref);//res:an object mapping by the key of "ref"
refs.remove(ref);
}
res.release();
ref.clear();
}
else{//Wrong. Check if the size of ref is equal to 0. Whether queue is null is not a condition to terminate the system.
System.out.println("break");
break;
}
}
System.out.println("break");
break;
}
}
}
System.out.println("end");
} |
ce2f0bde-db3f-4dc5-ba77-c0bc5f39c54f | 6 | private void sysCallExec()
{
//If there is nothing to run, abort. This should never happen.
if (m_programs.size() == 0)
{
System.err.println("ERROR! syscallExec has no programs to run.");
System.exit(-1);
}
//find out which program has been called the least and record how many
//times it has been called
int leastCallCount = m_programs.get(0).callCount;
for(Program prog : m_programs)
if (prog.callCount < leastCallCount)
leastCallCount = prog.callCount;
//Create a vector of all programs that have been called the least number
//of times
Vector<Program> cands = new Vector<Program>();
for(Program prog : m_programs)
cands.add(prog);
//Select a random program from the candidates list
Random rand = new Random();
int pn = rand.nextInt(m_programs.size());
Program prog = cands.get(pn);
//Determine the address space size using the default if available.
//Otherwise, use a multiple of the program size.
int allocSize = prog.getDefaultAllocSize();
if (allocSize <= 0)
allocSize = prog.getSize() * 2;
//Load the program into RAM
boolean success = createProcess(prog, allocSize);
//Adjust the PC since it's about to be incremented by the CPU
if(success)
m_CPU.setPC(m_CPU.getPC() - CPU.INSTRSIZE);
}//syscallExec |
75009d85-b63a-45fa-bace-9ef9318e7908 | 4 | protected int findClosest(Color c) {
if (colorTab == null) return -1;
int r = c.getRed();
int g = c.getGreen();
int b = c.getBlue();
int minpos = 0;
int dmin = 256 * 256 * 256;
int len = colorTab.length;
for (int i = 0; i < len;) {
int dr = r - (colorTab[i++] & 0xff);
int dg = g - (colorTab[i++] & 0xff);
int db = b - (colorTab[i] & 0xff);
int d = dr * dr + dg * dg + db * db;
int index = i / 3;
if (usedEntry[index] && (d < dmin)) {
dmin = d;
minpos = index;
}
i++;
}
return minpos;
} |
95dc3c0e-ca2d-42e8-9592-a8442f0734ee | 4 | public void readMails(String folderName) {
properties = new Properties();
properties.setProperty("mail.host", "imap.gmail.com");
properties.setProperty("mail.port", "995");
properties.setProperty("mail.transport.protocol", "imaps");
session = Session.getInstance(properties,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(userName, password);
}
});
try {
store = session.getStore("imaps");
store.connect();
inbox = store.getFolder(folderName);
inbox.open(Folder.READ_ONLY);
Message messages[] = inbox.search(new FlagTerm(
new Flags(Flag.SEEN),false));
System.out.println("Number of mails = " + messages.length);
for (int i = 0; i < messages.length; i++) {
System.out.println("------ok-------");
Message message = messages[i];
Address[] from = message.getFrom();
Enumeration headers = message.getAllHeaders();
while (headers.hasMoreElements()) {
Header h = (Header) headers.nextElement();
maildata.append(h.getName().toString()+":"+h.getValue().toString()+"\n");
}
maildata.append("SentDate:"+ message.getSentDate()+"\n");
maildata.append("Content:"+"\n");
getMultiMssage(message);
String emaildata=maildata.toString();
msgid= MailContainExtractor.getMessageID((maildata.toString()));
new EmailWriter().storeSpamFile(maildata, msgid);
maildata.delete(0, maildata.length());
}
inbox.close(true);
store.close();
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
}
} |
416d560a-c71f-40e9-81ce-8161403b94e4 | 0 | protected void onSetModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} |
8adf122c-08f4-45fc-8d10-b684027a12ae | 0 | public boolean isFirstMove() {
return this.moveCount == 0;
} |
355b02aa-5264-42f8-b0d0-5c0a8fa2395c | 6 | public static void recordAndIntroductionJustification(ControlFrame frame, Keyword lastmove) {
{ Vector conjuncts = ((Vector)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ARGUMENTS, null)));
Cons antecedents = Stella.NIL;
if (lastmove == Logic.KWD_UP_TRUE) {
{ ControlFrame conjunct = null;
Vector vector000 = conjuncts;
int index000 = 0;
int length000 = vector000.length();
Cons collect000 = null;
for (;index000 < length000; index000 = index000 + 1) {
conjunct = ((ControlFrame)((vector000.theArray)[index000]));
{
}
if (collect000 == null) {
{
collect000 = Cons.cons(((conjunct.state == Logic.KWD_POPPED) ? ((Justification)(KeyValueList.dynamicSlotValue(conjunct.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null))).copy() : ((Justification)(KeyValueList.dynamicSlotValue(conjunct.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null)))), Stella.NIL);
if (antecedents == Stella.NIL) {
antecedents = collect000;
}
else {
Cons.addConsToEndOfConsList(antecedents, collect000);
}
}
}
else {
{
collect000.rest = Cons.cons(((conjunct.state == Logic.KWD_POPPED) ? ((Justification)(KeyValueList.dynamicSlotValue(conjunct.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null))).copy() : ((Justification)(KeyValueList.dynamicSlotValue(conjunct.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null)))), Stella.NIL);
collect000 = collect000.rest;
}
}
}
}
{ Justification self000 = Justification.newJustification();
self000.inferenceRule = Logic.KWD_AND_INTRODUCTION;
self000.antecedents = antecedents;
ControlFrame.recordGoalJustification(frame, self000);
}
}
else {
}
}
} |
aa5cf828-014c-436a-8205-95b0b8fc1d00 | 5 | public static void main(String[] args) throws Exception {
BeeCommandLineParser arguments = BeeCommandLineParser.parse(args);
// average available surface: 29ha
// 1ha = 10000 square meters -> 29ha = 290000 square meters ->
// sqrt(290000) approximately 540m -> Env(-270, 270, -270, 270)
BeeSimulation simulation = new BeeSimulation(arguments.getNumberOfGroups(), arguments.getGroupSize(),
(arguments.showGui()) ? new Environment(-30, 30, -30, 30) : new Environment(-270, 270, -270, 270));
if (arguments.showGui()) {
simulation.addEventListener(new VisualisationEventListener(simulation));
}
if (arguments.generateReport()) {
try {
simulation.addEventListener(new ReportEventListener("report.csv", simulation));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
if (arguments.showControls()) {
simulation.setVisible(true);
} else {
simulation.run();
}
} |
dbe94b83-689a-461e-8a97-949edbb99a09 | 6 | public void setMaxSize(int newMaxSize)
{
if(newMaxSize < 0)
{
System.out.println("New size must be a nonnegative integer. " +
"maxCount has not been modified.");
return;
}
if(newMaxSize == maxCount)
{
return;
}
if(newMaxSize < this.maxCount && newMaxSize < this.queueCount)
{
int i = 0;
for(Node<T> currentNode = this.firstNode; currentNode != null; currentNode = currentNode.link)
{
i++;
if(i == newMaxSize)
{
currentNode.link = null;
this.lastNode = currentNode;
}
}
this.queueCount = newMaxSize;
}
this.maxCount = newMaxSize;
return;
}//end setMaxSize() |
0c808b9d-269d-434b-a1b5-3a5fd0f1e1c5 | 0 | public double getAltitude()
{
return altitude;
} |
5ee25de5-e830-4f55-a713-04904552756a | 6 | private boolean dupi(char[] c) {
for (int i = 0; i < c.length; i++) {
if (c[i] != ')') {
// if not closing bracket or a token
stack1.push(c[i]);
} else {
// if a closing bracket
char k = stack1.pop();
boolean tokenize = false;
while (k != '(') {
if (k != '(' || k != ')') {
tokenize = true;
}
k = stack1.pop();
}
if (!tokenize) {
return true;
}
}
}
return false;
} |
f1a67de5-2428-4bbd-83da-84adfc9032f0 | 1 | private synchronized static void createInstance() {
if (instance == null) {
instance = new FamilyService();
}
} |
02c2540e-fa14-4039-837d-cb75dacbc9f1 | 1 | public static void printWithColor(String color, String message){
try{
Colores col = Colores.valueOf(color.toUpperCase());
System.out.print("\034[" + col.cod + "m" + message + "\033[30m");
}catch (IllegalArgumentException e){
System.out.println("\033\tError: " + e.getMessage());
}
} |
c0dc989a-1043-44fe-bfd6-5f6fdd12dd24 | 6 | @Override
public void run( ){
while( keepDispatching ){
try{
Message event = MESSAGE_QUEUE.take();
MessageType type = event.getType();
int dispatchedCount = 0;
for( MListener listener : ELIST ){
if( listener.isSupported( type ) ){
listener.update( event );
++dispatchedCount;
}
}
if( dispatchedCount == 0 ){
adminListener.update( event );
continue;
}
messageCounter.incrementAndGet();
}catch( InterruptedException ie ){
LOGGER.info("Successfully shut down EventDispatcher thread.");
}catch( Exception e ){
LOGGER.warn("Exception occured while dispatching events.");
LOGGER.warn("{} ", e);
}
}
} |
e58bbf14-cf92-46e5-a4d1-385bbf771dbd | 0 | public void setId(String value) {
this.id = value;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.