method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bab5aca8-ce4c-4982-b125-f0d052a0d2eb
8
public ArrayList<Long> getFactors(Long b){ ArrayList<Long> lcm = new ArrayList<Long>(); ArrayList<Long> factors = new ArrayList<Long>(); if (b==0L){ factors.add(0L); return factors; } Map<Long, Boolean> factorsMap = new HashMap<Long, Boolean>(); double sqrt = Math.sqrt(Math.abs(b)); Long init = S...
5ff4c4a0-b61c-45d0-af3b-d54059ee2265
0
public MultiplePane(JSplitPane split) { super(new BorderLayout()); add(split, BorderLayout.CENTER); mySplit = split; }
1c509892-f7b9-4cae-9c42-e20957a80215
5
private ArrayList<AudioMixer> getCompatibleDevices(){ devices=new ArrayList<AudioMixer>(); //list the available mixers Mixer.Info mixers[]=AudioSystem.getMixerInfo(); int i; //iterate the mixers and display TargetLines for (i=0;i<mixers.length;i++){ Mixer m=AudioSystem.getMixer(mixers[i]); Line.Info l...
9efd7e4a-64ca-42db-93eb-780569d10989
4
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Position other = (Position) obj; return this.x == other.x && this.y == other.y; }
5aa32f1c-a506-4743-8562-f2028cf097bf
6
@Override public void onServerUpdate(Server lol) { for (Player p:lol.playerList) { if (p.ID!=maker&&p.checkCollision((int)X, (int)Y)) { radius=24; lol.earth.ground.FillCircleW((int)X, (int)Y, radius, World.LAVA); lol.sendMessage(Serve...
e9c6a32a-97dd-4f58-915a-2df85a5af86c
7
public static boolean computeCell(boolean[][] world, int col, int row) { boolean liveCell = getCell(world, col, row); int neighbours = countNeighbours(world, col, row); boolean nextCell = false; if (neighbours < 2) nextCell = false; if (liveCell && (neighbours == 2 || neighbours == 3)) nextCell = tru...
3c0ae688-afec-4d64-9ad6-146c521b77a4
3
public static void LoadFiles() { try { if (TIMV.config == null) { TIMV.configFile = new File(TIMV.instance.getDataFolder(), "config.yml"); } TIMV.config = YamlConfiguration.loadConfiguration(TIMV.configFile); if (TIMV.messages == null) { TIMV.messagesFile = new F...
4287f9e3-fca4-44c6-a6f7-c8e0e2d310b6
0
public static void question6() { /* QUESTION PANEL SETUP */ questionLabel.setText("What age group suits you best?"); questionNumberLabel.setText("6"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); radioButto...
cf86bbaa-4d73-4292-84c5-6b167573d449
1
@Test public void storeTestInvalidIsbn() { try { assertFalse(new Transaction().store(1111111, 123)); } catch (IOException e) { System.out.println("Invalid data"); } }
cd950c7a-1ca1-4cc8-86c1-0bf1f167c670
3
@Override protected boolean check() { return (method.getParameterTypes()[0] == Updates.class && (method .getParameterTypes()[1] == HKeyEventArgs.class || (method .getParameterTypes()[1] == String[].class && method .getParameterTypes()[2] == HKeyEventArgs.class))); }
c8f2f43f-7c7d-4efe-8c0d-c66cda618c3a
8
private int alphabeta(NeutronBoard nb, int depth,int alpha, int beta) { NeutronBoard n_copy; if ((depth==0) || (nb.isGameOver()!=NeutronBoard.NOPLAYER)) { return NeutronUtil.evaluation(nb); } for (String AMove : nb.uniqueMoves()) { n_copy=new NeutronBoard(nb); try { n_copy...
4786308a-d9b8-4460-bb0d-8d227824ce16
5
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("logo")) { logo = new ApiCorpLogo(); } else if (qName.equals("rowset")) { String name = getString(attrs, "name"); divisions = name.equals("divisions"); walletDivisions...
70b744b9-c245-4c3f-877d-d6a354a803cd
3
public void update(Game game) { lastMovementType = Types.MOVEMENT.MOVE; //Get the input from the player. requestPlayerInput(game); //Map from the action mask to a Vector2D action. Direction action2D = Utils.processMovementActionKeys(getKeyHandler().getMask(), getPlayerID())...
e6543ac7-cc15-4112-aef7-1069b70060c3
1
@Override public Writer nextRecord() throws IOException { for (final ColumnMetaData element : getColumnMetaData()) { final Object value = this.getRowMap().get(element.getColName()); this.write(this.formattedValue(value, element)); } return super.nextRecord(); }
ba8d59e8-5920-4e3e-b38a-77e2af351285
1
public void displayMovie() { System.out.println("MOVIRE NAME -->> DIRECTOR NAME -->> RATING\n"); for(int i=1;i<=15;i++) M[i].display(); }
17e2f8c3-1d03-4779-9748-82748b23b1a3
6
public JFrameMain() { frame.setResizable(false); frame.add(new TabController(), BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { if (running) { ...
a1f65b0b-439e-4ba1-94ae-ef085ce1c5f0
3
public static UserType valOf(Character val) throws Exception { if (val.equals(Admin.getVal())) { return Admin; } else if (val.equals(Member.getVal())) { return Member; } else if (val.equals(SuperAdmin.getVal())) { return SuperAdmin; } throw new Exception("Kode tidak terdaftar"); }
63b2ed03-8bbc-41ef-bcd4-f910379214ea
7
public boolean eat(int[] sourceLocation, int[] destLocation) { int x = round.getTurn() ? 0 : 1; if ((model.getTabellone()[sourceLocation[0]][sourceLocation[1]] % 2) == x) { if (model.eat(sourceLocation[0], sourceLocation[1], destLocation[0], destLocation[1])) { if (!model.can...
18fb7fb5-2a87-448c-a5ea-555607741e4f
5
public void prepareWriting(GrowableConstantPool gcp) { gcp.putUTF8(name); gcp.putUTF8(typeSig); if (bytecode != null) { gcp.putUTF8("Code"); bytecode.prepareWriting(gcp); } if (exceptions != null) { gcp.putUTF8("Exceptions"); for (int i = 0; i < exceptions.length; i++) gcp.putClassName(excepti...
509988ae-b1ed-4504-a850-60532dbc600d
8
public static byte[] readFile(String file) { File f = new File(file); if(!f.exists()) { //log: warning, while the exact file doesn't exist, receive //a read command. return null; } byte[] res = null; InputStream in = null; try{ in = new FileInputStream(f); byte[] tmpArr = new byte[1000]; i...
a938f27c-2541-4a48-9b35-20efd71a383a
5
public static void deletFile(File file) { if (file != null && file.exists()) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { /* * 如果是文件夹,递归删除。 */ File[] files = file.listFiles(); for (int i=0; i < files.length; i++) { deletFile(files[i]); } } ...
88cc740c-35b4-4490-86b0-314e57a2fbb4
5
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.GOLD + "[" + ChatColor.AQUA + "WGTP" + ChatColor.GOLD + "] " + ChatColor.RED + "Only Players can use this command!"); ...
3eb06d8c-42f1-4c77-95cd-7659ae2c532c
0
public int getKills() { return kills; }
f7e33400-0309-4fcc-8ead-771aa1fb31c3
0
public String getLocalNumber() { return localNumber.get(); }
3ec20fc6-13af-4112-b5e4-0dc1c418533a
0
public Iterable<String> keysThatMatch(String pattern) { Queue<String> queue = new Queue<String>(); collect(root, new StringBuilder(), 0, pattern, queue); return queue; }
119a82bf-924f-4d37-92e6-15483bce7509
9
public void read(SelectionKey key) throws Exception { SocketChannel socketChannel = (SocketChannel) key.channel(); this.rBuffer.clear(); int numRead = 0; try { numRead = socketChannel.read(rBuffer); } catch (Exception e) { numRead = -1000000000; } if (numRead <= 0) { loggerServer.warn("The so...
b188e26c-f888-4e8f-be4b-5177b8d87b3b
1
private void disp(int[] bowl) { String str = "|"; for (int i = 0; i < bowl.length; i++) { str += " " + bowl[i] + " |"; } str += "\n"; System.out.println(str); }
1ab0df1e-7cf3-4087-8af6-13085b59b299
4
public void dump() { Log.println("Map width = " + getWidth()); Log.println("Map height = " + getHeight()); for (int y=0; y<getHeight(); y++) { for (int x=0; x<getWidth(); x++) { int mapValue = getMapValue(x, y); Log.print(mapValue==0 ? " " : mapValue >= 255 ? "o" : "."); } Log.println(); } ...
2ae06cf5-bcee-4c1d-bb82-3ee4c1b4a489
1
public MemberValue getDefaultValue() { try { return new AnnotationsAttribute.Parser(info, constPool) .parseMemberValue(); } catch (Exception e) { throw new RuntimeException(e.toString()); } }
13671cf7-4884-4ebb-96f3-0b9475ee95bf
5
public static void main(String[] args) throws InterruptedException { // Generate environment map generateMap1(); Environment env = Environment.getInstance(); Square[][][] map = Environment.getInstance().getMap(); AgentScheduler as = new AgentScheduler(); Kernel k = Kernel...
8db17acf-d1b2-41c2-99b9-d5dc190e02ad
1
public void updateMasterHUD() { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); hud.LoadMatchingItems(); } checkRestoreCuror(); }
79c549a1-6ac6-4e1a-8177-5275688c4faa
5
static private boolean jj_3R_16() { if (jj_scan_token(ADOPT)) return true; if (jj_scan_token(BEHAVIORIDENT)) return true; if (jj_scan_token(LPAREN)) return true; Token xsp; xsp = jj_scanpos; if (jj_3_22()) jj_scanpos = xsp; if (jj_scan_token(RPAREN)) return true; return false; }
fd27af05-bf38-4335-bce4-9232bcc381a2
4
public void run(){ do { HashMap<String, ClientStatus> list = this.server.getClientlist(); Iterator iterator = list.keySet().iterator(); while(iterator.hasNext()) { String key =(String) iterator.next(); ClientStatus clientStatus=list.get(key); Vector<ServerHandleConnect> connectlist = clie...
7b7a90f7-edda-45e9-99d8-115c214ee540
0
public Node getNode() { return this.node; }
09494392-7100-46d6-bd99-9a536df803fd
5
public boolean interpret(LinkedList<GToken> input,GToken start)//takes in a goddamn stack n a fucking input { //stack starts with start token/symbol and an ending symbol LinkedList<GToken> stack=new LinkedList<GToken>(); GToken end=new GToken("<END_STRING>",true); stack.addFirst(end); stack.addFirst(start); ...
dbe108e7-3f15-4fc5-938a-c37e89b35c0a
2
private ArrayList<Village> getGrownVillages() { ArrayList<Village> villages = getVillages(); ArrayList<Village> grownVillages = new ArrayList<Village>(); for (int i = 0; i < villages.size(); ++i) { if (villages.get(i).getGrowth() != 0) { grownVillages.add(villages.get(i)); } } return grownVill...
826cc017-6728-4ac5-98a0-cb40a16f885b
4
protected void updateAbsoluteBounds() { super.updateAbsoluteBounds() ; if ((oldWide != xdim()) || (oldHigh != ydim())) { needsFormat = true ; oldWide = xdim() ; oldHigh = ydim() ; } if (needsFormat && (allEntries.size() > 0)) format(xdim()) ; //needsFormat = false ; }
b94f4664-d677-405f-af06-1a4bd7e2ac07
1
private void incCap(int minCapacity) { int[] old_data=data; int oldSize=data.length; int newSize=oldSize*2; if (newSize<minCapacity) newSize=minCapacity; data=new int[newSize]; System.arraycopy(old_data,0,data,0,count); };
c7ab81d2-4e63-4f8f-9e66-676fa1cbfd27
2
@Override public void Execute(Session mSession, String[] Arguments) { if(Arguments.length != 1) { mSession.SendAlert("Invalid number of arguments!", null); return; } String TargetName = Arguments[0]; Session Target = Grizzly.GrabHabboHotel().GrabSessionHandler().GrabSessionByName(TargetName); ...
0a87b745-6dd2-4933-8490-ab98046ffd7e
2
public String ToString (){ String res=""; for (int i=0; i<this.getRowCount();i++){ for (int j=0;j<this.getColumnCount(); j++){ res+=images[i][j].toString()+' '; } res+='\n'; } return res; }
08576a4a-471e-42e4-a6d3-6ce7ca08d6cd
1
public UmlConnectionableCapability( DefaultBox<?> box ){ this.box = box; }
990698af-40bf-442b-917d-7b7c7158bbde
3
public CtClass getComponentType() throws NotFoundException { if (opcode == Opcode.NEWARRAY) { int atype = iterator.byteAt(currentPos + 1); return getPrimitiveType(atype); } else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { ...
a4e7a305-faaf-4073-81c0-4bb8175f2960
0
private Animation createFlyAnim(Image img1, Image img2, Image img3) { Animation anim = new Animation(); anim.addFrame(img1, 50); anim.addFrame(img2, 50); anim.addFrame(img3, 50); anim.addFrame(img2, 50); return anim; }
5cb0b852-9d9f-4a93-a425-be851da78bbb
4
@Override public void setZeroFlag(boolean flagIsOn) { try { Image img; if (flagIsOn) { img = ImageIO.read(getClass().getResource("/resources/vdk-light-colour.png")); if (!CECIL_RESOLUTION.equals(CECIL_RESOLUTION_HIGH)) { img = img.getScaledInstance(ICON_SMALL.width, ICON_SMALL.height, Image.SCALE_...
1a1f9940-fa25-42fd-b38d-4aa3b907b663
1
private void checkTemp(){ File check = new File(downloadPath+File.separator+"temp"); if (!check.exists()) check.mkdir(); else{ //something wrong with temp mp3 files check.deleteOnExit(); } }
b84e9b92-99af-49bd-b0c0-c12e2ece9ca7
1
public void draw() { try { this.p1.drawN(1); } catch (Exception e) { this.p1.setLife(-999); } }
2da38246-47cb-4f51-8339-ba9cb1f1570a
3
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(messageButton)) { if (messageButton.getText().equals("Show")) { label.setVisible(true); messageButton.setText("Hide"); } else { label.setVisible(false); messageButton.setText("Show"); } } else if (e.getSource()...
34c33ebd-459d-43e2-8839-a5324a2e97f7
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...
94cd03ef-51f0-4c4a-9b00-16a2cb78b211
7
@Override public boolean tick(Tickable ticking, int tickID) { if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB)) { final MOB mob=(MOB)affected; if((target==null) ||(mob.location()!=target.location()) ||(!CMLib.flags().canBeSeenBy(target,mob))) { aborted = true; u...
38da34da-80a7-422e-aa4d-46fd42560a10
6
public boolean hasWon(ArrayList<Integer> arr) { boolean won = true; int ownScore = 0; if (game.getPlayerCount() != 2) { ownScore = arr.get(player.getColor() * 2); } else { if (player.getColor() == 0) { ownScore = arr.get(0); } else { ownScore = arr.get(2); } } ArrayList<Integer> otherSco...
7c18b50d-9d24-4fa9-8f00-a903518fd711
6
private void appendT(Event event) throws IOException { event.trim(this.eventEntry.getTypeLength(), this.eventEntry .getCommentLength()); byte[] type = event.getType().getBytes(); if (type.length < this.typeLength) { byte[] temp = new byte[typeLength]; System.arraycopy(type, 0, temp, 0, type.length);...
71f47037-f41c-4183-8113-2aa7448a3a49
1
public BufferedImage load_image(String path){ try { img = ImageIO.read(new File(path)); } catch (IOException e) { return null; } return img; }
2d489d52-5953-4614-9aa8-8ef4ab32453d
8
public void fieldReport(Sprite s) { if (s.name == "Hero Sword") { sendArmy("giant goblin", (int) s.y - 15); } if (s.name == "Hero") { sendArmy("goblin", (int) s.y); } if (s.name == "Wall") { sendArmy("battering ram", (int) s.y); } if (s.name == "Lake") { sendArmy("battering ram", (int) s.y); ...
bbcd715d-6cc3-4479-b682-aa4473644b00
3
public static boolean upload(String file) { FTPClient client = connect(); try { if (client == null) { System.out.println( "FTP error (if no error shown than bad login details"); return false; } client.changeWorkingDirectory(FTPInfo.FTP_FOLDER); FileInputStream in = new FileInputStream(Inst...
4a245a5d-a3db-4ec9-a209-731e97ed6474
6
* @return The index of where the last word of the string ends before the index of 99. */ private int findLastWord(String input){ if(input.length()<100) return input.length(); int space = -1; for(int i = 99; i>0; i--){ char tmp = input.charAt(i); if(isEndingPunctuation(tmp)){ return i+1; } if...
005656ad-488b-4d00-b743-2e1d2f60e6a1
9
public static PositiveLongContainer decode(ByteSource in) throws IOException, OffsetLengthDecodeException { long value; int size = 0; // read the prefix int temp = in.readByte(); // determine the prefix length while (0 != (temp & 0x80)) { temp <<= 1; size++; } // store the rest of this byte i...
9edf1e09-d250-4630-a985-39fc4775f378
2
@Override public void onActivate() { SpriteComponent sc = (SpriteComponent) getEntity().getComponent( SpriteComponent.ID); if (sc != null && animationFrame != -1) { sc.setFrame(animationFrame); } }
58f799fc-66a8-44ec-954a-43c26ad50e9c
6
private boolean isLogLibraryAvailable(String name, String classname) { if (isDiagnosticsEnabled()) { logDiagnostic("Checking for '" + name + "'."); } try { Log log = createLogFromClass( classname, this.getClass().getName(),...
f09ac005-b5d4-430e-a95d-039dda4c0af4
7
private void addLinkWords( String baseWord, String wikiText, String marker ){ int idx3 = wikiText.indexOf( "[[" ); while(idx3 > 0){ int idx4 = wikiText.indexOf( "]]", idx3 ); if(idx4 > 0){ if(idx3+2 < idx4){//leere Werte die vom Template entstehen, aus Performance...
1b865d96-a7a0-4b69-8251-ca14c5568eb7
9
@Override public boolean submitJob(JobConf jobConf) throws FileNotFoundException, IOException { //1. Check if the Job Configuration is Valid if(jobConf == null || !IsJobConfValid(jobConf)) { System.out.println("Invalid Job Configuration Submitted. Please check your Job Source Code and Config"); return fals...
a46536d3-4442-475e-a016-a0e19c03ba81
9
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof Value)) { return false; } final Value casted = (Value) obj; if (!(key == casted.key || (key != null && key.equals(caste...
0d14579e-04da-4f94-9273-51b0285c46a9
2
public ArrayList<String> GetDevices(int userID) throws Exception { _resultList = new ArrayList<String>(); try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB _connect = DriverManager.getConnection(_url, _user, _...
f83fd44a-cf4d-4e8a-9908-c0dd3e03c6ad
9
public void buildTree(Instances data, SimpleLinearRegression[][] higherRegressions, double totalInstanceWeight, double higherNumParameters) throws Exception{ //save some stuff m_totalInstanceWeight = totalInstanceWeight; m_train = new Instances(data); m_isLeaf = true...
5a22c10b-7bec-4ff0-ab24-539d92afa8b4
3
private void generateSamplingCore(int[] A, int index, int m) { if (index == 0) { return; } if (index + 1 == m) { return; } generateSamplingCore(A, index - 1, m); int randomIndex = new Random().nextInt(index + 1); if (randomIndex < m) { ...
9ef63a8d-4bce-4846-8332-a53b9196a28f
2
@Override public TestResult test(String input, Void... args) { if( !String.class.equals(input.getClass()) ){ throw new IllegalArgumentException("Parameter 'input' ONLY support 'String' type."); } Pattern pattern = Pattern.compile(regex); boolean passed = pattern.matcher(input).matches(); Strin...
f0e00cdd-edf9-4228-8a7f-cfd061c3b7d2
5
public static void viterbiTagger(String devDataFile, String countFile, String resultFile) throws IOException { FileReader in = new FileReader(devDataFile); BufferedReader br = new BufferedReader(in); // Store results from Viterbi tagging in a new file. File taggedResults = new File(resultFile); BufferedWrit...
f02ae87a-2eef-4a3c-9d60-e89690e582bc
4
@Override public Object getValueAt(int row, int col) { switch (col) { case 0: return new Boolean(dataSwitch[row]); case 1: return data[row].supplierID.toString(); case 2: return new Double(data[row].quantity); case 3: return new Double(data[row].price / 100.0); } return null; }
05bb9cf0-9a03-4a45-a01d-e0c407d08f00
6
@Override public void rankup(double exp) { if(exp < 50){ //add a tag thing here; this.setFarmerRank("Farmer"); }else if(exp > 49 && exp < 150){ if(this.getRank().equalsIgnoreCase("Farmer")){ Bukkit.broadcastMessage( ChatColor.GREEN + this.getfcPlayerName() + " is now a Great Farmer!"); } this....
5ab51a35-5d4e-4ff1-a754-a8b782092b06
9
private List<MapperEstimatedJvmCost> estimateMappersMemory(List<Mapper> eMappers, InitialJvmCapacity gcCap) { List<MapperEstimatedJvmCost> mappersJvmCostList = new ArrayList<MapperEstimatedJvmCost>(); MapperMemoryEstimator memoryEstimator = new MapperMemoryEstimator(finishedConf, newConf, gcCap); MapperEstimat...
3620bacb-0e80-4ed8-a6a8-0f0b9c3c9bb1
1
public GameSong(String file, float mg, float ft, float dur, GamePlayList gpl, boolean po) { try { filePath = file; maxGain = mg; audioDevice = FactoryRegistry.systemRegistry().createAudioDevice(); fadeIn = null; fadeOut = null; fadeTime = f...
005907c2-27f8-4a3e-b306-990882831d8a
7
public void digit(int digit) { scores[turn-1] +=digit; boolean gameOver = false; //Handle winning if (scores[turn-1] == WINNING_SCORE) { //Tell everyone the game quit Iterator<ModelListener> iter = modelListeners.iterator(); while (iter.hasNext()) { ModelListener listener = iter.next(); ...
9ea10f57-c366-4420-8cc4-04a6714930dd
6
public synchronized void addCopies(Set<BookCopy> bookCopiesSet) throws BookStoreException { int ISBN, numCopies; if (bookCopiesSet == null) { throw new BookStoreException(BookStoreConstants.NULL_INPUT); } for (BookCopy bookCopy : bookCopiesSet) { ISBN = bookCopy.getISBN(); numCopies = bookCopy.get...
2e207653-b2c6-4bdc-bc3d-a930bbb5ac01
7
public static String longestPalindrome_solution2(String s) { int n = s.length(); int longestBegin = 0; int maxLen = 1; boolean[][] table = new boolean[s.length()][s.length()]; for (int i = 0; i < n; i++) { table[i][i] = true; } for (int i = 0; i < n - 1; i++) { if (s.charAt(i) == s.charAt(i + 1)) { ...
4b020428-330a-41d5-9e59-9cf6e412250b
9
boolean verify() { if (!isValid()) { return false; } int start = _buffer.getKeyBlockStart(); int end = _buffer.getKeyBlockEnd(); // // This is the index of a Findex array entry that needs to be fixed up // with its true count. // int e...
edb0151b-a2f3-4346-8bb9-f2685643b2bb
1
public static void main(String[] args) { int[] num ={10,1,2,7,6,1,5}; List<List<Integer>> result = new Combination_Sum_II().combinationSum2(num,8); for (int i=0;i< result.size() ;i++ ) { System.out.println(result.get(i)); } }
95ab6ed9-d6fd-44a7-a5bc-21c4cc7c6b5e
6
private void readObject(ObjectInputStream in) throws IOException { GeneralPath path=new GeneralPath(); int type; while((type=in.readInt())!=Integer.MIN_VALUE) { if(type==PathIterator.SEG_MOVETO||type==PathIterator.SEG_LINETO) { double x1=in.readDouble(); double y1=in.readDouble(); if(type=...
39dcbaba-3dd0-4264-bc42-b7d212a5ba5e
3
public void itemChangeRecieved(ItemChangeEvent e) { if (e.getWorthProposal() != null) //itemChangeEvent requesting price update { long newWorth = e.getWorthProposal(); if (newWorth <= 0) { newWorth = 1; //an Item can at least be auto-sold for 1; } dm.setItemWorth(e.getItemName(), newWorth);...
af1f79a7-5863-4712-86d4-05a9da253acf
3
@Test public void testExceptions01() throws ParsingException, FileNotFoundException, XMLStreamException { setUp("/test01.xml"); assertEquals(null, parser.getElement()); parser.next(); assertEquals("level0", parser.getElement().getName().getLocalPart()); int level = parser.down(); assertEquals(1, level...
6b1ae0b8-818d-4e43-aaf3-6a7a745cf287
6
public IntegerWrapper integerLowerBound() { { IntervalCache interval = this; { Stella_Object lb = interval.lowerBound; if (lb != null) { { Surrogate testValue000 = Stella_Object.safePrimaryType(lb); if (Surrogate.subtypeOfIntegerP(testValue000)) { { IntegerWrappe...
f3356e6e-3fe3-4341-b3ac-8c7d47473e62
7
public void update() { int xa = 0, ya = 0; anim++; if (anim > 999) anim = 0; if (input.up) ya--; if (input.down) ya++; if (input.right) xa++; if (input.left) xa--; if (xa != 0 || ya != 0) { move(xa, ya); walking = true; } else { walking = false; } clear(); updateShooting(); }
0c9dea48-966e-44bb-858a-d52d9d77de45
3
@Override public void readValue(NBTInputStream input) throws IOException { while (true) { final byte tag = input.readByte(); if (tag == TYPE_END) { return; } final String name = input.readString(); final NamedBinaryTag nbt = NBTParser.createFromType(tag); if (nbt != null) { nbt.re...
816eb534-c54c-416e-88bb-e53fed39a235
9
public static double quantile(double x, double shape, double scale) { if (Double.isNaN(x) || Double.isNaN(shape) || Double.isNaN(scale)) return x + shape + scale; if (shape <= 0 || scale <= 0 || x < 0 || x > 1) { throw new java.lang.ArithmeticException("Math Error: DOMAIN"); } if (x == 0) retur...
5a63d466-e312-4559-8fb0-6ce4ce74d6d7
2
@Override public Operation simplify() { Expression L = Simplify.mod(this.L); Expression R = Simplify.mod(this.R); if( "0.0".equals(L.getString()) ){ return R.operation; } else if ( "0.0".equals(R.getString()) ){ return L.operation; } else { return new Sum( L, R ); } }
f5bbf456-466f-4b25-9a5c-1331c1de39c7
5
public void merge(int low,int mid,int high) { int[] helper = new int[a.length]; for(int i=low;i<=high;i++) { helper[i] = a[i]; } int i= low; int j = mid+1; int k = low; while(i <= mid && j <= high) { if(helper[i] <= helper[j]) { a[k] = helper[i]; i++; k++; } else ...
98fb17ec-b528-448f-816a-80d3b3450e80
0
public Spiel(Spieler p1, Spieler p2, LaenderGraph graph, Brett b) { spieler1 = p1; spieler2 = p2; aktuellerSpieler = spieler1; laenderGraph = graph; brett = b; frame = new Frame(brett, this); //p2.makeMove(laenderGraph.getLaenderList().getLandByID(1), laenderGraph.getLaenderList().getLandByID(0), 5, la...
91c2985a-d046-423c-b26d-4bc1c07bbe9e
1
public void insertConverted(int ID, String Cause) { try { //System.err.println("DBThread Runs"); Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root"); preparedStatement = connect.p...
5e48f88e-2ce7-4e16-a91e-ac02273eda1c
7
public boolean wallBlocks(double x0, double y0, double z0, double x1, double y1, double z1) { int xx0 = (int) Math.floor(x0 / 16); int yy0 = (int) Math.floor(y0 / 16); int xx1 = (int) Math.floor(x1 / 16); int yy1 = (int) Math.floor(y1 / 16); if (xx0 < 0) xx0 = 0; if (yy0 < 0) yy0 = 0; if (xx1 >= xs) xx1 =...
a832e228-89c0-495e-be38-bbb63bc996d3
0
public int getSuppliercode() { return this.suppliercode; }
d88f72f5-f452-4025-9dfa-8db7a16b9d4b
8
@Test public void testGetDescriptionThirdPhone() { Map<String, Object> descriptionSecondPhone = new HashMap<String, Object>(); descriptionSecondPhone.put("name", "IPhone 5C"); descriptionSecondPhone.put("brandName", "Apple Inc"); descriptionSecondPhone.put("screenSize", 4); descriptionSecondPhone.put("screen...
41d35129-9d9c-49a3-98fb-4d4af93458a2
2
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { if (isSelected) { button.setForeground(table.getSelectionForeground()); button.setBackground(table.getSelectionBackground()); } else{ button.setForeground(table.getForeground()); ...
8d003cbb-8528-4cba-a9d1-c66954fdcd12
3
public int amountSeen() { int num = 0; for (Iterator<Integer> i = data.keySet().iterator(); i.hasNext();) { int n = i.next(); if (data.get(n) == State.caught || data.get(n) == State.seen) num++; } return num; }
0f451d1d-bbe9-4051-8335-dba4b90b6715
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 Login)) { return false; } Login other = (Login) object; if ((this.userId == null && other.userId != null) || (t...
e5517130-5213-411b-90d7-8801c9456342
0
public Integer getId() { return id; }
79333b6e-3d8a-4ec1-baba-e79672a5d71d
4
public synchronized List<AndroidDeviceClient> getDeviceList( GetDeviceListMessageType messageType) { List<AndroidDevice> devices = ServerConnectionManager.getInstance() .getDevices(); List<AndroidDeviceClient> currentDeviceList = new ArrayList<AndroidDeviceClient>(); List<AndroidDeviceClient> returnList = ...
1198dc76-fddd-42a7-8190-1012ed8c698a
5
private static void merge(int low, int middle, int high) { int[][] helper = new int[data.length][data[1].length]; // Copy both parts into the helper array for (int i = low; i <= high; i++) { helper[i] = data[i]; } int i = low; int j = middle + 1; int k = low; /...
ab36e115-550e-4ef8-9dc7-97d18f534c18
0
public static void main(String[] args) { Sallary sallary = new MakeSallary(); sallary.makeSallary(); }
a3d2cda4-9baa-410f-b0c4-c7a2895b96c7
3
public static void execCheckCommand(CommandSender sender, Command command, String label, String[] args) { CommandHelper h = new CommandHelper(sender, command); if (sender instanceof Player) { if (args[1].equalsIgnoreCase("private")) { Player p = (Player) sender; String uuid = p....
42a2828a-c663-49ce-ba3d-b91d55c1de17
7
private void loadImages(){ try{ File directory = new File(PLAYER_IMAGE_PATH); File[] fileList = directory.listFiles(); for(File file : fileList){ playerImageMap.put(file.getName().split("\\.")[0], new ImageIcon(file.getAbsolutePath())); } }catch(Exception e){ CodeSource src = this.getClass()...
c532e889-fc7a-47ba-abfa-fc25f62570b4
9
public static int compareMarking(PetriNetState stateA, PetriNetState stateB) { boolean existe = false; boolean maior = true; int[] arrMarkingA = stateA.getMarkers(); int[] arrMarkingB = stateB.getMarkers(); for (int i = 0; ((i < arrMarkingA.length) && (maior == true)); i++) { if ((arrMarkingA[i] >= arrM...
025e4448-1f77-420e-8e39-1ea0883e0392
4
public boolean regenBlockQuestion(String world, int x,int y, int z, String currentMaterial) throws SQLException { if (!this.db.checkConnection()) this.db.openConnection(); Statement statement = this.db.getConnection().createStatement(); ResultSet rs = statement.executeQuery("SELECT * FROM 'wgrsnapshot' WHERE '...