method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1b549b3c-37bb-43af-9da9-995d046377a9
7
public void actionPerformed(ActionEvent e) { if (e.getSource() == Ok) { // Update options that do not require a reset theme = (String) themeSelect.getSelectedItem(); Game.repaintGrid(); // Check options that might require a game reset boolean requireRestart = false; requireRestart = requireResta...
2f7360e8-8fe1-4d11-9884-83ec808f6526
0
@Override public String toString() { return "From:" + from + "\nTo:" + to + "\nMsg:"+text+"\n"; }
19d56705-b440-4089-8768-8c70af744159
2
public void dessineGrille(final Graphics g) { //La grille apparait en noir. g.setColor(Color.BLACK); //colonnes for (int i = 0; i <= (this.tailleCase * this.largeurGrille); i += this.tailleCase) { g.drawLine(i, 0, i, this.tailleCase * this.hauteurGrille); } //lignes for (int j = 0; j <= this.ta...
70bfc688-0af8-401c-8312-d43b7e0880ea
5
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_W) { up = false; } if (key == KeyEvent.VK_A) { left = false; } if (key == KeyEvent.VK_S) { down = false; } if (key == KeyEvent.VK_D) { right = false; } if (key == KeyEvent.VK_SPACE) { space = false;...
16fc0844-367a-4b99-8031-3b32379dd633
6
public void tabulate(ArrayList<Response> resp){ //Takes a list of relevant responses for a question and displays all choices made ArrayList <Integer> count = new ArrayList <Integer>(); ArrayList <String> s = null; for (int i = 0; i < resp.size(); i++){ //For every response for (int j = 0; j < choice.size();...
6e5bf8a6-ece3-4fcf-9134-f3229c541b1e
2
@Override public void onServerStatusChanged() { ServerStatusController.ServerStatus serverStatus = ServerStatusController.getServerStatus(); switch (serverStatus) { case AVAILABLE: TestInfo testInfo = BmTestManager.getInstance().getTestInfo(); boolean test...
9773e901-2d7d-4926-9f04-d0234e8d58af
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TimeSerieRange other = (TimeSerieRange) obj; if (Double.doubleToLongBits(maxX) != Double .doubleToLongBits(other.maxX)) return false; if...
df8e8e04-e5bc-420f-8a71-6563028d7b30
0
public Almacen(int idAlmacen, String nombre, String posicion) { this.idAlmacen = idAlmacen; this.nombre = nombre; this.posicion = posicion; }
a91d4e58-046a-488c-a4cb-b96dfbebe5ab
3
protected boolean configureGraphics(mxGraphics2DCanvas canvas, mxCellState state, boolean background) { Map<String, Object> style = state.getStyle(); if (background) { // Paints the background of the shape Paint fillPaint = hasGradient(canvas, state) ? canvas .createFillPaint(getGradientBounds(can...
7876e309-77fe-4c48-9019-e487446d12c2
5
private boolean closeAddressBook() { if(isModified) { //ask user if they want to save current address book MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO | SWT.CANCEL); box.setText(shell.getText()); box.setMessage(resAddressBook.getString("Close_save")); int choice = box.open();...
fc691bed-d63f-453b-b982-3eaff1d47fde
1
public void testPlusFields() { Period test; test = Period.years(1).plusYears(1); assertEquals(new Period(2, 0, 0, 0, 0, 0, 0, 0, PeriodType.standard()), test); test = Period.months(1).plusMonths(1); assertEquals(new Period(0, 2, 0, 0, 0, 0, 0, 0, PeriodType.standard()), test); ...
92974e38-c034-4f5c-b0c7-980fa573c444
2
public Object callScript(String scriptName, List<String> keys, List<String> args) throws LuaScriptException { String scriptContent = getScript(scriptName); this._sha1Key = getScriptHash(scriptContent); try { Object o = callScriptByHash(_sha1Key, keys, args); return o; } catch (Exception e) { _logge...
c1a2a803-1cf8-4fca-be8c-00779c131eff
8
public void sort() throws IOException { Partitioner<Text> partitioner = new Partitioner<Text>(); BufferedReader[] inputArray = new BufferedReader[this.fileCounter]; BufferedOutputStream[] outputArray = new BufferedOutputStream[this.partitionNum]; /* Initialization */ for (int i = 0; i < this.fileCoun...
ef0680ad-1736-43d2-9151-7f51d505d655
7
public final String readLine() throws IOException { StringBuffer input = new StringBuffer(); int c = -1; boolean eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; break; case '\r': eol = true; long cur...
5a803313-ac90-4b18-ad5d-dd97b47b901e
7
public boolean tableExists(String tableName) throws Exception { if (!isConnected()) throw new IllegalStateException("Not connected, please connect first!"); if (m_Debug) { System.err.println("Checking if table " + tableName + " exists..."); } DatabaseMetaData dbmd = m_Connection.getMeta...
10dd0c7f-bd9d-4061-98f7-b7412124fc02
3
public static void noSpace(String string) throws JSONException { int i, length = string.length(); if (length == 0) { throw new JSONException("Empty string."); } for (i = 0; i < length; i += 1) { if (Character.isWhitespace(string.charAt(i))) { throw new JSONException("'" + string +...
217560c0-8550-456f-aa52-17971cfedd12
9
public static Point getIntersection(Point p1, Point p2, Point p3, Point p4) { float a1 = p2.getY() - p1.getY(); float a2 = p4.getY() - p3.getY(); float b1 = p1.getX() - p2.getX(); float b2 = p3.getX() - p4.getX(); float det = a1 * b2 - a2 * b1; if (Math.abs(det) <= epsilo...
712e245a-810f-4597-85f8-686e0fb15064
7
static boolean ok(){ int[] maxIndex = new int[1<<chosenCount]; maxIndex[0] = -1; for(int i=1; i<(1<<chosenCount); i++){ for(int pos=0; pos<chosenCount; pos++){ if((i&(1<<pos))!=0){ int j = i^(1<<pos); int offset = 0; ...
7a86d5e8-059f-4f3b-a383-3e1600150fff
2
public void removeLayer() { if (layers.size() > 1) { addUndo(new CPUndoRemoveLayer(activeLayer, curLayer)); layers.remove(activeLayer); setActiveLayer(activeLayer < layers.size() ? activeLayer : activeLayer - 1); invalidateFusion(); callListenersLayerChange(); } }
d9e2e4fe-6493-4134-8833-f008ecea3e94
7
public void tsekkaaLopetusehto(){ if (!loppuiko){ if (h1.getElinvoima() <= 0 && h2.getElinvoima() > 0){ asetaVoittoteksti("Pelaaja 2"); loppuiko = true; } else if (h2.getElinvoima() <= 0 && h1.getElinvoima() > 0){ asetaVoittoteksti("Pelaaja...
f8cce727-45f7-45ec-905b-a4e66d62bb43
9
private void doConnect(String username, String password, String url, Properties props) throws CommandException { try { if (props != null && !props.isEmpty()) { if (!props.containsKey("user") && username != null) { props.put("user", username); } if (!props.containsKey("password") && password != nul...
65b8b5c1-2b45-4be7-b18e-96298edd9fa8
4
private void btnPlaybackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlaybackActionPerformed File file = new File("data/" + txtFile.getText()); if (file.exists()) { for (LinkKNN knn : knns) { knn.learnType((String) lstTypes.getSelectedValue()); ...
8aaa80b6-6f2c-4be8-8fd9-d32d21341f1a
6
public String path() { int x=matrix[0].length-1; int y=matrix.length-1; String rs1=""; String rs2=""; String resultalt=""; int pos1=matrix[0].length-2; int pos2=matrix.length-2; while(x>0 || y>0) { if(matrix[y][x][1]==1 && y>0) { rs1=s2[pos2]+rs1; pos2--; rs2="-"+rs2; y--; ...
e9665592-5a9e-4466-acec-4b22a41f0056
1
public void startClocks() { for(Match m : liste) { m.startClock(); } }
2badc1bb-6711-4c77-b404-b25d5283468f
9
public AddInvoiceDialog(java.awt.Frame parent, boolean modal, AddInvoiceDelegate delegate) { super(parent, modal); initComponents(); this.delegate = delegate; comboPriceClass.addItem("A"); comboPriceClass.addItem("B"); DateOutlet.add(datepicker); datepicker.setD...
c22d682f-1454-44d2-be7e-af5bfa7cc10b
3
private static double tanQ(double xa, double xb, boolean cotanFlag) { int idx = (int) ((xa * 8.0) + 0.5); final double epsilon = xa - EIGHTHS[idx]; //idx*0.125; // Table lookups final double sintA = SINE_TABLE_A[idx]; final double sintB = SINE_TABLE_B[idx]; final double...
2d29b06b-f269-4f29-913f-047a78e4d40b
3
public static void main(String[] args) { // TODO Auto-generated method stub int[][][] score = { { { 100, 90, 80, 70 }, { 90, 80, 70, 60 }, { 80, 70, 60, 50 } }, { { 100, 100, 90, 80 }, { 100, 90, 80, 70 }, { 90, 80, 70, 60 } } }; // for (int tab = 0; tab < score.length;...
898215e9-410b-4a8c-9cf7-62d59796cb44
8
public String decodeString(boolean implicit) throws Asn1Exception { String retValue = null; // // There must be at least 2 bytes available // if (residualLength < 2) throw new Asn1Exception("Attempt to read past end of stream"); // // Validate the ta...
3fe5c21a-64f6-4bba-ba0c-02208172dc06
8
private int sendRollCallAndProcessResponders(MulticastSocket pSocket, DatagramPacket pOutPacket, DatagramPacket pInPacket, int pResponseCount) { String response; int responseCount = pResponseCount; try {pSocket.send(pOutPacket);} catch(IOException e) { logSevere(e.getMessage...
3e2ff15d-98d6-4987-ae53-839b3d9ccf6c
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) { ...
9d996861-68b2-4843-bebf-aedbfd7d4e51
9
public static RealInterval oddRoot(RealInterval x, double y) throws IAException { double ylo,yhi,zlo,zhi; if (y == 0.0) // throw new IAException("oddRoot(X,y): y=0 not allowed"); return RealInterval.fullInterval(); else if (y > 0.0) { ylo = RMath.div_lo(1.0,y); yhi = RMat...
23055cf3-9d37-450d-927e-9c18d3a04242
7
public double[] getNormalizedCentrality(String fileName, int centralityMode) { double[] result; if (centralityMode == 0) { result = getCentrality(fileName, 0); } else if (centralityMode == 1) { result = getCentrality(fileName, 1); } else if (centralityMode == 2) { result = getCentrality(fileName, 2); ...
58a6ae8b-dd24-42c5-a9e8-e14dd8c1d040
7
public double getKokBisection() { double a1 = getBas(); double b1 = getSon(); double fa = 0; double fb = 0; double fc = 0; do { fa = 0; fb = 0; fc = 0; ara_deger = (a1 + b1) / 2; for (int i = 0; i < katsayilar....
0936e23a-3f9c-4f15-a7a0-b80992517945
7
public void guardarIncidente() { FacesMessage msg; if (!getAdministracionControl().isIncidenteadmin()) { if (!"".equals(incidente.getCiudadano().getTercero().getNombres()) && !"".equals(incidente.getCiudadano().getTercero().getApellidos()) && !"".equals(incidente.getCiuda...
4fc0fa64-eb7a-450d-8938-dd70d8cfbb52
1
public void lastStep() { if (this.state != null) { this.state.lastStep(this); } }
4840cc59-394a-44e4-abc3-7716ad654767
2
@Override public void endElement(String uri, String localName, String qName) throws SAXException { String tipo = getTipo(); if(tipo.equals("getCPU")){ switch(qName){ //tag atual. Ex.: <host...> case "host": docList.add(doc); break; default: break; }//fim switch }//fim...
13327687-22fc-4528-9320-25006b50ce95
8
public void printTokenAnalyzed(int type) { Iterable<CSVRecord> parser = readFile(); if (parser == null) return; switch (type) { case AnalyzerFactory.ANALYZER_STANDARD: System.out.println("STAND ANALYZER START...."); break; case AnalyzerFactory.ANALYZER_CJK: System.out.println("CJK ANALYZER START.....
bc65a05b-a15b-4da2-b76d-9302bc8acb44
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
6eebb8ae-8e96-4adf-a358-de7b2e9a98ec
3
public void deleteUser(String email) { Connection connection = null; String[] query = new String[4]; query[0] = "DELETE FROM users WHERE email = ?;"; query[1] = "DELETE FROM blabs WHERE email = ?;"; query[2] = "DELETE FROM follows WHERE follower = ?;"; query[3] = "DELETE FROM follows WHERE following = ?...
1a520550-7d73-4a94-a4be-d01b494387b7
3
public void create(Map data, String savePath, String className,String templateName) throws IOException { log.info(String.format("create class %s from template %s,save to %s",className,templateName,savePath)); Template template = cfg.getTemplate(templateName); JavaClassNameParser parser = new Jav...
a3902a8f-148c-4601-bb2d-1f1e09b0a9ce
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TMasterOutlet other = (TMasterOutlet) obj; if (!Objects.equals(this.scyOutCode, other.scyOutCode)) { ...
d14004ec-b38e-4559-9d6e-6b1a731fe36b
6
public int compareTo(Date that) { if (this.year < that.year) return -1; if (this.year > that.year) return +1; if (this.month < that.month) return -1; if (this.month > that.month) return +1; if (this.day < that.day) return -1; if (this.day > that.day) return +1...
d00acd06-20cc-42fe-ae9b-abbfe328cca2
2
@SuppressWarnings("unchecked") public static <T> T getSelfOrAncestorOfType(Component component, Class<T> type) { if (component != null) { if (type.isAssignableFrom(component.getClass())) { return (T) component; } return getAncestorOfType(component, type); } return null; }
7687169a-9ad5-4f28-9cba-185c8182b565
2
@Override public void paintSelf(Graphics g, int pixelSize, Color[][] colorArr, Color curColor) { if (start == null) return; ArrayList<Point> ch = bresenham(start, temp); g.setColor(curColor); for (Point p : ch) { g.fillRect(p.x*pixelSize+1, p.y*pixelSize+1, p...
682fe5a9-3d89-4280-ad1e-f9a15744f7d0
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClas...
7c0fc6e1-0113-42ad-a75e-6461d66b4388
1
public String findCatalog(String orgLink, String catalogName) throws Exception { String response = doGet(orgLink); String element = findElement(response, Constants.LINK, Constants.CATALOG_LINK, catalogName); if( element == null){ throw new Exception("No Catalog found that matches the given name: " + catalogNa...
658368a7-d6c7-4bb8-b0d0-a2116a8053cf
7
public int historicalGetType (String typestr) { if (typestr.equalsIgnoreCase(HE_POP_SIZE_STRING)) { return HE_POP_SIZE; } else if (typestr.equalsIgnoreCase(HE_POP_SIZE_EXP_STRING)) { return HE_POP_SIZE_EXP; } else if (typestr.equalsIgnoreCase(HE_BOTTLENECK_STRING)) { return HE_BOTTLENECK; } ...
a95c4f4c-9092-4ffb-99f7-bb228b598e5b
9
public void registerTreeListener(String label, final JTree tree) { if(AbstractBagConstants.DATA_DIRECTORY.equals(label)) { tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { TreePath[] paths = tree.getSelectionPaths(); ...
f4e2dba5-34fb-4cb1-b7cb-e70d93d01a7c
0
public void setPrpPosId(BigInteger prpPosId) { this.prpPosId = prpPosId; }
b0b5b813-803a-4ddc-9cbc-dc8f88ad680a
5
public String getConstructor(CtClass c, String desc, MethodInfo orig) throws CompileError { String key = "<init>:" + desc; String consDesc = (String)accessors.get(key); if (consDesc != null) return consDesc; // already exists. consDesc = Descriptor.appendPara...
a4e67054-da00-4915-8fb0-5d237d590fd3
3
public static void removeBorder(String worldName) { if (!borderEnabled()) return; CircleMarker marker = roundBorders.remove(worldName); if (marker != null) marker.deleteMarker(); AreaMarker marker2 = squareBorders.remove(worldName); if (marker2 != null) marker2.deleteMarker(); }
b4e5bd8d-417c-40ac-982b-c1f3812da891
4
@SuppressWarnings("deprecation") public synchronized boolean closeConnection() { try { listModel.removeAllElements(); listmodel.removeAllElements(); onLineUsers.clear(); chatRooms.clear(); objChatRooms.clear(); frame.setTitle("Cli...
fb1e48b0-cba3-496c-9879-18e6357ed501
2
private void searchSongs() { try { String searchWord; Scanner keyboard = new Scanner(System.in); System.out.println("Enter search word, either artist or title: "); searchWord = keyboard.nextLine(); BLLSong ds = new BLLSong(); System.out.pr...
d9ab38bf-0489-4376-938d-323fa5dfe820
1
@Override public void setValues(Component target, int tweenType, float[] newValues) { ThePanel tp = (ThePanel) target; super.setValues(target, tweenType, newValues); switch (tweenType) { case BORDER_THICKNESS: tp.borderThickness = Math.round(newValues[0]); tp.repaint(); break; } }
8fcffda5-3fd7-4ef4-967a-2db69b536289
8
static boolean hasAnnotationType(Class clz, ClassPool cp, AnnotationsAttribute a1, AnnotationsAttribute a2) { Annotation[] anno1, anno2; if (a1 == null) anno1 = null; else anno1 = a1.getAnnotations(); if (a2 == null) ...
262923f8-c325-4328-a316-afc76276ac1e
2
public static int[] Unscramble(int[] m, int[] c) { int x = 0; int y = 0; while (x < m.length) { m[x] = m[x] / c[y]; x++; y++; if (y >= c.length) { y = 0; } } return m; }
8e3ffee2-f503-4b4d-8ec3-2fa388db0ccf
6
public void paintComponent(Graphics g) { super.paintComponent(g); if ( (OSI == null) || OSI.getWidth() != getWidth() || OSI.getHeight() != getHeight() ) { OSI = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); needsRedraw = true; } if (needsRedraw) { ...
8319fe91-4868-4094-8047-0c4f42e12311
7
public void updateTable() throws IOException { String backup = makeBackupTable(); ArrayList<TableElement> table = new ArrayList<TableElement>(); try { setStatus(Status.READING); File pwd = new File(WORKING_DIRECTORY.toString()); for (File current : pwd.listFiles()) { setFile(current.getName()); T...
a13e124b-fa5d-4886-8903-61614e9516a9
9
protected void addExtendsImplements(ClassDoc parent, ClassDoc cd, Content contentTree) { ClassDoc[] interfaces = cd.interfaces(); if (interfaces.length > (cd.isInterface()? 1 : 0)) { Arrays.sort(interfaces); int counter = 0; for (int i = 0; i < interfaces....
e15d378e-379e-443a-b9d9-e9bf66b8399e
4
public SkinnerApplication(String title, int width, int height) { super(title,width,height); m_Image = new ImageIcon(this.getClass() .getResource("Window.jpeg")); m_Frame = new JFrame(m_Title); m_Frame.setIconImage(m_Image.getImage()); m_Frame.setLayout(new GridBagLayout()); GridBagCo...
92239c75-2d47-48f4-aab4-31376d6a51e4
1
static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues( Map<K, V> map) { SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>( new Comparator<Map.Entry<K, V>>() { @Override public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) { retu...
4e04624b-8471-4838-87f3-3ca6911b1ec6
9
public boolean isInside(Point2D.Float point) { if (objectType == EditorObjectType.SPIKE) { if (point.x >= position.x && point.x <= position.x + width) { if (point.y >= position.y && point.y <= position.y + height) return true; } } else { if (point.x >= position.x - width / 2 && point.x <...
38c49fb4-b333-44f5-8834-dc7d22edea2b
4
public Object clone() { Grammar g; try { g = (Grammar) getClass().newInstance(); } catch (Throwable e) { System.err.println("Warning: clone of grammar failed!"); return null; } HashMap map = new HashMap(); // old variables to new variables String[] variables = getVariables(); for (int v = 0; v ...
e88d4189-efb8-464c-b92a-381830f8ea23
9
public static final int[] ensureRangeSafe(int beginIndex, int endIndex, final int length) { if (length <= 0 || beginIndex == endIndex) { return null; } if (beginIndex < 0) { // 确保 beginIndex 参数安全 beginIndex += length; if (beginIndex < 0) { beginIndex = 0; } } else if (beginIndex >= length) { ...
85ef0b44-624c-486a-905c-3e5fbe5f0e4d
5
public static void findThreaded( final int threadCount, final List<File> files, final String targetString, final StringMatchVisitor visitor) { // create finder final StringFinder scanner = new StringFinder(targetString); // create thread pool final ThreadPoolExecutor executor = new ThreadPoolE...
3b649fa2-3d17-4737-9d93-cefe846189f2
5
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
abbfd9a9-bc5d-4d87-b92a-b1ea724784c1
7
protected double[] getFinalClusterDistribution(Instance instance, int timeStep) throws Exception { int timeSteps = simpleKMeans.length; double[] finalClusterDistribution = new double[simpleKMeans[simpleKMeans.length - 1].getNumClusters()]; for (int simulations = 0; simulations < 1000; simulations++) { int labe...
a9b92942-9965-45f7-847c-8b6612752707
0
@Test public void testGetS1() { System.out.println("getS1"); Move instance = new Move(6,9); int expResult = 6; int result = instance.getS1(); assertEquals(expResult, result); }
e56ad14d-d59f-4e7d-b316-7e2d61af9dc8
3
public Point makeAIMove(OthelloBoard board){ Random r = new Random( ); /**< define the player colour */ Piece.OthelloPieceColour playerColour; if(getColour().equals("White")){ playerColour = Piece.OthelloPieceColour.WHITE; }else { playerColour = Piece.OthelloPie...
eb79f997-0954-4351-b951-9a316581c92b
5
public boolean isPowerOfTwo(int n) { boolean res = false; if (n == 1) { return true; }else if (n <= 0 || n % 2 == 1) { return false; } else { long st = 2; while (st < n) { st = st * 2; } // System.out.println(st); if (st == n) res = true; } return res; }
14c435b0-a3f5-416c-be12-1133c77f1776
8
@SuppressWarnings("unused") private void attaque() { if (!this.epuise){ this.cherche_Base(); ArrayList<Cellule> autour = this.cherche(); if (!autour.isEmpty() && (autour.size() != 0)){ this.rapproche(this.laplusproche(autour)); if (this.curent.coord == this.laplusproche(autour).coord){ this.t...
afa6becf-868c-498b-bf84-3189461d5549
7
private static void printList(List<?> r, Class<?> cl, boolean oneLiner) { boolean headerPrinted = false; for (Object o : r) { cl.cast(o); if (!headerPrinted) { if ((!(o instanceof String)) && (oneLiner)) { System.out.println(((StringHeader) o).getStringHeader()); } ...
dbe45a7c-e202-4ec6-9acb-b6e72549eded
1
public int revealAllProductions() { Set remaining = new HashSet(objectToProduction.keySet()); remaining.removeAll(alreadyDone); int number = remaining.size(); Iterator it = remaining.iterator(); Collection ps = new ArrayList(); while (it.hasNext()) { Production[] p = (Production[]) objectToProduction.get...
e540fdac-a4ab-42af-a7ef-d9bfee582b30
8
private static StringBuffer leerAsm(Scanner entrada){ StringBuffer contenido = new StringBuffer(); while(entrada.hasNextLine()){ String linea = entrada.nextLine(); if(!linea.startsWith(";") && !linea.contains(";") && !linea.equals("")){ contenido.append(linea); contenido.append("\n"); }else if(li...
59640cde-d1aa-4056-98fa-954e75b1eeee
0
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); Data.truncate(Appointment.class.getSimpleName()); Data.truncate(Reminder.class.getSimpleName()); Data.truncate(Venue.class.getSimpleName()); rtn.put("rtnCode", this.getRtnCod...
e46c3a8d-5429-4214-b568-8975aec12bbf
3
private boolean checarRFC(){ if(rfc == null){ if(nombre != null){ if(fechaNacimiento != null){ rfc = new RFC(nombre, fechaNacimiento); return true; } else{ System.out.println("No existe fecha de nacimeitno alguna para crear RFC"); return false; } } else{ System.out.pri...
b857e65c-e298-47ed-9cac-1265bf31ea95
4
public void toggle(int x, int y) { if (y < 0 || y > bits.length || x < 0 || x > ROW_LEN) return; image = null; bits[y] ^= 0x1 << x; }
05d894a8-bb22-4639-9c44-837b2a1d68cc
6
public static Stella_Object accessOutputFileStreamSlotValue(OutputFileStream self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_FILENAME) { if (setvalueP) { self.filename = ((StringWrapper)(value)).wrapperValue; } else { value = Strin...
61bb709a-a5f2-4b48-9ad3-ba8b7092544e
8
private void subdivide() { DCoord c1 = new DCoord(this.c1.x, this.c1.y); DCoord c2 = new DCoord((this.c1.x+this.c2.x)/2, this.c1.y); DCoord c3 = new DCoord(this.c1.x, (this.c1.y+this.c3.y)/2); DCoord c4 = new DCoord((this.c1.x+this.c2.x)/2, (this.c1.y+this.c3.y)/2); //picking out intensities, passing small...
4f82189d-28ff-4dc2-94ca-7c6e268f2c2b
8
public FileOperations() throws FileNotFoundException { reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter the name of the graph file including the extension."); System.out.println("E.g. file175.txt"); fileChoice = "Graph Files/"; try { ...
87cf5418-1ab0-4e68-94bf-902f857c963e
3
@Override public void addNode(Node node) { // Check to see if it is a valid node if (!node.validGameNode()) { // Throw an error if an invalid node was attempted to be // added throw new IllegalArgumentExcept...
6903fb1d-07dc-4204-a5c4-ce512ddb7cdb
0
public String getEmail() { return email; }
3020b00b-252d-4ff5-b3cb-bc784bb4f635
8
public boolean intersect(IntersectionRecord outRecord, Ray rayIn) { // TODO: fill in this function. // Hint: This object can be transformed by a transformation matrix, // so the rayIn needs to be processed so that it is in the same coordinate as the object. Ray ray = rayIn; ray = this.untransfo...
d472e81a-d9a3-46b3-8a6b-ed89ef9cb756
4
public static void main(String[] args) throws SQLException { String password = "mypass"; String user = "baraka"; String url = "jdbc:mysql://localhost:3306/hibernate"; String table = "conta"; //in this place should be injection! and it is //conta table DBInterface db = new MyDB(url,user,password); // d...
d426787d-c588-4450-aefe-77e4fa7f6846
2
public static void main(String argv[]) throws TransformerException, ParserConfigurationException { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // root elements Doc...
b54d603b-a077-46cc-83ab-e000dca27f15
5
@Override public Connection getConnection(boolean aRenewOldConnection) throws SQLException { if (this.pConnection == null || aRenewOldConnection == true) { //Prepare connection variables. String mUser = ""; if (!"".equals(this.pConfiguration.getDatabaseUsername())) { ...
7b302e5e-1e63-40cd-a3f0-ada3a2869e3c
4
@Override public void push(T task) throws IllegalArgumentException, InterruptedException { if (task == null) { throw new IllegalArgumentException("Task shall not be null"); } boolean isAdded = false; while (!isAdded) { int currentSize; synchronize...
702adc25-cb7c-4f0d-83de-fa7b4747363b
3
private boolean intersects(Point point, int fudge, QuadCurve2D.Float c) { if (!c.intersects(point.x - fudge, point.y - fudge, fudge << 1, fudge << 1)) return false; if (c.getFlatness() < fudge) return true; QuadCurve2D.Float f1 = new QuadCurve2D.Float(), f2 = new QuadCurve2D.Float(); c.subdivide(f1, f...
11981dd3-7667-444d-a34f-b194f26d1b44
5
private static void listClassesRec(final File dir, final List<File> files) { if (dir.isDirectory()) { for (final File subdir : dir.listFiles(new FileFilter() { @Override public boolean accept(final File file) { return file.isDirectory(); } })) { listClassesRec(subdir, files); } for (f...
fc433ba6-d41d-4134-bab8-b42bf036a2a9
2
public E put(Location loc, E obj) { if (!isValid(loc)) throw new IllegalArgumentException("Location " + loc + " is not valid"); if (obj == null) throw new NullPointerException("obj == null"); // Add the object to the grid. E oldOccupant = get(...
ef12fb84-64c1-410f-be39-2969cfd20ddc
8
public ArrayList<CheckOut> getAllCheckOuts(Timestamp startDate, Timestamp endDate) throws Exception { Connection connect = null; Statement statement = null; ResultSet resultSet = null; ArrayList<CheckOut> checkOutList = new ArrayList<CheckOut>(); try { // First connect to the database conne...
fbbcf5b3-9d71-4abd-93cb-0e479f7b1239
1
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[ListMan: name=" + this.name + " desc=" + this.desc + "] List Items:\n"); ListItem currentItem = this.head; while (currentItem != null) { sb.append(currentItem.toString()); sb.append("\n"); currentItem = curren...
8773a328-42fc-4fae-8ca5-d7f09eb28ca3
4
@Override public void sort(Comparable[] comparables) { int j; int gap = comparables.length / 2; while (gap > 0) { System.out.println("gap =" + gap); for (int i = gap; i < comparables.length; i++) { Comparable temp = comparables[i]; ...
3ee15e2d-de68-4230-b766-61a1c2519ee4
8
public Nodo quebrarExpressaoRegular(String er, int altura, Nodo n) { int parenteses = 0, inicio = 0, fim; boolean a = false; for (int i = 0; i < er.length(); i++) { char c = er.charAt(i); if ("(".charAt(0) == c) { parenteses++; a = true; ...
979c377c-eb6a-439a-8d8f-0c4a73ae1602
7
public final void operateImpl() throws IOException { final Pattern splitter = Pattern.compile(" "); String currentLine; while ((currentLine = readInputLine()) != null) { final String[] numbers = splitter.split(currentLine); if (numbers.length != 2) { thr...
8bdfc39f-45e3-4850-ae05-1b462b55b891
5
private void setDomain(CPA cpa){ for(int i=0; i<cpa.length() ; i++){ Assignment ass= cpa.getAssignment(i); if(ass!=null){ int agentID = ass.getID(); int assValue = ass.getValue(); if(constrained_agents(agentID , this.ID)){ int[][] values = constraints[agentID][this.ID]; System.out.println(...
077eb310-4d16-45a1-ba64-4f78e4188bc9
2
private void travelTree(TreeNode node, List<Integer> result) { TreeNode left = node.left; TreeNode right = node.right; //travel left if(null != left) travelTree(left, result); //record result.add(node.val); //travel right if(null != right) travelTree(righ...
234bf86e-5e47-4149-afd1-fd735f196606
1
final public CycObject function(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycObject val = null; val = representedTerm(false); eof(requireEOF); {if (true) return val;} throw new Error("Missing return statement in function"); }
b38e9268-bb92-4aa2-aab0-bb3432005461
6
private boolean removeModeFromSet(final String modeName, Map<String, Set<String>> modeSets, String modeToRemove) { if (null == modeName || "".equals(modeName.trim())) return false; boolean isModified = false; String o = modeName.trim().toUpperCase(); Set<String> modeSet = modeSets.get(o); if (null == modeSet)...
a4fcd3b1-9216-41fa-9b43-6e04a2d12e39
8
public void update(float delta) { if(blockNotifications || _notifications == null || _notifications.size() == 0) return; int updateThreshold = (int) (DisplayManager.getWindowHeight()/(height*renderScale)); Notification notification; for(int notificationId = 0;notificati...