method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4736466f-fead-40d3-8928-572a59738144
9
@Override public boolean capturar(Posicao posicaoInicial, Posicao posicaoFinal) { for (int aux = 0; aux < 8; aux++) { if ((posicaoInicial.getColuna() + aux == posicaoFinal.getColuna()) && (posicaoInicial.getLinha() + aux == posicaoFinal.getLinha())) { return true; } ...
012b7685-1e5e-4557-a433-5f7b75d97f95
0
public static void main(String[] args) { // Working with Accessors and Mutators Rectangle rectangle = new Rectangle(20, 50); rectangle.grow(5, 10); System.out.println(rectangle.getWidth()); System.out.println(rectangle.getHeight()); }
549c09c6-8287-4e2b-9929-e5cfaf19cec6
6
public int computeArithmeticValue() { if (!isConstExpression()) { throw new IllegalStateException("not const expression"); } switch (op) { case ADD: return lValue + rValue; case SUB: return lValue - rValue; case MUL: return lValue * rValue; case DIV: return lValue / rValue; case NEG: r...
ae375cf1-5b5c-43dc-8856-e50c813821c4
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g...
54a50261-7012-4243-956e-c1c79f73bef7
2
private void initialiseManagers() { if ( SQLManager.initialiseConnections() ) { DatabaseTableManager.createDefaultTables(); AnnouncementManager.loadAnnouncements(); // if ( MainConfig.UserSocketPort ) { // SocketManager.startServer(); ...
369c6cbb-6e79-4d7d-974a-125b9bd8f4e3
9
public void teach(double ordM, double invM) throws IOException{ double[] in; NeuronKoh lastWin = winner; while(!teached()){ in = ImageGenerator.getInstance().getRandLetterNoise(ordM,invM); neurons.get(0).trigger(in); winnerNET = neurons.get(3).lastResult; ...
a633552f-d6ee-40b5-af5b-6a6a45b84347
0
public static short getSample(byte[] buffer, int position) { return (short)( ((buffer[position+1] & 0xff) << 8) | (buffer[position] & 0xff)); }
9abfc70d-2b1b-4910-b336-0aef5c12668c
9
public static void show(JFrame parent) { createComponents(); JPanel conent = createGUI(); int choice = 0; while (true) { choice = JOptionPane.showOptionDialog(parent, conent, Main.TITLE_MED, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, ...
fc2d6392-4405-4765-9ed0-72c542fd8ef7
7
public static void selectWordRightText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; int currentPosition = textArea.getCaretPosition(); String text = textArea.getText(); int text_length = text.length(); if (currentPosition == text_length)...
6e91651d-d9a9-438c-932b-8f97184a6942
7
@Override public void showDialog(DialogAction dialogAction, int row, String code) { if (DialogAction.UPDATE.equals(dialogAction) && (row == BAD_ROW || code == null)) { throw new UnsupportedOperationException("You can not perform this action"); } JDialogTeacher dialogTeacher = ne...
4df14f4e-b3ac-4dc8-b279-0667bb831ca3
2
public void open() { FileNameExtensionFilter filter = new FileNameExtensionFilter( "Windows BMP file", "bmp"); FileNameExtensionFilter filter2 = new FileNameExtensionFilter( "JPEG file", "jpg", "jpeg"); FileNameExtensionFilter filter3 = new FileNameExtensionFilter("PNG", "png"); // TODO all img Fi...
196d3c85-b9db-4990-ac0a-1d5b6d363479
8
@Override public List<Predicat> createPredicats(Request request, List<Predicat> predicats) throws Exception { DataSetApplication dsApplication = (DataSetApplication) getContext().getAttributes().get("DataSetApplication"); DataSet ds = dsApplication.getDataSet(); Form params = request.getResourceRef().ge...
d89a46e2-2d15-49d3-a291-2de6ec0be266
0
public static boolean keyboardKeyState(int key) { return keyboardState[key]; }
24217f99-c2cb-4fe3-97b2-83d0f90eed2e
6
protected void play() throws Exception { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); tick = 0; printConfig(); printStep(); for (tick = 1; tick <= MAX_TICKS; tick++) { // step by step trace if (trace) { ...
de4b2464-8c70-45b9-bf02-6dbe4c6e17b4
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Coordinate other = (Coordinate) obj; if (x != other.x) return false; if (y != other.y) return false; return true; }
9b090e99-9f37-4996-b85c-77f768e43ed1
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhpposSalesItemsTaxesEntity that = (PhpposSalesItemsTaxesEntity) o; if (itemId != that.itemId) return false; if (Double.compare(that.percent, p...
2df19f3f-159f-44f8-92e8-ea3fd1d0c50f
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CPU other = (CPU) obj; if (cacheSize != other.cacheSize) return false; if (frequency != other.frequency) return false; if (numberOfCore...
01ea0d2a-cb3c-4c44-a717-e27081de3e5d
1
public void ih(String[] n) { for (int i = 0; i < n.length; i++) { System.out.println(n[i]); } }
b0ee7199-a3d9-4796-bf47-3752431a698f
0
private JCellule[][] getGrid() { WindowPrincipale window = (WindowPrincipale) this.getParent().getParent().getParent().getParent().getParent(); return window.getPanelGrid().getGrid(); }
fcd52667-b5c6-497c-b9ef-73d1be11702e
9
private boolean isValidDiagonalMove(int r1, int c1, int r2, int c2) { if (Math.abs(r1 - r2) != Math.abs(c1 - c2)) { return false; } int stepR = r1 - r2 < 0 ? 1 : -1; int stepC = c1 - c2 < 0 ? 1 : -1; if (stepC > 0) { for (int r = r1 + stepR, c = c1 + step...
96ed9750-10bd-4ef5-947c-79b276fffb9c
6
private void Flug ( int num, int lineNum, String str ) { //tOɂG[ switch ( num ) { case 1: System.out.print ( "Error: ̃}bvLqĂ܂Aǂꂩ‚ɓꂵĂ" ); break; case 2: System.out.print ( "Error: Õ|Cgłɑ݂Ă܂" ); break; case 3: System.out.print ( "Error: oH̓łɑ݂Ă܂" ); break; case 4: System.out.pri...
3b38d10c-a9a8-40ed-9e96-c5e0661e9e9e
7
public int resolve(boolean enhancedVerbosity) { if (upper.equals(BigInteger.ZERO)) return 0; if (upper.equals(BigInteger.ONE)) return 1; int rightMostBit = upper.getLowestSetBit(); BigInteger oddDivisor = upper.shiftRight(rightMostBit); int first = resol...
f083b629-4ed1-4e03-9138-f7952f2a39de
0
public void clearSelectedTransitions() { selectedTransitions.clear(); }
19ee591f-eef9-4cdd-9e1a-3cd0fe7f5388
1
private JFormattedTextField getTextField( JSpinner spinner ) { JComponent editor = spinner.getEditor(); if ( editor instanceof JSpinner.DefaultEditor ) { return ( ( JSpinner.DefaultEditor )editor ).getTextField(); } else { System.err.println( ...
be82a927-0b1a-4f81-aa04-145361602e5d
8
public List<TreeNode> generateTrees(int n) { if(n<0) return null; myele []Trees =new myele[n+1]; if(n==0) {myele t= new myele();t.add(null);return t.value;} Trees[1] = new myele(1); if(n==1){return Trees[1].value;} TreeNode root; for(int i=2;i<=n;i++) { Trees[i] = new myele(); ...
31011962-732f-450a-88f1-2ad69c7ec45c
9
protected synchronized String getLine(String prefix) throws IOException { long midpoint; String rightHalf; String leftHalf; String currentLine; int comparison; String match = null; long lower = 0; long upper = getFileSize(); long range = (upper - lower); long seekTarget = getFilePointer(); // L...
b24918f5-6076-4b26-befa-601b75cd63b0
4
final public void run() { connectionEstablished(); // The message from the server Object msg; // Loop waiting for data try { while (!readyToStop) { // Get data from Server and send it to the handler // The thread waits indefinitely at the following // statement until something is received fr...
4692c8cc-52df-4afa-bbd3-dcf41b0767d4
3
public void setExpLogica(PExpLogica node) { if(this._expLogica_ != null) { this._expLogica_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.par...
409e6e5e-0198-417a-a3e7-dd6f46c492f0
9
public GL_Mesh makeMeshObject(GL_OBJ_Reader objData) { ArrayList verts = objData.vertices; ArrayList txtrs = objData.textureCoords; ArrayList norms = objData.normals; ArrayList faces = objData.faces; // make a new mesh mesh = new GL_Mesh(); mesh.name = objData.fi...
b2fded24-af99-4722-8b45-891cd439906f
5
public void connect() { if (username.length() == 0) { return; } if (portField.length() == 0) { return; } if (serverField.length() == 0) { return; } int port = 0; try { port = Integer.parseInt(portField);...
36f5e05d-9662-4cac-b711-68413e75ab80
4
public void removeFromCW() { if (c.castleWarsTeam == 1) { if (c.inCwWait) { Server.castleWars.saradominWait.remove(Server.castleWars.saradominWait.indexOf(c.playerId)); } else { Server.castleWars.saradomin.remove(Server.castleWars.saradomin.indexOf(c.playerId)); } } else if (c.castleWarsTeam == 2) ...
8d3a5984-4b80-47ae-8190-b0d320b0a4ce
6
public static boolean isValidDimension(double width, double height) { if (width < 0 || height < 0) return false; if (width > Double.MAX_VALUE || height > Double.MAX_VALUE) return false; if(Double.isNaN(width) || Double.isNaN(height)) return false; return true; }
cf78fd14-a628-499b-a2e7-ef740a9d38cc
0
@FXML private void handleBtnCancelAction(ActionEvent event) { userAction = UserAction.CANCEL; hide(); }
83636578-fcfc-4bc1-86e4-4c85903b7b5e
6
private void getSaisieCryptanalyse() { ISaisieCryptanalyse s=new SaisieCryptanalyse(this, this.menu); while(s.estEnCours() && !this.stop) { try { Thread.sleep(100); } catch (InterruptedException e) { } } s.masquer(); if(!this.stop) { if(s.getType()!=null) { IMessage m=s.getMessage(); I...
5b21c663-b8fb-44ad-8ac1-063d5e2973a8
6
public void retry(String query) { boolean passed = false; Connection connection = open(); Statement statement = null; count = 0; while (!passed || count < timeout) { try { statement = connection.createStatement(); statement.executeQuery(query); statement.close(); connection.close(); pa...
94ec82b2-c57d-42c6-a724-774da4417666
2
public void update() { speedX = bg.getSpeedX() * 5; tileX += speedX; r.setBounds(tileX, tileY, 40, 40); if (r.intersects(Robot.yellowRed) && type != 0) { checkVerticalCollision(Robot.rect, Robot.rect2); checkSideCollision(Robot.rect3, Robot.rect4, Robot.footleft, Robot.footright); } }
f0fcc48f-6372-4cdb-8fa8-80793736def3
6
@SuppressWarnings("unchecked") public synchronized Resource getResource(Object key){//How can I get the referent from the key? I'd like to check if the specified referent has been enqueued. if(shutdown) throw new IllegalStateException(); boolean keyAvailable = true; while(true){ PhantomReference<Obje...
58b8d9e3-ef04-4ddc-a5ed-b8e68fe6aefe
5
public static void main(String[] args) throws PriceException { PropertyConfigurator.configure("src/resources/java/Log4J.properties"); Client cl = new Client("Jan", "Kowalski"); Client cl2 = new Client("Bartosz", "Posiakow"); try { cl.addMotorcycle(Brand.Honda, "CBR 600RR", 59000, 2003); cl.addMotorcycle...
9051a322-9323-4f7f-a0f2-5f2e6c90d05c
3
public static SpriteID getSpriteID2(EntityType type) { switch (type) { case OBJ_TREE: return EnviroSprite.tree_dead_1; case OBJ_DOOR_WOOD: return EnviroSprite.door_wooden_open; case ENTR_DUNGEON: return EnviroSprite.stone_hatch...
a9932096-ba96-442a-8450-354ef0b2605e
9
private boolean execGetFeatureGroup(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) throws SQLException { int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt"); String clientName = (String) queryParam.getVal(clntIdx); int usrIdx = queryParam.qpIndexOfKeyNoCase("usr"); if (...
c58a0ef8-6b23-4d72-8095-f10eb5da6924
7
public JSONArray getJsonValue() throws Exception { List<Element> taskElementList = tasksElement.getChildren("Task"); JSONArray returnJsonArray = new JSONArray(); for (Element taskElement : taskElementList) { String taskUseVar = taskElement.getAttributeValue("var"); if...
7bcd157e-f354-4320-918d-a545a322c68e
8
@EventHandler(priority = EventPriority.NORMAL) public void onBlockBreak(BlockBreakEvent event){ Block block = event.getBlock(); if ((block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)) { Sign s = (Sign)block.getState(); if(!plugin.loc.containsKey(block.getLocation())){ for(in...
4debc82b-c691-4250-9c80-e2bea13c4971
2
public String[] getVariablesOnRHS() { ProductionChecker pc = new ProductionChecker(); ArrayList list = new ArrayList(); for (int i = 0; i < myRHS.length(); i++) { char c = myRHS.charAt(i); if (ProductionChecker.isVariable(c)) list.add(myRHS.substring(i, i + 1)); } return (String[]) list.toArray(new ...
bc51e7df-b901-4c76-a23b-963c66fb9a70
7
public void deleteUser(String username) { boolean active; String activeBoolean = null; try { String table = "users"; String[] fields = {"active"}; crs = qb.selectFrom(fields, table).where("username", "=", username).executeQuery(); if(crs.next()) { active = crs.getBoolean("active"); if(act...
ca62f715-e472-40a3-abd3-a096c4de18e0
1
protected EngineLog(String name, boolean displayOnConsole) { logger = Logger.getLogger(name); getLogger().setLevel(TRACE_LEVEL); if(displayOnConsole) { ConsoleHandler cLogger = new ConsoleHandler(); cLogger.setLevel(TRACE_LEVEL); getLogger().addHandler(cLogger); } //TODO Add a static path for log ...
e99e8f34-7bd2-4aa2-87d2-e11461366405
2
public void deletePatient(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{ log.debug("PatientManager deletePatient method called..."); int healthRecord=Integer.parseInt(request.getParameter("healthrec")); PatientService patientService=new PatientServiceImpl(); try{...
81125087-a680-4870-9f78-5ccd0b7f68a3
1
public DrawableComponent loadAsModel(boolean state) { if (!opaque) { this.loadAsModel = state; } else { this.loadAsModel = false; } return this; }
2604a2db-2d83-4142-871f-87de4346e717
9
protected void readData() throws IOException { int index, r, g, b; switch (img.data.header.colorType) { case PngImage.COLOR_TYPE_PALETTE: if (length != 1) badLength(1); index = in_data.readUnsignedByte(); if (img.data.palette == null) t...
b28f28cc-779b-4fc2-bd0e-048df7e1c908
3
public void repaintTripleBuffer(Rectangle dirty) { if (tripleBuffered && tripleBufferGraphics != null) { if (dirty == null) { dirty = new Rectangle(tripleBuffer.getWidth(), tripleBuffer.getHeight()); } // Clears and repaints the dirty rectangle using the // graphics canvas as a renderer ...
1e12fb05-7ef2-41b6-a01f-7dede3995655
3
public void writeLine(String line,Color col,Font font) { if (line!=null) { if (logging==true) fileWriteLine(line); if (pauseDisplay==false) display_view.addLine(line,col,font); } }
8370e1a4-9c4e-4509-b5f1-d5a1386412cc
8
private void loadSegments() { File file = null; for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].getName().equals( "roadSeg-roadID-length-nodeID-nodeID-coords.tab")) { file = listOfFiles[i]; break; } } try { Scanner sc = new Scanner(file); sc.nextLine(); while (sc.h...
d5aab3be-4b7d-4ffc-94b4-a987b6e33295
4
public Iterable<Key> levelOrderTraversal() { Queue<Key> q = new LinkedList<Key>(); if (root == null) return q; Queue<Node> tempQ = new LinkedList<Node>(); Node n = root; tempQ.add(n); while (!tempQ.isEmpty()) { n = tempQ.poll(); q.ad...
235a907f-dfc6-41ca-9120-db4a42e301c3
7
public static boolean arrayEquals(byte[] a, byte[] b) { if (a == null && b == null) { return true; } else if (a == null || b == null) { return false; } else if (a.length != b.length) { return false; } for (int i = 0; i < a.length; i++)...
26bafdd9-55de-4097-87b1-82bc424ede8e
9
private boolean isHeap(){ for (int i = 0; i<theHeap.size(); i++){ E toCompare = theHeap.get(i); if ( (hasLeftChild(i) && theHeap.get(leftChild(i))!=null && toCompare.compareTo(theHeap.get(leftChild(i)))*(isMax ? 1:-1)<0) || (hasRightChild(i) && theHeap.get(rightChild(i))!=null && toCompare.compar...
cd5ba455-2af0-40dc-821c-405dff9a3574
4
public static String optimizeText(String s) { for (int i = 0; i < s.length(); i++) { if (i == 0) { s = String.format( "%s%s", Character.toUpperCase(s.charAt(0)), s.substring(1) ); } if (!Character.isLetterOrDigit(s.charAt(i))) { if (i + 1 < s.length()...
175a8b97-fda6-40cb-96be-4bdb1740ea03
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Node node = (Node) o; if (value != node.value) return false; if (left != null ? !left.equals(node.left) : node.left != null) return false; ...
30534173-95a8-4be0-9066-036ecf3da17a
6
private static void createReviewsOfPerson(ObjectBundle bundle, Person person, Integer reviewNr, Integer count, ValueGenerator valueGen, DateGenerator dateGen, NormalDistRangeGenerator prodNrGen, DateGenerator publishDateGen, RandomBucket true70) { for(int i=0;i<count;i++) { int product = prodNrGen.getValu...
66fc7513-b5eb-4bbb-b25c-d893f2cd1612
9
private static List<NameAndType> getColumns(Class<?> bean) { List<NameAndType> columns = new ArrayList<NameAndType>(); Field[] fields = bean.getDeclaredFields(); if (fields != null) { for (int i = 0; i < fields.length; i++) { Field field = fields[i]; i...
b484168a-415f-48f2-aadc-6c5c1bdcbd42
3
@SuppressWarnings({ "unchecked", "rawtypes" }) public Hashtable getValues() { Hashtable table = new Hashtable(); for (int i = 0; i < textField.size(); i++) { if (!field[i].getClass().isAssignableFrom(ArrayList.class)) { table.put(text.get(i).getText(), textField.get(i).getText()); } else { String[]...
63026ff4-c7fb-428c-a3e8-ca45602d24c8
4
public String toString() { final String[] SUITS = {"CLUBS", "DIAMONDS", "HEARTS", "SPADES"}; if (value == 0) { return "A" + " " + SUITS[suit]; } else if (value == 12) { return "K" + " " + SUITS[suit]; } else if (value == 11) { return "Q" + " " + SUITS...
d3239ed0-19cc-461d-bac8-8ad8715d48ef
1
public Connection getConnection() { try { return DriverManager.getConnection(direccion, usuario, password); } catch (SQLException e) { System.out.println("Fallo la conexion con la base de datos"); e.printStackTrace(); } return null; }
6392b4b5-076e-4072-8d96-fd99f191a934
7
private void onStartRun(){ logPanel.add("Started exposing on <strong>" + _postedTarget + "</strong>", LogPanel.OK, true); if(_dataFormat.hasChanged()) _unsavedSettings = true; if(_unsavedSettings && !EXPERT_MODE) _disableAll(); startRun_enabled = false; stopRun_enabled = true; postApp_enabled ...
16c23f44-69b7-4f2c-b12a-37f92b473122
7
@EventHandler( priority = EventPriority.MONITOR ) public void onPlayerInteractMonitor( PlayerInteractEvent event ) { if ( event.isCancelled() ) return; if ( event.getAction() == Action.RIGHT_CLICK_BLOCK && MyDoor.isDoor( event.getClickedBlock() ) ) { final MyDoor var1 = MyDoor.getDoor( event.getClicked...
6e25800e-d4a8-4c4c-852e-b52b11ee70f2
9
public int countDirection(Board board, char token, int column) { int[][] direction = { { -1, 0 }, { -1, 1 }, { 0, 1 }, { 1, 1 }, { 1, 0 }, { 1, -1 }, { 0, -1 }, { -1, -1 }, { -1, 0 } }; int j = board.getTopPosition(column); int count = 0; for (int i = 0; i < 4; i++) { if (verifyIn(board, column + directi...
9fb048a7-1434-4cbc-bf3a-f847ecd1ac82
7
public static Map<Integer, Set<Integer>> getTestQueryAnswers(String queryAnswersPath) { Map<Integer, Set<Integer>> queryAnswers = new HashMap<Integer, Set<Integer>>(); int queryIdColumn = 0; int queryAnswersColumn = 1; BufferedReader reader = null; String line; String q...
812c1618-7a05-4987-98af-714750f86bc1
8
public boolean findParticles(int ChNumber) { int i,TotCh; GenericDialog fpDial = new GenericDialog("Detect Particles"); //String [] DetectOptions = new String [] { // "1. Intensity maximum","2. Intensity shape"}; String [] sSensitivityOptions = new String [] { "Very dim particles (SNR=3)", "Dim particle...
dd7c8685-0941-47f3-9f26-80a40630f7c2
5
@Override public void update(int id_task, int id_user, Boolean active) { try { connection = getConnection(); ptmt = connection.prepareStatement("UPDATE Task_executors SET id_task=? id_user=? active=?" + " WHERE id_task=? id_user=?;"); ptmt.setInt(1, id...
d0c23052-cc9a-48f2-b7fa-b05fbea656ee
0
public Optional<Status> poll(URL url) { RestTemplate restTemplate = new RestTemplate(); return Optional. fromNullable( restTemplate.getForObject(url.toString(), Status.class)); }
23d9ad3f-8d1a-46bb-b717-6328fd0931ff
0
@Override public void sayToBomberman(String message) throws IOException { serverSideWriter.append(message).append("\n").flush(); message = clientSideReader.readLine(); System.out.println("**************************************************"); System.out.println("To player " + this.num...
3a0275bd-be1b-47d4-ae31-c791f3648166
2
public synchronized T take() { while (elements.isEmpty()) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } T el = elements.removeFirst(); notify(); return el; }
d3443c5e-a4e8-471f-90c1-7a67f7e94278
5
public SpriterKeyFrame[] buildKeyFrameArray(Animation animation){ MainLine mainline = animation.getMainline(); List<TimeLine> timeLines = animation.getTimeline(); List<Key> keyFrames = mainline.getKey(); SpriterKeyFrame[] spriterKeyFrames = new SpriterKeyFrame[keyFrames.size()]; for(int k=0;k<keyFr...
54668dd3-26fb-4aa3-bf62-fc63976645cb
1
public void enqueue(double waketime, Agent agent) throws IllegalArgumentException { if (waketime < _currentTime) throw new IllegalArgumentException(); _queue.add(new Node(waketime, agent)); }
50ede17d-86cb-4be8-874a-96ecbedd9328
3
protected void func_27260_a(int var1, int var2, Tessellator var3) { super.func_27260_a(var1, var2, var3); if (this.field_27268_b == 0) { GuiStats.drawSprite(this.field_27274_a, var1 + 115 - 18 + 1, var2 + 1 + 1, 18, 18); } else { GuiStats.drawSprite(this.field_27274_a, va...
d1c68c2f-cb43-42ce-b6d3-382dcf5a94dd
3
@Override public boolean equals(Object o) { if (o instanceof Vector3D) { Vector3D p = (Vector3D) o; double xD = p.x - x, yD = p.y - y, zD = p.z - z; return xD == 0 && yD == 0 && zD == 0; } return false; }
1e51808c-6e4a-437d-bc1a-2686e04b0184
9
public static int getWordEnd(RSyntaxTextArea textArea, int offs) throws BadLocationException { Document doc = textArea.getDocument(); int endOffs = textArea.getLineEndOffsetOfCurrentLine(); int lineEnd = Math.min(endOffs, doc.getLength()); if (offs == lineEnd) { // End of the line. return offs; ...
ff92b7dd-b88b-40e8-b6ce-3a1de02057dc
7
public static int discrete(double[] a) { double EPSILON = 1E-14; double sum = 0.0; for (int i = 0; i < a.length; i++) { if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]); sum = sum + a[i]; } if (sum > 1.0 + EP...
6604be4f-981f-4cda-a404-3e5fd04f4c33
1
public void test_getDifferenceAsLong_long_long() { assertEquals(0L, iField.getDifferenceAsLong(1L, 0L)); assertEquals(567L, iField.getDifferenceAsLong(567L * 90L, 0L)); assertEquals(567L - 1234L, iField.getDifferenceAsLong(567L * 90L, 1234L * 90L)); assertEquals(567L + 1234L, iField.getD...
b75b1a60-45f7-46e6-87b5-24bd82dcd7f1
7
public void reorderIntegerKeys() { List<Object> keys = getOrderedKeys(); int numKeys = keys.size(); if (numKeys <= 0) return; if (!(getOrderedKey(0) instanceof Integer)) return; List<Object> newKeys = new ArrayList<Object>(); List<Object> newValues = new ArrayList<Object>(); for (int i = 0; i < n...
7d89b4a6-b9fe-427d-85f1-6f0962a4f521
5
private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0, 0L); try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0, 0L); return 6; } switch (curChar) { case 91: if ((a...
cdafd622-0349-40ad-93dd-7277feaba6e8
1
private char validateUnusedLetter(char guess) { while(word.isLetterUsed(guess)) { System.out.println("This letter has already been guessed. Please enter a new, unused letter: "); String temp = sc.next(); validateGuessIsALetter(temp); guess = temp.charAt(0); } return guess; }
6ae01158-7cf2-4e90-b88e-06a5d972329c
5
private void skipQuotedValue(char quote) throws IOException { // Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access. char[] buffer = this.buffer; do { int p = pos; int l = limit; /* the index of the first character not yet appended to the builder. */ ...
9e1c3f91-9dae-4b8d-a147-277f2a3a6bdc
0
@Override public void Volum (double n) { this.volume=edge*edge*edge*0.707*n; this.edge = edge*Math.pow(n, 1/3); }
53711761-88a9-48c0-9a0b-5cb32ae06da3
7
public String longestCommonPrefix(String[] strs) { if(strs.length == 0) return ""; if(strs.length == 1) return strs[0]; int p = 0; here: while(true){ if(p >= strs[0].length()) break; char c = strs[0].charAt(p); for(String str : strs) { if(str.length() <= p || str.charA...
77276cc8-b8df-4770-89d5-ecffeeb57b51
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((addressFirstLine == null) ? 0 : addressFirstLine.hashCode()); result = prime * result + ((addressSecondLine == null) ? 0 : addressSecondLine .hashCode()); result = prime * result + ((city...
47d4c590-dde6-4318-9f03-18fe0d30332a
4
private static int isSelfDescribing(String num) { int occurrences; for(int i = 0; i < num.length(); i++) { occurrences = 0; for(int j = 0; j < num.length(); j++) { int value = Character.getNumericValue(num.charAt(j)); if(value == i) { occurrences++; } } if(occurrences != Chara...
357c8f11-e419-42d3-b014-bb7b437045bf
8
public Item targetItem(MOB target) { final Vector<Item> V=new Vector<Item>(); for(int i=0;i<target.numItems();i++) { final Item I2=target.getItem(i); if((!I2.amWearingAt(Wearable.IN_INVENTORY)) &&(((I2 instanceof Weapon)&&(I2.basePhyStats().damage()>1)) ||((I2 instanceof Armor)&&(I2.basePhyStats()...
32169f1a-ec05-4deb-bfb9-87b4b70f38ff
2
public void run() { try { Transaction workerTrans = transQueue.take(); while (!workerTrans.equals(nullTrans)) { // get relevant information from each account int fromAcct = workerTrans.getFrom(); int toAcct = workerTrans.getTo(); int transAmt = workerTrans.getAmt(); // ...
8a16474e-02b1-4427-b2aa-b6b2149a857a
5
public int readBits(int howManyBits) throws IOException { int retval = 0; if (myInput == null){ return -1; } while (howManyBits > myBitCount){ retval |= ( myBuffer << (howManyBits - myBitCount) ); howManyBits -= myBitCount; try...
cef236a9-68f3-457e-810a-216f8dad2f80
6
final boolean method353(byte byte0, int i) { if (i == -1) { return false; } if (byte0 != -53) { anInt599 = 63; } if (i == anInt612) { return true; } if (anIntArray610 != null) { for (int j = 0; ~j > ~anIntArray610.le...
e085ae83-57d8-4576-809a-3c7eef5f95ea
0
@Override public void setDef(String value) {this.def = parseColor(value);}
bdc9e537-b807-44cb-9bdb-e4db5e644c00
8
public static String getC_FineCommandName(int _findCommand){ switch(_findCommand){ case C_FIND_TOTAL: return "FIND_TOTAL"; case C_FIND_ELEMENT: return "FIND_ELEMENT"; case C_FIND_ELEMENT_VALUE: return "FIND_ELEMENT_VALUE"; case C_FIND_SORTED: ...
3d4fc7c9-64af-40fa-951f-56bae7a6eab7
7
@Override public void run() { this.window.setNetworkStatus(NetworkStatus.WAITING_CONNECTION); this.openSocket(); this.networkUI.setVisible(true); this.networkUI.addMessageListener(this); this.addMessageListener(this.networkUI); this.window.setNetworkStatus(Netwo...
36be031a-1b6c-483c-b82f-7b719a0ea595
4
public void toggle() { if(hidden == false) { setVisible(false); } if(hidden == true) { setVisible(true); requestFocusInWindow(); } if(hidden == true) { hidden = false; } if(hidden == false) { hidden = true; } }
2c97f08f-3f88-4dfd-bd40-0435a4d817f7
2
private void resetScenario() { forceList.clear(); addAllForcesToList(); for (Force force: forceList) { for (City city: force.getCityList()) { city.getCharacterList().clear(); } force.getCityList().clear(); } forceList.clear(); ...
ac597f67-e548-4744-a42a-68de8a21a917
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[28]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 0; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
6d93fac4-95ec-445c-bb6d-360206296e08
2
private void print(int[][] a) { for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[0].length; j++) { System.out.print(a[i][j] + " "); } System.out.println(); } System.out.println("------------"); }
a708000a-5bdb-4710-9d8b-6720d25eefc4
0
public Collection<Route> getRoutes() { return this._routes; }
defceff5-f008-4cd2-b492-83182e6d10c4
6
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == closeBtn) { this.setVisible(false); } else if (e.getSource() == addBtn) { ParameterEditor pe = new ParameterEditor(); if (pe.isOk()) { try { model.add(new Parameter(pe.getName(), pe.getFormula())); } catch (Exception ...
130980e0-bab8-49ab-8605-d9fb262c8886
1
public static int getDelimiterOffset(final String line, final int start, final char delimiter) { int idx = line.indexOf(delimiter, start); if (idx >= 0) { idx -= start - 1; } return idx; }
1d164e4b-158d-4cc3-8d8f-ffdfd2166118
1
@Override public String toString(){ StringBuffer sb = new StringBuffer(); Node temp = first; while (temp!=null){ sb.append(temp.e).append(","); temp=temp.next; } return sb.toString(); }