method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
49bb29be-ab3c-4b46-856c-9fa55ec2d921
1
public static void listManagersWith2Projects(EntityManager entityManager) { TypedQuery<Employee> query = entityManager.createQuery( "select m from Manager m where m.projects.size > 1", Employee.class); List<Employee> resultList = query.getResultList(); entityManager.close(); for (Employee employee...
5512b384-2204-47bf-8c5b-e6dd41f0eb9a
9
private void colorNeighboringO(int row, int column) { ArrayList<int[]> list = new ArrayList<int[]>(); int[] start = {row, column}; list.add(start); // int[] tmp = {0, 0}; int[] cPosition = {-1 , -1}; int cRow, cColumn; while (list.size() > 0) { cPosition = l...
f163fec7-6bd9-47b2-878a-f5343424ff11
7
private String GetWordsTwentyAndAbove(int number) { if (number % 10 == 0 && number < 100) return GetDoubleDigitWord(number); if (number < 100) return GetDoubleDigitWord(number - (number % 10)) + GetWordOneThroughTwenty(number % 10); if (number < 1000) { String...
eae9a492-3765-4320-a039-31e2cfbcf646
1
public Color getColor() { if(color != null) return color; return defaultColor; }
4f5b266e-10e1-4d8a-9ccc-9ec830957ff7
1
public static void insertLigneCommandeFournisseur( int idcommandefournisseur, int idarticle, int quantite, Float prixht, Float prixttc, Float remise) throws SQLException { String query = ""; try { query = "INSERT INTO LIGNE_COMMANDE_FOURNISSEUR (ID_CMDFOUR,ID_ARTICLE,LGCOMFOUQTE,LGCOMFOUPXH...
0b2bd62d-ee01-4be0-82ed-3d3ddafe5d16
0
@Test public void isEmptyRetunsTrueWhenEmptyTest() { BinaryHeap b = new BinaryHeap(); assertTrue(b.isEmpty()); }
a83f0425-5fa7-4b03-a38c-cbe91562c92c
9
void readMotif() { if (verbose) Timer.showStdErr("Loading Motifs and PWMs"); //--- // Sanity checks //--- String pwmsFileName = config.getDirDataVersion() + "/pwms.bin"; if (!Gpr.exists(pwmsFileName)) fatalError("Warning: Cannot open PWMs file " + pwmsFileName); String motifBinFileName = config.getBaseF...
b27075de-dddb-4b32-9e33-ce04b2369d62
0
public void setStatus(Status status) { this.status = status; }
17c8e5eb-879d-4ffb-9417-4d071753719b
2
public int maxSubArray2(int[] A) {// O(1) space if (A == null) return 0; int last = A[0]; int max = last; for (int i = 1; i < A.length; i++) { last = Math.max(A[i], last + A[i]); max = Math.max(last, max); // keep track of the largest sum } return max; }
c9d99905-349c-48f6-9479-c12fabee2d82
5
public final BooleanProperty selectedProperty() { if (null == selected) { selected = new BooleanPropertyBase() { @Override protected void invalidated() { if (null != getToggleGroup()) { if (get()) { getToggleGrou...
57b66c44-cdd5-446c-87e1-817aadd92a4a
0
@Test public void testSetPostition() throws IOException { System.out.println("setPostition"); int[] newPos = new int[2]; newPos[0] = 1; newPos[1] = 1; AntBrain ab = new AntBrain("cleverbrain1.brain"); Ant instance = new Ant(ab,true,0); instance.setPos...
78f9627a-9a15-4140-bb72-0dcbf6e86209
8
@Override protected ArrayList<PossibleTile> getLazyTiles(Board b) { ArrayList<PossibleTile> possibleTiles = new ArrayList<PossibleTile>(); int i = 1; boolean canSearch = true; while (canSearch) { PossibleTile pt = new PossibleTile(this.getX() - i, this.getY() - i, this); canSearch = decideToAddTile(b, po...
23c25380-8080-471a-bfc6-5e3b23ead45b
5
private Element generateLiteral(Document document, Literal literal, Tag xmlRootTag) { Element literalEle = document.createElement(xmlRootTag.getXmlTag()); Element atomEle = document.createElement(Tag.ATOM.getXmlTag()); atomEle.appendChild(document.createTextNode(literal.getName())); if (literal.isNegation()) ...
49e8df0e-7a25-441c-b864-70aabd55b40e
7
private static boolean multithread(final Option option) throws InterruptedException { Log.info("Using several threads: " + option.getNbThreads()); final ExecutorService executor = Executors.newFixedThreadPool(option.getNbThreads()); final AtomicBoolean errors = new AtomicBoolean(false); for (String s : option.g...
de6bb2fd-8296-4245-9871-a1163fce9a47
4
private static <T> Optional<T> loadOpt( Map<String, Object> map, String mapKey, String envVar, String javaProp, Function<String, T> fromString) { if (System.getenv(envVar) != null) { return Optional.fromNullable(fromString.apply(System.getenv(envVar))); } if (System.getPr...
b6838c1f-6d81-4916-9faf-16ebf63b1e72
8
public void openTray(DialogTray tray) throws IllegalStateException, UnsupportedOperationException { if (tray == null) { throw new NullPointerException("Tray was null"); //$NON-NLS-1$ } if (getTray() != null) { throw new IllegalStateException("Tray was already open"); //$NON-NLS-1$ } if (!isCompatibleLay...
720580ff-03e4-4a30-96fe-07902271a17b
3
public static int GetLargestKeyInHashMap(HashMap<Integer, Boolean> map) { int num = 0; for(int i = 1; i <= map.keySet().size() + 1; i++) { System.out.println(i); if(map.containsKey(i)) { if(i > num) { num = i; } System.out.println(num); } } return num; }
0c980a1f-3f01-45ed-861f-15aac98e69d4
1
public void setSaveOperand(final Block block, final boolean flag) { final int blockIndex = cfg.preOrderIndex(block); saveOperand[blockIndex] = flag; if (SSAPRE.DEBUG) { System.out.println(this); } }
18b6cd09-9f0c-4179-9870-6b23d5d596c5
0
public int getCost() { return cost; }
2b9335d5-e595-4360-9389-f0095596404d
7
private void flipColors(Node h) { // h must have opposite color of its two children assert (h != null) && (h.left != null) && (h.right != null); assert (!isRed(h) && isRed(h.left) && isRed(h.right)) || (isRed(h) && !isRed(h.left) && !isRed(h.right)); h.color = !h.color; ...
b8cf2749-c708-42fe-8fb5-595a2deb8c93
0
public String value() { return value; }
04ad7a1a-4c99-430a-b014-cc1fad16baac
8
@Override public void init() { /* 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://download.o...
da025eae-e109-40e6-81ca-6cc8c421043e
1
public void update(Avatar player,Map map,long gameTime) { for (MovingSquare movingSquare : movingSquares) { movingSquare.update(player,map,gameTime); } }
7373930f-f604-46dd-a635-0ccea52998ab
2
public FileSystemReplaceFileContentsHandler( String query, String replacement, FindReplaceResultsModel results, boolean isRegexp, boolean ignoreCase, boolean makeBackups, String lineEnding ) { super(lineEnding, false, FileContentsHandler.MODE_ARRAYS, Preferences.getPreferenceString(Preferences.OPE...
df7cd287-75da-417f-bc35-2849d85d4fd6
9
public static void writeFile(Preferences pref, File f, String content, boolean isBackup) { String fName = f.getAbsolutePath(); if (f.exists()) { if (!isBackup) { writeLog("File '" + f + "' already exists - not overwriting due to config option"); return; } File backup = new File(fNam...
d49de71a-d321-4d5b-a4df-8c2db577fb5d
4
private void colorHighTemp(int i, int j, long temp) { if (temp == MAX_TEMP) { drawing.setRGB(i, j, maxPoint); return; } if (temp == HIGH_TEMP) { drawing.setRGB(i, j, highPoint); return; } for (int k = 0; k < tempRangesHigh.length; k...
33dfe85a-c693-4b4c-ad46-f2ea9ded7055
8
private void buy(String type, int id) throws DataBaseConnectorException { if(type != null){ int cost = -1; if(type.equals("$tank$")){ cost = dataBaseConnector.getTankCost(id); } else if(type.equals("$armor$")){ cost = dataBase...
a9ae32bd-e738-4835-87e4-739c36f032a4
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
7b7e9bc6-89db-49d0-88b3-d375162bfc03
3
public boolean clientCom(String IP, String portNumber){ Integer port = Integer.parseInt(portNumber); if(!IP.isEmpty()){ try { InetAddress IPAddress = InetAddress.getByName(IP); clientTCPSocket = new Socket(IPAddress, port); System.out.println("...
dd3b2eb4-d20e-4a3d-bea8-d61b2c08a838
5
static ArrayList<Pair> surround(Pair start) { // System.out.printf("start is (%d, %d)", start.x, start.y); ArrayList<Pair> prlist = new ArrayList<Pair>(); for (int i=0; i<4; i++) { Pair tmp0 = new Pair(start); Pair tmp; if (i==0) { //if (start.x>0) { tmp = new Pair(tmp0.x-1...
5a0a7ca6-3329-4a1f-8e59-28b98c99be15
9
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[34]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 0; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if...
d20c4a82-96b7-4aa2-83c7-a09d367d3388
7
private boolean r_Step_1c() { int v_1; int v_2; // (, line 93 // [, line 94 ket = cursor; // or, line 94 lab0: do { v_1 = limit - cursor; lab1: do {...
1da83e35-a6d3-4c3f-aff1-866abda9f943
0
@FXML private void handleButtonAction(ActionEvent event) { System.out.println("Attack clicked"); handleAttack(); }
b1c98808-bc9c-4a85-812a-7afc7a713b29
9
private boolean isDestinationNode(int node, Network network) { boolean returned_value = false; Path fFilePath = network.getPath(); //Search for arterial links coming to this node File file_network = new File(fFilePath + "\\network.dat"); try (Scanner scanner_net = new Scanne...
eb622cd6-3b2f-426e-a308-a672d19eaf15
9
private boolean check() { if (!isBST()) StdOut.println("Not in symmetric order"); if (!isSizeConsistent()) StdOut.println("Subtree counts not consistent"); if (!isRankConsistent()) StdOut.println("Ranks not consistent"); if (!is23()) StdOut.println("Not a 2-3 tree"...
00d44a34-f2d2-465f-bf21-6a31d04d4bbe
1
public static PeerReference serializeHost(Host host) { if (host == null) { throw new NullPointerException("Cannot transform a null value to a CORBA object"); } return new PeerReference( host.getAddress().getHostAddress(), host.getPort(), ...
17079300-63df-4739-94b4-0fdc7ac11c1c
6
public static void DrawOddsRatioImage() { System.out.println("face vs non-face odds ratio image:"); for(int i = 0; i < FACE_HEIGHT; i++) { for(int j = 0; j < FACE_WIDTH; j++) { double odds = Math.log(isFaceProbilities[i][j]/nonFaceProbilities[i][j]); String denote = "#"; if(odds >= -0.05 && odd...
67da9571-11e2-4cf9-aa3a-37e303debb41
7
public boolean initEncrypt(String password) { if (password == null || password.length() < 1) { Application.getController().displayError(Application.getResourceBundle().getString("password_not_null_title"), Application.getResourceBundle().getString("password_not_null_message")); ...
7cd68a4d-f47c-4c49-9302-8c8b8e1617fc
0
public Consultar() { initComponents(); }
24ce0fdc-9fba-4139-9c7d-f65b22117dd1
1
public boolean canHaveAsCreditLimit(BigInteger creditLimit) { return (creditLimit != null) && (creditLimit.compareTo(BigInteger.ZERO) <= 0); }
9b1cb1a5-9e26-490b-8856-80f2cf2e2053
3
public void setEngine( CoreEngine engine ) { if ( this.engine != engine ) { this.engine = engine; for ( GameComponent component : components ) component.addToEngine( engine ); for ( GameObject child : children ) child.setEngine( engine ); } }
c48cb8b6-60b4-466a-9e7f-59121adde36b
8
public boolean matches(String id, String aclExpr) { String parts[] = aclExpr.split("/", 2); byte aclAddr[] = addr2Bytes(parts[0]); if (aclAddr == null) { return false; } int bits = aclAddr.length * 8; if (parts.length == 2) { try { ...
1ff3908c-b48c-4a9f-86d0-ede350992c01
2
public boolean isEnabled() { return comp.isEnabled() && comp.getSelectedText()!=null; }
44a45978-ce88-471c-a3c1-24ea42bc2e44
0
public int getPersonid() { return personid; }
b5565236-78e2-4c4b-999c-268d8dcdefaf
2
public void parse(String line) { init(); // Check record type if( !line.startsWith("@" + recordTypeCode) ) throw new RuntimeException("Header line is not type '" + recordTypeCode + "': " + line); // Split fields String fields[] = line.split("\t"); recordTypeCode = fields[0].substring(1); // Parse each ...
611ec1c7-f03d-428b-aadf-72ca68939074
2
private ItemStack[] importInventory(CompoundTag tag) { ItemStack[] inv = new ItemStack[36]; for (Tag t : ((ListTag) tag.getValue().get("Inventory")).getValue()) { int slot = ((ByteTag) ((CompoundTag) t).getValue().get("Slot")).getValue(); if (slot < 36) { inv[slot] = CraftItemStack.asBukkitCopy(n...
9b0457bd-4cc2-4f19-ae10-e8a4f042a02a
9
public void loadData(){ try { Files.lines(path).forEachOrdered(new Consumer<String>() { boolean headerDone = false; @Override public void accept(String t) { if(!headerDone && t.startsWith("----")){ headerDone = true; } else if(t.startsWith("date: ")){ try { date = dateSaveF...
85a01a16-6ce3-4777-87ed-7a4a1414e6e5
2
public boolean allOffersHaveStatus(String status) { List<String> services = this.getUserServiceList(); for (String service : services) { if (!hasStatus(service, status)) return false; } return true; }
91f9f507-5c31-4150-bb86-baaee14a709b
1
public static void main(String[] args) throws Exception { URL url = new URL("http://www.infoq.com"); // URLConnection conn = url.openConnection(); // // InputStream is = conn.getInputStream(); InputStream is = url.openStream(); OutputStream os = new FileOutputStream("info.txt"); byte[] buffer =...
aa48219a-3e95-4df6-a2e0-86abbf500f52
0
@AfterClass //Onde estava o erro @AfterClass e estava @After public static void tearDownAfterClass() throws Exception { //Prints.msg("AfterClass <--> Passei pelo tearDownAfterClass - Depois da Classe"); }
08ecaa31-998d-49ad-9a59-049f99706700
9
@Override public void mousePressed(MouseEvent e) { textArea = (OutlinerCellRendererImpl) e.getComponent(); // Shorthand Node currentNode = textArea.node; JoeTree tree = currentNode.getTree(); OutlineLayoutManager layout = tree.getDocument().panel.layout; // This is detection for Solaris, I thi...
0a977537-4c21-494a-9f23-3ca53ed851ee
4
public static void compile(String fileName, boolean opt) throws IOException { Program program = null; FileReader file = new FileReader(fileName); SFECompiler compiler = new SFECompiler(file); try { program = compiler.compileProgram(); } catch (ParseException pe) { System.er...
bfea72c7-f1ed-446a-94fd-c2cc28eff0ae
4
public String result(String string) { if (list.contains(string)) { return ""; } if (string.length() <= 2) return ""; if ((matcher = Pattern.compile(reg2).matcher(string)).find()) return ""; if ((matcher = Pattern.compile(reg1).matcher(string)).find()) return ""; /*if(string.equals("-lrb-")||stri...
e69cf65d-eef2-4d4b-bade-df90a6c06aa6
4
private ArrayList<Layer> createNodes(int numberOfInputs, int[] numberOfHiddenNodes, int numberOfOutputs){ ArrayList<Layer> layers = new ArrayList<Layer>(); Layer inputLayer = new Layer(); for(int i = 0; i<numberOfInputs;i++){ inputLayer.addNode(new Node()); } layers.a...
8b732925-41cb-412f-a6a5-223c3e1156d6
2
public IDataLayer getDataLayer() { SettingsManager sm = SettingsManager.getInstance(); if (sm.getPersistenceType().equalsIgnoreCase("sqlite")) { System.out.println("Initialize Sqlite Datalayer..."); DataLayerSqlite dls = new DataLayerSqlite(); dataLayer = dls; } else if (sm.getPersistenceType().equalsIgn...
ba57bb50-dd27-4825-b21e-49a8fb0f636f
0
public static void addLastItem(JComponent component, Container container) { GridBagLayout gridbag = (GridBagLayout) container.getLayout(); component.setMaximumSize(component.getPreferredSize()); c.weighty = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.gridwidth = GridBag...
13979e26-3bf3-4cac-92b1-9bf3ea66132f
3
public Pawn getSquareContent(final int x, final int y) { for (Pawn p : pawns) { if ((p.getX() == x) &&(p.getY() == y)) { return p; } } return null; }
ea30a515-1655-4023-86da-d2f611f92431
8
@Override protected boolean parseCliValue() { if (("true".equals(cliValue)) || ("enable".equals(cliValue)) || ("1".equals(cliValue)) || ("yes".equals(cliValue))) { value = true; return true; } if (("false".equals(cliValue)) || ("disable".equals(cliV...
c3d76b3b-13c3-4153-992c-65d6c639d8a5
1
public static void main(String[] args) { for(char c : "Java SE".toCharArray() ) System.out.print(c + " "); }
6dc6ff79-e7f5-4233-b845-9164641a53f4
1
public boolean update(Administrador admin){ PreparedStatement ps; try { ps = mycon.prepareStatement( "UPDATE Administradores "+ "SET passwd=?, dni=? "+ "WHERE userName=?" ); ps.setString(1, admin.getPassword()); ...
38dbb8e4-6219-4755-a9ba-99db37fee55e
2
private void doreport(Report r) throws IOException { if(!status.goterror(r.t)) return; URLConnection c = errordest.openConnection(); status.connecting(); c.setDoOutput(true); c.addRequestProperty("Content-Type", "application/x-java-error"); c.connect(); ObjectOutputStream o = new Ob...
00ab4042-c875-43f5-81f3-d7acd0bf0d7f
5
public static void openConnection() { try { DB_URL = loader.getDbConnection(); USER = loader.getDbUser(); PASSWORD = loader.getDbPass(); } catch (Exception e) { e.printStackTrace(); } try { Class.forName( DRIVER_PATH ).newInstance(); conn = DriverManager.getConnection( DB_URL, USER,...
7c824dfd-3afb-4f2f-8794-760537ef2a8e
5
public int[] getNearestNeighboursElementIds(long[] key, int beamRadius) { ReferenceBlock containingBlock = getBlockFor(key); ReferenceBlock lowerBlock = null; ReferenceBlock higherBlock = null; IntList neighbours = new IntArrayList(3 * blockSize); if (containingBlock == null) { highe...
b9a53b62-3991-4299-a868-c93edc38c739
1
public boolean matchFirst(char a, char b){ return (b == '.' || a == b); }
6d87395a-be27-49e0-8b36-9d17cccf7f14
2
public void write(String chaine) throws IOException { for (int i = 0; i<chaine.length(); i++) { this.writeBit(Character.getNumericValue(chaine.charAt(i))); } if (this.bits != 0) { this.ecrire.write(this.bits); } this.ecrire...
6f4fddb7-83ce-49ce-998b-66b8a3de5d7c
7
private boolean saveInternal(File file, boolean isInternal) { if (!isInternal && readOnly) { // unexpected situation, yet it's better // to back it up System.err.println("Attempt to save read-only map."); return false; } try { // Generating output ...
a83db223-9054-4bc9-ba2a-f29e7da2699b
8
FetchData fetchData(FetchRequest request) throws IOException { long arcStep = getArcStep(); long fetchStart = Util.normalize(request.getFetchStart(), arcStep); long fetchEnd = Util.normalize(request.getFetchEnd(), arcStep); if (fetchEnd < request.getFetchEnd()) { fetchEnd += ...
20b3069b-075b-41a1-b052-9b89b47fb1a3
1
private String extractHead(String idref) throws IDrefNotInSentenceException { String headIDref = sentence.getNode(idref).getHeadIDref(); if (headIDref != null) return sentence.getNode(headIDref).getAttributes().get("lemma"); return "NOHEAD"; }
73ce40d2-2781-47c4-8fb1-5a930877407c
6
public void onBlockRemoval(World par1World, int par2, int par3, int par4) { byte var5 = 4; int var6 = var5 + 1; if (par1World.checkChunksExist(par2 - var6, par3 - var6, par4 - var6, par2 + var6, par3 + var6, par4 + var6)) { for (int var7 = -var5; var7 <= var5; ++var7) ...
eab54cff-10a3-4e1d-b011-dfee9ab77957
8
public void setLabels(String value) { int i; String label; boolean quoted; boolean add; m_Labels.clear(); label = ""; quoted = false; add = false; for (i = 0; i < value.length(); i++) { // quotes? if (value.charAt(i) == '"') { quoted = !quoted; if (!...
1598af58-493e-4458-9aae-093c46c37c42
1
private void MergeSort(int low, int high) { if (low < high) { int mid = low + (high - low) / 2; // Sorting lower end of array MergeSort(low, mid); // Upper lower end of array MergeSort(mid + 1, high); // Merging both ends of the ar...
82cd612a-bf4b-4fef-a6f1-495aa47a3b04
3
private void renderFocusNagger() { String msg = "Click to focus!"; int xx = (WIDTH - msg.length() * 8) / 2; int yy = (HEIGHT - 8) / 2; int w = msg.length(); int h = 1; //screen.render(xx - 8, yy - 8, 0 + 13 * 32, Color.get(-1, 1, 5, 445), 0); //screen.render(xx + w * 8, yy - 8, 0 + 13 * 32, Color.get(-1,...
173149cd-4a67-4559-9f6b-7bfbda44f1ea
8
static void updateaudiostream() { bytesCopiedToStream = 0; short[] data = stream_cache_data; int stereo = stream_cache_stereo; int len = stream_cache_len; int buflen; int start, end; if (stream_playing == 0) { return; /* error */ } bu...
610e2032-7a7f-4381-89fe-75fb0c81b69a
7
public static void main(String[] args) { // Validate that one argument is passed if (args.length == 0) { System.out.println("Please provide a search string to search."); System.exit(0); } else if (args.length > 1) { System.out.println("Only one argument should be passed."); System.exit(0); } ...
7fb3a44d-05d6-48aa-ad26-1f57a0f86332
3
public String toStandard(){ return String.format("%d:%02d:%02d %s", ((hour == 0 || hour == 12 ?12 : hour%12)), minute, second,(hour < 12 ? "AM": "PM")); }
c19e35c7-7998-491d-91ee-88dda8e49c87
9
private void initComponents() { setLayout(new BorderLayout()); final List<Image> icons = new ArrayList<Image>(); icons.add(new ImageIcon(TallyDialog.class.getResource("/icons/calc16.png")).getImage()); setIconImages(icons); setModalityType(ModalityType.MODELESS); setP...
5ee40a6c-842f-41c0-945e-66fd7749a012
6
private boolean addFaultyFrame() { String name; boolean ret = false; Faculty faculty = new Faculty(); // Цыкл необходим для того, что бы было несколько попыток у пользователя do { name = SMS.input(this, "Введите название факультета:"); if (name != null) { ...
0480c28c-0e59-4d53-bb45-e4f4e50e6dec
5
public boolean accept(File pathname) { if (pathname.isDirectory()) return recurse; String name = pathname.getName(); if (! name.endsWith(extension)) return false; int lastNumberIndex = getLastNumberIndex(name); if (lastNumberIndex == -1) return false; int numEndLoc = lastNumber...
6fcfd2c3-11ba-49c8-8a4b-85d6ab6e9b42
1
public void onTick() { resultant = getResultant(); acceleration = Vector.multiply(resultant,1D/mass); try { velocity = Vector.add(velocity,Vector.multiply(acceleration, 0.05)); position = Vector.add(position, Vector.add(Vector.multiply(velocity, 0.05), Vector.multiply(acceleration, -0.5*Math.pow(0.05, 2))))...
0fe570ad-aada-4d60-85c7-46d1d4533684
1
private void processFileAction() { try { log.info("Processing from: " + reportFolder.getText()); sourceProcessing.processExcelFiles(reportFolder.getText()); } catch (Exception e) { log.log(Level.SEVERE,e.getMessage(),e); Run.showErrorDialog(this.getSelfRef(), "An error occurred processing the mus...
11e5c7e8-0378-4d5d-be44-de679799e5c1
0
public BST getTermIndex() { return termIndex; }
d35fa1b7-1263-4828-9f9b-d7b02faddf91
0
@Override public SkillsMain[] getSkillNames() { return Constants.priestSkillSkills; }
18caaf9b-a7be-4616-a314-f253a8c35db0
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...
f9aeba0a-1d8d-4fa4-9e22-67e3610d049b
6
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode head = new ListNode(0); ListNode p = head; while(l1 != null && l2 != null) { if(l1.val < l2.val) { p.next = l1; l1 = l1.next; } else { p.next = l2; ...
930c760b-0db1-47e7-b5c4-09b679dfab2a
3
private void itmMnuGerenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuGerenteActionPerformed // Menu - Cadastro > ItemMenu - Gerente DepartamentoBO depBO = new DepartamentoBO(); Departamento DEPexistente = null; try { DEPexistente = depBO.SelectDepart...
b2926ee7-c59d-4e1a-b0ef-570b91a9a604
4
public String getStrategy() { if (strategy == null) { throw new RuntimeException("Missing strategy."); } if (!strategy.equals(SimConst.MEAN) && !strategy.equals(SimConst.INDIVIDUAL) && !strategy.equals(SimConst.BINARY)) { throw new RuntimeException("Strategy " + strategy ...
ba9e8f2d-0ebf-4ab3-bfac-dc5597f2dd91
8
public String toString() { StringBuilder sb = new StringBuilder(HawkContext.SCHEME); char delim = BLANK; if (id != null) { sb.append(delim).append("id=\"").append(id).append(ESCDQUOTE); delim = COMMA; } if (mac != null) { sb.append(delim).append("mac=\"").append(mac).append(ESCDQUOTE); delim = COM...
1f9f44ee-cd44-4e62-9248-1ea1a881ff62
1
@Override public JSONObject getValueForOutput() { try { return this.user.toJson(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return new JSONObject(); } }
103fc962-cef4-488d-8c97-12055e768656
4
public boolean canMove(int direction) { Grid<GridActor> gr = getGrid(); if (gr == null) return false; Location loc = getLocation(); Location next = loc.getAdjacentLocation(direction); if (!gr.isValid(next)) return false; GridActor neighbor = gr...
7f5dbe6c-cf9e-45e8-8c3c-63731080535b
2
public ReceptDTO getRecept(int receptId) throws DALException { ResultSet rs = Connector.doQuery("SELECT * FROM recept WHERE recept_id = " + receptId); try { if (!rs.first()) throw new DALException("Recepten " + receptId + " findes ikke"); return new ReceptDTO (rs.getInt(1), rs.getString(2)); } catch (SQLE...
ff4762d6-5f94-4db4-b469-8d24cb6446dc
8
private static Map<String,String> initializeSTR2CODE() { int num = 0; int asciibase = 'A'; Map<String, String> retval = new HashMap<String, String>(); for (int xi = 0; xi < codechars.length; xi++) { retval.put(codechars[xi], Character.toString((char) (num + asciibase))); num+...
b2198222-633c-4761-9146-6e8ea6a21b4a
6
@Override public void saveSettings(HashMap<String, String> settingsToSave) { Set<String> keys = settingsToSave.keySet(); Iterator<String> keysIterator = keys.iterator(); String key; while(keysIterator.hasNext()) { key = keysIterator.next(); if(key.equals("minimizeToTray")) { System.out.println("mini...
f07bdf19-9d57-4a0a-a919-80ba28898377
0
private boolean hasMatchedWord(String phoneNum) { return dictionary.hasMatchedWord(phoneNum); }
d9e24d8d-01a3-485f-b06a-2f08f0570f0f
3
public ReadResponse(InternalResponse resp) { super(resp); try{ JSONObject rootJsonObj = new JSONObject(resp.getContent()); Response.withMeta(this, rootJsonObj); JSONObject respJson = rootJsonObj.getJSONObject(Constants.RESPONSE); Object dataObj = respJson.get(Constants.QUERY_DATA); ...
5ceb203d-09c1-4f34-b556-a0487b0b4e20
1
protected void sendConnectionHeaderIfNotAlreadyPresent(PrintWriter pw, Map<String, String> header) { if (!headerAlreadySent(header, "connection")) { pw.print("Connection: keep-alive\r\n"); } }
ad4c7658-37ba-40ee-a94b-770332f7d14d
5
public LawnMowersController(final String fileName) throws IOException,FileFormatException, NoMowerFoundException { lawnMowerControllers = new ArrayList<LawnMowerController>(); String lawnConfiguration = null; BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); S...
6b47ede3-5df0-4c15-b757-1762d02c5c2f
1
public Decoder() { for (int i = 0; i < 4; i++) m_PosSlotDecoder[i] = new BitTreeDecoder(6); }
00457631-0ddf-48e9-957c-bb0d3647296f
9
public void doBackup(File directory) throws Exception { if (!directory.exists()) { directory.mkdir(); } RequestContext rc = RequestContext.getRequestContext(); if (this.authStore != null) { Auth auth = this.authStore.retrieve(this.nsid); if (auth == ...
71a21fb4-731d-453e-8b9f-f25deb1b4de2
9
private int aslW(int dest, int n) { clearFlags(SR_N, SR_Z, SR_V, SR_C); boolean hibitSet = msbSetW(dest); boolean hasOverflow = false; int result = dest; boolean msbSet; for (int i = 0; i < n; i++) { msbSet = msbSetW(result); if (msbSet) setFlags(SR_X, SR_C); else clearFlags(SR...
fc254c02-9297-4824-b160-7d935578775d
6
public RandomArgument(Program p, ArgumentType type, String labelName, Condition condition) { super(p, type, labelName, condition); switch (type) { case REGISTER: value_register = p.getRandomRegister(false); break; case VREGISTER: va...