method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c7146fee-7f06-4b08-9c9c-f27946726cf6
4
@SuppressWarnings("unchecked") public static LinkedHashMap<String,Object> gvHashSO(LinkedHashMap<String,Object> array, String key) { if (array == null) return new LinkedHashMap<String,Object>(); Object retObj = gv(array,key); LinkedHashMap<String,Object> hm = new LinkedHashMap<String,Object>(); if (retObj inst...
78cab73a-7b24-4788-9b45-f132c55d48b4
6
public int peak(int [] arrA,int low, int high, int size){ int mid = (low+high)/2; if((mid==0||arrA[mid]>=arrA[mid-1]) && (arrA[mid]>=arrA[mid+1]||mid==size-1)){ return mid; } else if(mid>0 && arrA[mid]<arrA[mid-1]) return peak(arrA,low,mid-1,size); else return peak(arrA,mid+1,high,size); }
45f7a45c-03d5-4aa7-baa2-0a0432a0d3b9
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); try { if(request.getParameter("page").equalsIgnoreCase("createquestion")){ String questionid=CommonResource.getNextId("question"); String question=request.getP...
dc2d689a-d638-4537-a3de-26f26a7ce22e
6
public static String encode(double latitude, double longitude){ double[] lat_interval = {-90.0 , 90.0}; double[] lon_interval = {-180.0, 180.0}; StringBuilder geohash = new StringBuilder(); boolean is_even = true; int bit = 0, ch = 0; while(geohash.length() < precision){ double mid = 0.0; if(i...
d1ef1a82-b205-4c7c-871f-3b66512512f0
7
public Mes(int i, boolean bis) { if (i == 3 || i == 5 || i == 8 || i == 10) { n = 30; } else if (i == 1) { if (bis == false) { n = 28; } else { n = 29; } } else { n = 31; } dia = new Dias[...
2b7fcf62-9cfd-4c96-9c71-d7d56c8b7388
7
private void validate() throws ScheduleException { // For each team... for ( NFLTeam team : NFLTeam.values() ) { // ...make sure it has its schedule loaded. NFLMatchup[] schedule = matchups.get(team); if ( null == schedule ) { s...
7661bdab-596a-4bda-8c72-bf9328005a44
1
@Override protected void logBindInfo(Method method) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功"); } }
9934a937-b455-416f-8b57-d2c97e739161
5
protected boolean storeRegistrationID(Sim_event ev, List list) { boolean result = false; if (ev == null || list == null) { return result; } Object obj = ev.get_data(); if (obj instanceof Integer) { Integer id = (Integer) obj; list....
41bd1d8d-4020-48ef-a574-08c52276fdb7
2
public void deleteUser(String userEmail) { initConnection(); PreparedStatement sqlStatement = null; try { //Prepare Statement sqlStatement = (PreparedStatement) connection.prepareStatement("DELETE FROM users WHERE email= ?;"); sqlStatement.setString(1, userEmail); //Execute Prepared Statem...
f7530215-2f7a-4704-a2bf-01cf543ca2b7
7
private Map<Integer, List<Integer>> createDAG(String sentence) { Map<Integer, List<Integer>> dag = new HashMap<Integer, List<Integer>>(); TrieNode trie = wordDict.getTrie(); int N = sentence.length(); int i = 0, j = 0; TrieNode p = trie; while (i < N) { char c...
f6fa5775-10ab-4512-819a-d62a0892d8ef
3
public Object tooltip(Coord c,boolean again){ if(tip != null) return(tip); if(tips != null && !tips.equals("")){ tip = RichText.render(tips,200); } return(tip); }
e057d032-c2e3-469e-9a9d-34d4733c2e0e
0
public String getMsgID() { return msgID; }
05c0d649-a267-42b2-8ef1-a2816e682172
8
private void installLookAndFeel() { if (fLFName != null) { UIManager.LookAndFeelInfo[] lfInfos = UIManager.getInstalledLookAndFeels(); if (lfInfos != null) { for (int i = 0; i < lfInfos.length; i++) { if (lfInfos[i].getName().equals(fLFNam...
191a817f-d63e-4405-a2a8-119c322b0f71
2
public static void main(String[] args) throws IOException { System.out.println(new Date()); Features feat = new Features(50,50); feat.integralImages(feat.FACES, feat.numbFaces, feat.integralFaces); for(int i = 0; i < 2; i++){ for (int j = 0; j < 4; j+=2) { System.out.println(i + " " + j + " " + feat.getS...
d7879ebf-0a50-4158-9781-0951ef1aa42c
4
public void clickChooseCharacters(Scanner kb, ArrayList<MainMenuHeroSlot> heroies) { //Print out prompt System.out.println("Please input what type of heroes you would like to use one by one"); for(int i = 0; i < Constants.heroNames.length; i++) System.out.println(" - " + Constants.heroNames[i]); //Pick...
aa4ba505-a018-458c-bb33-d2922f00f3e1
3
private UserBean createUserBean(ResultSet result){ try { //gebe null zurück, falls kein User vorhanden ist if (result == null || result.getFetchSize() < 0){ return null; }else{ UserBean user = new UserBean(); user.setId...
4adc3266-ca74-4580-9de6-fbbfc550a00a
4
public void run() { //Guarda el tiempo actual del sistema tiempoActual = System.currentTimeMillis(); //Ciclo principal del Applet. Actualiza y despliega en pantalla la animación hasta que el Applet sea cerrado while (true) { if (!pausa && !instrucciones) { a...
afde8f8d-140c-48d4-a34f-c49fcd60ea9f
8
private void decodeGroup(String serviceName, OMMFilterEntry serviceFilterEntry) { byte[] group = null; byte[] mergedToGroup = null; OMMState groupStatus = null; // Get Group, MergedToGroup and Status from the payload OMMData serviceFilterEntryData = serviceFilterEntry.getDa...
f5f53caa-3394-4422-b64f-40c375a6c7c1
9
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof CountrylanguagePK)) { return false; } CountrylanguagePK other = (CountrylanguagePK) object; if ((this.countryCo...
a9057f14-db27-465c-844e-71f910279e9f
0
public static void main(String[] args) { Ex3 e = new Ex3(); D1.main(args); }
788fc182-8c09-48ae-9fbb-e00adefaa08a
2
public HiloBean loadId(HiloBean oCliente) throws NumberFormatException { try { if (request.getParameter("id") != null) { oCliente.setId(Integer.parseInt(request.getParameter("id"))); } else { oCliente.setId(0); } } catch (NumberFormatEx...
1b65e23f-3b53-4ff3-a740-be687d4f29b9
4
public List<Ban> searchBans(String search, boolean reverse) { List<Ban> result = new ArrayList<Ban>(); if (search == null || search.isEmpty()) { result.addAll(bans.values()); } else { // compile regex to search... Pattern searchPattern = Pattern.compile(sear...
f0067d14-3174-45bf-b3cb-cf29ee176145
1
public static void insertTva(String tva, float taux) throws SQLException { String query = ""; try { query = "INSERT INTO TVA (TVALIBELLE,TVATX) VALUES (?,?) "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement(query); pStatement.setStrin...
86d250c3-5f77-430d-b4be-fd5ea71e8838
7
BitSet[] computeRows() { HashMap<Short,BitSet> sets = new HashMap<Short,BitSet>(); for (int i=all.nextSetBit(0);i>=0;i=all.nextSetBit(i+1)) { sets.put( (short)i, (BitSet)all.clone() ); } for ( int i=0;i<sections.size();i++ ) { Section s = sect...
59aafa54-7398-4b58-a2f9-7f7737b7396d
7
@Override public void mouseDragged(MouseEvent e) { if (e.isConsumed() || (selectedTask == null)) { return; } Graphics2D g2 = (Graphics2D)chart.getGraphics(); g2.setXORMode(Color.WHITE); g2.draw(new Line2D.Double(selectedPoint, lastPoint)); lastPoint = e.getPoint(); Object hoverTask = chart.getTaskAt...
d6cbe30f-70b3-4494-9386-60fa847e4ca5
2
public void releaseVM(SlaveVM vm) { System.out.println("DEBUG: VM " + vm.getId() + " is available again"); vm.setState(VMState.WAITING); this.vmsInUse.remove(vm); this.vmsAvailable.add(vm); final int id = vm.getId(); Thread timeout = new Thread() { public void run() { try { Thread.sleep(Resour...
f7d03776-629e-4b94-a945-bce475183e81
9
public void actionPerformed(ActionEvent paramActionEvent) { try { if (paramActionEvent.getActionCommand().compareTo("title") == 0) { if (this.minimized) { setMinimized(false); return; } setMinimized(true); return; } if (pa...
aeac5036-bb78-4721-a35f-e14756e9dc42
6
public GUIController(WorldFrame<T> parent, GridPanel disp, DisplayMap displayMap, ResourceBundle res) { resources = res; display = disp; parentFrame = parent; this.displayMap = displayMap; makeControls(); occupantClasses = new TreeSet<Class>(new Comparato...
5303c212-a81a-40ee-b2a0-69efe8d8e45a
8
public static void main(String args[]){ int a = 0; while(a == 0){ int d = Integer.parseInt(JOptionPane.showInputDialog("Choose your decision:\n1 - Add a Girl\n2- Save to DB\n3- Load from DB\n4- List Items\n5- Exit")); if(d == 1){ String name = JOptionPane.showInputDialog("Input Name:"); String img = "...
ad2700c7-a13d-447d-ba92-b8cf2d914a5d
8
static void runFlowAnalyzes(OptFunctionNode fn, Node[] statementNodes) { int paramCount = fn.fnode.getParamCount(); int varCount = fn.fnode.getParamAndVarCount(); int[] varTypes = new int[varCount]; // If the variable is a parameter, it could have any type. for (int i = 0; i ...
c0c7ed58-a1ad-4070-b08c-3ccb7d791143
7
public static void main(String[] args) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); // this is simple... we parse out the [xx] bit first then compare to // the last line. String line = reader.readLine(); List<Double> list = new ArrayList<Double>(); while (l...
b2ec0690-2e09-44cb-9d14-470e25b87a34
2
private void loadFromFile(File f) throws ImageProcessingException, IOException { filename = f.getName(); filepath = f.getParent(); filesize = f.length(); filedate = f.lastModified(); Metadata metadata = ImageMetadataReader.readMetadata(f); Directory directory = metadata.getDirectory(ExifSubIFDDirector...
72c83ec6-953a-4535-ad65-c04bb5cfd420
2
public synchronized void stop(HTSMsg msg, int clientId){ Subscription s = getSubscription((Long) msg.get("subscriptionId"), clientId); HTSPServerConnection c = monitor.getServerConnection(s.serverConnectionId); msg.put("subscriptionId", s.serverSubscriptionId); try { c.send(msg); } catch (IOException e) { ...
a9ffdd77-5840-4747-9a02-e2532beafe38
4
public static void main(String[] args) { System.out.println("Begin: RankSumNoReplacementSimulate"); int numberOfSamples = 100000; for( int n = 2; true; n++ ) { // Generate random rank sums RankSumNoReplacementSimulate rss = new RankSumNoReplacementSimulate(numberOfSamples, n); // Show mean / variance f...
a80c2d64-a114-492f-8fe0-11e7a7bf2344
1
public boolean isBombed(int x, int y) { return (sea[x][y] == HIT || sea[x][y] == MISS); }
2f18f09e-c983-4ae8-9005-1cbe50f08451
4
public void saveTileSet() { if (canvas.getMap().getTileSet().getPath() == null) { int returnVal = chooser.showSaveDialog(canvas); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); File imagesDir = new File(file.getPare...
d5f2407d-1194-4616-a66e-ac5974785990
5
public static void main(String[] args) { ServerSocket server_sock = null; Socket client_sock = null; // Initialize the server socket MsgDumperCmnDef.WriteDebugSyslog(__FUNC__(), __LINE__(), "Initialize the server socket in MsgDumper daemon..."); try { server_sock = new ServerSocket(MsgDumperCmnDef.SERVE...
7edef268-c469-49ed-8dcd-a3489571076f
4
@Override public boolean join(String n) { boolean accepted = false; try { m_connectionSocket = new Socket(K.ADDRESS_TCP, K.TCP_SERVER_PORT); ObjectOutputStream os = new ObjectOutputStream( m_connectionSocket.getOutputStream()); // Sending join message to the server ... Join join = new Join(n); ...
c2df557a-5f25-4724-9c25-36f9273f5514
7
public static void driveStraightGyro(double power) { double leftMod = 1.0; double rightMod = 1.0; if (!newGyroReadingDriveStraight) { initGyro = gyro.getAngle(); newGyroReadingDriveStraight = true; } if (power < 0) { if ((gyro.get...
355a773d-1b7f-4757-8e2d-4c8ab747d122
1
public CycLeaseManager(final CycAccess cycAccess) { //// Preconditions if (cycAccess == null) { throw new InvalidParameterException("cycAccess must not be null"); } logger = Logger.getLogger("org.opencyc.api.CycLeaseManager"); this.cycAccess = cycAccess; }
3b22f920-45ad-42a6-a235-7b36168d858c
8
@Override public void close() throws IOException { if(os != null){ try{ os.flush(); os.close(); os = null; } catch (IOException e ){ e.printStackTrace(); } } if(fs != null){ try{ fs.close(); fs = null; } catch (IOException e ){ e.printStackTrace();...
5fee38e5-d687-4d13-ad0a-0ecc929928c6
0
public void setProducto(Producto producto) { this.producto = producto; }
4b1514f3-3800-4a6c-8b1e-d668aaa0436c
9
public DoubleVectorIndividual createIndividual( final EvolutionState state, int subpop, int index, int thread ) { Individual[] inds = state.population.subpops[subpop].individuals; DoubleVectorIndividual v = (DoubleVectorIndividual)(inds[index].clone()); do ...
60fe071c-2496-4bc5-8d03-f971ede9faf7
0
protected PropertySearchResults(PropertyTree firstNode) { results=new ArrayList<Result>(1); // size 1; guessing there will not be any conflicting values results.add(new Result(firstNode)); sorted=true; totalNodes=1; }
7edefc80-b392-4c51-83cb-4dffc469ec5c
1
public void visit_lxor(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
dbe05a3d-caa8-4322-bd75-8fb7d1137517
9
public SimpleProperty(Class clazz, String name) { this.name = name; Class[] readParams = {}; readMethod = Reflection.getMethod(clazz, "get" + name, readParams); if (readMethod == null) { readMethod = Reflection.getMethod(clazz, "is" + name, readParams); } if...
c93d5ee6-c824-4af7-a825-367aa3742796
3
public int getNumberOfFreeCells(){ int sum=0; for(int i=0;i<getX();i++){ for(int u=0;u<getY();u++){ if(this.cells[i][u]==0){ sum++; } } } return sum; }
5d9dad51-29c5-4575-8cc9-ad79851d17fd
7
public ConstructorWrapper findByArgumentTypes(Class<?>... types) { for (ConstructorWrapper wrapper : this.constructorWrappers) { List<ParameterWrapper> parameters = wrapper.parameters(); if (parameters.size() == types.length) { boolean valid = true; for (int i = 0, max = parameters.size(); i < max && va...
830e0cdb-029f-4267-ad62-90abb6b20b4a
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int testCases = Integer.parseInt(in.readLine().trim()); for (int t = 0; t < testCases; t++) { int[] nm = readInts(in.readLine()); i...
4449e273-9444-42e1-bb50-31f40c2f8307
8
private void mrXMoveLog() { URL busIcon = this.getClass().getResource("Bus.png"); URL taxiIcon = this.getClass().getResource("Taxi.png"); URL tubeIcon = this.getClass().getResource("Underground.png"); URL doubleIcon = this.getClass().getResource("DoubleMove.png"); URL secretIcon = this.getClass().getResource...
cdd42018-a46e-41ee-bd26-d17060d3c467
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Product product = (Product) o; return number == product.number && !(name != null ? !name.equals(product.name) : product.name != null); }
c5476614-ba14-429f-818d-9affd307ff26
7
private void setWidth() { float missingWidth = 0; float ascent = 0.0f; float descent = 0.0f; if (fontDescriptor != null) { if (fontDescriptor.getMissingWidth() > 0) { missingWidth = fontDescriptor.getMissingWidth() / 1000f; ascent = fontDescrip...
70f7de31-9335-4e62-a701-c9a39d7deabb
9
public void checkParserState( XmlPullParser xpp, int depth, int type, String name, String text, boolean isEmpty, int attribCount ) throws XmlPullParserException, IOException { assertTrue("line number must be -1 or >= 1 not "+xpp.getLineNumber(), ...
d8aebbe6-8058-4915-85f1-03e2f7a2f631
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
fd48c46c-e08f-47e5-b1b3-65521de8e64e
9
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { final UText shape = (UText) ushape; final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final UFont font = fontConfiguration.getFont(); final Dimension2D dimBack = calculateDimension(St...
ebdad684-5da4-4190-ad4f-2877f34438a4
6
static private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0;...
adb6b3d2-e988-448f-83e6-4b9065a5af65
2
@Test public void testDatabasePool() throws Exception { //test normal operation DataConnectionPool dcp = new DataConnectionPool(1, driver, database, login, password); dcp.getConnectionWrapper().commitAndDiscard(); dcp.getConnectionWrapper().rollbackAndDiscard(); //get several connection wrappers Connecti...
00b6d05b-4a7c-46fe-a410-1d9e39225131
7
public void transform(int form){ // TODO change form based upon input from user if(currentForm!=4){ timeSinceTransform = 0; if(form == 0){ if (fireFormEnabled){ currentForm = 0; fireOrbs = 0; currentFormDuration = fireFormDuration; fireFormEnabled = false; } } else if (form == 1){ if (lightning...
ce4bfab0-a39d-4e65-bf51-841cd35ef74b
9
@Override public String toString() { if (type == NUM) { return "NUM: " + value; } else if (type == CMD) { return "CMD: " + name; } else if (type == UNK) { return "UNK"; } else if (type == EOF) { retur...
fe0fa5da-b658-4938-8906-0c76f1c272ed
7
@Override public void keyTyped(KeyEvent e) { if (consoleInputField != null) { /* User can enter backspaces. */ if (e.getKeyChar() == (char) 8 && consoleInputField.getCmd().length() > 0) { String nev = consoleInputField.getCmd(); ...
44c14c7e-33d1-4ee9-8a10-b9ff98c8226c
0
public static <T> T[] concat(T[] first, T[] second) { T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; }
1affe964-15d0-43f0-b21b-faacfa942250
4
private void checkForRemovedMarkers() { markersToRemove.clear(); for (Node node : pane.getChildren()) { if (node instanceof Marker) { if (getSkinnable().getMarkers().keySet().contains(node)) continue; node.setManaged(false); node.removeEventHan...
b0e20b7b-5a26-4bc6-97e1-19d936b7f6be
8
private boolean r_prelude() { int among_var; int v_1; // repeat, line 36 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 36 ...
e5da042e-f712-473d-a759-fc938aafee0c
3
public int search(String docs) { int N = docs.length(); long docsHash = hash(docs, M); if (docsHash == patternHash) return 0; for (int i = M; i < N; i++) { // remove leading digit docsHash = (docsHash + Q - RM * docs.charAt(i-M) % Q) % Q; // add trailing digit docsHash = (docsHash * R + docs.ch...
c309c5b6-fc1b-43bb-8d26-d330b60e8b93
2
public static void mergeSort(int x[], int y[]) { int z[] = new int[x.length + y.length]; System.out.print("First Array :\t"); for (int i = 0; i < x.length; i++) { System.out.print(x[i] + " "); z[i] = x[i]; } System.out.print("\nSecond Array :\t"); for (int i = x.length, j = 0; i < z.length; i++, j++) ...
7cf10909-c611-4f97-824e-5b82a4f4fb16
3
int opcode(int op) { if (op == IFNULL) return IFNONNULL; else if (op == IFNONNULL) return IFNULL; else { if (((op - IFEQ) & 1) == 0) return op + 1; else return op - 1; ...
6d7fa4bc-3ce5-4f5e-b98f-035574c2c73b
3
public static void main(String[] args) { EdgeWeightedDigraph G = new EdgeWeightedDigraph(new In(args[0])); int s = Integer.parseInt(args[1]); AcyclicSP sp = new AcyclicSP(G, s); for (int t = 0; t < G.V(); t++) { System.out.print(s + " to " + t + " (" + String.format("%.2f", sp.distTo(t)) + ") : "); ...
643d8f0d-d1a9-447c-8aa7-415c2b070c06
6
public void MoonCheck() { CopyOnWriteArrayList<GameObject> objects = state.getMyObjects(); for (int j = 0; j < objects.size(); j++) { for (int i = 0; i < objects.size(); i++) { CollisionResults results = new CollisionResults(); Vector3f opos = objects.get(j).getPosition(); Vector3f odir = objects.g...
9bd6164c-e627-4052-8306-286b26391cb6
7
public void write(int address, int data) { if (this.cache.contains(address)) { this.cache.write(address, data); return; } else { for (int i = 0; i < this.history.length; i++) { if (this.history[i] == address) { // conflict miss int mode = Integer.valueOf(this.cache.getMode(), 2); if (mod...
756ad8e0-ffd0-4028-b325-ae32dbf45b05
4
public static void main(String[] args) { String name = JOptionPane.showInputDialog("Please enter your name"); if (name == null) return; String address = JOptionPane .showInputDialog("Please enter the server address"); if (address == null) return; int port = Integer.parseInt(JOptionPane .showInpu...
dd40aa5c-1965-456e-98ea-347b5f96adb0
2
public void renderEffects(){ for (ArrayList<GameObject> effect: effects) { for (GameObject gameObject : effect) { gameObject.render(); } } }
f3cf1033-aad2-480a-807f-0816783387c5
5
public static void main(String[] args) { /** Hand hand1 = new Rock() ; Hand hand2 = new Paper() ; Hand hand3 = new Scissors() ; System.out.println(hand1 + " beats " + hand1 + "? " + hand1.beats(hand1)) ; System.out.println(hand1 + " beats " + hand2 + "? " + hand1.beats(hand2)) ; Sys...
4d64d898-b9d8-4184-a3d9-f4ee7d7fccdb
0
public static boolean isCglibProxy(Object object) { return SpringClassUtils.isCglibProxyClass(object.getClass()); }
42107d9a-c3dd-49c4-9d43-4d4f6a18039a
2
@Override public void setPlayerToTradeWith(int playerIndex) { receiverIndex = playerIndex; if(receiverIndex > -1 && checkForValidTradeValues()) { getTradeOverlay().setTradeEnabled(true); getTradeOverlay().setStateMessage("Trade!"); } else { getTradeOverlay().setTradeEnabled(false); getTradeOverlay(...
d18c6843-7792-4ad1-ae92-c7d12e5c0f09
5
public void watch( Source source ) { // make sure the source exists: if( source == null ) return; // make sure we aren't already watching this source: if( streamingSources.contains( source ) ) return; ListIterator<Source> iter; ...
8bc3d1ac-201a-4737-8c4b-a5baea63c59e
9
private void setSettings() { this.setBorder(new Border() { @Override public Insets getBorderInsets(Component c) { return new Insets(5, 7, 5, 7); } @Override public boolean isBorderOpaque() { return false; } @Override public void paintBorder(Component c, Graphics g, int x, int y...
ef68d08b-22af-4cbc-bd50-b8da8f449ad9
4
public void printTree(treeNode rootNode, int orderIndex) { if (rootNode != null) { // System.out.println("Printing tree with root:" + rootNode.value); switch (orderIndex) { case 1: { // In-order printTree(rootNode.leftLeaf, orderIndex); System.out.print(' '); System.out.print(rootNode.value); ...
31b5289f-7538-4728-a107-234b5bc6db4a
7
private String readLine() throws IOException { byte[] readBytes = new byte[512]; int readIndex = 0; while (true) { int nextByte = remoteInputStream.read(); if (nextByte == -1) { if (readIndex == 0) { return null; } break; } if (nextByte == 10) { if (!ignoreNextLinefeed) { bre...
ced7283d-172b-4e5d-8e47-3b76e519ed2d
4
public static boolean otherCharactersFound(String s, char[] c){ boolean found = false; for (int i=0; i<s.length(); i++) { found = false; for (int j=0; j<c.length; j++) if (s.charAt(i)== c[j]) found = true; if (!found) return true; } return false; }
ba63a29f-8a58-4563-a844-6aa46912b627
5
public static WordSearch loadFromFile(File file) { WordSearch wordSearch = new WordSearch(); BufferedReader reader; List<Character> chars = new ArrayList<>(); try { reader = new BufferedReader(new FileReader(file)); int character; while ((character = reader.read()) != ':') { char c = (char)...
7c70ad4f-4602-4aae-b57d-3268a1898005
5
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed // TODO add your handling code here: if (v1.size() == 0) { JOptionPane.showMessageDialog(null, "You must enter Author Name to \n save book details"); } else if ((jTextField2.getText().equals(""...
e4279e14-9897-42c3-a0f9-339830454b7c
6
public int getPriority() { switch (getOperatorIndex()) { case 26: case 27: return 500; case 28: case 29: case 30: case 31: return 550; } throw new RuntimeException("Illegal operator"); }
97bd42f9-ca7c-4beb-b756-906bbbc59b18
7
public static final SocksImplementation getImplementation( final ConfigurationFacade configurationFacade, final Socket socket) throws IOException, AccessDeniedException, ProtocolException { final InputStream inputStream = socket.getInputStream(); final int protocol = inputStream.read(); switch (protocol) ...
9bad0867-a1a9-450a-b1c7-63d03e585e86
4
private void userSave (ArrayList < String > command) { String filename=null; if (command.size()>1) { filename=command.get(1); try { BufferedWriter bw=new BufferedWriter(new FileWriter(command.get(1))); for (int i=0; i<moveHistory.size(); i++) { bw.write(moveHistory.get(i)+" "); } bw...
4510cb9c-ac6c-410d-ae16-53f90e263314
4
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == inputText) { if(inputText.getText().trim().equals("")) { resetInputField(); return;} /** Look for it every time, if it's not there he's probably offline. */ NetworkSharedUser sendTo = Users.getUserById(targetUserId); if(sendTo == ...
bf32b9f9-c34d-4ea6-bbda-e2d8a96a42f1
7
public void loadConfigBoard() { try { FileReader reader = new FileReader(boardConfigFile); Scanner in = new Scanner(reader); while (in.hasNext()) { String input = in.nextLine(); String[] tokens = input.split(","); if (input.length() < 1) { throw new BadConfigFormatException("Error with boa...
082769ef-8948-47c8-9f15-2f9a51d49fea
8
public static Cons removeVariableTypePropositions(Proposition proposition) { { Keyword testValue000 = proposition.kind; if (testValue000 == Logic.KWD_AND) { { Cons typedeclarations = Stella.NIL; Proposition goalproposition = null; { Stella_Object arg = null; Vector ve...
bb633375-387e-44ab-b019-ee43aa3e6d6c
8
public static Vector2D<Integer> getCrossVector(Vector2D<Float> orig, Vector2D<Float> dest) { int crossX = 0; if (orig.getX().floatValue() < 0f && dest.getX().floatValue() >= 0) { crossX = 1; } else if (orig.getX().floatValue() >= 0f && dest.getX().floatValue() < 0) { crossX = -1; } int crossY = 0...
f4d0ac7b-ee20-425f-868d-b2e8fd9f726d
9
private void extend(Object component, Object lead, Object row, boolean recursive) { Object anchor = get(component, ":anchor"); if (anchor == null) { set(component, ":anchor", anchor = lead); } char select = 'n'; boolean changed = false; for (Object item = get(component, ":comp"); // anchor - row ite...
0ca40f25-874a-4e27-83c9-599b59df669c
8
final public void Function_statement() throws ParseException { /*@bgen(jjtree) Function_statement */ SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_STATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Function_call_...
f6f5d8b7-01ff-406e-bd49-46e68ea4155d
8
public static boolean computeCell(boolean[][] world, int col, int row) { // liveCell is true if the cell at position (col,row) in world is live boolean liveCell = getCell(world, col, row); // neighbours is the number of live neighbours to cell (col,row) int neighbours = countNeighbours(world, col...
51792d0b-eb2e-4794-b6ed-861fa374e434
3
public ExtGState getExtGState(String namedReference) { ExtGState gsState = null; if (extGStates != null) { Object attribute = library.getObject(extGStates, namedReference); if (attribute instanceof Hashtable) { gsState = new ExtGState(library, (Hashtable) attribut...
cd774338-39da-4081-b1b7-bd8ae64aa60d
4
protected void loadConfig() { // Read config file if (verbose) // Timer.showStdErr("Reading configuration file '" + configFile + "'" // + ((genomeVer != null) && (!genomeVer.isEmpty()) ? ". Genome: '" + genomeVer + "'" : "") // ); config = new Config(genomeVer, configFile, dataDir); // Read configurati...
4a3837fe-a9b5-4c0d-b5e7-4135333bc950
4
private Node find(Node node, String string) throws KeyNotFoundException { int index = 0; while (index < string.length()) { if (node == null) throw new KeyNotFoundException(); int cmp = node.ch.compareTo(string.charAt(index)); if (cmp < 0) node = node.right; ...
8ad2b057-ccb5-4abe-825b-5eecb40df631
2
@Override public void onHitByBullet(final HitByBulletEvent e) { // TODO check if this is needed if(lastState != null) { lastState.update(e); } if (doMove) { move.onHitByBullet(e); } }
94d6a4ba-8c0c-47f2-b5eb-92fb3013ca7e
0
private void log(String text) { textArea.append(text + "\n"); textArea.setCaretPosition(textArea.getDocument().getLength() - 1); }
8407c10d-bfa4-4952-b511-c2b319f6b741
7
public void run() { String theMsg = null; ITupleSpaceConnectorListener theListener = null; while (isRunning) { synchronized(messages) { if (messages.isEmpty()) { theMsg = null; theListener = null; try { messages.wait(); } catch (Exception e) {} } else if (isRunning ...
07ba296f-b10f-4e93-b974-380ad179ade1
5
public void render(Graphics2D g2d) { for (int row = rowOffset; row < rowOffset + numRowsToDraw; row++) { if (row >= rows) break; for (int col = colOffset; col < colOffset + numColsToDraw; col++) { if (col >= cols) break; if (map[row][col] == 0) continue; ...
c42d0a9d-f4f5-4045-9a83-763365498144
1
public FrequencyGen(Pair<Integer, Gen<T>> ... generatorPairs) { this.generatorPairs = generatorPairs; this.size = 0; for (int i = 0; i < generatorPairs.length; ++i) { this.size += generatorPairs[i].fst(); } }
27c329d4-9d54-42da-829b-4eb4d51d1c71
5
private final void setMinimumComponentBounds() { for (int i = 0; i < getTComponents().size(); i++) { TComponent c = getTComponents().get(i); if (resizeComponentArray.get(i)) if (isVertical) { if (c.getHeightD() > smallestComponentHeight) smallestComponentHeight...