method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2b6d9164-2e75-40e8-a480-a3eeeb2e6a03
6
public String toString() { String out = ""; if (quantity > 1) out += quantity; if (miniCompounds != null && miniCompounds.length > 0) { for (int i = miniCompounds.length - 1; i >= 0; i--) out += miniCompounds[i]; } else { if (miniCompounds == null) System.err.println("miniCompounds is nu...
1e608424-d151-4a4d-bf92-fca8dd9f2ba1
1
@Override public EndPoint getOtherEndPoint() { if( connection.getSourceEndPoint() == this ){ return connection.getTargetEndPoint(); } else{ return connection.getSourceEndPoint(); } }
562ce275-2320-420a-b8de-3ae0caff9864
4
@Test public void test_intersection() { HLLCounter h0 = new HLLCounter(true, 1024); HLLCounter h1 = new HLLCounter(true, 1024); HLLCounter h2 = new HLLCounter(true, 1024); HLLCounter h3 = new HLLCounter(true, 1024); for(int i = 0; i < 10000; i++) { h0.put(String.valueOf(i)); } for(in...
a9f3ecee-0f21-4a17-8d4d-8f414f1162b8
5
public boolean containedBy(Box3D box) { return (xpos >= box.xpos) && (ypos >= box.ypos) && (zpos >= box.zpos) && (xmax <= box.xmax) && (ymax <= box.ymax) && (zmax <= box.zmax) ; }
816a3902-044c-47fc-9d4a-714cb742df49
9
public SortProgram(String s) { super(s); setBounds(500,100,350,450); setLayout(null); JLabel laInput = new JLabel("Path to input data file:"); laInput.setBounds(105,10,200,15); add(laInput); final JTextField tfInput = new JTextField(""); tfInput.setBound...
f932b6bc-99c7-4e49-8092-75aa1eda38c8
2
public static int getLastId() { String sql = "SELECT idclientes FROM clientes ORDER BY idclientes DESC LIMIT 0,1"; if(!BD.getInstance().sqlSelect(sql)){ return 0; } if(!BD.getInstance().sqlFetch()){ return 0; } ...
14d3c4fe-94aa-4672-880b-d1855277658b
0
static public int getImageSizeW() { return imageSizeW; }
23ad89eb-2d67-4e60-aeb9-d5289573b2bc
0
public String getWeight() { return weight; }
399fa6c1-6045-44ba-b66e-3c331be5c9ea
5
@Override public void reactToCollision(Entity other, boolean notOnTheEdge) { if (Hidable.class.isInstance(other)) hide((Hidable)other); if (Eatable.class.isInstance(other) && notOnTheEdge) eat((Eatable)other); if (Tail.class.isInstance(other) && notOnTheEdge) ...
83b56312-4baa-4316-8f4b-c1a304d31bfb
1
public boolean equals(final Object obj) { return ((obj instanceof Label) && (((Label) obj).index == index)); }
21259f58-9c59-4c36-8575-50996c975e58
6
public static Location extractTarget(AIUnit aiUnit, PathNode path) { if (path == null) return null; final Unit unit = aiUnit.getUnit(); final Location loc = path.getLastNode().getLocation(); Settlement settlement = (loc == null) ? null : loc.getSettlement(); return (settlement in...
f0f43de0-6836-494f-a455-7ed1f9079632
6
public MonthCount(ReadData data) { storeIDMap = data.getStoreIDMap(); storeCommentMap = data.getStoreCommentMap(); for (String storeID : storeCommentMap.keySet()) { String type = storeIDMap.get(storeID).getType(); String[] types = type.split(" "); for (int i = 0; i < types.length; i++) { type =...
01eb02a8-0f38-450a-b0b6-ed8c2f354eb9
8
public static int numpadToY(char num){ //returns the y direction of each keypad input. switch(num){ case('1'): return 1; case('2'): return 1; case('3'): return 1; case('4'): return 0; case('6'): return 0; case('7'): return -1; case('8'): return -1; case('9'): return -1; def...
3b722357-ad09-4e43-84b0-be4d68fed24a
2
public static void main(String[] args){ //we make an enhanced for loop. //we call the class through the object we make //called sObject. Enumerations make built in arrays //and we call them as seen down below. values is a key Word //that can't be changed. //the sObject loops through the names of the objec...
7e097700-b692-4778-a6cb-f566c92e39df
3
public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo mutablePersistenceUnitInfo) { try { Resource[] resources = resourceLoader.getResources("classpath:"+getPath()); //resourceLoader.getResources("classpath:org/myexample/*.class"); for (Resource resource : resources) ...
1ec29919-a64a-44fa-8030-486dc1000edd
4
public DeckOfCards(int n){ m_size = n; m_cards = new HashSet<Card>(m_size); switch(m_size){ case 54: // 54 Cards m_cards.add(new Card("Joker1",14)); m_cards.add(new Card("Joker2",14)); case 52: // 52 Cards for(int i=2;i<=6;i++){ m_cards.add(new Card("Carreau",i)); m_cards.add(new Card("Coe...
9d52f0a0-8e45-4ca1-900d-d2c36288d699
1
public static void main(String s[]) throws IOException { int denomination[] = { 1, 7, 10 }; //CoinChange cc = new CoinChange(14, denomination); //System.out.println(cc); //for (int i = 0; i <= cc.totalAmount; i++) //System.out.print(cc.n[i] + " "); BufferedReader br = new BufferedReader(new InputStream...
f5254cfb-6000-4587-b8c2-c5b9d40c42dd
6
private void drawToMap(List<RiverSection> sections) { RiverSection oldSection = null; for (RiverSection section : sections) { riverMap.put(section.getPosition(), this); if (oldSection != null) { section.setBranch(oldSection.direction.getReverseDirection(), ...
c9574855-1d4d-4141-928d-9f9174f3151e
1
@Override public void render() { glPushMatrix(); { glTranslatef(getParent().getPosition().getX(),getParent().getPosition().getY(),0); for(Particle p:particles){ p.render(); } } glPopMatrix(); }
3bd5f21b-e5b2-4c79-8000-93dcbed88404
0
public static void initialiseGUI() { gui = new GUI(testWorld); gui.initaliseWorldMap(testWorld, 0, 0); }
732ebe0b-6566-4bbe-9c6a-ec49f9ab36f4
5
public Util(String[] args) { if (args.length > 0) parseArguments(args); filePath = (filePath != null ? filePath : null); format = (format != null ? format : Arguments.FORMAT_CSV); sudokuSize = (sudokuSize != null ? sudokuSize : Arguments.SIZE_9x9); folderPath = (folderPath != null ? folderPath : new Str...
7c505e98-6ef9-40f7-a5b9-a7fe61d048ac
1
private static int createPNG(StdImage image, List<byte[]> imageData, List<Integer> imageType, int type, int dpi) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (!StdImage.writePNG(baos, image, dpi)) { throw new IOException(UNABLE_TO_CREATE_PNG); } byte[] bytes = baos.toByte...
a0160bbf-7330-4f52-ba64-632c8435fdfb
7
@Override public void draw(Graphics2D g) { g.drawImage(Images.loadImage("/gui/crafting.png").getSubimage(0, 0, 96, 106), centerX - (96/2), centerY - (106/2),96,106,null); for(Button b : buttonList){ b.draw(g); } for(int slot = 0; slot < player.getInventory().getItems().length; slot++){ ItemStack i = p...
ccb29680-954b-44a0-b396-8fe9cae446db
7
public static void main(String[] args) { int limit = 28123; ArrayList<Integer> abundantNums = new ArrayList<Integer>(); for (int i = 1; i < limit; i++) if (abundant(i)) abundantNums.add(i); int numSumOfAbundant; boolean[] sumOfAbundant = new boolean[limit + 1]; for (int i = 0; i < abundantNums.size()...
26dc7bce-e1b4-45ab-8694-5d66b8244cc1
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoLogradouro other = (TipoLogradouro) obj; if (this.idTipoLogradouro != other.idTipoLogradouro && (this...
16379b22-e032-452c-8283-739a07bcc770
9
private int findRelevantElement(StackTraceElement[] trace) { if (trace.length == 0) { return -1; } else if (included.size() == 0) { return 0; } int firstIncluded = -1; for (String myIncluded : included) { for (int i = 0; i < trace.length; i++) { StackTraceElement ste = trace[i]; if (ste.getCl...
064fe0f0-2928-4246-8808-492c80e827d0
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...
f2ca4521-352a-4d3a-a77d-de1aff1b6752
2
private int getSiblingIndex(final int index) { if (index == 0) { return 0; } if (index % 2 == 0) { return getLeftChildIndex(getParentIndex(index)); } else { return getRightChildIndex(getParentIndex(index)); } }
c339ba74-89aa-45a8-aa9e-68630d435a94
6
public void selectRegion(Region regionToSelect) { // ONLY LOOK FOR IT IF IT EXISTS if (worldDataManager.hasRegion(regionToSelect)) { LinkedList<Region> pathToRegion = worldDataManager.getPathFromRoot(regionToSelect); DefaultMutableTreeNode walker = (DefaultMutableTree...
ebe1f845-d1c3-4c70-a300-f4810c202d17
9
public List<Location> adjacentLocations(Location location) { assert location != null : "Null location passed to adjacentLocations"; // The list of locations to be returned. List<Location> locations = new LinkedList<Location>(); if (location != null) { int row = location.getRow(); int col = location.getCol...
c7910834-4997-415a-8584-cc89142b9a1f
0
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(Color.black); g.drawLine(x, y + height / 2, x + width, y + height / 2); g.drawLine(x + width - height / 2, y, x + width, y + height / 2); g.drawLine(x + width - height / 2, y + height, x + width, y + height / 2); }
5658df52-0308-40c0-8ef6-dea949dbfda6
1
public boolean IsEmpty(int colonne, int rangee){ if(coordoneeJeu.get(rangee)[colonne]==false){ return true; } else{ return false; } }
f5846f40-2f5d-4012-855d-5efc0403276d
6
public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (end()) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = ...
6dec677f-dae6-40f0-a3e3-3398272750ac
0
@Override public int hashCode() { return id; }
4e332989-f187-454f-bfa6-6b66aac2c0be
9
public void renderLight(Screen screen, int xScroll, int yScroll) { int xo = xScroll >> 4; int yo = yScroll >> 4; int w = (screen.w + 15) >> 4; int h = (screen.h + 15) >> 4; screen.setOffset(xScroll, yScroll); int r = 4; for (int y = yo - r; y <= h + yo + r; y++) { for (int x = xo - r; x <= w + xo + r;...
1964ead7-8dc0-41f5-85aa-64c78cb3c240
8
@Override public boolean tick(Tickable ticking, int tickID) { Item I=null; if(affected instanceof Item) I=(Item)affected; if((canBeUninvoked())&&(I!=null)&&(I.owner() instanceof MOB) &&(I.amWearingAt(Wearable.WORN_NECK))) { final MOB mob=(MOB)I.owner(); if((!mob.amDead()) &&(mob.isMonster()) ...
69004c33-9806-4926-97c1-593a0f6223ca
8
private boolean processFields() { // // Validate the category information // int type = categoryType.getSelectedIndex(); if (type < 0) { JOptionPane.showMessageDialog(this, "You must select a category type", "Error", JOptionP...
8a2af8e4-7a74-48d0-a349-366c9a683dee
2
public boolean opEquals(Operator o) { return o instanceof StoreInstruction && o.operatorIndex == operatorIndex && o.isVoid() == isVoid(); }
6b8df336-d38e-43f3-86fa-14c451b6a2eb
2
public Font newFont(float size) { Font font = null; InputStream is = null; is = StageShop.class.getResourceAsStream("/fonts/Perfect DOS VGA 437 Win.ttf"); // is = StageShop.class.getResourceAsStream("/fonts/BMgermar.ttf"); // is = StageShop.class.getResourceAsStream("/fonts/Minecraftia.ttf"); try { font ...
3f9629a6-f5a5-400e-96a7-29f02eb2a159
5
void joinChannel(String cname, Client client) { if (checkForChannel(cname)) { Channel c = getChannelByName(cname); try { clients.remove(client); } catch (Exception e) { e.printStackTrace(); } if (c.checkUser(client) == f...
842c036b-17ef-403e-925a-cb15af4a4d84
1
public void setLeaseDurationMilliseconds(final long leaseDurationMilliseconds) { //// Preconditions if (leaseDurationMilliseconds < 2000) { throw new InvalidParameterException("leaseDurationMilliseconds must be at least 2000"); } this.leaseDurationMilliseconds = leaseDurationMilliseconds; }
b8157b85-0823-4a96-9114-a12ba6d88372
1
public static Item getItemSomething(String name){ // get item Item item = ItemStorageInventory.create().getItemfromStorage(name); if(item != null) System.out.println("you just get "+ item + " from item list \n"); else System.out.println("getting "+ item + " failed\n"); return item; }
b6d0dd98-c505-470a-9f25-5e343b8ff988
3
private void formPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_formPropertyChange if (evt.getPropertyName().equals("LataaTyopaivat")) { if (palkanlaskenta.getProfiili() != null) { malli.clear(); this.tyopaivat = palkanlaskenta.getProfiili().get...
8702ea4e-b201-4440-aa3f-65ec0af2f78b
7
private static int partition(int[] array, int start, int end) { int randomIdx = new Random().nextInt(end-start+1)+start; // Switch first item with the one of randomIdx int tmp = array[start]; array[start] = array[randomIdx]; array[randomIdx] = tmp; int piovtV = array[start]; while(start<end) { wh...
b001abf2-6d92-4b67-b59a-fc757d572221
8
@Override public void update(double time_difference) { // TODO Auto-generated method stub if(host.ip != null){ clientIP = host.ip; clientName = host.clientName; Server server = new Server(); }else{ clientIP = null; clientName = null; } switch (connection.getStatus()){ case STATUS_IDLE: ...
534c4f08-407b-4bb2-a3ea-b9d1b4fdf8f7
3
boolean isDirect(char c) { return c < 0x80 && (D_SET[c] || (optionalDirect && O_SET[c])); }
58299e14-ed8c-482f-be59-7af7b936ee0f
3
public GerarBackup(){ File diretorio = new File(pasta); File bck = new File(arq); if (!diretorio.isDirectory()) { System.out.println("Não Existe!"); new File(pasta).mkdir(); } else { System.out.println("Exis...
37e1ae6c-cfc4-456f-acdf-dc116a8bdc6a
2
public void tick(long delta) { switch(gameType) { case 0: zoneArray[currentZoneX][currentZoneY].tick(delta); break; case 1: break; } }
d6f6e93a-a202-4036-8b20-e7b4840f4c6d
9
public void removeFoundNode(AvlNode q) { AvlNode r; // at least one child of q, q will be removed directly if (q.left == null || q.right == null) { // the root is deleted if (q.parent == null) { if (q.left != null) this.root = q.left; ...
b07dee50-0583-4a01-b6d6-15cddc6ca7d1
8
public static void main(String[] args) { try{ int i = 0; // счетчик подключений ServerSocket server = new ServerSocket(SERVER_PORT);// слушаем порт 1234 Socket socket; while(true) { socket = server.accept(); if (getNumberOfUsers() ...
3b6e1a79-da60-4853-a765-e31363bc42e1
4
public void addASReplica(XmlNode node, XmlNode replicanode) { if (node == null || replicanode == null) return; List<XmlNode> list = ASreplicsMap.get(node); if (list != null) { if (!list.contains(replicanode)) list.add(replicanode); } else { list = new ArrayList<XmlNode>(); list.add(replicanode...
8dbb9201-1ae3-4537-97d2-6df8e3a0fb8f
0
public void setEmail(String s) { EMAIL = s; }
3356d1b7-ea3b-42e2-98b9-d046def8ed84
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...
29c43955-e6da-4a97-9864-981d384016ae
2
public void swapCards(CardComponent card1, CardComponent card2) { int index1 = this.getSubComponentIndex(card1); int index2 = this.getSubComponentIndex(card2); if (index1 < 0 || index2 < 0) { return; } this.getSlot(index1).unSocket(); this.getSlot(index2).un...
13398bba-ee65-4ab0-aa8c-707c9b314a5e
7
private static void setCommonAttributes(EmailDetailsDto emailDto, MultiPartEmail email) throws EmailException, SwingObjectException { email.setHostName(SwingObjProps.getSwingObjProperty("emailsmtp")); email.setAuthenticator(new DefaultAuthenticator(emailDto.getEmailID(),emailDto.getPassword())); email.setFrom(ema...
fd7fb3ee-34b8-4f1f-9327-c06cc3a7171f
6
public static void main(String[] args) { // This counts how many people we had to check int counter = 0; // This is the index of the array we update int index; // array to contain ALL THE BIRTHDAYS int[] daysOfYear = new int[365]; // Used to test if its possible for three birthdays to be consecutive up ...
1dde6f07-c58a-4a49-b52a-8b236151d611
7
private TypeMirror getTypeMirror() { String methodName = getMethodName(); if (methodName.startsWith("get") || methodName.startsWith("is")) { List<? extends VariableElement> params = element.getParameters(); if (params.isEmpty()) { return elemen...
8fd012b9-0c97-4401-a7a5-13d9a9d29ec5
9
public static long S5(){ long numS5 = 0; // S5: No student should write exams with no break between them for(Student s : Environment.get().students.objects()){ for(Lecture l1 : s.lectures){ if(l1.session == null) continue; for(Lecture l2 : s.lectures){ if(l2.session == null) continue; // lect...
8d8410b4-d0c4-4eef-9a08-006edbbdfe4d
9
public static Equation GenRndEquation(int numOperators){ //Create arrayList of expressions ArrayList<Expression> eList = new ArrayList<Expression>(); //Create a random Random rnd = new Random(); //Add a first numerical expression to equationList (First thing in an equation must be a number) eList.add(new N...
614b6b9b-983e-492a-b397-8f4c28e1dee7
1
public synchronized void take() throws InterruptedException { while (taken) wait(); taken = true; }
d8654462-7db5-4283-9a15-a475714840b8
1
private void calculateMinMax() { double[] minFlows = new double[flows.length]; double[] maxFlows = new double[flows.length]; for (int i = 0; i < flows.length; i++) { minFlows[i] = flows[i].getMin(); maxFlows[i] = flows[i].getMax(); } this.min = NetPresentValue.npv(minFlows, rate.getMax()); this.max = ...
5c03cfe1-e60f-441b-afab-868ced8f0634
0
@Column(name = "NOV_AAAAMM") @Id public Integer getNovAaaamm() { return novAaaamm; }
bc03d7b2-f1d9-49f5-b13f-28eeb0375f2d
2
public void checkDead() { ArrayList<Fish> fishies2 = new ArrayList<Fish>(); for (Fish a : fishies) { if (a.getHealth() <= 0) { fishies2.add(a); } } fishies.removeAll(fishies2); }
f70d79d2-96e6-4d2f-8a71-b640f05a8eef
2
public static void print(PrintProxy proxy) { if (proxy != null) { PrintManager mgr = proxy.getPrintManager(); if (mgr != null) { mgr.print(proxy); } else { WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), NO_PRINTER_SELECTED); } } }
39a2d4d0-b126-40c6-a47c-0e591174baae
8
public ImageStore () { MinuetoImage tileImage; MinuetoImage tempImage; URL imageLocation; MinuetoFont arial64B = new MinuetoFont("Arial",64,true,false); MinuetoFont arial40B = new MinuetoFont("Arial",32,true,false); this.imageDatabase = new MinuetoImage[128]; try { ...
a096cd23-4b30-4740-927b-b3ce12816bf0
4
private void initializeTree() { for (String line : lines) { if (line != null) { String[] words = line.split("\\s+"); if (words.length > 0) { String[] elementAndContact = words[0].split("="); if (elementAndContact.length == 2) ...
6bd672a1-22ff-4d54-ab67-7cf43a6c2931
2
public void setUserlistPadding(int[] padding) { if ((padding == null) || (padding.length != 4)) { this.userlist_Padding = UIPaddingInits.USERLIST.getPadding(); } else { this.userlist_Padding = padding; } somethingChanged(); }
50631681-5e59-4262-a02f-9c71022369cb
8
@Override public void setImages() { if (waitImage == null) { File imageFile = new File(Structure.baseDir + "MarineSentryGunMkII.png"); try { waitImage = ImageIO.read(imageFile); } catch (IOException e) { e.printStackTrace(); } } if (attackImage == null) { File imageFile = new File(St...
1bcec5a7-3152-4167-8ac0-ef2999053260
8
private void displayResultSetsInDialog(final JFrame frame, String sql) throws SQLException { StringBuilder warnings = new StringBuilder(); StringBuilder text = new StringBuilder(); Statement statement = SybaseBuddyApplication.connection.createStatement(); boolean results = statement.execute(sql); int rowsAffe...
e3482936-280b-4c81-a115-cc27aa6e6f20
2
@RequestMapping(value = "/assignmentForm") public ModelAndView showCustomerForm(HttpServletRequest request) { ModelAndView modelAndView = new ModelAndView("assignmentForm"); String method = request.getParameter("action"); if (method.equals("add")) { modelAndView.addObject("comma...
16e29c8a-b280-4cb3-a8d6-95129bdc15ae
8
public static int neighbors(int[][] board, final int x, final int y) { int neighbors = 0; for (int i = x - 1; i <= x + 1; i++) { if (i >= 0 && i < board.length) { for (int j = y - 1; j <= y + 1; j++) { if (j >= 0 && j < board[0].length) { if (!(i == x && j == y)) { neighbors += board[i][j]...
79abe551-7cb0-469a-b878-21835228ab00
4
@Test(groups = { "Character-Sorting", "Primitive Sort" }) public void testSelectionSortChar() { Reporter.log("[ ** Selection Sort ** ]\n"); try { testSortCharacters = new SelectionSort<>( primitiveShuffledArrayChar.clone()); Reporter.log("1. Unsorted Random Array\n"); timeKeeper = System.currentTi...
de38bb57-651c-4c35-b566-41067decba0e
2
public Tree multiplicativeExpressionPro(){ Tree firstConditionalExpression = null, secondConditionalExpression = null; if((firstConditionalExpression = unaryExpressionPro()) != null){ if((secondConditionalExpression = multiplicativeExpressionDashPro(firstConditionalExpression)) != null){ return secondCondit...
38205efd-4295-4545-810a-39f1150ba4bb
8
private static DRDiffReport doDiffOperationToReport(List<String> bdbLogFileContents, List<String> hadoopLogFileContents, IDiffStrategy diffStrategy) { int bdbLogFileIndex = 0; int hadoopLogFileIndex = 0; int bdbLogFileLength = bdbLogFileContents.size(); int hadoopLogFileLength = hadoopLo...
5fee3a7b-c91c-4164-b350-fa288de5b908
2
public void testPropertyPlusNoWrapMinute() { LocalTime test = new LocalTime(10, 20, 30, 40); LocalTime copy = test.minuteOfHour().addNoWrapToCopy(9); check(test, 10, 20, 30, 40); check(copy, 10, 29, 30, 40); copy = test.minuteOfHour().addNoWrapToCopy(39); check(c...
2bef2812-d93c-4185-a7ba-0f891f5898d9
2
public static void deleteFile() { File[] files = FileLister.getFilesArrayFile(); int selection = FileChooser.chooseFile(); if (selection < files.length) { boolean success = files[selection].delete(); if (success) { System.out.println(">File successfully deleted"); } else { System.out.println(">Fi...
108b7424-d646-4834-b331-8102097bdb08
7
public void run() { List<CyNode> allNodes = new ArrayList<CyNode>(); allNodes = network.getNodeList(); CyRow row; if(doRestart) { for(CyNode currNode : allNodes) { row = ColumnsCreator.DefaultNodeTable.getRow(currNode.getSUID()); Double initialOutput = row.get(ColumnsCreator.INITIAL_OUTPUT_VAL...
66ec5221-0d51-4103-9ba6-5e073f9dde29
4
private static void copyMemory(long src, Object dest, long size) { long sSize = size; while (size > 0) { if (size >= 8) { $.putLong(dest, sSize - size, $.getLong(null, src)); size -= 8; src += 8; } else if (size >= 4) { $.putInt(dest, sSize - size, $.getInt(null, src)); size -= 4; src ...
a640afc9-7dc1-4a42-8cbe-45106db54813
4
public Circle score(ShortImageBuffer edges) { if(this.x <= this.radius || this.y <= this.radius || this.x >= (edges.getWidth() - this.radius) || this.y >= (edges.getHeight() - this.radius)) return this.scoreCheck(edges); return this.scoreNoCheck(edges); }
6df3e92b-6cfb-4c33-a836-5aa9d5c0c3b3
9
@Override public void actionPerformed(ActionEvent e) { final boolean ok = viewMutantsConfiguration.getLiteralOmission().isSelected() || viewMutantsConfiguration.getLiteralNegation().isSelected() || viewMutantsConfiguration.getClauseOmission().isSelected() || ...
25d6d744-462e-465a-b1e6-b0b01c31f373
5
@SuppressWarnings("unchecked") public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) { if (map == null) { throw new IllegalArgumentException("Map must not be null"); } if (props != null) { for (Enumeration<?> en = props.propertyNames(); en.hasMoreElemen...
4626c839-8b5a-4b28-9c19-92ff7ce46518
7
public static void startupStrategies() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((M...
87265ae9-4f04-47fa-9229-10a6ab14dfdf
4
public void draw(Graphics g){ int x = getX(); int y = getY(); int w = getW(); int h = getH(); if(w < 0){ x +=w; w *= -1; } if(h < 0){ y +=h; h *= -1; } Graphics2D g2 = (Graphics2D) g; if(getLinePattern()) g2.setStroke(new MyDashStroke(getLineWidth())); else g2.setStroke(...
9fa10e8d-857e-4399-8751-f123166ead5c
1
@Test public void getValofRow_test() { try{ double [][]mat= {{3.0,2.0}, {1.0,3.0}}; int j=0; double[]result = Matrix.getVecOfRow(mat, j); double []exp= {3.0,2.0}; Assert.assertArrayEquals(exp, result, 0.0); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"...
92b7c859-239a-465f-bedc-d29b6cfa947a
1
private void registerManaged(Environment environment) { final Map<String, Managed> beansOfType = applicationContext.getBeansOfType(Managed.class); for (String beanName : beansOfType.keySet()) { Managed managed = beansOfType.get(beanName); environment.lifecycle().manage(managed...
dddb6ca5-882d-432f-b096-ce7ec892c9ac
4
public void setupVaultEconomy() { if (!hasVaultPlugin() || !manager.isPluginEnabled("Vault") || econHook != null) { return; } RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager().getRegistration(Economy.class); if (economyProvider != null) { econHook = economyProvid...
b92c454e-41ab-424d-9348-b20f280868e4
9
public void mate(){ boolean impregnate = false; Organism partner = null; for(int o = 0; o < environment.getOrganisms().size(); o ++){ // for(Organism o : environment.getOrganisms()){ if(environment.getOrganisms().get(o).getSpecies () == getSpecies()){ if(environmen...
2df492e3-27b8-4dee-8f0b-1ef80dc40431
4
public void escribirPalabras(int lin, String etq, String cod, String ope){ String line; line = Integer.toString(lin); try{ BufferedWriter bw = new BufferedWriter(new FileWriter("P2ASM.INST",true)); bw.write(line); bw.write("\t "); if(etq.isEmpty()) bw.write("Nul...
e198a839-4dda-469e-8887-2e399ead77bb
2
public static void main(String[] args) { Sequence sequence = new Sequence(10); for (int i = 0; i < 10; i++) sequence.add(Integer.toString(i)); // Selector selector = sequence.selector(); // while (!selector.end()) { // System.out.print(selector.current() + " "); // selector.next(); // } Selector reve...
a76209cf-d92c-482c-8938-077990363dc8
6
@EventHandler public void CaveSpiderHarm(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.getCaveSpiderConfig().getDouble("CaveSpide...
50599660-f116-4404-9088-1480d754f283
2
public static final boolean isJSP(String fileName) { for (String file : JSP) { if (file.equals(fileName)) { return true; } } return false; }
b6b9659b-e075-4a24-91af-187dee59fac0
8
@Override public int hashCode() { int result = item != null ? item.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); result = 31 * result + (item3 != null ? item3.hashCode() : 0); result = 31 * result + (item4 != null ? item4.hashCode() : 0); resu...
052ce9a5-08c0-43ce-9c07-3bd3831fe8f4
8
public Case getCaseByDirection(int direction, Case position){ switch(direction){ case 0: { if(position.getCaseNumber()-16 > 0){ return this.casefield[position.getCaseNumber()-16]; } return null; } case 1: { if(position.getCaseNumber()%16 != 0){ return this.casefield[posi...
f0b2adb7-8b53-40a0-b652-279edc96697e
7
public static void loadWeightsFromFile(){ File input = null; Scanner reader = null; try { input = new File(".data\\nnsave40_110000newLR"); reader = new Scanner(input); } catch ( java.io.FileNotFoundException e ) { try { input = new File(".data/nnsave40_110000newLR"); reader = new Scanner(input)...
97af73ac-8db6-41cd-8180-5a9bca837778
7
public boolean hasPathSum(TreeNode root, int sum) { if(root == null) return false; boolean bleft = false, bright=false; if(root.left==null && root.right==null) { if(sum==root.val) return true; else return false; } if(root.left != null) bleft =hasPath...
47fc887a-00b8-4f41-a976-57019090db76
5
public void update(double dt) { translatePosition = new Vector4(0, 0, 0); translateLookAt = new Vector4(0, 0, 0); // moze sie troche dziwne wydawac ale dziala poprawnie localXAxis.setX(_lookAt.getZ() * -1); localXAxis.setZ(_lookAt.getX()); localXAxis.normalize(); Vector4D newXAxis = new Vector4(localXAxi...
4c91629e-93de-4993-86fb-9e1a85460018
7
@Override protected BufferedImage doInBackground() throws Exception { long starttime = System.nanoTime(); BufferedImage image = new BufferedImage(AREAX, AREAY, BufferedImage.TYPE_INT_RGB); Graphics g = image.createGraphics(); ...
85482b69-1aea-45b9-82db-ebac6d9eedcc
1
private static JPanel[] createEmptyBuckets() { JPanel[] output = new JPanel[SIZE]; for(int i = 0; i < SIZE; i++) { output[i] = new JPanel(new GridLayout(0, 1)); } return output; }
c2cafe46-670a-40f8-b7b7-89c4d39a36d8
6
private void showProperty(final String propertyName) throws UnrecognizedCommandException { java.util.Set<String> properties = Set.properties; Properties systemProp = Conf.getSystemProperties(); StringBuilder sb = new StringBuilder(); if (null == propertyName) { int len1 = 0; for (String name : properties)...
b8d0a79d-532c-4da2-acd8-b8acb77fef75
5
private void heapify(int i) { int pienin; int l = left(i); int r = right(i); if (r <= keonKoko) { if (taulukko[i] < taulukko[r]) { pienin = r; } else pienin = l; if (taulukko[i] > taulukko[pienin]) { vai...