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])... |
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 ==... |
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.grabExcessHorizontal... |
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();
... |
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;
mR... |
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(glGetShad... |
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; ++... |
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> ... |
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... |
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 ... |
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) ... |
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 fe... |
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... |
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 >= scr... |
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
&... |
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... |
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.... |
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) {... |
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 + "... |
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] += amou... |
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 availab... |
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 =... |
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) * ... |
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 : -... |
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... |
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.executeQu... |
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 ... |
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.getWo... |
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 ikk... |
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_BITTE... |
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... |
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()) {
... |
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 arra... |
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 nu... |
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()... |
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;
}... |
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, v... |
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();
}
... |
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"), r... |
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 fi... |
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);
}
... |
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 (Ma... |
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... |
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.... |
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.wid... |
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 = new... |
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;
... |
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.getT... |
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 =... |
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.HE... |
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') {... |
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 = ... |
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.... |
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()... |
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... |
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 -> h... |
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) {}
}
... |
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... |
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://down... |
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("wha... |
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.p... |
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 testBo... |
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++) {
in... |
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.");
... |
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()) ;
... |
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 i... |
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) {
... |
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);
... |
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) {
... |
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) {
... |
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.... |
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)
... |
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 (IO... |
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 Str... |
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) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.