method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a9b4a266-6872-473e-99b4-87ff5766c7ac
3
private JSONWriter end(char mode, char c) throws JSONException { if (this.mode != mode) { throw new JSONException(mode == 'a' ? "Misplaced endArray." : "Misplaced endObject."); } this.pop(mode); try { this.writer.write(c); }...
d3045c14-87a5-4a51-b00c-67ba40076535
5
protected void shutdownAndAwaitTermination() { if ( pool.isShutdown() && periodicHarvest.isCancelled()) { // Already had a shutdown notification. return; } periodicHarvest.cancelReaper(); pool.shutdown(); // Disable new tasks from being submitted try { ...
cd8e8c5f-e25d-4e60-88ac-4db9b58fe0e8
1
@Override public void update(GameContainer container, StateBasedGame arg1, int arg2) throws SlickException { debug = Main.isDebugging(); Input input = container.getInput(); mouseX = Mouse.getX(); mouseY = Mouse.getY(); if (input.isKeyPressed(Input.KEY_BACKSLASH)) { Main.setDebugging(!debug); } ...
91331e04-7302-4201-ab64-b022f2b9a74c
2
public Duck(HuntField field) { this.field = field; this.type = 'D'; while(true){ myPosition = field.randomPositionGenerator(); if (myPosition == null) { field.setItem(this, myPosition); break; } } alive = true; ...
e862bfd3-c2bc-49e1-adc2-7ab6f037901f
1
@Override public Iterator getAttributeKeys() { if (attributes != null) { return attributes.keySet().iterator(); } return null; }
d9851a1d-52ae-4d2f-b759-71ae929b68d0
8
public void setImgPath_PWField(Path img, Imagetype type) { switch (type) { case DEFAULT: this.imgPWField_Def = handleImage(img, UIResNumbers.PWFIELD_DEF.getNum()); if (this.imgPWField_Def == null) { this.imgPWField_Def = UIDefaultImagePaths.PWFIELD...
68d93f32-e664-4603-aeda-8f7fbde21369
6
public static double pt(double t,double df) { // ALGORITHM AS 3 APPL. STATIST. (1968) VOL.17, P.189 // Computes P(T<t) double a,b,idf,im2,ioe,s,c,ks,fk,k; double g1=0.3183098862;// =1/pi; if(df<1) throw new IllegalArgumentException("Illegal argument df for pt(t,df)."); idf=df; ...
917b34b2-c0b1-4021-a9b3-f97866725e09
2
private void acao114(Token token) throws SemanticError { switch (contextoListaIds) { case DECLARACAO: acao114Declaracao(token); break; case PARAMETROS: acao114Parametros(token); default: break; } }
9271132d-698a-4afb-b2c9-00532b05b425
6
public RepositoryListVm getRepos(String baseUrl) throws IOException { Properties properties = ApplicationProperties.getProperties(); String organizationName = properties.getProperty(PropertiesConstants.GITHUB_ORGANIZATION); List<Repository> orgRepositories = getRepositories(organizationName); ...
8fd63496-3edc-4c04-9b31-384e23bcdebc
5
public int[][] carveCavern(int[][] currentBlockArray, int size, int xMin, int xMax, int zMin, int zMax, int paintRadius, float splitPercentage) { int x = randGen.nextInt(xMax - xMin) + xMin; int z = randGen.nextInt(zMax - zMin) + zMin; numberCaves = 2; int cave_x1 = 0; int cave_z...
fa1f4ae8-80ae-4603-bcdf-ee61f0d03100
3
public void updateUse(Game game) { if(Utils.processUseKey(getKeyHandler().getMask(), getPlayerID()) && hasAmmo()) //use primary set of keys, idx = 0 { VGDLSprite added = game.addSprite(itype, new Vector2d(this.rect.x, this.rect.y)); if(added != null){ //singleton sprites coul...
86beeb42-2012-49d5-9c45-a036e4383679
1
private void notifyOfSortCleared() { for (OutlineModelListener listener : getCurrentListeners()) { listener.sortCleared(this); } }
72c851c2-9d02-429f-8a9d-e483c8cd6fd8
2
public void fillArr_drag(int x, int y) { ArrayList<Delta> changes = currentTool.apply(curColor, x, y, currentLayer.colorArr); ArrayList<Delta> accepted = new ArrayList<>(); for (Delta d : changes) { if (!d.amUseless()) { accepted.add(d); } } ...
00d7029a-7039-42d1-a339-0a50d120a043
0
public String[] getPatternArray() { return patternArray; }
32599dc3-5a40-437e-a1f6-0c0675caef08
5
public void paintComponent(Graphics g) { if (started) { int width = getWidth(); int height = getHeight(); double maxY = 0.0; Graphics2D g2 = (Graphics2D) g; g2.setRenderingHints(hints); g2.setColor(new Color(255...
4952318e-cc8d-4c83-b67d-dd1ae0c82f38
7
@Override public boolean run() { //--- // Initialize //--- if (verbose) Timer.showStdErr("Loading config"); config = new Config(genomeVer); if (verbose) Timer.showStdErr("Loading predictor"); snpEffectPredictor = config.loadSnpEffectPredictor(); if (verbose) Timer.showStdErr("Building interval fores...
2fbf1b0f-578f-44ae-9695-9398fb87223e
1
public void run() throws ServletException, IOException { if (!dispatch()) { response.sendError(404); } }
ec050e0e-7bd2-401f-832c-7bee8deaac32
4
protected void fireServerStarEvent(ServerStartEvent evt) { if (serverStartListenerList != null) { Object[] listeners = serverStartListenerList.getListenerList(); for (int i=0; i<listeners.length; i+=2) { if (!isActive()) break; if (listeners[i]==ServerStartListener.class) { ((S...
ae70ab4c-4a8e-4715-93b6-83567f9e8c9f
3
public void set(int pos, long val) { if (start == end && start == pos) { minIndexVal = pos; } else { int mid = (start + end) / 2; if (pos <= mid) left.set(pos, val); else right.set(pos, val); minIndexVal = minIndexVal(left.minIndexVal, right.minIndexVal); } }
d99a98fa-c5bd-4d70-9523-ca90e9a1bfe2
4
@Override public Color[][] getColors(double[][] heightmap, boolean[][] water) { Color[][] c = new Color[heightmap.length][heightmap.length]; for (int x = 0; x < heightmap.length; x++) for (int y = 0; y < heightmap[x].length; y++) { int n = (int) (heightmap[x][y] * g); if (n > 255) n = 255; if (...
de0596b1-5937-4ac7-8814-637e00a40e2a
9
@Override public void simpleDraw(Graphics2D g2d) { //DRAWING FLAGS boolean drawRings = false; boolean drawDestinationLine = false; boolean drawViewCone = false; if (parentCell == null) { g2d.setColor(Color.pink); g2d.setBackground(Color.pink); ...
dc591d85-f027-4e97-9d38-dc5b3d3f65fc
4
public int executeQuery(String query) { System.out.println("Result SET QUERY"); int id = 0; //System.out.println("MySQL DAO executeResultSet"); // --- 3) prepare and execute statement stmt = null; // SQL statement object rset = null; // statement result set object // get resultset Syst...
f5ae1edd-d223-4ae9-864c-e8edcf3b1835
7
public void addColors(boolean addBasicColors) { int numColors = js.getNumColors(); int numCustomColors = js.getNumCustomColors(); String currentBGColor = js.getBGColor(); int index = -1; if( addBasicColors ) { String[] color = new String[numColors]; ...
3dd0b667-44b5-4739-a62f-e76848fc3050
2
private String readURL(String url) { try { return readAll(new URL(url).openStream()); } catch (MalformedURLException e) { // Should never happen e.printStackTrace(); return null; } catch (IOException e) { // Only happens when we try to get our token too fast return null; } }
c031d97f-0131-483c-a8d3-32c10444641c
4
void generateStatistics() { int trainingErrorCount; int testErrorCount; double trainingErrorPercentage; double testErrorPercentage; // Calculate Training Error trainingErrorCount = 0; for (int i = 0; i < trainingSetSize; i++) { if (correctClassifier(data.storage[trainingIndices[i]], data.classes[t...
0d00d738-4555-4447-b5dd-0f894cd16c4f
6
@EventHandler public void BlazeSpeed(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getBlazeConfig().getDouble("Blaze.Speed.DodgeC...
d167ed25-c0a7-4d8d-8a7c-07aabe2e3117
0
public boolean getLeft(){ return left; }
6ced695a-820a-458b-956a-840ffdc09c76
3
@Override public void controlReleased(Command c) { if (c.equals(click)) { if (choice == 0) { game.setState(State.PLAYING); } else if (choice == 2) { game.setState(State.QUIT); } } }
db2ecf77-46e3-4457-9286-0a613a93e324
5
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { String name = "" + file; if (!name.toLowerCase().contains("sopa")) { return CONTINUE; } if (attr.isRegularFile()) { if (name.endsWith(".txt")) { for (JSONArray comments : extractor.extractFromCrawler(file, ...
83d9618e-aa9b-4de3-aaed-a5cb9f74a800
1
public void checkIfEmailAlreadyInUse(String firstName, String lastName, String age, String hometown, String email, ...
27336d29-14ac-4a0d-b165-c4dd57fef60c
5
public void start() { ImageLoader.init(); Game.init(); Map.init(); Player.init(); game = Game.getInstance(); final int DELTA_TARGET_NANOS = DELTA_TARGET * 1000 * 1000; while (true) { long timeStart = System.nanoTime(); BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBuffer...
9f38d23b-d9db-411e-9d1a-7cfd4cd68e34
5
public void propertyChange(PropertyChangeEvent ev) { Program program = this.controller.get().program; if (program == null) { ((UserPreferences) ev.getSource()) .removePropertyChangeListener("language", this); } else { program.getTabbedPane().setTitleAt(0, Tools.getLocalizedString("PROJECT"...
0d50fce0-af18-45f9-8179-76c587d0a4b9
8
public void takeDamage(int dmg, SpecialAttack special) { System.out.println("ouch!"); switch (special) { case NONE: // do nothing case TWO_TARGETS: break; case FREEZE: effect = SpecialAttack.FREEZE; speed = 100; break; case SLOW: if (effect == SpecialAttack.NONE || effect == SpecialAttack.BUR...
e6d24c71-f701-40a1-8e05-55cc25aaedc4
0
@Override public void setCorrect(boolean value) { this.correct = value; }
d8af1d82-9a1d-4e5b-9966-943e394fa7f4
2
public void wipe() { for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { gridCells[i][j].Clear(); } } }
c755f1d1-ca45-45fa-a45e-2b5317de1327
7
void splitExp(LivingThing thnStore, int exp) { if (thnStore.popup) { thnStore.send(""+(char)33+"You have lost "+exp+" exp.\n"); } else { thnStore.chatMessage("You have lost "+exp+" exp."); } thnStore.exp -= exp; Vector vctStore; double tp, sidepoints=0; LivingThing thnFront; if (thnStore....
356aaa5e-9de0-4079-86af-e23a076ead8a
2
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestData rd = getRequestData(request); if (rd.page == null){ request.getRequestDispatcher("WEB-INF/pages/index.jsp").forward(re...
4fe80b52-b8d3-4ff5-a31d-b4a41251a158
6
public int solve() { myDivisors = findDivisors(); int result = 0; for (Integer divisor: myDivisors) { boolean success = true; result = divisor; if (divisor == mySum) return divisor; // the sum is always possible (no partition) int sum = 0; for (int i = 0; i < myData.length; i++) { sum += my...
2afce737-2ab1-4b83-8b1c-efbcbb20dbbe
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Specie other = (Specie) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name))...
930d58b7-0d9a-4cc9-b799-f3fd0689f4ce
5
public void execute(final State state) { // don't bother if we don't know where the enemy is if (state.targetPosition == null) { return; } this.state = state; updateWaves(); // calculate some basic gun stuff final double angle = next.angleTo(state.targetPosition); final double bulletPower = getBu...
fcfd8c44-bf8d-4187-b565-d463f3d421b4
4
public static void main(String args[]) { //<editor-fold defaultstate="collapsed" desc=" Set Cross Platform Look and Feel "> /* 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/lookandf...
dec43fe3-5305-48cf-a6cd-db3c492d71a3
1
public int getMaximum() { if (this.slider != null) { return this.slider.getMaximum(); } return ((Number) ((SpinnerNumberModel) this.spinner.getModel()).getMaximum()).intValue(); }
595252ff-eba0-49e4-bc6c-f1cf0026b439
8
private void extractMeta(Element dataSource) throws WorldFileParseException { // The worlds token String node = "token"; this.setToken(this.extractText(dataSource, node)); if (this.getToken().isEmpty()) { throw new WorldFileParseException(this.importable, node); } // The worlds name node = "name"; t...
c84c00d3-64b1-46a6-942e-8967faaee309
1
public static void handleClear() { if (getActiveTab() != null) getActiveTab().clearContent(); clearInput(); }
d7dbf1b2-449a-4864-99e9-f620fc617608
9
@Override public void Draw(Graphics2D g2d) { switch (gameState) { case PLAYING: game.draw(g2d, mousePosition()); break; case GAMEOVER: //... break; case MAIN_MENU: g2d.drawImage(menu_image...
c88162ad-7c63-47d6-b03a-a619d256cf43
1
private void loadPerson(ArrayList<CompanyPerson> PC) { // TODO Auto-generated method stub fila = new Object[5]; for (int i = 0, j=1; i < PC.size(); i++,j++) { fila[0] = i+1; fila[1] = PC.get(i).getCompany().getName(); fila[2] = PC.get(i).getWorkPosition(); fila[3] = PC.get(i).getArea(); fila[4...
2d415544-68db-4f2a-9b02-ab6e0e50be17
8
@Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if(source == optionPanel.newGameButton) { // Needs to resize the frame int choice = optionPanel.difficulty.getSelectedIndex(); int curGridSize = gridSize; if (choice...
5ec68788-709e-4fbf-9ce4-2229af8394a8
5
public static boolean isItemEnabled(WL plugin, int typeId) { String disabledItems = plugin.getConfig().getString("general.disabled items"); if (Util.getCommaSeperatedValues(disabledItems).contains(String.valueOf(typeId))) { return false; } if (!NON_WEAPONS_ENABLED) { if (!ItemChecker.isWeapon(plugi...
dd9be4f2-580a-4db2-a1b9-0ad593fadcfa
1
public static void main(String[] args) { for (int i = 0; i < 5; i++) new SelfManaged(); }
afbaad25-966c-4c7b-92ed-e1e02e697e1f
6
boolean dupRun(final MethodEditor m, final int j, final Instruction inst) { if (((Instruction) m.codeElementAt(j)).opcodeClass() == Opcode.opcx_dup) { for (int k = j - 1;; k--) { if (m.codeElementAt(k) instanceof Instruction) { if (((Instruction) m.codeElementAt(k)).opcodeClass() == Opcode.opcx_dup) { ...
996474e1-d5ad-47c1-9ae1-a184b2823cb0
2
private static void initTranslate(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.grabExcessHori...
24f1dd15-4757-4def-83db-5c6c94965c41
8
public static Class<?> propertyType(Class<?> baseClass, String property) throws NoSuchMethodException { Class<?> innerClass = baseClass; Method method; if (property.startsWith("./")) { property = property.substring(2); } String[] path = property.split("[./...
c44781b5-79c2-40d0-9bc2-43c635b56635
5
private void setupUpdater() { file = this.getFile(); updater = new Updater(pl, 53240, file, Updater.UpdateType.NO_DOWNLOAD, false); Updater.UpdateResult result = updater.getResult(); switch (result) { case FAIL_DBO: getLogger().info("Could not reach dev.bukkit.org. It is offline?"); update = false;...
ff285f65-b2ce-419d-987e-8fdc63296e64
3
public String getValue(String str) { if(StringUtilities.isNumber(str)) { return str; } if(str.contains("(")) { // System.out.println(str.substring(0, str.length() - 2)); HFunction function = functions.get(str.substring(0, str.length() - 2)); functi...
314d68ba-a64d-4581-8712-bea8ebb6765b
2
private VPlanToHtml(Workbook wb, Appendable output) { if (wb == null) { throw new NullPointerException("wb"); } if (output == null) { throw new NullPointerException("output"); } this.wb = wb; this.output = output; setupColorMap(); }
79c0c538-8872-4277-b18a-a3f19f214ced
8
public ViewerCell findSelectedCell(ColumnViewer viewer, ViewerCell currentSelectedCell, Event event) { switch (event.keyCode) { case SWT.ARROW_UP: if (currentSelectedCell != null) { return currentSelectedCell.getNeighbor(ViewerCell.ABOVE, false); } break; case SWT.ARROW_DOWN: if (currentSelect...
99c12623-39ab-4f3e-a5eb-54afab687bee
2
private String writeSet( Column col ) { if ( col.getClass().getSimpleName().equals( "VirtualStringColumn" ) ) { return ""; } StringBuilder str = new StringBuilder(); str.append( SPACE ); str.append( "public void " ); str.append( "set" ); str.app...
dda9a9ca-a41e-4b88-bfac-c57aa8ec98d4
3
@Override public byte[] getContents() { if (comp == CompressionType.None) return parentFile.getContents(); else if (comp == CompressionType.Lz) return LZ.decompress(parentFile.getContents()); else if (comp == CompressionType.LzWithHeader) return LZ.dec...
228d957d-a72a-4906-8030-48613fcecfe7
0
public String getReplacement() {return replacement;}
d5a63158-a5f7-427e-b1e4-e3bdbbfae85e
1
public boolean equals( Vector2f r ) { return x == r.getX() && y == r.getY(); }
cfca9837-f999-4c02-8a9a-1de8d07dc43f
7
public void handleBotInput(){ final Animation myTempAnimation = this; // ArrayList<InputHandler> myInputs = new ArrayList<>(); Thread botInputUpdater = new Thread(){ public void run(){ while(true){ try { Thread.sleep(10); } catch (InterruptedException e) { } if(firstPlayer.getHealth()>0 ...
b03e8717-4df8-4d80-b9ff-1116ad3221c5
9
public static String toXMLEscapedTextExpandingWhitespace(String text) { // Spaces and tabs are handled text = text.replaceAll("\t", " "); // Use eight spaces as tab // width. int len = text.length(); StringBuffer result = new StringBuffer(len); char myChar; ...
e15273fe-a2a9-45ae-aa95-29d6d93cb353
2
public String getErrorsText() { String ret = null; for (SAXParseException exception: exceptions) { if (ret == null) { ret = exception.getMessage(); } else { ret = String.format("%s\n", exception.getMessage())...
a2896654-ca54-4e3f-8674-17651bbb1941
7
public void handleLogin(Packet00Login packet, InetAddress address, int port) { System.out.println( "[" + address.getHostAddress() + ":" + port + "] " + packet.getName() + " has joined the game..."); Player player = null; if (packet.getRace().equalsIgnoreCase("human")) player = new Human(game, packet.getNam...
91380ff5-e471-47b5-98a9-2f57472c3635
2
@Override public void Parse(Session Session, EventRequest Request) { if (!Session.GrabActor().InRoom()) { return; } String Str; if (Session.GrabActor().OverrideSpeech != null) { Str = Session.GrabActor().OverrideSpeech; } else { Str = Request.PopFixedString(); } Session.GrabAct...
a7ba7433-131a-4a1e-92de-2f7f03c66f51
0
public static void log(String output) { console.append("\n"+output); console.selectAll(); int x = console.getSelectionEnd(); console.select(x, x); }
25a3a5ad-fd45-45e1-b06e-9c90aea9f62a
9
@Override protected byte[] generateVariableHeader() throws MQTTException, IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); // Some packages has this if(protocolName == null) out.write(getProtocol()); else{ // For some reason I need to te...
c065049f-805a-49e1-ad0a-a00791c6da14
8
@Override public void run() { timer.start(); lastFrameTime = currentTime = timer.getTime(); this.requestFocus(); final Image image = new BufferedImage(GAME_WIDTH, GAME_HEIGHT, BufferedImage.TYPE_INT_RGB); Sound.touch(); while (this.running) { Graphics g = image.getGraphics(); timer.tick(); d...
e193d4d5-46e1-4921-b792-e1588cae431d
4
@Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (active) { if (!world.isRemote && !entity.isBurning()) { if (entity instanceof EntityItem) { entity.setDead(); } else { entity.setFire(5); } } } else { entity.attackEntityFrom(Da...
87dc7aea-f1c1-4416-aab1-2ed5e5d8b64e
4
public static void main(String[] args){ Console console = System.console(); if (console == null) { System.err.println("No console."); System.exit(1); } while (true) { Pattern pattern = Pattern.compile(console.readLine("%nEnter your regex:...
5431bced-33f8-4043-ab02-84ec02736336
5
public Matrix times(Matrix m) { //Validity test given by c_1 = r_2 if(this.numColumns != m.numRows){ System.out.println("Error: matrix arguments are not compatible for multiplication!"); return null; } //Given that we have assessed correct bounds, we may calculate //without issues regarding indices ...
bdc4e1fe-1144-49ed-82b8-18141e7e7a9d
5
public static String pformat(Collection<?> c) { if(c.size() == 0) return "[]"; StringBuilder result = new StringBuilder("["); for(Object elem : c) { if(c.size() != 1) result.append("\n "); result.append(elem); } if(c.size() != 1) result.append("\n"); result.append("]"); return result.toString(); }
230a5920-4bcb-4ddd-980e-528d0924c42e
4
public void handleInput() { if (game.keybord.singlePress(game.keybord.escape)) { end = true; game.jukeBox.play(game.jukeBox.tracks.buttonClick); } if (game.mouse.getWheelNothces() == 1) { pos += 40; } else if (game.mouse.getWheelNothces() == -1) { pos -= 40; } if (game.mouse.getWheelNothces() !=...
3b3bed77-5aa7-44d6-abe0-7da3c6846334
8
public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String s = in.next(); int N = s.length(); int[][] a = new int[N+1][3]; for (int i = 0; i < N; i++) { System.arra...
85bd9194-1e4c-4e53-a4bf-93823fa4f22f
8
@Override public String process(HttpServletRequest request) throws MissingRequiredParameter { ResultSet resultSet = null; //String result = null; JSONArray result = new JSONArray(); //String result; try { // Get Connection and Statement connection = dataSource.getConnection(); statement = ...
8a33dc35-c604-4591-8cc3-b4e20daf1ea8
3
@Before public void setUp() throws Exception { objects = new java.util.ArrayList<Sphere>(); for (float x = LOWER_BOUND; x <= UPPER_BOUND; x += INCREMENT) for (float y = LOWER_BOUND; y <= UPPER_BOUND; y += INCREMENT) for (float z = LOWER_BOUND; z <= UPPER_BOUND; z += INCRE...
b0c46702-c5c9-44d7-98e4-aefa3c1c250d
2
public DodgeballTeam getWinnerTeam() { if(teamPlayerCount[TEAM_1.ordinal()] > teamPlayerCount[TEAM_2.ordinal()]) { return TEAM_1; } if(teamPlayerCount[TEAM_2.ordinal()] > teamPlayerCount[TEAM_1.ordinal()]) { return TEAM_2; } return null; }
79e80b54-7717-4c19-87ad-e110e9ca8fb1
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PrimitiveStrictTypesEntity other = (PrimitiveStrictTypesEntity) obj; if (Double.doubleToLongBits(doubleVal) != Double.doubleToL...
71664e21-f696-4fd0-9ff8-b8ee8cc1bd5b
3
private String tileToQuadKey(final int tx, final int ty, final int zl) { String quad = ""; for (int i = zl; i > 0; i--) { int mask = 1 << (i - 1); int cell = 0; if ((tx & mask) != 0) { cell++; } if ((ty & mask) != 0) { cell += 2; } quad += cell; } return quad; }
ad145dbb-bb7e-4b12-86e8-4cb480775bb7
4
public void setValue(Cell cell) { turn.incTurn(); cell.setValue(player.getPlayer()); log.info(grid.toString()); grid.getStatus().setText(player.getOtherPlayerName() + "'s turn."); // checks if the grid is full if (turn.getTurn() == gv.getMaxTurns()) { if(player...
e97e46e3-2423-4701-bc5f-6f16413c233c
8
public static Bin[] buildBins(long lifetime, double[] weights) { //@todo -- find the correct lambda threshold for this approximation double ERROR_LIMIT = 2.0 / (double) lifetime; //System.out.println("ERROR_LIMIT :: " + ERROR_LIMIT); //ensure all weights are > 0 for (int i = 0; i < weights.length; i++) { ...
dd3f8695-cef9-4208-85b3-c1ebcf8855af
6
public void numberOfPasswordTriesLeftAndTheirInitialization() { boolean[] arePasswordsInitialised = getters.arePasswordsInitialised(); int[] numberOfPasswordTriesLeft = getters.numberOfPasswordTriesLeftArray(); for (int i = 0; i < 4; i++) { String typeOfCurrentPassword = ""; ...
8a579e2c-ca01-469e-8048-11ce2eb73ce1
1
public void moveLeft() { if (centerX > 10) centerX -= speed; }
8052b5d8-fa9f-4e40-bc3b-7600bde41a93
4
void parseSparseGt(String str, byte gt[], int valueInt) { if ((str == null) || (str.isEmpty()) || (str.equals("true"))) return; // Split comma separated indeces String idxs[] = str.split(","); byte value = (byte) valueInt; // Set all entries for (String idx : idxs) { int i = Gpr.parseIntSafe(idx); g...
eed36532-2897-4e9c-b210-e590035c9946
0
protected void interrupted() { end(); }
af171d23-c2be-4af6-806c-94f9bf772193
8
public void verifyAndSave() { startButton.setEnabled(false); prefs.put("pngDir", pngDir.getText()); prefs.put("outFile", outFile.getText()); prefs.put("xSize", xSizeField.getText()); prefs.put("ySize", ySizeField.getText()); prefs.putInt("fps", ((Number)frameRateField.getValue()).intValue()); ...
e937e953-f240-4917-ad29-c774b78ca1c3
4
private Map<Integer, Image> splitImg(BufferedImage img, int numOfTilesOnSide) { Map<Integer, Image> map = new HashMap<Integer, Image>(); int n = 1; for (int i = 0; i < numOfTilesOnSide; i++) { for (int j = 0; j < numOfTilesOnSide; j++) { if (i == (numOfTilesOnSide - 1) && j == (numOfTilesOnSide - 1)) { ...
f5541bc1-ee16-4299-acce-f4241b96d24a
0
public void showAddressPopup() { addressDetail.show(); }
dacc2f76-10bb-45b3-9ca4-79db790f7897
8
public GroundItem getNearest(Tile tile, Filter<GroundItem> filter) { List<GroundItem> items = new ArrayList<GroundItem>(); IClient client = ctx.getClient(); INodeDeque[][] deques = client.getGroundItems()[client.getPlane()]; GroundItem item = null; for (int x = 0; x < 104; x++) { for (int y = 0; y < 104;...
b9713198-5425-4d06-91b5-1c458ee20c33
3
int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch){ int i=0; for(i=0; i<ch; i++) if(nonzero[i]!=0) break; if(i==ch) return (0); /* no nonzero vectors */ return (_2inverse(vb, vl, in, ch)); }
176d718e-56d7-46dc-a6b5-d137424af67a
0
@Override public void setMinimum(int i) {bar.setMinimum(i);}
84772c95-6a87-4afb-8f5e-c797863f6d6c
2
public Level(String fileName) { //parse XML //return NodeList on valid //null on in-valid NodeList xmlData = parseXml(fileName); if(xmlData != null) //if xml was valid { createHouses(xmlData); validateHouses(); } //report errors if any if(errorFlag == 1) System.out.println("Error: " + er...
958a6603-f0ea-4cc0-a465-308890fa6589
2
public float getPhysicalHeightInch() { int h = getHeight(); int ph = getPhysicalHeightDpi(); if (h > 0 && ph > 0) { return ((float)h) / ((float)ph); } else { return -1.0f; } }
925bdbd3-f4ac-408a-a92c-dabf2fdc7d8a
9
private static boolean isEmptyOrWhitespace(final String target) { if (target == null) { return true; } final int targetLen = target.length(); if (targetLen == 0) { return true; } final char c0 = target.charAt(0); if ((c0 >= 'a' && c0 <= 'z'...
0e1368ed-065c-41b0-ae90-93000b03e5fe
4
public void setup() { MatrixGraph graph = mapView.getMatrixGraph(); int half = GameConfig.TILE_WIDTH / 2; for (int i = 0; i < GameConfig.TILE_HEIGHT; i++) { graph.set(0, i, MatrixGraph.WALL); if (i >= half - 5 && i < half) continue; graph.set(GameConfig.TILE_WIDTH - 1, i, MatrixGraph.WALL); piece...
4bc7f99d-0f6a-4cac-9ce4-86dab92c2271
8
private void checkEnabled() { /* * if (!numberInUse() && !nameInUse() && (cbMuseumEducator.isSelected() * || cbClerk.isSelected() || cbOther.isSelected()) && * (cbFullTime.isSelected() || ((cbPartTime.isSelected() || * (pnlVacationPercentage.isVisible() && * !tfVacat...
87e103c6-e093-4b48-ba87-53ffc5af3c7c
6
private static ListNode merge(ListNode leftlist,ListNode rightlist){ ListNode head,currentNode, nextNode; if(leftlist == null) return rightlist; else if(rightlist == null) return leftlist; else if(leftlist.val <= rightlist.val){ head = leftlist; currentNode = leftlist; nextNode =...
bf17e3b1-83b8-4b49-adfd-bc011040bdbc
7
public Registrar registrar() { return new AbstractRegistrar() { public void listen(Object emitter, Object type, EventListener<?,?,?> listener) { entries.add(createEntry(emitter, type, listener)); } public void mute(Object listener) { Listener...
d30f5687-8125-416a-b1d4-522168ea9cf3
7
public void senseLeverUp() throws LeverErrorException { if((l.getLeverPosition()).equals("OFF")) { l.setLeverPosition("INT"); switch(d.getDialPosition()) { case 1: { w.setWiperSpeed(4); break; } case 2: { w.setWiperSpeed(6); break; } case 3: { w.setWiperSpeed(12); break; } } } else if((l.getLeverPosit...
aa515395-e2eb-4236-b468-d7000c3e72c6
6
public final DccChat dccSendChatRequest(String nick, int timeout) { DccChat chat = null; try { ServerSocket ss = null; int[] ports = getDccPorts(); if (ports == null) { // Use any free port. ss = new ServerSocket(0); } ...