method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9fcd3c1e-f1a7-41aa-98d3-fe9f0e3670e7
5
private void maxHearp(int [] lista,int hearpSize, int posicion){ int valorMayor=0; int left=2*posicion; int right=2*posicion+1; if(left<=hearpSize && lista[left]>lista[posicion]){ valorMayor=left; }else{ valorMayor=posicion; } if(right<=hearpSize && lista[right]>lista[valorMayor]){ valorMayor=rig...
7d784135-2b9a-499a-8b8a-83bae73663a5
4
public static Document processSync(URL pipelineUrl, InputStream docStream) throws EnrycherException { try { HttpURLConnection connection = (HttpURLConnection)pipelineUrl.openConnection(); connection.setRequestMethod("POST"); connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); ...
cff60335-d7ff-4816-a62c-037c9b28744d
5
private Map<Enchantment, Integer> getEnchantUp(AnvilInventory ai) { Map<Enchantment, Integer> tmp1 = new HashMap<>(); Map<Enchantment, Integer> tmp2 = new HashMap<>(); for(ItemStack i: ai.getContents()) { if(tmp1.isEmpty()) { tmp1 = i.getEnchantments(); ...
8e556eda-05a9-4682-9ddb-155fc27bb76a
7
public int getHorizontal(int i, int j, int r) { int sum = 0; int imax = this.length; int jmax = this.width; for (int n = 0; n <= 2 * r; n++) { int ii = topo.idI(i, j - r + n, imax, jmax); int jj = topo.idJ(i, j - r + n, imax, jmax); if ( (!(ii < 0) && !(ii >= imax)) && (!(jj < 0) && !(jj >= jmax)) && (...
fa22136e-0130-4cb4-ba7d-e785ef69fedf
7
public static void domNodeToTree(Node domNode, TreeDomNode parentTreeNode, boolean displayNodeValue) { if(domNode instanceof Text) return; TreeDomNode treeNode = new TreeDomNode(domNode, displayNodeValue); parentTreeNode.add(treeNode); NamedNodeMap attributeNodes = domNode.getAttributes(); if((attributeNo...
260ded29-ae14-4e7c-ae73-013e0a31e104
9
@Override public void startElement(@NotNull String uri, @NotNull String localName, @NotNull String name, @NotNull Attributes attributes) throws SAXException { if (name.equals("logentry")) { revision = attributes.getValue("revision"); revisionBefore = previous(revision); ...
cd0ee106-a0a0-493d-ae85-72be2a12d81a
9
public void makeInNodes() { int maxNumPrecedences = 0; for(int i=0; i<topologicalArray.size(); i++) { //Se nella posizione restituita da topologicalArray.get(i).get(0)-1 //(num. attività - 1) di dataActArray sono presenti precedenze //allora le inserisco in i...
1b5a6266-602c-49a3-9ea9-04013eed23e9
1
public void pageReSearchAction(boolean isCanChangeStatusLine) { vermilionCascadeNotebook.getEditor().setFocus(); String editorText = vermilionCascadeNotebook.getEditor().getText(); lastSearchingPosition = vermilionCascadeNotebook.getEditor().getCaretPosition() - 1; if (isCaseSensitive) { lastSearchingPosi...
5098ec67-1aed-4f02-a6a2-fbcdc1c16148
2
private Document getDocument() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(false); DocumentBuilder builder; Document doc = null; try { factory.setFeature("http://apache.org/xml/features/continue-after-fatal-error", true); builder = factory.newDocum...
502094de-013b-4a08-b85f-ed6f77b2fe40
4
@Override public String toString() { String probabilityS = (probability != Double.NEGATIVE_INFINITY) ? "probability=\"" + probability + "\"" : ""; String result = "\n\t\t\t\t\t<frame name=\"" + StringEscapeUtils.escapeXml(name) + "\" id=\"" + id + "\" " + probabilityS + ">"; result += "\n\t\t\t\t\t\t<target lemm...
b9a7038b-006f-4877-b557-aaf2632e69f2
3
public void run() { while(isRefreshing) { if(!options.isRefresh()) { System.out.println("BREAK!"); isRefreshing = false; refreshView(); } fps = (new Date()).getTime() - lastRefresh.getTime(); refreshView(); lastRefresh = new Date(); try { Thread.sleep(options.getRefreshDel...
580db965-5c23-4b7b-be62-65f9c9ade838
0
public String getParameterType() { return this.parameterType; }
3e4e3a6d-901b-4ac8-890e-6f60e4c1d55b
9
void format(){ boolean isNotFormatted = true; while(isNotFormatted){ if(times[SECOND] >= 60){ times[SECOND] -= 60; times[MINUTE] += 1; } if(times[MINUTE] >= 60){ times[MINUTE] -= 60; times[HOUR] += 1; } if(times[SECOND] < 0 && Math.abs(times[SECOND]) >= 60){ times[SECOND] += 60; ...
f7ca8d8d-41c3-4b93-844f-37587d0118a6
4
@Override public void draw(SpriteBatch batch, float parentAlpha) { if (MyStage.isCameraView(stage, x, y)) { update(Gdx.graphics.getDeltaTime()); if (isDead) { batch.draw(deadTexture, x - 32, y - 32, originX, originY, width, height, 1, 1, rotation); } else ...
e7a5895d-6147-4f5c-957c-c439b3c0371a
1
private static boolean biggerThanT2D(int n, int[][] a){ return n>a[2][0] && n>a[3][0]; }
d8d33f20-9e99-4b6c-b247-36f086d9a07c
5
public void register(Object obj) { for (Method method : obj.getClass().getMethods()) { Command command = method.getAnnotation(Command.class); if (command != null) { String name = command.value().isEmpty() ? method.getName() : command.value(); name = name.startsWith("!") ? name : "!" + name; if (comm...
2d19d191-e45c-4cbc-9969-a3a9214141e7
8
@Override protected void modifyPom(final Model projectModel, final Object... parameters) throws Exception { if (isEmpty(limit)) { throw new Exception("La limite des numéros est nul !!"); } if (parameters == null || parameters.length == 0) { return; } f...
7ddd7dc5-0be6-4a7d-b002-df47f1ac06d0
3
public void run() { try { if(StatsSyncher.func_27422_a(this.syncher) != null) { StatsSyncher.func_27412_a(this.syncher, StatsSyncher.func_27422_a(this.syncher), StatsSyncher.func_27423_b(this.syncher), StatsSyncher.func_27411_c(this.syncher), StatsSyncher.func_27413_d(this.syncher)); ...
acd69499-30cd-44fc-a876-aefa9010e566
2
@Override public void parse(CommandInvocation invocation, List<ParsedParameter> params, List<Parameter> suggestions) { String token = invocation.consume(1); for (String key : getFixedValues()) { if (key.equalsIgnoreCase(token)) { params.add(ParsedP...
fa62adca-ed2b-4d2e-94e1-ccb9d495afe8
7
static final public Type type() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VOID: jj_consume_token(VOID); {if (true) return Type.voidType;} break; case INT: jj_consume_token(INT); {if (true) return Type.intType;} break; case BOOL: jj_con...
c6854796-ca6e-4e12-82d9-0fc480701f4c
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TabelProdDivisi other = (TabelProdDivisi) obj; if (!Objects.equals(this.divisiId, other.divisiId)) { ...
37b8169c-5bd9-49b7-9fe8-be02f0db6ef7
3
public void start() { if (active != null){ // execute possibly pending setCurrent Displayable d = Display.getDisplay(active).getCurrent(); if(d != null){ Display.getDisplay(active).setCurrent(d); } try{ ...
2f62cdfb-8804-40ec-8e6f-face402793d6
5
public static String[] getValidResolutions() { String[] str; ArrayList<String> strings = new ArrayList<String>(); GraphicsEnvironment gc = GraphicsEnvironment .getLocalGraphicsEnvironment(); DisplayMode[] displayModes = gc.getDefaultScreenDevice().getDisplayModes(); int sizeX = gc.getDefaultScreenDevice()...
cfef8036-0cfe-4d00-96cf-486f435ced9c
0
protected void setPropertiy(String key, String value) { properties.put(key, value); }
5304dafd-fcf3-477f-be6e-e2af52e70078
8
public static LuaValue freaduntil(File f, boolean lineonly) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int c; try { if (lineonly) { loop: while ((c = f.read()) > 0) { switch (c) { case '\r': break; case '\n': break loop; default: bao...
e6e8c507-024f-4e98-a0cc-36ef37f083da
8
final boolean method2378(int i) { anInt8740++; if (i != 0) ((Entity) this).aShort8747 = (short) -75; for (int i_0_ = ((Entity) this).aShort8743; i_0_ <= ((Entity) this).aShort8751; i_0_++) { for (int i_1_ = ((Entity) this).aShort8750; ((((Entity) this).aShort8747 ^ 0xffffffff) <= (i_1_ ^ 0xfff...
0fe9599f-1c50-424e-88da-a2a4065115c3
1
private void addToPLButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addToPLButtonActionPerformed //Get selected songs int[] songs = titlesList.getSelectedIndices(); //Add each song by index to playlist for(int i : songs){ currentList.addSongT...
b5cbe543-fb6a-4833-8013-a762f9106a21
5
private void save() { boolean newInterface = isLocaleModified() || isFontModified(); Utils.config.writeVar(Configuration.AUTOCOMPLETION, String.valueOf(this.autoCompletionCheck.isSelected())); Utils.config.writeVar(Configuration.DEVMODE, String.valueOf(this.devModeCheck.isSelected())); Utils.config.writeVar(Co...
e1e06afb-e0bb-4b22-8b50-67d31c69f250
0
public Field getField() { return field; }
77243415-d99e-4d20-bc35-50b3b47be175
6
public UserDetailsView() { setBounds(100, 100, 534, 280); Toolkit toolkt = Toolkit.getDefaultToolkit(); Dimension screenSize = toolkt.getScreenSize(); this.setLocation(screenSize.width / 4, screenSize.height / 4); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentP...
23cd15f3-1ff2-428f-8b8e-a3f138e9298e
1
public void fillObject(Client client, ResultSet result) { //Заполняем данные о клиенте try { client.setId(result.getInt("ID")); client.setFio(result.getString("CLIENTFIO")); client.setAddress(result.getString("CLIENTADR")); client.setPassport(result.getStr...
e443f299-4884-4816-b6a6-96c3443960f8
1
public void testPrint_bufferMethods() throws Exception { DateTime dt = new DateTime(2004, 6, 9, 10, 20, 30, 40, UTC); StringBuffer buf = new StringBuffer(); f.printTo(buf, dt); assertEquals("Wed 2004-06-09T10:20:30Z", buf.toString()); buf = new StringBuffer(); f....
4be4a772-68e0-4361-baf8-ca57b73c8aef
6
public Wall(int x, int y, int width, int height){ this.setX_Point(x); this.setY_Point(y); this.setWidth(width); this.setHeight(height); ant= (int) ((KarpfenGame.HEIGHT-getY_Point())/30); img= new Image[ant]; for(int i=0;i<ant;i++){ Random rand = new Random(); int num= rand.nextInt(5)+1; if(...
adb9ae67-d408-4b0a-97c7-bcc29ac2303d
2
private void isGreaterThanDate(Date param, Object value) { if (value instanceof Date) { if (!param.after((Date) value)) { throw new IllegalStateException("Given Date does not lie after the supplied date."); } } else { throw new IllegalArgumentException(); } }
6873f48f-d7b7-407e-a170-017f2d30bfc6
7
public static LinkedList<Move> solve(int[][] board) throws NoMoveException { boolean[][] localUsedBoard = new boolean[8][8]; //List of moves to return LinkedList<Move> localMoves = new LinkedList<Move>(); LinkedList<Move> moves = new LinkedList<Move>(); //Right and down moves ...
b10a1334-f495-47bf-9e90-a405a18282d1
2
synchronized public void entrerVoie(Train train){ if(voiesDispo == 0) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } voiesDispo--; synchronized(TestGare.getMonServeurBilletterie()) { ...
2f2d1029-bdb2-4821-a666-f8e3dda26591
1
public <C extends StatefulContext> void callOnFinalState(StateEnum state, C context) throws Exception { Handler h = handlers.get(new HandlerType(EventType.FINAL_STATE, null, null)); if (h != null) { StateHandler<C> contextHandler = (StateHandler<C>) h; contextHandler.call(state, ...
5356d77c-80b7-4caa-a535-4368c7ae9463
4
private void acao135() throws SemanticError { if (idAtual instanceof IdentificadorVariavel) { if (idAtual instanceof IdentificadorVariavelCadeia) tipoVariavelIndexada = Tipo.CADEIA; else if (idAtual instanceof IdentificadorVariavelVetor) tipoVariavelIndexada = Tipo.VETOR; else throw new SemanticE...
284c8560-cef4-4f54-9fa7-5b77440f0461
6
public SmartResponder(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) { serviceRequest = httpservletrequest; serviceResponse = httpservletresponse; userRequest = httpservletrequest.getParameter("text"); userid = httpservletrequest.getParameter("userid"...
689a757b-e530-4a5a-a6cd-fceb623881ca
0
@Override public void addClientDisconnectEventListener(DisconnectListener listener) { disconnectEventListenerList.add(DisconnectListener.class, listener); }
ea773307-bf57-4dee-b665-9df5eeb7368f
0
public boolean getDirFilterExcludeIgnoreCase() { return this.dirFilterExcludeIgnoreCase; }
c2c450e6-e969-45da-a58c-ce06d3485609
5
@Test public void testPropertiesURL() { String[] testPropsAFF = {"duration", "title", "author", "album", "date", "comment", "copyright", "ogg.bitrate.min", "ogg.bitrate.nominal", "ogg.bitrate.max"}; String[] testPropsAF = {"vbr", "bitrate"}; try { URL url = new URL(fi...
3646f242-eab3-439e-bab2-db7c6023ae7f
7
public Piece getPiece(Position p){ boolean returnPiece; if(exclude.size() == 2 && exclude.get(1).equals(p)){ System.out.println("ofEight"); return ofEight; } for (Piece pi : pieces) { returnPiece = true; if(pi.position().equals(p)){ if(exclude.size() > 1){ if(exclude.get(0).equals(p)){ ...
aab26cd1-9864-4235-9843-434b3ac4ab53
4
@Override public boolean equals(Object other) { if (other instanceof Color) { Color o = (Color) other; return ((o.r == r) && (o.g == g) && (o.b == b) && (o.a == a)); } return false; }
e8404e44-3461-4675-8d8e-a311636b923e
4
@Override public int compareTo(AStarSearchNode o) { if(this.f < o.getF()){ return -1; }else if(this.f > o.getF()){ return 1; }else{ if(this.state.id < o.getState().id){ return -1; }else if(this.state.id > o.getState().id){ return 1; }else{ return 0; } } }
d1140185-408e-4479-913a-7d5d6a6d5e05
6
public void setNodeView(CyNode node, CyNetwork network, String type) { Collection<CyNetworkView> networkViewCollection = new HashSet<CyNetworkView>(); networkViewCollection = cyNetworkViewManager.getNetworkViews(network); CyNetworkView networkView = networkViewCollection.iterator().next(); View<CyNode> nodeVie...
f3ff9067-78e5-42b7-812c-934f227477b3
6
void resetEditors (boolean tab) { TableItem oldItem = comboEditor.getItem (); if (oldItem != null) { int row = table.indexOf (oldItem); /* Make sure user has entered valid data */ try { new String(nameText.getText()); } catch (NumberFormatException e) { nameText.setText(oldItem.getText(NAME_...
4f3fffe9-c9ba-4bf9-a254-03cc7522b912
2
public Music(byte[] buf) { try { seq = javax.sound.midi.MidiSystem .getSequence(new ByteArrayInputStream(buf)); } catch (javax.sound.midi.InvalidMidiDataException e) { throw (new LoadException("Invalid MIDI data", Resource.this)); } catch (IOException e) { throw (new LoadException(e, Resource...
7efe2cab-7165-4208-8a0b-13865e9f0c30
4
@SuppressWarnings("unchecked") public int deleteTag(String filename, String tagType, String tagValue) { int count = 0; Iterator it = GuiView.control.getCurrentUser().getAlbumList().entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Album> pairs = (Map.Entry<String, Album>) it.next(); if (pairs...
b2dbe738-f6b3-47e5-a555-39ffb26e4aa0
9
private Node<T> splay(Node<T> root, String relationship) { //if supplied node is already root node if(relationship==""){ return root; } // if the supplied node is either direct left or direct right child of the root if(relationship.length()==1){ //fetch ...
d0e6c3c9-5a46-42ae-ae9a-d066aa3f35e0
3
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); Campaign camp = (Campaign) session.get("campa"); CampaignDevice campdev = new CampaignDevice(camp, getPlatform()); getMyDao().getDbsession().sa...
db0bd3d1-9f22-44cf-95bd-9d5a531520aa
6
@Override public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (!(value instanceof ConsoleEntry)) { return new JLabel(); } ConsoleEntry ce = (ConsoleEntry) value; JTextArea jta = new JTextArea(ce.formatted); jta...
79ce7ab7-bdd2-4e96-89cb-22859c44ad11
5
* if the queue is full */ public void enqueue(E item) throws FullQueueException { if (this.isEmpty()) front = 0; if (this.isFull()) throw new FullQueueException(); else { if (numItems == maxCapacity) { if (rear > front) { array.set(0, item); rear = 0; } else if (rear < fr...
b27db86e-d6bf-43df-92e7-beca69fb6933
5
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_BACK_SPACE) { if (screenName.length() != 0) screenName = screenName.substring(0,screenName.length() -1); } else if ((char) key >= '0' && (char) key <= 'z') screenName += (char) key; else ...
5b65deca-6f96-47b7-bd9a-de7f3c5b90d5
8
public boolean isBlocked(){ byte signe=0, tCaseAutour[]={-8,-9, 1}; if (player == 1) signe = 1; else if (player == 2) signe = -1; for (byte numCase=0 ; numCase<tPlateau.length ; numCase++) { if (tPlateau[numCase] == player){ //pour chaque tortue du joueur byte typeCaseSuiv; for (byte dir : tCaseAutou...
3c508d2b-c177-4a3a-9705-4156e94fae55
2
public void writeMatColByCol(Matrix[] pictureMat, int gopSize, int frameSize, boolean codeCbCr) { int frameSizeC = frameSize >> 2; for (int frameNo = 0; frameNo < gopSize; frameNo++) { writePlaneColByCol(pictureMat[0].getArray(), oneLineY, frameNo * frameSize, frameSize); if (codeCbCr) { wri...
b9bcc9e3-b519-4d0c-a674-e54b8a68747b
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Birthday other = (Birthday) obj; if (date == null) { if (other.date != null) return false; } else if (!date.equals(other.date)) retur...
bf86e8a0-ad4a-42fa-bbf2-79cfca516bfa
8
private static Configuration loadConfiguration(String configurationFilename) { Configuration configuration = new Configuration(); String dictionaryVersion = ""; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); File c...
784ba8b5-bc0c-499c-b832-4fd5b8cc157b
2
public boolean deletePatient(PatientDL patient){ if (this.nextPatient == null){ return false; } else if (this.nextPatient.name.equals(patient.name)){ this.nextPatient = nextPatient.nextPatient; this.lastPatient = lastPatient.lastPatient; return true; } else { return this.nextPatient...
bf53665a-e6bd-4d26-8ace-0fa3986423b8
5
public double checkScore(Alignment ali) { int score = 0; for (int i = ali.startOfAlignment; i < ali.endOfAlignment; i++) { if (ali.aliSeq1.charAt(i) == '-') { score += gapOpen + gapExtend; i++; while (ali.aliSeq1.charAt(i) == '-') { score += gapExtend; i++; } } else if (ali.aliSeq...
312a3f39-cdab-4b7b-bee4-7849ff8754f9
8
public int getIdxNum() throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; int x = 0; try{ conn=getConnection(); String sql = "select max(idx) from travel"; pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); if(rs.next()){ x = rs.getInt...
4c9e126e-445d-4a82-9c20-6a13dd432ebc
7
public void create_line(int x1, int y1, int x2, int y2, byte rd, byte id, int Width, int Height, int winZoom, byte[][] Map, int[][] VMap, byte[][] PMap, float[][] HMap, int Shape) // From old autorun.lua { if (x1 > x2) { int xc2 = x1; x1 = x2; x2 = xc2; int yc2 = y1; y1 = y2; y2 = yc2; } drawst...
e37d282c-1340-4b3e-8167-13683c34c100
9
public void BSTDelete(Node start, Node root, Node value) { Node parent = new Node(); parent = findParent(root, value, parent); //if the node is a leaf if (value.left == null && value.right == null) { //remove without consequences replace(parent, value, null); ...
368e5bca-ecce-4aad-ad12-c73d37bc3b0c
3
void doReceive(final File file, final boolean resume) { new Thread() { public void run() { BufferedOutputStream foutput = null; Exception exception = null; try { ...
209c668d-1237-4ff2-a8de-78e7a401e346
1
public boolean humanPlaying() { return player1 instanceof PlayerHuman || player2 instanceof PlayerHuman; }
851a514a-0bd0-4d7a-b92d-2db6fec5fc2e
7
private ParsedExpression parseCacheKey(String key) { Assert.notNull(key, "Cache Key must not be null"); Set<String> namedParameters = new HashSet<String>(); ParsedExpression parsedKey = new ParsedExpression(key); char[] keyChars = key.toCharArray(); int namedParameterCount = 0; // int unnamedParameterCoun...
f19dd7a8-639b-4f4c-810a-774735d6ee7e
1
public final String getHumanReadableAddress() { return (isSecure() ? "S:" : "N:") + mAddress.getHostAddress(); }
10f8b426-00c0-4cde-899d-c1851d3d16c8
0
public int getMoney() { return money; }
d94328c1-10f9-4c62-9513-07c6dfef1167
4
@Override public void paintComponent(Graphics g) { // magic used to stop flickering when redrawing for animation later. super.paintComponent(g); setBackground(Color.BLACK); // Strange but we need to cast so we can paint Graphics2D g2 = (Graphics2D) g...
f708ed77-6dde-4ee6-be31-7c0f79b08feb
8
public static void main(String[] args) { BufferedReader br = null; BufferedWriter bw = null; String inputPath = "yourpath/ServiceLaneInput.txt"; String outputPath = "yourpath/ServiceLaneOutput.txt"; String[] vehicle = {"bike", "car", "truck"}; try{ br = new BufferedReader(new FileReader(inputPath)); ...
59226520-7c9a-4e72-9aa5-c0197bd0983a
6
public Expression simplify() { if (!staticFlag) { subExpressions[0] = subExpressions[0].simplify(); subExpressions[0].parent = this; if (subExpressions[0] instanceof ThisOperator) { FieldAnalyzer field = getField(); /* * This should check for isFinal(), but sadly, sometimes jikes * doesn't ...
0ca75c18-6846-4888-9e79-4e784d98ca20
7
@Override public Problem parse(String URL) throws ParserException, InterruptedException { URL = URL.trim(); FilterBean fb = new FilterBean(); fb.setURL(URL); // extract problem name fb.setFilters(new NodeFilter[] { new CssSelectorNodeFilter("hea...
e82afbb2-2bb5-46ca-97dd-53b0eb88572a
4
protected String createInferenceContinuationCommand(InferenceParameters queryProperties) { if (queryProperties == null) { queryProperties = new DefaultInferenceParameters(getCycServer()); } if ((answerProcessingFunction != null) && (!answerProcessingFunction.shouldQuote())) { answerProcessingFun...
2d075bc7-f22f-4511-a85a-169ff3793328
0
public void testGetFileName() { String filepath = "a.bc.txt"; String filename = FileUtils.getFileName(filepath); assertEquals(filename, filepath); filepath = "E:\\IOS\\abc.txt"; filename = FileUtils.getFileName(filepath); assertEquals(filename, "abc.txt"); }
739d6105-d747-48b8-93b2-5e58a9fd8795
1
public HistoryGUI(List<BufferedImage> history, GUI g) { this.g = g; frame = new JFrame(); int width = history.size(); width += (10 - history.size() % 10); // rounds UP to the nearest 10. System.out.println("Width: " + width); /* * Figure out how big to make our window (going to max width before * gett...
4f0e51bd-f1a0-47c0-bad5-2e2f6388fef7
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
83d84eed-ae67-43c5-8082-b299e6569919
6
static void populateMap( List<String> taxaNames, HashMap<String, Holder> map, BufferedReader reader ) throws Exception { for( String s= reader.readLine(); s != null; s= reader.readLine()) { StringTokenizer sToken = new StringTokenizer(s, "\t"); sToken.nextToken(); String sample = sToken.nextToken().repl...
cac7cb90-22b2-4dab-8deb-3ee387a8b2ba
1
public Element getElementHighestPriority(Position pos) { if (getGrid().getElementsOnPosition(pos).size() > 0) return getGrid().getElementsOnPosition(pos).get(0); return null; }
8f1729fe-8171-4425-aaa5-dcdd113a4d2d
5
public static void createCheckOutView() throws Exception{ Connection connect = null; Statement statement = null; ResultSet resultSet = null; try{ // First connect to the database connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); stat...
cfc35fbe-7fbf-4b44-90f4-74bb1908e1da
7
private String identidicarRadioButtons() { if (rbBolsa.isSelected()) { return FormatoProducto.BOLSA.toString(); } else if (rbBote.isSelected()) { return FormatoProducto.BOTE.toString(); } else if (rbCaja.isSelected()) { return FormatoProducto.CAJA.toString(); ...
66f7fdb0-ac7b-4998-a37d-1090c64e55a2
4
public void run(){ //loops indefinitely while(true){ //pauses the automaton try{ while (paused ==true){ Thread.sleep(1);} } catch(InterruptedException ie) {} //main cell logic iterate(); //timeout between grid-wide iterations try{ Thread.sleep(controller.getMaste...
53157b2c-cd9c-40c8-a65b-7bca65887bda
6
@Override public String checkToPrepareQuestion() { String warning = null; if(itemA == null || itemB == null){ warning = "Создайте соответствия!"; } else if(this.getTask().trim().isEmpty()){ warning = "Введите задание!"; } else { for (int i = 0; i <...
07fec420-489c-43c6-a105-b0530c8b4f19
9
private void restrictList(Combination guess, int[] scores) { if(remainingCombos.size() == 0) { for(char[] combo: new ComboMaker(charSet, length)) { try { Combination judge = new Combination(combo, charSet); int[] score = judge.judge(guess.clone()); if(score[0] == scores[0] && score[1] == scores[...
4db37164-0236-49a8-b58e-2f27482e059a
0
public void execute() { System.out.println("Called SecondStrategy.execute()"); }
9cf2efe7-f389-4fa4-97a3-b269bb9bd67f
6
public void run() { String str; boolean more = true; try { while (more) { // wait for next line from server str = sockIn.readLine(); if (str != null) { // parse server message parse(str); } else more = false; } close(); } catch (IOException ioe) { // if the connection ...
d74b176b-d6e8-476d-b32f-14b641ef41da
3
public static JSplitPane createSplit(Environment environment, boolean horizontal, double ratio, Component left, Component right) { JSplitPane split = new JSplitPane( horizontal ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT, true, left, right); Dimension dim = environment.getSize(); Compon...
dfcb2fc2-6e98-49e4-8c4b-548945473155
4
private void preencherTabela() { String[] propriedades = {"Id", "Nome", "Cartão", "Cpf", "Endereço"}; ClienteDAO dao = new ClienteDAO(); List<Cliente> clientes = dao.list(); String[][] matriz = new String[clientes.size()][5]; for (int i = 0; i < clientes.size(); i++) { ...
0021df27-cbf8-4cfe-b899-961fd92a859e
7
public static Colour fromHSB(float hue, float saturation, float brightness) { int r = 0, g = 0, b = 0; if (saturation == 0) { r = g = b = (int) (brightness * 255.0f + 0.5f); } else { float h = (hue - (float) Math.floor(hue)) * 6.0f; float f = h - (float) java.lang.Math.floor(h); float p = brightness *...
af34c6a4-209e-4b8b-bfe9-a5d651dfa05f
2
public void dailyBonus(Player player) { endangered = false; if (color == player.getColor()) { for(CastleBuilding b: buildings) { b.dailyBonus(player, this); } } buyed = false; }
8a1adedf-9976-41c6-bee4-d6a263db7bc1
5
public void gen_assign(SemanticRec id, SemanticRec exp, SemanticRec symbolTable) { SemanticRec result = gen_assign_cast(id, exp); Row leftRow = getIdRowFromSR(id); if (leftRow.getClassification() == Classification.VARIABLE) { SymbolTable leftTable = findSymbolTable(leftRow)...
cdf145ff-84d0-4824-a31d-74450e266e96
1
public GameObject getRootObject() { if ( root == null ) root = new GameObject(); return root; }
de87d2bf-5f1c-42e9-8ec8-160056ed8bfc
1
public void testIsEqual_TOD() { Partial test1 = createHourMinPartial(); Partial test1a = createHourMinPartial(); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqu...
00a4dbcf-5969-46c3-aec7-77d284262a6d
5
@RequestMapping("/read.do") public ModelAndView showInfo(Device device, HttpServletRequest req) throws Exception { ModelAndView mav = new ModelAndView(); String address = null; String keyword = null; // 공연의 정보를 가져오기 위한 공연 code 값 String seq = req.getParameter("seq"); // 맵 정보를 가져오기 위한 공연 장소 값 String mapPla...
3f83ec8f-a884-43dc-8a75-c30d742e27ab
6
@EventHandler public void WitchPoison(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWitchConfig().getDouble("Witch.Poison.Dodg...
42d806a1-2952-4c2b-a900-efcf8e32aa18
7
private String fFormatString(double x) { boolean noDigits=false; char[] ca6,ca7; if (Double.isInfinite(x)) { if (x==Double.POSITIVE_INFINITY) { if (leadingSign) ca6 = "+Inf".toCharArray(); else if (leadingSpace) ca6 = " Inf".toCharArray(); else ca6 = "...
2fa5cef2-091f-43e0-81df-f61c34c2baf5
4
@Override public void handle(HttpExchange exchange) throws IOException { // FinishTurnRequest request = (FinishTurnRequest) translator.translateFrom(exchange.getRequestBody().toString(), FinishTurnRequest.class); // exchange.getRequestBody().close(); // int userID = movesFacade.finishTurn(request); // if(/*request...
d84817ee-1f68-4d9a-bc85-1b7c7334e26d
5
public SystemTrayIcon() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { try { UIManager.setLoo...
2e2b8f9b-f0b8-427f-9b37-a88d9cef6475
8
private void setBorders(Tile tile, Territory t){ int tX = tile.getX(); int tY = tile.getY(); final int MARGIN = 2; // The margin will be added to the borders to ensure there is no overlapping of borders, margin should be equal to painted line width for the border // check northern border if (tY - 1 >= 0) ...
7c216b41-1567-4d94-af99-7a918b3360d8
7
private void resetGL(GraphicsHelper gh) { Vector2f scale = getScale(); if (pos.x != 0 || pos.y != 0) gh.g.translate(pos.x,pos.y); if (scale.x != 1f || scale.y != 1f) gh.g.scale(scale.x,scale.y); if (angle != 0) gh.gl.glRotatef(angle,0f,0f,1f); if (portPos.x != 0 || portPos.y != 0) gh.g.translate(portPos.x,por...
d6fb35ce-de23-465a-8de2-443cbf994376
9
public int[] selectInstalledActivityIdsByWorker ( int workerId ) { Connection con = null; PreparedStatement statement = null; ResultSet rs = null; List<Integer> ids = new ArrayList<Integer>(); try { con = ConnectionManager.getConnection(); String searchQuery = "SELECT activities.id " ...