method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
79bb8cef-3c7b-4169-83aa-2de3a554bff8
1
public String deepToString() { NumberFormat formatter = new DecimalFormat("0.#####E0"); return "\n " + "NaturalSatellite{" + "id=" + id + ", name='" + name + '\'' + ", mass=" + formatter.format(mass) + ", inhabited=" + inhabited + ...
b31df4d4-cfda-4ee7-b7e7-510ae62ddebe
6
public void run() { attuning.remove(this.player.getName()); if (player.getLocation().getBlockX() != pX || player.getLocation().getBlockY() != pY || player.getLocation().getBlockZ() != pZ) { plugin.sendMessage(player, GRAY + L("movedTooFarAttunementFailed")); return; } Location pLoc = player.getLoc...
22782abc-0cbe-4c4b-a889-e2a522e604a4
7
@Override protected void execute(Scanner in, PrintStream out) { for (int display = in.nextInt(); display != 0; display = in.nextInt()) { LedNumber.reset(); out.print("Case <" + display); LedNumber.breakDisplay(display); for (display = in.nextInt(); display !=...
e972bd8a-b68a-45cd-bb2b-56c30350ba29
7
public void cellsMoved(Object[] cells, double dx, double dy, boolean disconnect, boolean constrain) { if (cells != null && (dx != 0 || dy != 0)) { model.beginUpdate(); try { if (disconnect) { disconnectGraph(cells); } for (int i = 0; i < cells.length; i++) { translateCell...
a8680217-19ab-4ddc-964f-769304a13142
3
@Override public void render(float delta) { // TODO Auto-generated method stub Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); playa.update(delta); if (playa.bounds.overlaps(exitPoint)) { loadMap(level++); loadObjects(); loadAssets(); } cam.update(); rend...
3a2d2b9e-92a3-4970-bc7f-87452ea41c3f
9
private Programa[] tryAgain(Programa[] p1, int nThreads) throws IOException, InterruptedException { Thread t1[]=new Thread[nThreads]; Programa retry[] = new Programa[nThreads]; inicializaPrograma(retry,t1,nThreads); int indice=0; for(int i=0;i<nThreads;i++){ System.out.println("tentar denovo"); if(p1[...
15ee27fa-5461-4c6c-95b8-7450e51eab64
2
public String[] getAllParameters(String name){ String[] params = this.requestParameters.get(name); if (null != params && params.length >= 1) { return params; } else { return null; } }
e7de59b4-8f86-4a4a-b144-a9e5cba78fe1
5
public void writeTypesArray(Object[] array) { // A big ol' case statement in a for loop -- what's polymorphism mean, again? // I really wish I could extend the base classes! for (int i = 0; i < array.length; i++) { if (null == array[i]) continue; // if the array at i is a type of array write a [ // ...
bd83b665-30c1-452a-8df1-f1aaafb5d881
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...
7302fefd-1091-4b85-8b9b-9021945f907c
9
public void startTerminalSimulation() { BufferedReader in = new BufferedReader(new InputStreamReader( System.in)); String userId; long lUserId; try { System.out.println("terminal> UserId: "); userId = in.readLine(); } catch (IOException e) { return; } try { lUserId = Long.parseLong(user...
a18ddb56-325c-4ce5-ae93-dd81d31d9177
9
@SuppressWarnings("unused") @Test public void testWordIterator() { //Create a few regions with text lines and words Page page = new Page(); PageLayout pageLayout = page.getLayout(); TextRegion r1 = (TextRegion)pageLayout.createRegion(RegionType.TextRegion); TextLine t11 = r1.createTextLine(); Word w111 = ...
dc534d50-f07a-4e18-8ada-5f76efcebeae
3
public Dimension getPreferredSize() { int x = 0, y = 0; for (Iterator<ZElement> e = enumElements(); e.hasNext();) { MPDEntite o = (MPDEntite) e.next(); x = o.getX() + o.getWidth() > x ? o.getX() + o.getWidth() : x; y = o.getY() + o.getHeight() > y ? o.getY() + o.getHe...
45bedf3b-1fd7-49b7-b164-a55b4c5e27ca
1
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); if (doc.isShowingAttributes()) { doc.showAttributes(false); } else { doc.showAttributes(true); } calculateTextState(doc); }
9d2904f1-9ed2-46b5-b559-0fbfe51b389a
8
@Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_RIGHT) camera.from.y++; if(e.getKeyCode() == KeyEvent.VK_LEFT) camera.from.y--; if(e.getKeyCode() == KeyEvent.VK_UP) camera.from.z++; if(e.getKeyCode() == KeyEvent.VK_DOWN) camera.from.z--; if(e.getKe...
0e737b97-4dcb-45a5-89bb-9c0bdb744d0f
0
@Override public void setQuestAnswer(ArrayList<String> answ) { }
eef64eb5-18e1-4fd7-99cc-e4bf90ae1141
7
public String genSmallDB() { String nextLine; URL url; URLConnection urlConn; InputStreamReader inStream; BufferedReader buff; this.smalldb = ""; for (Iterator<NEOCP> it = this.neocpData.iterator(); it.hasNext();) { NEOCP neocp = it.next(); ...
380caea9-7dbe-46d8-a28a-67433214b376
7
public void possibleMovesForPiece(Piece piece, Position positionCheck) { piece.resetPossibleMoves(); int x1 = positionCheck.getPositionX(); int y1 = positionCheck.getPositionY(); String pieceType = piece.getPieceType().toLowerCase(); char column = (char) (x1 + 65); String row = ""+(y1+1); String positio...
fe23f2f6-ade0-4db0-8421-e75e6e4bea38
9
public static FileSystemTask load(File path) throws Exception { /* make sure the path exists and is a directory */ if (!path.exists() || !path.isDirectory()) throw new Exception(path.getPath() + " does not exist."); FileSystemTask task = new FileSystemTask(); Debugger.addMessage("FileSystemTask.load: " + pa...
cea2309a-f015-4300-aa65-275dabd74389
9
@Override public SearchResult simpleSearch(Board board, Player player, int depth, Evaluation evfunction) { if (depth <= 0 || isEndState(board)) { return new SearchResult(null, evfunction.evaluate(board, player)); } else { /* there's more to check */ Set<Point> possibleMoves = MoveExplorer.explore(board, play...
3f14f319-9906-45aa-a3de-b825593e3699
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FertigungsplanNr that = (FertigungsplanNr) o; if (n != null ? !n.equals(that.n) : that.n != null) return false; return true; }
13ab11e2-680a-4ac5-81a5-ccdf64725cd3
2
public boolean converseBoolean(Object command) throws UnknownHostException, IOException, CycApiException { Object[] response = {null, null}; response = converse(command); if (response[0].equals(Boolean.TRUE)) { if (response[1].toString().equals("T")) { return true; } else { ...
c65fee14-13db-4638-88f8-f10cba11c301
1
public CacheableNode getNext() { CacheableNode cacheableNode = current; if (cacheableNode == head) { current = null; return null; } else { current = cacheableNode.nextNode; return cacheableNode; } }
350162ed-667c-45de-a732-04271c3f7f2f
9
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/topPerformers/{name}") public List<LeaderBoardEntry> getTopPerformers(@PathParam("name") String name) { List<LeaderBoardEntry> users = new ArrayList<LeaderBoardEntry>(); DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Query query = new ...
e36f4bd7-2156-42ca-b332-da818c69b160
5
public int func_27256_c(int var1, int var2) { int var3 = this.width / 2 - 110; int var4 = this.width / 2 + 110; int var5 = var2 - this.top - this.field_27261_r + (int)this.amountScrolled - 4; int var6 = var5 / this.slotHeight; return var1 >= var3 && var1 <= var4 && var6 >= 0 && var5 >= 0 &...
79159b35-033b-4a3e-8840-276638e738d9
9
public void addSymFile(String fileName) throws Throwable { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "ASCII")); int numRead = 0; int numInserted = 0; String line; while(true) { line = br.readLine(); if(line == null) break; if(line.contains(";")) ...
628f1461-d601-4bc8-ba98-ba2e02a1363d
1
@Override public String toString() { long t = Math.abs(isWorking()?seconds:time); int h = (int) (t/3600); int m = (int) ((t%3600)/60); int s = (int) (t%60); return String.format("%d:%02d:%02d", h,m,s); }
4a71d727-da66-441f-b688-f5a9ae5bc687
0
public void setRight(BSTNode right) { this.right = right; }
58467fc6-c451-4dd3-86f3-b7750b916c99
1
public void testConstructor_ObjectStringEx1() throws Throwable { try { new LocalTime("1970-04-06"); fail(); } catch (IllegalArgumentException ex) {} }
b262cfe2-764a-4cd6-812a-ad37bb9073d8
8
public static HashMap<String, List<RawDesignMatrixParser>> getByLastTwoTokens() throws Exception { List<String> headers = getTaxaIds(); HashMap<String, List<RawDesignMatrixParser>> map = new HashMap<String, List<RawDesignMatrixParser>>(); BufferedReader reader = new BufferedReader(new FileReader(ConfigReader....
d0274d99-f9dd-44c7-a7d5-ff06b461ec1d
7
public boolean rowExist(String sql) { boolean status = false; TRS RS = null; try { if (!connected) { throw new Exception("DB is DOWN"); } RS = execSQL_SV(sql); if (RS.rs.next()) { status = true; }...
7d3a145c-146e-45cc-91a6-af4596060568
8
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Docente)) return false; Docente docente = (Docente) o; if (atividades != null ? !atividades.equals(docente.atividades) : docente.atividades != null) return false; if (id != null ? !id.equals(docente.id) : docente.id...
0ee2fb45-b19e-479d-afc5-0bd4932b912d
9
private void recursiveSourceFileJavaSearch(boolean firstTime,String scriptFileJavaCannonPath,int rootFolderOfSourcesIndex,FileExt parentPath,String[] relPathList,ClassDescriptorSourceFileRegistry sourceRegistry,LinkedList<ClassDescriptorSourceUnit> updatedSourceFiles,LinkedList<ClassDescriptorSourceUnit> newSourceFiles...
e4840223-2bb7-4a0f-9954-e91e8418ba7b
8
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: String Mensaje; String p = ""; String d = ""; String c = ""; String v = ""; String f = ""; String ca = "";...
46508ed0-2246-4464-914e-8584137ed67e
6
public static void execute(GenejectorProblem problem) { if (instanceRole == InstanceRole.PROJECT || instanceRole == InstanceRole.RISEN) { if (executeIsRunning) { return; // TODO: Consider throwing an exception instead once we are able to propagate them properly to the realm instance } try { ...
da665ee9-e8f2-45c4-b63d-8d12877826ea
6
public void collect(Connection conn, PreparedStatement st, ResultSet res) { if (res != null) { try { res.close(); } catch (SQLException e) { } } if (st != null) { try { st.close(); } catch (SQLException e) { } } if (conn != null) { try { conn.close(); } catch (SQLException ...
8c97f14e-26e7-438b-881e-6b6fad09eafb
3
@Override public Decimal round(Decimal number, RoundingContext roundingContext, RoundingMethod roundingMethod) { switch (roundingMethod) { case DOWN: return roundDown(number, roundingContext); case UP: return roundUp(number, roundingContext); case HALF_UP: return roundHalfUp(number, roundingContext); ...
f5b96393-f513-4557-a304-1367f147ddd6
6
public java.awt.Color getColorAsColor() { if( customColor != null ) { return customColor.getColorAsColor(); } // If icv is System window text color=7FFF, default fg color or default tooltip text color, return black if( (icv == 0x7FFF) || (icv == 0x40) || (icv == 0x51) ) { return java.awt.Color.BLACK;...
5d14364f-adf3-4703-a53c-4fc373d28240
4
public static void printTree(CommonTree t, int indent) { if ( t != null ) { StringBuffer sb = new StringBuffer(indent); if (t.getParent() == null){ System.out.println(sb.toString() + t.getText().toString()); } for ( int i = 0; i < indent; i++ ) sb = sb.append(" "); for ( int i = 0; i < ...
f5070b89-3d69-4dc7-8b61-25440a2bcf03
4
private YamlConfiguration load(File configFile) { YamlConfiguration config = new YamlConfiguration(); if (!configFile.exists()) { checkConfig(configFile); } try { config.load(configFile); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { e.printStac...
1801580d-6c03-4665-b0cd-15ad70bb1c03
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."); ...
f2f4779c-f25e-4d21-94ae-b8a57cc4510d
9
public double getFine(Law laws, LegalWarrant W, MOB criminal) { String s=null; if(CMath.bset(W.punishment(),Law.PUNISHMENTMASK_SEPARATE)) { s=W.getPunishmentParm(Law.PUNISHMENTMASK_FINE); if((s==null)||(s.length()==0)||(!CMath.isNumber(s))) return 0; return CMath.s_double(s); } double fine=0.0; ...
379de375-043a-4dca-a45b-7bd6c3e2e55a
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JSONNumber other = (JSONNumber) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) ...
6f900779-a4ef-4ca1-bd32-36d7d0f0c32a
4
private void beTheHost(int port) { ServerSocket serverSocket = null; Socket socket = null; try { serverSocket = new ServerSocket(port); System.out.println("Host wartet auf anderen Spieler ..."); while (true) { socket = serverSocket.accept(); // accept connection if (socket.isConnected()) ...
a44bfc83-2145-4e63-87b9-b5c9f08a17a2
0
public void setFileFilter(FileFilter fileFilter) { this.fileFilter = fileFilter; }
176c108c-e034-4522-96d1-3d65ed08ae4b
8
private static void downHeapCost(DisiWrapper[] heap, int size) { int i = 0; final DisiWrapper node = heap[0]; int j = leftNode(i); if (j < size) { int k = rightNode(j); if (k < size && heap[k].cost < heap[j].cost) { j = k; } if (heap[j].cost < node.cost) { do { ...
392719c4-6f10-4828-901f-205072fba8af
7
public void plotTrainingSig(File trainFile) { theNet.clearTrainingData(); loadTrainingData(trainFile); DisplayGraph[] dispGraph = new DisplayGraph[CypherType.size()]; for (int i = 0; i< dispGraph.length; i++) { dispGraph[i] = new DisplayGraph(CypherType.fromIntToString(i) + " : Signiture Plot"); } ...
850c4213-d480-4eb4-b614-f05642f3f080
6
static Collection<String> appendPathToRuntime(final String strPath) throws IllegalAccessException, NoSuchFieldException { Set<String> pathSet = new HashSet<String>(); Field field = ClassLoader.class.getDeclaredField("usr_paths"); field.setAccessible(true); pathSet.addAll(Arrays.asList...
9af0afce-7a8c-4f84-88e8-da8ae0d3ab76
4
protected static void setLocalName() { EzimNetwork.localName = EzimConf.NET_LOCALNAME; // query username if isn't set yet if (EzimNetwork.localName == null || EzimNetwork.localName.length() == 0) { String strTmp = null; // obtain user name while(strTmp == null || strTmp.length() == 0) { strTm...
d090caef-76f2-4a1e-bc74-4ac68234c0bc
0
private void setupItems() { String sql = "SELECT * FROM Bumon ORDER BY BumonCode"; List<Bumon> items = getPersist().readList(Bumon.class, sql); setItems(FXCollections.observableArrayList(items)); }
585516c7-7984-49c7-b8cb-bf68cf5bdce9
2
public boolean canDraw() { return playStarted && turnDraws < Game.MAX_DRAWS_PER_TURN && turnPlays < 1; }
e388fedd-aab0-41ae-9a81-3507fb589e00
6
private static void encryption() { boolean e_loop = true; // default file names String fn= "pic", fex=".jpg"; do { System.out.println("\n\n\n+==+ ENCRYPTION +==+ \n\n"+ "-- 1 - Begin encryption -- \n"+ "-- 2 - Change file name. (Currently:" +fn+fex+") -- \n"+ "-- 3 - Go back -- \n...
2bee5000-351d-4017-9be2-fa6d27a32b01
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(affected==null) return super.okMessage(myHost,msg); if(affected instanceof MOB) { final MOB mob=(MOB)affected; if(((msg.amITarget(mob))||(msg.amISource(mob))) &&(msg.tool() instanceof Social) &&(msg.tool().Name()...
ff357ffd-1b3e-4c89-b4ed-11f78ed9ffac
1
public long getWorldAge() { if (sim != null) { return sim.getWorldAge(); } else return 0; }
7de228b8-f9d0-4ad4-bdc5-925a39aa8a06
6
public void sendPacket(DBSsocket socket) throws IOException { byte[] buf = null; String msg = new String(); msgArgs.add(packetType); if(version !=null) msgArgs.add(version); if(fileID != null) msgArgs.add(bytesToHex(fileID).toLowerCase()); if(chunkNo != -1) msgArgs.add(Integer.toString(chunkNo)...
a95e0aa4-2da1-4d73-b28c-2801b74ac28b
3
protected ConfigurationSerializable deserializeViaMethod(Method method, Map<String, Object> args) { try { ConfigurationSerializable result = (ConfigurationSerializable) method.invoke(null, args); if (result == null) { Logger.getLogger(ConfigurationSerialization.class.get...
f747a2a9-4743-43f7-98f0-f6b80a339e31
4
private void setPixel(int xCoord, int yCoord){ if((xCoord>=0 && yCoord>=0) && (xCoord<=69 && yCoord<=69)){ _X.add(xCoord); _Y.add(yCoord); } }
ea0494c4-4280-4787-a1ee-69e52b25f6a6
8
public void jam() { if(!blacklist.isEmpty()){ System.out.println("Blacklisted hosts:"); System.out.println(blacklist.toString()+"\n"); } hostdiscover hosty = new hostdiscover(device, ips_to_explore); hosty.discover(); String gatewayip = hosty.getGatewayIp(); HashMap<String,String> ip_mac_list = hosty...
7c40ba1c-866d-46dc-a3c5-aedb006d90f3
2
@Override public BigDecimal calculateTotal() { BigDecimal res = BigDecimal.valueOf(0); Product product; Map<Character,Integer> orderChars = this.getOrderChars(); Integer pi; for (Character pch : orderChars.keySet()) { pi = orderChars.get(pch); if (this.products.get(pch)!=null) { //calc total f...
a3d27b82-1810-46b7-b511-6b242f0ae793
3
public WinnerMenu(IWindow windowHandle, IGame game) { this.window = windowHandle; this.game = game; updateMap = new HashMap<>(); updateMap.put(Update.ChangeLanguage, new ChangeLanguageUpdate()); setLayout(new MigLayout("align center center, wrap 1", "[center]")); text = new JLabel(); back = new JButton...
ee4b30ac-1d3f-44ce-879b-34e5cab504d1
3
private void ButtonActions() { play1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { frame.dispose(); try { Thread.sleep(3); } catch (InterruptedException e) { e.printStac...
24c7e4bb-fbf1-4ebc-91d6-7639d3fdd454
5
private void heapify(int indeksi, int d) { int min = indeksi; for (int i = 1; i <= d;) { i = getLapsenIndeksi(indeksi, i); if (i <= keonKoko && taulu[i] <taulu[min] && taulu[i] != 0) { min = i; } } if (min != indeksi) { int ...
68b57ff4-0286-410c-960c-030c5478ad83
5
public static void limpaCampos(Container container) { for (Component component : container.getComponents()) { if (component instanceof JTextField) limpaTextField((JTextField) component); else if (component instanceof JComboBox) limpaComboBox((JComboBox) c...
4c3d95b6-8f53-40c9-9ddd-5ba825c45b39
6
public void processGroups() { groups = new ArrayList<Group>(); for (Square[] c : squares) { for (Square s : c) { if (s.piece != null) { boolean inGroup = false; for (Group g : groups) { if (g.pieces.contains(s.piece)) { inGroup = true; break; } }...
c939644a-7ac4-4cbb-88ba-a2e0503f32b8
8
@Override public void cycler() { // Choices String[] speedModes = { "Easy", "Normal", "Hard" }; // Input System String speedSelect = (String) JOptionPane.showInputDialog(null, "Choose Difficulty", "RunBitMan 2", JOptionPane.PLAIN_MESSAGE, null, speedModes, "Easy"); long speedDeclare = 100; if ((...
f4d255e9-0ef1-4d05-a8a4-b9ccef2356d2
0
public int getTailleLigne(){ return Integer.parseInt(propriete.getProperty("taille")); }
efefe91a-823d-4926-879c-1df6f3bfab4b
2
public int[] generate(int nplayers, int bowlsize) { Random random = new Random(); int nfruits = nplayers * bowlsize; int[] dist = new int[12]; int left1 = (int) Math.floor(0.75*nfruits); int left2 = nfruits - left1 + 1; for (int i = 0; i < 6; i++) { int cnt ...
4575f1a1-6c7b-47de-bae0-96549e529dca
4
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String id = req.getParameter("id"); if (id==""){ id="0"; } String message; Book book = bookDao.getBookById(Integer.parseInt(id)); if ((!cardDao.isBookPresent(book)) && (!readingRo...
912ba2ee-dd9b-43cf-ac48-d7a746bf7b25
4
public synchronized void gridletMove(int gridletId, int userId, int destId, boolean ack) { // cancels the Gridlet ResGridlet rgl = cancel(gridletId, userId); // if the Gridlet is not found if (rgl == null) { System.out.println(super.resName_ + ...
50d994f7-5305-40e0-8aff-224abe88f731
0
public Message() { this.sysMessage = "系统资讯:" + new Date().toString(); }
be97a630-f318-44d6-8cd7-5a13274eaafb
0
public NBitColors(int bitsPerChannel) { this.bitsPerChannel = bitsPerChannel; this.channelMask = (1 << bitsPerChannel) - 1; this.additionalShift = 8 - bitsPerChannel; this.maxVal = (1 << (3 * bitsPerChannel)) - 1; }
19f86188-f0f4-4210-9241-9aa5a2121f1a
5
private int handleX(String value, DoubleMetaphoneResult result, int index) { if (index == 0) { result.append('S'); index++; } else { if (!((index == value.length() - 1) && (contains(value, index - 3,...
bbc5c384-4b86-49a5-bd32-fbc247ecd1b9
6
private static String packCurrentStatePacket(Packet packet) { StringBuilder sb = new StringBuilder(); ServerGameState sgs = (ServerGameState) packet.getData(); sb.append("\n"); sb.append(Packet.PACKET_CODES.ACTIVE_USER + " " + sgs.activePlayer +...
321ea328-af56-49b4-9162-484e0509b0a1
5
public static void main(String[] args){ Polylinje p = new Polylinje(); ValjPolylinje d = new ValjPolylinje(); Polylinje.PolylinjeIterator pd; p.laggTill(new Punkt("A", 2, 4)); p.laggTill(new Punkt("B", 5, 4)); System.out.println(p.toString()); p.laggTillFramfor((new Punkt("C", 4, 6)),"B"); System....
3ea3d6d3-4641-4267-9b53-3c9090dc1d9e
0
public String getName() { return name; }
be210baa-76b3-4aac-b833-04c3a16fe09f
9
public ObjModel(String fileName){ positions = new ArrayList<Vector3f>(); texCoords = new ArrayList<Vector2f>(); normals = new ArrayList<Vector3f>(); indices = new ArrayList<ObjIndex>(); hasNormals = false; hasTexCoords = false; BufferedReader meshReader = null; ...
05ee89a0-297e-4a88-ba26-8bcbd09c695b
6
private static void run() { while (!finished) { // Always call Window.update(), all the time Display.update(); if (Display.isCloseRequested()) { // Check for O/S close requests finished = true; } else if (Display.isActive()) { ...
62b8ac73-daee-4d53-9e4c-b9350de27e2b
7
public RawType qualifyType(String type) { List<RawType> options = new ArrayList<RawType>(); for (SpecificImport imp : specificImports) if (imp.type.equals(type)) options.add(new RawType(imp.module, type)); if (options.isEmpty()) for (WildcardImport imp : w...
a9c70bcc-1872-41c5-bf0e-e92b22defdea
4
private static boolean generateCsvFile(String sFileName, String contenu) { boolean fichierGenere = false; File csv = new File(Constantes.repertoire); if (!csv.exists() && !csv.isDirectory()) { new File(Constantes.repertoire).mkdir(); } try { FileWriter w...
053c5076-330e-4db8-a4f8-3bf390097be5
2
@Override public boolean equals(Object obj) { OBJIndex index = (OBJIndex)obj; return m_vertexIndex == index.m_vertexIndex && m_texCoordIndex == index.m_texCoordIndex && m_normalIndex == index.m_normalIndex; }
5f7418fe-b05f-4410-933e-296f472b6d93
8
protected void setValues(WorldNode[][] world) { if(log.isLoggable(Logger.INFO)) log.log(Logger.INFO, "World-Panel wird neu gezeichnet."); /* * TODO: komische Exception, nicht unmittelbar reproduzierbar: * Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException...
8314bb90-c459-4ddd-adff-7d41fd0306ee
0
@Test public void testToString() { UserAgent userAgent = UserAgent.parseUserAgentString("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"); assertEquals(OperatingSystem.WINDOWS_XP.toString() + "-" + Browser.IE6.toString(), userAgent.toString()); }
25be03c5-5ca7-4a78-9924-8d8d9be2f2d4
6
private void update() { if (server != null) { if (timeToAddMob <= 0) { addMob(); timeToAddMob = 60 * 10; } timeToAddMob--; } key.update(); if (!key.pause && !key.menu) { level.update(); } if (player.isRemoved()) { respawn_in--; if (respawn_in <= 0) { player.setHP(100); ...
64a4301c-9a08-4ae8-9b1d-bc0ad56cb886
5
@Override public void run() { try { while(!isClosed) { byte type = (byte) is.read(); if(type == 1) { DCPackage dp = receiveDCPackage(); if(listener == null) { messageBuffer.add(dp); } else { listener.addInput(dp); } } else { NetStatPackage nsp =...
a7883f36-4ab1-4cae-aad8-3382ec979d9e
4
public PolarVector face(Vector target) { double pitch, yaw = this.yaw; if (target.x == 0 && target.z == 0 ) pitch = target.y > 0 ? -90 : 90; else { yaw = (float) Math.toDegrees((Math.atan2(-target.x, target.z) + (PI * 2)) % (PI * 2)); pitch = (float) Math.toD...
e0925361-7543-4b5b-9761-372212b4fb12
2
public static Item get(ItemObject object){ Item item = null; switch(object){ case smallHealthPotion: item = new HealthPotion("kleiner Heiltrank", 100, "res/items/P_Red02.png"); break; case smallManaPotion: item = new ManaPotion("kleiner Manatrank", 100, "res/items/P_Blue02.png"); break; } return...
26100a2e-f2af-4fa6-b091-099cf0b84e79
1
public static void main(String[] args) throws IOException { encode74 encoder = new encode74(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]))); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1]))); int c; while((c = in...
bc41090c-faf1-4976-863c-ca677327bfb4
6
@Override public void update(GameContainer gc, int delta) throws SlickException { p.tick(gc); if (isConnect()) { p.sendX(n); p.sendY(n); p.sendHealth(n); n.sendKeepAlive(1000); } for (MPPlayer mpp : players.values()) { mpp.tick(gc); } for (Stain s : stains.values()) { s.tick(gc); } fo...
3c485eee-8e72-4f63-adcd-99574590aab2
4
public void drawBoard() { String piece = ""; System.out.println("\n -----------------------------------------------"); for (int row = 0; row < 8; row++) { System.out.print(8 - row + " | "); for (int col = 0; col < 8; col++) { if (board[row][col] != null) { if (board[row][col].isWhite) ...
6927bc60-9e75-498a-84e8-1f0039492c16
6
public static boolean areIdenticals(File oldFile, File newFile) { if(oldFile.length() != newFile.length()) return false; try { FileInputStream fis = new FileInputStream(oldFile); FileInputStream fis2 = new FileInputStream(newFile); byte[] buffer1 = new byte[1024]; byte[] buffer2 = new byte[1024];...
ea3eb83b-c416-4528-8dd0-d5d6418775ea
2
public void printTable() { for (int i = 0; i < m; i++) { if (table[i] == null) { System.out.println("m = " + m + " i = [" + i + "] - null"); } else { System.out.println("m = " + m + " i = [" + i + "] - " + table[i].getKey() + " | " + table[i].getI()); ...
d3c4d812-c57f-4498-a63d-4e9a7fc79067
0
public CheckResultMessage checkTotal1(int i){ return checkReport1.checkTotal1(i); }
6e5832c5-0f86-42b8-b6ea-bc426c37537a
1
int findPivot(Comparable<?> a[], int i, int j) { Random r = new Random(); int k =(i + (Math.abs(r.nextInt()) % (j - i))); System.out.println(k); return k; }
6132cba3-2cc1-4d7c-ae74-b695f091e12b
6
final void k(int i) { anInt5622++; int i_171_ = Class70.sineTable[i]; int i_172_ = Class70.cosineTable[i]; for (int i_173_ = 0; (anInt5557 ^ 0xffffffff) < (i_173_ ^ 0xffffffff); i_173_++) { int i_174_ = ((anIntArray5543[i_173_] * i_172_ + anIntArray5644[i_173_] * i_171_) >> 212706478); an...
9cd2bd0c-75f1-43b9-b3fa-ee5498bab53a
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((algorithm == null) ? 0 : algorithm.hashCode()); result = prime * result + ((scheme == null) ? 0 : scheme.hashCode()); long temp; temp = Double.doubleToLongBits(rmax); ...
b0f09ee2-2ee7-490c-a597-62cd4b480d44
7
private boolean r_postlude() { int v_1; int v_2; // (, line 203 // Boolean test Y_found, line 203 if (!(B_Y_found)) { return false; } // repeat, line 20...
e2856201-7a0c-4f6e-b20f-53f6ef411c68
8
@EventHandler public void playerLeftClicked(PlayerInteractEvent event) { if (!event.hasItem()) { // event.getPlayer().sendMessage("Strength of Hercules!"); } if (HumanTorch.playersInTorchState.contains(event.getPlayer())) { if (event.getAction().equals(Action.LEFT_CLICK_AIR)) { event.getPlayer().launch...
dac17da1-3964-4361-a6af-8badf9a74c65
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
3c74b6f6-6fb3-42b6-bf9e-e737cbfa24ee
2
@Override public void execute(CommandExecutor player, String[] args) { File levelsFolder = new File("levels"); File[] levelFiles = levelsFolder.listFiles(); StringBuilder finalStr = new StringBuilder(); for(File f : levelFiles) { if(f.getName().split("\\.")[1].equals("ggs")) { finalStr.append(f.g...
21d64207-5387-478b-a1ff-c74618dec0a9
8
private void getMinMax(int data[][], ChannelDefinition definitions[]) { for(int i = 0; i < data.length; i++) { double min = 0; double max = 0; double scalingValue = definitions[i].getSensitity() * definitions[i].getSensitivityCorrection(); for(int j = 0; j < data[i].length; j++) { if(min ...
522ee772-44f4-472d-bc12-4f978dd7fc6a
3
public void start() { Action newAction = new Action(x, y, z, getCurrAction(), 2, diskCount); actions.push(newAction); if (!TowersOfHanoi.repaintAndWait()) {return;} if (recursive(x, y, z, diskCount)) { TowersOfHanoi.solved = true; String execTime = TowersOfHanoi....