method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c7dd088d-9715-450c-9e30-2bab659184f9
8
public void actionPerformed(ActionEvent e) { // Sanity check - should have >1 parser if event is fired. int parserCount = getParserCount(); if (parserCount==0) { return; } long begin = 0; if (DEBUG_PARSING) { begin = System.currentTimeMillis(); } RSyntaxDocument doc = (RSyntaxDocument)textArea....
341f4133-ea04-41f9-a053-fae60761cc6b
8
private void renderState( State state ){ switch (state.getLoyalty()){ case NONE: GL11.glColor3f(0.1f, 0.1f, 0.1f); break; case EMPTY: GL11.glColor3f(0.3f, 0.3f, 0.3f); break; case BLUE: GL11.glCol...
26f9f3d4-4f07-43aa-94db-51462a891142
4
public void actualizaClassificacao(String cod_competicao,String cod_equipa1,int golos1,String cod_equipa2,int golos2 ){ try { Statement stm = conn.createStatement(); if(golos1>golos2){ String sql = "Update Classificacao set Pontos=Pontos+to_number('3'),Golos=Golos+to_number...
60e9c787-d319-4a11-b2ed-ddb2598819bc
1
@Override protected void createReaderWriter() throws JoeException { ourReaderWriter = new PdbSPReaderWriter() ; if (ourReaderWriter == null) { throw new JoeException(UNABLE_TO_CREATE_OBJECT) ; } }
d9ad6d99-5ced-4839-abf4-63c77948a0e7
0
public void setLidnummer(int lidnummer) { this.lidnummer = lidnummer; }
c255811a-b835-4371-bd3d-fbc48d54f42b
6
public Type intersection(Type type) { if (this == tError || type == tError) return tError; if (this == tUnknown) return type; if (type == tUnknown || this == type) return this; /* * We have two different singleton sets now. */ if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)...
b20d69f1-f751-4dce-8254-fa3083f6772a
6
public AxisAlignedBB addCoord(double par1, double par3, double par5) { double var7 = this.minX; double var9 = this.minY; double var11 = this.minZ; double var13 = this.maxX; double var15 = this.maxY; double var17 = this.maxZ; if (par1 < 0.0D) { ...
eb182ec6-2a4b-41a8-ab5c-51cde8858173
6
public boolean undo() { Debug.println("call: undo()", Debug.METHOD_CALL); if (history.isEmpty()) { return false; } Change c; while (true) { c = history.pop(); switch (c.operation) { case Change.NORMAL: grid[c.x][c.y].fill(c.numb...
1918c77f-3f00-45ff-9643-0280a991686c
6
public boolean comprobarAnadir() { boolean z = true; if (jTextFieldNombre.getText().compareToIgnoreCase("") == 0 || jTextFieldApellidos.getText().compareToIgnoreCase("") == 0 || jTextFieldApellidos.getText().compareToIgnoreCase("") == 0 || jTextFieldNumCuenta.getText().compareToIgnoreCase("") == 0 ...
661f39a2-681b-40d6-a6a2-b525d26a3373
2
public void visitCheckExpr(final CheckExpr expr) { // UGLY: We special case RC and UC to allow stack variables since // they do not change the operand stack at all. However, since // they do contain stack variables, we cannot hoist these // expressions, but we can one eliminate them so long as they // ar...
aabbae3b-d52b-43f3-9871-d43e47a1a48e
9
@Override protected void performAction() { synchronized (GlobalLock.WRITE_LOCK) { Spieler t1s1 = spielerService.findSpielerByName(gewinner1); Spieler t1s2 = spielerService.findSpielerByName(gewinner2); Spieler t2s1 = spielerService.findSpielerByName(verlierer1); Spieler t2s2 = spielerService.findSpielerB...
43307a82-b2d1-4645-941a-8473b7f166c8
1
private static String stringInts(int[] ints) { String s = "[ "; for (int i = 0; i < ints.length; i++) { s = s + Integer.toString(ints[i]) + " "; } return s + "]"; }
4d312f1c-c3ad-46a4-aa10-dcf36142b956
7
public void process(WatchedEvent event) { super.process(event); try { if (event.getType() == EventType.NodeDataChanged) { // 响应内容变更 String path = event.getPath(); if (map.containsKey(path) == true) { byte[] buffer = zk.getData(path, this, null); String content = new String(buffer, ...
dc305ff1-9454-4c5a-9d92-25092d74208c
2
public GameSound(String name, String path) { super(name); InputStream clipStream = GameSound.class.getResourceAsStream(path); logger.info(clipStream); clip = loadAudioClip(clipStream); // FloatControl master_gain = (FloatControl) // clip.getControl(FloatControl.Type.MASTER_GAIN); // master_gain.setValue...
6f94d0a6-4fb8-46c8-becf-3f11bf51ac31
5
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for (int i = 0; i < n; i++) { int setNumber = scanner.nextInt(); int[] data = new int[n]; for (int j = 0; j < 10; j++) data[j] = scanner.nextInt(); int result = 0; for (int j = 0; j < 3...
5ef6c073-0375-44aa-99bc-15b7e8e28d1c
4
private void render(){ BufferStrategy bs = getBufferStrategy(); if(bs == null){ createBufferStrategy(3); return; } render.clear(); if(state == 0) render.render(menu); if(state == 1){ render.render(level); render.renderUnit(u); } for(int i = 0; i < pixels.length; i++){ pixels[i] = re...
b7d0ad19-26da-4faf-a36c-088be51afc7e
1
@Override public void setData(FieldContent data) { // allow setting in field once only. // cannot have multiple sources for one @In ! if (this.data != null) { throw new ComponentException("Attempt to set @In field twice: " + comp + "." + field.getName()); } this.d...
cad04ed0-654b-444b-a2f9-a3dae4a7b63c
8
public static boolean removeImplantThread(RelayBot_ForwardConnection threadToRemove, long threadID_ToRemove) { try { if ((Driver.alRelayTerminals == null) || (Driver.alRelayTerminals.size() < 1)) { Driver.sop("alRelayTerminals - ArrayList is empty. No clients further to remove"); r...
43347680-2ffe-4f45-b334-bd0a5683228d
2
private void parseCurrenciesString(CounterParty counterParty, String currenciesString){ if(currenciesString!=null){ String[] currenciesStrings = currenciesString.split("\\Q | \\E"); for(int i=0;i<currenciesStrings.length;i++){ counterParty.getAccountsList().get(i).setCurr...
dbdb34a5-c672-460a-97a9-fce47cfd19bd
2
protected void execute(SignatureFile file) { this.file = file; new Thread(new Runnable() { @Override public void run() { if (signatureListener != null) { signatureListener.processStart(); } onPreExecute(); ...
2a22e22e-f5bc-4a61-a254-1bba7e74afd3
5
public HashMap<String,MusicObject> getSongByFolder(String folder) { HashMap<String,MusicObject> retVals = new HashMap<String,MusicObject>(); try { if (connection == null) { connection = getConnection(); } if (getSongByFolderStmt == null) { getSongByFolderStmt = connection.prepareStatement("...
f0611780-f3dc-4cdf-a717-613e1acb2720
7
private static void parseCommandLineArguments(final String[] args) throws IllegalArgumentException { if (args.length == 0) { // Give a little help System.out.println("Possible command-line arguments: -host [address] -port [port] -baseurl [baseurl]"); // System.out.println("De...
8e8ec270-2063-45f7-bde9-34a4b982f6ff
9
private void obtenerLimites(int c) { switch(c) { case 1: pvCuadrante=0; phCuadrante=0; break; case 2: pvCuadrante=0; phCuadrante=3; break; case 3: pvCua...
f11e8ed4-c136-4ed7-8253-07b65f0b53c9
8
private void clearRows(){ // i is which row we're in for(int i = 0; i < getGridHeight();){ boolean hadEmptySpot = false; // j is which column we're in for(int j = 0; j < getGridWidth(); j++){ if(!isSpotOccupied(i, j)){ hadEmptySpot = true; break; } } //If there are not empty spot...
c2daf2ba-3cce-4452-ab3e-c21bcaa65bf9
3
public static double getTotObservation(ArrayList<Observation>[] list, Vector2d reference){ if(list == null) return 0; double result = 0; for(int i=0; i<list.length; i++){ for(int j=0; j<list[i].size(); j++){ double distance = list[i].get(j).position.dist(reference); result...
85e0c25e-2eec-4401-9a04-2a45a369a027
1
@AroundInvoke public Object detectSmoke(InvocationContext ic) throws Exception { long start = System.currentTimeMillis(); try { return ic.proceed(); } catch (Exception e) { events.fire(e); throw e; } finally { long duration = System.cur...
ed6cc54b-8453-4a68-9b6e-5de6fc82cb50
9
@SuppressWarnings("CallToThreadDumpStack") private void writeSourceToOut() { FileWriter fileWriter=null; BufferedWriter bufferedWriter=null; String fileName; String destDir=doGetCrossCompilingHexTargetDirectory(); if (destDir==null) destDir=doGetCrossCompili...
144676e8-4307-444b-a7b5-d89a59b7281c
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ThreadsModel that = (ThreadsModel) o; if (idThreads != that.idThreads) return false; if (description != null ? !description.equals(that.descrip...
57db6985-f0e3-4cee-8ec7-29b5dab203d7
1
public void ResetTrail() { for (int i = 0; i < PlayerTrail.size(); i++) { trail.remove(PlayerTrail.get(i)); } this.PlayerTrail.clear(); }
2d7d6032-5d22-48b3-aa7b-36ef25db769c
1
public void testSimpleDivision() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException { List<String> basicStrings = new ArrayList<String>(); basicStrings.add("6.0/3.0"); basicStrings.add("6.0/3"); basicStrings.add("6/3.0"); basicStrings.add("...
ccac08c4-8553-41bc-b5fc-9ded06be23bb
3
public void loadConfig() { config = this.getConfig(); if(!config.contains("Format")) { config.set("Format", "<+prefix+name+suffix&f> +msg"); } format = config.getString("Format"); if(!config.contains("Channel-format")) { config.set("Channel-format", "&f<+prefix &f+name> &7 +msg"); } channelForma...
8cc2863f-98f6-4018-ad2f-b5180bccff46
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); List<User> users = ufl.findAll(); try (PrintWriter out = response.getWriter()) { ...
77ec0cc5-4ed4-45f4-935b-9c16beb1dc46
6
@Override public final void update(Level level, int x, int y, int z, Random rand) { if (id != ROPE.id) { int var6 = level.getTile(x, y - 1, z); if (level.isLit(x, y, z) && (var6 == DIRT.id || var6 == GRASS.id)) { if (rand.nextInt(5) == 0) { level.s...
4d90a904-5c18-492b-90f7-e0d092805710
4
public double[][] ReinforcementLearning() { int step = 1; State currState = this.game.StartState; double[][] allUtils = new double[this.game.States.length][this.game.States[0].length]; while(step < 100000) { currState.TimeStep = currState.TimeStep + 1; ACTION selectedAction = this.selectAction(cur...
e498563b-be0a-482d-a5ea-255c084381a5
6
public static void showBoard(BoardModel boardModel) { System.out.print(" "); for (int i = 0; i < boardModel.getBoardWidth(); i++) { System.out.print(" " + i); } System.out.println(""); System.out.println(" -----------------------"); for (int i = 0; i < boar...
175244c2-536b-41b2-ad31-2ac2caaec0ca
7
private void readEntityDecl() throws ParseException, IOException { readSymbol(ENTITY_BEGIN); readS(); if (isChar('%')) { readChar('%'); readS(); String name = readName(); readS(); String value; if (isEntityValue()) value = readEntityValue(); else val...
fa926a79-6cf3-4e4f-bad8-e900b4e27712
0
@Test public void itShouldDeserializeAPoint() throws Exception { GeoJsonObject value = mapper.fromJson("{\"type\":\"Point\",\"coordinates\":[100.0,5.0]}", GeoJsonObject.class); assertNotNull(value); assertTrue(value instanceof Point); Point point = (Point)value; assertLngLatAlt(100, 5, Double.NaN, point.get...
e5c735f7-2f47-4139-8417-b5ec98297e51
1
public String getWebsite() { return this.website == null ? "" : this.website; }
8df2ee74-6a1d-46e1-acb1-f48a0c11136b
1
public static void main(String[] args) { String[] a = (ABSDIF + ABSDIFLOG + NSLOG).split(" "); for (String string : a) { System.out.println("'" + string + "'"); } }
6bbe088b-9cc7-43a5-b37d-c3e517be5feb
9
protected void initSpecialParameters() throws MaltChainedException { if (getConfiguration().getOptionValue("singlemalt", "null_value") != null && getConfiguration().getOptionValue("singlemalt", "null_value").toString().equalsIgnoreCase("none")) { excludeNullValues = true; } else { excludeNullValues = false; ...
28647b45-0662-441b-b657-c5a5a49620f2
9
public int compareTo(Dependency dependency) { if (this.groupId != dependency.groupId) { if (this.groupId == null) return -1; if (! this.groupId.equals(dependency.groupId)) { return this.groupId.compareTo(dependency.groupId); } } if (this.artifa...
eac37cb6-5739-448f-852e-9d0e9efb7aac
8
public void generateNextPopulation(String args){ Random rng = new Random(); prevPopulation = population.clone(); if(args.compareToIgnoreCase("roulette") == 0){ for(int i = 1; i < fitness.length; i++) fitness[i] += fitness[i-1]; for(int i = 0; i < this.population.length; i += 2){ String[][]...
c694844c-833e-45a7-bb01-455b7c6c4258
1
@Override public boolean canMove(Board board, Field currentField, Field emptyField) { return this.validSetupForMove(currentField, emptyField) && emptyField.areAdjacentTo(currentField); }
4e6080c2-f11d-4a34-ab83-acf6357683b1
2
public static void main(String... args) throws IOException { long start = System.nanoTime(); lines = loadLines("output.json"); Collections.sort(lines, new Comparator<String>() { @Override public int compare(String o1, String o2) { if (o1.length() > o2.len...
598b69ce-e07c-4784-9729-f04181480e04
0
@Override public String toString() { return String.format( "Key [annotatedElementType=%s, annotationType=%s]", this.annotatedElementType, this.annotationType ); }
14b563dd-0198-47f6-8413-d8ed0df9f28b
2
public boolean isVariableWithLambdaProduction(String variable, Grammar grammar) { ProductionChecker pc = new ProductionChecker(); GrammarChecker gc = new GrammarChecker(); Production[] productions = GrammarChecker.getProductionsOnVariable( variable, grammar); for (int k = 0; k < productions.length; k++) ...
3fa9f66f-335d-40c5-bf13-b2c147a571a3
7
private static void test8() throws FileNotFoundException { //Test unlocking the cell door and getting caught String input = "new\n" + "pick up cell key\n" + "unlock cell door with cell key\n" + "quit\n" + "y\n"; HashMap<Integer, String> output = new HashMap<Integer, String>(); boolean passed = true; try...
4089a77b-c42d-4d38-9625-cfd498d68bb6
7
public void readFromXML(XMLStreamReader in) throws XMLStreamException { setId(in.getAttributeValue(null, ID_ATTRIBUTE_TAG)); number = new IntegerOption(getId() + ".number", getSpecification()); unitType = new UnitTypeOption(getId() + ".unitType", getSpecification()); role = new StringOpt...
f21b13d4-3dca-413f-8c50-f6a89dad3ada
7
public ReadMaze(String filePath, double nonTerminalReward) { try { FileReader f = new FileReader(filePath); BufferedReader b = new BufferedReader(f); Pattern pattern = Pattern.compile("(\\w|[\\+|\\-]\\d+|\\%)"); Matcher matcher; String s = null; Stri...
7fa466ef-e75e-4ac4-9f27-40377271c5b6
3
public void createBlock(Material underblock){ Location blockLocation = getLocation(); if (blockLocation == null) return; Block block = blockLocation.getBlock(); block.setType(Material.STONE_PLATE); block.getRelative(BlockFace.DOWN).setType(underblock); Block[] clearBlocks = { block.getRelative(faceFromYa...
bcf8bce6-7ff2-4007-a845-6262f7b2bc3b
4
@Override public void update(Observable arg0, Object arg1) { ModelNotification notificationType = (ModelNotification) arg1; switch(notificationType) { case LIST_OF_PARTICIPANTS_CHANGED: break; case LANGUAGE_CHANGED: refreshLabels(); break; case MESSAGE_RECEIVED: if(chatGuiMinimizedT...
485a43cc-1d3a-429a-a8e2-d6989c2e98d6
2
public static boolean isFullMask(int itemID) { for (int i=0; i<fullMask.length; i++) if (fullMask[i] == itemID) return true; return false; }
98afa280-6ba9-4932-a941-ca30713e3130
7
static private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k-1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; }
4c5129c1-133a-4a1f-b64e-14153806b7a9
8
private void createShell() { int leftPercent = 20, bottomPercent = 20; shell.setText(RepDevMain.NAMESTR); if(Config.getHostNameInTitle()) shell.setText(shell.getText() + " - " + Config.getServer()); shell.setImage(RepDevMain.smallProgramIcon); if(Config.getWindowSize() != null) shell.setSize(Config.getW...
60e7753b-34ea-450a-bf19-a8eee391cd6b
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Movie other = (Movie) obj; if (this.movieFile != other.movieFile && (this.movieFile == null || !this.movieFile.equals(other.movieFile))) { return false; } ...
76e23734-93b7-4acf-ae36-82ae1812ffaa
5
public boolean isCancelled() { try{ if(((isDone() && (get() instanceof Cancellable) && ((Cancellable)this.get()).isCancelled())) || topCancel){ return true; } }catch(Exception e){ return topCancel; } return false; }
8ca2e049-c4d0-4f20-a5b0-339e2930c99a
8
private JsonValue parseValue() throws JsonException { Token tok; tok = lexer.nextToken(); switch (tok.type) { case TokenTypes.INTEGER: return new JsonInteger(Integer.parseInt(tok.value)); case TokenTypes.NUMBER: return new JsonNumber(Doubl...
122f5383-5fb5-4842-86cf-89195aa4b8f4
2
public String toString() { String tempString = ""; for (Vertex v : adjMap.keySet()) { for (Vertex w : this.getAdjacentVertices(v)) { tempString += v + "->" + w + "\n"; } } return tempString; }
8f7e940a-3daa-455c-b4b7-b0302228451e
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("@x1 is already anim...
8bd5948d-9c3b-46e2-b4ed-42b74c60dada
1
public AudioComponent(Entity entity, String[] soundNames, Sound[] soundsIn) { super(entity, ID); sounds = new HashMap<>(); for (int i = 0; i < soundNames.length; i++) { sounds.put(soundNames[i], soundsIn[i]); } }
69e9a5d5-4901-4675-81e3-c5aa45d7a7b5
7
StanInagroda losowanie_stanu_pocz(StanInagroda stany_innych[], int liczba_innych) { // wybor stanow poczatkowych obiektow (tak by nie kolidowaly z innymi obiektami // agenta naszego i obcych agentow: int puste_pola[] = new int[liczba_wierszy]; int liczba_pustych_pol = 0; int ag...
d7709586-85b4-47b5-adf3-efaa1e0b445f
2
public int[] copyRectXOR(CPColorBmp bmp, CPRect rect) { CPRect r = new CPRect(0, 0, width, height); r.clip(rect); int[] buffer = new int[r.getWidth() * r.getHeight()]; int w = r.getWidth(); int h = r.getHeight(); for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { buffer[i + j * w] = data[(j...
9c875cc3-352a-4af2-afd1-2da316c274b4
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { Physical target=mob; if((auto)&&(givenTarget!=null)) target=givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",...
8e7c5b4a-0fe3-46b8-b79b-70cb7c8cf26f
1
@Override public void actionPerformed(ActionEvent e) { if(e.getSource().equals(connectb)) { connectToServer(); } }
bc1f30dd-7d1c-438b-80b7-13e18f1f00c7
2
public static int getInt(ByteBuffer in) { int a = in.get() & 0xFF; int sign = (a & BYTE_SIGN_NEG); int value = (a & 0x3f); int shift = -1; while ((a & BYTE_MORE) != 0) { a = in.get() & 0xFF; value |= (a & 0x7F) << (shift += 7); ...
d53e38dd-d0ea-4607-b8d1-33286b80caa9
5
private void readChunkUnzip(Inflater inflater, byte[] buffer, int offset, int length) throws IOException { assert(buffer != this.buffer); try { do { int read = inflater.inflate(buffer, offset, length); if(read <= 0) { if(inflater.finished()...
1af2bd52-33fe-4c7a-90b6-d6c2647f9cd2
1
private boolean jj_3_3() { if (jj_3R_21()) return true; return false; }
fd717952-ffb1-49fb-a09f-96f84faa86aa
8
private final boolean pushEntity() throws IOException { boolean whitespace = true; int pos; String code; String result; read(); // & pos = mTextPos; while (!mEOF && mPeek0 != ';') { push(read()); } code = pop(pos); read(); if (code.length() > 0 && code.charAt(0) == '#') { int c = code.char...
bd0ccf17-5b95-4801-8a03-2aceb694ed26
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Pessoa)) { return false; } Pessoa other = (Pessoa) object; if ((this.idPessoa == null && other.idPessoa != null...
4a0edc1b-ca8d-447c-b4ee-a726c0118f12
1
public static void addPreferenceItem(String text, JComponent field, Container container) { LayoutManager layout = container.getLayout(); JLabel label = new JLabel(text); field.setMaximumSize(field.getPreferredSize()); if (layout instanceof GridBagLayout) { GridBagLayout gridbag = (GridBagLayout) layout...
41c74215-adec-4108-ae32-b48bb3d4952e
9
private Matrix getTObs(Instances data) throws Exception { int p = m_numAttributes; // number of columns // matrix of complete-data sufficient statistics for observed values Matrix t = new Matrix(p+1, p+1); // initialize T for observed data (T_obs) int currentPatternStart = 0; whil...
95ea4720-e1ec-4249-99a0-0e39f63165a0
3
private static void sieve(int[] p){ for(int i=2;i<N;i++){ if(p[i]==1){ for(int j=i+i;j<N;j+=i){ p[j]=0; } } } }
6b94c7d1-2b98-411e-bc6a-60c72313d7c8
7
protected void doPrintHeader() { append("<html>\n"); append("<head>\n"); append("<title>Predictions for dataset " + sanitize(m_Header.relationName()) + "</title>\n"); append("</head>\n"); append("<body>\n"); append("<div align=\"center\">\n"); append("<h3>Predictions for dataset " + sanitize...
97b3522f-ce9c-4873-a476-be3877c17a77
6
public JSONObject getImageCategoriesTag(int ImageID) { try { Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); stmt=conn.createStatement(); json=new JSONObject(); String SQL="select cat_id from image_cats where image_id='"+ImageID+"'"; ...
af42766a-5403-4c11-b591-708697c40f11
4
@Override public Body parseBody() throws IOException { Body b = new Body(); while (curToken.type != Lexer.Type.RIGHT_BRACES) { Command command = parseCommand(); b.getCommandList().add(command); if (curToken.type == SEMICOLON) { curToken = lexer.ge...
24445f99-57fa-4964-9d2a-d86c703ca4a2
0
@Test public void testGetAdjacentAntsRed() { System.out.println("getAdjacentAntsRed"); Cell instance = new Cell(0,0); int expResult = 0; int result = instance.getAdjacentAntsRed(); assertEquals(expResult, result); }
df8f0dcd-359f-4853-b1e0-c55fee25ed9d
3
public void completarTabla(){ for(int i=0;i<NumeroSalidas;i++){ List<Boolean> newList=new List(); for(int j=0;j<LargoLista;j++){ for(int k=0;k<entradas.getLength();k++){ boolean o=(Boolean)entradas.get(k).get(j); parent.setEntrada(k...
9c97ce4c-bf18-427a-aff1-3a9cfeb8075c
2
public void run() { //Guarda el tiempo actual del sistema tiempoActual = System.currentTimeMillis(); while (true) { actualiza(); checaColision(); repaint(); try { // El thread se duerme. Thread.sleep(80); ...
aa7a1200-678c-420c-9a54-cab2691608d0
0
private Combination<Colors> generateAttemptCombination1() { List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>(); attemptTokens.add(new Token<Colors>(Colors.R)); attemptTokens.add(new Token<Colors>(Colors.O)); attemptTokens.add(new Token<Colors>(Colors.Y)); attemptTokens.add(new Token<...
30718dc1-903f-4d03-8a9c-0c3f18c7cbb4
7
public void markBlocksForUpdate(int par1, int par2, int par3, int par4, int par5, int par6) { int var7 = MathHelper.bucketInt(par1, 16); int var8 = MathHelper.bucketInt(par2, 16); int var9 = MathHelper.bucketInt(par3, 16); int var10 = MathHelper.bucketInt(par4, 16); int var11...
f1529bf1-54ac-4b88-a217-c2b1ef55e649
7
@Override public Boolean value(final Double a, final Double b) { if (a == null || b == null || Double.isInfinite(a) || Double.isNaN(a) || Double.isInfinite(b) || Double.isNaN(b)) return false; /* * In an attempt to not destroy a large number of si...
472594d4-d3d2-4bf1-84f5-d34470580884
7
private static boolean isPointBelongsToContour(int matrix[][], int x, int y) { int p2 = matrix[y - 1][x]; int p3 = matrix[y - 1][x + 1]; int p4 = matrix[y][x + 1]; int p5 = matrix[y + 1][x + 1]; int p6 = matrix[y + 1][x]; int p7 = matrix[y + 1][x - 1]; int p8 = ma...
90efe7ca-7663-479a-aaec-abe8ad9d6388
0
public void IncrementEmptyTrips() { emptyTrips += 1; }
4b679cf2-8ade-4a32-9133-9085dbcf9ff7
6
@Override public void execute(MacroManager macroManager, SmartRobot robot, DataManager dataManager) { String rlhs = resolveVariable(macroManager, lhs, resolveLhs); String rrhs = resolveVariable(macroManager, rhs, resolveRhs); switch (operator) { case Equal: runCommand(macroManager, robot, dataManager, rlh...
9a63556f-d2c0-4cf6-b655-f1b3dd4537ef
0
public int getTailleX() { return plateau.getTailleX(); }
572046ed-ed2f-45a8-8b26-03dd8e7983a4
2
private void setDateValue(final Cursor cursor, final int index, final Field field, final Object object) { final String value = cursor.getString(index); final Date result = (!cursor.isNull(index) && value != null ? DateUtils.format(value, DATE_FORMAT) : null); Reflection.setFieldValue(field.getName(), object, resu...
92058de7-0b99-4a06-bcc6-7e7a941f2629
9
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { if(target instanceof MOB) { final Room R=((MOB)target).location(); boolean found=false; if(R!=null) for(int r=0;r<R.numInhabitants();r++) { final MOB M=R.fetchInhabitant(r); if((M!=null)&&(M!=mo...
326da0df-404c-4e75-be98-55858d2a476b
9
public int getHandleOfNode(Node node) { if (null != node) { // Is Node actually within the same document? If not, don't search! // This would be easier if m_root was always the Document node, but // we decided to allow wrapping a DTM around a subtree. if((m_root==node) || (m_r...
2fdcf5a4-0c5a-4a9f-a9e4-5889c3dc026e
6
/* */ public void login(String paramString1, String paramString2) { /* */ try { /* 92 */ HashMap localHashMap = new HashMap(); /* 93 */ localHashMap.put("user", paramString1); /* 94 */ localHashMap.put("password", paramString2); /* 95 */ localHashMap.put("version", Integer.valu...
c0f6ce3c-2664-4f0d-8b56-50728c8a8219
1
public ShapeElemlin(SimpleFeature f, String tipo) { super(f, tipo); // Creamos la factoria para crear objetos de GeoTools (hay otra factoria pero falla) com.vividsolutions.jts.geom.GeometryFactory factory = JTSFactoryFinder.getGeometryFactory(null); shapeId = "ELEMLIN" + newShapeId(); // Elemtex trae la...
bb36233b-60a8-478f-8d17-9725ae9b3b84
4
@Override public void permission(Permission p, ProtectionDomain pd) { if (filter(p)) { //filter out file operation checks for this class return; } if (!perms.containsKey(pd)) { perms.put(pd, new ArrayList<Permission>()); } perms.get(pd).ad...
cde1a3bb-1e33-4429-a301-aca613891980
2
private void renderError(Graphics2D g) { if (MESSAGE != null) { g.setFont(new Font("TimesRoman", Font.PLAIN, 30)); FontMetrics fontMetrics = g.getFontMetrics(); float xLeft = (float) (CARD_WIDTH + CARD_X_GAP); float x = (getWidth() - xLeft - fontMetrics.stringWid...
94e7acb4-e2bd-4fc7-a233-ba84a510810f
7
private <V, E, G extends Digraph<? extends V, ? extends E>> void writeNodesAndEdges( Writer writer, int level, DotProvider<V, E, G> provider, G digraph, Map<V, Cluster<V,E,G>> clusters, DigraphProvider<? super V, G> subgraphs) throws IOException { for (V vertex : digraph.vertices()) { if (cluster...
7dfda511-c3a1-46d7-92e7-60ff09c49f46
3
void readFromAlg() throws FileNotFoundException { Scanner in = new Scanner(file); String line, section = ""; while (in.hasNext()) { line = in.nextLine(); if (line.startsWith(" ")) { parseEntry(line, section); } else { line = ...
95d84cbc-7683-4cea-a258-078736bb0609
0
public void setMaximumSize(Dimension maximumSize) { super.setMaximumSize(maximumSize); questionTextArea.setMaximumSize(maximumSize); answerTextArea.setMaximumSize(maximumSize); }
b64fd478-d97b-4add-ac88-40414c42f641
9
public static void solveFlexible(Node node) //TODO: make for (x/y)/(a/d) { if(node.data.length() == 0) return; double ans; boolean modified = false; switch( node.data.charAt(0) ) { case '+': ans= 0; for(int i = 0; i<n...
166e386e-791a-40e2-8d49-a7b829018f4d
3
public static void removeConnectedClient(String btN) { for(int i = 0;i<=5;i++) { if(clientsTable.getModel().getValueAt(i, 0) != null) { if(clientsTable.getModel().getValueAt(i, 0).toString().equals(btN)) { //Clear Device clientsTable.getModel().setValueAt(null, i, 0); clientsTable.getM...
4939e42e-381c-4cc9-93de-a5b1a4f8c3fb
3
@Override public String getColumnName(int c) { String result; switch (c) { case 2: result = "Section"; break; case 3: result = "Correct"; break; case 4: result = "Incorrect"; ...
2ac14f40-905c-44ce-9c4d-d2990c3177e8
4
public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) { if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative"); if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative"); double xs = s...
a6ee6db2-8193-48ac-951d-8f7a41f76ea1
3
public String returnUsers(){ String returnme = ""; if(usershere.size() > 0){ returnme += "@" + usershere.get(0).getName(); } if(usershere.size() > 1){ for(int i = 1; i < usershere.size(); i ++){ returnme += " " + usershere.get(i).getName(); } } return returnme; }