method_id
stringlengths 36
36
| cyclomatic_complexity
int32 0
9
| method_text
stringlengths 14
410k
|
---|---|---|
732c4afe-129f-4272-abf7-383aa1a5556d | 6 | public static void createRatingSiteData(Long[] seeds)
{
System.out.println("Generating RatingSite Data: Reviewers and Reviews... ");
DateGenerator publishDateGen = new DateGenerator(new GregorianCalendar(2008,5,20),new GregorianCalendar(2008,8,23),seeds[0]);
ValueGenerator valueGen = new ValueGenerator(seeds[1]);
RandomBucket countryGen = createCountryGenerator(seeds[2]);
//For Review Generation
DateGenerator reviewDateGen = new DateGenerator(182,today,seeds[3]);
RandomBucket true70 = new RandomBucket(2, seeds[4]);
NormalDistRangeGenerator productNrGen = new NormalDistRangeGenerator(2,1,productCount,4,seeds[5]);
true70.add(70, Boolean.valueOf(true));
true70.add(30, Boolean.valueOf(false));
NormalDistGenerator reviewCountPRSGen = new NormalDistGenerator(3,1, avgReviewsPerRatingSite ,seeds[6]);
NormalDistGenerator reviewCountPPGen = new NormalDistGenerator(3,1, avgReviewsPerPerson ,seeds[7]);
Integer reviewNr = 1;
Integer personNr = 1;
Integer ratingSiteNr = 1;
ObjectBundle bundle = new ObjectBundle(serializer);
while(reviewNr<=reviewCount)
{
//Get number of reviews for this Rating Site
Integer reviewCountRatingSite = reviewCountPRSGen.getValue();
if(reviewNr+reviewCountRatingSite > reviewCount)
reviewCountRatingSite = reviewCount - reviewNr + 1;
//Generate provenance data for this rating site
if(namedGraph) {
bundle.setPublisher(RatingSite.getURIref(ratingSiteNr));
bundle.setPublishDate(publishDateGen.randomDateInMillis());
bundle.setGraphName("<" + RatingSite.getRatingSiteNS(ratingSiteNr) + "Graph-" + DateGenerator.formatDate(bundle.getPublishDate()) + ">");
bundle.setPublisherNum(ratingSiteNr);
}
else {
bundle.setPublisher(RatingSite.getURIref(ratingSiteNr));
bundle.setPublisherNum(ratingSiteNr);
}
//Now generate persons and reviews
Integer maxReviewForRatingSite = reviewNr+reviewCountRatingSite;
while(reviewNr < maxReviewForRatingSite)
{
//Generate Person data
String name = dictionary3.getRandomSentence(1);
String country = (String)countryGen.getRandom();
String mbox_sha1 = valueGen.randomSHA1();
Person p = new Person(personNr,name,country,mbox_sha1);
//Generate Publisher data
if(!namedGraph) {
p.setPublishDate(publishDateGen.randomDateInMillis());
}
//needed for qualified name
p.setPublisher(ratingSiteNr);
bundle.add(p);
//Now generate Reviews for this Person
Integer reviewCountPerson = reviewCountPPGen.getValue0();
if(reviewNr+reviewCountPerson > maxReviewForRatingSite)
reviewCountPerson = maxReviewForRatingSite - reviewNr;
createReviewsOfPerson(bundle, p, reviewNr, reviewCountPerson, valueGen, reviewDateGen,
productNrGen, publishDateGen, true70);
personNr++;
reviewNr += reviewCountPerson;
}
//All data for current producer generated -> commit (Important for NG-Model).
bundle.commitToSerializer();
ratingSiteNr++;
}
System.out.println((ratingSiteNr - 1) + " Rating Sites with " + (personNr - 1) + " Persons and " + (reviewNr-1) + " Reviews have been generated.\n");
} |
f3a20d04-aef1-4661-90eb-3989fb258184 | 1 | public SignatureVisitor visitInterfaceBound() {
separator = seenInterfaceBound ? ", " : " extends ";
seenInterfaceBound = true;
startType();
return this;
} |
f9858e47-fc9e-4042-9f51-63de6546ad12 | 8 | public void zoneEventOccurred(String eventZone, int eventType){
// If within the bounds of the text, go to the link
if(eventType==ZoneEvents.ENTER && eventZone.equals("polygon")){
Gui.changeCursor(Cursor.HAND_CURSOR);
}
else if (eventType==ZoneEvents.CLICK && eventZone.equals("polygon")){
if(0 == onclick)
{
//TODO MAKE ON CLICK WORK
// java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
try
{
// java.net.URI uri = new java.net.URI( onclickurl);
BrowserLoader.openURL(onclickurl);//added by Mark Mellar
// desktop.browse( uri );
return;
}
catch( Exception e1 ) {
System.err.println( e1.getMessage() );
}
}
//set next slide id
if(onclick >0)
{
// nextslideid = onclick;
Engine.gotoSlide(onclick);//added by mark mellar
if(Debug.poly) System.out.println("the next slide ID = " + nextslideid);
}
}
} |
277b656c-2f92-415f-8776-fb53ea69759e | 1 | public void visitMultiANewArrayInsn(final String desc, final int dims) {
minSize += 4;
maxSize += 4;
if (mv != null) {
mv.visitMultiANewArrayInsn(desc, dims);
}
} |
4d537310-c269-458a-8b1b-6b54f7afcc7b | 0 | public CheckResultMessage checkG11(int day) {
return checkReport.checkG11(day);
} |
3bc565cc-18e1-4c15-84e5-694203707b3d | 1 | private static void initDCT(Composite inComposite, int heightHint) {
final Composite toolbar = new Composite(inComposite, SWT.BORDER);
final Composite imageContainer = new Composite(inComposite, SWT.BORDER);
GridData toolbarGridData = new GridData(GridData.FILL_HORIZONTAL);
toolbarGridData.grabExcessHorizontalSpace = true;
toolbar.setLayoutData(toolbarGridData);
toolbar.setLayout(new GridLayout(2, false));
// final Text st = new Text(toolbar, SWT.BORDER);
// st.setText("0.5");
final Combo combo = new Combo (toolbar, SWT.READ_ONLY);
combo.setItems (new String [] {"1.0", "0.9", "0.8","0.7", "0.6","0.5", "0.4","0.3", "0.2", "0.1"});
combo.setText("0.8");
Button button = new Button(toolbar, SWT.PUSH);
button.setText("DCT");
button.setBounds(0, 0, 100, 30);
button.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
button.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
double coefficient = 1;
try {
coefficient = Double.parseDouble(combo.getText());
} catch (Exception e) {
e.printStackTrace();
}
dct(coefficient);
ImageUtils.paintImage(new GC(imageContainer), dct, dctHisto);
ImageUtils.paintImage(new GC(diffContainer), diff, diffHisto);
}
});
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.grabExcessHorizontalSpace = true;
gridData.heightHint = heightHint;
imageContainer.setLayoutData(gridData);
imageContainer.addListener(SWT.Paint, new Listener() {
public void handleEvent(Event event) {
ImageUtils.paintImage(event.gc, dct, dctHisto);
}
});
} |
d7bb8f1f-c38e-4097-8474-4ac32f6e86de | 5 | public void getStats(){
Iterator sentenceIterator = sentenceMap.entrySet().iterator();
Iterator wordsIterator;
while(sentenceIterator.hasNext()) {
Map.Entry sentencePair = (Map.Entry) sentenceIterator.next();
Sentence sentence = (Sentence) sentencePair.getValue();
wordsIterator = sentence.wordsMapDouble.entrySet().iterator();
while(wordsIterator.hasNext()) {
Map.Entry wordsPair = (Map.Entry) wordsIterator.next();
WordITA word = (WordITA) wordsPair.getValue();
String bigram;
if (word.dom == 0) continue;
WordITA parent = (WordITA) sentence.wordsMapDouble.get(word.dom);
if(word.id < parent.id) {
String delimiter = "<";
bigram = word.featValues[1] + delimiter + parent.featValues[1];
} else {
String delimiter = ">";
bigram = parent.featValues[1] + delimiter + word.featValues[1];
}
if (StatsManagement.stats.containsKey(bigram)) {
StatsManagement.stats.put(bigram, StatsManagement.stats.get(bigram) + 1);
} else {
StatsManagement.stats.put(bigram, 1);
}
}
}
} |
ca62838d-b9e2-4d59-b4c4-8d299092b16c | 1 | @Override
public void layoutContainer(Container target) {
if (mRootCell != null) {
Rectangle bounds = target.getBounds();
Insets insets = target.getInsets();
bounds.x = insets.left;
bounds.y = insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
mRootCell.layout(bounds);
}
} |
d2134cac-1de2-41eb-9f6a-50be43e0cd73 | 2 | private void AddProgram(String text, int type)
{
int shader = glCreateShader(type);
if(shader == 0)
{
System.err.println("Shader creation failed: Could not find valid memory location when adding shader");
System.exit(1);
}
glShaderSource(shader, text);
glCompileShader(shader);
if(glGetShaderi(shader, GL_COMPILE_STATUS) == 0)
{
System.err.println(glGetShaderInfoLog(shader, 1024));
System.exit(1);
}
glAttachShader(m_resource.GetProgram(), shader);
} |
6ec75e3a-8817-4529-a3db-dea7c3224a6b | 3 | public void setAnnotations(Annotation[][] params) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
AnnotationsWriter writer = new AnnotationsWriter(output, constPool);
try {
int n = params.length;
writer.numParameters(n);
for (int i = 0; i < n; ++i) {
Annotation[] anno = params[i];
writer.numAnnotations(anno.length);
for (int j = 0; j < anno.length; ++j)
anno[j].write(writer);
}
writer.close();
}
catch (IOException e) {
throw new RuntimeException(e); // should never reach here.
}
set(output.toByteArray());
} |
b5fbadc8-9f54-47b9-a15b-112f6039d407 | 0 | public int getRowCount() {
// TODO Auto-generated method stub
return 0;
} |
dd799e73-4cf4-440e-adac-bfcd9c55c9cc | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE> already @x1.",name()));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?"":L("^S<S-NAME> chant(s) <S-HIM-HERSELF> off the ground.^?"));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
if(msg.value()<=0)
{
success=beneficialAffect(mob,target,asLevel,0)!=null;
target.location().show(target,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> start(s) drifting up!"));
}
}
}
else
return beneficialWordsFizzle(mob,null,L("<S-NAME> chant(s), but fail(s) to leave the ground."));
// return whether it worked
return success;
} |
47c4ed2a-e0d3-4200-870f-9e43cb2daa34 | 5 | @BeforeClass
public static void setUpBeforeClass() {
try { new MySQLConnection(); }
catch (InstantiationException e) { e.printStackTrace(); }
catch (IllegalAccessException e) { e.printStackTrace(); }
catch (ClassNotFoundException e) { e.printStackTrace(); }
catch (SQLException e) { e.printStackTrace(); }
catch (Exception e) { e.printStackTrace(); }
} |
7afebe18-0164-44d3-a25c-2c1acea525fd | 1 | private final static void submitSongTasks()
throws MasterException {
try {
//submit tasks to do.
//Waiting until all tasks are done
MasterMetadata.songES.invokeAll(MasterMetadata.songTasks);
//Clean the queue
MasterMetadata.songTasks.clear();
} catch (Exception e) {
throw new MasterException("Exception "+e.getMessage(), e);
}
} |
ac1f7d52-3b3c-4178-bc3f-753ee8c6e18b | 3 | public OpenURL(String URL) throws Exception {
//if we're not on a supported OS just quit
if (!Desktop.isDesktopSupported()) {
throw new Exception("Unsupported Desktop. Can't open authentication site.");
}
//if thre is no url to open just quit
if (URL.length() == 0) {
throw new Exception("Invalid URL received");
}
//create a desktop opject
Desktop desktop = Desktop.getDesktop();
//another check for a supported os (not sure why this is needed)
if (!desktop.isSupported(Desktop.Action.BROWSE)) {
throw new Exception("Unsupported Desktop. Can't open authentication site.");
}
//try to open the URL or throw an error message
URI uri = new URI(URL);
desktop.browse(uri);
} |
77a0a6bb-f468-43d6-b5ff-246721774186 | 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(DisabilityAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(DisabilityAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(DisabilityAct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(DisabilityAct.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 DisabilityAct().setVisible(true);
}
});
} |
5adc051e-0c52-481c-90ee-8b514754e1a6 | 7 | public static final boolean fullVeracsEquipped(Player player) {
int helmId = player.getEquipment().getHatId();
int chestId = player.getEquipment().getChestId();
int legsId = player.getEquipment().getLegsId();
int weaponId = player.getEquipment().getWeaponId();
if (helmId == -1 || chestId == -1 || legsId == -1 || weaponId == -1)
return false;
return ItemDefinitions.getItemDefinitions(helmId).getName()
.contains("Verac's")
&& ItemDefinitions.getItemDefinitions(chestId).getName()
.contains("Verac's")
&& ItemDefinitions.getItemDefinitions(legsId).getName()
.contains("Verac's")
&& ItemDefinitions.getItemDefinitions(weaponId).getName()
.contains("Verac's");
} |
310db1fb-ec72-45dd-a8d9-dde29e9d5573 | 5 | public void draw() {
pixels = screen.getPixels();
int xxx = xEnd - xOrigin;
int yyy = yEnd - yOrigin;
double d = (Math.sqrt((xxx*xxx)+(yyy*yyy)));
double xSeg = xxx/d;
double ySeg = yyy/d;
for(int i = 0; i < getLength(); i++){
if(xOrigin <= 0 || xEnd >= screen.getWidth() || yOrigin <= 0 || yEnd >= screen.getHeight()) continue;
int xx =(int) (xSeg * i + xOrigin);
int yy =(int) (ySeg * i + yOrigin);
pixels[xx+yy*screen.getWidth()] = col.getColor();
}
setPixels(pixels);
} |
d7e550ab-5e9a-4128-97a8-abba760cd82c | 6 | private GoodsType goodsToMake() {
GoodsType wantGoods = null;
int diff, wantAmount = -1;
for (GoodsType g : getSpecification().getGoodsTypeList()) {
GoodsType produced;
if (g.isRawMaterial()
&& (produced = g.getProducedMaterial()) != null
&& produced.isStorable()
&& getGoodsCount(g) > getWantedGoodsAmount(g)
&& (diff = getWantedGoodsAmount(produced)
- getGoodsCount(produced)) > wantAmount) {
wantGoods = produced;
wantAmount = diff;
}
}
return wantGoods;
} |
ac608992-02f5-442b-8629-0080904d9eec | 6 | public void timeTableAndBlockOutput(){
try {
jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("outputFile.xls")); //要寫入的路徑以及檔名
jxl.write.WritableSheet writeSheet = writeWorkBook.createSheet("inbound_train", 0); //建立一個工作表名字,然後0表示為第一頁
Label label = new Label(0, 0, "Inbound Train No."); //設一個label, 並添加column major
writeSheet.addCell(label); //將格子添加到表格
label = new Label(1, 0, "Arrival Time");
writeSheet.addCell(label);
BlockValues b = new BlockValues(); //為了要輸出總共有幾種blocks
for(int i=2, j=0 ; j<b.blockLength ; i++, j++){
label = new Label(i, 0, b.blockValues[j]);
writeSheet.addCell(label); //將blocks的種類名字寫入sheet
}
for(int i=0, x=1; i<trainSet.size() ; i++, x++){ //輸入每一筆火車的資料
label = new Label(0, x, trainSet.get(i).inBoundTrainId);
writeSheet.addCell(label); //寫入火車編號
label = new Label(1, x, trainSet.get(i).arrivalTime);
writeSheet.addCell(label); //寫入到達時間
for(int j=0, y=2 ; j<b.blockLength ; j++, y++){ //寫入車廂種類數量
label = new Label(y, x, countBlocks(b.blockValues[j], trainSet.get(i)));
writeSheet.addCell(label);
}
label = null;
}
writeWorkBook.write(); //最後的最後,在一次將資料寫入檔案內即可,這是一次性寫入,第二次寫入會無效
writeWorkBook.close(); //關檔是好習慣
} catch (IOException e) {
e.printStackTrace();
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
} |
3660148a-18a4-405f-b687-c5586d2d99bb | 4 | public void draw(Graphics g) {
game.screen.clear();
double xScroll = game.player.getX() - game.screen.width / 2;
double yScroll = game.player.getY() - game.screen.height / 2;
game.level.render((int) xScroll, (int) yScroll, game.screen);
for (int i = 0; i < game.pixels.length; i++) {
game.pixels[i] = game.screen.pixels[i];
}
g.drawImage(game.image, 0, 0, game.getWidth(), game.getHeight(), null);
game.screen.hud.draw(g);
if (game.debug) {
g.setColor(new Color(255, 255, 255, 75));
int xPos = 10;
g.fillRect(0, 0, 200, debug.length * 16);
g.setColor(new Color(0, 0, 0));
for (int i = 0; i < debug.length; i++) {
if (debug[i] != null) g.drawString(debug[i], xPos, 18 + (14 * i));
}
}
} |
e1aa17a0-e009-438f-b69b-4e2fb7ea9bd9 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
JList list = (JList) o;
if (getId() != null ? !getId().equals(list.getId()) : list.getId() != null) return false;
return true;
} |
8cd924c1-9f7b-4874-87ec-cdce21efea2a | 6 | public void removeDegreeFromStudent(int studentId, int degreeId) {
if(!isValidId(studentId) || !isValidId(degreeId)) {
return;
}
Student student = studentDao.getStudent(studentId);
Set<Degree> degrees = student.getDegrees();
if (student != null && degrees != null) {
for (Degree degree : degrees) {
if (degree.getId() == degreeId) {
degrees.remove(degree);
}
}
student.setDegrees(degrees);
studentDao.saveStudent(student);
}
} |
8d6d6b05-3d76-4d6a-8c94-6b94998d0a53 | 0 | public int size()
{
return accounts.length;
} |
6fb5d64e-9386-4ff9-b4a2-26039ba0f276 | 8 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.BLUE
+ "-----------------------------------------------------");
sender.sendMessage(ChatColor.GOLD + "Developed by: "
+ ChatColor.GRAY + "Staartvin");
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.GRAY
+ plugin.getDescription().getVersion());
sender.sendMessage(ChatColor.YELLOW
+ "Type /scroll help for a list of commands.");
return true;
} else if (args[0].equalsIgnoreCase("give")) {
return new GiveCommand(plugin).onCommand(sender, cmd, label, args);
} else if (args[0].equalsIgnoreCase("help")) {
if (args.length == 1) {
showHelpPage(1, sender);
return true;
} else {
Integer id = -1;
try {
id = Integer.parseInt(args[1]);
} catch (Exception e) {
sender.sendMessage(ChatColor.RED
+ (args[1] + " is not a valid page number!"));
return true;
}
showHelpPage(id, sender);
return true;
}
} else if (args[0].equalsIgnoreCase("reload")) {
return new ReloadCommand(plugin).onCommand(sender, cmd, label, args);
} else if (args[0].equalsIgnoreCase("create")) {
return new CreateCommand(plugin).onCommand(sender, cmd, label, args);
} else if (args[0].equalsIgnoreCase("set")) {
return new SetCommand(plugin).onCommand(sender, cmd, label, args);
}
sender.sendMessage(ChatColor.RED + "Command not recognised!");
sender.sendMessage(ChatColor.YELLOW + "Type '/scroll help' for a list of commands.");
return true;
} |
91a2110b-1438-46fa-b6f3-49609436d882 | 2 | public void setHour(int h){
//checks to see if h is less than or equal to one
//and it checks to see if its less than 24 and if
//both requirements are meant than the integer can remain the same
//value but if it doesn't than we set it to zero.
hour = ((h >= 0 && h<24) ? h : 0);
} |
bfc71472-7547-484b-a843-475887057949 | 7 | public void killHappenedAt(PointI p, int mobSize, boolean wasSplashDamage){
if((p.x < 0) || (p.y < 0) || (p.x >= w) || (p.y >= h)) return;
double amount = 1f / mobSize / mobSize;
for(int y=0; y<mobSize; y++){
for(int x=0; x<mobSize; x++){
if(wasSplashDamage){
splashKillCounts[p.y + y][p.x + x] += amount;
} else {
normalKillCounts[p.y + y][p.x + x] += amount;
}
}
}
} |
8c9fee77-287d-42a3-b5c5-8fe54251557e | 3 | @EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
if(player.hasPermission("EasyPvpKits.Admin") && Main.update)
{
if(plugin.getConfig().getBoolean("options.auto-update-onlogin-notice"))
{
player.sendMessage(ChatColor.GREEN + "An update is available: " + Main.name + ", a " + Main.type + " for " + Main.version + ".");
player.sendMessage(ChatColor.GOLD + "Type /update if you would like to automatically update.");
}
}
} |
2a649969-b5e9-471b-8ac9-bac1d8aeb727 | 9 | public void load()
{
bans = new HashMap<String, Long>();
ipBans = new LinkedList<String>();
mutes = new HashMap<String, Long>();
persistMutes = false;
broadcastKick = false;
broadcastMute = false;
broadcastBan = false;
muteLimit = 0;
banLimit = 0;
try
{
// load bans
String banString = instance.getConfig().getString("bans");
if (banString.length() > 0)
{
// if we recovered an error here, set node
if (decodeList(bans, banString.split(",")))
save("bans", bansString());
}
// load IP bans
String ipBanString = instance.getConfig().getString("ipbans");
if (ipBanString.length() > 0)
ipBans.addAll(Arrays.asList(ipBanString.split(",")));
// load setting to persist mutes through sessions or not
persistMutes = instance.getConfig().getBoolean("persist-mutes", false);
// if we are persisting mutes, load pre-existing ones
if (persistMutes)
{
String muteString = instance.getConfig().getString("mutes");
if (muteString.length() > 0)
{
// if we recovered an error here, set node
if (decodeList(this.mutes, muteString.split(",")))
save("mutes", mutesString());
}
}
// make sure broadcast path is in config
if (!instance.getConfig().contains("broadcast"))
{
configGen.genBroadcast();
instance.saveConfig();
}
// load broadcast settings
broadcastKick = instance.getConfig().getBoolean("broadcast.kick");
broadcastMute = instance.getConfig().getBoolean("broadcast.mute");
broadcastBan = instance.getConfig().getBoolean("broadcast.ban");
// make sure limit path is in config
if (!instance.getConfig().contains("limit"))
{
configGen.genLimit();
instance.saveConfig();
}
// load limit settings
muteLimit = instance.getConfig().getInt("limit.mute");
banLimit = instance.getConfig().getInt("limit.ban");
}
// config file couldn't be read
catch (NullPointerException npe)
{
// generate new config
instance.getLogger().warning("Null when loading config, generating new config!");
instance.getLogger().log(Level.FINEST, "NPE when loading config.", npe);
configGen.genConfig();
instance.saveConfig();
}
} |
8dc497cc-9e8f-4d1d-baae-9779738605f3 | 3 | public void shapeImageToPixels(int x, int y, int height, int originalPixels[], int ai[], int j, int k, int i1, int l1, int i2) {
try {
int j2 = -l1 / 2;
int k2 = -height / 2;
int l2 = (int) (Math.sin((double) j / 326.11000000000001D) * 65536D);
int i3 = (int) (Math.cos((double) j / 326.11000000000001D) * 65536D);
l2 = l2 * k >> 8;
i3 = i3 * k >> 8;
int j3 = (i2 << 16) + (k2 * l2 + j2 * i3);
int k3 = (i1 << 16) + (k2 * i3 - j2 * l2);
int offset = x + y * RSDrawingArea.width;
for (y = 0; y < height; y++) {
int i4 = originalPixels[y];
int j4 = offset + i4;
int k4 = j3 + i3 * i4;
int l4 = k3 - l2 * i4;
for (x = -ai[y]; x < 0; x++) {
RSDrawingArea.pixels[j4++] = myPixels[(k4 >> 16) + (l4 >> 16) * myWidth];
k4 += i3;
l4 -= l2;
}
j3 += l2;
k3 += i3;
offset += RSDrawingArea.width;
}
} catch (Exception _ex) {
}
} |
a059bfdf-4aeb-45e9-a2ab-8eda239593f7 | 6 | private float grad(int hashCode, float x, float y, float z) {
// Convert lower 4 bits of hash code into 12 gradient directions
int h = hashCode & 15;
float u = h < 8 ? x : y;
float v = h < 4 ? y : h == 12 || h == 14 ? x : z;
return (((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v));
} |
148bd2b3-35aa-4d89-b92b-df5ffd48c11e | 4 | private int locateLineByKey( String key ) {
if( key == null )
return -1;
// Search current line.
for( int i = 0; i < this.list.size(); i++ ) {
HTTPHeaderLine line = this.list.get(i);
if( line.getKey() != null && line.getKey().equalsIgnoreCase(key) ) {
return i;
}
}
return -1;
} |
9b410e7f-5fb1-4494-9513-0e92968acdbf | 8 | protected void drawData(Graphics g) {
if (graphValues == null) return;
g.setColor(color);
int X, Y;
int xval, yval;
for (int i = 0; i < graphBuffer.getRows(); i++) {
xval = graphValues[0][i];
yval = graphValues[1][i];
if (xval != graphBuffer.getInvalidNumber()) {
if (yval != graphBuffer.getInvalidNumber()) {
// do not plot "out of range" values
if (xval < xmin || xval > xmax || yval < ymin || yval > ymax) continue;
X = computeX(xval);
Y = computeY(yval);
g.drawLine(X-2, Y, X+2, Y);
g.drawLine(X, Y-2, X, Y+2);
}
}
}
} |
ac01e175-a4bf-44b8-876e-f1fb5cad70f1 | 1 | public static MultiChoiceMultiAnswerQuestion getQuestionByQuestionID(int questionID) {
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, questionID);
ResultSet rs = stmt.executeQuery();
rs.next();
ArrayList<String> questionStringList = getParsedStrings(rs.getString("question"));
ArrayList<String> answerStringList = getParsedStrings(rs.getString("answer"));
MultiChoiceMultiAnswerQuestion q = new MultiChoiceMultiAnswerQuestion(
rs.getInt("questionid"), rs.getInt("quizid"), rs.getInt("position"),
questionStringList, answerStringList, rs.getDouble("score"));
rs.close();
return q;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
} |
9a8dc2ee-3b8d-4b1e-b163-0aa28b6ff9f8 | 4 | public String getTripleObjectByPredicate( Vector<Vector<String>> triple_list, String predicate)
{
for(int i=0; i<triple_list.size() ;i++)
{ Vector<String> t = triple_list.get(i);
if( t != null )
if( t.get(1)!=null && ((String)t.get(1)).equals(predicate))
{return t.get(2);}
}
return null;
}//public String getTripleObjectByPredicate( triple, uris.daysURI) ) |
fbdde29b-e7b9-4a15-8c9b-2e38e4c1a96d | 9 | public boolean isAllowed(final Player player, final Location target) {
if (player.hasPermission("simpleregions.override.protection")) return true;
boolean found = false;
// check loaded regions, return true if any region allows access
for (final Region region : this.cached(target.getWorld(), target.getBlockX() >> 4, target.getBlockZ() >> 4))
if (region.contains(target)) {
if (region.hasAccess(player)) return true;
found = true;
}
// if at least one loaded region was found, that indicates all applicable regions would have been found in loaded
if (found) return false;
// check world default region only if no other regions apply
final Region worldDefault = this.indices.get(target.getWorld().getName()).worldDefault;
if (worldDefault != null && worldDefault.active)
return this.indices.get(target.getWorld()).worldDefault.hasAccess(player);
// check server default region only if no other regions apply and there is no world default region
if (this.serverDefault != null && this.serverDefault.active)
return this.serverDefault.hasAccess(player);
return false;
} |
6785b861-1e78-497b-b44c-ed98b6bdb271 | 0 | public static ParticipantListJsonConverter getInstance() {
return instance;
} |
eece953a-293b-4be6-a347-9995b09811d4 | 5 | public static void ordTilFil(ArrayList<Innlegg> minListe)
{
Formatter output = null;
try
{
//For å skrive til fil må jeg bruke klassen FileWriter
FileWriter fileWriter = new FileWriter("laerersord.txt", true);
output = new Formatter (fileWriter);//åpner fila laerersord.txt for skriving, hvis den ikke finnes, opprettes den
}
//Oppretter feilmeldinger slik at hvis programmet ikke finner filen, kommer det en feilmelding som sier det, istedenfor errorer
catch ( SecurityException securityException )
{
JOptionPane.showMessageDialog(null, "", "Du har ikke skriverettigheter til denne fila", JOptionPane.PLAIN_MESSAGE );
System.exit( 1 ); // avslutter programmet
}
catch ( FileNotFoundException fileNotFoundException )
{
JOptionPane.showMessageDialog(null, "", "Feil ved åpning av fila", JOptionPane.PLAIN_MESSAGE );
System.exit( 1 ); // avslutter programmet
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (Innlegg detteInnlegget : minListe){
System.out.println(detteInnlegget.getNorskOrd());
System.out.println(detteInnlegget.getEngelskOrd());
System.out.println(detteInnlegget.getNivaa());
output.format("%s %s %d \r\n ", detteInnlegget.getNorskOrd(), detteInnlegget.getEngelskOrd(), detteInnlegget.getNivaa());
}
//Lukker filen
if ( output != null){
output.close();
}
} |
129ae217-bd5c-4c60-8ade-3b4b03bba162 | 3 | public boolean canJump() {
boolean jump = true;
int jx = (int) x / 16;
int jy = (int) y / 16;
for (int i = 0; i < 4; i++) {
if (level.getTile(jx, jy - i).solid()) jump = false;
}
if (!doJump) jump = false;
return jump;
} |
353c19d9-a996-4a16-abdf-8bbbae27d4af | 2 | @Subscribe
public void childrenInput(EventInput eventInput) {
if (active)
if (eventInput instanceof EventMouse)
childBus.post(eventInput);
} |
b2d6f8b7-842a-4d18-8302-4a34170c0fb8 | 9 | public Food(int initX, int initY, int initOption) {
super(initX, initY, initOption);
foodType = type.values()[initOption];
switch (foodType) {
case YUKKURIFOOD:
amount = 100*24*24;
imageType = FOOD_NOT_EMPTY_NORMAL;
break;
case BITTER:
amount = 100*24*24;
imageType = FOOD_NOT_EMPTY_BITTER;
break;
case LEMONPOP:
amount = 100*24*24;
imageType = FOOD_NOT_EMPTY_LEMON;
break;
case HOT:
amount = 100*24*24;
imageType = FOOD_NOT_EMPTY_HOT;
break;
case VIYUGRA:
amount = 100*24*24;
imageType = FOOD_NOT_EMPTY_VIYUGRA;
break;
case STALK:
amount = 100*24*2;
imageType = STALK;
break;
case SWEETS1:
amount = 100*24*4;
imageType = SWEETS_NORMAL;
break;
case SWEETS2:
amount = 100*24*4;
imageType = SWEETS_HIGH;
break;
case WASTE:
amount = 100*24*32;
imageType = WASTE;
break;
default:
amount = 100*24*24;
imageType = 0;
break;
}
setBoundary(boundary[imageType]);
setCollisionSize(getPivotX(), getPivotY());
objEXList.add(this);
objType = Type.OBJECT;
objEXType = ObjEXType.FOOD;
removed = false;
} |
595c62f8-0539-4c5b-a367-9cdb646ccff4 | 0 | public static void main(String [] args) {
//NeuralNet n = new NeuralNet();
/* First demonstrate how the layout looks with just one neuron. */
/* Output neuron uses a linear function, f=x^(1). */
//n.setOutputNeuron(new Neuron(new PolynomialTerm(1)));
/* Add inputs. */
/*for(int i = 0; i < 3; i++) {
n.addInputNeuron(new Neuron(new PrimaryInput("Input"+i)));
}
int counter = 0;
while(true) {
if(counter%1000==0)
System.out.println(n.getOutputNeuron());
DataPoint dp = new DataPoint();
double i = Math.random();
double j = Math.random();
dp.addFeature("Input0", i);
dp.addFeature("Input1", j);
dp.addFeature("Input2", 0);
dp.setExpected(i*2+3+j);
n.learn(dp);
counter+=1;
}
*/} |
9f2b6d34-456a-493e-a444-224537861211 | 7 | public boolean pickAndExecuteAnAction() {
try{
for(int j = 0; j < Waiters.size(); j++){
//print("" +Waiters.get(j).ws);
if(Waiters.get(j).ws == WaiterState.wantToGoOnBreak){
answerWaiter(Waiters.get(j));
return true;
}
}
for (Table table : tables) {
if (!table.isOccupied()) {
for(int i = 0; i < theCustomers.size(); i++){
if(theCustomers.get(i).s == CustomerState.waiting){
AssignWaiter(theCustomers.get(i), table);//the action
return true;//return true to the abstract agent to reinvoke the scheduler.
}
}
}
}
return false;
}
catch(ConcurrentModificationException e){
return false;
}
//we have tried all our rules and found
//nothing to do. So return false to main loop of abstract agent
//and wait.
} |
7fa5d045-ddba-47bc-b86d-b1399d53061a | 3 | public static boolean inMap(int x, int y)
{
return x >= 0 && y >= 0 && x < map.width && y < map.height;
} |
0f5bf88b-c60a-46f4-8b4a-1f6d3fbc9052 | 9 | public ArrayList<String> playerCardString(){
ArrayList<String> displayedCards = new ArrayList<String>();
/*if(playerInputArrayInts==null){
return "player inputs are null";
}
if(shuffle==null){
return "shuffle is null";
}
if(deck==null){
return "deck is null";
}*/
//make the size of the array based on how many times we shuffle
//place holder to where to insert the statement
if (shuffle=="shuffle once before dealing" || shuffle == "shuffle after every set of cards is dealt"){
deck.shuffle();
displayedCards.add("deck shuffled\n");
}
if(hands==null)
hands=new Hand[numHands];
for(int i=0; i<numHands;i++){
if (playerInputArrayInts[i]<0||playerInputArrayInts[i]>53)
playerInputArrayInts[i]=5;
if(hands[i]==null){
hands[i]= new Hand();
}
hands[i].addtoHand(playerInputArrayInts[i], deck);
displayedCards.add("\n" +"Player "+ (i+1)+ "/" +numHands+ ": "+ hands[i]+"\n");
if(shuffle=="shuffle after every set of cards is dealt"){
deck.shuffle();
displayedCards.add("\ndeck shuffled\n");
}
}
displayedCards.add("\n\n"+deck);
if(deck.getDeck().size()<=0){
displayedCards.add("\nNo more cards to distribute. Click Submit/Reset button to reset the deck and play again.");
}
return displayedCards;
} |
2b524fcc-50ad-4aec-a1e2-1c92564570a0 | 3 | public Point locationOf(Tile t) {
for (int y = bounds.y; y < bounds.height + bounds.y; y++) {
for (int x = bounds.x; x < bounds.width + bounds.x; x++) {
if (getTileAt(x, y) == t) {
return new Point(x, y);
}
}
}
return null;
} |
5c8e1458-fefb-4020-8943-b76a03a909c3 | 2 | public void print() {
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
System.out.printf("%9.4f ", data[i][j]);
}
System.out.println();
}
} |
1cbeacfa-b04e-40e8-a90d-47f6a98f9e96 | 2 | private static boolean trailingZeroesCheck(int a, int b) {
//cast both to string and convert to char array
char[] charsA = ("" + a).toCharArray();
char[] charsB = ("" + b).toCharArray();
if (charsA[1] == 0 && charsB[1] == 0) return false;
else return true;
} |
d8e0b380-57df-4cf0-ac0a-b5070b37ddc3 | 8 | public Response handle(Request r) {
// first of all, file requests or plugins should always be okay
// plugins allowed basically so I can reset mediatomb if it died
if (r.getPage().equals(STServer.FILES) ||
r.getPage().equals(STServer.PLUGINS))
return super.handle(r);
Response resp = new Response();
// set the content type for PS3 to be happy
// it's not a file, so it should be html!
resp.setContentType("text/html");
// make sure we have a profile!
if (!Profile.getInstance().isSelected() &&
specificHandler(STServer.PROFILE_SELECT, r, "display Profile Select page", resp)) {
return resp;
}
// check for a static message (eg: reloading)
synchronized(isStatic) {
if (isStatic && specificHandler(STServer.STATIC_MESSAGE, r,
"display Static Message page", resp)) {
return resp;
}
}
// make sure we know the user
if (!Profile.getInstance().fillUser(r) &&
specificHandler(STServer.USER_SELECT, r, "request a user", resp)) {
return resp;
}
// default actions
return super.handle(r);
} |
3f66310b-cc9e-43e6-a84b-ab94f460e7f3 | 2 | private boolean hunt(Position preyPosition) {
FieldItem prey = field.get(preyPosition);
char preyType = field.getItemType(preyPosition);
if (field.shot(preyPosition)) {
field.removeItem(prey, preyPosition);
if (preyType == 'D') {
return true;
}
}
return false;
} |
0e21b0eb-3889-43f2-a039-f52ab6f27a52 | 4 | public Attribute set(Map<String, String> map, ValueVisitor visitor) {
Set<String> keys = map.keySet();
Class<?> clazz = getClass();
for (String key : keys) {
String value = map.get(key);
try {
Field field = SpringReflectionUtils.findField(clazz, key);
field.setAccessible(true);
field.set(this, visitor.target(field.getType(), value, null));
} catch (IllegalArgumentException e) {
throw ExceptionFactory.wrapException("argument exception!", e);
} catch (IllegalAccessException e) {
throw ExceptionFactory
.wrapException("permission exception!", e);
}
}
return this;
} |
7fb62dcc-e579-4b9d-974e-11b68c9ebdf7 | 6 | public String[] sendNameSearch(String s) throws IOException{
String str = new String("namesearch"+ "," + s );
System.out.println(str);
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostException e1) {
e1.printStackTrace();
}
Socket socket = null;
try {
System.out.println("sending name search server");
socket = new Socket(serverAddr, GlobalV.sendingPortLogin);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
PrintWriter out = null;
try {
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
out.println(str);
System.out.print("namesearch sent");
BufferedReader in = null;
try {
in = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String input = " ";
try {
input = in.readLine();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String[] user_info = new String[3];
user_info[0]=" ";
System.out.println(input);
user_info = input.split(",");
socket.close();
return user_info;
} |
3464e4cc-f855-47f7-b1ea-7f02703461f4 | 2 | public static Quiz[] getQuizzes()
{
try {
String query = String.format("SELECT * FROM QUIZ");
ResultSet rs = getQueryResults(query);
List<Quiz> quizzes = new ArrayList<Quiz>();
while (rs.next())
{
Quiz q = new Quiz(rs.getString("QUIZTITLE"), rs.getInt("QUIZID"));
q.timeLimit = rs.getInt("TimeAllowed");
q.available = rs.getBoolean("Available");
q.feedbackAvailable = rs.getBoolean("FeedbackAvailable");
q.timeOutBehaviour = rs.getInt("TimeOutBehaviour");
q.showPracticeQuestion = rs.getBoolean("ShowPracticeQuestion");
q.navigationEnabled = rs.getBoolean("NAVIGATIONENABLED");
q.randomiseQuestions = rs.getBoolean("RANDOMISEQUESTIONS");
quizzes.add(q);
}
return quizzes.toArray(new Quiz[quizzes.size()]);
}
catch(SQLException se)
{
return null;
}
} |
091dc8d6-161e-43b3-a55f-f3409627c0a0 | 3 | public int hashCode() {
int firstHashCode = (first == null ? 0 : first.hashCode());
int secondHashCode = (second == null ? 0 : second.hashCode());
if (firstHashCode != secondHashCode) {
return (((firstHashCode & secondHashCode) << 16) ^ ((firstHashCode | secondHashCode)));
} else {
return firstHashCode;
}
} |
cf6c6d1b-5c53-4d20-bed7-3bb68fe64467 | 1 | public int opponent(int player) {
return player == PLAYER1 ? PLAYER2 : PLAYER1;
} |
4a03d6b6-958a-4718-b3bc-da2fe338619a | 3 | public void setIdentificador(TIdentificador node)
{
if(this._identificador_ != null)
{
this._identificador_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._identificador_ = node;
} |
6c9bf823-eb9b-4ea2-8c0f-aeca41044987 | 1 | public void setDay(int day) {
if (day <= 31 & day >= 0)
this._day = day;
else
this._day = 0;
this._set = true;
} |
001a0343-4e28-4909-8338-888167632439 | 0 | public void setSkills(List<SkillRating> skills) {
this.skills = skills;
} |
30eb7e62-06bb-43ba-a9d3-1262da6e8720 | 9 | public void synchronizeEconomyPlayer(UUID uuid) {
try {
List<Map<String, Object>> results = db.getResults("SELECT * FROM " + Economy.ecoPlayerTable + " WHERE uuid = '" + uuid.toString() + "';");
for (int i = 0; i < results.size(); i++) {
EconomyPlayer eco = new EconomyPlayer();
for (Map.Entry<String, Object> entry : results.get(i).entrySet()) {
if (entry.getKey().equals("uuid")) {
eco.setUser(UUID.fromString(entry.getValue().toString()));
} else if(entry.getKey().equals("cash")) {
eco.setCash(Double.valueOf(entry.getValue().toString()));
} else if(entry.getKey().equals("totalgiven")) {
eco.setTotalGiven(Double.valueOf(entry.getValue().toString()));
} else if(entry.getKey().equals("totalreceived")) {
eco.setTotalReceived(Double.valueOf(entry.getValue().toString()));
} else if(entry.getKey().equals("totaldonated")) {
eco.setTotalDonated(Double.valueOf(entry.getValue().toString()));
} else if(entry.getKey().equals("welfare")) {
boolean b = ((Boolean) entry.getValue()).booleanValue();
eco.setWelfareStatus(b);
}
}
Economy.ePlayers.put(eco.getUser(), eco);
}
} catch(Exception e) {
e.printStackTrace();
}
} |
44bbf11e-96d5-4876-b4d1-f460e0f81f4d | 5 | @Override
public void gibFehlerAus(ServerKontext kontext, Spieler spieler,
Befehlszeile befehlszeile)
{
Raum raum = kontext.getAktuellenRaumZu(spieler);
if(!spieler.getInventar().hasAnyKuchen())
{
kontext.schreibeAnSpieler(spieler, TextVerwalter.MAUS_KEIN_KRUEMEL);
}
else if(!raum.hasKatze() && !raum.hasMaus())
{
kontext.schreibeAnSpieler(spieler,
TextVerwalter.BEFEHL_FUETTERE_NICHTS_DA_ZUM_FUETTERN);
}
else if(raum.hasKatze() && raum.getKatze().isSatt())
{
kontext.schreibeAnSpieler(spieler,
TextVerwalter.KATZE_HAT_KEINEN_HUNGER);
}
} |
7a2f4173-8f98-4f21-912b-5d48e50f98d8 | 2 | public static double asech(double a){
if(a>1.0D || a<0.0D) throw new IllegalArgumentException("asech real number argument (" + a + ") must be >= 0 and <= 1");
return 0.5D*(Math.log(1.0D/a + Math.sqrt(1.0D/(a*a) - 1.0D)));
} |
82135585-0914-4026-a814-d0aac358595f | 6 | public void runMainActivityWithTestInput(LinkedList<String> userInput) {
int inputCounter = 0;
boolean run = true;
Main.giveMain().setDmPhase(new DMPhase());
do {
if(Main.giveMain().getPhase() instanceof ASRPhase) {
System.out.print("Your next Input:");
Main.giveMain().setAsrResult(userInput.get(inputCounter));
System.out.println(userInput.get(inputCounter));
inputCounter++;
if(inputCounter == userInput.size()) {
run = false;
}
Main.giveMain().setPhase(new NLUPhase());
} else {
Main.giveMain().getPhase().setPhaseResult(Main.giveMain());
Main.giveMain().setPhase(Main.giveMain().getPhase().nextPhase(Main.giveMain()));
}
if(Main.giveMain().getPhase() instanceof TTSPhase) {
nlgResults.add(Main.giveMain().getNlgResult());
} else if (Main.giveMain().getPhase() instanceof NLGPhase) {
dmResults.add(Main.giveMain().getDmResult().getOutputKeyword());
}
}
while(run || !(Main.giveMain().getPhase() instanceof ASRPhase));
} |
95bafa3d-6a9b-4f5b-9a22-65b77d0cf7e0 | 9 | public final void setVideoFileTempDimensions(Dimension size) {
if (size.width <= 0 && size.height <= 0) return;
Dimension fullSize = this.getVideoFileSourceDimensions();
if (fullSize.width <= 0 && fullSize.height <= 0) return;
Dimension newSize = new Dimension(size);
if (newSize.width <= 0) {
newSize.width = newSize.height * fullSize.width / fullSize.height;
}
else if (newSize.height <= 0) {
newSize.height = newSize.width * fullSize.height / fullSize.width;
}
boolean trigger = false;
synchronized (this.videoFileTempLock) {
if (this.videoFileTempDimensions.width != newSize.width || this.videoFileTempDimensions.height != newSize.height) {
this.videoFileTempDimensions.width = newSize.width;
this.videoFileTempDimensions.height = newSize.height;
trigger = true;
}
}
if (trigger) {
this.clearVideoFileTemp();
}
} |
ab64a93f-5837-45ed-8a6c-c0f18a2c65c7 | 0 | ThumbNailCanvas(DrawableItemController dicon) {
items = new ArrayList<>();
//panels =new ArrayList<>();
dic = dicon;
} |
255cefd1-f990-40f5-b06c-159cdcd66453 | 2 | public DataBase(final String dbDirectory, final TableProvider newProvider, final List<Class<?>> newTypes)
throws IOException {
name = new File(dbDirectory).getName();
dataBaseDirectory = dbDirectory;
provider = newProvider;
if (newTypes != null) {
types = newTypes;
MySignature.setSignature(dataBaseDirectory, types);
} else {
types = MySignature.getSignature(dataBaseDirectory);
}
isCorrect();
files = new DataBaseFile[256];
loadFiles();
} |
407214b2-3b2d-49fe-8e32-7b8791a55f1b | 6 | private void movement() {
if (y <= 0)
vy = speed;
if (y >= cs.getHeight() - height)
vy = -speed;
if (x <= 0) { // If hits left side (Player)
vx = speed;
cs.clientScore++;
}
if (x >= cs.getWidth() - width) { // If hits right side (AI)
vx = -speed;
cs.serverScore++;
}
x += vx;
y += vy;
if (this.intersects(cs.serverRect)) {
vx = speed;
}
if (this.intersects(cs.clientRect)) {
vx = -speed;
}
} // End movement |
2c95df4a-638e-4427-a6f0-84fdb43712ad | 0 | @Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "CTR_ID")
public int getIdPosControlTransacciones() {
return idPosControlTransacciones;
} |
f930bd8c-a89f-40c3-857b-45b97cc6a8f6 | 5 | private void field_cuit3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_cuit3FocusLost
if(field_cuit3.isEditable()){
String cuit1=field_cuit1.getText();
String cuit2=field_cuit2.getText();
String cuit3=field_cuit3.getText();
if(!field_cuit2.getText().equals("")){
this.ocultar_Msj();
if(!validar.isInt(field_cuit3.getText())){
this.mostrar_Msj_Error("Debe ingresar el digitos DV correspondiente al CUIT");
field_cuit3.requestFocus();
}
if(field_cuit3.getText().equals("")){
this.mostrar_Msj_Error("El campo CUIT-DV se encuentra vacio, debe ingresar un valor");
field_cuit3.requestFocus();
}
if(validar.isCuit(cuit1,cuit2,cuit3)){
this.mostrar_Msj_Exito("El CUIT ingresado es correcto");
}
else{
this.mostrar_Msj_Error("El campo CUIT ingresado es incorrecto");
}
}
}
}//GEN-LAST:event_field_cuit3FocusLost |
0e0ba048-ac69-4e3a-9bd1-fdd6110d0965 | 3 | @Override
public void deserialize(Buffer buf) {
objectUID = buf.readInt();
if (objectUID < 0)
throw new RuntimeException("Forbidden value on objectUID = " + objectUID + ", it doesn't respect the following condition : objectUID < 0");
powerRate = buf.readShort();
overMax = buf.readBoolean();
int limit = buf.readUShort();
effects = new ObjectEffect[limit];
for (int i = 0; i < limit; i++) {
effects[i] = ProtocolTypeManager.getInstance().build(buf.readShort());
effects[i].deserialize(buf);
}
limit = buf.readUShort();
prices = new int[limit];
for (int i = 0; i < limit; i++) {
prices[i] = buf.readInt();
}
} |
7edd5537-4e35-4354-93df-0b324f5f0457 | 7 | @Override
public void update(){
// if(guiDisplaying instanceof GuiHud)
// System.out.println(GameTime);
if(backGrounds != null && !backGrounds.isEmpty())
for(Background bg : backGrounds)
bg.update();
handleInput();
tileMap.setPosition((GamePanel.WIDTH / 2) - player.getScreenXpos(),(GamePanel.HEIGHT / 2) - player.getScreenYpos());
if((guiDisplaying instanceof GuiHud)){
// GameTime++;
//
// if(GameTime >= 32000){
// GameTime = 0;
// }
//TODO put night time back into the game
if(isNightTime())
SpawningLogic.spawnNightCreatures(this);
player.update();
for(MapObject obj : listWithMapObjects){
obj.update();
if(obj.remove){
listWithMapObjects.remove(obj);
break;
}
}
}
} |
37dbda15-306f-492a-a3c9-a2a324c946d7 | 5 | void invoerNieuwePersoon() {
Geslacht geslacht = null;
while (geslacht == null) {
String g = readString("wat is het geslacht (m/v)");
if (g.toLowerCase().charAt(0) == 'm') {
geslacht = Geslacht.MAN;
}
if (g.toLowerCase().charAt(0) == 'v') {
geslacht = Geslacht.VROUW;
}
}
String[] vnamen;
vnamen = readString("voornamen gescheiden door spatie").split(" ");
String tvoegsel;
tvoegsel = readString("tussenvoegsel");
String anaam;
anaam = readString("achternaam");
Calendar gebdat;
gebdat = readDate("geboortedatum");
String gebplaats;
gebplaats = readString("geboorteplaats");
Gezin ouders;
toonGezinnen();
String gezinsString = readString("gezinsnummer van ouderlijk gezin");
if (gezinsString.equals("")) {
ouders = null;
} else {
ouders = getAdmin().getGezin(Integer.parseInt(gezinsString));
}
getAdmin().addPersoon(geslacht, vnamen, anaam, tvoegsel, gebdat,
gebplaats, ouders);
File f = new File("serializaedadmin");
try
{
controller.serialize(f);
} catch(IOException exc) {
exc.fillInStackTrace();
}
} |
42a429b2-570d-4a15-a542-b5f2ced01769 | 1 | private void calculatePercentages() {
metalPercentages = new double[3];
double point1, point2, larger, smaller;
point1 = Math.random();
point2 = Math.random();
if (point1 < point2) {
larger = point2;
smaller = point1;
} else {
larger = point1;
smaller = point2;
}
metalPercentages[0] = smaller;
metalPercentages[1] = larger - smaller;
metalPercentages[2] = 1.00 - larger;
} |
67c2d347-cb7d-4af0-b8e8-c8165f723cc7 | 6 | public static TreeNode initSyTree(int i,boolean isSy){
/**
* 1
/ \
2 2
/ \ / \
3 4 4 3
*/
TreeNode root = new TreeNode(1);
if(isSy){
//symmertric
if(i==1){
/*
1
2 2
*/
TreeNode l = new TreeNode(2);
TreeNode r = new TreeNode(2);
root.left=l;
root.right = r;
}else if(i==2){
/**
* 1
* 2 2
* x 3 3 x
*/
TreeNode l = new TreeNode(2);
TreeNode r = new TreeNode(2);
root.left=l;
root.right = r;
TreeNode lr = new TreeNode(3);
TreeNode rl = new TreeNode(3);
l.right = lr;
r.left = rl;
}else if(i==3){
/*
1
/ \
2 2
/ \ / \
3 4 4 3
*/
TreeNode l = new TreeNode(2);
TreeNode r = new TreeNode(2);
root.left=l;
root.right = r;
TreeNode ll = new TreeNode(3);
TreeNode lr = new TreeNode(4);
l.left = ll;
l.right =lr;
TreeNode rl = new TreeNode(4);
TreeNode rr = new TreeNode(3);
r.left = rl;
r.right = rr;
}
}else{
/**
1
2
sy false
*/
if(i==0){
TreeNode l = new TreeNode(2);
root.left=l;
}else if(i==1){
/**
* [1,2,3,3,null,2,null]
* 1
* 2 3
* 3 x 2 x
* mid order 3 2 1 2 3
* af invert
* 1
* 3 2
* x 2 x 3
* mid order 3 2 1 2 3
*/
}
}
return root;
} |
ac1ac603-9665-4f64-b1b8-dc59e3472685 | 3 | public static SearchResponse intersect(SearchResponse s1, SearchResponse s2) {
Map<Integer, RendezVous> m1 = s1.getWordIndex().getMeetings();
Map<Integer, RendezVous> m2 = s2.getWordIndex().getMeetings();
Map<Integer, RendezVous> mResult = new HashMap<>();
for (Integer file : m1.keySet()) {
RendezVous rv2 = m2.get(file);
if (rv2 != null) { // both in file
ArrayList<Place> places1 = m1.get(file).getPlaces();
ArrayList<Place> places2 = rv2.getPlaces();
if(null != mResult.put(file, new RendezVous(file, true))) {
throw new RuntimeException("Duplicate file indexing");
}
ArrayList<Place> placesRes = mResult.get(file).getPlaces();
placesRes.addAll(places1);
placesRes.addAll(places2);
}
}
return new SearchResponse(s1.getRequest().concat(" ").concat(s2.getRequest()), new WordIndex(mResult));
} |
79e2966c-7b15-4537-95b7-7b14bae9c78b | 9 | @SuppressWarnings("unchecked")
public boolean equals(Object o){
if(o == null) return false;
if(o.getClass() == getClass()){
ShareableHashMap<K, V> other = (ShareableHashMap<K, V>) o;
if(other.currentHashCode != currentHashCode) return false;
if(other.size() != size()) return false;
if(isEmpty()) return true; // No need to check if the maps are empty.
Iterator<Map.Entry<K, V>> otherIterator = other.entryIterator();
while(otherIterator.hasNext()){
Map.Entry<K, V> entry = otherIterator.next();
V otherValue = entry.getValue();
V thisValue = get(entry.getKey());
if(otherValue != thisValue && thisValue != null && !thisValue.equals(entry.getValue())) return false;
}
return true;
}
return false;
} |
2fb05608-7be6-4b2b-82b5-a553cc9b8851 | 7 | private void registerListeners() {
getSkinnable().widthProperty().addListener(observable -> handleControlPropertyChanged("RESIZE") );
getSkinnable().heightProperty().addListener(observable -> handleControlPropertyChanged("RESIZE") );
getSkinnable().prefWidthProperty().addListener(observable -> handleControlPropertyChanged("PREF_SIZE") );
getSkinnable().prefHeightProperty().addListener(observable -> handleControlPropertyChanged("PREF_SIZE") );
getSkinnable().textProperty().addListener(observable -> handleControlPropertyChanged("TEXT") );
getSkinnable().flapColorProperty().addListener(observable -> handleControlPropertyChanged("FLAP_COLOR") );
getSkinnable().textColorProperty().addListener(observable -> handleControlPropertyChanged("TEXT_COLOR") );
getSkinnable().withFixtureProperty().addListener(observable -> handleControlPropertyChanged("WITH_FIXTURE") );
getSkinnable().darkFixtureProperty().addListener(observable -> handleControlPropertyChanged("DARK_FIXTURE") );
getSkinnable().squareFlapsProperty().addListener(observable -> handleControlPropertyChanged("SQUARE_FLAPS") );
getSkinnable().getStyleClass().addListener(new ListChangeListener<String>() {
@Override public void onChanged(Change<? extends String> change) {
resize();
}
});
rotateFlap.angleProperty().addListener(new ChangeListener<Number>() {
@Override public void changed(ObservableValue<? extends Number> ov, Number oldAngle, Number newAngle) {
if (newAngle.doubleValue() > 90) {
flapTextFront.setOpacity(0);
flapTextBack.setOpacity(1);
flap.setEffect(reversedInnerHighlight);
}
if (newAngle.doubleValue() < 90) {
// frontside text visible = true
}
}
});
timeline.setOnFinished(new EventHandler<ActionEvent>() {
@Override public void handle(final ActionEvent EVENT) {
getSkinnable().fireEvent(FLIP_FINISHED);
flap.setCache(false);
flap.setCacheShape(false);
if (Double.compare(rotateFlap.getAngle(), 180) == 0) {
flap.setEffect(innerHighlight);
rotateFlap.setAngle(0);
flapTextBack.setOpacity(0);
flapTextFront.setOpacity(1);
refreshTextCtx();
if (!getSkinnable().getText().equals(selectedSet.get(currentSelectionIndex))) {
flipForward();
}
} else if(Double.compare(rotateFlap.getAngle(), 0) == 0) {
rotateFlap.setAngle(180);
}
}
});
} |
2e8cfa34-cf24-4129-8029-68e4ac461a8a | 0 | public Color getColor() {
return color;
} |
36f6173e-850c-40e3-b346-1289c8042d2a | 6 | public static void close(ResultSet res, Statement sta, Connection con) {
if (res != null) {
try {
res.close();
} catch (Exception ex){}
}
if (sta != null) {
try {
sta.close();
} catch (Exception ex) {}
}
if (con != null) {
try {
con.close();
} catch (Exception ex) {}
}
} |
6d421db4-60d7-4456-b786-e3dc6b47a87c | 0 | private void enterScope()
{
SymbolTable table = new SymbolTable();
table.setDepth(symbolTable.getDepth() + 1);
table.setParent(symbolTable);
symbolTable = table;
} |
bd08df29-13a5-44ba-8af8-a1029ba01ba7 | 4 | public static Connection getConection() {
try {
System.out.print("Conecting with the database... ");
Class.forName("com.mysql.jdbc.Driver");
if (properties == null) {
properties = ResourceBundle.getBundle("MySQL");
host = properties.getString("host");
port = properties.getString("port");
database = properties.getString("database");
user = properties.getString("user");
password = properties.getString("password");
}
Connection con = DriverManager.getConnection(
String.format("jdbc:mysql://%s:%s/%s", host, port, database),
user, password);
System.out.println("success.");
return con;
} catch (ClassNotFoundException ex) {
System.out.println("failed.\n" + ex);
return null;
} catch (SQLException ex) {
System.out.println("failed.\n" + ex);
return null;
} catch (MissingResourceException ex) {
System.out.println("failed.\n" + ex);
return null;
}
} |
b48efad6-f4e6-4904-ae1d-06ec5f5948c9 | 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(EmpleadoForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(EmpleadoForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(EmpleadoForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(EmpleadoForm.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 EmpleadoForm().setVisible(true);
}
});
} |
e40aa0c3-b092-4fe5-ae37-b4e3fa732940 | 2 | public boolean fullRow( int row )
{
for( int i = 0; i < numRowsToClear; i++ ) {
if( rowsToClear[i] == row )
return true;
}
return false;
} |
d8bb1977-5008-4631-bdf9-6036d4735d65 | 6 | @Test
public void originTest2() {
userInput.add("hello");
userInput.add("daniel");
userInput.add("can you help me with cooking");
userInput.add("what is the origin");
userInput.add("hamburger");
userInput.add("origin");
runMainActivityWithTestInput(userInput);
assertTrue(nlgResults.get(2).contains("what") || nlgResults.get(2).contains("What")
&& nlgResults.get(3).contains("what") || nlgResults.get(3).contains("What") || nlgResults.get(3).contains("name")
&& nlgResults.get(4).contains("hamburger")
&& nlgResults.get(5).contains("USA"));
} |
987263d3-0a19-43d3-8a0d-7efa1c7b5b0a | 6 | public void paint(Board board) {
// Iterate over all Hexpos's
Set set = owner.keySet();
Iterator it = set.iterator();
int[][] binds = new int[17][9];
for (int[] row : binds)
Arrays.fill(row, -1);
while (it.hasNext()) {
Hexpos hp = (Hexpos) it.next();
if (owner.get(hp) != null) {
System.out.println(hp);
if (owner.get(hp).equals("red")) {
binds[hp.row() - 1][hp.col() - 1] = Hexxagon.RED;
} else if (owner.get(hp).equals("blue")) {
binds[hp.row() - 1][hp.col() - 1] = Hexxagon.BLUE;
} else
binds[hp.row() - 1][hp.col() - 1] = Hexxagon.BLANK;
}
}
board.updateBoard(binds);
board.setScore( getnRed() , getnBlue());
board.setPlayer(whoseTurn().equals("red") ? 1 : 2 );
} |
009db747-21bb-41b6-916f-5337d7d61bce | 9 | public boolean testByName(String testName, int testNo, boolean verbose) {
switch (testName.toLowerCase()) {
case "initial":
return testInitialFirst(testNo, verbose);
case "goal":
return testGoalLast(testNo, verbose);
case "steps":
return testValidSteps(testNo, verbose);
case "booms":
return testBoomLengths(testNo, verbose);
case "convexity":
return testConvexity(testNo, verbose);
case "areas":
return testAreas(testNo, verbose);
case "bounds":
return testBounds(testNo, verbose);
case "collisions":
return testCollisions(testNo, verbose);
case "cost":
return testTotalCost(testNo, verbose);
default:
return true;
}
} |
cfdf5e5a-7c60-423c-a06c-38fdda77287a | 7 | public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
int xOffset = player.x - (screen.width / 2);
int yOffset = player.y - (screen.height / 2);
level.renderTiles(screen, xOffset, yOffset);
for (int x = 0; x < level.Width; x++) {
int colour = 0;
if (x % 10 == 0 && x != 0) {
colour = Colours.get(-1, -1, -1, 500);
}
}
level.renderEntities(screen);
for (int y = 0; y < screen.height; y++) {
for (int x = 0; x < screen.width; x++) {
int colourCode = screen.pixels[x + y * screen.width];
if (colourCode < 255)
pixels[x + y * WIDTH] = colours[colourCode];
}
}
Graphics g = bs.getDrawGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, getWidth(), getWidth());
g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
g.dispose();
bs.show();
} |
4a3f380b-a3d9-4d09-adcd-9a996eeb7ea5 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
}
} else if (o instanceof Float) {
if (((Float) o).isInfinite() || ((Float) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
}
}
}
} |
4e1c8058-5bfb-4a90-a472-d05ecc469f32 | 4 | public void saveAs()
{
// get instance of a file chooser
TFileChooser saveDialog = GUIGlobals.PROJECT_LOAD_SAVE_DIALOG ;
saveDialog.setProjectFiler();
// prepare a filename advice
File file = TGlobal.tools.createProjectFilename(
TGlobal.projects.getCurrentProject()) ;
// defaults
if (file == null)
{
try
{
file = new File( TGlobal.projects.getCurrentProject().
getWorkingDirectory()
+ "/project.ppf" ) ;
}
catch (Exception e)
{
file = null ;
}
}
if (file != null)
{
saveDialog.setSelectedFile(file);
}
// open dialog -------
int returnVal = saveDialog.showSaveDialog() ;
if ( returnVal == JFileChooser.APPROVE_OPTION )
{
save( saveDialog.getSelectedFile() ) ;
}
} |
1249c6b4-c920-443d-9315-23b4ddfdb758 | 9 | public static void findPotentials(String data_file) {
ChainMRFPotentials p = new ChainMRFPotentials(data_file);
SumProduct sp = new SumProduct(p);
for(int i=1; i<=p.chainLength(); i++) {
double[] marginal = sp.marginalProbability(i);
if(marginal.length-1 != p.numXValues()) // take off 1 for 0 index which is not used
throw new RuntimeException("length of probability distribution is incorrect: " + marginal.length);
System.out.println("marginal probability distribution for node " + i + " is:");
double sum = 0.0;
for(int k=1; k<=p.numXValues(); k++) {
if(marginal[k] < 0.0 || marginal[k] > 1.0)
throw new RuntimeException("illegal probability for x_" + i);
System.out.println("\tP(x = " + k + ") = " + marginal[k]);
sum += marginal[k];
}
double err = 1e-5;
if(sum < 1.0-err || sum > 1.0+err)
throw new RuntimeException("marginal probability distribution for x_" + i + " doesn't sum to 1");
}
MaxSum ms = new MaxSum(p);
for(int i=1; i<=p.chainLength(); i++) {
double maxProb = ms.maxProbability(i);
System.out.println("maxLogProbability="+maxProb);
int[] assignments = ms.getAssignments();
for (int j = 1; j<assignments.length; j++) {
System.out.println("x_"+j+"="+assignments[j]);
}
}
} |
ecad7894-aeee-4f89-b137-1869baf5f98d | 1 | public static void removeFromList(CallFrame frame)
{
if(callFrameList.contains(frame))callFrameList.remove(frame);
} |
283f6c1f-888b-4a9c-a912-9a7e2ac12564 | 7 | protected void execute(String gameBehavior, AlertObject in) {
//System.out.println(gameBehavior);
for (WeakReference x : myWeakReferences) {
try {
Class[] paramClasses = gameBehaviors.get(gameBehavior).getParameterTypes();
if (paramClasses.length == 0) {
gameBehaviors.get(gameBehavior).invoke(x.get()); //An argument is not required for game behaviors
} else if(paramClasses[0].isInstance(in)) {
gameBehaviors.get(gameBehavior).invoke(x.get(), paramClasses[0].cast(in));
}
} catch (IllegalArgumentException e) {
System.out.println("Illegal Argument Exception on game method call: " + gameBehavior);
} catch (IllegalAccessException e) {
System.out.println("Illegal Access Exception on game method call: " + gameBehavior);
} catch (InvocationTargetException e) {
System.out.println("Inovaction Target Exception on game method call: " + gameBehavior);
} catch (NullPointerException e) {
System.out.println("Null Pointer Exception on game method call: " + gameBehavior);
}
}
} |
d3411e57-3bce-4be6-9dc1-53be79981814 | 4 | @Override
public int compareTo(Person t) {
if (t.equals(this)) {
return 0;
}
if (t.age != this.age) {
return this.age.compareTo(t.age);
}
if (t.name.compareToIgnoreCase(this.name) != 0) {
return t.name.compareToIgnoreCase(this.name);
}
if (t.surname.compareToIgnoreCase(this.surname) != 0) {
return t.surname.compareToIgnoreCase(this.surname);
}
return -1;
} |
0fcacf02-d94d-4098-80b7-9fb152c935c9 | 9 | final boolean method2758(int i) {
if (i < 84)
aClass206_8844 = null;
anInt8834++;
if (((OpenGlToolkit) ((Class348_Sub5) this).aHa_Sub2_6618).aBoolean7820
&& ((OpenGlToolkit) ((Class348_Sub5) this).aHa_Sub2_6618).aBoolean7783
&& ((OpenGlToolkit) ((Class348_Sub5) this).aHa_Sub2_6618).aBoolean7818) {
aClass206_8825
= new Class206(((Class348_Sub5) this).aHa_Sub2_6618);
aClass258_Sub3_8835
= new Class258_Sub3(((Class348_Sub5) this).aHa_Sub2_6618, 3553,
34842, 256, 256);
aClass258_Sub3_8835.method1965(false, false, 10243);
aClass258_Sub3_8830
= new Class258_Sub3(((Class348_Sub5) this).aHa_Sub2_6618, 3553,
34842, 256, 256);
aClass258_Sub3_8830.method1965(false, false, 10243);
((Class348_Sub5) this).aHa_Sub2_6618.method3773(-1,
aClass206_8825);
aClass206_8825.method1509(aClass258_Sub3_8835, 0, 0);
aClass206_8825.method1509(aClass258_Sub3_8830, 0, 1);
aClass206_8825.method1503(0, (byte) 3);
if (!aClass206_8825.method1507(124)) {
((Class348_Sub5) this).aHa_Sub2_6618
.method3770(-422613672, aClass206_8825);
return false;
}
((Class348_Sub5) this).aHa_Sub2_6618.method3770(-422613672,
aClass206_8825);
aClass337_8842
= (Class318_Sub1_Sub5_Sub2.method2493
(((Class348_Sub5) this).aHa_Sub2_6618, -1,
(new Class242[]
{ WidgetVariable.method3249
(35632, 80, ((Class348_Sub5) this).aHa_Sub2_6618,
"#extension GL_ARB_texture_rectangle : enable\nuniform vec3 params;\nuniform sampler2DRect sceneTex;\nconst vec3 lumCoef = vec3(0.2126, 0.7152, 0.0722);\nvoid main() {\n vec4 col = texture2DRect(sceneTex, gl_TexCoord[0].xy);\n gl_FragColor = col*step(params.x, dot(lumCoef, col.rgb));\n}\n") })));
aClass337_8824
= (Class318_Sub1_Sub5_Sub2.method2493
(((Class348_Sub5) this).aHa_Sub2_6618, -1,
(new Class242[]
{ WidgetVariable.method3249
(35632, -45, ((Class348_Sub5) this).aHa_Sub2_6618,
"uniform vec3 params;\nuniform sampler2D sceneTex;\nconst vec3 lumCoef = vec3(0.2126, 0.7152, 0.0722);\nvoid main() {\n vec4 col = texture2D(sceneTex, gl_TexCoord[0].xy);\n gl_FragColor = col*step(params.x, dot(lumCoef, col.rgb));\n}\n") })));
aClass337_8836
= (Class318_Sub1_Sub5_Sub2.method2493
(((Class348_Sub5) this).aHa_Sub2_6618, -1,
(new Class242[]
{ WidgetVariable.method3249
(35632, -108, ((Class348_Sub5) this).aHa_Sub2_6618,
"#extension GL_ARB_texture_rectangle : enable\nuniform vec3 params;\nuniform vec3 dimScale;\nuniform sampler2D bloomTex;\nuniform sampler2DRect sceneTex;\nconst vec3 lumCoef = vec3(0.2126, 0.7152, 0.0722);\nvoid main() {\n\t vec4 bloomCol = texture2D(bloomTex, gl_TexCoord[1].xy);\n\t vec4 sceneCol = texture2DRect(sceneTex, gl_TexCoord[0].xy);\n\t float preLum = 0.99*dot(lumCoef, sceneCol.rgb)+0.01;\n float postLum = preLum*(1.0+(preLum/params.y))/(preLum+1.0);\n\t gl_FragColor = sceneCol*(postLum/preLum)+bloomCol*params.x;\n}\n") })));
aClass337_8822
= (Class318_Sub1_Sub5_Sub2.method2493
(((Class348_Sub5) this).aHa_Sub2_6618, -1,
(new Class242[]
{ WidgetVariable.method3249
(35632, -31, ((Class348_Sub5) this).aHa_Sub2_6618,
"uniform vec3 step;\nuniform sampler2D baseTex;\nvoid main() {\n\tvec4 fragCol = texture2D(baseTex, gl_TexCoord[0].xy)*0.091396265;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-1.0*step.xy))*0.088584304;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 1.0*step.xy))*0.088584304;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-2.0*step.xy))*0.08065692;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 2.0*step.xy))*0.08065692;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-3.0*step.xy))*0.068989515;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 3.0*step.xy))*0.068989515;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-4.0*step.xy))*0.055434637;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 4.0*step.xy))*0.055434637;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-5.0*step.xy))*0.04184426;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 5.0*step.xy))*0.04184426;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-6.0*step.xy))*0.029672023;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 6.0*step.xy))*0.029672023;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-7.0*step.xy))*0.019765828;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 7.0*step.xy))*0.019765828;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+(-8.0*step.xy))*0.012369139;\n\tfragCol += texture2D(baseTex, gl_TexCoord[0].xy+( 8.0*step.xy))*0.012369139;\n\tgl_FragColor = fragCol;\n}\n") })));
if (aClass337_8824 == null || aClass337_8842 == null
|| aClass337_8836 == null || aClass337_8822 == null)
return false;
return true;
}
return false;
} |
d5919758-6430-4697-8c6c-a4b89e08028a | 2 | public static int countOccurrences(final String haystack, final char needle) {
int count = 0;
for (int i = 0; i < haystack.length(); i++) {
if (haystack.charAt(i) == needle) {
count++;
}
}
return count;
} |
ea86fc50-95a5-40e3-8503-ad80bed72b54 | 5 | public void onAction(String name, boolean isPressed, float tpf) {
if (isPressed && name.equals(KeyMapper.BRING_ELEVATOR_UP)) {
if (!elevatorMoving) {
if (elevatorUp == true) {
bringElevatorDown();
}
if (elevatorUp == false) {
bringElevatorUp();
}
}
}
} |
c3f95495-05e2-4ff6-86cd-f347f02b1e51 | 1 | public static SendResourceHashes getCRCMap()
{
// Create a hashmap as return value and populate it with
// entries of key - hashID
HashMap<String,Long> rval = new HashMap<String,Long>();
for(String key : resourceByString.keySet())
{
Resource resource = resourceByString.get(key);
rval.put(key, resource.hashID);
}
// Generate a network object and pack the resource hashes into it.
SendResourceHashes network_object = new SendResourceHashes();
network_object.filenameToCRC = rval;
return network_object;
} |
2335b246-cb88-409e-adcf-afd9763e09e6 | 6 | public void doOpen() {
fileDialog = new JFileChooser(currentDirectory);
fileDialog.setDialogTitle("Select File to be Opened");
fileDialog.setSelectedFile(null); // No file is initially selected.
int option = fileDialog.showOpenDialog(this);
if (option != JFileChooser.APPROVE_OPTION)
return; // User canceled or clicked the dialog's close box.
File selectedFile = fileDialog.getSelectedFile();
BufferedReader in;
try {
FileReader stream = new FileReader(selectedFile);
in = new BufferedReader( stream );
}
catch (Exception e) {
JOptionPane.showMessageDialog(this,
"Sorry, but an error occurred while trying to open the file:\n" + e);
return;
}
try {
StringBuffer input = new StringBuffer();
while (true) {
String lineFromFile = in.readLine();
if (lineFromFile == null)
break; // End-of-file has been reached.
input.append(lineFromFile);
input.append('\n');
if (input.length() > 10000)
throw new IOException("Input file is too large for this program.");
}
in.close();
text.setText(input.toString());
editFile = selectedFile;
setTitle("TrivialEdit: " + editFile.getName());
}
catch (Exception e) {
JOptionPane.showMessageDialog(this,
"Sorry, but an error occurred while trying to read the data:\n" + e);
}
} |
a9b08cee-b306-4f0c-8bf8-788c2be7fbfc | 4 | public void run()
{
while (true)
{
try
{
PianoPacket packet = packets.take();
Iterator<ObjectOutputStream> iter = outStreams.iterator();
while (iter.hasNext())
{
ObjectOutputStream out = iter.next();
try
{
out.writeObject(packet);
out.flush();
}
catch (IOException e)
{
e.printStackTrace();
iter.remove();
}
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
} |
bc3e9471-5b6c-4e3b-9623-69f3c63c2d10 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new StringBuffer();
for (;;) {
if (c == '<' || c == 0) {
back();
return sb.toString().trim();
}
if (c == '&') {
sb.append(nextEntity(c));
} else {
sb.append(c);
}
c = next();
}
} |
c3d44dc4-524a-42a3-84d6-fc3ab29e98a4 | 6 | @Override
public boolean equals(Object obj) {
if (obj instanceof String)
return name.equals(obj);
if (obj instanceof Profile) {
Profile that = (Profile) obj;
return this.name.equals(that.name) && this.host.equals(that.host) &&
this.port.equals(that.port) && this.userName.equals(that.userName) &&
this.password.equals(that.password);
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.