method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
441aeb30-6995-4dea-8352-b3ecb5f194e3
1
@Test public void testCreatingContactWithNullPhoneNumberShouldFail() { try { new Contact("Bart", "Simpson", (PhoneNumber[]) null); fail("Was expecting an Exception when no phone number is provided."); } catch (IllegalArgumentException iae) { Assert.assertEquals("Please provide a value for Phone Number as ...
e6957270-f3a4-48d8-a0d1-c5363c5fe68d
7
public K advise( Set<K> currentSet, long position ) { K advice = null; // current candidate to return long max = Long.MIN_VALUE; // advice's position - max encountered for ( K inMem : currentSet ) { if ( evicted.contains( inMem ) ) { continue; ...
8de65dc9-89e8-4401-b408-00c8f63e94b6
2
public void draw(GOut g) { g.image(bg, Coord.z); if(!res.loading) { Tex t = res.layer(Resource.imgc).tex(); Tooltip tt = res.layer(Resource.tooltip); // APX if (tt != null) toolTip = tt.t; //Kerri Coord dc = new Coord(6, (bg.sz().y / 2) - (t.sz().y / 2)); ...
a6b137db-6db7-403b-a068-bbce97c1dac5
9
public static void localMinPointsXOR(String filename, int reps, int epochsPerRep, double maxError, ANN ann, double[][] inputs, double[][] outputs) throws IOException { double[][] pinputs = Arrays.copyOf(inputs, inputs.length); double[][] poutputs = Arrays.copyOf(outputs, outputs.length); File file = new File(...
a9ac5ec7-575b-48b5-98c7-236f1dffa854
0
public synchronized int getSize() {return queue.size();}
2b7f4c91-f941-4252-bf91-a6f1d0af9f6d
1
public Calendar getDate(String date) { Calendar cal = Calendar.getInstance(); Date newDate = null; Calendar calHolder = Calendar.getInstance(); try { newDate = df.parse(date); cal.setTime(df.parse(date)); calHolder.setTime(newDate); } catch (ParseException e) { System.out .println("That was ...
067e283b-b106-4ba8-8e55-c58e3d719659
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]) { if (cmd.getName().equalsIgnoreCase("fireworkmanager")) { if (args.length == 0) { // 引数ゼロはヘルプ表示 args = new String[] { "help" }; } ...
5a774404-abfa-43f5-bb4b-c11f90ee3cab
1
private int dot(int[] a, int[] b) { assert(a.length == b.length); int sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i] * b[i]; } return sum; }
7836c0e3-02d5-4def-9c37-bec3e48c6b50
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
c31942c5-262b-4ad6-96a7-f7285b85d8a2
6
private int[] getRange(QueryConfig config) { int[] ranges = new int[2]; //Implementation int vec_index = index_map.get(config.getQuerystring()); int i = vec_index; int dim = config.dim; //get low bound index in vector while(i > 0 && DataProcessor.getSiftDim(keylist.elementAt(i)) == dim && Dat...
22014d97-bdba-4813-aabb-ff67910ea808
6
@EventHandler(ignoreCancelled = true) public void handle(PlayerMoveEvent event) { Player player = event.getPlayer(); GameSession session = plugin.getGameManager().getGameSessionOfPlayer( player); if (session == null) { return; } if ((!(session.isStarted())) && session.isPlayer(player) && EventUtil...
d4188c72-184a-4f9f-8561-d530a51a8e26
1
private OwnerDaoEntity selectAddedOwner() throws DaoException { final TransactionManagerImpl transactionManager = new TransactionManagerImpl(); final String selectOwnerSql = "SELECT first_name, last_name, patronymic, DOB, passport_number, identification_number, address FROM CAR_OWNERS ORDER BY id DESC L...
fb299cf5-0e1a-42d6-a83d-2f8e4187d7c4
4
private void handleStart() { System.out.println("Start"); int p1Index = -1; int p2Index = -1; for (int i = 0; i < fighters.length; i++) { if (view.getSelection()[i] == 1) { p1Index = i; } if (view.getSelection()[i] == 2) { p2Index = i; } } setVisible(false); AppGameContainer app; tr...
c23608e4-92a1-4506-9a36-079297749ebf
9
public static void formatResults(ArrayList<TetrisAgent[]> generations, String file) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file, false)); } catch(IOException ex){ex.printStackTrace();} int gens = generations.size(); //header for(int i = 0;...
bcc3aa11-7ca1-4569-acd6-55fce23d3e5c
6
public String cryptanalyseCle(IMessage clair, IMessage crypte) { long d=new Date().getTime(); int j=0; boolean trouve=false; while(j<clair.taille() && !trouve) { if((char)(65+(clair.getChar(j)+13-65)%26)!=crypte.getChar(j) && clair.getChar(j)!=crypte.getChar(j) && (char)(97+(clair.getChar(j)+13-97)%26)!=cryp...
4af910f6-99e9-4da9-831e-271c98af6009
7
public static ArrayList<XMLFile> imdbPointQueryText(String ... text) { try { dbs.setup(dbName); } catch (DatabaseException e){ System.err.println("Caught Exception creating datatbase :"); e.printStackTrace(); } ArrayList<XMLFile> foundEntries = new ArrayList<X...
1b5ba5f7-1411-4874-913e-5d700ba9200b
7
public void focusLost(FocusEvent e) { try { _txtBrickCount.commitEdit(); _txtHitsToRemoveBrick.commitEdit(); _txtBallsPerLevel.commitEdit(); } catch(ParseException ex) { } int brickCountVal = ((Number)_txtBrickCount.getValue()).int...
06cb73e4-77fe-470e-bea2-470a1be0b483
7
public int minDistance(String word1, String word2) { if (word1.isEmpty()) { return word2.length(); } if (word2.isEmpty()) { return word1.length(); } int[][] dp = new int[word1.length() + 1][word2.length() + 1]; for (int row = ...
22d9d59f-77a3-40c0-8c47-bb3770ad4513
0
public boolean getAcceptByHalting(){ return turingAcceptByHalting; }
0a85ff30-307a-444c-9b0c-15095339c9e7
8
public StringSelection getStringSelection() { StringSelection result; int[] indices; int i; int n; StringBuffer tmp; result = null; // nothing selected? -> all if (getSelectedRow() == -1) { // re...
a87e42b3-5547-4ef7-a15a-d7e2a8030c83
5
public boolean write(aos.apib.OutStream out, aos.apib.Base o) { Churn v = (Churn)o; int i = -1; while ((i = out.nextField(i, this)) >= 0) { switch (i) { case 0: out.putInt(v.peerID, i, __def.peerID, this); break; case 3: out.writeBaseClasses(o, this); break;...
f1b5fb50-4a7f-4416-963c-4d4e24b445df
6
private int[] getSize(Scanner scanner){ int[] size = new int[2]; String regex = "[0-9]+"; System.out.println("Anna kartan mitat: "); System.out.println("Korkeus: "); String measure = scanner.nextLine(); while(!measure.matches(regex)){ System.out.println("Korke...
8f61e5a6-29bb-45d5-99b8-4ec77cc0c5d8
0
public Park getPark(){ return this.park; }
a5cef83b-c96f-47a1-8915-b72c9321c3bb
9
@Override public void runApplication(String commandString) { BufferedReader inputInfoStream = null; BufferedReader inputErrorsStream = null; try { Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec(commandString); inputInfoStream = new BufferedReader(new InputStreamReader( proce...
334225e6-4037-4806-8cbd-e4e45e586748
6
public static void display(int[][] puzzle) { for (int count = 0; count < 9; count++) { for (int innerCount = 0; innerCount < 9; innerCount++) { System.out.print(puzzle[count][innerCount] + " "); if (innerCount == 2 || innerCount == 5) { System.out.print(" | "); } } System.out.println(); i...
62c318b4-7085-453e-89bd-0ae060c03eb0
7
@Override public String toString() { StringBuilder buffer = new StringBuilder(); updateAlt(); if (mAltCount > 0 && mSides > 0) { buffer.append(mAltCount); buffer.append('d'); if (mSides != ASSUMED_SIDE_COUNT) { buffer.append(mSides); } } if (mAltModifier > 0) { buffer.append('+'); buffe...
5ad83fcf-941c-4902-bd6f-14e057333609
6
private void removeFoundNode(TreeNode removingNode) { TreeNode parentNode; if (removingNode.left == null || removingNode.right == null) { parentNode = removingNode; } else { parentNode = successor(removingNode); removingNode.key = parentNode.key; } TreeNode childNode; if (parentNode.left != null)...
5f8f5eb8-0f42-46ad-a5a8-a9f44fe4aaba
3
public void tick() { timer++; pos.add(velocity); velocity.mul(friction, friction); if (timer >= 10) { List<Player> players = world.getPlayers(12, pos.toVector2i()); if (players.size() > 0) { Player player = players.get(random.nextInt(players.size()...
1be296b9-2c0e-4076-b577-e9163aeb6806
7
public void mousePressed(MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && color != null) { controller.setCurColor(color); repaint(); } if ((e.getModifiers() & InputEvent.BUTTON2_MASK) != 0 && color != null) { color = null; repaint(); } if ((e.getModifiers() & Input...
817907d5-3dea-4af0-8bff-95e4eb74d460
9
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { Raster source = sources[0]; Rectangle srcRect = mapDestRect(destRect, 0); int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest); ...
3208f32e-2478-47c8-9352-80cdf06be065
5
private void images() { int i = 0; ImageIcon image; if (dir.isDirectory()) { // make sure it's a directory for (final File f : dir.listFiles(IMAGE_FILTER)) { try { File abc = GameFrame.convert(f, GameFrame.height/v, GameFrame.height/v); Image pic = ...
7e81dc4c-5891-4f8c-82cf-589277523bc2
6
private String getClosestRobotName() { double closestDistance = Double.MAX_VALUE; String closestRobot = ""; disabledRobotExists = false; HashMap<String, ArrayList<RobotIntel>> intel = Observer.getLog(); for (String key : intel.keySet()) { // change target to any disa...
d2f7858a-95d1-40c4-878e-a3f113085aaa
9
public static void main(String[] args) throws Exception { if (min(5, 8, 6) != 5) { System.out.println("1) Неправильно для a"); //вывод=5 } if (min(5, 6, 8) != 5) { System.out.println("2) Неправильно для a"); //вывод=5 } if (min(-3, -5, -2) != -5) { ...
70ba3568-5ce4-428d-9df9-48a1f81df9ed
9
private void drawJuliaPolarBruteForce(int image_size) { double size = fractal.getSize(); double xcenter = fractal.getXCenter(); double ycenter = fractal.getYCenter(); double start; double center = Math.log(size); int pixel_percent = image_size * image_size / 100; ...
a3b052c8-6362-4bcb-a4f2-2cd144e52665
3
private static void readMagicItemsFromFileToArray(String fileName, ListItem[] items) { File myFile = new File(fileName); try { int itemCount = 0; Scanner input = new Scanner(myFile); while (input.hasNext() && itemCount < items.length) { // Read a line from the file. String item...
a69c5e17-5fe6-4fd0-9e90-23d2a439bcfb
0
public void setNavigation(JPanel navigation) { this.navigation = navigation; }
d57b989e-c609-4ef2-83a6-21df3cae0906
5
public boolean initialize() { CommPortIdentifier portId = null; Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); //First, Find an instance of serial port as set in PORT_NAMES. while (portEnum.hasMoreElements()) { CommPortIdentifier currPortId = (Co...
b9584011-3bda-4706-93f8-b31beccf8eb1
8
private boolean ld8b_diag() { /*************************************************************************************************************** * Test LDRR_8b Tests 0x00 <- 0xFF, 0xFF <- 0x00 for not changing flags * and loading good values */ boolean status = true; cpu.regs[cpu.A] = 0; cpu.regs[cpu.B]...
5a5f5f42-cf4f-470d-bc90-e61fd7210737
9
public Staff getStaff(int index) { List<Staff> staves = new ArrayList<Staff>(); for (int i = 0; i < getStaffCount(); i++) staves.add(new Staff()); for (Event event:this) { if (event instanceof VerticalEvent) { for (Staff staff:staves) staff.add(event); } else if (event instanceof Staff...
f4ae84a2-5415-454e-8be8-289c6bded8b2
3
@Test public void testGetAllTransactionRecordsBetweenDates() { CardPaymentRequest paymentRequest = getCreditCardPaymentRequest( getRandomOrderId("TEST_QUERY"), "12.34"); try { PaymentResponse payment = beanstream.payments().makePayment(paymentRequest); Assert.assertNotNul...
d5ebc22b-333f-4d79-bb25-f452b7943293
8
public Frame6() { try{ Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL,USER, PASS); statement = conn.createStatement(); }catch(SQLException se){ se.printStackTrace(); }catch(Exception e){ e.printStackTrace(); } setTitle("Blok B, 1-23"); setDefaultCloseOperation(JFram...
e3ed8889-768c-4fec-a6e5-28bd1d345028
4
private String getNumber(int next) throws IOException { StringBuilder str = new StringBuilder(); boolean hasDecimalPlace = false; while (isDigit(next) || (!hasDecimalPlace && next == '.')) { str.append((char) next); if (next == '.') { hasDecimalPlace = true; } next = getChar(); } next = readE...
bfa22dcb-f58b-4a48-ba8e-84a7a4e71685
2
public Expression negate() { if (!allowsNaN || getOperatorIndex() <= NOTEQUALS_OP) { setOperatorIndex(getOperatorIndex() ^ 1); return this; } return super.negate(); }
8a3515de-f245-49af-89ad-168094a4e8f4
0
public static void main(String[] args) { Map<Integer, String> linkedHashMap = new LinkedHashMap<Integer, String>(); linkedHashMap.put(7, "seven"); linkedHashMap.put(1, "one"); linkedHashMap.put(2, "two"); linkedHashMap.put(10, "ten"); linkedHashMap.put(3, "three"); ...
9f967964-7077-4552-84a9-44671d1bf83f
0
public static double fp_bf_e(final int n, final int m, final int k) { return Math.pow(Math.pow(1-Math.E, -(n*k)/(double)m),k); }
3f44d35c-5978-4dbc-b168-8a997f1984f2
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...
31cee81c-aa0d-42bf-9a6d-a3cfbdbb56c0
2
@Override public void tick() { minions = Game.getInstance().getMobs(); for (GenericMinion gm : minions) { if (pos.distance(gm.getPos()) < RADIUS) { gm.setDirection(direction); } } }
95d82ac3-3e25-43a7-9a32-2f6c056b2d2f
3
public void remove() throws UnsupportedOperationException { if(counter >= 0 && (counter < size)) { try { deleteAt(counter); counter--; } catch (DAIndexOutOfBoundsException e) { e.printStackTrace(); } } else { throw new Unsupporte...
5d35c84f-2b36-415c-a691-14b9e35accfd
4
public static void main(String[] args) throws Exception { int maxNorm = Integer.parseInt(args[0]); maxNorm *= maxNorm; for(Eisenstein e=new Eisenstein(0,-3); e.norm2()<maxNorm; e=e.inc()) hopp: { Eisenstein f = e; for(Eisenstein z: primes) { if(f.mod(z).equals(Eisenstein.ZERO) && f.norm2() > z.norm2...
49fb3e57-09db-4c23-9ac3-d9cb640da0ae
0
public void init() { super.init(); // set up input manager initInput(); // start resource manager resourceManager = new ResourceManager( screen.getFullScreenWindow().getGraphicsConfiguration()); // load resources renderer = new TileMapRenderer(); ...
7a7a203d-a791-48c9-9a46-9228f360571b
8
public static void main(String[] args) { if (args.length == 0) { startOpenPythiaInGuiMode(); return; } List<String> arguments = new ArrayList<>(Arrays.asList(args)); if (arguments.contains("-v") || arguments.contains("-V")) { printVersionToOutput(); ...
e2ba5195-242c-49be-9ef0-c4fc52aa434f
0
public NullFieldException(int i) { this.i=i; }
be35d649-4ca7-4c09-ac6e-e992c2d407c2
4
public static String replaceSpaces(char[] str) { int count=0; for(int i=0;i<str.length;i++) { if(str[i]==' ') count++; } char[] news=new char[str.length+count*2]; int j=0; for(int i=0;i<str.length;i++) { if(str[i]==' ') { news[j++]='%'; news[j++]='2'; news[j++]='0'; } else...
8e60cf0b-6673-4f93-aea9-f64fcefd3fc2
6
@SuppressWarnings("unchecked") private static Method getMethodOfInterest(Object cmp, Class<? extends Annotation> ann) { Class cmpClass = cmp.getClass(); Class infoClass = infoClass(cmpClass); Method[] ms = infoClass.getMethods(); for (Method m : ms) { if (m.getAnnotation(...
b9f1c3a8-6bdf-4759-a6ce-97eb5494c285
4
public boolean checkRange(XYLocation finalLocation) { if (finalLocation.getXCoOrdinate()<0 || finalLocation.getXCoOrdinate()>=rowBoard) return false; if (finalLocation.getYCoOrdinate()<0 || finalLocation.getYCoOrdinate()>=colBoard) return false; return true; }
3f1facd2-a41e-49c7-b746-8e56a9b05528
5
public static ArrayList<Camion> heuristica(GrafoTabla Grafico, ArrayList<Camion> Camiones){ ArrayList<Camion> Solucion = Camiones; ArrayList<Camion> SolucionVecina = new ArrayList(); double gama = 0.0; Random random = new Random(); double poison = 0.0; for(double t=5...
b840a558-1b0f-4baf-9795-29456cda8a2e
2
public LocalInfo findSlot(int slot) { for (int i = 0; i < count; i++) if (locals[i].getSlot() == slot) return locals[i]; return null; }
e102ee5a-fe3d-47de-be0f-ebca67a7dab0
0
private void close() { hide(); }
88a68e6a-8c16-4815-8b95-83fa42564377
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
3edd3618-bea9-4ed9-be75-17565c7f3a0f
0
@Test(expected = java.lang.RuntimeException.class) public void test_get_int_missing() { Assert.assertEquals(8989, getInt("bogus_key!")); }
8295b6e5-dc32-43be-b9b3-1eaa01564410
7
public static void printTopLevelObject(Stella_Object self, PrintableStringWriter nativestream) { { OutputStream stream = Logic.wrapNativeOutputStream(nativestream); if (self.deletedP()) { stream.nativeStream.print("#DELETED#"); } { Surrogate testValue000 = Stella_Object.safePrimaryType(se...
782e395d-f5b3-4fd1-8b9b-da637d37cc3c
1
public BigInteger[] nextBigIngtegerArray() throws Exception { String[] line = reader.readLine().trim().split(" "); BigInteger[] out = new BigInteger[line.length]; for (int i = 0; i < line.length; i++) { out[i] = new BigInteger(line[i]); } retur...
e0cbd187-8b62-484c-88a8-8fd903420155
8
public void ProcessVidGithub(String path){ try { in=new BufferedReader(new FileReader(new File(path))); out=new BufferedWriter(new FileWriter(new File("hosts"),true)); boolean startMark=false; while((line=in.readLine())!=null){ if(line.contains("#redirect")){startMark=true;} else if(startMark&&(li...
08e011fb-2c3b-4359-97a1-f5dc03d69c04
3
public List<Integer> findMinHeightTrees(int n, int[][] edges) { //1. 通过邻接链表的方式创建图 LinkedList[] graph=createAdjacentLinkedListGraph(n,edges); //2. 计算所有根节点的树高度 HashMap<Integer,Integer> heightMap=new HashMap<Integer, Integer>(); int min=Integer.MAX_VALUE; //2.1 优化 按照邻接点的多少排序...
21147aaf-b2a8-4fb2-8372-c52d2b3bdaa8
9
private ArrayList<Class<?>> getConfigurableClasses(ArrayList<Class<?>> classes) throws Exception { ArrayList<Class<?>> annotated = new ArrayList<>(); for(Class c : classes)//TODO decomp this part into findConfigurableClass(); { if(c.getSimpleName().equals("ConfigurableClass"))//...
b954982b-dbc1-4e9f-a4af-6d574cbf3664
3
void addIfDiff(char codonOld[], char codonNew[]) { String cold = new String(codonOld); String cnew = new String(codonNew); if (!cold.equals(cnew)) { codonsOld += transcript.isStrandPlus() ? cold : GprSeq.wc(cold); codonsNew += transcript.isStrandPlus() ? cnew : GprSeq.wc(cnew); } }
100d5578-0c2d-4a2c-a245-d4b641e36b75
2
public void createLinks() {//the adjacency list must be created at this point, then the links are created based on the adjacency list. for (int j = 0; j < graph_nodes.getLength(); j++) { //List gr_node=(List)graph_nodes.get(j); int lenght = ((GraphNode) (graph_nodes.get(j))).getNode_grap...
52e81144-c158-47c4-9030-e68676f8c07d
1
public void pingSleep(long extra) throws IOException { int f = this.getPing(); long timeToSleep = f + extra; LOG.debug("Time to sleep: {}", timeToSleep); try { Thread.sleep(timeToSleep); } catch (InterruptedException ex) { // ignore } LOG.d...
cc23f396-3830-4d4a-b25c-d4cd564d4393
5
public boolean processFile(TextProcessor textProcessor) throws Exception { if(this.rootDirAddr == null) { System.out.println("Please Specify the root directory first"); return false; } byte operation = this.getFileOperation(); if(operation == DropboxConstants.ADD ||...
886693d8-d326-481e-b15a-5a31c81dc53f
8
private void remove() { for (int i = 0; i < entities.size(); i++) { if (entities.get(i).isRemoved()) entities.remove(i); } for (int i = 0; i < projectiles.size(); i++) { if (projectiles.get(i).isRemoved()) projectiles.remove(i); } for (int i = 0; i < particles.size(); i++) { if (particles.get(i).isRe...
d9af1118-e78c-4071-a405-774593245bdb
9
public void reset() { // if (area.getSelectionStart() != wordOffset + wordPos) // area.setCaretPosition(wordOffset + wordPos); // String w = area.getText(wordOffset,wordPos); String w = area.code.getsb(row).toString().substring(wordStart, wordEnd); if (w.isEmpty()) { options = completions; ...
887cf66f-7b12-4872-808b-fc0575e28d8c
5
@Override public void addCard(PlayerInterface player, CardInterface card) throws SubRoundAlreadyFinished, PlayerAlreadyLaidCard { checkSubroundAlreadyFinished(); checkPlayerAlreadyLaidCard(player); if (trickcard == null || trickcard.isLessThan(card, trump)) { trickplayer = playe...
13dbfae6-2530-4135-8252-5a622ecd6ac9
2
public boolean setRank(Rank rank) { boolean promoted = false; if (rank.compareTo(this.getRank()) > 0) { promoted = false; } else if (rank.compareTo(this.getRank()) < 0) { promoted = true; } this.rank = rank; return promoted; }
ee6a901d-6530-4c71-b97a-1f3f5201b0ed
5
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case FIRST_NAME: return isSetFirstName(); case LAST_NAME: return isSetLastName(); case STATUS: return isSetStatus(); case ID: return isSetId(); ...
be2e4c56-61f2-4304-9531-c69846b83666
3
public static ArrayList<Planet> forDcalcDist(SimulatedPlanetWars simpw){ ArrayList<Planet> asw = new ArrayList<Planet>(2); // Find the best couple source/destination relying on Dcalculation + distance (our heurisctic function) int heurisctic = -1024; for (Planet s : simpw.MyPlanets()) { for (Planet d : simp...
6b42f951-48f5-4ca0-b986-8eb122e06d44
2
@Test public void testSuggestions() throws Exception { for (CommandBase command : suggContainer.getCommands()) { try { String description = command.getDescriptor().getDescription(); List<String> suggs = command.getSuggestions(new CommandInv...
4b76fd6c-95cf-484d-8b95-60f641cda109
0
public void setSeenFossil(boolean value) { this.seenFossil = value; }
08bb72a9-dc72-4e57-aaa9-79d6e861b0bd
0
public void setPassiveActivity(PassiveActivities passiveActivity) { this.passiveActivity = passiveActivity; }
08ae7936-39ed-40b3-826d-71d0eb68668a
8
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractXYItemLabelGenerator)) { return false; } AbstractXYItemLabelGenerator that = (AbstractXYItemLabelGenerator) obj; if (!this.formatString...
2f2b4017-6b75-456c-a119-867e30e3b05c
1
@Override public void dropActionChanged(DropTargetDragEvent dtde) { mDragDockable = getDockableInDrag(dtde); if (mDragDockable != null) { updateForDragOver(dtde.getLocation()); dtde.acceptDrag(DnDConstants.ACTION_MOVE); } else { clearDragState(); dtde.rejectDrag(); } }
0a4f2c1c-d546-449f-b49d-b39999637560
0
public InvalidValueException(String message) { super(message); }
a560b68d-40ae-4fd7-bfa5-12e8c7bfe7da
2
public static Atributos sqlLeer(Atributos attr){ String sql="select * from atributos where idatributos = '"+attr.getId()+"' "; if(!BD.getInstance().sqlSelect(sql)){ return null; } if(!BD.getInstance().sqlFetch()){ return null; } at...
02de1612-3bd8-4c92-97b3-0b078807dfe4
5
private void checkInput(Input input) { if (isFalling()) { fallInputCheck(input); return; } else if (input.isKeyDown(Input.KEY_SPACE) && timeSinceJump >= JUMP_CD) {// Jump Triggered changeYForce(1000); setFalling(true); timeSinceJump = 0; } else if (input.isKeyDown(OptionsFile.get().fetchIntegerFrom...
20e8b012-5c22-4088-92bc-f7e71febf86c
2
public double[][] rawCovariances(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients(); return this.rawCovariances; }
c5e11fca-804c-4020-bb40-c2e79baee4c5
9
public static double[][] benchmarkJLargeArraysDoubleRandom(long[] sizes, int[] nthreads, int iters, String file) { final int[] randIdx = new int[(int) sizes[sizes.length - 1]]; double[][] results = new double[nthreads.length][sizes.length]; long k; Random r = new Random(0); S...
125b8d85-47bf-4879-8781-4b906aa6baf1
8
public void flip() { Wire wire1 = ports[0].myWire; Wire wire2 = ports[1].myWire; if (wire1 != null) { if (wire1.fromPort == ports[0]) { wire1.fromPort = ports[1]; } if (wire1.toPort == ports[0]) { wire1.toPort = ports[1]; ...
788d4edd-d15a-47d2-8667-de3bb85ceac2
5
private HttpStreamingResponse buildHttpStreamingResponse(HttpURLConnection conn) { try { if (conn.getHeaderFields() != null) { Map<String, List<String>> headers = new HashMap<String, List<String>>(conn.getHeaderFields()); logger.d("Http response headers:", headers); ...
4e2817c4-7f15-4ceb-8877-f9a8702b18e6
2
@Override public String toString() { String result = ""; for (int i = 0; i < field.length; i++) { for (int j = 0; j < field[0].length; j++) { result = result + "[" + this.getItemType(new Position(i, j)) + "]"; } result = result + "\n"; } ...
c8d59c1d-6ae0-433c-8877-a28199ed5dab
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed //no uname if (uNameField.getText().equals("")) { JOptionPane.showMessageDialog(this, "Please enter a username.", "No Username", ...
7894fd50-11aa-41b2-a41e-a59b6ac66198
5
@Override public void show() { Auction a = null; System.out.println(name + ", type in the required information for a new auction item." + "\n"); System.out.println("Name of product:"); try { productName = br.readLine(); } catch (IOException e) { e.printStackTrace(); } System.out.println("De...
2d7127bb-c037-47e2-8d9b-22e4d77e1043
9
public double[] calculateDxDy(int cx, int cy, double vx, double vy) { int ci = getI(cx); int cj = getJ(cy); double dx = 0; double dy = 0; if (ci + 1 < voxels.length) dx = voxels[ci + 1][cj] - voxels[ci][cj]; if (ci - 1 > 0) dx += voxels[ci][cj] - voxels[ci - 1][cj]; if (cj + 1 < voxels[0].length) ...
afa776f3-e40a-4782-861c-1f852d8f892b
7
private String fillOrder(String output) { //While there are orders on the queue do { //If the currentOrder object is null, get an order off the Queue, and //set the current number of widgets needed to fill that order if (currentOrder == null) { curren...
1ef67655-236b-41a2-9d01-cf8174d0fdbc
1
public static Utilities getInstance() { if (instance == null) instance = new Utilities(); return instance; }
e1134230-25ed-429a-9981-2909059904a7
5
@MethodInformation(author="Alex", date="09.12.2012", description="Gives back a double that describes the maximum number of swords to plowshares of all DieselTraktor") protected double maxSwordsDiesel() { MyIterator it = (MyIterator) traktoren.iterator(); double max = 0; while(it.hasNext()) { Traktor obj =...
b2f4b87c-5694-45d7-9243-37ed4560a2d0
4
public GreenfootImage DisplayDescription(Class DT){ String message = ""; if (DT == Mechanic.class){ message = "In deze game is het \n de bedoeling dat je zo \n snel mogelijk boten repareert. \n Het beroep dat hierbij \n hoort is monteur."; } else if (DT == Container.class){ ...
86517e3c-cebe-44e3-8bf9-d96523e3c31a
4
public boolean kanTrouwenOp(Calendar datum) { for (Gezin gezin : alsOuderBetrokkenIn) { if (gezin.heeftGetrouwdeOudersOp(datum)) { return false; } else { Calendar huwdatum = gezin.getHuwelijksdatum(); if (huwdatum != null && huwdatum.after(...
1dbb5930-c2ce-45fa-aebd-0c2aee8433da
1
private void buttonCreditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCreditActionPerformed final int columnIdIndex = 0; //Получаем Id выбранного клиента int rowSelectedIndex = tableClients.getSelectedRow(); int selectedClientId; //Если выбрана запись ...
1bfbba5b-e0c8-474d-a6fd-299e58f65648
9
@Override public void renderWinConditions(GameContainer gc, StateBasedGame sbg, Graphics g) { int Conditions = 1; g.setColor(Color.white); if (EnemyPrimary || EnemySecondary) { if (EnemiesMet()) { g.setColor(Color.green); } else { g.setColor(Color.white); } String Enemy = "En...
3997290d-e00c-4096-a35c-b4767d137c66
1
@Override public void commandReceived(String data) { if (data.length()>0) result[0] = data; this.interrupt(); }
8d276b8c-910a-4ffd-870b-092fbe354f75
0
public void configureForImport(String protocolName, String currentDirectory) { lazyInstantiate(); // adjust title setDialogTitle("Import: " + protocolName); // adjust approve button setApproveButtonToolTipText("Import selected file"); // Set the Accessory state. setAccessory(importAccessory); // S...