method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b63c3c2a-a43a-4edd-ac4e-dcd47d164eb9
3
public static String kuvaFormaatti(String kuvanNimi) { String teksti = kuvanNimi; teksti.toLowerCase(); if (teksti.endsWith(".png")) { return "png"; } if (teksti.endsWith(".gif")) { return "gif"; } if (teksti.endsWith(".jpg")) { ...
1e1e448c-810c-442b-b518-1362bfa2cd86
3
private void setupListeners() { saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent click) { Game tempGame = baseController.makeGameFromInput(titleField.getText(), rankingField.getText(), rulesArea.getText()); if (tempGame != null) { ...
5d323169-f37f-49cf-bdcb-ba03179f71cc
9
private boolean executaComando(char comando, String parametros) throws MVNException{ switch(comando){ case CMD_INICIALIZA: initialize(); break; case CMD_ASCII: loadTextFiletoMemory(parametros); break; case CMD_EXECUTA: executa(ExtractArguments(parametros)); break; case CMD_DEBUG...
3703e3dc-bcf9-46a2-a46e-a6cb183b3332
0
public void create() { frame = new JFrame(TITLE); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE)); frame.pack(); frame.setLocationRelativeTo(null); frame.add(this); frame.setVisible(true); }
84d71fad-7b76-4afe-b94b-a2471c472375
4
public int[] calculateDragDistance() { int[] distances = new int[2]; int startX = clickX; int startY = clickY; int currentX = mouseX; int currentY = mouseY; if (startX < currentX) { distances[0] = +(currentX - startX); } if (startX > currentX) { distances[0] = -(startX - currentX); } if (start...
d2de2e3f-efc9-492b-a2d6-612cd3aecc62
9
public boolean pickAndExecuteAnAction() { synchronized(marketbills) { for (MyMarketBill mb : marketbills) { if (mb.state == mbState.unpaid) { payMarketBill(mb); } } } synchronized(uncomputedChecks) { for(Check c: uncomputedChecks) { if(c.state == CheckState.uncomputed) { c.sta...
63f350bb-55e8-412d-b828-b0f8d052ea55
1
@Override public void run(){ try{ say(s,""); say(s, "Sorry, there are too many users."); say(s, "Server message: too many users"); } catch(Exception e){ e.printStackTrace(); } }
d615aee6-f74f-4c26-9b49-eeef15adcf42
1
private JLabel getLblSongName() { if (lblSongName == null) { lblSongName = new JLabel("Song name :"); lblSongName.setBounds(10, 81, 86, 14); } return lblSongName; }
f54af83f-5015-4492-8b63-1db72121a02d
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean.T...
f6049083-dc68-4916-8a5f-ba6e1d5e0d8a
6
@Override public void updateCourses(List<Integer> mainCourseList, List<Integer> additionalCourseList, int userId) throws SQLException { Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDriver")); connect = ...
36f76a61-5d53-4e4a-a82f-45eb26150cc8
4
public void run() { // Set colors setBodyColor(new Color(128, 128, 50)); setGunColor(new Color(50, 50, 20)); setRadarColor(new Color(200, 200, 70)); setScanColor(Color.white); setBulletColor(Color.blue); // Prepare gun trackName = null; // Initialize to not tracking anyone setAdjustGunForRobotTurn(tr...
b8c71153-5651-456f-bc5d-b45e8fcb9ce3
1
private void generateHardwareSystemAlternativesEP() { int alternatives = 1; int possibilities[] = new int[project.getHardwareSets().size()]; int repetitions[] = new int[project.getHardwareSets().size()]; int i = 0; for (HardwareSet hws : project.getHardwareSets()) { alternatives *= hws.getHardwareSetCheape...
9ea4ad32-09d0-4c8e-b566-d4a1a2b3482f
7
@Override public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) { if( failed ) { return HandshakeState.NOT_MATCHED; } try { if( !response.getFieldValue( "Sec-WebSocket-Origin" ).equals( request.getFieldValue( "Origin" ) ) || !basicAccept( response ) ) { ret...
145c0b50-e604-49ce-9665-231a69470797
3
public String returnInsertColumnsDefine() { StringBuilder sb = new StringBuilder(); List<String> list = columnMap.get(this.getClass()); int i = 0; for (String column : list) { if (isNull(column)) continue; if (i++ != 0) sb.append(','); sb.append("#{").append(column).append('}'); } return ...
8d7a370f-ed57-4f90-b9a5-d99ef25c14a5
1
private void sendAsChunked(OutputStream outputStream, PrintWriter pw) throws IOException { pw.print("Transfer-Encoding: chunked\r\n"); pw.print("\r\n"); pw.flush(); int BUFFER_SIZE = 16 * 1024; byte[] CRLF = "\r\n".getBytes(); byte[] buff = new byt...
59bb39bd-77e6-454b-8bf4-ef5106aab8eb
1
@Override public int hashCode() { return isAlive ? 1231 : 1237; }
af8fdb48-da9f-47e8-88a0-39f02f704d24
6
private void loadWorlds() throws DynmapInitException { for (DynmapWorld world : dynmapConfig.getWorlds()) { logger.info("Checking World " + world.getName()); AbstractFile dynmapWorldConfig = null; try { dynmapWorldConfig = getFile("standalone/dynmap_" + world...
26bc4e4b-130f-4418-8c22-e709b578c8fe
7
public void loadAlphabets(String filename) { try { File f = new File(filename); Scanner s = new Scanner(f); String line = null; List<String> dot_mat_alpha = new ArrayList<String>(); if(s.hasNext()) characters = s.nextLine(); int i = 0;...
3a274596-8ca7-443b-ac2d-3b0ece35e4d2
0
public static void decTrigger() { idTrigger--; }
1e59f600-f70b-4251-8770-0c79d6396e6c
8
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; int v_4; // (, line 175 // setlimit, line 176 v_1 = limit - cursor; // tomark, line 176 ...
9b07c0ce-f8a5-476d-b235-77f756be6038
9
public void close(){ try { List<User> f = pod.getFriendList(); //récupère la liste d'ami //on la stocke dans un JSONArray JSONArray t = new JSONArray(); for(int i = 0 ; i < f.size() ; i++) t.put(i, f.get(i).getLocation()); //On récupère les amis qui était dans l'ancien fichier stocker l...
56527950-7aeb-4a36-a82b-d06bb59d8b93
5
public void singlePlayerMove(Object source, int indexPosition) { boolean legalMove = false; legalMove = singlePlayerGame.selectSquare(indexPosition); if (legalMove) { // Draw board moves on board setOpponentsMove(singlePlayerGame.getComputersMostRecentMove()); ...
3304cdd6-50ad-4c9f-bc7d-70aa1ece84fd
1
public void test_getValue_long() { assertEquals(0, iField.getValue(0L)); assertEquals(12345, iField.getValue(12345678L)); assertEquals(-1, iField.getValue(-1234L)); assertEquals(INTEGER_MAX, iField.getValue(LONG_INTEGER_MAX * 1000L + 999L)); try { iField.getValue(LONG...
cefb3e4c-39e2-4af0-b8d4-8fc1c91c65e1
9
@Override public MapObject doNextAction(MapEngine engine, double s_elapsed) { if (is_cloaked && cloak_time_left < 0.0) { is_cloaked = false; is_visible = true; playPublicSound("effects/cloakoff.wav"); } MultipleObject created_objects = new MultipleObject(); if (!death_spin_started) {...
e3b420dd-2e1c-45ac-aa7c-47eb92184dd8
3
public static void load(int track) { // TODO Auto-generated constructor stub switch (track) { case 0: splash = loadMusic("splash.ogg"); break; case 1: game = loadMusic("game.ogg"); break; case 2: kill = loadMusic("kill.ogg"); break; } }
dadf7c5f-0c76-4cfb-8bd7-1859b566d9bb
2
public Hole getHole(int holeNumber) { for (Hole hole : holes) { if (hole.getHoleNumber() == holeNumber) { return hole; } } return null; }
de615f6c-9c7a-469c-be3c-58175436e327
2
public void setColorArray(String id, Color[] color) { int count = 0; for(int i=0;i<identity.size();i++) { if(identity.get(i).contains(id)) { attrib_colors = new Color[2]; attrib_colors[0] = color[count]; //Color attrib_colors[1] = colors.get(i)[1]; //Textcolor colors.set(i, attrib_c...
1500c660-1f63-4f63-b8bd-8cc9a8511a67
0
@Override public void signalEndOfData() { taskAcceptor.signalEndOfData(); }
f41acb6a-16f6-40fd-a15b-d97d4d8c39d7
9
public void stripFunction(){ //set validness of filename to false as initialization and other general initialization boolean valid=false; //if inputs are valid String inFileName=_curDir; //input filename String outFileName=_saveDir; //output file name int overrideChoice=-1; //for override button choice Stri...
2b273055-f0e8-46e3-a526-7288b313851b
7
public void mutate(int strandIndex, int mutatorKind, int index, Nucleotide nucleotideTo) { Strand strand = getStrand(strandIndex); if (strand == null) return; Mutator mutator = strand.getMutator(mutatorKind); if (mutator == null) return; if ((mutator instanceof SubstitutionMutator) || (mutator instanceo...
adbc4865-0eab-4b6d-8275-f1aefe029fcc
0
public void setLives(int a){ lives = a; }
11e3bc89-3e75-401b-9159-49360f4957c2
3
public void fusionWithAddFullAlpha(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha1 = (c...
0df9812e-71be-4593-951f-05a5d6ea52d5
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { Physical target=mob; if((auto)&&(givenTarget!=null)) target=givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",...
4f3274e6-b139-4353-8705-649cfc498488
4
public static String getJailer(String playerName){ String banner = "Not Jailed"; if(isJailed(playerName)){ try { SQL_STATEMENT = SQL_CONNECTION.createStatement(); SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'"); // This loop check...
26fcbea1-c308-46e5-8f45-961c97145820
8
@Override public void updateItem(Boolean item, boolean empty) { super.updateItem(item, empty); if(item!=null){ chkCell.setSelected(item); setGraphic(chkCell); chkCell.setOnKeyPressed( new EventHandler<KeyEvent>() { ...
cf650a23-ea38-4373-aead-104b58e3e58a
7
public ModelAppResponse handleRequest(HTTPRequest request, BufferedReader is) { ModelUser user = authenticateUser(request); if (isExcludedSecurity(request)) { user = (user == null) ? ModelUser.annonymous() : user; } if (isLoginRequest(request)) { return routeLogin(request, user); } else if (user == nul...
72e80ec6-6e76-470d-8bf8-480b2f176689
7
public void cliqueFinRedeploiement() { if( joueurEnCours.getPeuple().getNbUniteEnMain() == 0 ){ if ((etape == 2 || etape == 3)) { if (Game.getInstance().askConf("Confirmer la fin du redéploiement ?")) { if (etape == 2) { if (tempEnDeclin) { joueurEnCours.getPeuple().decliner(); ...
5cd43f97-3287-4b22-8346-bdd05e9be409
0
@Override public void mouseClicked(MouseEvent e) { }
9a763401-8ac2-4394-bf0d-df210a5c4aa0
2
private String getExtension(String f) { // get extension of a file String ext = ""; int i = f.lastIndexOf('.'); if (i > 0 && i < f.length() - 1) { ext = f.substring(i + 1); } return ext; }
ab5584a6-05b6-42f6-8296-d9fc9d9f4bc8
5
private boolean isInBounds(int var1, int var2, int var3) { return var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height; }
fc06ed7d-7e09-44c7-9134-a44faf74140f
3
protected void pack(byte[] src, int[] dest, int destOffset) { assert destOffset + (src.length / 4) <= dest.length; int i = 0, shift = 24; int j = destOffset; dest[j] = 0; while (i < src.length) { dest[j] |= ((src[i] & 0xff) << shift); if (shift == 0) { ...
ccae655d-d248-4330-b36a-e170732d1ce3
7
public static Cons mostGeneralCollections(Cons descriptions) { if (descriptions.rest == null) { return (descriptions); } { Cons cursor1 = descriptions; Cons cursor2 = null; Stella_Object value1 = null; Stella_Object value2 = null; while (!(cursor1 == Stella.NIL)) { val...
b1bde972-6c5f-41fa-87b9-a5a88eae96db
6
private Direction getDirection(){ List<Direction> directionList = new ArrayList<Direction>(); //Determine if //Calculate the distances from all possible directions for(int i = 0; i < Direction.Orientation.values().length; i++){ int[] relativeCoordinate = (Direction.Orientation.values()[i]).directio...
ee792375-3afb-4acd-80ee-aeb5d3994e75
1
public String getOpiskellutAsiat(){ String palautettava = ""; ArrayList<String> opiskellut = ajastimenTiedot.getOpiskellutAiheet(); for (String opiskeltu : opiskellut) { palautettava += opiskeltu + " "; } return palautettava.substring(0, palautettava.length()-1); //po...
690ba987-d491-4e5c-8c11-b3f2ce41dd90
9
protected void renderContinuousSegment() { /* A lazy but effective line drawing algorithm */ final int dX = points[1].x - points[0].x; final int dY = points[1].y - points[0].y; int absdX = Math.abs(dX); int absdY = Math.abs(dY); if ((dX == 0) && (dY == 0)) return; if (absdY > absdX) { final int inc...
a2a2e3dd-a640-42b9-916c-83deb7817cf1
3
public void print(){ for (String index : cache.keySet()) { for(String tag : cache.get(index).records.keySet()){ for(String offset: cache.get(index).records.get(tag).words.keySet()){ System.out.print(" " + index + " " + tag + " " + offset + " " + cache.get(index).records.get(tag).words.get(offset)); } ...
b6811e82-7424-489c-8c7d-5518f573e57c
9
public void createVehicles(int numVehicles){ ArrayList<Vehicle> v= Vehicle.getVehicleArray(); for(int k=0; k<numVehicles; k++){ double number= Math.random()*4; if(number>=0 && number<1) v.add(new Car(this)); if(number>=1 && number<2) v.add(new Ambulance(this)); if(number>=2 && number<3) v.ad...
9f2cf910-b73f-4596-b41d-f260bf458fc1
8
public int getLineIdByNameAndPassword(String name, String password) { try { if(name.equals("D1") && password.equals("dev_password1")) return -11; else if(name.equals("D2") && password.equals("dev_password2")) return -12; Scanner scan = new Scanner(this); int num =...
bd7a81f0-2f3a-4276-bd7d-7859599d7a1a
2
private synchronized void calcSimilarity(ArrayList<CompareResult> compareResults) { for (CompareResult result : compareResults) { if (_similarity < result.getSimilarity()) { _similarity = result.getSimilarity(); } } }
ed7be6f6-2bf8-45b7-bb44-e1ba629c1edd
1
public void run() { try { log.debug(this.taskName + " : is started."); Thread.sleep(10000); log.debug(this.taskName + " : is completed."); } catch (InterruptedException e) { log.error(this.taskName + " : is not completed!"); e.printStackTrace(); } }
40315fd3-ab46-49f8-91e4-4ce3a724e86d
5
private static boolean isLanguageModelCreated(String grammar, boolean deleteOnExit){ boolean isLanguageModelCreated = false; // Ensure that the files were created successfully File lm = new File(grammar + ".lm"); File dmp = new File(grammar + ".DMP"); // Check if the files exists...
efc8b412-22f7-4d54-b46f-57af38c7d1a7
0
public Controller(View _view, ActionDispatch a) { }
3d0b5c3a-ef0c-428f-87ca-ef711d4d906d
2
private PhongShader() { super(); addVertexShaderFromFile("phongVertex.vs"); addFragmentShaderFromFile("phongFragment.fs"); compileShader(); addUniform("transform"); addUniform("transformProjected"); addUniform("baseColor"); addUniform("ambientLight"); addUniform("specularIntensity"); addUn...
42629357-e0de-4d8a-b85d-2b4ca97a302b
7
private void moveShuffled(){ shuffling = new HashMap<String, Multimap<String, Double>>(); HashMap<String, Multimap<String, Double>> lastCore = combinedShuffling.get(combinedShuffling.size()-1); for (String str : lastCore.keySet()){ Multimap<String, Double> mhsd = ArrayListMultimap.create(); for (String hs :...
d273757c-1b3e-486c-9dba-892096f7d672
7
protected void scaleNumericPredictions() { double maxErr; double minErr; double err; int i; Double errd; double temp; maxErr = Double.NEGATIVE_INFINITY; minErr = Double.POSITIVE_INFINITY; // find min/max errors for (i = 0; i < m_PlotSizes.size(); i++) { errd = (...
5d7f3623-6c51-4bbc-b435-38028dddced4
9
public static void main( String[] args ) { final RobotState rs = new RobotState(); final RayCaster rc = new RayCaster( 32, 32 ); for( int i=0; i<1024; ++i ) rc.walls[i] = true; Random r = new Random(); int tx = 16, ty = 16; for( int i=0; i<1024; ++i ) { rc.putWallAt( tx, ty, false ); //ty += 1; ...
deb7c4d1-c8fa-4f83-a02c-5a7872c9db40
8
public static Parser rulesParserFromReader( BufferedReader src ) { try { StringBuffer result = new StringBuffer(); String line; Map prefixes = new Map(); // List preloadedRules = new ArrayList(); List preloadedRules = new List(); while ((line = src...
46be431f-9f8a-43ef-9b6a-b0c5a40dd3e3
0
public void AddInputPacket(RouterPacket dPacket, int bufferNumber) { //put a packet in the chosen buffer inputBuffer[bufferNumber].add(dPacket); System.out.println("Time: "+GetTime()+" --> Delivered packet#: "+dPacket.GetSequenceNumber()+" to InputBuffer: "+bufferNumber+" PacketTIME:...
1ad32ef3-18ab-4659-b3d2-5ba69a7919db
1
public int getWidth() { return (this.getHeight() < 1) ? 0 : this.pic[0].length(); }
a6dbc0e1-f84c-48fc-bd6f-4a8f40990e4c
1
@Override public final Configuration get() { try { XmlConfigurationReader xmlConfigReader = new XmlConfigurationReader(componentName); return new MojoConfiguration(authorUrl, publishUrl, dispatcherUrl, xmlConfigReader); } catch (Exception e) { throw new ProvisionE...
0fd45990-d0fd-4ac4-9f4d-b99b5b702f6e
9
public static void helpInsertACsValue(KvCons kvcons, Stella_Object newvalue, Context target, boolean overwriteP) { { int contextnumber = target.contextNumber; for (;;) { if ((!Stella.$CONTEXT_BACKTRACKING_MODE$) && (Stella.$UNLINK_DISCARDED_CONTEXTS_ON_WRITEp$ && (((((Context...
d6ca480d-8ac1-44d0-b2ba-4e41302f7237
5
@Override public void update(int mouseX, int mouseY, boolean pressed) { super.update(mouseX, mouseY, pressed); if(this.btnBack.wasClicked()) Game.instance.setCurrentGui(this.parent); if(this.btnNext.wasClicked() && this.page < 2) this.page++; if(this.btnPrev.wasClicked() && this.page > 0) this.page-...
a1a32313-4d15-48ba-a337-e94c2f14a2c3
4
private static Node deleteNode(Node h, int value){ if(h==null) return null; if(h.v==value) return h.next; Node curr = h.next; Node prev = h; while(curr!=null){ if(curr.v == value){ prev.next = curr.next; break; } prev = curr; curr = curr.next; } return h; }
60dff9bb-4d48-4353-81a9-cf97e090ccc3
2
public static boolean arrayEqual(char[] a, char[] b, int aStart, int bStart, int length) { for(int i=0;i<length;i++) { if(a[aStart+i] != b[bStart+i]) { return false; } } return true; }
b3ed0092-1d56-475f-8a63-319cb8d7aeac
4
int getB(String s1, String s2) { int b = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) { // this situation has handled by getA. continue; } if (s1.charAt(i) == s2.charAt(j)) { // if their digit m...
ad36b7ef-c47e-4e58-91c0-8c846f114c8b
9
public static void processTriple(String subject, String verb, String object, String inputDir, String outDir){ //expansion ArrayList<String> subject_words = expanded_object_list.get(subject); ArrayList<String> verb_words = expanded_verb_list.get(verb); ArrayList<String> obje...
98be0227-e7d9-44c1-b1f0-1b3b71a2543f
8
public void loadRepositoryFromGraphXML(String graphXML) { try { String result=graphXML.replaceAll("&#x","---"); Document document = builder.parse(new InputSource(new StringReader(result))); // SBModel is sign of SystemBiology XML document, which equals to GraphData of Pat...
aab42459-2dc3-44fa-9185-d4d789709273
9
public File getCsvData() { List<DataLead> leads = selectAll(); if(leads == null) { this.errorLogFile.log(LoggingProxy.ERROR, "[---]CsvProxy error. Can't get data. "); return null; } File tmp = createCsvFile(); if(tmp == null) { this.errorLogFi...
378cc745-7f3c-4df8-98e1-69ecc10b4c28
9
public String openMana(Player player) { // Currently only considers basic lands. String mana = ""; for (Card perm : this.permanents) { if (perm.getTypes().contains("Land") && perm.getController().equals(player) && !perm.isTapped()) { String cardName = perm.getName(); switch (cardName) { case "...
9a068ddd-7cb7-46ad-9736-c54137291eb3
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { invoker=mob; final CMMsg msg=CMClass.getMsg(mob...
c8079f48-2766-4321-a426-803c2b000e17
1
public synchronized void adicionar() { try { new PesquisaView(this); } catch (Exception e) { } }
9605e9cb-1c56-45a1-9199-54d5aeb796c9
1
public static String nullSafeClassName(Object obj) { return (obj != null ? obj.getClass().getName() : NULL_STRING); }
fa8d9df8-f848-496f-9149-2b960dec812c
9
@Override public Set<String> keySet() { return new Set<String>() { @Override public int size() { return size; } @Override public boolean isEmpty() { return size == 0; ...
8e10db77-4ab6-4fcf-8f54-7a2d93cbcb21
5
private static void wordquiz() { for (int i = 0; i < 40; ++i) System.out.println(); int max = database.size() - 1; success = new SList(); failure = new SList(); total = new SList(); String guess; sc = new Scanner(System.in); System.out.println("Random word's deffinition is displayed below. You have to g...
22a9e202-d29a-4835-860b-da8f5bd0804d
0
public void setjTextFieldPrenom(JTextField jTextFieldPrenom) { this.jTextFieldPrenom = jTextFieldPrenom; }
cdf94955-9ece-4d73-b5bd-4b53b1904570
5
public boolean replace(String key, int ttlSec, Object value, long timeoutMiliSec) throws TimeoutException { try { StringBuilder sb = new StringBuilder(); byte valueBytes[] = null; int flag = -1; if (value instanceof String) { String arg = (String) value; valueBytes = arg.getBytes(charset); ...
b65f7d45-f394-40fa-b1a5-d24968aee40a
9
@Override public void actionPerformed(ActionEvent e) { if(e.getSource()==logOut){ frameRef.setContentPane(new Login(frameRef)); } if(e.getSource()==addBook){ contentPanelLayout.show(panel, "ADD_BOOK"); } if(e.getSource()==addItem){ contentPanelLayout.show(panel, "ADD_ITEM"); } if(e.getSource() =...
babbc4fa-0f35-46a1-b69d-dd6062c6a89a
0
@XmlElementDecl(namespace = "urn:ietf:params:xml:ns:keyprov:pskc", name = "KeyContainer") public JAXBElement<KeyContainerType> createKeyContainer(KeyContainerType value) { return new JAXBElement<KeyContainerType>(_KeyContainer_QNAME, KeyContainerType.class, null, value); }
50535655-f7ba-46a6-84bd-a8ce21d1e364
2
public void run(){ System.out.println("in run method "); synchronized(this){ try { for(int i = 0; i < 100; i++){ total += i; System.out.println("total: "+total); wait(100); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }...
36800256-0b04-4001-b1fe-a8b52a12f688
4
public int getIndexFrom(){ int numOfOptions=_map.mygraph.getCurr(); if(numOfOptions==0){ JOptionPane.showMessageDialog(null,"There isn't any location on the map!","Directions",JOptionPane.ERROR_MESSAGE,null); return -1; } String[] options=new String[numOfOptions]; for(int i=0;i<numOfOpt...
e12269d0-41a8-450b-8444-0b676ba15146
8
public String format(Alignment alignment) { char[] sequence1 = alignment.getSequence1(); char[] sequence2 = alignment.getSequence2(); char[] markup = alignment.getMarkupLine(); int length = sequence1.length > sequence2.length ? sequence2.length : sequence1.length; String name1 = adjustName(alignment.get...
e67f6cda-3c4e-4c18-8098-6c436e7950b7
9
public ShapeModels(String path) throws BadModelFormatException{ models = new HashSet<ShapeModel>(); Integer length = 0; Integer height = 0; Integer lineNumber = 0; Integer modelScore = 0; Set<Position> model = null; List<String> lines = null; try { lines = Files.readAllLines(Paths.get(path)); } cat...
5bf78fda-b08a-4698-9c44-a4b73ce38c94
4
@Override public String[] getClientAliases(String keyType, Principal[] issuers) { if (CacHookingAgent.DEBUG) { System.out.println("getClientAliases: "); } try { KeyStore ks = getKeyStore(); if (ks == null) { return new String[0]; } ArrayList<String> asList = new ArrayList<String>(); Enumera...
df811fa2-4d7b-4e69-a31b-36def49ccbf2
6
public ListNode mergeKLists(ListNode[] lists) { if (lists == null || lists.length == 0) { return null; } PriorityQueue<ListNode> priorityQueue = new PriorityQueue<ListNode>(new Comparator<ListNode>() { @Override public int compare(ListNode o1, ListNode o2) { ...
9608cc00-072c-41b1-ad4a-143c44cb48d3
6
@EventHandler public void IronGolemFastDigging(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.getIronGolemConfig().getDouble("Iron...
cef27ac0-2c14-40f7-9c94-f55f170168f2
7
public static void main(String[] args) { int[] tipsArr = new int[] { 1, 10, 1, 5, 5, 10, 10, 5, 10, 5 }; Random random = new Random(); for (int i = 1; i < tipsArr.length; i++) { int j = random.nextInt(i); int temp = tipsArr[i]; tipsArr[i] = tipsArr[j]; tipsArr[j] = temp; } for (int i = 0...
78775eb3-00fc-445e-93ee-5297834ac0ef
3
boolean checkPassword(String password, String confirmPassword) { if(password.length() < 8 || password.length() > 16) { JOptionPane.showMessageDialog(null, "Password must be between 8 to 16 characters long", "Error", JOptionPane.ERROR_MESSAGE); return false; } if(!password.equals(confirmPassword)) { JOpti...
fadfe3e6-a6fe-4808-bd12-45dcb8af4827
3
static void printAngle(double theta, PrintStream ps, String posPrefix, String negPrefix) { int pd, pm; double phi = RtoD(Math.abs(theta)); pd = (int) phi; phi = 60.0 * (phi - pd); pm = (int) phi; phi = 60.0 * (phi - pm); if (theta < 0.0) { ps.print((negPrefix == null) ? "-" : negPrefix); } else...
e5cf63ab-2652-40cc-943d-5ef12566680a
6
public void sendDebugFile(final String errorid) throws IOException { this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, new Runnable() { @SuppressWarnings("resource") @Override public void run() { try { URL url = new URL("http...
8151e4ce-3548-49da-be26-6420e2a2951d
9
protected void ushortLoop(RasterAccessor src, RasterAccessor dst, int filterSize) { int dwidth = dst.getWidth(); int dheight = dst.getHeight(); int dnumBands = dst.getNumBands(); short dstDataArrays[][] = dst.getShortDataArr...
33f4005d-4d14-4195-9f98-cbe8cbe6e7d2
4
@Override public void paint(Graphics g) { super.paint(g); map.paint(g, this); for (Tower tower : towerList) { tower.paintBase(g, this); } enemyHandler.paint(g, this); for (Tower tower : towerList) { tower.paintProjectiles(g, this); } ...
cb6b8b30-bdc5-4f23-8e80-f6462d605d35
2
public void train(String listofFiles,String output) { CountsCollection bag1=new CountsCollection(); HashSet<String> IdsVisible=new HashSet<String>(); loadList(listofFiles,DataHalf.ODD,Visibility.VISIBLE,bag1,IdsVisible); loadList(listofFiles,DataHalf.EVEN,Visibility.BLIND,bag1,IdsVisible); // Do some sort of ...
3ad2489e-a0a8-47f2-987e-409834180bbd
4
public void run() { long lastTime = System.nanoTime(); long timer = System.currentTimeMillis(); double ns = 1000000000.0 / 60.0; double unprocessed = 0; int ticks = 0; int frames = 0; requestFocus(); while (running) { long now = System.nanoTime(); unprocessed += (now - lastTime) / ns; lastTime...
2dbd9f5e-1004-472d-b445-9443724533fa
3
private void pullData() { File tmp = new File(backup); tmp.mkdirs(); tmp.delete(); info("Your device will ask you for permission to backup files. Do NOT enter a password, just accept."); String messages = ""; try { Process p = Runtime.getRuntime().exec(new S...
3bc0022f-9bb7-44cb-981e-01c87805dc67
1
public boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]|\\."); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; } return true; }
bffc0476-27df-4345-a164-6fc7f530ce17
7
@Override public void addChoices(Player player, List<Choice> choices) { super.addChoices(player, choices); if (player.isNextTo(ConnectionType.boat)) { if (player.lastChoice() != null && (player.lastChoice().equals(doNothing) || (player.lastChoice().equals(this) && player.getAt().getType().equals(...
34251608-95cf-4b8f-b9e1-09c940d5a01b
9
public void update(float delta, Level level) { move(delta, level, false); if (collision(level)) { level.entities.remove(this); } for (int i = 0; i < level.entities.size(); i++) { if (level.entities.get(i) instanceof Player && collision(level.entities.get(i))) { level.resetLevel(); Sound.DEATH...
0e0bd6c4-11d1-4a5e-9d4e-a4fa7d0fe785
7
public void act(XmlAction pAction) { if (pAction instanceof ChangeRootNodeAction) { ChangeRootNodeAction rootNodeAction = (ChangeRootNodeAction) pAction; NodeAdapter focussed = controller.getNodeFromID(rootNodeAction .getNode()); if (fo...
fd3440ca-cf51-47e1-af43-15c22109d5e2
9
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ( "tag".equals(qName) ) { String name = attributes.getValue("name"); String content = attributes.getValue("content"); String ...
3e1d0738-9471-4313-8159-7546d5457e07
0
public String getColor() { return color; }