method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b16286eb-0518-448d-9cd7-13d9e3bd6a6f
9
public Object execute(Node node) { Keyword key = (Keyword) node.getLeftChild().getTokenValue(); Node result = (Node) super.execute(node.getRightChild()); char[] ops = key.toString().substring(1, key.toString().length() - 1).toLowerCase().toCharArray(); for (int i = ops.length - 1; i >= 0; i--) { if (ops[i...
219a29ce-4b45-4e1a-a2f8-4199405c8425
4
protected static Ptg calcRound( Ptg[] operands ) throws CalculationException { if( operands.length < 1 ) { return PtgCalculator.getNAError(); } double[] dd = PtgCalculator.getDoubleValueArray( operands ); if( dd == null ) { return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error } //...
dc4319e3-6af7-446f-adc1-b46fe0580d23
0
public static Hand OnePair(Rank pairRank, Rank firstKicker, Rank secondKicker, Rank thirdKicker) { return new Hand(HandRank.OnePair, null, pairRank, firstKicker, secondKicker, thirdKicker, Rank.Null); }
d76df438-e0ec-465f-a267-706a050c05e9
1
private void connectButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_connectButtonActionPerformed {//GEN-HEADEREND:event_connectButtonActionPerformed try { echoClient.connect(hostTextField.getText(), Integer.parseInt(portTextField.getText())); messageArr...
e8d5716c-0040-47fe-a11f-82daa3d9c58c
4
@Override public Task getTask(String jid, String tid) throws RemoteException { Task[] taskArray = null; synchronized (this.syncTaskList) { taskArray = this.syncTaskList.toArray(new Task[0]); } if (taskArray == null) { return null; } for (int i = this.syncTaskList.size() - 1; i >= 0; i--) { Task...
e8e12b3d-c2db-4a72-ad0e-b17fdc64fe77
7
public SchemaGraphComponent(mxGraph graph) { super(graph); mxGraphView graphView = new mxGraphView(graph) { /** * */ public void updateFloatingTerminalPoint(mxCellState edge, mxCellState start, mxCellState end, boolean isSource) { int col = getColumn(edge, isSource); if (col >= ...
3885d2d4-6a41-4879-8d4c-fc36a3cdea25
7
public String getColumnName(int column) { int count = getColumnCount(); if (column == count - 1) return "Result"; int offset = 0; if(isMultiple){ offset = 1; if(column == 0) return "File"; } String word = ""; if(column <= (getInputCount()-1+offset) && col...
eb52d0f4-ace1-436b-a0f7-176b134262dd
4
public void muteMedia() { if (Debug.audio) System.out.println("AudioPlayer -> muteMedia called"); if ((null != player) && realizeComplete) { gainControl.setMute(true); if (Debug.audio) System.out.println("AudioPlayer -> muteMedia set"); } }
8abd49b3-1fcc-4f2f-b734-d2ecf69a0bdf
0
public int getLength(){ return arraysBase.size(); }
951141ce-b8ac-421b-8502-2bb272ee7ae8
2
public static boolean isChargedCreeper (Entity entity) { if (entity instanceof Creeper) { Creeper chargedcreeper = (Creeper) entity; if (chargedcreeper.isPowered()) { return true; } } return false; }
096d72fa-d8d9-4d56-b7e5-f3ae5bd3fbca
9
public static Population evolvePopulation(Population pop, int mutationPerEvo) { int cloneCounter = 0; Population newPopulation = new Population(pop.populationSize(), false); tournamentSize = (int) (pop.populationSize()*0.2); // Keep our best individual if elitism is enabled int elit...
ce51668a-7f28-4c7f-a1df-791978e0360c
0
@Override public void undo() { // Remove the Node node.getTree().removeNode(node); parent.removeChild(node, index); }
6bb72a95-7116-4d09-b8a9-871542f637c2
3
public void actionPerformed(ActionEvent e) { if (e.getSource() == btnExcluir) { try { do_btnExcluir_actionPerformed(e); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } if (e.getSource() == btnCancelar) { do_btnCancelar_actionPerformed(e); } }
c38c6192-4430-4bb5-9b76-4fe8ee368f2c
4
private static Result doSendViaGcm(String message, Sender sender, DeviceInfo deviceInfo) throws IOException { // Trim message if needed. if (message.length() > 1000) { message = message.substring(0, 1000) + "[...]"; } // This message object is a Google Cloud Messaging object, it is NOT ...
30e87b13-e089-4678-96c2-1400bfa3bb9d
2
public void removeService(Object service) throws Exception { int index = this._list.indexOf(service); if (index >= 0) { this._list.remove(index); if (service instanceof IService) { ((IService) service).uninitializeService(); } } }
4eafa21c-537a-4dde-91f2-b5909ee0e404
8
private boolean analyzeLine(SourceLine sourceLine, List<SourceLine> lines) { for (String expression : properties.expressions) { Matcher m = Pattern.compile(expression).matcher(sourceLine.getContent()); if (m.matches()) { sourceLine.matchesAt(m.start(), m.end()); ...
20687489-0e76-4403-a201-c57e20fd17e1
4
public void positionVessel(EnumBoard player, EnumLine line, EnumColumn column, boolean vertical, EnumElement vessel) throws InvalidPositionException, GameInitializedException { if (this.init) { throw new GameInitializedException(); } else { Map<String, EnumElement> board = (player.equals(EnumBoard.PLAYE...
a6344d72-6655-4b22-9ce1-05826462ab3b
6
public void configure(Configuration conf) throws ConfigurationException { conf.addConfigurable(this); ruleFile = conf.getProperty("broadcastTCPOutputConnector.rule"); if(ruleFile == null) throw new ConfigurationException("broadcastTCPOutputConnector.rule not specified"); String portString = conf.get...
e1b007ea-125b-45be-8965-ad9dd7f9b775
7
protected void scriptConvert(int pass, String relpath, File file) { if (pass == 1 && file.getName().endsWith("fcf")) { if (!relpath.contains("/")) { //If any subfolders exist, it's because the files were extracted on top of //an aborted earlier extraction. routeParser.parse(file, appendMap); } ...
30bc4fa9-e63d-40f7-aa26-69b34aaed49e
1
public boolean ModificarTrata(Trata p){ if (p!=null) { cx.Modificar(p); return true; }else { return false; } }
2b20a3a8-d6d1-454f-8267-375f4d6f33b0
9
void createChildren(Widget widget, boolean materialize) { if (contentProviderIsLazy) { Object element = widget.getData(); if (element == null && widget instanceof TreeItem) { // parent has not been materialized virtualMaterializeItem((TreeItem) widget); // try getting the element now that updateElem...
43b0753b-53de-4078-be76-f00cfdd0440e
4
private String getCellToolTip(MouseEvent event) { String toolTip = null; int col = columnAtPoint(event.getPoint()); int row = rowAtPoint(event.getPoint()); if (row >= 0 && col >= 0) { TableCellRenderer renderer = getCellRenderer(row, col); Component component = ...
b9c09c0b-e411-41be-9ea9-fcdae012fffa
3
public void execute(MinersWife wife){ switch(rand.nextInt(3)) { case 0: System.out.println(wife.getName() + " Moppin' the floor"); break; case 1: System.out.println(wife.getName() + " Washin' the dishes"); break; case 2: System.out.println(wife.getName() + " Mak...
7e622b41-d1e7-4054-87c7-6a18cf85d473
4
public void setGame(Game game){ boolean test = false; if (test || m_test) { System.out.println("EndDisplay :: setGame() BEGIN"); } m_game = game; if (test || m_test) { System.out.println("EndDisplay :: setGame() END"); } }
3352b516-251d-4401-a569-9dfd488b2e5a
2
public static void clearAllNodes() { eventQueue.pruneAllNodeEvents(); packetsInTheAir = new PacketsInTheAirBuffer(); for(Node n : nodes) { n.outgoingConnections.removeAndFreeAllEdges(); } nodes = createNewNodeCollection(); Node.resetIDCounter(); // new nodes restart their ID with 1 if(Global.isGuiMode...
bc83d4e5-fecc-4338-b7a5-ceea82d7d936
0
public Shape getShape() { return shape; }
8e6ebc4b-b48e-45fb-91f2-3c0e4c474e74
9
@SuppressWarnings("unchecked") public static SignalWriter createSignalWriter(SignalEntry signalEntry){ Properties unisensProperties = UnisensProperties.getInstance().getProperties(); String readerClassName = unisensProperties.getProperty(Constants.SIGNAL_WRITER.replaceAll("format", signalEntry.getFileFormat().getF...
56532d24-480b-45d7-a5c3-c29983633e89
4
private void New() { try { for(int i = 0; i < list.getProjectList().size(); i++) { StringTokenizer st = new StringTokenizer(list.getProjectList().get(i), " : "); String str = st.nextToken(); if(str.equals(NameTextField.getText())) { JOptionPane.showMessageDialog(buttonNew, "Project with...
ac2fa9a6-4990-45cb-a237-cf6aeeb0fe70
2
private final boolean isInvalidURICharacter( char c ) { for ( int i = 0; i < VALID_URI_CHARS.length; ++i ) { if ( VALID_URI_CHARS[i] == c ) { return false; } } return true; }
8623c112-fe70-45df-9455-5e303d1fd2d2
7
public String[] getOptions() { Vector result; String[] options; int i; result = new Vector(); if (getDebug()) result.add("-D"); if (getSilent()) result.add("-S"); result.add("-N"); result.add("" + getNumInstances()); if (getE...
da4125f8-2edc-435e-a308-bc1ce7ccfccc
1
public static ProtocolSignUp getProtocolSignup(String inString) throws JDOMException, IOException, TagFormatException { SAXBuilder mSAXBuilder = new SAXBuilder(); Document mDocument = mSAXBuilder.build(new StringReader(inString)); Element rootNode = mDocument.getRootElement(); String protType = rootNode.getN...
c4623d8e-e784-402d-aac7-625641f0fee3
6
private void spawnObstacle() { if (rand.nextInt(100) <= 8) { for (int i = 0; i < 10; i++) { int xPos = rand.nextInt(Game.WIDTH - 30) + 15; Entity o = new EntityObstacle(xPos, 0); if (rand.nextInt(100) <= 2) { o = new EntityObstacleSpecial(xPos, 0); } Object[] e = getCollisionListFor(o).toA...
47baedff-8501-4837-afcf-fc4117896fe6
1
public static void nth_number(Integer[] v, Integer n) { int min1 = 0, min2 = 0, min3 = 0; for (Integer value : v) { } }
ce9f40d5-046a-43f1-b47a-b2933f4b4f08
2
public static int safeLongToInt(long l) { if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { throw new IllegalArgumentException (l + " cannot be cast to int without changing its value."); } return (int) l; }
9a27aac8-ddf5-4c18-b6d7-f01925a682dc
1
@Override public final void mouseMoved(MouseEvent mouseevent) { int i = mouseevent.getX(); int j = mouseevent.getY(); if (frame != null) { i -= 4; j -= 22; } idleTime = 0; mouseX = i; mouseY = j; }
7509c418-7b65-46f6-9234-cc23f9b59e53
1
List<CompilationUnit> getMissingCompilationUnits() { List<CompilationUnit> missingCompilationUnits = new ArrayList<>(); compilationUnits.forEach((compilationUnit) -> { try { loadClass(compilationUnit.getName()); } catch (ClassNotFoundException e) { ...
8560f0f6-293c-4134-9ebc-6412d2560432
9
public TestFrame() { super(new GLTexture("bg0.png",GL13.GL_TEXTURE0)); this.test = new Button(420, 262, Colors.BLUE+"G"+Colors.RED+"o"+Colors.YELLOW+"o"+Colors.BLUE+"g"+Colors.DARKGREEN+"l"+Colors.RED+"e"); this.test.setBackgroundHighlightColor(Colors.VIOLET.getGlColor()); this.test.setBorderColor(Colors.LIGHT...
a60131e6-3fa2-4069-ac9d-ebeedf1566f0
2
public LinkedList<String[]> getServers() { LinkedList<String[]> servers = new LinkedList<String[]>(); conn.query("SELECT * from "+SCHEMA+".servers"); ResultSet rs = conn.getQueryResult(); try { while( rs.next() ) { servers.add(new String[] { rs.getString("url"), String.valueOf(rs.getInt("...
80c5623b-15a7-4299-8bff-4fd03f146a87
2
public void setLocal(String local) { if(local.length() < 65) { try { isValidLocal(local); this.local = local; } catch(Exception e) { System.out.println(e.getMessage()); System.out.println("Local not set."); } } else System.out.println("Local part length must be less than 65 characters"...
86daee93-4231-434f-b8a2-7b221a36b218
5
public Vector collide(PhysicsObject a){ Vector aPosition = a.getPosition(); Vector aOldPosition = a.getOldPosition(); Vector aSize = a.getSize(); //System.out.println(aPosition); //if( this.y >= doA.oy + doA.height && (doA.y + doA.height >= this.y) && (doA.x < this.x + this.width && doA.x + doA.width > this.x...
621a4bc2-8741-471a-a730-af78873245a0
8
@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> already <S-...
faad0157-4d25-454d-9eb8-03d349bcb4c6
9
private static boolean isVowel(char chr){ return (chr == 'A' || chr == 'E' || chr == 'I' || chr == 'O' || chr == 'U' || chr == 'a' || chr == 'e' || chr == 'i' || chr == 'o' || chr == 'u'); }
7a29b50b-90da-4d35-8c8e-727e29c00bf3
8
@Override @SuppressWarnings({ "nls", "boxing" }) protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder enc) { super.initialize(type, oldInstance, newInstance, enc); if (type != oldInstance.getClass()) { return; } Menu menu = (Menu) oldInstance; i...
2192cf2d-82f7-418b-b3fd-04d3f4b67219
9
@Override public void EntityKilled(Entity entity, Entity killer) { if(entity instanceof Mob){ Mob mob = (Mob)entity; if((killer != null) && (killer instanceof Tower)){ mobGotKilled(mob); ((Tower)killer).kills++; } level.markMobForDeletion(mob); return; } if(entity instanceof Tower){ lev...
ea071a2c-5e09-4a03-a11c-cc138d9431cf
2
public Locale dequeue() throws Exception { Locale retVal = null; // Check for underflow. if (!this.isEmpty()) { retVal = arr[frontPtr]; // Shift every element towards the front. for (int i = 0; i < backPtr; i++) { arr[i] = arr[i + 1]; } // Reinitialize the last element arr[backPtr] = null; ...
4c91c828-b0d2-4e8c-9b4c-a6f3ab4fae2f
4
public <T> void registerMethods(final Class<T> cls, String toStringMethodName, String fromStringMethodName) { if (cls == null) { throw new IllegalArgumentException("Class must not be null"); } if (toStringMethodName == null || fromStringMethodName == null) { throw new Ill...
89aea124-37e1-4fef-94e7-6d31674dab2e
6
public Value( String strVal ) { value = strVal; // test to see which type of value it is if ( value.compareTo("#t") == 0 || value.compareTo("#f") == 0) { type = "boolean"; } else if ( value.matches("-?\\d+") ) { type = "integer"; } else if ( val...
27162f2c-565d-462d-8bd2-8d56b65aa164
6
private static void initChoiceCombinationAndChoices() { if (choiceCombination == null || choiceCombination.length == 0) { return; } indexsArray = new Integer[choiceCombination.length]; for (int i = 0; i < choiceCombination.length; i++) { indexsArray[i] = i; String itemString = choiceCombination[i]; ...
8d31324f-23f4-4cbf-8207-81ff6a8a7f58
7
public static void printResult(Map<String, Double> result, ArgumentValidator validator, int limit) { try { FileWriter fstream = null; BufferedWriter out = null; boolean writeToFile = validator.getSearchOut() == null ? false : true; // Create file if (writeToFile) { fstream = new FileW...
6b97010c-093c-425c-9789-0e4fccde753a
4
private static String rationalPartFrom(String expression, int part) { notNull(expression, "Expression cannot be null"); int p = expression.indexOf("/"); switch (part) { case NUMERATOR: return p > 0 ? expression.substring(0, p) : expression; case DENOMINATO...
fb2ffa0e-167c-47d2-8295-3dbd04522b29
5
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
6822f8d6-f004-4aac-9cf5-14f587965656
1
public static synchronized DatabaseConnection getInstance(){ if (DatabaseConnection.instance == null){ DatabaseConnection.instance = new DatabaseConnection(); } return DatabaseConnection.instance; }
465297df-66c6-40f6-818f-0724b0668322
9
public boolean fGuiCheckChildObjectNonExistence(WebElement objParent, String strDesc){ //Delimiters String[] delimiters = new String[] {":="}; String[] arrFindByValues = strDesc.split(delimiters[0]); //Get Findby and Value String FindBy = arrFindByValues[0]; String v...
05841cc9-75b6-4441-acdb-0433f4cf7bcc
5
public double getSternCapPerSquareMetre(){ if(!this.sternOption){ System.out.println("Class: GouyChapmanStern\nMethod: getSternCapacitance\nThe Stern modification has not been included"); System.out.println("A value of infinity has been returned"); return Double.POSITIVE_INFI...
7c18d688-777d-4ed8-af63-d372e4632c44
3
public void setTable() { // Centering the first two column's cell content DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); questionTable.getColumnModel().getColumn(0).setCellRenderer(centerRenderer); ...
fd5242c1-ff0d-48cb-8861-f5a090a9f0be
6
private void readStudents(Element node, Group group) throws ServerException { if (log.isDebugEnabled()) log.debug("Method call. Arguments: " + group); Element studentsNode = (Element) node.getElementsByTagName("students") .item(0); if (studentsNode == null) { ServerException ex = new ServerException( ...
a5b331dd-44e4-40de-b7da-f3cce23f4c9e
3
public static void main(String[] args) throws SummerMissingException { Programmetajs programmetajs = new Programmetajs(); Vasara vasara = new Vasara(); programmetajs.Vards = "Janis"; vasara.VidejaTemperatura = 20; if (vasara.VidejaTemperatura < 20) throw new Su...
83b99aeb-a428-48cc-804b-7c534a7ee2e1
2
public static long getLastUpdate(){ Connection con = DBase.dbConnection(); PreparedStatement pst; long t=0; Calendar c = Calendar.getInstance(); try{ String query = "Select Distinct RetreiveDate FROM \"ME\".USD"; pst = con.prepareStatement(query); ...
008d760b-97ff-486a-9957-47a79142580f
5
void getPreviousWavelength (){ previousStateValues = FileManager.loadBackup(); if(Integer.parseInt(previousStateValues.get(0)) == -1){ previousStateValues.set(0, "0"); } if(Integer.parseInt(previousStateValues.get(1)) == -1){ previousStateValues.set(1, "0"); } int conversion1 = Integer.parseI...
3b9b9dd1-5b42-4a14-8c47-9e30fe9bbc8d
9
public String exportCustReport() { File outFile = new File(STAFF_REPORT_PATH); if(outFile.exists()){ outFile.delete(); } IDataVector<ISubDataVector> data = Application.RECORD_VIEW.getTableModel().getData(); FileInputStream in = null; OutputStream out = null; try { in = new FileInputStream(new ...
577721c7-aaee-463c-a534-8be9d48e102a
2
public void setNametextFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.nametextFontColor = UIFontInits.NAME.getColor(); } else { this.nametextFontColor = fontcolor; } somethingChanged(); }
3eedcca3-a685-402f-be0d-318d32ab3085
5
public void bOpen(){ if (isOpen) return; if (bombsBeingRevealed && getValue() != 9){ return; } if (markIndex > 0){ return; } if (!hasStarted) MainFrame.startTimer(); getModel().setPressed(true); getModel().setEnabled(false); isOpen = true; chooseIcon(true); //theGame.openSpot(xPos, yPo...
3e2487b1-9345-4ed0-ab2a-6bb8195ed0a2
7
private void initFenetre() { this.setLocationRelativeTo(null); this.setUndecorated(true); this.setResizable(false); this.setSize(350, 200); JLabel finJeuLabel = new JLabel(); finJeuLabel.setIcon(new ImageIcon(getClass().getClassLoader().getResource("popupLabel.jpg"))); finJeuLabel.setLayout(new FlowLa...
adb919b9-3dae-4a81-8452-d31af0043c22
3
public Inventory solveGreedily() { int availableCapacity = capacity; ArrayList<Double> amounts = new ArrayList<Double>(); if (availableCapacity <= 0) { return new Inventory(this, amounts); } for (Item i : items) { if (availableCapacity < i.getWeight()) { ...
9b472644-7e0c-49a0-be9f-639f03b00bda
7
public void play(File file) { if (stopRequested) { stopRequested = false; try { AudioInputStream stream = AudioSystem.getAudioInputStream(file); AudioFormat format = stream.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat(), ((int) stream.getFrameLength() * form...
2b1c4a2f-d752-4d47-b103-fb664e1f8def
4
protected void execute() { // TODO Auto-generated method stub double speed = scale(oi.getXSpeed(RobotMap.HookController)); if(speed > 0 && !hookMotors.Limit1.get()){ hookMotors.motor1.set(speed); } else if(speed < 0 && !hookMotors.Limit2.get()){ hookMotors.motor2.set(-speed); } }
9483bbd6-9156-44f6-8290-9709081ec4ab
5
private final void method3167(int i, ByteBuffer class348_sub49, byte i_2_) { if (i_2_ == -86) { anInt9489++; if ((i ^ 0xffffffff) == -250) { int i_3_ = class348_sub49.getUByte(); if (aClass356_9494 == null) { int i_4_ = Class33.method340(i_3_, (byte) 108); aClass356_9494 = new HashTable...
30f6bc70-4bea-4e2b-a4a9-211e56d9cd7d
3
public static void doLevel() throws ClassNotFoundException, FileNotFoundException, IOException, InterruptedException { addToPattern(); SimoneUI.blinker.run(); Thread.sleep(5000); for(Integer i: currentPattern) { // Don't need the integer, but it will ask for the same number of inputs as are in the current pa...
f7089749-1cc0-403b-ae60-742c6f1d9f18
9
public void executarMetodos() throws MyClassException { SingleValueVetor obj = new SingleValueVetor(); for (Method metodo : obj.getClass().getDeclaredMethods()) { for (Annotation anotacao : metodo.getAnnotations()) { if ((anotacao instanceof SingleValueLogAnnotation) && (((SingleValueLogAnnotation) anotacao)...
86b67b90-1e62-450f-9027-1637f14293c2
1
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
22411aa6-5593-48ee-8c8a-f9fef1bbaa95
5
public void startTreasureHunt() { found = false; if(currentTreasureLocation != null && currentTreasureLocation.getBlock().getType().equals(Material.CHEST)) { Chest chest = (Chest)currentTreasureLocation.getBlock().getState(); Inventory inv = chest.getBlockInventory(); inv.clear(); currentTreasureL...
f82c1f32-f1c8-4c50-9add-8b2ab3a8f543
6
final void method1092(int i, int i_0_) { anInt1819++; for (int i_1_ = 0; ((Model) this).vertices > i_1_; i_1_++) { ((Model) this).vertexX[i_1_] <<= i; ((Model) this).vertexY[i_1_] <<= i; ((Model) this).vertexZ[i_1_] <<= i; } if (i_0_ <= 39) method1107(40, -7, -80, -24); if ((((Model) this).anIn...
1261a850-6a9e-4098-b911-2e8a4fa484c6
4
private void setUsersState(int state){ //Номер колонки айди пользователя final int columnId = 0; //Если выбран пользователь в таблице if (tableUsers.getSelectedRow() != -1) { //Получаем идентификатор выбранного пользователя int userId = (Integer)tableUsers.getValu...
a2274dca-60ad-4902-bfba-d10778ef4e5b
7
public static long parseTimeInterval(String str) { try { int len = str.length(); char suffix = str.charAt(len - 1); String numstr; long mult = 1; if (Character.isDigit(suffix)) { numstr = str; } else { numstr...
e5a7832a-172e-4052-a867-6012f8f0499b
2
public static Model getModel(int id) { if (Model.modelHeaderCache == null) { return null; } ModelHeader modelHeader = Model.modelHeaderCache[id]; if (modelHeader == null) { Model.fileRequester.get(id); return null; } else { return new Model(id); } }
f5a4da46-0d39-4bd2-bc7a-31b72493f43a
0
private void dehighlight() { pane.tablePanel.dehighlight(); pane.grammarTable.dehighlight(); pane.tablePanel.repaint(); pane.grammarTable.repaint(); }
7ccd58f3-4d36-4d14-b738-b89fd41f24b8
7
private static String applyUnification(String sen1, String sen2, String[][] substitution){ String newSentence = ""; for(int i = 1; i < substitution.length; i++){ if(substitution[i][0] != null){ sen1 = sen1.replaceAll(substitution[i][0], substitution[i][1]); sen2 = sen2.replaceAll(substitution[i][0], subs...
f18a45b5-952e-4a79-8921-ebb3aeaf37c7
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...
abe51a7b-953a-4b23-9733-f780e43aca2f
3
public void wanderSpawner(){ if(time % 10 + random.nextInt(25) == 0) pickWanderLocation(); if(targetX != 0 && targetY != 0) pathTo(new Vector2i(x / 32, y / 32), new Vector2i(targetX, targetY), 0); }
7c8544a5-1a33-4ad0-a3e5-b1e3632af459
4
private Position findPlayer(ArrayList<String> board) throws Exception { for (int y = 0; y < board.size(); ++y) { for (int x = 0; x < board.get(y).length(); ++x) { char c = board.get(y).charAt(x); if (c == '@' || c == '+') re...
56bb1642-6ab2-44f5-a95a-8d21763b65e8
6
private void copyNsAndAttributes(XMLStreamReader parser, XMLStreamWriter writer) throws XMLStreamException { int nbNamespace = parser.getNamespaceCount(); for (int i = 0; i < nbNamespace; i++) { String nsPrefix = parser.getNamespacePrefix(i); String nsURI = parser.getNamespaceURI...
f216ac9f-182b-440c-a8f8-f24e31bc684e
7
@Override public void setup( BSPPeer<NullWritable, NullWritable, NullWritable, NullWritable, JobMessage> peer) throws IOException, SyncException, InterruptedException { HamaConfiguration conf = peer.getConfiguration(); blockSize = conf.getInt(blockSizeString, 2); /* Values for rows and columns padde...
e25ff8e5-9a84-4f70-8015-935536dde51c
9
public void make_pivot(ArrayList<finger_print> outliers){ ////System.out.println("Total outliers :" +outliers.size()); if(outliers.size()< OUTLIERS_SIZE || outliers.size() < PIVOT_SIZE_TOTAL){ for(int i=0;i<outliers.size();i++){ final_pivot_list.add(new node(outliers.get(i))); } return; }...
84af6f6f-fe19-4eb3-8a40-ee1f76cda237
9
private MinesNode[] getSurroundingNodes(int inX, int inY) { Vector v = new Vector(); for (int i = (inX-1); i <= (inX+1); i++) { for (int j = (inY-1); j <= (inY+1); j++) { if (i >= 0 && j >= 0 && i < width && j < height && !(i == inX && j == inY)) v.addElement(minesNodes[i][j]); } } MinesNode[]...
fe2bf30d-c978-4032-9e55-8017fdc794d3
3
public static boolean isValidSuggestion(Suggestion s) { if (s.getSubject().isEmpty()) { return false; } if (s.getDescription().isEmpty()) { return false; } if (!UserModel.isValidUser(s.getAuthor())) { return false; } System.out....
57b581e5-ed66-4778-9b9d-59a7b9650860
1
public int[][] directHoaar(int f[][]) { int c[] = zigZag.getHideZigZagArray(f, N); int result[] = new int[N * N]; for (int i = 0; i < N * N / 2; i++) { result[2 * i] = ((c[2 * i] + c[2 * i + 1])); result[2 * i + 1] = ((c[2 * i] - c[2 * i + 1])); } int arra...
f6b3c8b7-9915-4cba-874f-d90baaa2b451
5
public void reloadAll() { Class<Textures> localTextures = Textures.class; BufferedImage localBufferedImage1; for (Iterator localIterator = this.loadedImages.keySet().iterator(); localIterator.hasNext(); ) { int i = ((Integer)localIterator.next()).intValue(); localBufferedImage1 = (BufferedImage)this.l...
c203e9cc-cfc7-481c-bec3-a081ae28b090
7
private double leastSquares(Instances instances) { double numerator=0, denominator=0, w, t; double[] classMeans = new double[m_numOfClasses]; double[] classTotals = new double[m_numOfClasses]; for (int i=0; i<instances.numInstances(); i++) { LADInstance inst = (LADInstance) instances.instance(i)...
cc713c54-0a06-4302-9331-70fd74fd8c4f
8
public void setPieces(){ TicTacToePiece[][] piecesToBeSaved = TicTacToeBoard.getBoard(); for(int j = 0; j < piecesToBeSaved[0].length; j++){ for(int i = 0; i < piecesToBeSaved.length; i++){ if(piecesToBeSaved[i][j].getPieceColour() == Piece.TicTacToePieceColour.NOUGHT){ Element newNoughtPiece; ...
5c8a332a-1684-451f-9254-547529bd14e0
5
private boolean enteredViaVertex0( int anEdgeIndex) { if (anEdgeIndex < 1 || anEdgeIndex > 5) throw new IllegalArgumentException( "Edge index must be in range [1..5], was " + anEdgeIndex); else { boolean retval; Edge cur = myEdge[anEdgeIndex]; Edge prev = myEdge[...
7bf42c50-b4c8-495c-bf73-654f044270d6
9
public GayBerneConfigure() { super(new BorderLayout()); if (rotateCursor1 == null) { rotateCursor1 = UserAction.createCursor("images/cursors/rotate1.gif", new Point(16, 17), "rotate"); rotateCursor2 = UserAction.createCursor("images/cursors/rotate2.gif", new Point(14, 11), "rotate"); rotateCursor3 = User...
0a89487f-90f7-4ce2-bbfd-f91233e04768
5
protected PingResult pingLeft(){ for (int i = this.posX; i >= 0; i--){ if (i == enemyPosX && this.posY == enemyPosY) { return new PingResult(this.posX - i - 1, true); } else if (BattleBotsGUI.instance.obstacles[i][this.posY]) { return new PingR...
aa412af3-3fe8-4f6a-9a25-47b189939b51
0
public CmdCreateExecutor(SimpleQueues plugin) { this.plugin = plugin; }
b56b6f16-8c10-44f3-8f24-3139e38d5e85
0
@Test public void testSetFood() { System.out.println("setFood"); int food = 0; Cell instance = new Cell(0,0); instance.setFood(food); int expResult = 0; int result = instance.getFood(); assertEquals(expResult, result); }
c5dd022b-88ff-47db-82f3-4e69f76cd354
0
public void add(GUITreeComponent comp) { reg.put(comp.getGUITreeComponentID(), comp); }
7389271b-c063-4a1f-af59-b7675b103a8f
5
private String parseRes(String res) { Pattern pattern = Pattern.compile(Constant.MESSAGE_PATTER); Matcher matcher = pattern.matcher(res); if (matcher.find()) { return matcher.group().split(":")[1]; } if (res.matches(Constant.ORDER_SUCCESS_REGEX)) { String ...
7e2566a3-4d02-4ac5-bec7-1e7641640160
2
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); String userId = request.getParameter("userId"); try{ connection = new Mongo(); scheduleDB = connection.getDB("sched...
417c7128-a701-4c4a-bcba-43bdc1549ddf
5
@Override public double getXRotation() { double lowest = 9001; double highest = 0; int y = 0; if (getRotationAngle() == 180) y = -20; if (getRotationAngle() == 360) y = 20; for (Block block : blockArray) { if (block.getXValue() > highest) highest = block.getXValue(); if (block.getXValue(...
6e6881c9-8716-4bcf-aa84-dfcf656a5b4c
2
@Override public void add(double score) { if ((score < 0) || (score > 1)) throw new RuntimeException("p-value out of range: " + score); scores.add(score); }
951d6d6b-befe-497c-995e-e3ca736bc1c4
4
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_W: keys[0] = false; break; case KeyEvent.VK_S: keys[1] = false; break; case KeyEvent.VK_I: keys[2] = false; break; case KeyEvent.VK_K: keys[3] = false; break; default: break; ...