method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6594dcb7-8b04-4475-a14f-335d88c861d6
9
public boolean input(Instance instance) throws Exception { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } Method m = (Class.forName(m_Class)).getMethod(m_Method, new Clas...
076eb36e-91a0-47fe-8555-b306ee9e355d
5
@Override public boolean equals(Object o ) { if(o == null) return false; if(!(o instanceof Kunde)) return false; Kunde other = (Kunde)o; if (!other.getAddress().equals(this.getAddress())) return false; if(!other.getName().equals(this.ge...
4c3fe752-6049-44c0-be85-258501fd6574
1
@Test public void branchInstr_testInvalidRegisterRef() { //Checks instr. not created with invalid register ref. try { instr = new BranchInstr(Opcode.BRNE, 19, 25); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); }
0c49bb09-9432-4e30-b919-e70126b78838
1
private void buildCodageTabBinary (String codage, ArrayList<ArrayList> tabBinary) { if (this.isLeaf()) { ArrayList code = new ArrayList(); code.add(this.caractere); code.add(codage); tabBinary.add(code); } else { this.fGauche.buildC...
ab239404-a96c-4b50-83fd-73e0b62a7cc2
7
public void findApplets(Element e, URL url, List appletList) { if(e == null) return; if(e.getNodeName().equals("applet")) { AppletDesc appletDesc = getAppletDesc(e, url); if(appletDesc != null) { appletList.add(appletDesc); } return; } /...
c60aa937-3399-4f2d-9461-ee446d56de1b
1
private void registerProviders(Environment environment) { final Map<String, Object> beansWithAnnotation = applicationContext.getBeansWithAnnotation(Provider.class); for (String beanName : beansWithAnnotation.keySet()) { Object provider = beansWithAnnotation.get(beanName); //e...
ead0d190-9ef2-4b29-bdcb-699553ed8fe0
1
private static void checkSignature(CtMethod wrappedBody, String descriptor) throws CannotCompileException { if (!descriptor.equals(wrappedBody.getMethodInfo2().getDescriptor())) throw new CannotCompileException( "wrapped meth...
4525cde5-7b43-4b95-b598-c40220822f7e
3
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed this.setRandomColor(); if (gestione.controlla(num, jTextField1.getText(), jTextField2.getText())) { jLabel4.setText("Bravo: la traduzione inserita è corretta!"); if (GU...
198e984f-7091-42dd-89dd-917a0cc8251d
6
private void readUseList(ObjectModule module) throws SyntaxException { calLocation(); int useCount = 0; int useCountLineNum = 0; int useCountOffset = 0; try { useCount = scanner.nextInt(); useCountLineNum = lineNum; useCountOffset = offset; } catch (Exception e) { throw new SyntaxException("Par...
aed0a40e-c2eb-4771-a8e3-7de3dc9d7514
8
public void findATree(String nodeLabelList[]){ // change label list to node list Set<Node> targetNodeList = new HashSet<Node>(); for (String i : nodeLabelList){ Node u = qualifier.getNodeByLabel(i); if (u!=null) targetNodeList.add(u); } // ...
cbb12945-4e1d-4aa0-8e84-19ded89a14b4
3
boolean feasible(double point[]) { for (int i = 0; i < point.length; i++) { if (point[i] < lowBound[i] || point[i] > upBound[i]) { return false; } } return true; }
9db07de0-27bd-4f98-ad7e-7a0a4091516e
8
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof NetworkDevice)) return false; NetworkDevice that = (NetworkDevice) o; if (!hostname.equals(that.hostname)) return false; if (!id.equals(that.id)) return false; if (!ipAddressO...
a72cf0c9-48ed-4941-96fc-0be1749449ca
7
public void rotationLeft(){ switch (polygonPaint) { case 0: line.RatationLeft(); repaint(); break; case 01: curv.RatationLeft(); ...
f74c2e36-9daf-4ea5-8cf8-36f727927256
5
public Laskutoimitus hae(String tunnus) { if (tunnus.equals("+")) { return new Plus(); } if (tunnus.equals("-")) { return new Miinus(); } if (tunnus.equals("*")) { return new Kertolasku(); } if (tunnus.equals("/")) { return new Jakolasku(); } if (tunnus.equals("'")) { return new ...
f6368552-faac-4074-8e99-3d7929fe02a3
4
public void copyToPencilMode() { int i = 0, j = 0; for(i = 0; i < 16; i++) { for(j = 0; j < 16; j++) { if((pencilEntries[i][j].isEditable()) && (pencilEntries[i][j].getText().equals(""))) { pencilEntries[i][j].setText(entries[i][j].getText()); } } } }
e2a430f0-69f8-408b-89cc-9f4a250e9cbf
8
public void drawGameScreen(Graphics g, ArrayList<Ship> ships, double xRot, double yRot, int fps, ArrayList<StarChunk> stars, Camera camera, String version, int ups, boolean paused, HashSet<Shot> allShots, Dimension mapSize) { //long start = System.currentTimeMillis(); if (drawi...
541fcf35-8b75-44f7-9abc-ff37820e4999
4
private static void Adjust(Node[] data, int idx){ while(idx != 0){ if(idx % 2 == 1){ if(data[idx].data < data[idx + 1].data){ data[(idx - 1)/2] = data[idx]; }else { data[(idx-1)/2] = data[idx + 1]; } idx = (idx - 1)/2; } else { if(data[idx-1].data < data[idx].data){ ...
96c7c8ee-3236-46e1-82f9-55e46fc364bf
5
private static final int method1823(byte abyte0[][], byte abyte1[][], int ai[], int ai1[], int ai2[], int i, int j) { int k = ai[i]; int l = k + ai2[i]; int i1 = ai[j]; int j1 = i1 + ai2[j]; int k1 = k; if (i1 > k) { k1 = i1; } int l1 = l; ...
34c25796-8a53-4814-91ef-9259e1868511
0
public String getNamePer() { return namePer; }
97d51bd5-db1e-4407-a3df-a5cbd73340ba
2
public void protectObjectInternalConditional(Integer ownerTableId, Long ownerId, String relationName, Integer propertyTableId, Long propertyId, Integer classNameId, ConnectionWrapper cw) throws SQLException { StringBuilder statement = new StringBuilder(150); statement.append("SELECT COUNT(*) FROM "); statemen...
cf9365e3-c910-411d-8176-852cf6d792f8
0
private NoteEditorFrame(){ frame = new JFrame(FRAME_TITLE); initialize(); }
cb7559e2-9f83-4af7-aa16-2b59b04e13cc
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
ae7c7747-163d-4e99-ab8b-ea1f0f7ab0a8
3
private String getSimpleText(Element element) { if (element == null) return null; StringBuffer sb = new StringBuffer(); NodeList nodes = element.getChildNodes(); Node node; for(int i=0; i < nodes.getLength(); i++) { node = nodes.item(i); if (node.getNodeType() == Node.TEX...
8394dddb-6611-4416-9768-d4f8f6d23fa2
5
private String getEventDescription() throws XMLStreamException { switch (look().getEventType()) { case START_DOCUMENT: return "start of document"; case END_DOCUMENT: return "end of document"; case START_ELEMENT: return "start of " + getNameOfStartElement(); case END_ELEMENT: return "end of...
157fa7e9-d7b0-4b77-9ae2-d69616c8dcd5
2
public void saveFruits() throws IOException { FileOutputStream fos = new FileOutputStream(DevilFruits.getInstance().getDataFolder() + "/fruitdata.xml"); if(fos == null) return; ObjectOutputStream oos = new ObjectOutputStream(fos); if(oos == null) return; oos.writeObject(fruits); oos.cl...
63c33773-819c-47ed-a31e-f3d84047f918
1
public void addTag (String strTag) { if (!tagV.contains(strTag)) tagV.add(strTag); }
4e22ab16-00d8-4dc9-8d38-368d01815d8d
2
public void register(short id,Class<?> block){ if(registeredBlocks.containsKey(id))throw new IllegalArgumentException("Block is already registered"); registeredBlocks.put(id, block); }
e9a85bcb-ebec-47f6-a56b-154728364962
2
public void testPropertySetMilli() { LocalDateTime test = new LocalDateTime(2005, 6, 9, 10, 20, 30, 40); LocalDateTime copy = test.millisOfSecond().setCopy(12); check(test, 2005, 6, 9, 10, 20, 30, 40); check(copy, 2005, 6, 9, 10, 20, 30, 12); try { test.milli...
1f0ef608-32e5-4964-9029-cc99c46d20d6
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://download.ora...
55ebff7b-f66d-4f1e-a838-9ad6464142c8
2
public Matrix4f mul(Matrix4f r) { Matrix4f res = new Matrix4f(); for(int i = 0; i < 4; i++) { for(int j = 0; j<4; j++) { res.set(i, j, m[i][0] * r.get(0, j) + m[i][1] * r.get(1, j) + m[i][2] * r.get(2, j) + m[i][3] * r.get(3, j)); } } return res; }
adf39473-a417-43be-9766-e6e431977fc3
8
public void createFiveFoldCrossValidation() { HashMap<Character, ArrayList<String>> mapaco = new HashMap<Character, ArrayList<String>>(); Character inicial = 'A'; for (int i = 0; i < 26; i++) { ArrayList<String> letra = new ArrayList<>(); mapaco.put(inicial, letra); System.out.println(inicial); inici...
81b9a0f6-9d34-4e00-8a93-6aeba6406427
0
public ExitRespMessage(int seq) { int len = 12; buf = new byte[len]; TypeConvert.int2byte(len, buf, 0); TypeConvert.int2byte(RequestId.Exit_Resp, buf, 4); TypeConvert.int2byte(seq, buf, 8); }
3d609431-25e6-44e7-8f32-9e4eb492db44
4
@Override public Skin newSkin(String skinname, String author, String web, Path img) { if ((skinname == null) || skinname.equals("")) { IllegalArgumentException iae = new IllegalArgumentException("Name is null or empty!"); Main.handleUnhandableProblem(iae); } Error er...
bbf1bb92-9cc2-4ca0-a478-0a4cd2171d37
3
public void doAction(String value) { char choice = value.toUpperCase().charAt(0); while (choice != 'F' && choice != 'T') { System.out.println("Invalid selection"); choice = getInput().toUpperCase().charAt(0); } if (choice == 'F') { System.out.println...
7b03a5bd-f2da-4322-a3e8-1ea98987179c
7
private double[] forwardPropagate(double[] input) { if(input == null || input.length + 1 != x[0].length) { throw new RuntimeException("Wrong number of input elements."); } x[0][x[0].length - 1] = 1.0; for(int i = 0; i < input.length; i++) { x[0][i] = input[i]; } for(int i = 1; i < ...
55d890d8-b31b-4ec5-8b2c-888bbc70d611
8
@Override public Rectangle getBounds() { float x = position.x, y = position.y; float width = sprite.getRegionWidth(), height = sprite.getRegionHeight(); bounds.x = x; bounds.y = y; bounds.width = width * scale.x; bounds.height = height * scale.y; switch (registration) { case BOTTOM_CENTER: bounds.x = ...
86ee2e5d-7518-4ad6-a0bd-3d3639aa00e2
2
private Token isReservedWord(Token token) { Token tok = token; for (ReservedWord rw : ReservedWord.values()) { //Si encontramos que en el enum ReservedWord existe el lexema que estoy comparando, entonces devuelvo el TokenType que tiene asociado en ese enum. //de lo contrario devu...
e46da89f-383d-4583-bf1e-a58c8ad76bbe
4
public void stageOne() { if(this.checkerObject.getUp()==1) { // Able to move to up this.openNodes.add(new Node((this.currentNode.getX()-1), (this.currentNode.getY()))); } if (this.checkerObject.getLeft()==1) { // Able to move to left this.openNodes.add(new Node((this.currentNode.getX()), (this.current...
5cb5714c-da25-452a-91a1-80a04e198caa
4
private void NextBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NextBtnActionPerformed // TODO add your handling code here: setResponse(); String ac = evt.getActionCommand(); //Show next question if (ac.equals("Next") && qIndex < quiz.questionList....
6ac0d0d4-4f2c-41f0-b1a6-5c1c6b41b06b
9
@Override public Iterable<JavaFileObject> list(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException { if (recurse) throw new UnsupportedOperationException("recurse is not currently supported"); boolean passes = false; if (location.isOutp...
b707967f-5f8f-4c0f-abd0-bac849ce4dd2
2
public Client(Server server, Socket s) throws IOException, MalformedHeaderException { this.server = server; this.socket = s; this.socketAdapter = new SocketAdapter(this.socket, this); this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); this.out = new PrintWriter(this.socket.get...
1cfd95a1-7169-4655-b790-ab6bd368a446
7
public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) { if ( i > __field_names.length ) return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 ); HeartBeatTimer v = (HeartBeatTimer)o; switch (i) { case 0: v.peerID = in.getInt(); break; case 1: ...
802fbfe1-7580-4774-960a-3777bc487901
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
0c7d315a-5132-455f-ae88-859e50fa2868
6
private static AlignmentCell getACel(int x, int y, int affinePenalty,AlignmentCell[][] cels, float gapPenalty, SubstitutionMatrix sm, String s1, String s2) throws Exception { float top = Float.NEGATIVE_INFINITY; float left = Float.NEGATIVE_INFINITY; if( affinePenalty >0 ) // linear gap { top...
fd967dd9-d59f-4d3a-a1a0-ac399f231b62
2
public boolean isSet(String path) { Configuration root = getRoot(); if (root == null) { return false; } if (root.options().copyDefaults()) { return contains(path); } return get(path, null) != null; }
4e17fb7d-a90b-4259-a266-8f3d3db60105
9
public void checkFlyBy(double limit, double checkTime, double[] bodies) throws Exception { double t; int i; double limit2 = limit * limit; for (i = 0; i < this.bodies; i++) { bodies[i] = Double.NaN; } this.flag = 4; t = this.time + checkTime; double timeStep = Math.abs(this.timeStep); this.time...
fff90a4f-1c4f-4aea-a076-c6c57c9b68c9
6
public void stateChanged(ChangeEvent e) { if(e.getSource() instanceof JSlider) { JSlider source = (JSlider)e.getSource(); double val = source.getValue(); if(source.getName().equals("tempSlider")) World.temp = val; else if(source.getName().equals("presSlider")) Wo...
ddf266ad-657a-443e-ba78-888a0d2714b2
8
@Override public ArrayList<BoardPosition> getPossibleMoves(Board board, BoardPosition startingPosition) { int x = startingPosition.getColumn(); int y = startingPosition.getRow(); ArrayList<BoardPosition> possibleMoves = new ArrayList<BoardPosition>(); //"long" move first LM...
8011b029-8c3a-4463-97ad-363c4900cf64
1
@Override public void end() { if (id > 0) userControls.put(id, new LayoutControl(id, theClass, isSensitive)); }
c6916aa6-16a6-4ff4-8ad8-560cd3362a65
0
public int getCount() { return this._count; }
d09fd062-e844-4a4d-848e-79cef28ecda7
4
public static int bruteForce(String pattern, String docs) { int M = pattern.length(); int N = docs.length(); for (int i = 0; i < N - M; i ++) { int j; for (j = 0; j < M; j++) if (pattern.charAt(j) != docs.charAt(i + j)) break; if (j == M) return i; } return N; }
0a3288c9-7d5a-45d7-892c-7f2261a8e013
2
public void updateType() { Type newType; if (!opAssign) { /* An opassign (+=, -=, etc.) doesn't merge rvalue type. */ Type lvalueType = subExpressions[0].getType(); Type rvalueType = subExpressions[1].getType(); subExpressions[0].setType(Type.tSuperType(rvalueType)); subExpressions[1].setType(Type....
cd094965-ca4a-4644-8cf2-1618b8a4a0ad
1
@Test public void angleBetweenPointsTest() { Point p1 = new Point(0,0); Point p2 = new Point(8,5); Point p3 = new Point(7.5, 7); assertEquals(new Angle(45.0), p1.angleBetween(new Point(5,5))); assertEquals(new Angle(225.0), new Point(5,5).angleBetween(p1)); // test opposite for (int i = 0; i < TESTS...
12ba26f8-96c1-4ed2-a319-a36009121c7e
7
public int[] maxSlidingWindow(int[] nums, int k) { if (nums.length == 0) { return new int[0]; } int resultSize = nums.length - k + 1; int[] result = new int[resultSize]; int offset = k - 1; // Use a double ended queue which maintains ordering ...
ba89b423-1c21-456f-b962-e84c636f1afa
1
private void btnAdicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdicionarActionPerformed Produto p = (Produto) cbxProdutos.getSelectedItem(); int qtd = Integer.parseInt(txtQuantidade.getText()); ItemVenda item = new ItemVenda(); try { ...
bfa44980-3d15-4a58-b5bb-050c9ccce042
2
public static void listarClientes(HashMap<Integer, Clientes> tablaClientes) { if (tablaClientes.isEmpty()) // No hay clientes en el sistema { System.out.println("No existen clientes dados de alta"); } else { String nombre = null; String apellidos = null; String dni = null; int edad; Se...
fec4047b-2f70-4b77-8193-9f13abf773d4
8
protected double getNodeDistribution(int i) { double energy = 0.0; // This check is placed outside of the inner loop for speed, even // though the code then has to be duplicated if (isOptimizeNodeDistribution == true) { if (approxNodeDimensions) { for (int j = 0; j < v.length; j++) { if (...
4986f1d4-7078-45fa-976b-415581f1e9af
5
private final int method1481(int i, int i_1_) { if (i_1_ == 255) { int i_2_ = buffer.getUByte(); int i_3_ = buffer.method3366((byte) 112); if (i_2_ == 47) { ((ByteBuffer) buffer).position += i_3_; return 1; } if (i_2_ == 81) { int i_4_ = buffer.getTri(); i_3_ -= 3; int i_5_ = ((MidiF...
14254d81-4fa2-4868-81fc-dcd4ca3b284a
0
public void setVue(VueComptesRendus vue) { this.vue = vue; }
873a7f38-8891-473a-b2d1-3923f137e73d
0
public TextKeyListener() {}
477d507b-257b-4afb-b05d-867eff67264c
5
public void addNewBall() { if(nBalls<maxBalls) { for(int i=0;i<maxBalls;i++) if((balls[i]!=null && !balls[i].ballAlive) || balls[i]==null) { balls[i]=new Ball(); new Thread(balls[i]).start(); break; } nBalls++; } }
c34f7565-0455-40b2-bad4-355c90f99ecb
3
public String getValue(String node) { String val = null; this.pattern = Pattern .compile("^<node=\"([-a-zA-Z,._\\/0-9]{1,})\">([-a-zA-Z,._\\/0-9\\s]{1,})<\\/node>"); for (String line : this.getConfigFileLines()) { this.matcher = this.pattern.matcher(line); if (this.matcher.matches()) { String n = th...
5faaf90e-58fa-47fd-ab5c-9026ce040254
1
public CharacterSelect(GameStateManager gsm) { this.gsm = gsm; try { bg = new Background("/Background/PlainBG.png", 1, false, 0); bg.setVector(-0.1, 0); titleColor = new Color(128, 0, 0); titleFont = new Font("Maximilien", Font.PLAIN, 28); maximilien = new Font("Maximilien", Font.PLAIN, 15); }...
16c4ec5f-c694-46a3-ab70-27753365f3e1
6
public synchronized T get(IndexReader reader, Object coreKey, Object delCoreKey) throws IOException { T value; if (cache == null) { cache = new WeakHashMap<Object,T>(); } if (deletesMode == DeletesMode.IGNORE) { // key on core value = cache.get(coreKey); } else if...
f8159101-ed86-4a78-96ce-1b5dc20ee3bd
0
public ArrowDisplayOnlyTool(AutomatonPane view, AutomatonDrawer drawer) { super(view, drawer); }
f569c725-6df7-4366-ab08-df4801b8c24b
9
public static byte[] decode(byte[] bytes) { if (bytes == null) throw new NullPointerException("bytes"); if (bytes.length % 2 != 0) throw new IllegalArgumentException("Hex data length must be a multiple of 2"); int retlen = bytes.length / 2; byte[] ret = new byte[retlen]; for (i...
4faf425c-95c2-4462-880e-a217fa9fa0cd
4
public double getMRR() { if (this.predictionData.size() != 0 && this.realData.size() != 0) { double sum = 0.0; for (String val : this.realData) { int index = 0; if ((index = this.predictionData.indexOf(val)) != -1) { sum += (1.0 / (index + 1)); } else { sum += 0.0; } } return sum...
f574a5d2-f6fd-4254-af95-e6c441c77ae9
1
private boolean viewIsUnbounded() { Pannable p = getPannableView(); return (p != null && p.isPannableUnbounded()); }
66367d3d-9582-4d00-bf9e-0d156ddcc541
0
public static void main(String[] args) { Exception4 test = new Exception4(); test.method(); }
02cea464-be60-4be8-bd30-021bf7df3ad4
2
public int NumShips(int playerID) { int numShips = 0; for (Planet p : planets) { if (p.Owner() == playerID) { numShips += p.NumShips(); } } return numShips; }
bcaacfaa-790b-4caa-8700-8fdefe01d496
1
@Override public int hashCode() { int hash = 0; hash += (idAddress != null ? idAddress.hashCode() : 0); return hash; }
8bf5bd3b-31a0-41b6-b8ba-8edacfb6a6da
4
public ClassGroup(String name, String description) { if (name == null || name == "" || description == null || description == "") throw new IllegalArgumentException(); this.name = name; this.description = description; }
808b6dc3-1fff-4c3c-96d4-51b7a236c754
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Fato)) { return false; } Fato other = (Fato) obj; if (identificadorGrupo == null) { if (other.identificadorGrupo != null) { return false; } } else...
c93d3919-ff00-426d-b567-120562c3e6b1
2
public void setHeight(float height) { if ((height > 0.0) && (height < 20.0)) { this.height = height; } else { height = 0; } }
1ed1ab20-a35a-4c82-817a-92f146f4d427
0
private ImageProcessor bwAreaOpen(ImageProcessor region, int size){ ImageProcessor result = region.convertToByteProcessor(); result.threshold(0); result.invert(); ImagePlus ip = new ImagePlus("Temp", result); ParticleAnalyzer pa = new ParticleAnalyzer(ParticleAnalyzer.IN_SITU_SHOW | ParticleAnalyzer.SHOW_MASK...
71b9880d-54d5-472c-bed8-d16682e14333
7
private void filterPixels(DirectGif89Frame dgf) throws IOException { if (ciLookup == null) throw new IOException("RGB frames require palette autodetection"); int[] argb_pixels = (int[]) dgf.getPixelSource(); byte[] ci_pixels = dgf.getPixelSink(); int npixels = argb_pixels.length; ...
9af434b5-5dc9-4cbe-8293-59a53aa25e75
8
public static String preProcess(Reader reader) { int columnStart = 6; int columnEnd = 72; try { // FileInputStream propsStream = new FileInputStream("cb2xml.properties"); Properties props = new Properties(); // props.load(propsStream); // pro...
7d184779-8a5c-4380-a27a-75ac1bb8967f
8
public Object nextValue() throws JSONException { char c = nextClean(); String s; switch (c) { case '"': case '\'': return nextString(c); case '{': back(); return new JSONObject(this); case '[': ...
f70d8a20-d24a-4eef-9237-0a03eeec3337
3
private boolean valueExists(int[] values, String[][][] pathsFromRoot) { for (int i = 0; i < values.length - 1; i++) { if (!(pathsFromRoot[i].length > values[i + 1])) { return false; } else { if (!(pathsFromRoot[i][values[i + 1]].length > values[0])) { return false; } } } return true; }
25f40887-4aea-407d-9700-0f9420d404b5
3
private BonusQuestion loadFromPanel() { BonusQuestion bq = new BonusQuestion(); bq.setPrompt(tfPromptInput.getText().trim()); if (rbMultChoice.isSelected()) { bq.setBonusType(BONUS_TYPE.MULTI); String[] answers = new String[rbAnsList.size()]; for (int i = 0; i < rbAnsList.size(); i++) { ans...
fa5c9460-aa39-4a6d-875c-8c40cdd8807d
3
public static boolean isCyclicDirected(mxAnalysisGraph aGraph) { mxGraph graph = aGraph.getGraph(); mxIGraphModel model = graph.getModel(); Object[] cells = model.cloneCells(aGraph.getChildCells(graph.getDefaultParent(), true, true), true); mxGraphModel modelCopy = new mxGraphModel(); mxGraph graphCopy = new...
c308e292-7956-4774-95b6-57b0ba9fc71e
4
@Override public void close() { if (isNotReady()) { return; } try { onClose(); } catch (IOException e) { // ignore } finally { closed = true; if (initialized) { protocol.releaseBuffer( buffer ); for (ByteBuffer bb : bufferOut) { protocol.release...
237b2e04-9bda-4277-ba3f-d2d1743ee828
5
private int getXIndex(GeoParams geoParams, STTPoint sttPoint) { double delta_x; if (geoParams.geoBoundNW.longitude > geoParams.geoBoundSE.longitude && geoParams.geoBoundNW.longitude > sttPoint.getLatLong().longitude) { //Our point is wrapped around 180/-180 if (geoParams.geoBoundSE.longitude > sttPoint....
715e7943-ccb2-4fe8-8b99-fdfa5b29c193
8
public String getPluralForm() { // TODO: Complete this method // If the word ends in y preceded by a consonant you take away the y and add ies. // If the word ends in y preceded by a vowel, you just add an s. // You add an es when a word ends in o, or s, or sh, or ch. // In all the other...
58a146fe-0d4a-4443-8237-f79b06c76dc1
2
private int getolid(int mask) { for (int i = 0; i < olc.length; i++) { if ((mask & (1 << i)) != 0) { return i; } } return 0; }
399c94bd-28a4-4476-9054-f81d9607c77e
6
public ArrayList<String> revMsg(int which) { // Read the first message from standard input StringBuilder str = new StringBuilder(); String holder; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); try { holder = i...
8f253a0b-3665-44be-8aa2-eff1d5520195
9
@SuppressWarnings("unchecked") public static <T> T[] arrayOfArraysSorter(T[] tab, int sortColumn) { int tabLength = tab.length; if (tabLength == 0) return tab; for (int i = 0; i < tabLength; ++i) { if (!tab[i].getClass().isArray()) throw new IllegalArgumentException( "Array does not contain Array...
dcb76019-c551-4341-9560-6f4703874a92
0
public void runMainWindow(){ mainWindow = new FrameGeneralWindow("Analyzer"); }
a1b5bb88-ab95-441d-9a8a-68404493a2a8
2
private final Element getAlbumListNode(String artistName, String albumName) throws GetHttpException, MusicbrainzUrlException, CreateDocException { String content= ""; content= this.getHttp.getWebPageAsString(MusicbrainzUrl.getMbRelease(artistName, albumName)); if(content.equals("")) return null; th...
ce404d45-a1b1-4eb9-982a-d1b85bde68b5
1
@Override public void focusLost(FocusEvent e) { for (int i=0; i<keys.length; i++) { keys[i] = false; } }
32664624-6e65-4610-9380-dedffe582d48
1
public void displayEnd() { String s = myLemma.createPumpedString(); myPumpedStringDisplay.setText(s); if(myLemma.isInLang(s)) myLastWord.setText(createXYZ() + " = " + PumpingLemmaInputPane.toHTMLString(s) + " = " + s + " is in the language. YOU W...
73f39b5a-ae56-41a7-a967-c9ce5b74cf15
3
public static String supportReport(boolean abbrev) { ArrayList<Property> props= new ArrayList<Property>(); for(Property p : MediaProperty.values() ) { props.add(p); } Collections.sort(props, new Sorter()); String fmt; if(abbrev) { fmt="%-40.40s|%-38.3...
55e59870-ad6c-4afb-a882-ac4c2192ec39
1
public E min() { if (tail != null) { final E e = (E) head.getKey(); return e; } else { return null; } }
c9f35f95-bbe9-417c-bf2a-8e984e872cfa
7
public void testConstructor_int_int_int_int_int_int_int() throws Throwable { MutableDateTime test = new MutableDateTime(2002, 6, 9, 1, 0, 0, 0); // +01:00 assertEquals(ISOChronology.getInstance(), test.getChronology()); assertEquals(LONDON, test.getZone()); assertEquals(TEST_TIME_NOW, t...
3ef0e969-ad19-4019-b8a6-e2bb9d27ea3d
7
static public String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String s = Double.toString(d); if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) { ...
7999dc7f-c9cb-4fb0-bd7d-6b1e2a05a896
0
public void setGoTo(String []goTo) { this.goTo=goTo[0]; }
e840ba89-1233-4000-83ec-de71509afa8a
3
public boolean isZero(){ boolean test = true; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ if(this.matrix[i][j]!=0.0D)test = false; } } return test; }
6454da06-5a33-4fa7-9979-585d80fd786f
1
public Vector2f subtractX(float x) { if (this.x > 0) this.x -= x; return this; }
70816f0c-70b0-4ab2-a2b0-42f7edccbf96
2
public static void loadQuestions() { List<String> questionlist = Config.getStringList("questions"); for(String s:questionlist){ String[] args = s.split("-"); if(args.length >= 4){ questions.add(new Question(args[0], args[1], args[2], Integer.valueOf(args[3]))); }else{ System.out.println("Error for ...
767b2902-a09e-48d1-b281-59c17b21c767
5
public boolean isMultipleHits() { // These tags are produced by BWA // XA: Alternative hits; format: (chr,pos,CIGAR,NM;)* String xa = findTag("XA"); if (xa != null) return true; // It has 'XA' tag? => It is hitting multiple regions // XT: Type: Unique/Repeat/N/Mate-sw String xt = findTag("XT"); if ((xt ...