method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3a849d01-4314-409f-bb04-b03eccc30dbb
8
private int centerAndValueOn() { CABot3Net factNet = (CABot3Net)getNet("FactNet"); CABot3Net valueNet = (CABot3Net)getNet("ValueNet"); boolean valueOn=false; boolean centerOn=false; int result = 0; for (int i = 0; i < valueNet.getSize(); i ++) { if (valueNet.neurons[i].getFired()) valueOn...
30bc3e1c-db66-45db-a7ae-467927f8edfe
0
public void setPrpIdElemento(int prpIdElemento) { this.prpIdElemento = prpIdElemento; }
81053f11-fb97-41f8-a1d6-6589d114cce3
5
public Tracker(java.lang.String name, long delay, long period, java.lang.String filename) { super(name); boolean __b = getAgentType() == tracker.Tracker.class; if (__b) { __init1(); __init2(); } java.lang.System.out.println(name + "\tstarted "); ...
b8ac293e-ad69-43f6-8114-a80f3cfa1684
3
private static void consume_Tf(GraphicsState graphicState, Stack stack, Resources resources) { // collectTokenFrequency(PdfOps.Tf_TOKEN); //graphicState.translate(-shift,0); //shift=0; float size = ((Number) stack.pop()).floatValue(); Name name2 = (Name) stack.pop(); // bu...
4a0a669c-e711-4509-a0d0-0bbe8307c027
5
private void create(FileFilter filter, boolean directoryOnly) { this.chooser.setDialogType(JFileChooser.OPEN_DIALOG); this.chooser.setFileHidingEnabled(true); this.chooser.setAcceptAllFileFilterUsed(false); this.basePanel.add(this.chooser, BorderLayout.CENTER); if (filter != nul...
976b42c3-3ba2-42e8-a5e3-294e9129f1c1
9
private static String toWords(int n) { final String s = String.valueOf(n); final int l = s.length(); if (l == 1) { return numbersToWords.get(n); } else if (l == 2) { if (numbersToWords.containsKey(n)) { return numbersToWords.get(n); } ...
866d2d39-9976-4d40-989b-7c36d1e462f8
3
public boolean scoped(String scope) { if (this.scope != null) { for (String s : this.scope.split(" ")) if (scope.equals(s)) return true; } return false; }
a3dcf794-cb9d-4dbd-8689-b979fbb1ac0d
5
public void duplicateTrack() { int theId = lookForBlankId(); int newMatchesSize = Math.max(theId + 1, highestId() + 1); int[] matches = new int[newMatchesSize]; for (int i = 0; i < matches.length; i++) { if (i == matches.length - 1) matches[i] = 0; else matches[i] = currentTrack().getMatches()[i];...
351d8643-3c52-42be-9b8c-95acc3e8f150
1
public void stop() { continueLoop = false; if(thread != null) { thread.interrupt(); } }
5b78a33c-5862-4424-aebb-a2033c17da43
3
@Override public Object getSupportedAttributeValues(Class<? extends Attribute> category, DocFlavor flavor, AttributeSet attributes) { if (category == Media.class) { return new Media[] { MediaSizeName.NA_LETTER, MediaSizeName.NA_LEGAL, MediaSizeName.ISO_A4 }; } if (category == OrientationRequested.class) { ...
0ca50630-bd70-4d86-be4f-ba089cf89dd7
2
protected static String readInputCommadForServer(BufferedReader commandReader) { String commandLine = null; do { try { commandLine = commandReader.readLine(); log.info("receive command: " + commandLine); } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); co...
4b49536b-046c-47d8-adc0-4c0cdf35e025
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
77212c55-3c90-4502-babb-f319c622f3dd
1
public String toString() { StringBuilder sb = new StringBuilder("["); Node node = _head.next; String sep = ""; while (node != null) { sb.append(sep).append("(").append(node.waketime).append(",") .append(node.agent).append(")"); node = node.next; sep = ";"; } sb.append("...
e5953080-2742-403d-907f-ae1ed9161b8f
2
private static void permutate(char[] s, int n){ for(int i=n;i<s.length;i++){ for(int j=i+1;j<s.length;j++){ swap(i, j, s); permutations.add(new String(s)); permutate(s, n+1); swap(i, j, s); permutate(s, n+1); } } }
8fba3f00-380d-459d-8241-d8626e41458d
7
public static String camelCaseToUnderline(String name) { final int length = name.length(); boolean inupper = false; StringBuilder stb = new StringBuilder(length); int i = 0; while (i < length) { char c = name.charAt(i); i = i + 1; if(inupper) {...
937cb6ea-73fb-4af0-b805-74311c0fa6f5
9
protected void generateCSVFile(File dir, String typeFilter) throws IOException { try { File skillListFile = new File(dir, "skillsList_" + typeFilter + ".csv"); HashSet<String> writtenKeys = new HashSet(skillSets.size()); if (skillListFile.exists()) { skillListFile.delete(); } System.out.print...
2a45deb1-432b-4f6a-a268-9d238d3d0972
5
public static Node insert(Node head, Node insert) { if (head == null && insert != null) { head = insert; return head; } if (head == null) { return head; } Node traverse = head; while (traverse.info < insert.info && traverse.next != null) { traverse = traverse.next; } insert.next = traverse.n...
b611d766-6b26-4ccd-a1ca-b1b5eff87dc3
8
public static void createNgramsFromFolder(File input_folder, File output_folder, int ngram_value) { Stack<File> stack = new Stack<File>(); stack.push(input_folder); while(!stack.isEmpty()) { File child = stack.pop(); if (child.isDirectory()) { for(File f : child.listF...
a39608de-dcaf-429a-87ef-af529a31604f
4
/* */ public boolean isActive() /* */ { /* 35 */ if (this.context == 0) { /* 36 */ this.context = -1; /* */ try { /* 38 */ if (getAppletContext() != null) this.context = 1; /* */ } /* */ catch (Exception localException) /* */ { /* */ } ...
b4aa9079-2780-4cd6-90e1-acbb3af17e46
9
public void runOptimisticUnchoke(){ RUBTConstants.main_log.info("*** RUNNING OPTIMISTIC UNCHOKE ***"); if (this.activePeers.size() >= RUBTConstants.MAX_UNCHOKED_PEERS) { RUBTConstants.main_log.info("too little active peers: " + this.activePeers.size()); return; } //Lookup selected peer in active list to...
e86e1322-7c1d-4ab4-a05a-127ef748a462
1
public ArrayList<String> getAllIdentifier() { ArrayList<String> result = new ArrayList<>(); NodeList nl = doc.getDocumentElement().getElementsByTagName("stock"); for (int i = 0; i < nl.getLength(); i++) { Element e = (Element) nl.item(i); result.add(e.getAttribute("identi...
4f17a591-bb4b-47e8-8e3c-b2df53929ce5
7
public Double getDistance(int distanceType, Entries other, int VERBOSE) { int logFlag = 0b10; // if one of the entries contains nothing, then we cannot // compute the distance if (other.size()==0) return null; if (this.size() ==0) return null; // say, we have two timeSeries 1 and 2 // our assump...
d34cb8a1-2df0-47e0-9093-4244769ba928
1
public float mean() { float sum = 0; for (float x : data) { sum += x; } return sum / data.size(); }
9d293dfd-81cb-4e19-8c79-ac41f8879925
9
public void resolveAddresses() { for(int i = 0; i < byteCodeFile.size(); i++) { String byteCode = byteCodeFile.get(i).get(0); if(byteCode.equals("FALSEBRANCH") || byteCode.equals("GOTO") || byteCode.equals("RETURN") || byteCode.equals("CALL")) { int address = 0; String byteCodeArg = byteCodeFile.get(i)...
2d6fce66-0157-4e58-93e5-cfdf5d0a90a9
7
static public boolean mapEquals(IPersistentMap m1, Object obj){ if(m1 == obj) return true; if(!(obj instanceof Map)) return false; Map m = (Map) obj; if(m.size() != m1.count() || m.hashCode() != m1.hashCode()) return false; for(ISeq s = m1.seq(); s != null; s = s.next()) { Map.Entry e = (Map.Entry) s.fir...
0c8eed5a-a0e7-4289-9343-cc8138cbe86c
7
public float palDifUni(int[] a, int[] b) { boolean aTransp = a[3] == 0; boolean bTransp = b[3] == 0; if (aTransp != bTransp) return Float.POSITIVE_INFINITY; float dif = 0; int len = aTransp ? 3 : 4; boolean[] sel = new boolean[len]; for (int i ...
81726ef8-af90-4e35-b68e-dffa8b7501f8
5
void animateBall() { switch(animCoun) { case 0: img=imgAnim01; break; case 20: img=imgAnim02; break; case 40: img=imgAnim03; break; case 60: img=imgAnim04; break; case 80: MetalBreaker.nBalls--; ballAlive=false; } animCoun++; }
8000f25c-9a88-4bef-924a-cf22492c309f
7
protected int indexToInsert(GameComponent<?> component) { int lowerIndex = 0; int higherIndex = this.getComponentCount() - 1; int searchedZ = component.getZ(); if(this.getComponents().isEmpty() || searchedZ < this.getZFromComponentAt(lowerIndex)) { return 0; } if(searchedZ >= this.getZFromComponentAt(h...
426bdb7d-6b95-49df-8c4a-459ca8639f62
2
public static boolean uniqueASCII(String s) { int[] counts = new int[256]; char[] chars = s.toCharArray(); for(char c : chars) { counts[c]++; if(counts[c] > 1) { return false; } } return true; }
69a0a745-d82c-4d3d-98c8-7d882809be50
5
public static void metroStyleTitlebar(JInternalFrame internalFrame) { JComponent title = ((BasicInternalFrameUI)internalFrame.getUI()).getNorthPane(); for (int i = 0; i < title.getComponentCount(); i++) { JComponent component = (JComponent)title.getComponent(i); if(component instanceof JBu...
50489031-dff8-474d-bcf8-68848f7418bf
9
@Override public void run() { DNSPacket dnsMessage = new DNSPacket(true); dnsMessage.setAuthoritativeAnswer(true); List<ServiceInfo> removalList = new LinkedList<ServiceInfo>(); boolean bannouncedLocalInfo = false; if(_LocalInfo.getState().isAnnouncing()) { synchronized(_LocalInfo) { addLocal...
2dafcc90-31b8-4582-a996-6438d7acdc04
7
public boolean legalMove(Move m) { return ( // the player must exist (m.player.equals("red") || m.player.equals("blue")) && // it must be his turn (m.player.equals(turn)) && // the player must own the piece he wants to move (owner(m.begin) != null) && (owner(m.begin).equals(m.player)) && // the go...
9204c915-ded7-435b-8e29-862f26addc77
2
public void successAndUpdate(NullParamFn<? extends Boolean> fn) { this.val(this.suc ? fn.fn() : false); }
29b5736c-1efb-4c6f-913e-77494683fed4
5
public void removeActivity(Activity a) { if (user.getActivities().contains(a.getId())) { //user will actually be changed user.removeActivity(a.getId()); //we got rid of it, so don't keep it around activities.remove(activityIdNameMap.get(a.getId())); ac...
22305f6c-103a-4a21-ab61-fecc04ad3e72
2
public static void main(String[] args) { final Count2 count = new Count2(); for (int i = 0; i < 5; i++) { new Thread() { public void run() { count.get(); } }.start(); } for (int i = 0; i < 5; i++) { ...
65b2f5d3-7fac-48f9-9116-d10311e21a21
9
public static void main(String[] args) { boolean[] primes = new boolean[2000000]; for (int i = 2; i < primes.length; i++) primes[i] = true; for (int i = 2; i < primes.length; i++) if (primes[i]) for (int j = 2; i*j < primes.length; j++) primes[i*j] = false; ArrayList<Integer> primeList = new Arr...
b54dfff3-1d8c-4285-b03f-d4f4dc1cde5b
5
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { boolean handled = false; if (is(label, "ol")) { if ((args.length == 1) && (is(args[0], "reload"))) { handled = true; if (!isPlayer(sender)) { OKC...
befbe70b-ae87-441b-9e83-fc5ba28e2d7e
3
public boolean lookupEmail(String email) { Connection connection = null; String query = null; PreparedStatement statement = null; try { connection = dataSource.getConnection(); query = "SELECT * FROM users WHERE email = ?;"; statement = (PreparedStatement)connection.prepareStatement(query)...
bef42870-6344-4a13-90bc-aaed0aca6dd6
0
public Object get() { return queueList.removeFirst(); }
0d9417d5-ac0a-4064-893c-f27590285675
0
public String getNick() { return _nick; }
78a93ea9-913f-4a35-9d1e-70386f32eee2
5
public static int calculateNumberOfWaysToGetChange(int num, int type){ int next_type = 0; if(type == QUARTER) next_type = DIME; else if(type == DIME) next_type = NICKEL; else if(type == NICKEL) next_type = PENNY; else if(type == PENNY) return PENNY; int ways = 0; ...
fbb69bfe-fd1e-4c8b-ba91-15d91be400c7
1
public boolean isItemReceived() { if (itemReceivedInt == "1") { return true; } else { return false; } }
af412bbb-0dc8-4578-a688-519865c1b161
6
public static void raggiunto (int num_uno, double grow_uno, int num_due, double grow_due) { int final_uno = 0; int final_due = 0; int years = 1; boolean flag = false; if ( (num_uno > num_due && grow_uno > grow_due) && (num_due > num_uno && grow_due > grow_uno) ) { System.out.println ("Le Popolazio...
9963e1f1-3e72-4abf-80c8-60aca6169d17
0
public void setFesUsuario(String fesUsuario) { this.fesUsuario = fesUsuario; }
59f62872-d8e6-4aad-89d3-c46e0b874f8c
2
public void Start(boolean changefilename) throws FileNotFoundException { if (changefilename) { try { ChangeFilePath(filepath); } catch (IOException e) { e.printStackTrace(); } } Running = true; runner = new Log(); runner.start(); }
4aa67494-4f32-417b-9ce0-283f9fe56743
4
private int checkPasswordField() { int res = 0; lblError.setVisible(false); if (cbAdministrator.isSelected() && roleStateAdministrator == 0) { if (!Validate.tfEmpty(tfPassword) && Validate.notOverSize(tfPassword)) { res = 1; } else { lblErr...
58960023-d020-4a59-b8e7-0934887a757b
6
public void addParameter(String parameterType) throws SQLException { switch (parameterType) { case "string": try { StringParameter newParameter = new StringParameter(); newParameter.setElementId(element.getId()); newParamete...
b2ae9340-85a0-4225-adb4-905463aa51d9
2
public void mainMenu() throws IOException { Account aA = new Account(activeAccount); Scanner in = new Scanner(System.in); System.out.println("Logged in as "+aA.getName()); System.out.println("-----------------------"); System.out.println("What do you want to manage?"); System.out.prin...
f895ca3c-f62e-4828-811a-f839677a0753
0
public void setUser(IrcUser user){ this.User = user; }
53199a2d-0cb1-4c38-8a87-4ea1e9de29b5
6
public Class<?> getColumnClass(int column) { switch(column) { case NATION_COLUMN: return Nation.class; case AVAILABILITY_COLUMN: return NationOptions.NationState.class; case ADVANTAGE_COLUMN: return NationType.class; ...
a9bb909a-bc8d-4fcd-858c-3e80725f8b25
7
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int row = Integer.parseInt(br.readLine()); int col = Integer.parseInt(br.readLine()); int[][] input = new int[row][col]; int[][] minPath = new int[row][col]; for (int i = 0; ...
d21d7f35-989d-40f0-94a3-76f87cacedc9
0
public void killUser(String userid) { Card card = _view.cards.get(userid); _view.cards.remove(userid); _view.gamePanel.remove(card); }
eb3a623b-5b97-4dcc-9968-20fa51282e96
7
public static Collection<String> getResourceCollection(Class clazz, String path) throws IOException { Collection<String> resourceCollection = new HashSet<>(); URL dirUrl = clazz.getResource(path); if (dirUrl == null) { try ( InputStream in = ResourceUtil.class...
ea569c98-1163-4271-b9fa-a609d426fc98
1
private void tulosta() { for (Henkilo h : henkilot) { System.out.println(h); } }
2863000d-4377-45bf-965c-d57aed0d4e13
9
private static String round(String num, int length) { // used by realToString if (num.indexOf('.') < 0) return num; if (num.length() <= length) return num; if (num.charAt(length) >= '5' && num.charAt(length) != '.') { char[] temp = new char[length+1]; int ct = leng...
5cdbce8c-e835-4688-92b0-f36117b0a5e1
6
private static void Take(){ if (currentLocale.getId() == 0){ mapFound = true; bag[0].setFound(true); newBag.add(bag[0].getName()); System.out.println("You found " + bag[0].getName() + ", it is in your bag."); } else if (currentLocale.getId() == 1){ bag[1].setFound(true); ...
18aad198-1444-4c7f-8e96-94435711eb8e
7
private Instances subset(Instances insts, HotTestDetails test) { Instances sub = new Instances(insts, insts.numInstances()); for (int i = 0; i < insts.numInstances(); i++) { Instance temp = insts.instance(i); if (!temp.isMissing(test.m_splitAttIndex)) { if (insts.attribute(test.m_s...
f6f24521-072b-4bc4-8ad5-c84ec02de337
1
public void setKeywordExtractMode(String keywordExtractMode) { if( !keywordExtractMode.equals(AlchemyAPI_KeywordParams.EXTRACT_MODE_STRICT)) { throw new RuntimeException("Invalid setting " + keywordExtractMode + " for parameter keywordExtractMode"); } this.keywordExtractMode = keywordExtractMode; }
29784838-da8f-4b54-b063-d8b1ac080ec8
8
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new FileReader("empty.in")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("empty.out"))); StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(...
7fa21c72-0fa4-40ad-84b5-a65a759f85b9
8
public static void main(String[] args) { EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation(); starter.initLanguage(new char[] { '0', '1' }, 10, "(1(01*0)*1|0)*"); int solutionFoundCounter = 0; int noSolutionFound = 0; List<Long> cycleCount = new LinkedList<Long>(); ...
92ffbfc4-5bea-496d-8995-4da4f63c4a5b
0
@Override public final void testFinished(Description description) throws Exception { super.testFinished(description); selectListener(description).testFinished(description); }
47f07288-232b-4dd0-a55b-5142d5b2f6c1
0
@Override public String toString() { return String.format("%s='%s'", getType(), getId()); }
f495e6e0-eb1e-408d-9c5b-9323df07f835
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...
fa8b012f-e4a0-4c72-a2d2-acb6097bd21a
4
public Map<String, String> writeToFile() throws FileNotFoundException, IOException { File file = new File("property.prop"); if (!file.exists()) { FileOutputStream fosTemp = new FileOutputStream("property.prop"); } FileInputStream inputFis = new FileInputStream("property.pro...
6b36a86e-b903-49c2-ae4b-f3ece2e42106
3
private void method60(int id) { Interface interfaceInstance = Interface.cachedInterfaces[id]; for (int childId : interfaceInstance.children) { if (childId == -1) { break; } Interface children = Interface.cachedInterfaces[childId]; if (child...
87aa4a12-87cd-4672-afce-bc22fd018143
3
private static boolean binarySearch1(Long number, int lo, int hi) { if (lo > hi) return false; int location = (lo + hi) / 2; if (sorted[location]==number) return true; if (sorted[location] < number) return binarySearch1(number, location+1, hi); return binarySearch1(number, lo, loc...
bf520bb1-1edb-4978-bd02-848d960bfde4
3
void setSelectionBackground () { if (!instance.startup) { tabFolder1.setSelectionBackground(selectionBackgroundColor); } // Set the selection background item's image to match the background color of the selection. Color color = selectionBackgroundColor; if (color == null) color = tabFolder1.getSelectionBac...
d8b25776-5dfe-48a2-998c-9f750569b7c2
3
public static Image createDegrade(boolean isColor, int height, int width, int color1, int color2) { Image degradee = null; if (isColor) { degradee = new RgbImage(width, height); } else { degradee = new RgbImage(width, height); } Color c1 = new Color(color1); Color c2 = new Color(color2); Color cu...
e4ed6100-c1e4-4ad7-95df-57cc682cb916
4
@Override public Formula generateOffer (Formula offer, int snum) { Formula responseOffer = getPreferedOffer(offer, snum); if (responseOffer != null) { addHistoryFormula(responseOffer); } if (offer != null && offer.equals(responseOffer) && offer.getPrice() >= responseOffer.getThreshold()) responseOffer...
e87c5cbd-65c1-4f3e-b7a0-ba217b2c4400
4
private void handleDisplay() { //prompt user System.out.println("\n--Display Course Sections--"); if (dataModel.isEmpty()) { System.out.println("No courses stored. Nothing to display."); return; } System.out.println("Stored courses:"); ...
1a598266-952b-49e5-ba9c-fd5fa49f9267
5
public static int maxValue(Node root) { if(root == null) return -1; else if(root.left == null && root.right == null) return root.data; else if(root.left == null) return Math.max(root.data, maxValue(root.right)); else if(root.right == null) return Math.max(root.data, maxValue(root.left)); else r...
e26eb68d-3d6d-4d96-9bf4-6bf3c3dbe5a2
8
@Override public void inputData(Map<String, Map<String, String>> input) { //name : index[] : answer Iterator<String> nameIterator = input.keySet().iterator(); Map<String, String> indexToAnswers = input.get(nameIterator.next()); String[] data = indexToAnswers.get("0").split(COLON_SEPARATOR); if (data[0]....
81ea211c-36da-4872-86ca-139fbfc2f2f8
2
private void loadPrefab(int spawnX, int spawnY){ String pathTag = "HousePrefab"; String path = ""; path = "data/" + pathTag + String.valueOf(spawnRotation) + ".pfb"; File f = new File(path); if (f.isFile()){ try { prefab.buildPrefab(spawnX, spawnY, path); } catch (IOException e) { e.printS...
42c8156f-1656-48a4-8b18-ddd1a4c7eb84
2
@Override public void open(String name) throws ChannelException { try { if (port == null) { port = (SerialPort) commPortIdentifier.open(name, 2000); } port.setSerialPortParams( 19200, SerialPort.DATABITS_8, ...
31cee56c-ea2e-4bf9-abfe-d03324e794b3
1
public List<ElementInfo> getElementsOnPosition(Position pos) { final List<ElementInfo> elements = new ArrayList<ElementInfo>(); for (Element elem : grid.getElementsOnPosition(pos)) elements.add((ElementInfo) elem); return elements; }
1876c132-0a82-4f5c-9d20-0415f96a121e
5
public static ImageIcon importState() { if(isImChose) { if(isImPress) return imPre; if(isImHover) return imChoHov; return imCho; } if(isImPress) return imPre; if(isImHover) return imHov; r...
0235b04d-fa75-4336-8996-dd6c341ecb38
5
public boolean addCouponToDatabase(Coupon coupon) throws SQLException { if (couponExists(coupon)) return false; Connection con = sql.getConnection(); PreparedStatement p = null; if (coupon instanceof ItemCoupon) { ItemCoupon c = (ItemCoupon) coupon; p = con.prepareStatement("INSERT INTO couponcodes (na...
efd7320b-85dc-4993-a750-601b1b1cd848
6
public boolean hasCycle(ListNode head) { if (head ==null){ return false; } if(head.next == null) return false; if(head.next.next == null) return false; ListNode p_fast = head.next.next; ListNode p_slow = head.next; while (p_slow...
f74decc7-06cc-42b3-a43c-55f4d751a76c
5
@BeforeClass public static void setUpBeforeClass() { try { new MySQLConnection(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e...
9bef2df3-9746-477f-9871-dd5b0bc92957
1
public ProductDao getProductDao() { if (productDao == null) { productDao = new ProductDaoImp(); } return productDao; }
66cec8c4-dd9f-46c8-a6c6-ce13fce51d0e
3
public static void main(String argv[]) { try { String filepath = "c:\\file.xml"; DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(filepath); ...
9f11bc57-3ccd-4e12-8e13-b299856aeaf3
4
public void uploadArray(String vname,float defaultValue) throws UnknownHostException, IOException, WrongArgumentException, InterruptedException { creater = new ArrayCreater(conf, zone, this.shapes.get(this.shapes.size() - 1),vname,this.thread_num,defaultValue); int i ; int []srcShape = new int [chunk.getChunk...
29d463cc-4264-40df-bb8a-863c12ca3400
5
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "ok" - Data entry is complete // "cancel" - Cancel the request // "help" - Display help for investment accounts // try { switch (ae.getActionCommand()) { ...
7d3cea4d-1799-47f5-acc7-581e35bbbe46
8
private void printParts(String query, PartFactory partFactory, PrintStream psHtml, int maxRows) { TreeSet<Part> parts = new TreeSet<Part>(); for (Part part : partFactory) { if (partMatchesQuery(part, query)) { parts.add(part); if (parts.size() >= maxRows) { ...
9117bfc9-ce59-44dd-a77f-a8f43454eaac
5
private boolean getIsIdRightOrientedInEdge(int id, Edge edge){ if(id == edge.getIdA()){ //id is A if(edge.getType() == EdgeType.NORMAL || edge.getType() == EdgeType.INNIE){ return true; }else{ return false; } }else{ //id is B if(edge.getType() == EdgeType.NORMAL || edge.getType() == EdgeTy...
b7c83c75-7e58-4a93-8903-67c6cb86e5ab
9
private void readRLE(BufferedImage im, LittleEndianInputStream in) throws IOException { in.readInt(); // length int palSize = in.readInt(); if (palSize < 1 || palSize > 256) throw new FileFormatException("Invalid palette size"); int[] pal = new int[palSize]; for (int i = 0; i < palSize; i++) pal[i] =...
17336ee0-0cbd-4669-bf45-893ff1c99b4c
7
private void executeBattleCommand(String[] commandString, Player player) throws CommandException { if (AttackCommand.isAttackCommand(commandString[0])) { BattleFeedbackEnum feedback = null; AttackCommand firstCommand = AttackCommand.toCommand(commandString[0]); switch (firstC...
af7d49f7-cca6-452a-94a8-e726db8c1e11
1
public void setMinecraftArguments(String minecraftArguments) { if (minecraftArguments == null) throw new IllegalArgumentException("Process arguments cannot be null or empty"); this.minecraftArguments = minecraftArguments; }
cb5c06c3-0f39-4ac0-a02a-88cf163d1510
7
private void writeCurrentClassificationResultsForOneInterval( String classificationResultsFilename, int interval) throws IOException { // find maxHop byte maxHop = 0; for (byte hop : this.results.get(interval).getCorrelatedSpikesStats() .keySet()) { if (maxHop < hop) { maxHop = hop; } } ...
285ed9ad-d62d-4e7c-8861-fcda084f9bd8
4
public void attack() { if(monsterLP <= 0 || lifepoints <= 0) { System.out.print("The winner has been chosen"); } else { if(damage>monsterD) { int gap= monsterD-damage; monsterLP = monsterLP+gap; }...
0aa819d9-0a3b-4b1c-a7dc-f0513c4665b4
7
public List<Ability> returnOffensiveAffects(Physical fromMe) { final Vector<Ability> offenders=new Vector<Ability>(); for(final Enumeration<Ability> a=fromMe.effects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null)&&((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_POISON)...
e50f2b07-da63-43b1-97da-00d83ba70ac6
4
public Set<PointGame> getAdjacentPoints() { Set<PointGame> adjacent = new HashSet<PointGame>(); // Search in 4 directions: We are done each branch if // we run out of boundary or have found a valid point. // ---------------------------------------- // x+ direction: PointGame rightNeighbor = getRightNeighbor...
7e1cf1a3-ae51-44fc-b607-79208d6bd25c
2
public ArrayList<Account> getAccountNoMatchProject(Project project) { ArrayList<Account> result = new ArrayList<>(); for(Account account : accounts.getBusinessObjects()) { if (!project.getBusinessObjects().contains(account)){ result.add(account); } } return result; }
8c29a12a-8103-45e0-ba5e-b358b48e614b
9
public void run(){ try{ if(lport==-1){ Class c=Class.forName(target); daemon=(ForwardedTCPIPDaemon)c.newInstance(); PipedOutputStream out=new PipedOutputStream(); io.setInputStream(new PassiveInputStream(out , 32*1024 ...
c63f1e2d-7305-4af1-a0cb-f82359bc3d55
3
public void fireSelectionEvent(final SelectionEvent EVENT) { fireEvent(EVENT); final EventType TYPE = EVENT.getEventType(); final EventHandler<SelectionEvent> HANDLER; if (SelectionEvent.SELECT == TYPE) { HANDLER = getOnSelect(); } else if (SelectionEvent.DESELECT == ...
f7c35b74-5955-42fb-a331-e414ba757d18
7
public static String read_block(char[][] block, boolean row) { StringBuilder sb=new StringBuilder(); int r=block.length; int c=block[0].length; if(row) { for(int i=0;i<r;i++) { for(int j=0;j<c;j++) { if(block[i][j]!='\0') { sb.append(block[i][j]); } } } } else ...
8c07d8c0-f181-4cbb-8b08-52c8031b1b69
4
public boolean isWithinDistance(Location other) { if (z != other.z) { return false; } int deltaX = other.x - x, deltaY = other.y - y; return deltaX <= 14 && deltaX >= -15 && deltaY <= 14 && deltaY >= -15; }
de22d201-4268-4255-97b8-a79655fca155
3
public static IdParser createParser(String id) { if (SolexaFastqParser.matchID(id)) return new SolexaFastqParser(id); if (CasavaFastqParser.matchID(id)) return new CasavaFastqParser(id); if(NCBIFastqIdParser.matchID(id)) return new NCBIFastqIdParser(id); return null; }
70e73b3d-f983-410f-b2b0-0817f80458e2
5
public static void clean(ResultSet result) throws SQLException { if (!activeResults.containsKey(result)) return; WeakReference<PreparedStatement> ref = activeResults.get(result); boolean removeStatement = true; for (Entry<ResultSet, WeakReference<PreparedStatement>> ent : activeResults .entrySet()) { ...
6620ca69-3217-4658-8a74-e9e166e507a5
7
public void setText(String text) { if (text.equals("Main Menu")) { int i = 9; } if (!this.isSolidified() && !this.isSolidifying()) { this.initialText = text; return; } this.text = text; if (text.length() > maxChars) { for...