method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
234cd637-b6f7-4ce0-bed0-5933a4bfa50a
0
@Test public void testKMP() { String docs = "substring search application"; String pattern1 = "app"; String pattern2 = "apa"; DFA dfa1 = new DFA(pattern1, 256); DFA dfa2 = new DFA(pattern2, 256); assert(dfa1.search(docs) == docs.indexOf(pattern1)); // success assert(dfa2.search(docs) == docs.lengt...
ba26c653-b779-4eb1-b698-f6f374ed75df
0
public void setDexterity(double dexterity) { this.dexterity = dexterity; }
dbf9f563-0a8d-4705-8a98-a9de7cd5abe2
5
public void analisiPedinaNera(boolean tur) //controlla le mosse semplici per i pezzi neri. { boolean vicini=false; try { if(damiera.getPosizione(riga+1, colonna+1).vuota()) listaMosse.add(new Mossa(damiera.getPosizione(riga, colonna), damiera.getPosizione(riga+1, colonna+1), null, 0)); else vici...
ee431eda-aec5-415e-a1c3-e44a346e6b74
5
boolean NORTHhasCraftedBlock(Location startLocation) { boolean res = false; int validCraftBlockRows = 0; // amount of horizontal rows that have been successfully checked for crafted blocks. // Check NORTH ========================================================= // Check if there is a block ...
368e4848-5abe-4cff-97e2-4a6e1d8644ef
5
@SuppressWarnings("unchecked") @Override public <T> T getResource(String id, Class<T> clazz) { ResourceLoader<?> loader = loaders.get(clazz.getName()); T resource = null; if (hasResource(id, clazz)) { resource = (T) loader.getResource(id); } else if (definitionManager.hasElement(id)) { ResourceDefin...
830125c8-92d7-4439-9ac6-1bef3d9ad806
2
public Square() { for(int i = 0; i < DEFAULT_SIZE; i++) for(int j = 0; j < DEFAULT_SIZE; j++) { this.cell[i][j] = new Cell(); } this.suid += 1; this.id = this.suid; }
9e378f65-0dbc-42e7-a962-1935e800dea7
3
@Override public Object evaluate(Context context) { Object value = expression.evaluate(context); if (value != null && value instanceof Integer && ((Integer)value) != 0 ){ block.evaluate(context); } return Nothing.VALUE; }
d210eaa2-5de6-459b-8a28-e9e135264448
2
public int size() { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } return array.length; }
7fa6772b-919c-4fde-9b21-7aaa61691adb
3
public int[] getPower() { int[] powerArray = new int[3]; int usedPower = 0, totalPower = 0, availablePower = 0; Placeable placeable = null; try { for (String key : placeables.keySet()) { placeable = (Placeable) placeables.get(key); if (placea...
e68c70d7-c80c-4976-a851-ce5578ffe1fa
9
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[61]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 15; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { i...
4ef54a32-f136-476d-aee5-623381b8cd4b
7
public void moveDialog(){ final int speed = 4; if(moving == MoveType.UP){ //bring into focus if (top) y -= speed; else y += speed; if(y >= 75 + offset) { moving = MoveType.NOT; raised = true; } } else { //bring out of focus float min = -20; if(moving==MoveType.HALFDOWN) min = 47.5f; ...
f6a620d5-5e9f-47c0-8ce7-a70837beb6bc
7
protected double objectiveFunction(double[] x){ double nll = 0; // -LogLikelihood int dim = m_NumPredictors+1; // Number of variables per class for(int i=0; i<cls.length; i++){ // ith instance double[] exp = new double[m_NumClasses-1]; int index; for(int offset=0; offset<m_NumClasses-1; offs...
e1d82be4-c174-423b-bc40-3c50d3155fea
7
protected long encodeJavaEnvelope(OutputStream objOut, RPCJavaEnvelope javEnv) throws IOException { if(log.isDebugEnabled()) log.debug("encodeJavaEnvelope"); long byteSent = 0L; writeShort(objOut, javEnv.getEnvelopeType()); byteSent +=2L; Object jarSrc = javEnv.getJarSource(); if(log.isDebugEnabled())...
20969d1f-6f5e-45eb-b0c9-03200ac3326c
7
public boolean isIrrigable() { switch(value) { case 3: case 8: case 9: case 12: case 13: case 14: case 15: return false; default: return true; } }
9c6fadd4-1c44-4e52-9b60-ee0d13d8d16f
2
@Override public void run() { while (!Thread.currentThread().isInterrupted() && counter > 0) { assertNull("Duplicate found!", results.put(cgp.next(), null)); --counter; } }
4d67cd96-a1d5-4627-b645-ac1f81cf4368
5
private void zoom(java.awt.event.MouseWheelEvent evt) { isZooming = true; double zoomFactor = .2; int length=graph_screen.getWidth(); int height=graph_screen.getHeight(); xmin=Double.parseDouble(Xmin.getText()); xmax=Double.parseDouble(Xmax.getText()); ymin=Do...
d844e9a1-09ba-4c71-8b8b-5a6648fedc08
5
private int jjMoveStringLiteralDfa4_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); return 4; } switch(curChar) { case 101: ...
93b10ea1-df3f-442b-8c4f-d1550f33bfb6
9
private int evalStateSide(State s, String side) { int score = 0; if(side != "red" && side !="blue") return -1; String opp = (side == "red")?"blue":"red"; MyList Pawns = s.ownees(side); for(Object pawn : Pawns){ int thisScore = secureScore; for(Object neighbour : ((Hexpos)pawn).neighbours()){ Hexp...
2104d128-7675-479a-99d4-74c9756ed37f
7
@Override public boolean start(Player player) { if (player == null || node == null) { return false; } if ((ingredients == null && rawIngredient == null) || otherItem == null) { return false; } if (ingredients != null) { this.slot = ingredients.getSlot(otherItem.getId()); if (player.getSkills().ge...
0901e16d-590c-4ca4-9573-bc2c98b5eab2
9
void hitmiss(int xe, int ye, int [][] pixel2, int [][]pixel, int [] lut){ int x, y; // considers the pixels outside image to be 0 (not set) for (x=1; x<xe-1; x++) { for (y=1; y<ye-1; y++) { pixel[x][y]+= lut[( pixel2[x-1][y-1] + pixel2[x ][y-1] * 2 + pixel2[x+1][y-1] * 4 + pixel2[x-1][y ]...
40d4bba5-b798-4931-a8fd-cb5a5b9921c9
3
private void showOrderDetails(Order order) { String status = ""; if(order.isStatus()) status = "Dispatched"; else status = "Pending"; String orderDetailsMessage = "ORDER DATE : " + order.getDateString()+ "\nORDER STATUS : " + status; orderDetailsMessage += "\nItems in this order: "; for (StockItem sto...
fc3b2ab9-bb04-4488-9809-1ccb075b86dc
7
public void trackDiscovery(){ //x and y coordinates of player int playerX = logicHandler.getPlayerPosition()[0]; int playerY = logicHandler.getPlayerPosition()[1]; //records the current x,y, position discoveredArea[playerX][playerY] = 1; //records all areas 2 spaces around the current position for(int i = -2;...
35add928-602b-47a7-9a7c-ab93f6b7b9a0
5
public final void method43(AbstractToolkit var_ha, int i) { anInt9995++; if (i != -14218) method2404(null, -47, 49); Object object = null; r var_r; if (aR9976 == null && aBoolean9988) { Class2 class2 = method2401(var_ha, 262144, true, 22); var_r = class2 == null ? null : ((Class2) class2).aR118; } ...
6f54c080-0ba9-4e69-b499-166d0ab62ee7
2
CommandDictionary() { dictCodeToClass = new Hashtable<Integer, Class<? extends Command>>(); dictClassToCode = new Hashtable<Class<? extends Command>,Integer>(); this.init(); }
594b1111-9fc2-4611-957d-388166253f1e
0
public void setTelephone(String telephone) { this.telephone = telephone; }
8e61b480-8899-4d8d-89f5-5bee205b9ae0
4
@Override public boolean[][] generateMaze() { List<Point> list = new ArrayList<Point>(); int last = 0; this.maze[1][1] = false; last = this.addNeighbours(new Point(1,1), list); while(!list.isEmpty()){ int curi = this.rnd.nextInt() % last; ...
eee8a32c-2c9c-4f6e-b715-11bf721466ce
1
@Override public Object pop() throws EmptyStackException { if (this.empty()) { throw new EmptyStackException(); } Object pop = this.listStack.get(this.listStack.size() - 1); this.listStack.remove(this.listStack.size() - 1); return pop; }
01ee0928-0e2b-4c1a-b8f2-c52d45cf4ffd
1
public Executor(ClassPool classPool, ConstPool constPool) { this.constPool = constPool; this.classPool = classPool; try { STRING_TYPE = getType("java.lang.String"); CLASS_TYPE = getType("java.lang.Class"); THROWABLE_TYPE = getType("java.lang.Throwable"); ...
95a8ceb9-12af-4dec-a8b8-ced2abbb3d9b
3
@POST @Consumes({"application/json"}) @Produces({"application/json"}) public List<PeopleAround> create(MacAdr entity) { List<String> macAdrList = entity.getOtherMacAdr(); List<PeopleAround> profileList = new ArrayList(); for(String macAdrString : macAdrList){ query = em.c...
8709c725-89d5-4d4b-84ec-66e3bd7870b4
1
public void testParseDateTime_simple() { DateTime expect = null; expect = new DateTime(2004, 6, 9, 11, 20, 30, 0, LONDON); assertEquals(expect, g.parseDateTime("2004-06-09T10:20:30Z")); try { g.parseDateTime("ABC"); fail(); } catch (IllegalArgumen...
5c221edb-8006-463a-a7fe-bdfb6c4edfa3
0
@Test public void testGetMarkers() { System.out.println("getMarkers"); boolean colour = false; Cell instance = new Cell(0,0); boolean[] expResult = new boolean[6]; boolean[] result = instance.getMarkers(colour); assertEquals(expResult[0], result[0]); assertEqu...
faa82798-9154-4ad3-baa9-a406567420c3
2
@Override void load(DataInput datainput, int depth) { if (depth > 512) { throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); } else { this.VALUES.clear(); byte b; while ((b = asByte(datainput)) != 0) { ...
8a4e9763-c0d6-4506-9494-2085264a9621
2
public static Object readField(Object bean, String fieldName) { Field field = getField(bean.getClass(), fieldName); // Ensure we can access even if field or class is not public field.setAccessible(true); Throwable cause = null; try { return field.get(bea...
931c98d5-9aa3-43ce-827c-ecaca53fcef6
8
private void addNavigationMenu() { String[] buttonLabels = {"Intro", "Pixels", "Colors", "Data in Images", "False Color", "Check Color", "About"}; int width = mainDisplay.getWidth(); int buttonWidth = 120; int buttonHeight = 40; int padding = (width-(buttonLabels.length*buttonWidth))/(buttonLabels.length+1...
80946d67-30b9-45e8-a63a-bd197f324e6e
6
@EventHandler public void PigZombieWaterBreathing(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPigZombieConfig().getDouble("P...
0b79af71-8d75-4b66-af34-262cca344c21
0
private void resetRound() { pendingPackage = null; remaining = activeConnections; }
582f8b3a-5972-47d5-9515-6b6d6b364a04
2
public static String getElementType(String arrayType) { char c = arrayType.charAt(1); if (c == 'L') return arrayType.substring(2, arrayType.length() - 1).replace('/', '.'); else if (c == '[') return arrayType.substring(1); ...
cdec552f-3b9d-4b81-96e9-6aaf02e43ba3
3
public final boolean insert(final K key, V value) { final HashCounter hc = new HashCounter(key); Entry<K,V> e = new Entry<K,V>(key,value,hc.mli); final int index = off[hc.mli].indexOf(e); if (index!=-1) { e = off[hc.mli].get(index); e.setV(value); return false; } for (Integer i : hc.hashs) { off...
d25b81f2-4565-4988-889c-270ca5556d42
3
public int getStrategyAsInt() { if (strategy.equals(SimConst.MEAN)) { return ParameterData.MEAN; } else if (strategy.equals(SimConst.INDIVIDUAL)) { return ParameterData.INDIVIDUAL; } else if (strategy.equals(SimConst.BINARY)) { return ParameterData.BINARY; ...
ce35ed83-e600-4ba6-b546-8c4f761451dd
7
Class235(AbstractToolkit var_ha, ObjectDefinition class51, int i, int i_15_, int i_16_, int i_17_, Class318_Sub1 class318_sub1, boolean bool, int i_18_) { anInt3055 = 0; aBoolean3064 = false; anInt3053 = -1; aBoolean3069 = false; anInt3056 = -1; anInt3073 = -1; try { ((Class235) this).anInt3079 = i; ...
9d9b81e8-8704-4318-9bbe-5a177e4aa6e9
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just infected the enemy!"); return random.nextInt((int) agility) * 3; } return 0; }
43406cc0-27ed-4e1f-a537-cb3dacd9401a
2
public void disable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { configuration.set("opt-out"...
333a30f2-53b4-4d50-8a99-ad23aac3771d
3
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.pickaxe) { if (player.payStamina(4 - tool.level)) { hurt(level, xt, yt, random.nextInt(10) + (tool.level) * 5 + 10);...
ac91b22d-53c7-4d97-85bc-df2c2c6b5dae
6
private List<Hit> allHits() { List<Hit> all = new ArrayList<>(); for (Ball b1 : balls) { for (Ball b2 : balls) { if (b1.id < b2.id) { double whenHit = new Thin_k(b1, b2).whenHit(); if (whenHit >= 0) { all.add(new Hit.HitB(b1, b2, whenHit)); } } } if (b1.getMotion().dx != 0) { ...
435b9bc9-cbea-4930-a1e7-28f125425cdc
4
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed loginLabel.setText("Loggin in..."); if (uNameField.getText().equals("")) { JOptionPane.showMessageDialog(this, "Please enter a username.", ...
cb2033c4-4fab-4444-91d1-f69ec28f89c9
5
public void parseFile(MidLayerControl mlc) throws Exception { String inputFile = mlc.getInputFileName(); this.codeTree = mlc.getCodeTree(); getGlobalSymTab(); this.symbolTable = mlc.getSymbolTable(currentNestingLevel++, symTabStack); Scanner scanPrint = new Scanner(inputFile); sc...
1cc9dbd4-61d6-42f3-981d-acd66f26b52a
9
public static void main() throws Exception{ BufferedReader br = new BufferedReader(new FileReader("Staves.input")); String s = br.readLine(); int n = s.length(); int[] sections = new int[n]; for(int i=0; i<n; i++){ sections[i] = Integer.parseInt(s.charAt(i)+""); ...
788fd864-cede-4a4a-969f-69cff045c6b8
1
@Override public int play(){ gui.requestDiscard(this); int card = game.deck.draw(guiDiscard); gui.requestSlot(this); return guiSlot == -1 ? card : rack.swap(card, guiSlot, guiDiscard); }
7467ae4f-875b-4de2-89ee-3aee1e3cac79
2
public Server(boolean useEvent) { /** * Listener port 9090 and setup handler input calls */ conn = new RemoteServerConnection(9090, new Helper()); //conn.setIdleTimeout(idleTimeout); /** * Optional events */ if (useEvent) { conn.addServerStartListener(new ServerStartList...
fe69d291-b14c-4ecf-beba-b51e077463b2
0
public Tlv[] getOtherTlvArray() { return OtherTlvArray; }
b5b4dbf8-43f2-4821-8d78-cf82c27c3818
6
public Map<Integer, GraphNode> clone(GraphNode source, Map<Integer, GraphNode> cloned) { // try DFS form source if(source == null) { return null; } // if cloned graph does not contain the node if(!cloned.containsKey(new Integer(source.label))) { // create b...
f27cf9af-f9d3-49b5-9ed1-0583222f0c3e
7
public int updateUser(String imie, String nazwisko,String pesel,String miasto,String ulica,String nr_dom,String tel,String kod) { try { String p =""; String UpdateQuery="UPDATE pacjenci SET"; String InsertQuery1="INSERT INTO miasto VALUES"; String InsertQuery2...
11e4d183-c546-48dc-9584-97ef2745d166
9
public void takeTurn(){ if( !alive ){ } else if( playerJustEnteredLair ){ //Prepare to breath fire preparingToBreatheFire = true; playerJustEnteredLair = false; System.out.println("The Jabberwocky's eyes of flame light up as it senses you.\n" + "It backs up a bit and begins to inhale deeply.\nSm...
23dad3ac-0848-41a4-b65b-83c885c5a668
9
private void remove(int index){ if(size==0) return; if (index < 0 || index >= size) throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size); if(index==0){//Start head=head.getNext(); }else{ Node<T> current = head; for(int i=-1;i<index && index<this.size && index>=0;i++)...
4f29e88d-7d1b-4ae7-9434-b8d143c1820c
2
public Bag getDiscsWithFade(int fade) { LOGGER.log(Level.INFO, "Getting discs with fade " + fade); Bag discBag = new Bag(); for (int i = 0; i < discs.size(); i++) { if (discs.get(i).getFade() == fade) { discBag.addDisc(discs.get(i)); } } ...
78ba2c45-b605-4f50-92d4-91f240cfa87d
5
@Override public String execute() throws Exception { System.out.println("login action:check u_account " + account); user = this.service.login(account, password); System.out.println("this.account " + account); System.out.println("this.password " + password); //Invalid Account if(user == null) { Sys...
f92300b0-5455-4575-abd0-272c6ce25864
9
public void tick(int tick) { //System.out.println("ant's destination: " + destination.x + " " + destination.y); if (state == StateEnum.Idle) { } else if (state == StateEnum.Walking) { if (isDestinationReached()) { parent.mPhysics.setVelocity(0); state = StateEnum.Idle; } Coord c...
a1aaca72-260e-4bd6-aff5-081e1d346203
1
public void addBlockInitializer(int index, StructuredBlock initializer) { if (blockInitializers[index] == null) blockInitializers[index] = initializer; else blockInitializers[index].appendBlock(initializer); }
1c3a5649-7af1-4776-a4dd-35575f3516ef
2
public List<Question> findAll() { List<Question> questions = new ArrayList<Question>(); try { Statement statement = base.createStatement(); ResultSet resultSet = statement .executeQuery("SELECT * FROM question"); resultSet.beforeFirst(); while (resultSet.next()) { questions.add(new Questi...
d435921a-a326-456a-8f07-9e40d90941c2
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ObjectWithMap other = (ObjectWithMap) obj; if (this.map != other.map && (this.map == null || !this.map.eq...
4159250a-63f9-4f8e-aebe-15baa14eafcd
9
public void setMacrosVars(String str, Macros m){ if((!str.contains("[") || (!str.contains("]")))){ throw new RuntimeException("это не валидная область аргументов!"); } String argsArea = str.substring(str.indexOf("[")+1, str.indexOf("]")).trim(); List<String> lexems = Parsing...
ba314dea-1edb-4295-8af8-4b85523da06a
9
public static QuestionFraction decode(String str) throws DecodeException { QuestionFraction res = null; if (str.substring(0,17).compareTo("#QuestionFraction") == 0) { res = new QuestionFraction(); int i = 17; if (str.charAt(i) == '<') { while (str.charAt(i) != '>') { i++; } ArrayList<Integ...
9e80edd5-81b4-4ae3-bb65-002e012ab636
2
private static double round2(double num) { if (num>=1000000){ double result = (double)num / 10000; result = Math.round(result); result = result / 100; return result; } else if (num>=1000){ double result = (double)num / 10; result = Math.round(result); result = result / 100; return result; ...
15ffe48c-1284-43ff-97c5-165bec27c8ad
7
@Override public String toString() { StringBuilder buf = new StringBuilder(); if (tag != null) { buf.append(" tag:"+tag); } if (id != null) { buf.append(" id:"+id); } if (ref != null) { buf.append(" ref:"+ref); } if (parentTagName != null) { ...
64bfd6c9-3fa1-448b-b379-c3e17afa73b0
8
public double executaMandril() { double menorTempo= getTempoUniversal()+1; ordenaPeloTempoDeSaidaM(maquinaMandril); for(int i=maquinaMandril.size()-1; i>=0 && maquinaMandril.size()>0 && verificaMaquinaMandril(maquinaMandril) ; i--) { if(maquinaMandril.get(i).getStatus()==1) { if(maquinaMa...
555ea735-1912-4d6b-b26c-b94484287d34
3
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { update_info(bowl, bowlId, round, canPick, musTake); print_input(); if (musTake) return true; if (!canPick) return false; /* ...
bc852962-a8ea-4e55-8f40-dc745f33f77e
8
private void placeIdentityDiscNearPlayer() { for (Player p : grid.getAllPlayersOnGrid()) { boolean placed = false; Position pos = grid.getElementPosition(p); int minX = (pos.xCoordinate > 1) ? pos.xCoordinate - 4 : 0; int maxX = (grid.width - pos.xCoordinate > 1) ? pos.xCoordinate + 4 : grid.width; in...
9eb35f4b-028f-4e90-82a7-5938de64185a
2
public boolean verifyUser(String login, String password){ boolean userExist=false; try { PreparedStatement statement = base.prepareStatement("SELECT * FROM player " + "WHERE pseudo=? AND password=?"); statement.setString(1, login); statement.setString(2, password); statement.executeQuery();...
d6f14615-6a6e-4160-867a-55f52a049fb2
9
public void focusLost(FocusEvent e) { if(e.getSource() == txtName) { // this is where we have lost focus, so now we need to populate the data // See if we can find the hop Hop temp = new Hop(); temp.setName(txtName.getText()); int result = db.find(temp); Debug.print("Searching for " + txtName.getTex...
f58571fe-87ac-4cce-93eb-5ad20894d315
8
private List<List<STEP>> solutions(GAME game, Map<GAME, List<List<STEP>>> foundSolutions, String level) { if (foundSolutions.containsKey(game)) { return foundSolutions.get(game); } if (game.isWin()) { return newArrayList(); } List<List<...
1e10a4fe-3816-4d37-bd39-c4daffd8e35d
8
public Command planNextMove(Info info) { this.distances.clear(); this.x = (this.y = this.rotation = -1); this.data = info; this.x = info.getX(); this.y = info.getY(); this.rotation = info.getDirection(); int targetInfo = getTarget(); int target = targetInfo; int focus = tar...
06b05775-016c-4055-acbe-e0401f4cb740
3
public void init(FilterConfig fConfig) throws ServletException { // TODO Auto-generated method stub try { //URL textURL = getClass().getResource("AccessList.xml"); //InputStream is = textURL.openStream(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder...
d758dff8-5751-4e8e-990a-0b43c50eff81
2
public ZMsg duplicate() { if (frames != null) { ZMsg msg = new ZMsg (); for (ZFrame f : frames) msg.add(f.duplicate()); return msg; } else return null; }
a3f9c8ad-189d-4866-8d24-9bd3afbac7f6
0
public void setFooArray(T[] fooArray) { this.fooArray = fooArray; }
8533f195-0a82-4432-af4f-76d0eca5b83f
1
@Test public void testRunA_star() { try { double astarTime = (double) bmg.runA_Star(); assertTrue(bmg.getA_StarRoutedArray() != null); } catch (Exception ex) { System.out.println(ex); assertTrue(false); } }
41b58525-cc8a-4b05-9703-86b87dfcf786
0
public char GetDirection() { return this.direction; }
9a14c9c8-ef8e-48a6-ae2e-44ef0a603cd2
5
public static void distanceFromSurroundingPointsToVector(Computation comp, List<Measurement> measurements, int threshold) { double sum1 = 0.0; int count1 = 0; double sum2 = 0.0; int count2 = 0; HashSet<Integer> indices = Generate.randomInts(threshold, measurements.size(), null); for(int i : indices) { ...
9ae7b9ac-4b16-4a17-87f3-a3ac08060f19
7
@Override public void setSizeOfField(int size) { if (size < sizeOfField) { int diference = sizeOfField - size; LinkedList<Integer> keys = new LinkedList<Integer>(); for (int i = 0; i < diference; i++) { keys.add(i); } for (Integer key : keys) { this.getCardInFieldGame().remove(key); } s...
088619c2-c7af-4944-8538-9f8d149af7ad
5
@Test public void testInsertMultipleElements() throws IOException { // Test adding a large number of elements, so that block splitting will // need to take place. int blockSize = 100; int keySize = 4; int numIndexPairs = 300; AbstractBlockBasedIndex<?> index = createIndex(tempFolder, keySize, ...
ec754146-b653-40be-8dea-c1b949c4f05e
0
public List findByContent(Object content) { return findByProperty(CONTENT, content); }
7e4ac489-81da-4b0a-b8c7-ecbc9e4fed45
9
public static void matrixm(int x[][], int y[][]) { int z[][] = new int[x.length][x[0].length]; if (x[0].length != y.length) { System.out.println("Sorry Matrices Can't Be Multiplied"); } for (int i = 0; i < x.length; i++) { System.out.print("\n"); for (int j = 0; j < x[i].length; j++) { System.out.p...
c6a82c41-7d59-488b-a4fd-7e16c7071962
2
protected void fireTableChanged(TableViewModelEvent pEvent) { // Guaranteed to return a non-null array Object[] listeners = mListenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.lengt...
0b7573cb-8885-4aaa-8b22-9b2ed145b672
0
public String serialize(TreeNode root) { StringBuilder sb=new StringBuilder(); preTraversal(root, sb); return sb.toString(); }
03e966cf-144e-4919-b890-3f86cd2d80fd
3
public void draw(Graphics g1) { Graphics2D g = (Graphics2D) g1; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setStroke(new BasicStroke(2.0f)); int width = Game.getDimensions().width; int height = Game.getDimensions().height; int x = width - 460; int y = 65; ...
10ec0430-3926-4e97-a5ab-336bab4b714b
7
public static Vector<Move> ObtainForcedMovesForBlack(int r, int c, Board board) { Vector<Move> furtherCaptures = new Vector<Move>(); if (board.cell[r][c].equals(CellEntry.black) || board.cell[r][c].equals(CellEntry.blackKing)) { if (Forwa...
213440c9-d373-4a55-8990-a885ca64f92c
5
public XMLTreePanel() { XMLTreeCellRenderer renderer = new XMLTreeCellRenderer(); setLayout(new BorderLayout()); model = new XMLTreeModel(); tree = new JTree(); tree.setModel(model); tree.setShowsRootHandles(true); tree.setEditable(false); tree.setCellRen...
d9f72f33-c0c7-46a8-9b80-dbc5cb19321c
8
private void algo() { // Step 1 - // initialize the zero flow (if none is given) // mark Quelle init(); // Step 2 // save the current to be inspected Vertice into vi. // end loop, if there are no more. for (Long vi = getMarkedUninspected(); vi != -1L; vi = getMarkedUninspected()) { // filter all e...
31c83a8a-e1a7-4144-a1d3-863f379ab2f3
0
@Override public int getID() { // TODO Auto-generated method stub return 0; }
ca7c129b-241b-47ce-9542-9120bf780bfc
4
public void solve() { Scanner in = new Scanner(System.in); Prime prime = new Prime(100000); int[] a = prime.getPrimeArray(); int test = in.nextInt(); out: for (int t = 0; t < test; t++) { int n = in.nextInt(); for (int i = 0; i < a.length; i++) { if (n % a[i] == 0) { ...
d60d2388-a274-4232-91aa-90d781c86093
4
public Router() { //read the configuration file cfg = new ConfigFile(); try { if(((String)cfg.GetConfig("GENERAL", "Seed")).compareToIgnoreCase("Auto") == 0) { //save the current time seed SEED = System.current...
382e5faa-a68d-48e0-a452-5869ecbc4f18
0
public void setEncoder(Encoder encoder) { this.encoder = encoder; }
57962d06-44f0-4da2-8ec3-d24ca356f1bd
5
public void store(String filename, RoutingTable routingTable) throws FileNotFoundException { FileOutputStream outStream = null; try { outStream = new FileOutputStream(filename); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); XMLEventWriter eventWrit...
78998962-acda-4eab-a28b-a24adb88c314
2
public static void setAccounting(Accounting accounting) { setMortgages(accounting==null?null:accounting.getMortgages()); setAccounts(accounting==null?null:accounting.getAccounts()); }
ab4f14d3-543d-4623-a280-e6e255b5c4c7
2
public BudgetBreakdown calculateTotalAllBudgetItems(BudgetBreakdown breakdown) { BigDecimal totalAllItems = new BigDecimal(BigInteger.ZERO); if(breakdown.getTotalCoreBudget() != null && breakdown.getTotalSocialBudget() != null) { totalAllItems = breakdown.getTotalCoreBudget().add(breakdow...
2705a72a-b317-4c1c-8b90-34d6b191ebc1
5
private String getVar(String key) { if(this.configFile.exists()) try { for(String string : this.currentConfig) if(string.startsWith(key + ":")) { if(key.equals(Configuration.APIKEY)) Utils.logger.log(Level.INFO, "Found key " + key); else Utils.logger.log(Level.INFO, "Fou...
8bea0eb8-ad8e-4533-8e53-5da8b19c6076
3
public boolean addFile(String dirPath, int libraryFK){ //Creating paths String archiveFileName = new File(dirPath).getName() + ".zip"; String archiveDirectoryPath = Resource.getString("path.temp.zip") + libraryFK + "/"; new File(archiveDirectoryPath).mkdirs(); String zipFileArchivePath = archiveDirector...
dcc93300-3dcf-4499-b606-55f22aefdce8
0
public Account getAccount() { return this.account; }
889668f7-165d-40a0-a747-549c76ea2d2f
9
private boolean readOneFile(File logFile, RecordProcessor<T> processor, int logNameIndex) { FileInputStream in = null; try { if (!logFile.exists()) return false; RandomAccessFile randomAccessFile = new RandomAccessFile(logFile, "r"); in = new FileInputStream(randomAcc...
cda205bc-1e99-4e68-b453-bb756904719a
1
public void minus() throws SyntaxError { ArithmeticElement previous = (ArithmeticElement) mapping.lastElement(); if (isOperational(previous, true)) { throw new SyntaxError("Expected a nonoperational token"); } mapping.add(ArithmeticElement.MINUS); values.add(null); }
12ee3e79-a468-4136-8a16-23234c698329
8
@Override public void setupTest(JavaSamplerContext context) { super.setupTest(context); if (table == null) { String tableName = context.getParameter("tableName"); byte[] tableNamebyte = tableName.getBytes(); boolean autoFlush = Boolean.valueOf(context.getParameter("autoFlush")); long writeBufferSize =...