method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
84c8984f-d0af-4259-8ea0-35efd5f0e91a
2
public boolean put(String key, Integer value){ if(root == null){ LeafNode leaf = new LeafNode(key,value); root = leaf; return true; } else{ InfoNode infoNode = Add(key, value, this.root); if(infoNode != null){ InternalNode node = new InternalNode(); node.size = 1; node.children[0] = ...
c4464006-55ea-4eb5-b0ba-559404863983
1
@Override public void init() throws Exception { if (isInitial()) return; super.init(); //.. addServerStartListener(new ServerStartListener() { @Override public void OnServerStartEvent(ServerStartEvent evt) { fireServerStart(evt); } }); addServerStopListener(new ...
95dcd709-46a3-435f-8f98-84a3545e95f2
6
@Override public String toString() { String rslt = getId() + " " + op + " "; if (target != null) { rslt += target + " "; } else if (lValue != null) { rslt += lValue + " "; } else if (src != null || rValue != null) { throw new IllegalStateException("the src is not null, but the target is null"); } ...
de9a8629-bd9c-44bb-bd50-9c86752fbdd0
0
@Test(expected=IllegalArgumentException.class) public void testInvokeZeroArgMethod_arg() { ReflectUtils.invokeZeroArgMethod(new Bean(), "methodWithArg"); }
9b48db90-52d9-4fe6-b002-5f276c44238f
7
public static void unitsEvaluator(Proposition self) { { Stella_Object magnitude = Logic.valueOf((self.arguments.theArray)[0]); Stella_Object units = Logic.valueOf((self.arguments.theArray)[1]); Stella_Object dimNumber = Logic.valueOf((self.arguments.theArray)[2]); DimNumberLogicWrapper value1 = Un...
38e33618-de4f-4947-80ee-7f7f1f340d58
9
public void mouseMenuInteract() { int mouseX = MouseInfo.getPointerInfo().getLocation().x; int mouseY = MouseInfo.getPointerInfo().getLocation().y; for (int i = 0; i < huds.size(); i++) { Hud hud = huds.get(i); if (mouseX >= hud.getCoords().getX() && mouseY >= hud.getCoord...
99f6f7d1-4b90-4f39-b0e7-7779b31bd539
0
private void action(final String input) { System.out.println(MSG_INACTION+input); String s1, s2; StringTokenizer st = new StringTokenizer(input,","); s1 = st.nextToken(); s2 = st.nextToken(); int res = calcAsciiSum(s1)-calcAsciiSum(s2); System.out.println(res); }
af3fde66-dcec-44e0-b89d-ae847e127c0b
6
private void traverse(File dir, String relativePath) throws IOException { if (mIgnoreDirectories.contains(relativePath)) { // DCI: ok for .git .hg, won't work for .svn sprinkled in every subdir... return; } String[] values = dir.list(); if ...
b728d3be-3d0a-4a23-9135-3a38a73da202
7
public static PythagoreanTriple getInstance(long idx) { if (idx < 0) { throw new IllegalArgumentException( "idx must be zero or positive number"); } if (0 == idx) { return START; } Stack<Integer> stack = new Stack<Integer>(); whi...
3172c68a-110a-4105-bd79-238488bb8982
3
private void paintPlacablePixelPosition(Placeable obj, Graphics2D g2) { if (obj == null) { System.out.println("enemy obj in paintPlacablePixelPosition is null"); } else { int yPos = obj.getPixelPosition().getY(); int xPos = obj.getPixelPosition().getX(); i...
42624308-1cf0-4834-a2d7-c5ac71337071
2
public NMEASentence( String sentence ) throws Exception { rawSentence = sentence; identifier = sentence.substring( 1, 6 ).replaceAll( "-", "" ); //remove identifier sentence = sentence.substring( 7, sentence.length() ); //get checksum, remove from sentence if( sentence.charAt( sentence.length() - 3 ) =...
8a3c76f3-2fb8-4af3-af10-cb5a96a1e83b
8
public boolean sellStocksOrFunds(String accountID, String investSymbol, int type, int numberOfShares) { int dueNumber = numberOfShares; boolean flag = true; Timestamp targetTime, todayTime; int ownNumber, toSell, shortOrLong; double crtPrice, amount, prevPrice, gainOrLoss; Statement s; TransControl ...
5e23f123-43c2-4349-8b39-70ee2a8e6aa7
7
public void fillCell(){ cellfillflag = true; for(int y=0;y<= mainBrain.ysiz-1;y++){ for(int x=0;x<= mainBrain.xsiz-1;x++){ switch(cfo){ case 0: cellDraw(x,y); break; case 1: cellCheckDraw(x,y,false); break; case 2: cellRandDraw(x,y); break; case 3: cellRCDraw(x,y); br...
f61eb592-e264-4b1a-ba17-e5b5e96dbe8f
7
public String longestCommonPrefix(String[] strs) { if (strs.length == 0) { return ""; } int prefixIndex = -1; boolean found = false; while (!found) { boolean first = true; char charAtFirst = 0; ++prefixIndex; for (in...
38fa5f8c-a47a-475a-ae73-65405d848495
3
public void alocarProfessorTurma(String codDisciplina, int numTurma, String matriculaProf) { try { sistemaFrontEnd.alocaProfessorATurma(codDisciplina, numTurma, matriculaProf); front.exibirMsg("Professor alocado com sucesso"); } catch (DisciplinaInexistenteException e) { front.exibirMsg("A discipli...
647085d7-8a37-4ed2-a634-9b5dd6ce403d
5
@Override public double getXRotation() { double lowest = 9001; double highest = 0; int y = 0; if (getRotationAngle() == 180) y = -20; if (getRotationAngle() == 360) y = 20; for (Block block : blockArray) { if (block.getXValue() > highest) highest = block.getXValue(); if (block.getXValue(...
86ebe7c5-a327-4922-8960-b703ea6d0dc1
8
private void rotateLeft(Node<T> currentNode, boolean changeRootOfSubtree) { if (currentNode.getParent() != null) { if (changeRootOfSubtree) { Node<T> oldRoot = currentNode; Node<T> newRoot = currentNode.getRightChild(); newRoot.setParent(oldRoot.getPar...
f278e810-9c67-4c7a-80c6-e87a96d845dd
5
private void initializeChomskyMap(Grammar g) { // //System.out.println("Chomsky = "+g); CNFConverter converter = new CNFConverter(g); Production[] p = g.getProductions(); boolean chomsky = true; for (int i = 0; i < p.length; i++) chomsky &= converter.isChomsky(p[i]); if (!chomsky) { myCNFMap=...
29a11b57-dba5-4109-a06f-d5f2e84b85fe
7
static void quickSort(int[] A, int l, int r){ if(l>=r) return; int pivot = A[l]; int i=l, j=r; while(i<j){ while(A[i]<pivot && i<r) i++; while(A[j]>=pivot && j>l) j--; if(i>=j){ break; } int temp = A[i]; A[i]=A[j]; A[j]=temp; i++; j--; } quickSort(A, l, j); quickSort(A, j+1,...
bb98327b-8c7f-4a53-98ab-c6b85277b771
8
private boolean compareText(PushbackReader source, String text) throws IOException { if (text == null || text.length() == 0) return true; text = adjustTextNL(text); char[] chars = new char[text.length()]; int pos = 0; int n; String readStr = ""; do { n...
5e1f225a-7a08-4614-8d12-d9f66ee431d5
1
@Override public void update(GameContainer gc, StateBasedGame sbg, int Delta) throws SlickException { elapsedTime += Delta; if(elapsedTime >= Delay) { music.stop(); sbg.enterState(Game.menuId); } }
1a9aab54-7e85-4988-af3f-b9aedc2e6f23
4
public static void filledRectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys ...
df5c89e9-cc00-4318-aeab-0625b852db7c
1
public void setNext(IntegerNode n) { if (this.next == null){ this.next = n; } else { this.next.setNext(n); } count++; }
5f7a39ee-f457-4d0f-bbbc-ab560b37d2e9
9
void run(){ Scanner sc = new Scanner(System.in); for(;;){ int n = sc.nextInt(); if(n==0)break; int[] s = new int[1000], in = new int[1000]; boolean[] f = new boolean[1000]; while(n--!=0){ sc.next(); String[] t = sc.next().split(":"); int time = Integer.parseInt(t[0])*60+Integer.parseInt(t...
e408d050-7ade-4c65-bad9-066acb1cf657
3
public void setItemDeletionPercentage(double perCent){ this.itemDeletionPercentage = perCent; this.itemDeletionPercentageSet = true; if(this.personDeletionPercentageSet && this.replacementOptionSet){ this.allNoResponseOptionsSet = true; if(this.dataEntered){ ...
c37f63d3-5fce-46d7-a1b5-287148abe439
5
@Override public void handleMessage(String msg) { int id = 0; try { id = Integer.parseInt(mID); } catch ( NumberFormatException nfe ) { ; } if ( id>0 && id==LANWebcam.sIdentifier ) { mWebcam.takePictures(1); List<BufferedImage> imgs = mWebcam.getImages(); BufferedImage img = imgs....
06ba92b6-230a-4544-8b76-d555a914b72f
7
public static void genRSAKeysText(CryptobyConsole console) { final Scanner scanner = new Scanner(System.in); // Initial Variables int keySize; int choice; String publicKey; String privateKey; // Set Default Key Size keySize = 1024; do { ...
5fb3c7eb-0fe1-4a7e-96ff-19f719a0f934
9
public final int computeCardinality() { final int c1 = operand0.getCardinality(); final int c2 = operand1.getCardinality(); switch (operator) { case Token.UNION: if (Literal.isEmptySequence(operand0)) return c2; if (Literal.isEmptySequence(operand1)) r...
b1d99093-ef14-45ee-8773-c0e39e49eae4
6
public static void unZipIt(String zipFile, String outputFolder){ byte[] buffer = new byte[1024]; try{ //create output directory is not exists File folder = new File(outputFolder); if(!folder.exists()){ folder.mkdir(); } //get the zip file content ZipInputStream zis = new ZipInputStre...
c51c189a-475c-4475-99f9-078f2676c683
5
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String subcommand; // This will take the value of args[0] if it exists if(sender instanceof ConsoleCommandSender) return false; // TO-DO: Handle server commands ...
a3ae6aa2-6855-4bbc-b4fa-f05ff82f7651
2
private static void register(BufferedReader br, ServiceInterface obj, Scanner cs) throws IOException { // TODO Auto-generated method stub String str[] = new String[3]; for (int i = 0; i < 3; i++) { str[i] = br.readLine(); } if(obj.register(str[0], str[1], str[2])){ System.out.println(str[0]+" Regis...
e5d2da65-3874-4005-8a13-69d01ba09360
6
public static void releaseProcess(Process p) { Exception ex = null; if ( p != null) { try { p.getInputStream().close(); } catch ( Exception iex) { iex.printStackTrace(); } try { p.getOutputStream().close(); } catch ( Exception oex) {oex.printStackTrace(); } try { p.g...
29fb9a1d-bd84-4867-9dc8-141f20537b64
9
public static HashMap<String, String> search(String title, String kind, String productionYear) { HashMap<String, String> infoMap = new HashMap<String, String>(); infoMap.put("title", new String(title)); infoMap.put("kind", new String(kind)); try { String infoData[] = { "plot", "runtimes", "genres", ...
410f22f7-9672-44dc-a83d-0bd228261e1a
1
public void dump(FileOutputStream out) throws Exception { out.write(packet_tag & 0xff); out.write(packet_length & 0xff); out.write(version & 0xff); for (int i : key_id) out.write(i & 0xff); out.write(PKA_id & 0xff); base.dump(out); encr_key.dump(out); ...
cd44eeec-c410-4bf5-8181-5235edf59952
1
@Test public void additionWithRounding() { final PrecisionLab lab = LAB_FACTORY.createPrecisionLab(2); final DecimalImpl addition = DecimalImpl.valueOf("0.011"); // Precision says two digits after the comma for AUDUSD on 4W final RoundingContext context = new SampleRoundingContext("AUDUSD", "4W", null); final ...
d1ac26a0-ffb1-4f75-b353-bd2a8e08e8ae
4
@Override protected void recalculateAvgs() { innerSum[0] = innerSum[1] = innerSum[2] = outerSum[0] = outerSum[1] = outerSum[2] = innerSize = outerSize = 0; for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { if (getValue(x, y) == 3) { addToOuter(x, y); } else ...
83dbe009-a415-4608-84e2-fe38a5f101e8
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
f4d15103-3977-412d-99e2-9de83e245492
4
public boolean deletePlayers(String wName) { boolean done = true; File playerDat = new File(Bukkit.getWorldContainer().getPath() + wName + File.separator + "players" + File.separator); File[] files = playerDat.listFiles(); for (File file : files) { int i = file.getName().lastIndexOf('.'); if (((i > 0) ...
88a6b6b6-53c6-412a-9114-944195d16825
2
@Override public boolean equals(Object obj) { if (obj == this) { return true; } return obj instanceof WeightValue && super.equals(obj); }
61193f42-bdbc-4f3d-8481-0139908294de
6
@Override public ContextGraph add(GraphComponent component) { if((component instanceof NodeP) && ((NodeP) component).isGeneric()) throw new IllegalArgumentException("Generic nodes are not allowed"); if((component instanceof Node) && ((Node) component).getLabel().startsWith(NodeP.NODEP_LABEL)) throw new Ille...
cffafb89-0297-4a18-86b8-559708d9d878
6
public VertexLocation getNormalizedLocation() { // Return location that has direction NW or NE switch (dir) { case NorthWest: case NorthEast: return this; case West: return new VertexLocation( hexLoc.getNeighborLoc(EdgeDirection.SouthWest), VertexDirection.NorthEast...
cb893fcb-033c-4183-a090-1b65f2f6480f
9
static final void method1982(int i) { try { anInt9372++; if (i != 0) { method1982(-44); } for (Node_Sub3 node_sub3 = (Node_Sub3) Class56.aHashTable839.method1516(false); node_sub3 != null; node_sub3 = (Node_Sub3) Class56.aHashTable839.method1520(106)) { if (node_sub3.aClass189_Sub1_6943.method1920...
b916fa19-3170-4f1a-afc3-040466a039ea
8
@Override public void mouseReleased(MouseEvent e) { Point p = e.getPoint(); int size = display.frame.getHeight() / 12; int xOff = (display.frame.getWidth() - size * 9) / 2; int yOff = (display.frame.getHeight() - size * 9) / 4; for(int x = 0; x < 9; x++){ for(int y = 0; y < 9; y++){ Point pos = new Po...
3aa77a06-afa7-4bc7-bb91-cfa93a0e6a52
9
public Object getValueAt(int row, int column) { if (row >= capitalGains.size()) throw new IndexOutOfBoundsException("Report row "+row+" is not valid"); CapitalGainRecord g = capitalGains.get(row); Object value = null; switch (column) { ca...
f4d7f561-3b0f-41b2-aaf2-df0ac6145224
8
public void setFieldNames(String[] newFieldNames) { boolean changed = false; if (_fieldNames == null) changed = true; else if (newFieldNames.length != _fieldNames.length) changed = true; if (newFieldNames.length > _headerRenderers.size()) _headerR...
96fbea15-abe5-4369-a457-e465188d639c
4
public static void checkField(SubField field, int[] listID, int[] stopOnID) { for (int i = 0; i < listID.length; i++) { if (listID[i] == theField[field.x][field.y]) { int[] element = new int[2]; element[0] = field.x; element[1] = field.y; listFields.add(element); } } for (int i = 0; i...
e829b7ba-2917-4b12-b79d-bc51134f6fe4
1
private void preencheTabela(List<Produto> lista){ this.modelo = new DefaultTableModel(); modelo.addColumn("Id"); modelo.addColumn("Nome"); modelo.addColumn("Valor de Compra"); modelo.addColumn("Valor de Venda"); modelo.addColumn("Descrição"); modelo.addCo...
9c0be571-2105-4f21-9345-c8dc4cead352
9
public void menu(){ boolean quitter = false; while(!quitter){ System.out.println("********************************************"); System.out.println("Bienvenue dans le Menu de Saisie interactive"); System.out.println("*******************...
93d3976a-479d-477c-bb3b-ad87b6611178
2
public static void listarMusica(HashMap<Integer, Musica> tablaMusica) { String titulo = null; String formato = null; if (tablaMusica.isEmpty()) // No hay discos en el sistema { System.out.println("No existen discos dados de alta"); } else { Set<Entry<Integer,Musica>> s = tablaMusica.entrySet();...
cb7c50a3-188d-491b-b2f8-ed1a9fba882b
7
public static int[] biInsertSort(int[] data){ int temp=0; int left=0; int right=0; for(int i=1; i<data.length;i++){ left=0; right=i-1; while(left<right){ int mid=(left+right)/2; if(data[mid]>data[i]){ right=mid-1; }else{ left=mid +1; } } temp =data[i]...
df7e6aeb-3651-4d9c-9508-d9160b70898a
3
public IllegalOrphanException(List<String> messages) { super((messages != null && messages.size() > 0 ? messages.get(0) : null)); if (messages == null) { this.messages = new ArrayList<String>(); } else { this.messages = messages; } }
80c6016d-757b-4662-ba28-36686cfd83ed
2
public static int[][] convertDoubleToIntMatrix(double[][] m) { int mRows = m.length; int mColumns = m[0].length; int[][] res = new int[mRows][mColumns]; for (int i = 0; i < mRows; i++) { for (int j = 0; j < mColumns; j++) { res[i][j] = (int) Math.round(m[i][j]); } } return res; }
1b0fd3ce-38d0-4d81-a87a-1893d56fcb96
7
public static Logger fromLevelString(String value) { String lowerCaseValue = value.toLowerCase(); if (lowerCaseValue.equals("notset")) { return Logger.NOTSET; } if (lowerCaseValue.equals("debug")) { return Logger.DEBUG; } if (lowerCaseValue.equals("info")) { return Logger.INFO; } if (lowerCa...
0ec16499-4ddc-4f53-94c2-6800709a042e
7
@Override public void unInvoke() { // undo the affects of this spell if((affected==null)||(!(affected instanceof Item))) return; if(invoker==null) return; final MOB mob=invoker; final Item item=(Item)affected; super.unInvoke(); if(canBeUninvoked()) { if(item.amWearingAt(Wearable.WORN_FLOAT...
6a7f4d9d-cc5f-42c5-a2f8-f2007e86b950
0
public void setDefaults() { setNumberOfPoints(10); setTimeStep(0.5); setTimePeriod(100d); setXMin(1f); setXMax(2f); setYMin(0.05f); setYMax(1f); setAngle(Angle.PSI); setIntegrationMethod(IntegrationMethods.DORMAND_PRINCE_8); setPhi(0.01); ...
dbb4cebf-ee80-427b-8192-1ad7b2a0e661
8
public QRDecomposition(Matrix A) { // Initialize. QR = A.getArrayCopy(); m = A.getRowDimension(); n = A.getColumnDimension(); Rdiag = new double[n]; // Main loop. for (int k = 0; k < n; k++) { // Compute 2-norm of k-th column without under/overflow. double nrm = 0; for (int i = k; i < m; i++) { ...
77e6a981-f7cb-41ad-a82f-cc12e49dfbf8
0
public ConcretePrototype() { System.out.println("具体原型角色!"); }
c8b554d5-5555-4c6c-a50a-590b4011faad
3
public static void main(String[] args) throws Exception { ClassLoader.getSystemClassLoader() .setDefaultAssertionStatus(true); // Enable asserts new ProcessFiles(new AtUnit(), "class").start(args); if(failures == 0) print("OK (" + testsRun + " tests)"); else { print("(" + testsRun + " ...
a332a90b-af36-43d4-9b96-603632316715
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Node other = (Node) obj; if (state == null) { if (other.state != null) return false; } else if (!state.equals(other.state)) return fa...
8a0af7ef-8644-4657-bbae-cdfec9cebc9f
4
@Override public void keyReleased(KeyEvent ke) { /* System.out.println(searchField.getText()); LinkedList tempStudentLinkedList = new LinkedList(); for(int i=0;i<Student.studentListText.size();i++) { Student currentStudent=Student.studentListText.get(i); if(currentStudent.studentName.indexOf(searchFi...
38cb1c50-a7a3-4f7c-851a-0a57b07d078c
9
@SuppressWarnings("static-access") public String process(String commandstring) { this.commandstring = commandstring; if (checkCommand() == false) { return "Invalid command"; } StockGameCommandType commandType = (StockGameCommandType) descriptor .getCommandType(); try { switch (commandType) { ca...
726ab4bc-20dd-4483-960c-6d1dc9635276
1
public void printListForwards() { if (this.next == start) { System.out.println(this.getData()); } else { System.out.println(this.getData()); next.printListForwards(); } }
d481443a-8f0e-457a-8de9-e0b937bdd3a2
1
@Override public int filterRGB(int x, int y, int rgb) { if (rgb == trans) { return 0; } else { return rgb; } }
6a0118bc-c3ff-48b3-a3e3-d99eb426a77e
7
public void close() { final int exitValue; if (closed) { return; } if (!browserConfigurationOptions.is("honorSystemProxy")) { restoreSystemProxy(); } if (process == null) { return; } LOGGER.info("Killing Safari.....
335d8efc-2bdb-4f0d-8a5e-bd31bd0826a8
5
public static Operation getPrefixOperation( String prefix, String argument ) throws ParseException, NullParensException{ //this may need some work for error checking if( "".equals(prefix) ){ throw new NullParensException(); } else if ("sin".equals(prefix)){ return new Sin(argument); } else i...
b02f046a-f1cd-406c-ba2b-c7b6839d3273
7
public void setCurrentValues() { if (link.toLowerCase().startsWith("mailto")) { protocolLabel.setText("MailTo Protocol"); typeLabel.setText("E-mail Address"); } else if (link.toLowerCase().endsWith("jnlp")) { protocolLabel.setText("Java Network Launching Protocol"); typeLabel.setText("JNLP File"); ...
8ee9a45f-3cd1-4798-a2c6-681194cb3503
0
public static void main(String[] args) { MaxIncreasingPathInMatrix maxIncreasingPathInMatrix=new MaxIncreasingPathInMatrix(); int[][] input = { {9, 9, 4}, {6, 6, 8}, {2, 1, 1} }; int[][] input1 = { {3, 4, 5}, ...
bd887f11-af35-41bf-81fb-d0cacc587965
5
public long addPropsect(String json) throws JsonSyntaxException, EntityNotFoundException { Gson gson = new Gson(); ProspectInput pIn = gson.fromJson(json, ProspectInput.class); Entity entity = new Entity(R.Prospect.ENTITY_TYPE); // Set Properties entity.setProperty(R.Prospect.PROFILE, ...
65e9443c-fd38-40af-a1f5-5e9353bafcc3
2
public void jobStatus(int id, JobType jt){ if (runningJobs.containsKey(id)) runningJobs.get(id).startingJob(jt); else if (finishedJobs.containsKey(id)) finishedJobs.get(id).startingJob(jt); }
55fc12f3-7cd3-4917-9f52-a42584ef841f
2
public long getLong(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number)object).longValue() : Long.parseLong((String)object); } catch (Exception e) { throw new JSONException("J...
7ca5c983-b4c7-4259-9398-78cc33a3e443
0
public static void main(String[] args) { HashMap myHashMap = new HashMap(); //MyKey name argument passed is used for equals() and hashCode() MyKey key = new MyKey("Pankaj"); //assume hashCode=1234 myHashMap.put(key, "Value"); // Below code will change the key hashCode() and equals()...
9fef3fa1-3ec2-4002-b117-3749baff0719
5
public synchronized void setRun(int state) throws InvalidArgumentException { if (state == NEW || state == RUNNING || state == CONFIRMED || state == ERROR || state == CLOSED) { this.state = state; } else { throw new InvalidArgumentException("State must equal NEW, RUNNING, CONFIRME...
92d1e269-4918-4701-9ed9-d4cc4765d390
5
public static String Erikoismerkit(char c) { String hex = ""; if (c == '!') { hex = "09"; } else if (c == '.') { hex = "05"; } else if (c == ',') { hex = "01"; } else if (c == '?') { hex = "13"; ...
38ff554e-9127-43cb-89ec-04fb2efd8525
9
public void update( final double ct ) { // get the array of entities final Entity[] entities = getEntities(); // update all entities for( final Entity entity : entities ) { entity.update( ct ); } // check for collisions for( final Entity entityA : entities ) { for( final Entity entityB : ent...
d531daf4-b33b-4045-bc5f-268df4d7d093
8
private int findDefaultFontIndex() { int index = -1; for(int i=0; i<fontNames.length; i++) { if (fontNames[i].equals("Lucida Sans") ) { index = i; i = fontNames.length; } } //If we found Lucida Sans, return the index //else, look for choice number 2 if (index>-1) return index; else {...
cbb97b5d-11a5-4bc2-a261-af1f0bca47f3
8
public boolean TestLineSort(double x, boolean blue){ boolean r=true; LineComparator x_evaluation = new LineComparator(x); List<Point> locList; if(blue==true){ locList = new ArrayList<Point>(lBlue); } else { locList= new ArrayList<Point>(lRed); } Collections.sort(locList, x_evaluation); for (int ...
70ff0cc5-0f22-44cc-87a7-41f965c6c11b
9
public void setAction(int a) { switch (a) { case 119: { action = 0; break; } case 100: { action = 1; break; } case 115: { action = 2; break; } ...
cf135fe7-dc77-4644-a09f-ddb65fad1100
5
public static void hideFlags(ItemStack stack) { if (stack == null) return; try { Object craft = getHandle(stack); if (craft == null) return; Object tagObject = getTag(craft); if (tagObject == null) return; Object hideFlag = null; ...
f6bdc853-19de-41e5-ab56-9c223eaf9413
5
public Score findScore(String name) { File file = new File("Scores.txt"); double highScore, lastScore; int bestTime,lastTime; String lineFromFile, bestDifficulty, bestSize,lastDifficulty,lastSize; StringTokenizer scoreData; Score userScore = new Score(); Scanner scanner; try { scanner = new Scanner(f...
91b1b6a2-d88b-43ec-b8db-0460012147ab
2
@Override public String toString() { // TODO {key1:value;key2:value...} if (game == null) return null; String result = "{roomName=" + this.name + "," + GameSocketServer.TIMED_KEY + isTimed + ","; String tResult = game.getParameters(); if (tResult != null) result = (result + tResult); return (resu...
9b7c96b5-bfde-40b5-9d7a-c6ec852949f9
1
public boolean update(List<String> args) throws InvalidTableRowException { if (args.size() != columnNames.size()) { throw new InvalidTableRowException("args massive size doesn't map table column size"); } String key = args.get(0); Row row = new Row(args); rows.put(k...
d7f4092b-43ee-49ce-9b1d-0cfba2f23e4f
4
@Test public void testTrade() { //offer trade OfferTradeRequest offerRequest = new OfferTradeRequest(0, new ResourceHand(1, 1, 0, -1, -1), 1); ServerModel aGame = gamesList.get(1); TradeOffer trade = aGame.getTradeOffer(); assertEquals(trade, null); try { aGame = moves.offerTrade(offerRequest, coo...
a88be45c-7a3f-48bb-a457-040ca6312c2e
3
private Socket connect () { Socket s = null; int attempts = 0; do { attempts ++; try { s = new Socket(host, port); s.setKeepAlive(true); s.setSoTimeout(0); } catch (Exception e) { String msg = String.format("Warning: connection attempt %d to %s failed.", attemp...
995171cb-33eb-4d72-a173-33fa3a5b17d4
2
public boolean validSetupForAttack(Field currentField, Field occupiedField) { return this == currentField.getPiece() && occupiedField.hasPiece() && this.isWhite != occupiedField.getPiece().isWhite; }
50c35a52-17f2-42c9-8802-848471e5c3ee
2
public ArrayList<Actor> getActors() { ArrayList<Actor> actors = new ArrayList<Actor>(); int[] dirs = { Location.AHEAD, Location.HALF_LEFT, Location.HALF_RIGHT }; for (Location loc : getLocationsInDirections(dirs)) { Actor a = getGrid().get(loc); if...
5e49359a-0a85-4e11-884b-c52bf410fd4a
6
@Override public boolean isConflict(Estimation another) { boolean ret = false; //for example: >=9 VS <=8 if ((this.getOperType() == GREAT_EQUAL) && (another.getOperType() == LESS_EQUAL)) { if (this.getValue() > another.getValue()) { ret = true; } } else { //for example: <=8 VS >=9 if (...
55740838-4983-489b-b54a-3de3cca80ece
5
public static void startShell() { String request = ""; while(true) { try { if(System.in.available()>0) { char readByte = (char)System.in.read(); if(readByte != '\n' && readByte != '\r') { request = request + readByte; } else { //end of request processConsole(request);...
bfb59440-e981-4ff8-8473-a905bebed585
9
private static HashMap<String, String> getBarcodeToSampleMap() throws Exception { HashMap<String,String> map = new HashMap<String,String>(); BufferedReader reader = new BufferedReader(new FileReader(new File( ConfigReader.getIanLongitudnalDec2015Dir() + File.separator + "SeriesBarcode.txt"))); read...
ea16b7cf-84e3-4fab-9c8d-2e9c34488b29
2
public void setLevel(String level) { if ((level != null) && (!level.isEmpty())) this.level = level; }
9c9cb98f-0999-4ec9-8be2-bcd5168dabaf
5
public Model<?> fetchObject(Class<?> cls, long id) { try { Model<?> o = objects.get(cls).get(id).get(); if (o == null) objects.get(cls).remove(id); return o; } catch (Exception e) { return null; } }
38b070f7-b27a-4489-bb6a-29a7981b79b8
9
private int getValue(Game g) throws GameException { // return immediately if game is over already if (g.winner() == Game.FIRST_PLAYER) return 1; else if (g.winner() == Game.SECOND_PLAYER) return -1; else if (g.winner() == Game.DRAW) return 0; boolean max; int bestVal; // if first player, then f...
0073b04e-a490-4ca4-9e38-9f2b970aee10
9
private boolean canVineStay(World par1World, int par2, int par3, int par4) { int i = par1World.getBlockMetadata(par2, par3, par4); int j = i; if (j > 0) { for (int k = 0; k <= 3; k++) { int l = 1 << k; if ((i & l) != 0 && !can...
58b8e2a4-214b-4c45-a852-7ab2a6497bac
7
public void removeDisplay(String pname, int id, World world){ Player player = Bukkit.getServer().getPlayer(pname); //check if the display is still pending int counter = 0; boolean found = false; while(counter < displays.get(-2).size()){ if(displays.get(-2).get(counter) != null){ if(displays.get(-2)...
9cba67d2-539d-430a-9e4d-848904904b93
6
public static void Weather(CommandSender sender, String value) { Player player = (Player) sender; World world = player.getWorld(); Server server = player.getServer(); if (value.equalsIgnoreCase("rain")) { if (!world.hasStorm()) { world.setStorm(true); world.setThundering(false); } else { serv...
8e2d0e48-3440-4dd8-acc5-09445539e16c
9
public boolean collides(MMTServerPlayer mmtServerPlayer) { if(mmtServerPlayer == null) return false; if((mmtServerPlayer.getXLoc() >= myLoc.x && mmtServerPlayer.getXLoc() <= myLoc.x + 10) || (mmtServerPlayer.getXLoc()+10 >= myLoc.x && mmtServerPlayer.getXLoc()+10 <= myLoc.x + 10)) ...
aab544c7-0365-479c-893c-73c4241cc1e3
5
@Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final WorldCoordinate other = (WorldCoordinate) obj; if (this.dimension != other.dimension) return false; if (this....
1269b082-f2bd-49bc-bd8f-56be934b52d9
8
public BindingManagerEvent(final BindingManager manager, final boolean activeBindingsChanged, final Map previousTriggersByParameterizedCommand, final boolean activeSchemeChanged, final Scheme scheme, final boolean schemeDefined, final boolean localeChanged, final boolean platformChanged) { if (manager ...
e5bba61c-e711-4fb9-8534-50f128b3168f
0
private Combination<Colors> generateAttemptCombination7() { List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>(); attemptTokens.add(new Token<Colors>(Colors.B)); attemptTokens.add(new Token<Colors>(Colors.Y)); attemptTokens.add(new Token<Colors>(Colors.W)); attemptTokens.add(new Token<...
8aeb4dda-2a13-42ce-9dc3-cffeb1156166
6
private void Flug ( int num, int lineNum, String str ) { //tOɂG[ switch ( num ) { case 1: System.out.print ( "Error: ̃CtTCNLqĂ܂Aǂꂩ‚ɓꂵĂ" ); break; case 2: System.out.print ( "Error: ÕXe[Włɑ݂Ă܂" ); break; case 3: System.out.print ( "Error: oH̃pXłɑ݂Ă܂" ); break; case 4: System.ou...
8cd6dd1a-4fd3-4016-9128-73cfca32058d
6
public void onBlockBreak(BlockBreakEvent event) { // Check if plugin is enabled if(plugin.isEnabled()) { // Slot protection enabled if(plugin.configData.protection) { Block b = event.getBlock(); // Look for match in slots for(SlotMachine slot : plugin.slotData.getSlots()) { ...