method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
882eb0e6-38fc-4a6e-b131-9bfa6d5badc6
9
private Particle parseGroup() throws PrologSyntaxException { Particle g = new Particle(Particle.GROUP); g.particles = new Vector(); new AtomParser(db, as, pp, g).parseParticles(); int n = g.particles.size(); int flags = 0; for (int i = 0; i < n; i++) { switch (((Particle)g.particles.elemen...
8756d889-7e78-498f-96d8-1488b0b217f8
9
public Spinner(int x, int y, int size, int min, int max, int val, int step, GuiRotation rot) { this.x = x; this.y = y; if (rot == GuiRotation.HORIZONTAL) { width = size; height = HEIGHT; } else { width = HEIGHT; height = size; } value = val; this.min = min; this.max = max; this.step = step...
83af3758-b11a-4d07-a73f-0580bb44264a
1
protected void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja cancelar?")== 0){ dispose(); } }//GEN-LAST:event_btnCancelarActionPerformed
04a84a5c-1b83-4d8d-994d-f7d01219df5c
8
public static int firstMissingPositive(int[] A) { int len = A.length; if(len == 0) { return 1; } for(int i=0;i<len;i++) { int current = A[i]; if(current < 1 || current > len) { A[i] = 0; } else if(current != (i+1)){ int tmp = A[curr...
52dbf033-bf1f-4298-9f54-ecdea6afdc39
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
dcc6d89d-ca86-42a8-8caf-b23ee0cc924a
4
private static int sumOfDivs(int n){ int divSum = 1; for(int i=2;i<=Math.sqrt(n);i++){ if (i==Math.sqrt(n) && n%i==0) divSum+=i; else if (n%i==0) divSum+=i+n/i; } return divSum; }
c7a0d06c-4fde-442c-8afb-c4bbeda0e697
7
private static Instances clusterInstances(Instances data) { XMeans xmeans = new XMeans(); Remove filter = new Remove(); Instances dataClusterer = null; if (data == null) { throw new NullPointerException("Data is null at clusteredInstances method"); } //Get the...
8bb41d26-82e7-43df-8aba-79fd548c9135
9
private static BytesRef pack(byte[]... point) { if (point == null) { throw new IllegalArgumentException("point must not be null"); } if (point.length == 0) { throw new IllegalArgumentException("point must not be 0 dimensions"); } if (point.length == 1) { return new BytesRef(point[0...
358f1616-efe7-4a8e-870c-97eb46478aff
8
@Test public void reTest2() { userInput.add("hi"); userInput.add("my name is meng meng"); userInput.add("can you tell me about hamburger"); userInput.add("ingredients"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); use...
107f66bb-3175-47d0-b821-c0df123cf884
3
@Override public List<Convenio> listByNome(String nome) { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; List<Convenio> convenio = new ArrayList<>(); try{ con = ConnectionFactory.getConnection(); pstm = con...
a37c1f7f-b5d8-4c19-8fab-343489b1c523
8
public void displaychapter(int framenum, int labelnum) throws IOException { chapdispframenum = framenum; labelnumber = labelnum; BufferedImage testimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); File file = new File(filename); ...
aa4059f1-3817-4197-8e6e-d368d13fda91
7
public static float idealNestPop( Species species, Venue site, World world, boolean cached ) { final Nest nest = (cached && site instanceof Nest) ? (Nest) site : null ; if (nest != null && nest.idealPopEstimate != -1) { return nest.idealPopEstimate ; } // TODO: Repeating the sample h...
87ddde72-1b97-4201-be96-e6f01c249885
8
public static void main(String[] args) { long time = System.nanoTime(); for (int n = 0; n < TEST_SIZE; n++) { vt = System.currentTimeMillis(); } System.out.println("volatile write:"); System.out.println((System.nanoTime() - time)); time = System.nanoTime(); ...
fda719cc-3a09-48dd-9e6e-012f7978edd5
9
public ServerGUI() { field = new JTextField("6060",10); field.setHorizontalAlignment(JTextField.RIGHT); field.setBorder(BorderFactory.createTitledBorder("Inserisci la porta")); field.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(Ke...
4994e203-1dcc-4f50-9ba5-3a8ddfb6231a
6
public void exportSolution() { int steps = model.getMoves().size(); File file = new File(basePath + player + "/" + FOLDER_SOLUTIONS + "/" + levelName + ".sol"); // Create the file, if it doesn't already exist try { if (file.createNewFile()) { try { FileWriter fw = new FileWriter(file); fw...
c8e9af3a-8fd3-4702-b3c2-761562866a1c
4
@Override public T createAdaptiveExtensionProxy(final Class<T> iFaceType) { checkAnnotation(iFaceType); Enhancer en = new Enhancer(); en.setSuperclass(iFaceType); en.setCallback(new MethodInterceptor() { @Override public Object intercept(Object arg0, Method method, Object[] params, MethodProxy arg3) thr...
031eb6fc-3280-4336-8746-9b60dead182d
0
@Override public void setIndicatorState(int indicatorState) { this.indicatorState = indicatorState; }
baeeb7ce-0984-4505-8a7c-bbe3e5b88bbc
4
static private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch(curChar) { cas...
dfc39f99-f0d2-4fbc-8033-1d552855ea50
8
private JPanel multiLineLabelPanel(String sourceL, int splitWidth) { JPanel jp = new JPanel(); Vector v = new Vector(); int labelWidth = m_fontM.stringWidth(sourceL); if (labelWidth < splitWidth) { v.addElement(sourceL); } else { // find mid point int mid = sourceL.lengt...
41731ab3-7ebd-467f-acf2-9e97f4bb3daa
8
public Object getValueAt( int rowIndex, int columnIndex ) { Object back = "" ; TLanguageFile dummy = data.getData(rowIndex) ; if (dummy != null) { switch (columnIndex) { case -1 : // normally not used - debugging if ( (data.getDefaultLang() != null) && (rowIndex == ...
9c931508-7eef-44f1-84f9-158d67f1172c
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TimeTable other = (TimeTable) obj; if (this.dayOfWeek != other.dayOfWeek) { return false; ...
3bc3f6d1-662c-41a3-9e34-7cd499de3f40
5
@Around("execution(* ProfileServiceImpl.readProfile(..))") public void aroundRead(ProceedingJoinPoint joinPoint) throws Throwable{ ProfileServiceImpl profileService = (ProfileServiceImpl)joinPoint.getTarget(); Object [] args = joinPoint.getArgs(); System.out.println(args[0] + " reads the profile of " + args[1...
59a229c1-2559-4bac-ba8a-bf25f985ef3b
5
private final List<File> getFiles(File dir, List<File> files) throws ClusterException { if(dir == null) throw new ClusterException("The directory is null"); if(files == null) files = new ArrayList<File>(); if(dir.isDirectory() == false) { if(dir.getName().startsWith("SONG_L...
0ac16ade-e680-46ba-bf12-3ac14142cd56
2
private double search() { double l=mu-sigma*2; double r=mu+sigma*2; while (l+0.1<r){ double t1=(r-l)/3+l; double t2=2*(r-l)/3+l; if(f(t1) < f(t2)) l=t1; else r=t2; } return (l+r)/2; }
af932930-4b4b-4322-ac86-66469e18d9b1
0
public int size() { return results.size(); }
6101c232-ca80-4007-a5b5-a7cd828d66f2
3
public void setReal(TReal node) { if(this._real_ != null) { this._real_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
3e578c44-6f4d-4bbd-8b4f-dd56501a7380
4
private void consume() { try { if (requestSocket != null) { while (!queue.isEmpty()) { for (ProcessRequestData processRequestData : queue) { queue.poll(); processCommand.processRequest(processRequestData); } queue.notifyAll(); } } else { Thread.sleep(wait); Comv...
7bbb6bf6-b088-4d99-a58d-4a432bc8f61a
9
public void togglePause() { if(state.sdprint){ //Execute commands to pause if(state.pause){ state.pause=false; //Continue and resume addToPrintQueue(GCodeFactory.getGCode("M24",-24), false); }else{ addToPrintQueue(GCodeFactory.getGCode("M25",-25), false); try { Thread.sleep(1000); //w...
194ccf60-e85e-4b31-9c36-86703fa676b6
5
private boolean ignoreScan(String intf) { if (scanPackages != null) { for (String scan : scanPackages) { // do not ignore if on packages to scan list if (intf.startsWith(scan + ".")) { return false; } } return true; // did...
1ba8aed2-78cd-453c-bf68-5c477e8aec8b
0
public FSATransitionCreator(AutomatonPane parent) { super(parent); }
5daec423-6bd3-4aef-b648-63fcf575c918
7
private boolean isFunctionOver(){ if(this.token.length()>0){ String tmp=this.token; int leftBracketCount=0; int rightBracketCount=0; char T[]=tmp.toCharArray(); for(int i=0;i<T.length;++i){ if(T[i]=='('){ leftBracketCount++; }else if(T[i]==')'){ rightBracketCount++; } } if(l...
bc52a583-5e77-46b1-992a-fafa8936bdd6
1
@Override public void Connect(Server server) { this.server = server; try { Class.forName(DRIVER).newInstance(); connection = DriverManager.getConnection(getURL() + DB, username, pass); } catch (Exception e) { e.printStackTrace(); } }
f26d4185-6ac3-46ba-8819-4ef8f8fce486
3
protected void setCell(CellSnapshot cellSnapshot) { if ( (cellSnapshot.id != this.cellSnapshot.id) || (cellSnapshot.row != this.cellSnapshot.row) || (cellSnapshot.positionInRow != this.cellSnapshot.positionInRow) ) { this.cellSnapshot = cellSnapshot; ...
1d9fafac-42fa-4c6f-88a9-012cd9179772
8
private int findSize(int type) { int size = 1; int edgeCount; if (type % 2 == 0) { edgeCount = 3; } else { edgeCount = 4; } size += edgeCount; if ((type / 2) % 2 == 1) size += 1; /* Material */ if ((type / 4) % 2 == 1) size += 1; /* Face UV */ if ((type / 8) % 2 == 1) size += edgeCount;...
852ea053-7647-403e-8827-3f675bf16ede
7
public IMessage decrypter(IMessage crypte, String key) { /* * Les caractres sont dcods un un via oprations elementaires * Les caractres ne correspondant pas des lettres sont ajouts tel quels. */ long d=new Date().getTime(); int k=Integer.parseInt(key); char[] c=new char[crypte.taille()]; for(int i=...
562254be-d5ac-48ae-b631-35e59a25a4a9
5
private boolean sendGridlet(String errorMsg, int gridletId, int userId, int resourceId, double delay, int tag, boolean ack) { boolean valid = validateValue(errorMsg, gridletId, userId, resourceId); if (!valid || delay < 0.0) { return false; } i...
24415af9-22e2-4b73-95d3-0f07cffb51a1
1
protected long getChecksumStream(InputStream in) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { CheckedInputStream cis = new CheckedInputStream(in, createChecksumObject()); byte[] buff = new byte[128]; while (cis.read(buff) >= 0) { } return cis...
0f56211f-d05b-4224-95c6-0e030e95043b
2
@Override public void resetAllProperties() { Iterator it = getKeys(); while (it.hasNext()) { String key = (String) it.next(); if (propertyDefaultExists(key)) { setProperty(key, getPropertyDefault(key)); } else { removeProperty(key); } } }
d21b1d5b-ee6d-4b6c-a23a-4dbf33e207b2
5
public OperationExpression combineConstInput() { Operator newOp; if (left instanceof BooleanConstant) { if (((BooleanConstant) left).getConst()) { // true const newOp = ((PrimitiveOperator) op).oneLeft(); } else { newOp = ((PrimitiveOperator) op).zeroLeft(); } return new BinaryOpExpression(new...
30ea6db6-90d7-4aed-9b8b-9dd6c0d38475
8
public manajData1() { initComponents(); conn = new DBconn(); getDataFromDb(); System.out.println(queryPendaftar.length +" | "+ queryPendaftar[0].length); for(int x=0; x<queryPendaftar.length; x++){ jTable1.setValueAt(queryPendaftar[x][1], x, 0); } ...
bb964837-dba1-48f7-8b1c-383f34ff7d57
0
public QueuePublisherThread(BlockingQueue<Integer> queue) { this.queue = queue; }
be57592f-e77b-4718-a742-28172ba1fb01
9
private void readLuminance() { int type = sourceImage.getType(); if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) { int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null); for (int i = 0; i < picsize; i++) { int p = pixels[i]; int r = (p &...
86aa68f2-d2d1-4433-9e4b-a1a7fb749427
5
public static <T> List<T> simpleFind(String sql,ResultSetBeanMapping<T> mapping) throws SQLException{ Connection con = null; Statement smt = null; try { con = DBManager.getConnection(); smt = con.createStatement(); ResultSet rs = smt.executeQuery(sql); List<T> list = new ArrayList<T>(); while(...
93c1c086-b576-418e-b192-4b9a7c9e2076
7
@Override public boolean addPriceReserveAlert(boolean value,AuctionBean auctionBean) { ObjectComparator objectComparator=new ObjectComparator(); //Si l'utilisateur est acheteur, ou un acheteur vendeur if(this.getRole().equals(RoleEnum.BUYER)|| this.getRole().equals(RoleEnum.SELLER_BUYER)){ //il faut qu...
a33e1c11-7319-410c-8f65-aca0090e103e
4
@Override public HantoPiece getPieceAt(HantoCoordinate where) { HantoPiece ret = null; HantoCoordinate zero = new BasicCoordinate(0, 0); if(where.getX() == 0 && where.getY() == 0) { ret = new BasicHantoPiece(HantoPieceType.BUTTERFLY, HantoPlayerColor.BLUE); } else if(isAdjacent(zero, where) && currentTurn...
4ad3d307-43da-42c7-8286-e11a66f115d0
9
int insertKeyRehash(double val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look...
85f32687-f93e-4cae-99e7-568a295bf0fe
9
private void savePrefs() { for (int i = 0; i < Math.min(cmbFilter.getItemCount(), 20); i++) prefs.put(PREFS_KEY_FILTER + i, cmbFilter.getItemAt(i)); if (tblClasses.getRowSorter().getSortKeys().size() > 0) { int i = tblClasses.getRowSorter().getSortKeys().get(0).getCo...
c216e36d-b720-4b18-85cd-ddb9370f6fda
7
public static void main(String[] args) throws Exception{ SOP("==========Chapter 5 Bit Manipulation==="); SOP("To run: java c5 [function name] [function arguments]"); SOP("Example: java c5 q1"); SOP(""); SOP("Possible functions:"); SOP("q1\tQuestion 1"); SOP("q2\tQ...
87e6761f-f0e2-4388-82ec-3a49bd45be02
2
public static void main(String[] args) { try { throw new LoggingException(); } catch (LoggingException e) { System.err.println("Catch " + e); } try { throw new LoggingException(); } catch (LoggingException e) { System.err.println("C...
b0308a25-4fef-43ab-b55c-64717f45a709
0
public int getScaledHeight() { return HEIGHT; }
0bdcdb6d-9380-4d51-b52a-2bb376981fe6
4
public static int arrayMinIndex(float[] array, int startInd, int endInd){ if(array == null || array.length == 0) return 0; float min = array[startInd]; int minInd = startInd; for(int i=startInd; i<endInd;i++){ if(array[i] < min){ min = array[i]; minInd = i; } } return minInd; }
28175c79-a910-4101-bd7b-b33911c3c3de
4
@Override public void init() { super.init(); int cch = ByteTools.readShort( getByteAt( 0 ), getByteAt( 1 ) ); int pos = 1; if( cch > 0 ) { //A - fHighByte (1 bit): A bit that specifies whether the characters in rgb are double-byte characters. // 0x0 All the characters in the string have a high byte o...
a0f4c4b1-957d-4e30-84bc-1e6c60695a02
3
public float[] bowl(boolean firstRound){ float[] averageBowl = new float[NUM_FRUIT_TYPES]; float[] platter = platter(); System.out.println(Arrays.toString(platter)); bowlScoreStats = new Stats(); for (int i = 0; i < 1000; i++) { float[] tempPlatter = platter.clone(); float[] tempBowl = s...
cfecf83b-0483-4e6b-9ed4-35687d6baff5
0
public int size() { return this.equivalenceList.size(); }
7e1b93d1-26c5-4fea-9ee1-67eaf8268b80
1
@Override public Word get(Word word){ if(!base.containsKey(word.getWord())){ return null; } return new Word(base.ceilingKey(word.getWord()),base.get(base.ceilingKey(word.getWord()))); }
b51ee27c-bc8c-43d2-8a0c-e586e8508f9c
3
@Override public void execute(CommandSender sender, String worldName, List<String> args) { this.sender = sender; if (worldName == null) { error("No world given."); reply("Usage: /gworld load <worldname>"); } else if (!hasWorld(worldName)) { reply("Unknown world: " + worldName); } else { if (getW...
1d92ef53-80a1-4921-a633-d7fa30326e17
9
public static void main(String[] args) { // TODO Auto-generated method stub Map<String, Integer> map= new HashMap<String,Integer>(); map.put("Ling", 0);map.put("Yi", 1);map.put("Er", 2);map.put("San", 3);map.put("Si", 4); map.put("Wu", 5);map.put("Liu", 6);map.put("Qi", 7);map.put("Ba", 8);map.put("Jiu", 9); ...
b104524c-749c-441e-84d4-8f99eb8f64e1
3
private CellGui cellGuiAt(int row, int col){ for (CellGui cell : cells){ if (cell.underlying().row == row && cell.underlying().column == col) return cell; } throw new RuntimeException("unable to find cell at "+row+", "+col+" in next shape gui"); }
bab2dffe-a43a-4871-8616-a82f1766826b
7
@Override public MapObject doNextAction(MapEngine engine, double s_elapsed) { if (can_growl && growl_cooldown_left < 0.0) { registerGrowler(engine); } MultipleObject created_objects = new MultipleObject(); if (!is_exploded) { if (firing_cannon && shields >= 0) { if (volley_reload_t...
1980fac3-c7b6-4c12-abcb-be14c4d9c4a2
1
private EntityManager() { entityList = new LinkedList<Entity>(); registeredComponents = new HashMap<Class<? extends IComponent>, HashMap<Entity, IComponent>>(); }
2f58b402-c23d-4b11-8bda-61cf1f572347
3
@Override public void virusAttack(int iterationNum) { if (updateInfectionStatus && iterationNum != this.timeOfUpdate) { this.infectionStatus = true; } else { if (random.getResult()) { this.updateInfectionStatus = true; this.timeOfUpdate = itera...
600fd755-09b9-4ced-9492-7263e0150749
2
private double average() { double sum = 0, number = 0; for (Patient p : this.allPatients) { if (!p.isHospitalized()) { sum += p.getTotalTime(); number++; } } return sum / number; }
04a1d5e7-3c2a-4d9a-b019-42375b4d545a
2
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (value instanceof TmpCounterParty) { cell.setForeground(C...
a5991f05-779f-4654-9038-76feb5f1a321
3
private ASPlayer setCurOnline(ASPlayer data, TableType table, int value) { switch(table) { case DAY: data.curDay.online = value; break; case WEEK: data.curWeek.online = value; break; case MONTH: data.curMonth.online = value; break; default: plugin.severe("Invalid Type in setCurOnline"); } return ...
c51d61d3-8146-473c-94a6-6bdfdfa35375
4
public boolean estPositionValide(Position unePosition) { if (unePosition.obtenirCoordonneesEnX() >= 0 && unePosition.obtenirCoordonneesEnX() < NOMBRE_DE_COLONNES) if (unePosition.obtenirCoordonneesEnY() >= 0 && unePosition.obtenirCoordonneesEnY() < NOMBRE_DE_LIGNES) return true; return false; }
ae001291-e9a8-439b-ba7e-1f419e3b9fcb
5
private static void merge(Comparable[] a, Comparable[] aux, int lo, int mid, int hi) { for (int k = lo; k <= hi; k++) aux[k] = a[k]; int i = lo, j = mid + 1; for (int k = lo; k <= hi; k++) { if (i > mid) a[k] = aux[j++]; else if (j ...
fe2aae89-7219-46e5-b552-e5f4ceac4d20
3
@SuppressWarnings({ "unchecked", "rawtypes" }) static ArrayList generateCustomers(Class documentClass) throws Exception { ArrayList<HashMap<String,Object>> customers = new ArrayList<HashMap<String,Object>>(); for (int i=0;i<documentCount;i++) { HashMap<String,Object> customer = (HashMap<Str...
93547aaf-a2ed-4a65-9563-754b9b6671a1
0
public void stopLoad() { isRun = false; }
9dc57330-8d36-4615-a195-4342f4956947
6
private boolean LoadKerning(String line) { try { Scanner s = new Scanner(line); Kerning newKerning = new Kerning(); int id = 0; while(s.hasNext()) { StringTokenizer st = new StringTokenizer(s.next(), "="); String command = st.nextToken(); if (command.equals("first")) { ...
ecb72a1c-235a-4ef1-a731-c596cc8b1765
4
public void setDirection(int dir) { this.direction = dir; switch(direction) { case SOUTH : setRotation(90); break; case EAST : setRotation(0); break; case NORTH : setRotation(270); ...
f1b21aca-b6b2-4246-903b-e3ccab3b2bc0
6
double getRowLength(double row) { if (row <= 0) { return 0; } if (row <= n) { return 6 * row; } if (row <= 2 * n) { return 3 * n + 3 * row; } if (row <= 3 * n) { return 9 * n; } if (row <= 4 * n) { ...
fe9f815d-79b4-4adb-bb60-39c94c284574
7
public static void pauseSchedule(){ // used for loops int i; // Used to access the specific methods associated with a video player VideoPlayer currentVideoPlayer; // Used to access the specific methods associated with a audio player AudioPlayer currentAudioPlayer; // Used to access the specific methods a...
71486e87-4b7a-40c5-8067-cdc7d3d02b11
9
public void quickSort(int[] data, int start, int end){ int i = start; int j = end; int p = (start + end)/2; int pivot = data[p]; while(i < j){ while(i < p && pivot >= data[i]){ ++i; } if(i < p){ data[p] = data[i]; p = i; } while(j > p && pivot <= data[j]){ --j; } if(j >...
d1aab7fa-6d3e-4d31-bb4a-ea93e5dc4bca
2
@Override public int hashCode() { int result; long temp; result = itemId; result = 31 * result + (name != null ? name.hashCode() : 0); temp = percent != +0.0d ? Double.doubleToLongBits(percent) : 0L; result = 31 * result + (int) (temp ^ (temp >>> 32)); return ...
c1483a73-8edf-4c5c-b92a-7cc092789ffe
0
private void menuShowHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuShowHelpActionPerformed formHelp fh = new formHelp(); fh.setAlwaysOnTop(true); fh.setVisible(true); // TODO add your handling code here: }//GEN-LAST:event_menuShowHelpActionPerformed
9d5f5daf-6a4c-404e-b1a6-5e40ec65bc29
8
private Object js_unescape(Object[] args) { String s = ScriptRuntime.toString(args, 0); int firstEscapePos = s.indexOf('%'); if (firstEscapePos >= 0) { int L = s.length(); char[] buf = s.toCharArray(); int destination = firstEscapePos; for (int...
c68302dd-95b7-46e7-b516-1c0758d42dc6
6
public static TimeDuration stringToTimeDuration(String duration) { { int nDays = 0; int nMillis = 0; boolean negativeP = Native.stringSearch(duration, "minus", 0) != Stella.NULL_INTEGER; int dayStartPosition = 0; int dayEndPosition = 0; int msStartPosition = 0; int msEndPosition ...
758ed595-c63c-478c-9fbe-b5f7bc0b7633
8
public BareBonesWhile(String[] Lines, String[] CurrentLineParts, LineReference currentLine, HashMap<String, Integer> Variables) throws BareBonesSyntaxException, BareBonesCompilerException { super(Lines, currentLine, Variables); if(!CurrentLineParts[0].equalsIgnoreCase("while")) throw new BareBonesCompilerExcept...
bb30ddf3-d6f1-4333-8e45-092c32014996
1
public static String removeNewLine(String text) { do { text = text.replaceAll("\n", ""); } while (text.contains("\n")); return text; }
284cefec-b287-4ce6-bef0-103c989dd0a9
6
public double getSimilarity(String s1, String s2) { s1 = s1.toLowerCase(); s2 = s2.toLowerCase(); int[] costs = new int[s2.length() + 1]; for (int i = 0; i <= s1.length(); i++) { int lastValue = i; for (int j = 0; j <= s2.length(); j++) { if (i == 0) costs[j] = j; else { if (j > 0) { ...
d0745ac9-46e8-4ad8-a9e9-9c2df10fe19c
2
public void menuCadastrarHorario(String disci, String dia, int numero, int hI, int hF) { try { Disciplina disciplina = sistemaFrontEnd.pesquisaDisciplina(disci); try { sistemaFrontEnd.pesquisaTurma(disci, numero); sistemaFrontEnd .cadastraHorarioTurma(disci, numero, dia, hI, hF); } catch (Tu...
ea9afd24-2337-4e15-8298-e5ba56ac8eec
3
private int addGNoise(int pixel, Random random) { int v, ran; boolean inRange = false; do { double nextGaussian = 0; //nextGaussian = random.nextGaussian(); nextGaussian = getGaussianNoise(this.mean,this.getVariance()); ran = (int) Math.round(nextGaussian * noiseFactor); v = pixel + ran; // chec...
15a1baed-a020-4aa9-a9b9-e02609e99889
4
public static Dimension sanitizeSize(Dimension size) { if (size.width < 0) { size.width = 0; } else if (size.width > MAXIMUM_SIZE) { size.width = MAXIMUM_SIZE; } if (size.height < 0) { size.height = 0; } else if (size.height > MAXIMUM_SIZE) { size.height = MAXIMUM_SIZE; } return size; }
ed04aaf5-d051-4cff-9240-1072ee36ec34
2
@Override public final void mousePressed(MouseEvent mouseevent) { int x = mouseevent.getX(); int y = mouseevent.getY(); if (frame != null) { x -= 4; y -= 22; } idleTime = 0; clickX = x; clickY = y; clickTime = System.currentTimeMillis(); if (mouseevent.isMetaDown()) { clickMode1 = 2; clic...
4ca5e967-3174-4493-9300-53db9d1fde66
1
public Type getCanonic() { int types = possTypes; int i = 0; while ((types >>= 1) != 0) { i++; } return simpleTypes[i]; }
247985d4-26ef-4903-acb1-ceb42bfe87dd
6
public static Cons javaTranslateCondition(Cons condition, boolean symbolcasep) { { Cons translatedactions = Cons.cons(Stella.SYM_STELLA_JAVA_STATEMENTS, Cons.javaTranslateListOfTrees(condition.rest).concatenate(Stella.NIL, Stella.NIL)); Stella_Object keys = condition.value; Stella_Object translatedkeys ...
38078bc0-d3ae-40d3-a0b1-7bdff0a8345e
6
public Matrix3D plus(Matrix3D B) { Matrix3D A = this; if (B.M != A.M || B.N != A.N || B.K != A.K) throw new RuntimeException("Illegal matrix dimensions."); Matrix3D C = new Matrix3D(M, N, K); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) for (int l = 0;...
f1d99d8c-b65c-42e1-8c29-2b74e73ddd8d
0
@Basic @Column(name = "level_debt") public double getLevel_debt() { return level_debt; }
3c012673-22a0-49e4-bbe2-5f8ad3dcfc34
6
public static void main(String[] args) { PlayGame play = new PlayGame(); int in = 0; Game game = null; while (in != 4) { switch (in = play.userInput()) { case 1: game = new Game(new HumanPlayer(), new ComputerPlayer()); break; case 2: game = new Game(new HumanPlayer(), new HumanPlayer());...
8f6edc1b-2df5-42fc-bdb0-b40e72acb579
3
private void createPrinterCombo() { PrintService[] services = PrinterJob.lookupPrintServices(); if (services.length == 0) { services = new PrintService[] { new DummyPrintService() }; } WrappedPrintService[] serviceWrappers = new WrappedPrintService[services.length]; int selection = 0; for (int i = 0; i <...
6b22139d-2d7b-457d-bd75-a71f7ee0eb1c
8
private boolean find(char[][] board, boolean[][] visited, int i, int j) { if (i - 1 < 0 || i + 1 >= board.length || j - 1 < 0 || j + 1 >= board[0].length) { return false; } int[] rowStep = {-1, 1, 0, 0}; int[] colStep = {0, 0, -1, 1}; for (int t = 0; t < 4; t++) { ...
746a97b0-e16b-4c0f-b48d-a91a4c6ef8e2
6
public boolean sincronizarModelComView(Servico model) { if (!txtItendificador.getText().equals("")) { model.setId(Integer.parseInt(txtItendificador.getText())); }else{ model.setId(null); } if (!cbClientes.getSelectedItem().equals("Selecione")) { mode...
b93fa8f1-bd26-4471-b78d-25df655fd3ec
1
public void setTotalHrsForYear(double totalHrsForYear) { if (totalHrsForYear < 0){ throw new IllegalArgumentException("Hour total must be greater than or equal to zero"); } this.totalHrsForYear = totalHrsForYear; }
b1b4d2ef-b171-473c-8e6d-60eb14d83438
0
public Point getPosition() { return recognizer.centroid; }
c61c5a5b-c601-4c27-8de0-5867de5ca81b
5
public void createUser(){ String email, nombre, pass, tipo; boolean ciclo; if(activo.validateTipo(Usuario.ADMINISTRADOR) && counterOfUsers < 50){ do{ System.out.print("Ingrese su email: "); email = scan.next(); ciclo = false; for (int x=0; x<counte...
6151dcd6-3652-462c-8dd2-4dd8e9717f0f
8
private void importData(String tableName, String query, List<TableField> fieldsList, Connection bizConn, Connection memConn) throws Exception { // 共多少行 int totalRowNum = 0; // 共多少页 int totalPage = 0; // 相同字段 List<String> joinFieldList = null; PreparedStatement pst = null; try { memConn.setAutoC...
f9c8cd2b-5192-4b85-9f4b-90dad052fff4
1
public static List<String> toSortedKeyList(Set<Object> keys) { List<String> list = new ArrayList<String>(); for (Object key : keys) { list.add(key.toString()); } Collections.sort(list); return list; }
35b85faa-1759-421e-81a5-2360cac6ffd8
4
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof RelMarchaProcesionId) ) return false; RelMarchaProcesionId castOther = ( RelMarchaProcesionId ) other; return (this.getIdmarcha()==castOther.getIdmarch...
5ab8f88a-c9c4-4d2e-975a-f77c84636a99
5
public void run() { try { Thread.sleep(5000L); if(NetworkManager.getReadThread(this.netManager).isAlive()) { try { NetworkManager.getReadThread(this.netManager).stop(); } catch (Throwable var3) { ; } } if(Networ...
ddaf0302-c0f1-483c-bf61-45501df83908
1
public static int getTypeSize(String typeSig) { return usingTwoSlots(typeSig.charAt(0)) ? 2 : 1; }