method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
942e107f-ce5c-4687-aac8-148dbfe2311c
9
public static void main(String[] args) { int mode = 0; String textLine = ""; printHelp(); printHit(mode); while (true) { textLine = readInputTextLine(); if (textLine == null || textLine.length() < 1) { printHelp(); }else if ("q".equals(textLine)) { System.exit(0); } else if ("t".equals(tex...
22f647bb-54c7-40cf-8270-1ccecc1ab8df
4
public void setExplanation(){ if(Playtable.myRank == 3){ lbExplain.setText("<html><body style='width:500px'> Als grosser Diener musst du dem Grossen Dalmuti deine beiden besten Karten geben. Bitte drück dafür auf Tauschen."); } if(Playtable.myRank == 2){ lbExplain.setText("<html><body style='width:500px'> Al...
e382a7ab-d160-4550-9328-0da1fa5fcc74
5
protected boolean loopDetection(List<Formula> goals) { for(Formula f : goals) { if(f.getClass().equals(Implies.class)) { Implies i = (Implies) f; if( inKnowledge(i.left()) && ( goals.contains(i.right()) || incompleteGoals.contains(i.right()) ) ) return true; } } ...
962aee42-da2e-4b7f-b800-b90747abc5a2
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CalendarUser other = (CalendarUser) obj; if (id == null) { if (other.id !...
a6cf6e13-d862-41ec-b865-454cfea1f9ab
8
public void actionPerformed(ActionEvent arg0) { String command = arg0.getActionCommand(); if (command.compareToIgnoreCase("Begin") == 0) { // disable the begin button and the configPanel (freeze the config) controlPanel.begin.setEnabled(false); configPanel.setEnabled(false); fast = false; // T...
d3cfa4f7-ebfd-4ff1-a5d6-818a9e720a41
0
@Test public void virheellinenFormaattiTapausB() { Este s = new Este(100, 200, 200, 100); Este r = new Este(100, 100, 200, 200); assertTrue("Este ei muuttanut kulmia oikeiksi. " + s.toString(), s.toString().equals(r.toString())); }
d738794d-ab0b-4b6e-ab50-767a0111b355
5
public static boolean isPrime(long num) { if (num<2) return false; if (num==2) return true; if (num%2==0) return false; for (long i = 3; (i*i)<=(num); i+=2) { if (num%i == 0) return false; } return true; }
ca55ec89-72f2-4324-9a78-314027c2fc6d
0
public static String arrayToCommaDelimitedString(Object[] arr) { return arrayToDelimitedString(arr, ","); }
3869192a-5f45-4c1f-b88b-0f6a210aabc6
2
public static void newDeviceAvailable(int vendor_id, int product_id, int usb_port_address, String pdoname) { try { if (trace) System.err.println ("in java newFWDeviceAvailable w/:"+pdoname); self.mkBus (pdoname, usb_port_address); } catch (Exception ioe) { //ca...
ba7b56a9-a32b-466c-ab28-d4b893f9c012
9
@Override public Object findById(Class c, Object id) { if (c.equals(Vendedor.class)) { for (Object v : findAll(c)) { Vendedor ven = (Vendedor) v; if (ven.getIdentificacion() == Long.parseLong(id.toString())) { ...
1f886cdc-4ba5-4975-8655-0db0da9bca86
9
public void buildClassifier(Instances insts) throws Exception { // can classifier handle the data? getCapabilities().testWithFail(insts); // remove instances with missing class insts = new Instances(insts); insts.deleteWithMissingClass(); // Compute mean of target value double yMean =...
fd10d0b5-4bce-4be8-b0d1-e0a592531300
7
@Override protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) { super.dataAttributeChanged(keyWord, value); if (value != null) { if (keyWord == BPKeyWords.SOURCE) { if (this.sourceVertex != null) { this.sourceVertex.remove...
77786ce4-32b9-422f-bef5-875c07c4ca2d
2
public boolean hasPermission() { return this.permission != null && !this.permission.equals("*") && !this.permission.equals(""); }
1c43d9ab-e4b6-4b0e-91fd-77329446801a
1
public String getTooltip() { String tooltip = name; for (GroupOfUnits u: units) { tooltip += "\n"+ u.type.name +" ("+u.getNumberDesc()+")"; } return tooltip; }
3529c4ef-4123-417b-907d-e4cccc713b1a
7
private void expandir() { Nodo mejor = openList.get(0); openList.remove(0); closedList.add(mejor.getEstado()); for (Nodo s : problema.sucesor(mejor)) { Estado siguiente = s.getEstado(); if (!closedList.contains(siguiente)) { int f = f(mejor, s)...
1a4ae56f-e116-4fc4-bab5-fbe334caa07b
7
public void parseFixatdlFile( String aFilename ) throws FIXatdlFormatException { setLastFixatdlFilename( null ); setLastFilteredStrategyList( null ); setStrategies( null ); // Create a JAXB unmarshaller object from StrategiesT class // TODO: Perhaps this should be done statically (e.g. once at app load...
f54075a5-5011-490b-b9f2-08cee0409c0f
2
* @Post: No changes * @Return: Returns all pieces of the given color that can attack the given point */ ArrayList<Piece> piecesThatCanAttack(Point p, boolean color) { ArrayList<Piece> thePieces =myBoard.getPieces(color); int indexToCheck=0; while(indexToCheck<thePieces.size()) { if(thePieces.get(indexT...
5f61fe79-9c4d-46df-beb3-2eaec18ec0d4
5
public boolean place(int x, int y) { //if all squares are free, place ship and placed == true. if not, return false if (randomAlignment() == true) { x = randomWithRange(0,6); for (int i = x; i < x + 4; i++) { if (!Grid.isSquareEmpty(i, y)) { Grid.addTo...
941bf1ba-921c-4014-8b02-21ebaf9131c0
7
private Place[] placesPath( final Place init, final Place dest, boolean reports ) { if (printSearch) I.say("Searching from "+init.core+" to "+dest.core) ; final Search <Place> search = new Search <Place> (init, -1) { protected Place[] adjacent(Place spot) { // // TODO: ...
f3fe20b5-da2a-4b5d-9cc8-48dfa5423509
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final WordLocation other = (WordLocation) obj; if ((this.word == null) ? (other.word != null) : ...
39f0cd30-6327-4ce3-9d31-7e5a415a1f09
4
public static User connectOrCreate(String openId, String email, String firstname, String lastname) { User result = find("byOpenId", openId).first(); if (result == null) { // User not found, create one result = new User(openId, email, firstname, lastname); result.save(...
36178f00-e68f-4180-9c09-7a61983ce13f
8
@Override public List<Employee> listEmployeesInDept(List<Integer> departmentIds) { XStream xstream = new XStream(); ArrayList<ContentExchange> exchanges = new ArrayList<ContentExchange>(departmentIds.size()); String serverUrl; for (Integer i : departmentIds) { try { serverUrl = getServerURLForD...
bc77df81-1831-419e-b3c1-9ef836a1f779
0
private void setLengthLifeInAquarium(Scanner scanner) { lengthLifeInAquarium = Input.getPositiveNumber(scanner, "Enter the number of cycles of life:"); }
bbc89e78-0c2d-4251-a0ce-cb3480213db8
8
private boolean isAction(QueryType type) { switch (type) { case SELECT: return this.action.equals(ACTION_SELECT) ? true : false; case INSERT: return this.action.equals(ACTION_INSERT) ? true : false; case UPDATE: return this.action.equals(ACTION_UPDATE) ? true : false; case DELETE: retur...
eb679c18-bb26-4caf-911e-a22c5a22f6f0
0
public String getManagerId() { return managerId; }
80529877-dc6e-4c56-bbed-0ab161aeff13
2
@Override public boolean apply(ICreature input) { if (input == observer || !(input.getClass().isAssignableFrom(Plant.class))) { return false; } return abs(observer.distanceFromAPoint(input.getPosition())) <= observer.visionDistance; }
58150511-d373-4437-925d-d1bfe82bfc9b
5
private static void runToFirstInputFrameAfterAddressHiOrLoNoLimit(int move, int joypadInputAdd, int addressToPass) { State initial = curGb.newState(); // System.out.println("runToFirstInputFrameAfterAddressHiOrLo steps1: " + curGb.currentStepCount); runToAddressNoLimit(0, 0, addressToPass); // System.out....
8c76d7f9-c9db-4806-8448-096cef9451ca
5
@Test public void evaluatePostfix1() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException { try { String result = calc.evaluatePostfix(postfix); String expected = "5.0"; assertEquals(expected, result); } catc...
6a3aacdd-cb01-405f-ad8b-0a00078c5fab
5
private String readFile(String filename){ if (!filename.endsWith(".java")){ System.out.println("该文本文件名不是以.java结尾的"); return null; } BufferedReader in = null; try { in = new BufferedReader(new FileReader(filename)); } catch (FileNotFoundException e) { System.out.println("File not found"); //e.pr...
45d1af81-cdba-4a9c-8fe8-36f9e7c622d8
7
@Override public String paramString() { StringBuilder param = new StringBuilder(255); switch(getID()) { case NATIVE_MOUSE_CLICKED: param.append("NATIVE_MOUSE_CLICKED"); break; case NATIVE_MOUSE_PRESSED: param.append("NATIVE_MOUSE_PRESSED"); break; case NATIVE_MOUSE_RELEASED: para...
1b733130-072c-4851-910d-e892f9933d58
6
public static void main(String[] args) { //13. Se le da una matriz con números enteros positivos y negativos. Escriba una función para cambiar el orden de los elementos de la matriz de tal manera que los enteros negativos estén al principio, los enteros positivos queden al final. Cero (0) y números enteros que tienen e...
d6961dda-7acf-41f3-81ec-3deae00bf71d
4
public Model(float[] vBuffer, String texturePath, int mode){ id = createVBOID(); vBufferSize = vBuffer.length; vBufferData = BufferUtils.createFloatBuffer(vBuffer.length); vBufferData.put(vBuffer); vBufferData.rewind(); if(texturePath != null){ try { texture = TextureLoader.getTextu...
a7a6b20c-c070-4da4-afb4-f60260614ca5
1
public CtMethod getEnclosingMethod() throws NotFoundException { ClassFile cf = getClassFile2(); EnclosingMethodAttribute ema = (EnclosingMethodAttribute)cf.getAttribute( EnclosingMethodAttribute.tag); if (ema != null) { ...
fb1250fe-877b-41c9-a507-2e883cd2455a
8
@SuppressWarnings("unchecked") @Override public void doStep() { if ((boolean) entry.getStepInfo().get("skipped")) { Logging.log("Skipping relocate"); nextStep(); return; } data = (Map<FieldKey, String>) entry.getStepInfo().get("meta.data"); final String dirPath = ConfigManager.getInstance().getConfi...
b6722e62-cdfe-4824-b0d7-55640ff4df94
5
@Override public void actionPerformed(ActionEvent e) { switch (menu) { case 'b': frontend.switchMenu(); break; case 'm': frontend.emptyBox(); frontend.fillComboBox(Units.MASS); frontend.switchMenu(); break; case 'c': frontend.emptyBox(); frontend.fillComboBox(CONFIG.Units.CAPACITY); ...
2ffdd3a3-11cd-4dc0-9250-e0cd5c606092
9
public int median(int i, int j) { int m, n, count, t[], tmp; //--- Browse Kernel Matrix ---// t = new int[9]; for (m = i - 1, count = 0; m <= i + 1; m++) { for (n = j - 1; n <= j + 1; n++) { if (m >= 0 && m < nrows && n >= 0 && n < ncols) { ...
2949b13d-256d-453f-8b2f-cbaca634879a
9
private EASLogEntry(String entryNum, String startTime, String endTime, String cmd, String requestXML, String responseXML, boolean serverException, boolean pendingResponse, Map<String, String>headers, Alarms alarms){ // initialize the alarm signal, value can be updated during subsequent processing ...
26213ad3-d6c6-4bde-a2d0-d21b92b42d4b
7
private void updateCalendar() { LocalDate calDate = currentDate.withDayOfMonth(1).withDayOfWeek(1); LocalDate finishDate = currentDate.withDayOfMonth(currentDate.dayOfMonth().getMaximumValue()).withDayOfWeek(7); if (currentDate.getDayOfWeek() <= 6) { //add extra week for when the dat...
11dec407-fa1c-4e93-b62d-c6b1b819ea1e
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Grant other = (Grant) obj; if (grantee == null) { if (other.grantee != nu...
febfb5dd-8b1a-469c-8fbd-b4c5ac1da146
4
public List<GenericObject> getCore() { final List<GenericObject> core = new ArrayList<GenericObject>(); final String tag = getTag(); for (int i = 1; /* loop until broken */; i++) { GenericObject prov = dataSource.getProvince(i); if (prov == null) break; ...
27b9d715-df3a-4757-9a54-a1308e9ac2ee
1
public void setSuperclass(CtClass clazz) throws CannotCompileException { checkModify(); if (isInterface()) addInterface(clazz); else getClassFile2().setSuperclass(clazz.getName()); }
687a0989-82e6-44e4-a0dc-b450a7bf052e
4
private static List<Split> computeSplits(Job job) { List<Split> splits = new ArrayList<Split>(); File inputDir = new File(job.getInputDir()); for (final File fileEntry : inputDir.listFiles()) { long bytes = fileEntry.length(); if(bytes > Split.MAX_SPLIT_SIZE) { long numChunks = (bytes/Split.MAX_SP...
db6f0c68-7487-45e6-aa99-ecfb9a612518
4
public float nextVonNeumann() { int n; int k = 0; float u1; // Loop to try sequences of uniformly-distributed // random values. for (;;) { n = 1; u1 = gen.nextFloat(); float u = u1; float uPrev...
25fdd336-d69d-4781-a738-46fe2961018b
4
private void traverse(TreeNode current, TraverseCallback callback) { TreeNode previous; do { while (!current.leftIsWire) { current = current.leftChild; } callback.action(current); previous = current; current = current.rightChild; while (previous.rightIsWire && current != nul...
ebad842e-461b-4ca0-a6ab-e52534055ff6
2
private String getListBy( String variable ) { StringBuilder sb = new StringBuilder(); if ( hasSearch ) { for ( int i = 1; i < searchList.size() + 1; i++ ) { sb.append( "\n" + TAB + TAB + TAB + "List<" + variable + "> list" + i + "= " ); sb.append( toJavaCase(...
ca343ec3-7874-4fd6-a2ed-4bd2be123d6c
9
public int firstMissingPositive(int[] A) { if (A == null || A.length == 0) { return 1; } int i = 0; while (i < A.length) { if (A[i] != i + 1 && A[i] >= 1 && A[i] <= A.length && A[A[i] - 1] != A[i]) { int temp = A[A[i] - 1]; A[A[i] - 1] = A[i]; A[i] = temp; } else { i++; } } ...
57d0c713-952f-4a1b-a627-c423668e948f
1
public int getNumber() { int value = -1; if (q.size() > 0) { value = (Integer)q.remove(); } return value; }
2d50d7a1-2b71-4ee6-9fa8-ee4ef2f2e914
7
public static Usage getInstanceWithId(int id) { switch(id) { case 1: return RequiredConfigurationData; case 2: return ChangeableRequiredConfigurationData; case 3: return OptionalConfigurationData; case 4: return ChangeableOptionalConfigurationData; case 5: return OnlineDataAsSourceReceiver; c...
175caf83-453e-4bed-a64b-bc61d63c7f26
4
private void createHuffmanDecodingTables(final int alphaSize, final int nGroups) { final Data dataShadow = this.data; final char[][] len = dataShadow.temp_charArray2d; final int[] minLens = dataShadow.minLens; final int[][] limit = dataShadow....
059cea72-9179-4c80-8b39-e50fb59a1d4e
7
public static void main(String[] args) { // Options options = new Options(); // create boolean options Option underscoreOpt = new Option("u", "Use underscore character for separating syllables of words"); options.addOption(underscoreOpt); // Option plainTextFormatOpt = new Option("p", "Use plain text form...
14d3ea1f-6e20-4b11-b9a5-c6da0710a073
6
public static ArrayList<FilterBean> getFilter(HttpServletRequest request) { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filteroperator") != null) { if (request.getParameter("filtervalue") != null)...
4a170783-da19-4128-b2f5-1ade0788085f
2
public void stopTime(){ if(fpsTimer.isRunning())fpsTimer.stop(); if(tickTimer.isRunning()) tickTimer.stop(); }
5ae9ebdb-9ce5-4eb6-8231-d0c92e8fb598
9
public void InitializeGameWorld(int numEnemyTanks, int numRocks, int numTrees){ listObjects = new LinkedList<GameObject>(); tanks = new LinkedList<Tank>(); landscape = new LinkedList<LandscapeGameObject>(); projectiles = new LinkedList<Projectile>(); playerTank = getRandomPlayerTank(0); for (int i...
a18e6df8-2709-4555-82de-bc56c43e7fba
4
private DescRec parseDesc(Node item) throws IOException { if (!"Desc".equals(item.getNodeName())) return null; String id; try { id = item.getAttributes().getNamedItem("id").getNodeValue(); } catch (Exception e) { throw new IOException("Cannot have a description without id"); } String name = valueOr...
08141ad3-1a1e-43e0-a41c-d43fdd4cb6d1
4
public static String getArg(String substring) { int c = 1; char array[] = substring.toCharArray(); for (int i = 0; i < array.length; i++) { if (array[i] == '(') { c++; } else if (array[i] == ')') { c--; if (c == 0) { return substring.substring(0, i); } } } return substring; }
46e93b33-97de-422e-a66d-434438be8c13
1
public SpeelScherm(Spel spel) { try { initialize(spel); } catch (IOException e) { JOptionPane.showMessageDialog(new JFrame(), e.getMessage()); } }
a664de89-609c-4df8-be12-e18d6de3b944
7
public XMLElement save() { if (style != null || color != null || width != WIDTH_PARENT) { XMLElement edge = new XMLElement(); edge.setName("edge"); if (style != null) { edge.setAttribute("STYLE", style); } if (color != null) { ...
19ce88c7-8577-4794-a6ab-50701af7d424
5
public boolean isNotEnough(Items items) { if (items.getShoes().size() == 0 || items.getPants().size() == 0 || items.getGloves().size() == 0 || items.getArmors().size() == 0 || items.getHelms().size() == 0) { return true; } return false; }
202530cd-fc2e-4a65-9747-a11f32a3af1a
3
@Override public void open(AudioFormat pAudioFormat) throws AudioDeviceException { super.open( pAudioFormat ); DataLine.Info dataLineInfo = new DataLine.Info( this.mSourceDataLineClass, pAudioFormat, this.mBufferSize ); try { if ( this.mMixer == null ) { this.mSourceDataLine = (SourceDataLin...
9215aad6-42b3-4f02-a59e-29b1f4ab7143
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
eb8d5a34-2c6f-4e08-80e0-955c40d02d77
4
public Variable getVariableValue(String varName) { if(varName.equalsIgnoreCase("true") || varName.equalsIgnoreCase("false")) { return new Variable<String>(varName); } if(varName.contains(".")) { String[] parts = varName.split("\\."); String object = parts[0]...
bf4b37a9-58a8-4d30-88d7-4ccb9f85ecb8
8
private Rule rule() { Condition condition = condition(); consume(ARR); List<Update> updates = new ArrayList<Update>(); Command must = null; while (true) { if (peekType() == MEM || peek().isMemSugar()) { Update update = update(); updates.add(update); } else if (peek().isAction()) { must = act...
e23a78f1-e94a-4178-903a-8f4510c18d3e
5
public static String encodeParameters(PostParameter[] httpParams) { if (null == httpParams) { return ""; } StringBuffer buf = new StringBuffer(); for (int j = 0; j < httpParams.length; j++) { if (httpParams[j].isFile()) { throw new IllegalArgumentE...
f013cb57-db06-414b-9e93-34f92ebf3d3b
2
public void setcanfocus(boolean canfocus) { this.autofocus = this.canfocus = canfocus; if (parent != null) { if (canfocus) { parent.newfocusable(this); } else { parent.delfocusable(this); } } }
1eae2eb5-3116-4cde-ae41-af46ea2a5683
7
private CatalogItem getCatalogItem(String org, String catalog, String item, String type) { this.vccPreCheck(); Formatter.printInfoLine("Retrieving catalog: " + catalog); Catalog cat = null; try { Organization orgObj = this.getOrganization(org); for (ReferenceType catalogRef : orgObj.getCatalogRefs()) {...
28dd1f0a-f5ca-4293-863a-156b01a224ea
1
public synchronized void close() { try { this.bucket.close(); } catch (IOException ioe) { logger.error("Error closing torrent byte storage: " + ioe.getMessage()); } }
82e47104-35ea-4092-b46c-0a099ad83933
0
public TestRunner(AlgorythmFile algorythmFile, DataStructures arraysData, int numberOfPoints){ this.algorythmFile = algorythmFile; this.arraysData = arraysData; this.numberOfPoints = numberOfPoints; }
60be1521-785d-450f-b55c-455a830b9d58
3
private byte[] toByteArray() { if ( old_buffers == null ){ byte[] res = new byte[current_buffer_pos]; System.arraycopy( current_buffer, 0, res, 0, current_buffer_pos ); // System.out.println( "-> " + current_buffer_pos ); return( res ); }else{...
a94846c1-b968-40b8-adae-1f0411f9765c
6
@Override public void run() { try { try { System.out.println("opening streams"); this.input = getBufferedReader(client.getInputStream()); this.output = getPrintStream(client.getOutputStream()); System.out.println("Opened streams"); Command handshake = new Command(input, false); ...
17bf560e-a7f6-493d-8204-09f3a8eae08f
3
public static void main(String[] args) { /* * *** ***** ******* */ for(i=0;i<=3;i++) { for(j=i;j<=6;j++) { System.out.print(" "); } for(j=i;j>=1;j--) { System.out.print("**"); } System.out...
352485ad-54df-44fe-b98b-ca24e6abe364
2
public Pion(Position position, String couleur) { super(position, couleur); if(this.position.getI()==6 || this.position.getI()==1) NombreDeDeplacement=0; else NombreDeDeplacement=1; this.setPositionPossible(); this.Image = "Image d'une dame de cette couleur"; }
e417c968-32c4-4261-a6e1-35fd02e082e8
3
@Override public double getTipValue() { double tip = 0.00; // always initialize local variables switch(serviceQuality) { case GOOD: tip = bill * GOOD_RATE; break; case FAIR: tip = bill * FAIR_RATE; break; ...
c6f801ac-c8dd-4bcb-b8c1-aae41aa474d1
0
@Test public void testUnion() { QuickUnion spy = Mockito.spy(new QuickUnion(5)); when(spy.getRoot(0)).thenReturn(0); when(spy.getRoot(1)).thenReturn(1); when(spy.getRoot(2)).thenReturn(2); when(spy.getRoot(3)).thenReturn(3); when(spy.getRoot(4)).thenReturn(4); spy.union(0, 1); when(spy.getRoot(0)).t...
956463c2-2ebb-407e-9f45-db41a7b4e64f
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission(Permissions.PERM_INFO)) return false; if (!(sender instanceof Player)) return false; Player player = (Player) sender; Chunk chunk = player.getLocation().getChunk(); Chu...
09d1dcb1-0f99-4628-a1dd-f00cbd22fd72
5
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } ResultSet rs; java.sql.Statement stmt; Connection con; try { con = service.getConnection(); st...
2413c881-4342-4978-96f2-f1ea889ccdf3
6
public void setEntity(AbstractEntity entity) { if (entity == null) { entity = EntityManager.getEntityManager().getEntity("Air"); } if (entity.isSolid() && getAgents().size() > 0) { throw new IllegalArgumentException("Putting solid over agent"); } AbstractEntity oldentity = this.entity; this.enti...
869403d9-abd1-44eb-a481-1b34efb7ebbb
4
public void addPieceToBoard(Piece piece, int x, int y) { Position position = new Position(x, y); Square newSquare = new Square(piece, position); board.setChessBoardSquare(newSquare, position); if(piece.getPieceColor().equals(white)) { team.addWhitePieceToTeam(piece, position); } else { team.ad...
22f50782-37aa-4145-b792-e704a719dbff
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
82974680-08eb-41f8-8cde-1db62788d991
6
private void onReload(FileConfiguration data) { String title = data.getString("title"); int size = data.getInt("size"); List<HumanEntity> viewers = inventory.getViewers(); // Changing the size or title requires creating a new inventory boolean recreate = !title.equals(inventory....
061da126-1803-4394-8494-f8372e65c6c7
1
private void loadTextures() { this.name2texture = new HashMap<String, Texture>(); String name = ""; for (GameButton button : buttons) { name = button.getName(); this.name2texture.put(name, new Texture(Gdx.files.internal("model/button/" + name + ".png"))); } this.name2texture.put("background",new Texture...
6a5c08ab-829e-4126-8994-66fad550bf9e
2
public void test_01() { readFile("tests/indexer_test_01.fastq"); // Compare random references for( int i = 0; i < NUMBER_OF_COMPARISSONS; i++ ) { // Pick 2 random references and compare them long ref1 = references.get((int) (Math.random() * references.size())); long ref2 = references.get((int) (Math.ran...
b28b04fd-5149-4ca7-aa5b-ebafa74980b1
0
@Override public void applyCurrentToApplication() { Preferences prefs = Outliner.prefs; PreferenceString pMergeDelimiter = (PreferenceString) prefs.getPreference(Preferences.MERGE_DELIMITER); PreferenceBoolean pTrimEnabled = (PreferenceBoolean) prefs.getPreference(Preferences.TRIM_ENABLED_FOR_MERGE_WITH_DELIM...
4bae568a-e61e-44f5-94ff-b1aa7eef62dc
4
public void repaint(SnakePlayer[] players) { for (int i = 0; i < players.length; i++) { if (players[i].isAlive()) { updateScore(players[i]); for (int d = 0; d < 10; d = d + 2) { int player = players[i].PlayerID - 1; if (player >= 0){ bi.setRGB((int) players[i].playerArray[d...
09cda386-c5f0-479d-b604-93954a221dfc
0
public OutlinerDocumentEvent(OutlinerDocument doc) { super(doc); }
7ea07297-0519-44a1-bb33-9f5071bf2786
0
public static Transition getTransition(String v1, String v2, VariableDependencyGraph graph) { State from = getStateForVariable(v1, graph); State to = getStateForVariable(v2, graph); return new VDGTransition(from, to); }
aba063f2-e3e7-4c3d-bf17-7d03d37e4e65
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos...
643c4383-6a5a-4886-b9a6-c1c5337aa078
0
public static void main(String[] args){ prepare(); init(); run(); }
634497a1-3a37-4d94-8bbc-727e32e71542
6
public void updateFog() { Level var1 = this.minecraft.level; Player var2 = this.minecraft.player; GL11.glFog(2918, this.createBuffer(this.fogRed, this.fogBlue, this.fogGreen, 1.0F)); GL11.glNormal3f(0.0F, -1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Block var5; if((var...
695e6ce0-c370-4cb5-9058-55ebce9ba997
6
public boolean isPerfect(){ if(this.name==null) return false; if(this.dl==null) return false; if(this.circle==null)return false; if(this.circle.getName()==null) return false; if(this.exp_long==null) return false; if(this.exp_short==null) return false; return true; }
348bc70a-fd99-49fb-ab17-61a7db4ca995
0
public void setNomeUser(String nomeUser) { this.nomeUser = nomeUser; }
a60ea862-1a19-4cef-aef9-5c33d136f7b8
1
public Set<TableDescription> getTablesDescriptions() { Set<String> tableNameSet = tableHashMap.keySet(); Set<TableDescription> tableDescriptions = new TreeSet<TableDescription>(); for (String tableName : tableNameSet) { Table table = tableHashMap.get(tableName); TableDesc...
735680b8-865f-4654-9b4b-3a36a1777a2c
1
private Geom.Side calcPosition( EndPoint endPoint ){ if( endPoint.getEndPointPosition() != EndPointPosition.AUTOMATIC ){ return Geom.toSide( endPoint.getEndPointPosition() ); } return Geom.nearestSide( endPoint.getOtherEndPoint().getArrayBoundaries(), getBoundaries() ); }
0f633d8f-c612-44f4-a442-0a3b5bdf8fbe
0
private StartForwarder() { // JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents putValue(NAME, "Iniciar Forwarder"); putValue(SHORT_DESCRIPTION, "Iniciar Forwarder"); putValue(LONG_DESCRIPTION, "Iniciar Forwarder"); putValue(SMA...
2a7c6cfc-d8ad-412c-90cf-8f2d8f0cbbbe
1
static void displayVendingMachineProducts(VendingMachine vendingMachine) { System.out.println("Product Options..."); int option_num = 1; for(Product product : vendingMachine.getStocked_products()) { System.out.println("Product #" + option_num + " " + product.get...
90dd2aaf-0ee7-42b4-8f45-030b430bed23
0
public synchronized int value() { return c; }
271e41f2-4181-474f-b923-8e94d0dd1862
2
public static void saveData(String name, ParsableConfigurationData data){ try { URL oracle = new URL("http://www.wdfatv.net/olywar/input.php?user=" + name + "&data=" + data.getParsedString().replaceAll(" ", "%20").replaceAll("#","/")); new BufferedReader(new InputStreamReader(oracle.openStream())); ...
2f15c024-8ffd-4d91-b9d7-91f5159287f0
2
public boolean connect(){ Properties props = new Properties(); props.setProperty("user",properties.DB_USERNAME); props.setProperty("password",properties.DB_PASSWORD); try { con = DriverManager.getConnection(properties.DB_URL, props); } catch( SQLException e ){ if( debug ) System.out.println("Error in Da...
408bc28b-287b-456a-9aad-5726824523d3
7
public void inputAndReverse(char[] p_input) throws IOException { ArrayBasedStack<Integer> l_startStack = new ArrayBasedStack<>(10000); ArrayBasedStack<Integer> l_endStack = new ArrayBasedStack<>(10000); boolean l_flag = true; for (int l_i = 0; l_i < p_input.length; l_i++) { ...
d09ea4bf-a0ea-4414-bbbc-23bb1428a9d9
2
@Override public boolean hasNext() { boolean hasNext = mIterator != null && mIterator.hasNext(); if (!hasNext) { mIterator = null; hasNext = mIndex < mRows.size(); } return hasNext; }
f643dc30-22b8-475e-a0f9-6910a6f29dda
1
private void reset() { clear(3); clear(6); for (int i=15; i<32; i++) clear(i); }