method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b434ac04-6ba6-4a40-8d41-e5ada97a70fa
3
private int calculateSize( PerfectHashMap<TrieNode<S, T>> nodes ) { int size = 0; if (nodes != null) { for (int i = nodes.capacity() - 1; i >= 0; i--) { TrieNode<S, T> n = nodes.valueAt( i ); if (n != null) { size += n.size; ...
e94031f1-be35-4a17-8113-6cbc20e8fd07
0
public static void hoist(Node currentNode) { currentNode.getTree().getDocument().hoistStack.hoist(new HoistStackItem(currentNode)); return; }
176ea77d-6d93-495c-8b1f-a0cb7307b3e3
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof HandTypesKey)) return false; HandTypesKey that = (HandTypesKey) o; if (getInt() != that.getInt()) return false; if (getBoolean() != that.getBoolean()) return false; return true; }
d7787280-9cc1-4023-9a4c-1bc0b873871f
3
static public String run(String programStr) { try { WggSimPLParser parser = new WggSimPLParser(new java.io.ByteArrayInputStream(programStr.getBytes())); parser.syntax_Analysis(); SimpleNode node = (SimpleNode) parser.getTreeRoot(); Expression program = null; program= generateSynatx(node...
0dbc3abb-9083-43ee-be88-b97ed3d95787
3
public static void main(String [] args) { // args: // -h // infile, outfile if(args.length == 2) { runParser(args[0], args[1]); } else if(args.length == 1 && args[0].equals("-h")) { printHelp(); System.exit(0); } else { print("bad command line args"); printHelp(); System.exit(1); } ...
0deaef35-9947-466d-8592-03ec619e5682
6
public double getCost(AState state1, AState state2) { int x = Math.abs(state2.getX() - state1.getX()); int y = Math.abs(state2.getY() - state1.getY()); if(x > 1 || y > 1) return -1; else if(x == 1 && y == 1) return Math.sqrt(2); else if(x == 1 || y == 1) return 1; else return 0; }
616781c8-c385-49d5-8f72-5846df3342ed
3
public Point nextPoint(int speed) { if(index == -1) throw new NullPointerException("Route hasn't been initialised for following"); if(index > points.size()) throw new ArrayIndexOutOfBoundsException("Reading past end of route"); if(index + speed > points.size()) return getLastPoint(); in...
ec120671-a740-4fd1-9e8c-0d97d7011b25
1
private String formatH3(String content) { String buf = ""; int idx = 0; int aStart = 0; int aEnd = -5; while (content.indexOf("<h3>", idx) != -1) { aStart = content.indexOf("<h3>", idx); buf += content.substring(aEnd+5, aStart); aEnd = content.indexOf("</h3>", aStart); buf += "\n$b{"+cont...
0d6aa6ea-a31b-42dc-87e9-2ca9276b2c50
2
public final void setHourlyRate(double hourlyRate) { if(hourlyRate < 0 || hourlyRate > 500) { throw new IllegalArgumentException(); } this.hourlyRate = hourlyRate; }
fba2802f-17ee-4eb6-afed-f69e19b23443
2
public void removeClientFromList(DiscoveredClient client) { Iterator<Entry<JRadioButton, DiscoveredClient>> it = buttonList.entrySet().iterator(); while ( it.hasNext() ) { Entry<JRadioButton, DiscoveredClient> thisClient = it.next(); if ( thisClient.getValue().getUsername().equals(client.getUsername()) ) ...
7b913db6-1969-4729-b6c8-81083043ccbb
3
private void checkTopOut() { for(int x = 0; x < length; x++) { for(int y = 0; y < width; y++) { if(cubes[x][y][height - SAFE_HEIGHT] != Piece.NOTHING) { toppedOut = true; System.out.println("Topped out"); } } } }
70f44289-38f8-4b12-b8a7-12142d34af26
1
public void saveProperties() { try { FileOutputStream fos = new FileOutputStream(new File( Main.USER_PROPS)); props.setProperty("X", "" + this.getX()); props.setProperty("Y", "" + this.getY()); props.setProperty("width", "" + this.getWidth()); props.setProperty("height", "" + this.getHeight()); ...
998a07c2-60bc-4d3a-a2fd-ff17ef251ef1
3
@Override public Boolean compareAnswer(Object input) { if (!(input instanceof String[])) return false; String[] inputArray = (String[])input; for (int i=0; i<inputArray.length; i++){ if (!answers.contains(inputArray[i])) return false; } return true; }
5bfe91bd-0be8-4798-b395-184c029b97fc
6
public void deleteComment(String filePath){ PictureObject picture = findById(filePath); if(picture != null){ CommentI com = picture.getComment(); beginTransaction(); List<? extends PictureI> pictures = new ArrayList<Picture>(); try{ pictures = com.getPictures(); pictures.remove(picture); }cat...
c3686304-a875-474c-806e-4073e31c3a44
3
@Path("/admin.html") @GET public String controlPage( @Context HttpServletRequest request, @Context HttpServletResponse response ) { if( !checkHostInfo(request.getRemoteHost(), AdminProperties.getHttp_allowed()) ) { if(!checkHostInfo(request.getRemoteAddr(), AdminProperties.getHttp_allowed()) ) ...
a0d2b711-2af9-4cc5-b5eb-3ef64c8e8690
3
public boolean isOnMap(int x, int y) { return (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()); }
43db6eab-38ac-434e-92eb-8add17ee3f63
1
public String stringApiValue() { if (isHLVariable()) { return SubLAPIHelper.makeSubLStmt("GET-VARIABLE", this.hlVariableId); } else { return "'" + cyclifyWithEscapeChars(); } }
7153f486-4387-4abc-925e-efa723db0bc8
9
public void start() { synchronized (syncSS) { if (ps != null) { ps.destroy(); ps = null; } needExit = false; Thread t = new Thread(new Runnable() { String[] cmd = new String[] { "/usr/local/bin/ffserver", "-f", cfgPath }; @Override public void run() { try { while (needExi...
84b6edb2-3e6c-465a-8ae1-b8ae86606d2e
8
public int getHeight(String text) { DisplayList displayList = null; if (displayListCaching) { displayList = (DisplayList) displayLists.get(text); if (displayList != null && displayList.height != null) { return displayList.height.intValue(); } }...
29d91928-887d-4446-a57e-805c2f8f943d
5
public SocketProvider sendPortCommand(Command command, Reply commandReply) throws IOException, FtpWorkflowException, FtpIOException { setConnectionStatusLock(CSL_INDIRECT_CALL); setConnectionStatus(FTPConnection.BUSY); SocketProvider provider = null; ...
08e8b58c-fad1-431e-a3c0-b7ad17a260e1
4
@Override public String convertToString(Boolean[] array) { if (array.length == 0) { return ""; } StringBuilder buf = new StringBuilder(array.length); for (int i = 0; i < array.length; i++) { buf.append(ar...
567037bf-aa6d-4b57-928d-c39481211282
2
public Funktio hae(String tunnus) { if (tunnus.equals("sin")) { return new Sinifunktio(); } if (tunnus.equals("cos")) { return new Kosinifunktio(); } return null; }
ce028c3c-c4ae-4761-ba91-dd7735096a6d
1
public void visitFormalTypeParameter(final String name) { if (!hasFormals) { hasFormals = true; buf.append('<'); } buf.append(name); buf.append(':'); }
c42a8d14-bef3-4495-b26b-509ee71caa08
1
private void addExcludedPathBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addExcludedPathBtnActionPerformed if (pathsToExcludeChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { controller.getModel().getFilesToExclude().add(pathsToExcludeChooser.getSelectedFile()); updateVi...
d642b0dc-36a5-4dfb-a1bf-edba6c03cd05
3
public void run() { boolean isRunning = true; while (isRunning) { try { // Get the message data (MagnetObject) MagnetObject m = (MagnetObject) this.input.readObject(); // Check if client (Kid) has disconnected if...
33f9f515-bce8-44d6-979e-ff928fd5b24c
0
public void setM(int n) { reset(); m = n; chooseW(); }
d15ca522-a6e7-428f-8401-271903c5bf7b
6
public VertexSet getNachbarn(Land land) { if (laenderList.containsID(land.getID())) { VertexSet result = new VertexSet(); Land landOne; Land landTwo; for (Pfad p : pfadList) { landOne = p.getFirstLand(); landTwo = p.getSecondLand(); if (landOne.equals(land)) { if (!result.containsID(lan...
cdf85fad-94fd-4f55-aec8-37b1660cf596
3
private List<? extends TypeMirror> getElementTypeMirrors( List<? extends Element> elements) { List<TypeMirror> list = new ArrayList<TypeMirror>(); for (Element o : elements) { list.add(o.asType()); } return list; }
dc12c216-c9ab-4960-a010-13a7571936af
0
@Override public void windowClosing(WindowEvent e) { System.exit(0); }
456a13e6-8b17-4483-b888-0c9b0bc2c457
9
public void add(AbstractUnit units) { Specification spec = getSpecification(); UnitType unitType = units.getUnitType(spec); int n = units.getNumber(); boolean added = false; if (unitType.hasAbility(Ability.NAVAL_UNIT)) { for (AbstractUnit refUn...
25f729f9-2a96-4d76-8b26-aa20ed2f5f5d
9
public int bestPosition(String[] board) { Set<Integer> badRows = new HashSet<Integer>(); Set<Integer> badCols = new HashSet<Integer>(); int boardLen = board.length; for (int i = 0; i < boardLen; i++) { String line = board[i]; int lineLen = line.length(); ...
d7f891ee-b92e-4a58-8aa6-0d56a5fe663e
8
private static SplitContainer findBetterContainer(SplitContainer split, Container dockingPanel, boolean anchoredTop, boolean anchoredLeft, boolean anchoredBottom, boolean anchoredRight) { // we already have found a splitContainer, but it can be subOptimal in some cases // for instance when we want to anchor a compo...
6f027864-d30b-4340-a116-00a9dbf55aaf
4
private static void validatePhone(String phone) throws TechnicalException { if (phone == null || phone.isEmpty() || phone.length() > PHONE_SIZE) { throw new TechnicalException(PHONE_ERROR_MSG); } String regex = "\\+375\\-\\d{2}\\-\\d{3}\\-\\d{2}-\\d{2}"; Pattern p = Pattern.c...
070107a0-dd41-4689-96ca-b7662a37303c
6
public void write(OutputStream outputStream) { StringBuilder sb = new StringBuilder(); // add response code sb.append(headers.get(ResponseKeys.PROTOCOL.getValue()).getValue()); sb.append(" "); sb.append(status.getStatus()); sb.append(" "); sb.append(status.getMess...
77927f9d-3d43-4410-83cf-0fee2799c14f
2
private boolean showExists(Show show){ for (Show show1 : shows) { if (show1.getName().equals(show.getName())){ return true; } } return false; }
6fcb2c2a-8dfb-448d-b3eb-83c7c9864013
7
public AlienWorldWell(World world, long seed, int wellX, int wellZ) { super(world, seed, wellX, wellZ); mineralOdds = random.nextInt(5) + 1; mineralsPerLayer = random.nextInt(10); height = random.nextInt(32) + 48; liquidLevel = random.nextInt(height / 2) + height / 2; switch (random.nextInt(7)) { case ...
259ab71e-3667-4109-ad7d-c9e26ea825fe
9
public static ArrayList<Integer> inorderTraversal2(TreeNode root) { ArrayList<Integer> list =new ArrayList<Integer>(); if(root == null) return list; TreeNode prev = null; Stack<TreeNode> stack = new Stack<TreeNode>(); stack.add(root); while(!stack.isEmpty()){ TreeNo...
641e17c3-8627-44fb-bfa8-19c45e2690bc
6
public boolean isValid(String progress) { //radius type x z [y] world String[] t = progress.split(" ", 6); if(t.length != 5 && t.length != 6)return false; if(!t[1].equalsIgnoreCase("circle") && !t[1].equalsIgnoreCase("square"))return false; try { Double.parseDouble(t[0]); Double.parseDouble(t[2]); ...
a84da271-257c-4317-9bc8-485a48614fb3
1
private static void doTest(boolean b, String msg) { if (b) { System.out.println("Good."); } else { System.err.println(msg); } }
72720758-a12b-4ef4-ac07-06854174a5de
7
private void doAdd(ICommand cmd) throws Exception { if (cmd.getSubCommand().equals(CmdConstants.SubCmdNames.PACKAGE)) { // First get the id of the object to modify, then modify it long id = IdManager.getInstance().accessIdWithKey(cmd.getFlagValue(CmdConstants.Flags.OBJECT)); isc.addPackage(id, cmd.getFlagVal...
85614fd6-62df-4a11-9021-9f9aafb76aa1
6
private static boolean saveChangesRecursively(Component comp) { if (comp instanceof YIComponent) { YController controller = (YController) ((YIComponent)comp).getYProperty().get(YIComponent.CONTROLLER); if (controller != null) { if (! changesSaved(controller)) { return fa...
a8c8f974-0c0e-4747-a73e-a88fc0002aaa
5
public void drawInGameMenu(GL2 gl) { this.gl = gl; if(isMenuOpen()) { start2D(); if(selection == 0) { inGameMenu = Texture.findOrCreateByName(RESUME); if(inGameMenu != null) { inGameMenu.bind(gl); gl.glBegin(...
3c9a72fc-2071-4c67-a872-7857c342f2a1
9
private BufferedImage readImage(ImageReader jpegReader, ImageReadParam param) throws IOException { if (ycckDecodeMode) { // The standard Oracle Java JPEG readers can't deal with CMYK YCCK encoded images // without a little help from us. We'll try and pick up such instances an...
878d13b5-7be6-4885-9a75-7571a408025f
9
public long auctionItem(String category_name, String user, String item_name, String description, String min_price, String duration, String[] values) throws DTException{ //create auction with confirmation message Category modelCategory = objectModel.createCategory(); modelCategor...
0509a713-62b8-4faf-bcb6-bdbd9f0bf034
2
public float[][] GetM() { float[][] res = new float[4][4]; for(int i = 0; i < 4; i++) for(int j = 0; j < 4; j++) res[i][j] = m[i][j]; return res; }
261909cc-12e0-459f-b2ee-ef9f4d8eca6f
7
public ArrayList<ArrayList<Node>> ConnectedComponents(HierarchicalUndirectedGraph hgraph) { componentCount = 0; int componentsSize[]; List<Integer> sizeList = new ArrayList<Integer>(); ArrayList<ArrayList<Node>> componentListofList = new ArrayList<ArrayList<Node>>(); ...
f60b9a30-c569-4ad9-b799-02509cedbbab
4
@Override public void updatePowerUp(BlockBreakersModel M) { // TODO Auto-generated method stub lifeTime--; if (lifeTime <= 0) { active = false; } if (lifeTime < Max_life/4) { if (lifeTime%10 == 0) toggle *= -1; if (toggle == 1) M.getPaddle().setColor(old_color); else M.getPaddle().set...
cf9bb17f-97f3-4820-b043-40430c7ea22a
4
public static void main(String[] args) { System.out.print("Введіть кількість фотографій >> "); Scanner in = new Scanner (System.in); int count = in.nextInt(); System.out.print("Формат (1 - 9x12; 2 - 10x15; 3 - 18x24) >> "); int format = in.nextInt(); double price = 0; double all = 0; System.out.println(...
908d7c4f-4798-4065-a81d-87e766cff99f
2
public static BufferedImage getAnimationFrame(BufferedImage image, int x, int y, int width, int height) { return image.getSubimage(x * width, y * height, (width > 0 ? width : 1), (height > 0 ? height : 1)); }
b6b4d471-0137-4601-a866-f7dc9aacd6b3
4
public void init(){ game = this; int index = 0; for(int r=0;r<6;r++){ for(int g=0;g<6;g++){ for(int b=0;b<6;b++){ int rr = (r*255/5); int gg = (g*255/5); int bb = (b*255/5); colors[index++]=rr<<16|gg<<8|bb; } } } screen = new Screen(WIDTH,HEIGHT, new SpriteSheet("/spri...
2d1ea367-bd8e-4a8c-8ed1-6a740b926df4
0
public ThreadT1(String name) { super(name); }
c715d201-05d1-4938-bb0e-95ba60ff2b63
1
public static void error(Exception e) { String message = "Es trat in unbehandelbarer Fehler auf:\n" + e.getMessage() + "\n"; message += "Dies kann viele Gründe haben. Sollte dieser Fehler sehr oft auftreten, melden Sie ihn bitte mit folgenden Trace:\n\n"; StackTraceElement[] trace = e.getStackTrace(); for (...
b57bbdb6-a0ec-4e4a-94a8-6893bc7d724e
5
private int calculateNodeCount(boolean input, boolean draw, int rack_size){ if (input) return ((draw ? USE_PROB_DRAW : USE_PROB_PLAY) ? rack_size*3 : rack_size) + 1; return ((draw ? USE_PROB_DRAW : USE_PROB_PLAY) ? rack_size*2 : rack_size*4); }
4aa3c9b0-1878-4695-a455-3b0962edad4c
1
private void SetRanges(String[] strRange, int[] range, int length) { for(int x=1; x<length; x++) //convert string to number range[x-1] = Integer.parseInt(strRange[x]); }
3f58a09f-0464-403f-afe7-74ee218c5672
7
public boolean canPlay() { if (multiplayer) { try { return round == player && Network.canPlay(); } catch (RemoteException e) { e.printStackTrace(); } return false; } else { if (playerWhite.isAI() && round != Player.BLACK) return false; if (playerBlack.isAI() && round != Player.WHITE) ...
2adf90a2-1677-4912-a402-2808fc50d72b
1
private static Method[] getDeclaredMethods( final Class<?> type ) { return AccessController.doPrivileged( new PrivilegedAction<Method[]>() { public Method[] run() { final Method[] declaredMethods = type.getDeclaredMethods(); AccessibleObject.se...
7bb6fc66-f3a9-4930-98a9-8e477704bf3a
4
public Map<String,String> codage(ArrayList<Couple> tableauProb){ //init tableau ArrayList<Couple> tableauP = new ArrayList<Couple>(); tableauP = copyList(tableauProb); Map<String,String> tableauCode = new HashMap(); for (Couple c : tableauP){ tableauCode.put(c.caractere, ""); } //tri tableau de pro...
8d91d490-a4de-4c74-a6ea-d243a45469c2
9
public static Method getMostSpecificMethod(Method method, Class<?> targetClass) { if (method != null && isOverridable(method, targetClass) && targetClass != null && !targetClass.equals(method.getDeclaringClass())) { try { if (Modifier.isPublic(method.getModifiers())) { try { return targetClass.g...
1d19abd0-6d6b-4714-8369-c03487721adb
9
public void tryJoinChatroom(String userMsg) { System.out.println("Entering tryJoinChatRoom"); //logging Message joinMsg; // check for a " " (space) in chatroom argument if (userMsg.contains(" ")) { System.out.println("Improper use of /join"); System.out.println("Please use '/help'...
4b40fea3-589f-4453-9c0a-b3ef7b2b4b4a
5
private void deleteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteBtnActionPerformed // TODO add your handling code here: int index = paymentList.getSelectedIndex(); try { String stuID = payingStudent.getStudentID(); String payID = listPay.get...
ad509219-a43e-4ec1-b320-a5f35b56023f
8
public static void main(String[] args) { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } int port = 1099; InetAddress localhost = null; try { localhost = InetAddress.getLocalHost(); System.err.println("Host name : "+localhost.g...
77cf311e-e24f-40b3-b87a-b5c146e8c404
8
public static void main(String[] args) throws IOException { BufferedReader in; StringBuilder out = new StringBuilder(); File f = new File("entrada"); if (f.exists()) { in = new BufferedReader(new FileReader(f)); } else { in = new BufferedReader(new InputStreamReader(System.in)); } String line; int...
57fbac7e-750c-4823-ac70-46f6323569ec
1
public Item next() { if (!hasNext()) throw new NoSuchElementException(); Item item = current.item; current = current.next; return item; }
78ffd26c-0b27-407e-8de0-6c113a83f187
3
@Override protected Boolean doInBackground() { Boolean verif = null; try { // Obtention d'une instance de l'objet calculant la signature Signature signer = Signature.getInstance(super.file.getAlgorithm()); // initialisation de l'objet signant avec la clé publiq...
37fe05b4-a84b-40ec-94f9-574e9d7ece4a
9
public static void kmp(String t, String p) { if (t == null || t.length() == 0 || p == null || p.length() == 0) { return; } int next[] = getNext(p); int i = 0; int j = 0; while (i < t.length() && j < p.length()) { if (j == -1 || t.charAt(i) == p.ch...
73f95fe3-4164-454e-b9ed-27997ee3b151
6
public boolean pickAndExecuteAnAction() { if (!(mCustomer == null)) { if (mCustomer.transaction == EnumTransaction.Deposit) { deposit(); mCustomer.transaction = EnumTransaction.None; return true; } if (mCustomer.transaction == EnumTransaction.Loan) { loan(); mCustomer.transaction = EnumTr...
7978def9-7805-42be-888d-baebf6a25919
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Position other = (Position) obj; if (positionX != other.positionX) return false; if (positionY != other.positionY) return false; return...
b5e06fa3-dab7-4a7f-869d-2652bd3ab053
4
public void setVariable(String name, String value) { if (name.charAt(0) == '_') { if (name.equals("_vertex_color")) { String parts[] = value.split(",", 3); setColor(new Color(Integer.parseInt(parts[0].trim()), Integer.parseInt(parts[1] .trim())...
524a664c-f86e-487f-b2df-0b7bf93a8ddd
2
@Override public String toString() { String g = G().V() + " vertices " + G().E() + " edges\n"; for (int v = 0; v < G().V(); v++) { g += name(v) + "(" + v + "): "; for (int w : G().adj(v)) g += name(w) + "(" + w + "), "; g += "\n"; } return g; }
4b098f14-7987-41d2-b90e-18a3fbb17c21
3
protected void add(Filter filter) { if (!containsParam(Constants.FILTERS) || !(getParam(Constants.FILTERS) instanceof SimpleData) || !(((SimpleData) getParam(Constants.FILTERS)).getData() instanceof FilterList)) setParam(Constants.FILTERS, new FilterList()); getFilterList().add(filter); }
50b208d8-e00b-4a2b-9cc3-7240e5d2a12a
2
public void execute() { this.outputWindow.setEditable(true); if (this.openedFile!=null && this.openedFile.exists()) { this.classLoader.loadClass(this.openedFile); this.outputWindow.setText(null); this.outputWindow.setEditable(false); this...
85f6791e-06b1-4b47-a991-49a2492b8ac0
2
public void newInvProduct(){ int arr[] = new int [PID.length]; try { Database db = dbconnect(); String query = "INSERT INTO products_involved (ticket_TID, product_PID) VALUES " + "(?,?)"; db.prepare(query); fo...
f5163f9f-679f-4b2e-8427-d4d4fc6c4148
7
@Override public void affectPhyStats(Physical affected, PhyStats stats) { super.affectPhyStats(affected,stats); if((glows) &&(affected instanceof MOB) &&(!super.amWearingAt(Wearable.IN_INVENTORY)) &&(((MOB)affected).location()!=null) &&(((MOB)affected).location().domainType()==Room.DOMAIN_INDOORS_CAVE) ...
86488695-8b52-48d6-9862-bb396ce7718c
7
public void run() { byte[] buffer = new byte[1024]; DatagramPacket packet = new DatagramPacket(buffer, buffer.length); while (true) { try { this.socket.receive(packet); } catch (IOException e) { e.printStackTrace(); } byte[] cmd = packet.getData(); InetAddress addr = packet.ge...
3a4f5d27-49af-417d-be4d-26b070f029bb
9
public void assembleFile() { File source = null; File outputExe = null; JFileChooser chooser = new JFileChooser(sourceDir); FileNameExtensionFilter filter = new FileNameExtensionFilter( "Pippin Source Files", "pasm"); chooser.setFileFilter(filter); // CODE TO LOAD DESIRED FILE int openOK = chooser.sho...
c0466f57-667a-4616-9aae-8836a63196cc
0
public GraphPane() { this.setLayout(new BorderLayout()); firsPanel.setBorder(new TitledBorder("选项")); firsPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); firsPanel.add(typeBox); getcontent(); chartPanel = new ChartPanel(chart,true); secPanel.add(chartPanel); ...
fa7b0b11-86b2-44a7-88ea-0fc375ab52bf
0
public List<String> getContents() { return contents; }
bc12978d-0942-470d-b760-dea885c77fad
4
public CustomFontTab(GraphicsExample example) { super(example); // create list of fonts for this platform FontData [] fontData = Display.getCurrent().getFontList(null, true); fontNames = new ArrayList<String>(); for (int i=0; i < fontData.length; i++) { // remove duplicates and sort String nextName = fontDat...
390ca795-4306-4592-b55b-06f3a8f17db6
2
private static String intArToColor(int[] ar) { assert ar.length == 4; String tmp = UIRegex.ARGB + "("; for (int i = 0; i < ar.length; i++) { tmp += ar[i]; if (i != (ar.length - 1)) { tmp += ","; } } tmp += ")"; return ...
94b88b0c-8e59-47c9-a745-ba42ecb01f4b
6
@Override public void run() { while(!Thread.interrupted()){ if(speed == 0){ //Draw at most x60 per second long time = System.currentTimeMillis(); if(canvas != null)canvas.repaint(); if(System.currentTimeMillis() - time < 17){ try { sleep(System.currentTimeMillis() - time); } catch ...
d9c1d852-2689-4dcf-9681-58d7a08b9080
9
public String toString() { String sql = "INSERT INTO " + targetTable + "("; String f = fieldNameList.get(0); boolean bReachHeaderEnd = false; int headerCount = 0; for (int i = 0; i < fieldNameList.size(); ++i) { if (i != 0 && fieldNameList.get(i).equals(f)) { bReachHeaderEnd = true; } if (bReac...
416135a9-67b3-4875-bdd6-f0180d2dde9c
6
public static MassBankRecordLine getRecordLine(String line) { for (MassBankRecordLine recordLine : MassBankRecordLine.values()) { if (line.startsWith(recordLine.getKey().concat(":")) || line.startsWith(recordLine.getKey().concat(";")) || (MassBankRecordLine.FOLLOWING_LINE == recordLine || MassBankRecordLine....
5cda6de2-5e2a-43d6-95b6-355ce755021a
6
public void renderText() { for (Text t : text) { if(!t.isVisible()) continue; for(int i = 0; i < t.getImageAmount(); i++) { Image image = t.getImageAt(i); int[] pix = image.getPixels(); int w = image.getWidth(); for(int yLoc = 0; yLoc < w; yLoc++) { for(int xLoc = 0; xLoc < im...
321374b0-0a73-4788-9384-ff21cb2f7e01
4
public boolean isWithinGrid(Grid grid) { if(x>=0 && y>=0 && x<grid.getGridSize() && y<grid.getGridSize()){ return true; } return false; }
07c9c49b-c9e6-4c7b-993b-c84567424a28
6
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == editButton) { cancelButton.setEnabled(true); saveButton.setEnabled(true); editButton.setEnabled(false); tfSubjectPriority.setEditable(true); } ...
c49b0b6e-80c9-422b-bcad-675ca0dd74a1
2
private void drawScene() { int hauteurMax = this.hauteurMax(); int largeurMax = this.largeurMax(); for(int i = nbr-1 ; i >= 0; i--) { System.out.print(" "); System.out.print(t1.getStringLine(i,largeurMax)); System.out.print(" "); System.out.print(t...
c3489d60-2c99-4103-a6e4-c01870729a6e
3
public List<Event> sendRequest(String params) { StringBuilder builder = new StringBuilder(); builder.append("https://api.guildwars2.com/v1/events.json"); if(params!=null) { builder.append(params); } String url = builder.toString(); List<Event> result = new ArrayList<Event>(); RestTemplate rest = new Re...
159d2783-da33-4ed6-bdc8-2b7dbd9bd77b
9
public void warn(Event event) { switch(event.getTypeEvent()) { case ROBOT_DETECTED : if(state == 1) state = -1; else ignore(); break; case ROTATE_END : if(state == 0) state = 1; else if(state == 2) state = 3; else ignore(); break; case GOFORWARD_END : if(state == 1)...
6ff5a094-9c0e-46b0-a924-4847e01ec107
1
private Character Charactervalidate(Character character){ if(!paidTransaction(Accesscreate(),character) ) return null; return character; }
56e3bc23-01a6-41ef-9406-8024a8615b9f
2
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { if (!subExpressions[0].getType().isOfType(Type.tString) && !subExpressions[1].getType().isOfType(Type.tString)) { writer.print("\"\""); writer.breakOp(); writer.print(getOperatorString()); } subExpressions[0].dumpE...
be01116e-4d5a-48a8-9e4d-4384547fbdc4
5
public void saveUrl(String fileName, File directory, String urlString, boolean display) throws MalformedURLException, IOException { BufferedInputStream in = null; FileOutputStream fout = null; try { File file = new File(directory, fileName); URLConnection c = new URL(urlString).openConnection(); c.set...
393a2a21-e4a2-4d48-af31-266a5f9752df
6
private boolean isObstacle(int row, int col) { if(row<0 || row>=grid.length) return true; if(col<0 || col>=grid[row].length) return true; for(Observation obs : grid[row][col]) { if(obstacleItypes.contains(obs.itype)) return true; } return...
50eea547-a89f-4011-9ff1-2a3e4519482c
0
public void setDefaultChannels(String[] set){ DefaultChannels = set; }
a4e86285-4cf9-4e62-83ee-303333411650
3
public void fireSectionEvent(final SectionEvent EVENT) { final EventHandler<SectionEvent> HANDLER; final EventType TYPE = EVENT.getEventType(); if (SectionEvent.ENTERING_SECTION == TYPE) { HANDLER = getOnEnteringSection(); } else if (SectionEvent.LEAVING_SECTION == TYPE) { ...
7a858029-f844-45a8-a96a-d136a88e7de0
9
public void showROI(ImagePlus ip, Roi roi, StateContainer sc_in) { // green coloured pixel for alive set pixel visualization final int[] ALIVE_PIXEL = new int[] {0, 255, 0, 0}; // red coloured pixel for trial set (band) pixel visualization final int[] BAND_PIXEL = new int[] {255, 0, 0, 0}; final ImageProgre...
95cd75a4-1df2-4836-99f5-326c5b307183
5
private GsSong[] filterSongs(GsSong[] rawSongs,String id) { GsSong[] res=new GsSong[1]; int size=0; for(int i=0;i<rawSongs.length;i++) { if(rawSongs[i]==null) continue; if(id.compareTo(rawSongs[i].getAlbumId())!=0) continue; if(rawSongs[i].trackNum()==0) continue; if(size!=0) { GsSong[...
cede6a5d-9bff-44bb-8943-d5189bfb32b3
3
@Override public byte[] getInterval(int start, int end) { validateInterval(start, end); if (comp == CompressionType.None) return parentFile.getInterval(start, end); byte[] data = parentFile.getContents(); if (comp == CompressionType.Lz) data = LZ.decompr...
35011aeb-0d0b-4ab5-bc01-3b710b22f7b3
2
private void isGreaterThanEqualsToInteger(Integer param, Object value) { if (value instanceof Integer) { if (!(param >= (Integer) value)) { throw new IllegalStateException("Integer is not greater than supplied value."); } } else { throw new IllegalArgumentException(); } }
cd94e5dc-7cfd-4f26-8ed2-f5b641a3dfbd
1
public void visitLookupSwitchInsn( final Label dflt, final int[] keys, final Label[] labels) { minSize += 9 + keys.length * 8; maxSize += 12 + keys.length * 8; if (mv != null) { mv.visitLookupSwitchInsn(dflt, keys, labels); } }
913a83ac-e07d-48e4-89db-59f3c037d646
0
public void onAccount(IAccount account) throws JFException { }