method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
838d743c-5d23-4699-9b7b-5e4d101af8c1
0
public void PostInit(ContentManager manager) {}
78a340e2-c135-4e22-9e22-b57566feebae
3
private String getClassName(JarFile jar) { Enumeration<JarEntry> enume = jar.entries(); JarEntry je; while(enume.hasMoreElements()) { je = enume.nextElement(); String className = je.toString(); if(className.contains(".class") && !className.contains...
18fe637d-bc53-42a3-9079-67bb80038f0a
6
static public Header header(byte[] buf) { String format; try { format = new String(buf, 0, 4, StandardCharsets.US_ASCII); } catch (RuntimeException err) { throw new Error("Error parsing format", err); } int version; switch (format) { ...
ffb61713-b254-4365-9a1d-c5349126bb8e
9
public boolean isValidMove(int move, boolean isInCheck) { int type = Move.getType(move); int indexTo = Move.getTo(move); int indexFrom = Move.getFrom(move); int indexKing = king.get(sideToMove, 0); int piece = Square.getPiece(squares[indexFrom]); int inc = Increment.getI...
1ef96e89-2627-4ca7-8d4c-756b1be38eec
0
public void setItemUnitPrice(double itemUnitPrice) { this.itemUnitPrice = itemUnitPrice; }
0951d383-a91d-4514-8905-45d8b213c1c6
1
public long end() { if (started == 0) { throw new Error("trying to end but never started."); } final long duration = System.currentTimeMillis() - started; started = 0; return duration; }
1e1f21b2-7ce4-4a42-b029-0d1e508a61e2
6
public void drawMap(Graphics g){ for(int i = 0; i<sArray.length; i++){ for( int j = 0; j<sArray[i].length(); j++){ if(sArray[i].charAt(j) == '1'){ g.drawImage(grass, j * Constant.WIDTH_HEIGHT, i * Constant.WIDTH_HEIGHT, Constant.WIDTH_HEIGHT, Constant.WIDTH_HEIGHT, this); }else if( sArray[i].charAt(j)...
4f727744-a095-43ab-8883-a12b592697be
3
private String diff_linesToCharsMunge(String text, List<String> lineArray, Map<String, Integer> lineHash) { int lineStart = 0; int lineEnd = -1; String line; StringBuilder chars = new StringBuilder(); // Walk the text, pulling out a substring for each line. ...
599b3d15-0bde-40fc-95c7-6f3cf9027f1d
3
public void update(double dt) { for (LevelSegment obj: _layer0) { obj.update(dt); } for (LevelSegment obj: _layer1) { obj.update(dt); } for (LevelSegment obj: _holes) { obj.update(dt); } _ball.update(dt); _endPoint.update(dt); }
3aa5576f-cf45-4974-a7d7-38a24eb16e7e
6
public void menuFileCrypt() { int choice; do { System.out.println("\n"); System.out.println("File Cryption Menu"); System.out.println("Select Cryptology Type"); System.out.println("----------------------\n"); System.out.println("1 - Asymmetric...
b0b75f1f-7c25-4712-8051-610230feb670
7
public static void main (String [ ] args) { int dayOfYear = 0; try { dayOfYear = Integer.parseInt (args[0]); }catch (NumberFormatException e) { e.printStackTrace(); } int month, dateInMonth, daysInMonth; month = 1; daysInMonth = 31; ...
2e65863b-c609-49cd-a983-11e02bcb69aa
4
@Override public void mouseReleased(MouseEvent e) { for(int i = 0; i < Rocket.getRocket().currentGui.compList.toArray().length; i++){ if(((Button) Rocket.getRocket().currentGui.compList.get(i)).isInside(e.getX(), e.getY())){ if(!((Button) Rocket.getRocket().currentGui.compList.get(i)).isCheckBox()) { ((B...
5b224d63-749d-4f1b-81db-586e155a71e2
3
public void update(long deltaMs) { if(mainLogic.currentState == GameLogic.GameState.PLAYING) { time += deltaMs; for(WeaponLocation wl : weaponLocations) { wl.update(deltaMs); } } if(playerLost) { Application.ge...
760f3ccd-cab2-40f3-8f46-480263753b9d
3
public int cdlTakuriLookback( ) { return ((( ((( (this.candleSettings[CandleSettingType.BodyDoji.ordinal()].avgPeriod) ) > ( (this.candleSettings[CandleSettingType.ShadowVeryShort.ordinal()].avgPeriod) )) ? ( (this.candleSettings[CandleSettingType.BodyDoji.ordinal()].avgPeriod) ) : ( (this.candleSettings[Candl...
0496e216-f873-446f-9919-34b0e351117f
1
private void emitCode() { LinkedList worklist = new LinkedList(); // Create an instantiation of the "root" subroutine, which is just the // main routine worklist.add(new Instantiation(null, mainSubroutine)); // Emit instantiations of each subroutine we encounter, including the // main subroutine InsnList...
ce739065-d989-4ef3-b9e0-67251a843dbc
1
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
f09bc851-1be3-481c-8c36-195aa8d564d1
4
@Override public RoleSchool addRoleFromGSON(String json, long id) { EntityManager em = emf.createEntityManager(); RoleSchool role = gson.fromJson(json, RoleSchool.class); if (role.getRoleName().equals("Student")) { role = gson.fromJson(json, Student.class); } if (...
a069a288-a34e-4552-9689-b39c41a6e467
7
private static Object readParameter(String cs, Object co, String className, Representation... arguments){ if('\"'==cs.charAt(0)&&'\"'==cs.charAt(cs.length()-1)) return cs.substring(1, cs.length()-1); else if('\''==cs.charAt(0)&&'\''==cs.charAt(cs.length()-1)) return cs.charAt(1); else if(cs.charAt(0)=='*') ...
0516a364-22b3-4712-913b-dc1b6cd29476
2
public Door(int x, int y, int x2, int y2){ points1 = new ArrayList<Point>(); points2 = new ArrayList<Point>(); points1.add(new Point(x, y)); points1.add(new Point(x+1, y)); points1.add(new Point(x, y+1)); points1.add(new Point(x+1, y+1)); points1.add(new Point(x, y+2)); points1.add(new Point(x+1, y+2...
c3165bd5-ae66-4f32-a7c4-9a42b2167466
4
private void makeTarget16x16() { v = tgt.getH()/16; h = tgt.getW()/16; for(int y = 0; y < v; y++) { for(int x = 0; x < h; x++) { int xoff = (x * 16); int yoff = (y * 16); RGB[][] tempx = new RGB[16][16]; for(int z = 0; z < 16; z++) { for(int w = 0; w < 16; w++) { ...
71d158e6-45f7-4b02-a100-02f5e6cb6656
5
public FileInfo promptForFile(String text, String pattern, String title) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(title); fileChooser.getExtensionFilters().add(new ExtensionFilter(text, pattern)); String head = null; String mess = null; ...
2673047c-9134-4bb8-aa22-1c3601433bde
0
public void setKey(KeyType value) { this.key = value; }
bf9e002d-485d-4945-ab6c-5011eddb855c
6
@Override public void check(Minecraft m, ByteClass bClass) { byte[] data = bClass.getData(); for (int i = 0; i < data.length + 1 - checkData.length; i++) { boolean searching = true; int sIndex = 0; while (searching) { if ((...
edfe3cf3-f24a-455c-ac25-a66d95dcb658
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
bf846f71-9a2c-4bd0-931a-233ce862b647
5
public IMessage decrypter(IMessage crypte, String key) { /* * Mthode appelant le calcul des dcimales de Pi, * puis dcodant les caractres du message un un */ long d=new Date().getTime(); int k=Integer.parseInt(key); this.getDecimalesPi(crypte.taille()+k); char[] c=new char[crypte.taille()]; int v=...
6a73ae5a-7269-4294-9503-f7a17c8bc9b7
3
public BigInteger readKeyFromFile(String keyFileName) throws IOException { //InputStream in = ServerConnection.class.getResourceAsStream(keyFileName); File f=new File(keyFileName); FileInputStream fis=new FileInputStream(f); ObjectInputStream ois = new ObjectInputStream(fis); try { n = (BigIn...
be5a3c07-ac21-4f73-93b2-743c3a2a3b0b
6
public static String formatArray(final boolean format, final Object object) throws IllegalArgumentException { if (object == null) return "null"; final int size = Array.getLength(object); if (size == 0) return "[]"; String space = (format ? "[\n " : "["); final String comma = (format ? ",\n " : ", "); fina...
831aefec-fa80-42e5-9ec8-3647722310e9
7
public ProperProcessor(int threadCount, final ThreadFactory factory) { final ImmutableList.Builder<Thread> threads = ImmutableList.builder(); while (threadCount-- >= 1) { final Thread thread = factory.newThread( new Runnable() { @Override public void run() { final BlockingQueue<Task<?...
81e04a9f-a7b8-46a7-b7d9-db1132237231
9
public boolean updateCustomer(String customerJSON) { // Read the JSON file and create the customer object ObjectMapper mapper = new ObjectMapper(); Customer originalCustomer = null; boolean updateSuccessful = false; logger.info("Reading Update JSON !"); try { customer = mapper.readValue(customerJSON, C...
5bad019d-42d7-41eb-80c6-094e681c6fe8
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ASCII_Sound other = (ASCII_Sound) obj; if (this.ring != other.ring) { return false; }...
4114d546-6077-4fe5-bbde-84a9bca9a7e5
8
public X509Certificate generateX509Certificate() { Date targetDate1 = new Date(); Calendar calendar1 = Calendar.getInstance(); calendar1.setTime(targetDate1); calendar1.add(Calendar.DATE, -1); Date targetDate2 = new Date(); Calendar calendar2 = Calendar.getInstance(); calendar2.setTime(targetDate2); c...
0fbfb011-f20c-43ae-a065-31b6639b5036
0
public void setType(String type) { this.type = type; }
531f5fab-05e8-408a-873c-aee2ec2521d4
1
public void testSetDateTime_int_int_int_int_int_int_int2() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.setDateTime(2010, 13, 3, 5, 6, 7, 8); fail(); } catch (IllegalArgumentException ex) { } assertEquals(TEST_TIME1, test.getMillis(...
5cc1858d-c294-42ba-b65a-1aa94aa1a692
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } OutlineItem other = (OutlineItem) obj; // we want items in the same position to be equal even if their ids are not equal, *exce...
8adb7c2a-bafe-40fd-ad4a-5db17bbf9dc6
7
public final GameState nextState() throws IOException { Board board = null; PlayerState pState = new PlayerState(); int turn = 0; Duration d = null; String message = ""; jsonReader.beginObject(); while (jsonReader.hasNext()) { if (jsonReader.peek() == JsonToken.END_DOCUMENT) { ...
fe5e5fd5-e301-4fbf-8ac4-c052161a0fb4
7
public String optimize(String in){ String out = ""; HashMap<String, String> hm = new HashMap<String, String>(); String lines[] = in.split("\n"); for(String line : lines){ String parts[] = line.split("[\\s]*:=[\\s]*"); String id = parts[0]; Matcher matcher = idexp.matcher(parts[1]); if(matcher.mat...
3740c020-eeea-442b-babd-ee99f13d8f80
2
public String getAllByUID(Statement statement,String UID) { List<DataClass.CarNumber> carNumberList = new ArrayList(); String resultString = null; String sql; String result = null; sql = "select * from carnumber where UID = '" + UID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs...
a46b5e6f-05f1-41fe-abe8-64f56237c067
6
@SuppressWarnings("deprecation") public static void main(String args[]) throws NumberFormatException, IOException { DataInputStream in; int data;String cont; BST b=new BST();; do { System.out.println("1. Insert"); System.out.println("2. Delete"); System.out.println("3. Print"); System.out.println("4. Mirror"); ...
f0898281-6b0b-4a75-8a60-b973bbac64a8
1
private void sendMessageToAll(String message) { for (Client client : clients) { sendMessage(message, client.getAddress(), client.getPort()); } }
dd80553b-9c49-4a07-a354-185b45cb0a16
7
public static String get(int id) { String color = ""; switch (id) { case 0: color = "white"; break; case 1: color = "red"; break; case 2: color = "yellow"; break; case 3: color = "green"; break; case 4: color = "blue"; break; ...
69b6dca1-5454-4d78-bab4-ccc4ed115d57
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Email)) { return false; } Email other = (Email) object; if ((this.id == null && other.id != null) || (this.id !...
c537de7c-ab1b-4533-8fa7-9f23d680070e
2
public void setDate(String timeStamp) { /* if (imessage) timeStamp+=978307200;*/ try{ long unixTime = Long.parseLong(timeStamp); Date d = new Date(unixTime* 1000); if (isiMessage()){ Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.YEAR, 31); cal.add(Calendar.DATE,...
fdd6c027-0c4b-4e97-a6ed-7a3ea8d76bfe
5
private void createTable() { if (maandPercentage != null && mensualiteit != null && startKapitaal != null && aantalMaanden != 0) { Mortgage newMortgage; if (fix.isSelected()) { newMortgage = Calculate.createFixedAmountTable(startKapitaal, aantalMaanden, mensualiteit, maandPercentage); } else { newMor...
2c2a0c51-2018-4ab7-bc91-694b4cec0575
7
public void drawWeather(float delta, ShapeRenderer shapeRenderer) { // set up OpenGL state for drawing weather GL11.glDisable(GL11.GL_CULL_FACE); GL11.glNormal3f(0F, 1F, 0F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ...
fa352ec1-cce4-42a2-ac4c-96d85fc5fb7d
1
@Override public String toString() { StringBuilder foo = new StringBuilder(super.toString()); if (this.note != null) { foo.append("Note: "); foo.append(this.note); foo.append("\n"); } return foo.toString(); }
ceed958f-db23-462a-9b2b-b1425a289377
3
@Override public GameState doAction(GameState state, Card card, int time) { if(time == Time.DAY) { state = monkeyDay(state, card, true); } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); state = temp.doAction(state, card, time); } else if(time == Time.NIGHT) { //Do n...
e587c0fc-6cb1-475e-86d0-3acbfc961e3f
5
public static void main(String[] args) { @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.nextLine()); TreeMap<String, TreeMap<String, Integer>> users = new TreeMap<>(); for (int i = 0; i < n; i++) { String[] userInput = scan.nextLine().split(" ");...
2bc2726a-cd1e-49a1-b158-cd2c66a7f893
4
public void forceNaturalSelection(KnowledgeBaseObject kb) { ArrayList<BuildOrder> ordersToSave = new ArrayList<BuildOrder>(); ArrayList<BuildOrder> allOrders = new ArrayList<BuildOrder>(kb.orders); for (int i = 0; i < NUM_ORDERS_PRESERVED; i++) { // Find the highest scoring build order, preserve it, remo...
8bc65da0-dabc-460a-a393-8a74d00f170b
9
private static Quiz getQuizFromHistory(String type) { int userId = Controller.getLoginUser().getId(); List<QuizHistory> list = new ArrayList<>(); try { list = QuizHistory.doQueryGetByUserID(conn, userId); } catch (SQLException ex) { Logger.getLogger(Controller.cla...
c6f4fef5-7473-4fa6-99dd-4f95550dcf8a
4
static int getRegisteredID (Connection connection, Object object) { ObjectSpace[] instances = ObjectSpace.instances; for (int i = 0, n = instances.length; i < n; i++) { ObjectSpace objectSpace = instances[i]; // Check if the connection is in this ObjectSpace. Connection[] connections = objectSpace.connecti...
d1325bc7-329a-4860-b7e3-42c2f57e7cfd
1
public Coord getc() { Gob gob; if ((gob = getgob()) != null) return (gob.position()); return (c); }
79fecfe4-b317-4753-b0d2-aa34ab864850
4
@Override public String toString() { String depart, retour ; if(this.dateDepart != null){ depart = Dates.parseDate(this.dateDepart) ; } else { depart = "" ; } if(this.dateRetour != null){ retour = Dates.parseDate(this.dateRetour) ; } else { retour = "" ; } String sonEtat ; if(this.eta...
ce5cac18-f3b6-43cd-badc-69a13ce44e3b
7
private boolean similarExceptForStateNames(STS sts1, STS sts2) { Map<Action, Action> correspAction = new HashMap<Action, Action>(); Map<Transition, Transition> correspTransition = new HashMap<Transition, Transition>(); Map<State, State> correspState = new HashMap<State, State>(); boolean inputsMatch = matchI...
23eba03b-1013-4cc9-85f2-9acde1d24d7e
6
public void draw() { if (!this.isDrawing) { throw new IllegalStateException("Not tesselating!"); } else { this.isDrawing = false; if (!this.renderingChunk) { GL11.glEnd(); // this.checkOpenGlError(); } else if (this.vertexCou...
eec15769-48f5-4dc0-9680-9d695403ade9
8
public void actionPerformed( ActionEvent e ) { TProjectData current = TGlobal.projects.getCurrentData() ; // if any data available if (current != null) { if ( GUIGlobals.PROJECT_SAVE_SINGLE_DIALOG == null ) GUIGlobals.PROJECT_SAVE_SINGLE_DIALOG = new TLangSelectionDialog() ; if (...
85c5c277-2f67-48c9-91f3-661951aff6cc
1
public void store(OutputStream out) throws IOException { PrintWriter writer = new PrintWriter(out); for (Iterator i = entrySet().iterator(); i.hasNext();) { Map.Entry e = (Map.Entry) i.next(); writer.println(e.getKey() + "=" + e.getValue()); } writer.flush(); }
7aa3e939-a3aa-44c6-bc9c-14fd6cbfeb36
3
@Override public synchronized void handlePieceCompleted(SharingPeer peer, Piece piece) { // Regardless of validity, record the number of bytes downloaded and // mark the piece as not requseted anymore this.downloaded += piece.size(); this.requestedPieces.set(piece.getIndex(), false); if (piece.isValid()) { ...
e7d9f972-bac8-42c9-bb30-dce83a70e8b2
2
public void run() { for(int i = m_start.x; i <= m_end.x; i++) for(int j = m_start.y; j <= m_end.y; j++) C[j][i] = A[j][i] + B[j][i]; }
ecfac90d-d19e-4d36-8519-2dc6b3b64740
4
private static synchronized void doSet() { String key = RandomUtils.random(36, true, true); String val = RandomUtils.random(12, true, true); try { long startTime = System.nanoTime(); // ... the code being measured ... redis.set(key, val); long estimatedTime = System.nanoTime() - startTime; setRu...
b16bb048-d56b-4cbe-a966-cae8344023a8
9
@Override protected void buildModel() throws Exception { for (int iter = 1; iter <= numIters; iter++) { loss = 0; errs = 0; for (MatrixEntry me : trainMatrix) { int u = me.row(); // user int j = me.column(); // item double ruj = me.get(); if (ruj <= 0.0) continue; double pred =...
692d279b-03cf-4060-8926-00a220a8ed7a
2
private void closeOpeningTag(final boolean newLine) throws IOException { if (!this.closed) { writeAttributes(); this.closed = true; this.writer.write(">"); if (newLine) this.writer.write("\n"); } }
90893136-6d9b-44f0-a9e3-c2f7022b83f1
4
private void yesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesActionPerformed File csvBatteries = new File("batteries.csv"); File csvMatches = new File("matches.csv"); try { BufferedWriter writer = new BufferedWriter(new FileWriter(csvBatteries)); ...
6189189d-1ec2-4d74-93b2-847214ed9d1b
5
private static Boolean requestBoolean(String key) { String value = getString(key); if (value == null) return null; if (value.equals("1") || value.toLowerCase().equals("true")) { return Boolean.TRUE; } else if (value.equals("0") || value.toLowerCase().equals("false")) { return Boolean.FALSE; } el...
926a8c0c-e9a4-42a1-8050-5cc68a5c7c7b
9
private void setDomainColoring() { if(!domain_coloring_opt.isSelected()) { domain_coloring = false; domain_coloring_button.setSelected(false); domain_coloring_options_opt.setEnabled(false); if(!use_palette_domain_coloring) { palette_toolbar_prev...
394c5ad1-e796-41b5-be5f-d10846e00b2b
5
public void calcTraf(){ int ant=0,pos=0; for(Nodo e : grafo){ if(e instanceof Edge){ Edge er= (Edge) e; for(Mat m: traf) { if(m.In.EqId(e.getId())){ ant=er.pred[m.Out.id]; pos=m.Out.id; m.Out.uso+=m.traf; do { Nodo tmp= findbyid(pos); tmp...
7a1a6218-fff2-4bc9-8853-74bdb525a80e
9
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btn_setStart) { if(btn_setGoal.isSelected()) { btn_setGoal.setSelected(false); } JToggleButton jToggleButton = (JToggleButton)e.getSource(); if (jToggleButton.isSelect...
5965cb96-f3b8-434a-819d-b92f1ca5de24
2
public Object opt(int index) { return (index < 0 || index >= this.length()) ? null : this.myArrayList.get(index); }
0d99f369-3a7e-49e4-9bf3-ee2ab4f089d2
0
public void setSectorWork(String sectorWork) { this.sectorWork = sectorWork; }
4ea82a7f-7d13-4080-bd39-da0a96cadfb6
2
public boolean testOutputEvent(OutputEvent actualOutputEvent) { final InputOutputEventType expectedInputOutputEventType = inputOutputEventTypes.poll(); final WordPredicate wordPredicate = outputWordPredicates.peek(); boolean isCorrectSoFar; if (expectedInputOutputEventType != actualOutpu...
34a4e0cf-4b98-480d-b0a8-535e53a24893
7
private String getTypeCurrentToken(int status){ String result = ""; String prefix = ""; if(!isNumber(parseTokenList.get(i).getText())){ if (status == 1 || status == 2 || status == 3 || status == 5) { prefix = currentNameSpase; } else if (status == 4) { ...
2ba46948-0762-44c5-ab6e-4f941e6a3c21
9
public void run() { int ch; try { _outerLoop: while (!__isClosed) { try { if ((ch = __read(true)) < 0) break; } catch (InterruptedIOException e) ...
d20cf880-4b3e-40bd-9583-b0ea62d1de31
0
public boolean isMovingRight() { return isMovingRight; }
180170f3-876f-4ecd-ae9f-833b595cb272
3
@Override public String stringApiValue() { if (size() <= 0) { return CycObjectFactory.nil.stringApiValue(); } StringBuilder buf = new StringBuilder("(LIST "); for (Iterator<CycSymbol> iter = keySet().iterator(); iter.hasNext();) { CycSymbol key = iter.next(); buf.append(DefaultCycObj...
fbe79058-cc4f-4b3b-b44c-52e995fbd644
1
public void insertAfterMethod(CtMethod origMethod, CtMethod afterMethod) throws CannotCompileException { try { transformers = new TransformAfter(transformers, origMethod, afterMethod); } catc...
6677c5c4-81bd-449c-ad95-bf19e54360c8
2
public void removeEvent(String identifier) { for(Event e: events){ if(e.getIdentifier().equals(identifier)) events.remove(e); } }
5a7069fb-f37a-4b35-ad1c-2b06d2f746a8
6
public static double[] gauss(double[][] a, double b[]) { int n = b.length; //proceso descendente double aux; for (int k = 0; k < n; k++) { aux = a[k][k]; for (int j = k; j < n; j++) a[k][j] = a[k][j] / aux; b[k] = b[k] / aux; ...
e72aca54-c338-43d3-94d5-d41c57928ee8
9
private CharClass parseCharClassEscOrXmlChar() throws RegexSyntaxException { switch (curChar) { case EOS: if (eos) expect(']'); break; case '\\': advance(); return parseEsc(); case '[': case ']': case '-': throw makeException("should_quote", new String(new c...
ebe3399d-0fed-464c-b282-0902b01cebbe
2
public State getStateForStates(State[] states, Automaton dfa, Automaton nfa) { State[] dfaStates = dfa.getStates(); for (int k = 0; k < dfaStates.length; k++) { State[] nfaStates = getStatesForState(dfaStates[k], nfa); if (containSameStates(nfaStates, states)) { return dfaStates[k]; } } return null...
9d6661f3-0db7-44b7-9946-05e39b99f34f
6
public static void menu(BufferedReader inp) { String userInput = null; loop:while(true) { try { LoginBean loginBean = new LoginBean(); System.out.println("Enter the following details"); System.out.println("UserName[String]"); loginBean.setUserName(inp.readLine()); System.out.pr...
1bf79504-ffdd-4943-8a0e-d176684d11bb
9
protected void initializeRecord(RecordConfig record) throws BeanIOConfigurationException { // a record is ignored if a 'class' was not set and the property root is null // or the record repeats recordIgnored = false; if (record.getType() == null && record.getTarget() == null) { ...
e2b82fea-d3a8-4f15-905e-628e702720a9
3
public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); ...
9a43ebfe-1235-43dc-bb70-e0a919a88967
8
private static ArrayList<Entries> cutEntries(Entries entries, long cutInSeconds) { if (entries.size() == 0) return null; ArrayList<Entries> result = new ArrayList<Entries>(); // get the min timeStart and the max timeEnd, // just in case it is not sorted long minTimeStart = Long.MAX_VALUE; long maxTimeE...
b7f8d3bd-ba12-4e57-9b35-bd685391f7f7
7
public void parse() { String titre; ArrayList<Piste> morceaux = new ArrayList<Piste>(); // ArrayList<Instrument> instrument = new ArrayList<>(); // String nomInstru[]; boolean ifTitle = true; titre = new String(); String artiste = new String(); try { ...
ea0454c3-fc42-482f-962d-6662409a3049
1
public char getChar( String name ){ XAttribute attribute = getAttribute( name ); if( attribute == null ) throw new XException( "no attribute known with name: " + name ); return attribute.getChar(); }
477ffbc7-45f4-4d75-8f99-ae0c9748ee56
6
public String[] get_sms_cost(String phones, String message, int translit, int format, String sender, String query) { String[] formats = {"", "flash=1", "push=1", "hlr=1", "bin=1", "bin=2", "ping=1"}; String[] m = {}; try { m = _smsc_send_cmd("send", "cost=1&phones=" + URLEnc...
54654ea4-6b43-4ca8-9863-b067a03c8cbd
2
public synchronized void start() throws Exception { if (thread != null) { throw new Exception("Process has already started."); } thread = new Thread(mp); if (hasStarted == false) { thread.start(); hasStarted = true; } else { mp.run(); } }
9a8c78a4-baaa-4a73-a791-934ecdfdcb24
7
public StructuredFloat absBigger() { switch (numberType) { case Nan: case Infinite: return null; case SubNormalized: { if (specialValue == FloatNumberSpecialValue.MaxSubNormal) { return new StructuredFloat(config).buildByType(negative, FloatNumberType.Normalized, FloatNumberSpecialValue.Mi...
53ed4bca-b11c-4264-aed9-fb6376d0430b
2
private void incWord(Word w) { w.increment(time); if (trace) System.out.println("Incremented " + w + " " + w.getScore(time) + (counter != null ? " " + counter.get(w.units) : "")); }
d5bf7835-d382-447f-9b02-99e251b1b23b
3
private boolean isValidMove (int x, int y) { return ( x < 3 && x >=0 && y <3 && y >= 0 ); }
ef898f74-acea-4620-809f-ceeb6cb81090
1
@Override public void writeTo(WordWriter out) throws IOException { if(realInstruction != null) realInstruction.writeTo(out); }
c660af41-90b5-4929-9542-9509751006d1
6
private void drawLine(int x0, int y0, int x1, int y1) { //Bresenham's line algorithm boolean steep = Math.abs(y1 - y0) > Math.abs(x1 - x0); if (steep) { int tmp = y0; y0 = x0; x0 = tmp; tmp = y1; y1 = x1; x1 = tmp; } if (x0 > x1) { int tmp = x1; x1 = x0; x0 = tmp; tmp = y1; ...
55b2334c-c945-4a67-9f24-5b51e9f43a94
1
private static Class getArrayBaseType(Class array) { while (array.isArray()) { array = array.getComponentType(); } return array; }
7a8f2cab-2592-463f-bda7-3abe3bf2bb83
0
public Items getItem() { return this.item; }
50ca2603-09b1-43bb-b55b-333aafa16086
8
public void setSelectKeyFields(String... keyFieldNames) { Schema schema = sbuf.getSchema(); if (keyFieldNames == null) { // Use names from schema int nkey = 0; for (int i=0; i<schema.size(); ++i) { SqlCol col = (SqlCol)schema.getCol(i); if (col.isKey()) ++nkey; } keyFields = new int[nkey]; int j=0; ...
d6c8a625-eb41-4dea-9b14-c63625fda62e
9
public boolean pickAndExecuteAnAction() { for(MarketOrder order : mOrders) { if(order.mStatus == EnumOrderStatus.SENT && order.mEvent == EnumOrderEvent.ORDER_PAID) { order.mStatus = EnumOrderStatus.ORDERING; processOrder(order); return true; } } for(MarketOrder order : mOrders) { if(order.mSt...
7fa30a87-bfc1-418d-9252-dcbf9aa25f2b
2
private MenuHint(Color bg, String text) { if (bg == null) { bg = Color.WHITE; } if (text == null) { throw new IllegalArgumentException(); } create(bg, text); }
05608fc0-fe49-4213-a42e-b45eb287196e
5
public static Object ReadObjectFromFile(String filename) { Object obj = null; try { ObjectInputStream stream = new ObjectInputStream(new FileInputStream(filename)); obj = stream.readObject(); stream.close(); } catch (OptionalDataException ode) { System.out.println("Exception: " + ode); } ...
c6b5cfbb-3885-497e-9646-742f269e68a7
1
public void testConstructor_ObjectStringEx6() throws Throwable { try { new LocalDate("10:20:30.040"); fail(); } catch (IllegalArgumentException ex) {} }
ab46bde3-7aab-42f6-8967-5124c87d5866
5
@EventHandler public void onPlayerInteract( PlayerInteractEvent e ){ Player p = e.getPlayer(); if( e.getItem() != null ){ if( String.valueOf(e.getItem().getType()).toUpperCase().contains("CHESTPLATE") ) { if (String.valueOf(e.getItem().getItemMeta().getLore()).contains("L...
aec238a7-f3a7-45c8-a9ed-e470335ad44a
4
public WorldImage makeImage( ) { Iterator<Bomb> i = bombList.listIterator( 0 ); Iterator<Explosion> j = explosionList.listIterator( 0 ); Iterator<Rocks> k = rockList.listIterator( 0 ); Iterator<Enemies> l = enemyList.listIterator( 0 ); WorldImage world = new RectangleImage(new Posn(0, 0), 1000, 650, new W...