method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f18e2601-f0a4-4966-b10e-15a942c46043
2
public void setMinCount(int newMin) { if (headCount < newMin) { GlobalOptions.err .println("WARNING: something got wrong with scoped class " + clazzAnalyzer.getClazz() + ": " + newMin + "," + headCount); new Throwable().printStackTrace(GlobalOptions.err); headMinCount = headCount; } else...
0f40d2a4-b249-4338-8e18-14fdf71885f5
6
@SuppressWarnings("unchecked") @Override protected boolean canRun(ClassNode node) { if (node.superName.isEmpty()) { return false; } int string = 0, model = 0; ListIterator<FieldNode> fnIt = node.fields.listIterator(); while (fnIt.hasNext()) { FieldNode fn = fnIt.next(); if ((fn.access & Opcodes.ACC...
aa5dfc2d-da9b-481a-99fe-626c8d1764e9
4
private void redTeamWin() { for (String n : this.getPlayers()) { if (this.getBlueTeam().getPlayers().contains(n)) { PlayerStats s = plugin.getPlayerStats().get(n); if (s != null) { s.setLosses(s.getLosses() + 1); } else { ...
29a8b545-b85e-4db6-b55c-ff85015a2df2
8
static String getUnitText(double v, String u) { double va = Math.abs(v); if (va < 1e-14) return "0 " + u; if (va < 1e-9) return showFormat.format(v*1e12) + " p" + u; if (va < 1e-6) return showFormat.format(v*1e9) + " n" + u; if (va < 1e-3) return showFormat.format(v*1e6) + " " + CirSim.muString...
6d37764f-afe5-4fdd-b698-9b1f315d8451
5
public static void main(String[] args) { String name = AdjustFileNotice.class.getSimpleName(); Attributes attributes = new Attributes(); attributes.putValue(BundleInfo.BUNDLE_NAME, name); attributes.putValue(BundleInfo.BUNDLE_VERSION, VERSION); attributes.putValue(BundleInfo.BUNDLE_COPYRIGHT_OWNER, COPYRIGHT_...
234d27f5-fbba-4ddb-8e78-383f1f49d2df
0
public int getS1() { return s1; }
2eac401c-7ec3-4321-9eea-1866cc68f083
1
public static StringBuilder grabVal() throws IOException { String genLine = ""; while((genLine = input.readLine())!= null) { sb.append(genLine); } return sb; }
0e790845-5c04-48d7-96e8-3c37e62b3ada
7
public Instances getDataSet() throws IOException { Instances result; Vector<Double> row; double[] data; int i; int n; if (m_sourceReader == null) throw new IOException("No source has been specified"); if (getRetrieval() == INCREMENTAL) throw new IOException("Cannot m...
9a451dc0-6e2e-43f1-b522-fd19ae4858c3
6
public static int[] rotateBilinear(int[] pix, float beta, int iw, int ih, int owh) { int[] opix = new int[owh * owh]; double t = beta / 180; float cos_beta = (float) Math.cos(t * Math.PI); float sin_beta = (float) Math.sin(t * Math.PI); for (int i = 0; i < owh-1; i++) { for (int j = 0; j < owh-1; j++) {...
e9309f44-ce28-4e15-97a4-f4273589b3a2
5
@Override public void setValueAt(Object obj, int rowIndex, int columnIndex){ if(rowIndex > customers.size()) throw new IllegalArgumentException("Row index greater than customers size"); Customer c = customers.get(rowIndex); switch(columnIndex){ case 1: c.setFirstna...
4091a5d1-8e8d-420e-93b7-1b2f809bafa5
0
void increaseRightScore(int score) { setRightScore(getRightScore() + score); }
d3335bcc-540d-49f9-9073-98488f010428
6
public static <T> ObserverMethod<T> create(ForkJoinPool pool, BeanManager bm, AnnotatedType<?> type, AnnotatedMethod<?> method, AnnotatedParameter<?> param) { ObserverMethodHolder<T> objectMethodHolder = new ObserverMethodHolder<>(); objectMethodHolder.pool = pool; objectMethodHolder...
9c380d0f-6249-4ef1-9a31-6b5a4498ed16
9
public static boolean isConnected(Board board, BoardNode node1, BoardNode node2){ //vertically aligned if(isVerticallyAligned(node1, node2) && node1.getColor() == node2.getColor() && notBlocked(board, node1, node2)){ return true; } //horizontally aligned if(isHorizontallyAligned(node1, node2) && node1.getC...
c1cdabce-4aa2-46d7-a9f3-c1e1e6319087
1
public void addColumn(ColumnAttributes attributes) { if (!data.isEmpty()) { throw new MLException("Cannot add a column to a matrix that contains rows"); } columnAttributes.add(attributes); }
709da5cc-5acd-4a81-b24f-145e211e3fc1
1
public static boolean isFileURL(URL url) { String protocol = url.getProtocol(); return (URL_PROTOCOL_FILE.equals(protocol) || protocol.startsWith(URL_PROTOCOL_VFS)); }
72dd6608-c7c7-48c0-a129-e423d360c478
0
private void initLargerView() { table = new GrammarTable(model); table.getTableHeader().setReorderingAllowed(false); TableColumn lhs = table.getColumnModel().getColumn(0); TableColumn arrows = table.getColumnModel().getColumn(1); TableColumn rhs = table.getColumnModel().getColumn(2); lhs.setHeaderValue("LH...
0b9fbbb7-d9c6-48f5-b9d7-68b840f2f8a4
3
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Path p = file.getFileName(); if (attrs.isRegularFile() && p != null) { Pattern pat = Pattern.compile(combineRegex(), Pattern.CASE_INSENSITIVE); Matcher m = pat.matcher(p.toString()); while (m.fin...
c23154a1-4828-45d7-b568-4ff6a96a0dd9
1
public void setName(String name) { if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("Name shouldn't be NULL or empty."); } this.name = name; }
2c04cf00-1fb0-4b5a-b7bc-be1a94bbeffb
2
public GenericNode getOther(GenericNode node) { // TODO Auto-generated method stub if(node == nodeOne) return nodeTwo; else if(node == nodeTwo) return nodeOne; else return null; }
6ce71db5-f264-42ae-972c-d56ba174997a
6
@EventHandler public void onInventoryClick(InventoryClickEvent event) { if (event.getWhoClicked() instanceof Player) { ClickType clickType = event.getClick(); Player player = (Player) event.getWhoClicked(); String uuid = player.getUniqueId().toString(); ShopId...
895d985a-1046-48bf-b417-d7df1689ecac
2
public static void setTypeInfoOption(int opt){ switch(opt){ case 1: Db.inputTypeInfo = true; break; case 2: Db.inputTypeInfo = false; break; default: throw new IllegalArgumentException("Option " + opt + " not rec...
dd6ae606-d8b6-48c5-a352-7d4c4d12154b
9
private void createMidi(Attributes attrs) { midi = new Midi(midiDef); // loop through all attributes, setting appropriate values for (int i = 0; i < attrs.getLength(); i++) { if (attrs.getQName(i).equals("x")) midi.getStartPoint().setX(Integer.valueOf(attrs.getValue(i))); else if (attrs.getQName(i).equa...
3cd20cf7-595b-4ef7-aa32-bca2486fd53b
7
private void setUp() { File tmpUser = null; File tmpMusic = null; try{ tmpUser = new File("res/users.data"); tmpMusic = new File("res/musics.data"); this.setuserFileOut(new FileOutputStream(tmpUser)); this.setUserFileIn(new FileInputStream(tmpUser)); this.setMusicFileOut(new FileOutputStream(tmpMus...
38979133-bf6c-4564-a6c2-b4238ac3d8a8
0
public void setIdDiagnostico(Integer idDiagnostico) { this.idDiagnostico = idDiagnostico; }
935530ae-61db-4f5a-bcc9-d70a425cff31
4
protected Behaviour getNextStep() { final Profile p = actor.base().profiles.profileFor(actor) ; if (p.daysSinceWageEval(actor.world()) < 1) return null ; if (pays instanceof AuditOffice) { final AuditOffice office = (AuditOffice) pays ; if (office.assessRelief(actor, false) <= 0) return nul...
2adeee31-dcd1-47bc-a731-da37462dabd4
1
public String getString(int index) throws JSONException { Object object = this.get(index); if (object instanceof String) { return (String) object; } throw new JSONException("JSONArray[" + index + "] not a string."); }
69b9149b-6a22-45a7-a562-c6ed486da3e2
7
void smbFft(float[] fftBuffer, int fftFrameSize, int sign) /* FFT routine, (C)1996 S.M.Bernsee. Sign = -1 is FFT, 1 is iFFT (inverse) Fills fftBuffer[0...2*fftFrameSize-1] with the Fourier transform of the time domain data in fftBuffer[0...2*fftFrameSize-1]. The FFT array takes and returns the cosine and sine...
02549ddc-9e45-4654-bb06-570813bb2f4f
1
@Override public void documentRemoved(DocumentRepositoryEvent e) { // local vars int whichOne = isThisOneOfOurs(PropertyContainerUtil.getPropertyAsString(e.getDocument().getDocumentInfo(), DocumentInfo.KEY_PATH)); // if it's one of ours ... if (whichOne != DOCUMENT_NOT_FOUND) { // mark it closed docOp...
96b13b15-ecfb-4a9e-b7e3-efbba7281f3f
6
@Override public boolean equals(Object obj) { if (null == obj) { return false; } if (this == obj) { return true; } if (obj instanceof PostParameter) { PostParameter that = (PostParameter) obj; if (file != null ? !file.e...
756908d0-6043-47ad-b250-a601ae4163a3
5
public void draw(Graphics2D g) { if (!visible) return; Rectangle rect = shape.getBounds(); int bx = (int)rect.getX(); int by = (int)rect.getY(); int bw = (int)rect.getWidth(); int bh = (int)rect.getHeight(); /* if (checked) { g.setColor(Color.GRAY)...
9ff87389-c58a-48db-9e2f-0e67b9c1d941
3
void workerStop() { if (workerThread == null) return; synchronized(workerLock) { workerCancelled = true; workerStopped = true; workerLock.notifyAll(); } while (workerThread != null) { if (! display.readAndDispatch()) display.sleep(); } }
98f48e0a-484f-4a30-bd7b-1a0aa105a3fa
8
@Override public Object visitUnary(unary_AST node, ScopeElement data) { if (node.primary != null) { if (node.primary instanceof primaryExisting_AST) { primaryExisting_AST p = (primaryExisting_AST) node.primary; p.jjtAccept(this, data); node.typeObj = p.typeObj; } else if (node.primary instanceof ne...
506dafed-ca83-4411-9ec5-ef9212bf21fd
7
public static void main(String[] args){ for(int a=1;a<1000;a++){ for(int b=1;b<1000;b++){ for(int c=1;c<1000;c++){ if(a<b && b<c && a+b+c==1000 && Math.pow(a,2) + Math.pow(b,2) == Math.pow(c,2)){ System.out.println("a:" + String.valueOf(a) + " b:" + String.valueOf(b) +" c:"+ String.valueOf(c)); ...
22817b05-4ecf-4494-98ff-259d764d3fc3
2
public void mouseClicked(MouseEvent e) { TableColumnModel colModel = table.getColumnModel(); int columnModelIndex = colModel.getColumnIndexAtX(e.getX()); int modelIndex = colModel.getColumn(columnModelIndex) .getModelIndex(); if (modelIndex < 0) return; TerminalTableRowEntry.sorting = modelInde...
abb6fd1d-b957-4d65-b8dd-5178090f275d
4
public void setConstructorParameters (Class type, Class[] parameterTypes, String[] parameterNames) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (parameterTypes == null) throw new IllegalArgumentException("parameterTypes cannot be null."); if (parameterNames == null) throw ...
ed3cb00d-7f6d-4a31-b066-e52f49dab0ab
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Student other = (Student) obj; if (!Objects.equals(this.stuName, other.stuName)){ return false; } if (!Objects.eq...
208a03be-43e9-46dd-9bd0-c495956283cc
9
private Set floodFill(int x, int y) { Set group = new HashSet(); LinkedList points = new LinkedList(); points.add(new int[] {x, y}); while (!points.isEmpty()) { int[] point = (int[]) points.removeFirst(); group.add(point); for (int dx = -1; dx <= 1; dx...
a3981742-190b-47a5-9746-864e6f525436
4
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] A = new int[n]; int[] l = new int[n]; for(int i=0;i<n;i++){ A[i]=in.nextInt(); } l[0]=1; int result = 1; int prev = A[0]; for(int i=1;i<n;i++){ if(A[i]>prev){ l[i]=l[i-1]+1; prev...
e898a59e-74f9-4db3-bf95-8f042500a988
0
public String getServer() { return serverVersion; }
f96c8af5-76b9-4125-8136-dd614d0bad5c
1
private List<IArticle> parseArticles(String[] args) throws IOException { List<IArticle> result = new ArrayList<>(args.length); String[] postIds = Arrays.copyOfRange(args, 1, args.length); for (String postId : postIds) { UrlWrapper url = new UrlWrapper(format(URL_TEMPLATE, postId)); ...
e678c7a6-8f53-439f-bb95-379bf2203088
0
private void retrieveAllProducts() { this.allProducts = this.userFacade.retrieveAllProducts(); this.sizeOfProducts = this.allProducts.size(); }
7d5357dd-e8fc-4d20-957d-7e281ccabeff
8
public CompareImagesWindow(String imageFile1, String imageFile2) throws IOException { super("Compare images"); this.imageFile1 = imageFile1; this.imageFile2 = imageFile2; setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLocationRelativeTo(null); addWindowListener(new WindowListener() { @Override ...
10ff6583-f678-44b7-85fb-f8eeee2e8bfc
9
@Override public CharSequence subSequence(int start, int end) { if (start >= length || end >= length) { throw new IllegalArgumentException("start or end cannot be greater than length"); } Integer startOfSubMap = sequences.lowerKey(start); NavigableMap<Integer, CharSequen...
0ff7e108-72b4-4785-a35a-61414a671757
3
@Override public void update() throws IOException { if (isNotReady()) { readyToSend = false; return; } long startTime = System.nanoTime(); long currentTime = System.currentTimeMillis(); readyToSend = (currentTime >= nextTime); if (readyToSend) { while (nextTime <= currentTim...
c45ab1cf-119e-4ef2-8eab-a25fc6df19d7
9
@Override public void trainOnInstanceImpl(Instance inst) { double d = 1.0; int[] m = new int[this.ensemble.length]; for (int j = 0; j < this.ensemble.length; j++) { int j0 = 0; //max(0,j-K) pipos[j] = 1.0; pineg[j] = 1.0; m[j] = -1; ...
7fc0511e-1cf8-4008-9160-091aa047a17d
4
public void write_multiple(short address, byte[] msg) throws IOException { if ((this.mode==0) || (this.mode==SET_MODE_I2C_SERIAL)) this.set_mode(SET_MODE_I2C_100); byte[] data=new byte[msg.length+2]; data[0]=(byte)RW_MULTIPLE; data[1]=(byte)address; System.arraycopy(msg, 0, data, 2, msg.le...
a88ecda1-b184-453c-afa2-11ea9d69b86b
0
public void setUpdateExisting(boolean updateExisting) { this.updateExisting = updateExisting; }
1a61ceae-3dd3-42dc-a84c-9f9be49f364a
5
public boolean check_Status(String status){ String book_Status=status.toLowerCase(); if (book_Status.equals("lost") || book_Status.equals("checked-in")|| book_Status.equals("in-queue") || book_Status.equals("available")) return true; else if (book_Status.isEmpty()) return...
e1a5cace-47cf-49c5-9eae-3bb351af70d4
9
@Override public Object execute() throws OperationNotSupportedException { Object result; switch (operation) { // facebook specific actions case ADD_COMMENT: result = FacebookActionImplementation.sendComment("resource", "text"); break; case LIKE_AS: result = FacebookActionImplementation.likeAs("r...
9beef453-7e2f-4fb2-b6ec-b70e6db57aeb
4
@Override public void mouseClicked(MouseEvent event) { Iterator<MouseClickedListener> it = mouseListeners.iterator(); while(it.hasNext()) { try { MouseClickedListener listener = it.next(); if(listener.isFinished()) { //TODO: gets removed next time the mouse is clicked... it.remove...
2d59c1ab-97ce-4ffe-9d29-79760ca99be4
9
public List<List<Integer>> threeSum(int[] num) { final int len = num.length; List<List<Integer>> list = new LinkedList<List<Integer>>(); if(len < 3) return list; Set<String> set = new HashSet<String>(); Arrays.sort(num); for(int i=0; i<len-2; i++){ if(num[i]>0) break; if(i == 0 || num[i] > n...
834bff6a-4b72-4d72-abdf-babda379bb29
2
@Override public void writeToSave(DataTag data) { super.writeToSave(data); DataList list = new DataList(); for(int slot = 0; slot < getMaxSlots(); slot++){ ItemStack stack = getStackInSlot(slot); if(stack != null){ DataTag tag = new DataTag(); stack.writeToSave(tag); tag.writeInt("slot", slot)...
67f59247-30d0-4f96-890c-b075305306a4
1
public ShieldMinigame(int level, Vector2 chunk, LD ld) { Util.clearBodies(); this.level = level; if (level == 0) { new IllegalArgumentException("0 isn't a valid level").printStackTrace(); } // TODO: clear bodies Objects.world.setContactListener(new ShieldMinigameContactManager(this)); life = 20 - level...
6b8a0e53-e1f4-428c-99c1-01a79d3343eb
0
@Override public void undo() { node.setCommentState(oldState); }
b501e982-8cc0-4b9c-8b14-3402fa9129c6
7
public boolean processCommand(Terminal terminal, List<String> words) { boolean leave = false; leave = super.processCommand(terminal, words); if (!words.isEmpty()) { switch (words.get(0)) { case "add": terminal.add(); break; ...
7c1cfb02-b572-4678-9b6d-86aea8692649
3
private Vector<byte[]> segmentFile(String f) throws Exception { Vector<byte[]> sequenceList = new Vector<byte[]>(); try { //Open the input and out files for the streams FileInputStream file= new FileInputStream(f); while (file.available() > PAYLOADLENGTH) { byte[] b = new byte[PAYLOADLENGTH]; ...
e0257e2b-9042-43ff-9e47-3e070d6cd234
1
public Date getNextDate() { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, h); c.set(Calendar.MINUTE, m); if (c.before(Calendar.getInstance())) { c.add(Calendar.DATE, 1); } return c.getTime(); }
4827ef5f-3bc1-4eda-bc0c-1b524ddb5d70
3
@Override public BufferedImage getImage(int pageNumber) { Logger.getLogger(PdfHandler.class.getName()).entering(PdfHandler.class.getName(), "getImage", pageNumber); if (!isImageInRange(pageNumber)) { Logger.getLogger(PdfHandler.class.getName()).exiting(PdfHandler.class.getName(), "getIma...
5083baed-62f1-441b-8ff7-e51936496d3b
0
public Throwable getCause() { return this.cause; }
3c384d15-f68b-4dd9-a98a-a3228001cbd5
6
private void search(int i,int target,int[] cand, ArrayList<Integer> tmp,ArrayList<ArrayList<Integer>> rst) { if (cand[i] > target) return; if (cand[i] == target) { ArrayList<Integer> element = new ArrayList<Integer>(); element.addAll(tmp); element.add(cand[i]); rst.add(element); return; } i...
3310f61e-d151-4f66-b7a5-21e8f3081e9e
5
public Boolean isNewGameOk() { if (this.height != 0 && this.width != 0 && this.nbMines != 0 && this.nbFlags != 0 && cells[8][9] != null) { return true; } else { return false; } }
572763c4-1978-4cf0-980e-e5db209e3f2f
0
public void setSpNum(String spNum) { this.spNum = spNum; }
f14155fd-9d6e-4994-9712-604267f1acc7
0
public CheckResultMessage checkG(int day) { return checkReport.checkG(day); }
3a4734e2-e3ea-4253-b76d-a03a49cb846e
5
private void updateTabla(){ //** pido los datos a la tabla Object[][] vcta = this.getDatos(); //** se colocan los datos en la tabla DefaultTableModel datos = new DefaultTableModel(); tabla.setModel(datos); ...
68107b78-5dbe-4900-9b31-7ee842d24744
5
public Model getDialogueModel(int gender) { int dialogueModelId = maleDialogueModelId; int dialogueHatModelId = maleDialogueHatModelId; if (gender == 1) { dialogueModelId = femaleDialogueModelId; dialogueHatModelId = femaleDialogueHatModelId; } if (dialogueModelId == -1) return null; Model dialogue...
c4e301ac-a3b6-4dec-aa8c-17c33a63fc22
0
public String getCode_lab() { return code_lab; }
5b731eff-0cef-4814-ba27-1f59e142308f
2
@Override public boolean filter(String url) { if (null == url || "".equals(url)) { return false; } Pattern pattern = Pattern.compile("^(http|https)://.+$"); Matcher matcher = pattern.matcher(url); return matcher.matches(); }
6f3c5350-6e70-40cb-997c-0a595ca929fb
5
private void trHeapSort (final int ISA, final int ISAd, final int ISAn, final int sa, final int size) { final int[] SA = this.SA; int i, m; int t; m = size; if ((size % 2) == 0) { m--; if (trGetC (ISA, ISAd, ISAn, SA[sa + (m / 2)]) < trGetC (ISA, ISAd, ISAn, SA[sa + m])) { swapElements (SA, sa + ...
6e789310-b15a-41cd-beab-b967def47334
7
public static void main(String[] args) { Reader.init(System.in); try { int numCasos = Reader.nextInt(); for(int i=0;i<numCasos;i++) { int n = Reader.nextInt(); int p = Reader.nextInt(); int q = Reader.nextInt(); W = new int[n]; val = new int[n + 1][q + 1][p + 1]; for(in...
0d730f4a-9e22-4777-b376-8c58d75e460b
4
public void print() { System.out.println("*** Draw Deck ***"); if ( draw_.isEmpty() ) System.out.print("No Cards Available"); else for ( Card c : draw_ ) System.out.print(c.toString() + ", "); System.out.println("\n*** Discard Deck *** "); ...
6d53804d-6e75-40e2-ad31-96c12d209e9e
9
public void update(User u) throws InvalidFieldException { if (u.getFirstName() != null) { setFirstName(u.getFirstName()); } if (u.getLastName() != null) { setLastName(u.getLastName()); } if (u.getID() != null) { setID(u.getID()); } if (u.getPoints() != getPoints()) { setPoints(u.getPoints()...
43480f62-d6a9-40e3-aa0e-335bf6d9a8fb
3
public ShapeElemtex(SimpleFeature f, String tipo) { super(f, tipo); shapeId = "ELEMTEX" + super.newShapeId(); // Elemtex trae la geometria en formato MultiLineString if ( f.getDefaultGeometry().getClass().getName().equals("com.vividsolutions.jts.geom.MultiLineString")){ MultiLineString l = (MultiLineStri...
4ee46845-8237-48f1-8832-0adfe8c6f399
4
float func_526_b(int var1) { return var1 >= 0 && var1 < this.leafDistanceLimit?(var1 != 0 && var1 != this.leafDistanceLimit - 1?3.0F:2.0F):-1.0F; }
afd6e0cd-18fb-4d79-b339-97d2193ba03c
6
public static String javaPackagePrefix(Module module, String separator) { { String result = ""; char separatorChar = separator.charAt(0); String packagePrefix = module.javaPackage(); if (packagePrefix != null) { if (separatorChar == '.') { result = packagePrefix; } ...
e2559a01-975b-47f0-875d-ee1f9b756b18
0
public AttributesImageIconCellEditor(AbstractAttributesPanel panel) { super(new JCheckBox(), OutlineEditableIndicator.ICON_IS_PROPERTY, OutlineEditableIndicator.ICON_IS_NOT_PROPERTY); this.panel = panel; }
ca65e21c-eb30-43e4-884a-ce110ae55b8b
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...
140496bc-af57-4085-9910-ff86e26e3749
3
@Override public void render(Drawer drawer) { for (int x = 0; x < map.length; x++) { for (int y = 0; y < map[x].length; y++) { int drawX = (x * tileSize) + offsetX; int drawY = (y * tileSize) + offsetY; if (map[x][y] == 0) { ...
bb1f2b77-9a54-412c-8908-e413d436402a
2
void renderOffscreen() { do { if (vImg.validate(getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE) { // old vImg doesn't work with new GraphicsConfig; re-create it vImg = this.getGraphicsConfiguration() .createCompatibleVolatileImage(workingImage.getWidth(), workingImage.getHeig...
c2eb14ec-e559-429e-a3ef-1b87dd36c20d
2
private void reduce(){ int[] primeNumbers = getPrimeNumbers(); for (int primeNumber: primeNumbers){ while (isReducible(primeNumber)){ numerator /= primeNumber; denominator /= primeNumber; } } }
d521583e-0620-40cb-bd00-d7ee43afab87
7
private void validateTileDimension(String targetPath, String tilePath) throws IOException { try { // Create a buffer of target image. BufferedImage targetBuffer = ImageIO.read(new File(targetPath)); // Creating a new file instance. File tileDirectory = new File(tilePath); // Total number of tiles in...
7d90867f-31d7-4bab-93f2-4a0caaea5f00
8
public void FullBack_findBall() throws UnknownHostException, InterruptedException { //Pos origin = new Pos(0,0); //System.out.println("in FullBack_findBall"); if(mem.isObjVisible("ball")) { ObjBall ball = mem.getBall(); if((ball.getDirection() > 5.0 || ball.getDirection() < -5.0)) { rc.turn(ball.getD...
23280cb6-2bab-445c-9efb-0eef1b3200dd
5
public Collection<String> getMainGroops() { // A Map of groopName --> Count Map<String, Integer> mainGroopMap = new TreeMap<String, Integer>(); Collection<String> mainGroops = new Vector<String>(); Iterator<Track> tIt = tracks.iterator(); while (tIt.hasNext()) { // Incre...
429e91c3-5f87-4eb7-b6c2-23a754710da1
5
@Override public int analyse(LexicalAnalyser analyser, int beginIndex) throws AnalyseException { String content = analyser.getSentence(); char character = content.charAt(beginIndex); char characterNext = beginIndex + 1 == content.length() ? ' ' : content .charAt(beginIndex + 1); // if (!WordTable.isDeli...
1ee3a67c-0bd7-4055-8b58-0f4b25d54b5d
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equal...
0ce53954-b47c-4f7d-b489-978b1c718460
3
private void jButton1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jButton1KeyReleased if (evt.getKeyChar() == evt.VK_ENTER) { i++; if (i == 1) { jButton1.doClick(); } else if (i == 2) { i = 0; } } }//GEN-LAST:event_jButton1KeyReleased
c4a712c6-efd1-45de-874c-e4d117e643a7
1
public static void main(String[] args) { try { EntityUi dialog = new EntityUi(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
31ab5951-db42-4557-86b6-508a1c20d0f1
9
private void updateSelectionLocation(final MouseEvent _event, final boolean _applyChanges) { if (pnt_start == null || _event == null) { //print error message. State.getLogger().severe("the pnt_start or the _event is null" + "\n\tpnt_start: \t" + pnt_start + "\n\t_event: \t" + _event); ret...
fe20ed71-c2d6-4f45-a63b-a56b262564b4
9
public void getMails(MailAccount account) { List<String> mailContent; sTrace.debug("getting Mails"); List<Integer> mailNumberList = new ArrayList<Integer>(); error = false; /* Ab Java 7: try-with-resources mit automat. close benutzen! */ // Socket, inklusive Streams, einrichten openSocket(account); i...
857d1d93-ebbb-463a-823d-33437faa038e
8
protected List<Section> loadDataFromInternet() throws IOException { File tmpFile = File.createTempFile("uas", ".txt"); try { // Download file to temp location BufferedReader reader = null; FileWriter writer = null; try { URL url = new UR...
594132f6-0e36-4d86-ad91-1b0069f7a324
3
public static void back(int index, int cur) { if (totalLength - cur < dif) { dif = totalLength - cur; sum = cur; ans = taken; } if (index + 1 >= tracks.length) return; if (cur + tracks[index + 1] <= totalLength) { taken |= 1 << (index); back(index + 1, cur + tracks[index + 1]); taken ^= 1 <...
80f98b4f-c1f1-4353-b793-b86c0ef16dda
8
public void dotBrowserChanged(String newText) { setErrorMessage(null); setMessage(null); if (newText == null) { newText = dotBrowser.getText(); } if (specifyDotButton.getSelection()) { if (newText.length() == 0) { setErrorMessage("Please en...
b84678f0-486d-4e04-867d-4c18ff1ab0af
9
public boolean deleteDirectory(String sPath) { //如果sPath不以文件分隔符结尾,自动添加文件分隔符 if (!sPath.endsWith(File.separator)) { sPath = sPath + File.separator; } File dirFile = new File(sPath); //如果dir对应的文件不存在,或者不是一个目录,则退出 if (!dirFile.exists() || !dirFile.isDirectory()) {...
5773dc92-a126-4e67-ad46-47f5dde37cb8
6
public static String trimTextWithWidth(String text, int width) { if (null == text || "".equals(text.trim()) || width <= 0) return ""; StringBuilder sb = new StringBuilder(); String[] textList = text.replace("\r", "").split("\n"); int c = 0; for (String t : textList) { String trimedText = trimLineTextWithWi...
11203cc3-9493-4c08-80b7-dde6a0efec47
9
public boolean cooking() { if (playerLevel[playerCooking] >= cooking[1]) { if (actionTimer == 0 && cooking[0] == 1 && playerEquipment[playerWeapon] >= 0) { actionAmount++; actionTimer = 4; OriginalShield = playerEquipment[playerShield]; OriginalWeapon = playerEquipment[playerWeapon]; playerEqui...
b5e562a8-81e7-46de-8d8d-3a69a923def0
7
private void addSolutionModifiers(Query arq, Resource query) { long limit = arq.getLimit(); if(limit != Query.NOLIMIT) { query.addProperty(SP.limit, query.getModel().createTypedLiteral(limit)); } long offset = arq.getOffset(); if(offset != Query.NOLIMIT) { query.addProperty(SP.offset, query.getModel().c...
0753db28-7799-427b-8f27-bf62fa5cd150
9
Option(boolean hasArg, String... aliases) { this.hasArg = hasArg; this.aliases = aliases; }
0a081263-8ce3-44d4-b5db-18a9e71d493d
2
public void initTableModel(JTable table, List<CreditProgram> list) { //Формируем массив программ для модели таблицы Object[][] crProgArr = new Object[list.size()][table.getColumnCount()]; int i = 0; for (CreditProgram prog : list) { //Создаем массив для кредитной программы ...
094dd069-0526-4d98-a80e-1f55b9cda875
6
public final void updatePath(boolean aquireTargetImeediately) { if ((path == null) || (pathTarget == null)) { path = GameCtrl.get().getCurrentPathingGraph(def.size).iterator(); nextPathTarget(); } else { PointI p1 = path.getLastPoint(); if (aquireTargetImeediately) { path = GameCtrl.get().getCurrent...
f7a54689-0bc0-46d4-b6c2-bb988d5b1e1b
5
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == exit) { System.exit(1); } else if (e.getSource() == createMaster) { CreateMasterFrame.getInstance().setVisible(true); parent.dispose(); } else if (e.getSource() == measurePath) { MeasurePathFrame.getInstance().start(); par...
7338de99-e632-4391-8cc6-526c0dd1bd18
7
public boolean executeDistributedQuery(String keyRegExp, String valRegExp, String unitTestName) { System.out.println("Executing Distributed query for unit test cast : " + unitTestName); ProcessBuilder pb = null; try { if(keyRegExp != "" && valRegExp != "") pb = new ProcessBuilder("./dgrep", "-key", keyR...