method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fa161367-d067-4ea8-aaea-bf927944402b
5
public void initialise(World world) throws PatternFormatException { String[] cellParts = cells.split(" "); for (int i=0;i<cellParts.length;i++) { char[] currCells = cellParts[i].toCharArray(); for (int j=0;j<currCells.length;j++) { if (currCells[j] != '1' && currCells[j] != '0') ...
fcd7a037-aeb2-4ea7-9ea0-bd975dcd00a3
7
public static void main(String[] args) { ArrayList newWordList = new ArrayList(); ArrayList filteredWordList = new ArrayList(); try { // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("My Clippings.txt"); // Get the object of DataInputStream ...
d77899ed-684b-49e8-b275-62aed953d682
0
public boolean createDirectory(String path) throws IOException { return fs.mkdirs(new Path(path)); }
4393cfa2-35ea-490c-91b8-6655ce689b13
8
protected GraphicalRepresentationElement representChildren(PathElement el, Set<PathElement> blackNodes) { // FIXME: check casts to VisualizableGraphComponent throughout the method GraphicalRepresentationElement repr = new GraphicalRepresentationElement(this, (VisualizableGraphComponent) el.getNode(), Type.NODE...
5d5ebbfb-9d05-466c-84f8-e221534e1b5c
9
private static boolean canPushBlock(int par0, World par1World, int par2, int par3, int par4, boolean par5) { if (par0 == Block.obsidian.blockID) { return false; } else { if (par0 != Block.pistonBase.blockID && par0 != Block.pistonStickyBase.blockID) ...
c2919808-94c4-4ecb-885e-44b9ad8d7a5c
2
public void run(){ int generation = 0; calculateFitnesses(); //main loop while(true){ if(generation % POPULATION_SIZE == 0){ System.out.println("\nGeneration: "+generation+", cost: "+minCost); System.out.print("\nminimum gene: "); printGene(genes[fittestGeneIndex]); initRouteFromGene(ge...
2387786d-742c-4677-8fd2-fcee4597bc11
1
private void createDrawHistory(){ DataInstance ddi = new DataInstance(drawNet.inputNodes()); //Rack ddi.addFeature(rack.getCards(), game.card_count); //Probabilities if (USE_PROB_DRAW){ double[][] prob = rack.getProbabilities(false, 0); ddi.addFeature(prob[0], 1); ddi.addFeature(prob[1], 1); } //...
b2b1e81d-bafd-40e6-a0a8-195d1334f1ca
9
private void findAnnotations(Class clazz) { if (clazz.getSuperclass() != null) { findAnnotations(clazz.getSuperclass()); } for (Method m : clazz.getDeclaredMethods()) { Command c = null; m.setAccessible(true); if ((c = m.getAnnotation(Command.cl...
bbbc9a94-1dec-4e93-a895-dc66a05d801b
5
public void populateFromFolder(final String str_name, final File cl_dir, final boolean b_dir) { ScriptEngineManager lcl_mgr = new ScriptEngineManager(); for (File lcl_f : cl_dir.listFiles()) { if (lcl_f.isDirectory()) { if (b_dir) { populateFromFolder(str_name, lcl_f, b_dir); } } else if (!lcl_f...
abfc8d02-c012-4b28-9e28-f44b59100fcb
8
@Override public boolean equals(Object o) { if(!(o instanceof MapEntry)) return false; MapEntry<?, ?> me = (MapEntry<?, ?>)o; return (key == null ? me.getKey() == null : key.equals(me.getKey())) && (value == null ? me.getValue() == null : value.equals(me ...
9310d9b0-b914-4e96-b17b-bad96b1ef470
5
public void update(WPEngine4 engine) { if(lightingType.equals(LightingType.SPOT_LIGHT)) { //setupLighting(lightingType); for(int i = 0; i < spotList.size(); i++) { Entity e = spotList.get(i); int RadiusX = spotRadiusX.get(i); int RadiusY = spotRadiusY.get(i); int LeftX = e.getX() - RadiusX; ...
354b856c-8d4a-47fe-92b8-814599e606e1
7
public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) { SubCommand subCommand; if (args.length > 0) { subCommand = this.getCommand(args[0]); } else { subCommand = this.getCommandByName(t...
9e1d881e-f883-463e-936b-bc14142a8b65
0
public int GetBus() { return bus; }
fb5766e4-0dbc-4731-88e8-90b08e217df0
2
public void addPhi(final Block block) { Phi phi = phis[cfg.preOrderIndex(block)]; if (phi == null) { if (StackPRE.DEBUG) { System.out.println(" add phi for " + def + " at " + block); } phi = new Phi(block); phis[cfg.preOrderIndex(block)] = phi; } }
e56b843b-2557-4e59-b881-5f2ed12361e8
6
private PostParameter getParameterValue(String name,Object value){ if(value instanceof Boolean){ return new PostParameter(name, (Boolean)value?"0":"1"); }else if(value instanceof String){ return new PostParameter(name, value.toString()); }else if(value instanceof Integer){ return new PostParameter(name,I...
c591c34c-b8e4-4cbf-ba4b-26ed9920cd0b
2
public int claimProvince(String playerName, String worldName, int chunkX, int chunkZ) { int updateSuccessful = 0; Connection con = getSQLConnection(); PreparedStatement statement = null; String SQL = "INSERT INTO `Monarchy_Provinces` (`id`, `player`, `world`, `x`, `z`, `parent`, `invited`, `time`) VALUES (NUL...
e68242b6-57d8-4a1a-8c53-8d2ebc186b6a
1
public void deleteApp() throws IOException { Scanner in = new Scanner(System.in); System.out.println("Which App do you want to delete? (App Number)"); int ch = in.nextInt(); File x = new File(appDir+ch+".txt"); boolean delete = x.delete(); if(delete) System.out.println("Deleted!"); else System.out.println("Cannot ...
4b2ceb1f-4218-4f0a-b4a3-3538766d2d4f
2
public Layer setActiveLayer(Layer l, boolean active, ArrayList<Layer> layers) { if (active) { for (Layer other : layers) { other.setActive(false); } l.setActive(true); return l; } else { layers.get(1).setActive(true); ...
3cc1f855-8bbd-480a-8588-cc4e4f0a8929
2
public List<Achievement> readAchievements(InputStream stream) throws IOException, JAXBException { log.trace("Reading achievements XML"); // Need to clean invalid XML and comments before JAXB parsing BufferedReader in = new BufferedReader(new InputStreamReader(stream, "UTF8")); StringBuilder sb = new StringBui...
826830cb-6ced-4b14-9642-46da14b26c98
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
3c9b4082-8f71-485d-9800-0563c2c1a609
7
public static void printAllPercentileLocationHomeDistanceRestByDuration(int percentile, int duration){ try { Connection con = dbConnect(); PreparedStatement getXY = con.prepareStatement( "SELECT x,y FROM "+locTbl+" WHERE locationID = ?"); PreparedStatement getDistance = con.prepareStatement( "SELEC...
f6c33685-f967-4189-87e0-992718a76352
1
public void activeHeroChanged(Hero hero) { setActiveHero(hero); System.out.println("active hero changed"); if (WorldMap.getLastInstance() != null) { System.out.println("pre calculate route"); WorldMap.getLastInstance().calculateRoute(hero); } }
ff2f10b6-63dc-413b-be21-63d2adfcfcab
9
private TimeSeriesCollection createTimeSeriesData() { TimeSeriesCollection tsc = new TimeSeriesCollection(); TimeSeries vehTotal = new TimeSeries("Total Vehicles"); TimeSeries carTotal = new TimeSeries("Total Cars"); TimeSeries mcTotal = new TimeSeries("MotorCycles"); //Base time, data set up - the calen...
d0b13042-9115-4856-a057-c0c13d0d2d0d
0
public static void main(String[] args) { w = new Worker(); }
a9941c60-7b81-40f9-be8e-20f13766013f
9
public static ObjectType getTypeFromDataChar(char dataChar) { switch (dataChar) { default: case '0': return AIR; case '1': return STONE; case '2': return BRICK; case '3': return ICE; case '4': return SPIKE; case '5': return PORTAL; case '6': return KEY; case '7': return POTIO...
a9ca7315-6514-47b4-9af7-f4d371eb5bad
4
public static int[] mirror(int[] pixs, int w, int h, int n) { int[] pix = new int[w * h]; for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { if (n == 0) { int u = w - 1 - i; int v = j; pix[v * w + u] = pixs[j * w + i]; } else if (n == 1) { int u = i; int v = h - 1 - j; ...
966b18fc-f07b-4909-aee3-c043d566d666
6
public BSTNode getNameSearchByName(String name) { try { if (Tmproot == null) { Tmproot = root; } String name1 = Tmproot.getName().toString(); if (root == null) { return null; } else { if (name.contentEquals(name1)) { return Tmproot; } else if (Tmproot.getLeft() == null) { Tmp...
8e08833b-90cf-4ce0-8da2-818004cc1657
0
private UselessStatesDetector() { }
2bb73db6-f74d-423d-9124-5180573c21f8
0
private PriceManager() { }
9bb45bb9-4b23-46f5-90f7-9bb829290f4e
7
public static void addEscapeToCloseSupport(final JDialog dialog, final boolean fadeOnClose) { LayerUI<Container> layerUI = new LayerUI<Container>() { /** * */ private static final long serialVersionUID = 2514339457426555702L; private boolean closing = false; @Override public void installUI...
decd9e1f-4a3b-4314-a182-b78a3cfa7103
1
@Override public boolean shouldReact(Message message) { return message.text.startsWith("stopwatch") && message.text.indexOf(' ') != NOT_FOUND; }
9311b881-2462-4997-8f4e-0cc7da6c8fc2
2
private static void inventoryAdder(Items item){ //push to array //Items newItem = item; inventoryHasAtLeastOne = true; for (int i=0;i<inventory.length;i++){ if (inventory[i] == null){ inventory[i] = item; item.setObtained(true); ret...
cfc6e603-64cc-4988-8c8d-a8f4f6cc08cd
7
public static void haku(Pysakkiverkko2 verkko, String lahto, String maali, int aika) { PriorityQueue<Tila2> pq = new PriorityQueue<>(); ArrayList<String> loydetyt = new ArrayList<>(); Tila2 maaliTila = null; boolean loydetty = false; Tila2 t = new Tila2(lahto, null, lahto, Math...
b4ea0db7-a9f6-4dba-a21e-a3273d418ea8
0
public ActivityTypes getActivityType() { return activityType; }
20f8a2d7-f05c-4844-9502-43f79296f3e3
7
public void iniciar() throws Exception { while (true) { System.out.println(); System.out.println("Gestión de personas"); System.out.println("1. Agregar"); System.out.println("2. Modificar"); System.out.println("3. Eliminar"); System.out.println("4. Obtener uno"); System.out.println("5. Obtener to...
30639029-cb90-4bca-8dfe-e44df9ba9ff8
2
public BufferedImage rotateBufferedImage(BufferedImage bf, int rotateDegree) { if(rotateDegree % 360 == 0){ return bf; } int imageWidth = bf.getWidth(); int imageHeight = bf.getHeight(); double rotationRequired = Math.toRadians(rotateDegree); double locationX = bf.getWidth() / 2; double locationY = bf....
b6fdeacd-7f05-44fb-bb9d-ef7f422e98c3
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Pessoa other = (Pessoa) obj; if (this.idPessoa != other.idPessoa && (this.idPessoa == null || !this.idPes...
39ce10e5-1d3e-4682-b87c-88295759dd4b
3
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { evaluateRegex(); } else if (e.getKeyCode() == KeyEvent.VK_F3) { if (!e.isShiftDown()) jumpToNextMatch(); else jumpToPrevMatch(); } }
69e18a84-724d-46c4-b794-0bb6b854b3dd
6
final void method3924(boolean bool, boolean bool_2_, int i, Class70 class70, boolean bool_3_) { try { anInt9852++; if (bool_2_ == false) { OpenGL.glTexEnvi(8960, i + 34176, Class57.method531((byte) 101, class70)); if (bool) OpenGL.glTexEnvi(8960, i + 34192, !bool_3_ ? 770 : 771); else ...
3dee7299-8bf5-44fe-b007-648e54b5683a
9
@Override public boolean read(DummyObjectList dummyObjects, DummyObject [] dummyTypes, TileMap tileMap) { System.out.println("Opening .level file"); try { ResFileReader r; r = new ResFileReader(path); // load tilemap, post names are map, map2, map3 etc. r.gotoPost("map", fal...
6e890162-3cec-43dc-a46b-539943c05193
7
public static void addRingInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) { mplew.writeShort(0); mplew.writeShort(chr.getCrushRings().size()); for (MapleRing ring : chr.getCrushRings()) { mplew.writeInt(ring.getPartnerChrId()); mplew.writeAsciiString(StringU...
b40153ed-2600-452f-8741-055d6e5089b9
9
public static String toEnglish1000(int i) { String[] f20 = {" zero", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen"}; String[] tens = {"ERR", "ERR", "...
e762d998-2be9-4829-90a0-cb777673c2ab
8
void helper(int need, int complete, List<String> res, StringBuilder tmp, int n) { if (complete > need) { tmp.deleteCharAt(tmp.length() - 1); return; } if (need < n && complete < n) { tmp.append('('); helper(need + 1, complete, res, tmp, n); tmp.append(')'); helper(need, complete + 1, res, tmp, n...
354f9180-6328-4491-a5a5-7f00d2db960c
5
public void keyReleased(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_UP){ me.setMoveUp(false); } if(e.getKeyCode() == KeyEvent.VK_DOWN){ me.setMoveDown(false); } if(e.getKeyCode() == KeyEvent.VK_LEFT){ me.setMoveLeft(false); } if(e.getKeyCode() == KeyEvent.VK_RIGHT){ ...
de367692-d8ee-4d01-b137-f7df0ec5ae99
6
public Wave05PewterGym(){ super(); MobBuilder m = super.mobBuilder; for(int i = 0; i < 50; i++){ if(i < 25){ if(i % 2 == 0) add(m.buildMob(MobID.DIGLETT)); else add(m.buildMob(MobID.SANDSHREW)); } else if(i >= 25 && i < 49){ if(i % 2 == 0) add(m.buildMob(MobID.DIGLETT)); el...
40d82c60-26f5-4131-9e2d-19ff17ca93ca
6
public int loadProject( File file) { int back = -1 ; TProject dummy = null ; try { dummy = this.readXmlFile( file ) ; } catch ( SAXException sxe ) { // sxe.printStackTrace() ; back = 1 ; } catch ( ParserConfigurationException pce ) { // pce.printStackTrac...
a6397b47-ec72-4a92-913c-b4092bdded2b
5
public List<Predicate> parsePredicates(String input) throws ParseException { List<Predicate> predicates = new ArrayList<Predicate>(); int numberOfBrackets = 0; int start = 0; for (int end = 0; end < input.length(); ++end) { char currentChar = input.charAt(end); ...
5c8215d4-2cc4-4360-b9a7-d2b7968e731d
9
public Point tryMove(int quad) /* * The quadrant is translated into a tile coordinate, and tested for * validity. The translation varies depending on if the row position of the * curent tile (yTile) is even or odd. null is returned if the new position * is invalid. */ { Point nextPt; if (quad == NE) ...
aec2bb19-8741-41c5-8ed8-66059057f411
4
public int getIndexOfChild(Object parent, Object child) { if(!(parent instanceof ObjectNode)) throw new RuntimeException("unexpected object of " + parent.getClass() + " passed"); if(!(child instanceof ObjectNode)) throw new RuntimeException("unexpected object of " + child.getClass() + " passed"); ...
17d53da6-b7c9-415e-82e4-466fa01f9c26
9
@Override public int hashCode() { int result = (int) (id ^ (id >>> 32)); result = 31 * result + (firstName != null ? firstName.hashCode() : 0); result = 31 * result + (lastName != null ? lastName.hashCode() : 0); result = 31 * result + (identityCode != null ? identityCode.hashCode() ...
f99b7d76-6724-4917-b593-d5a5ecc418c7
8
public static void main(String[] args) { // Declare the JDBC objects. Connection con = null; CallableStatement cstmt = null; ResultSet rs = null; try { // Establish the connection. SQLServerDataSource ds = new SQLServerDataSource(); ds.setIntegratedSecurity(true); ds.setServerName("localhos...
bac4e27a-c3b1-4c8d-acdb-69b34d7f75f9
6
@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 TaxonDesignationPK)) { return false; } TaxonDesignationPK other = (TaxonDesignationPK) object; if ((this.taxonV...
cd71787e-5ee1-48c0-b1de-0362eded8f24
0
public static boolean isLessThan11(int i){ return i < 11; }
6c5784ea-13ea-45e4-95a2-b52196b20e82
0
@Before public void setUp() { _helper = new TruncateHelper(); }
d40e992e-cafb-45dd-999e-60b590d63380
0
public void setComputerScores(){ computerScores++; }
16839e00-eadf-471b-9741-7c065b05ce13
7
private void formMouseEvent(java.awt.event.MouseEvent evt) { int mouseEventId = evt.getID(); int buttonID = evt.getButton(); int xcord = evt.getX(); int ycord = evt.getComponent().getHeight() - evt.getY(); long time = evt.getWhen()/1000; ...
d4ba5847-30a6-41a9-a661-95ab27fb3b3d
4
public static boolean isLocation(Location loc1, Location loc2) { if (loc1.getWorld() == loc2.getWorld() && loc1.getBlockX() == loc2.getBlockX() && loc1.getBlockY() == loc2.getBlockY() && loc1.getBlockZ() == loc2.getBlockZ()) return true; else return false; }
b5d2d338-fa87-40b1-8490-758c20f6f4a2
7
public boolean meet(Temporal temporal) { if (null == temporal) return false; // if (null == temporal || this == temporal) return false; if (isTimeInstance()) { if (temporal.isTimeInstance()) return startTime == temporal.startTime; else return startTime == temporal.endTime || startTime == temporal.startTime;...
57651fbe-9fb3-4a6d-86eb-391502506543
6
@Override public Iterator<E> iterator() { return new Iterator<E>() { private int index = -1; @Override public boolean hasNext() { return index < SimpleHashSet.this.size() - 1; } @Override public E next() { ...
afc20dc8-1ad9-43c7-be40-cdb85afe96fd
5
private float coFactor(int c, int r) { Matrix3 minor = new Matrix3(); int i = 0; for(int ri = 0;ri < SIZE;ri++) { if(ri == c) continue; for(int ci = 0;ci < SIZE;ci++) { if(ci == r) continue; minor.m[i++] = m[ri * 4 + ci]; } } if((r + c) % 2 == 0) return minor.determinant(); else return -min...
6a8302ee-0c6b-43a7-86c8-34077237d0aa
5
@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 AccessRequestType)) { return false; } AccessRequestType other = (AccessRequestType) object; if ((this.id == nul...
b9a1da7f-7699-433d-ad9e-48daad5b49ab
8
private void displayLists(CommandSender sender, List<Lists> lists) { for (Lists list : lists) { if (list == null) { continue; } int id = list.getReportId(); ReportType type = ReportType.getType(list.getType()); switch (type) { ...
a79d58b6-5573-4f2e-bfbe-8e656ec7e683
6
public synchronized final void close() { if (!open) { return; // it is not an error to attempt to close a closed Query } if (Prolog.thread_self() == -1) { throw new JPLException("no engine is attached to this thread"); } if (Prolog.current_engine().value != engine.value) { throw new JPLException("thi...
86a4c1ba-7d93-4a17-be1a-89c6b3d9897d
8
void genRandArray(int[] array, int size) { if (size > array.length) throw new IllegalArgumentException("Given size " + size + " exceeds array length " + array.length); if (size < N32) throw new IllegalArgumentException("Size must be at least " + N32 + ", but is " + size); if (size % 4 != 0) thr...
bf4935b4-60cb-4215-9351-376e2728e592
8
public static Stella_Object accessSubstringPositionIteratorSlotValue(SubstringPositionIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_LOGIC_SUPER_STRING) { if (setvalueP) { self.superString = ((StringWrapper)(value)).wrapperValue; } else ...
34f11061-06b3-4446-bb18-b05747de0ce4
6
private HelperGroup better(HelperGroup a, HelperGroup b, int R) { if (a.totalCapacity >= R && b.totalCapacity < R) return a; if (a.totalCapacity < R && b.totalCapacity >= R) return b; if (a.totalCapacity < R && b.totalCapacity < R) return max(a, b); return min(a, b); }
170af63b-8e8f-47be-89e4-fc7d04ca1d19
8
public boolean userCanSeePatient(String uid, String uunit, Patient patient) { int type = findType(uid); if (type == TYPE_GOV) { return true; } else if (type == TYPE_DOCTOR || type == TYPE_NURSE) { ArrayList<JournalEntry> entries = patient.getJournal().getEntries(); for (JournalEntry entry : entries) { ...
ed6bca36-fc21-4e7b-92e1-3716fccc4cd4
0
public static void main(String[] args) { ConfigFile f = new ConfigFile("config.txt"); f.ReadFile(); }
4b7ab4eb-5af1-46e5-a001-eb2ba78ee362
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
95abf259-d9c9-4d73-8d21-25f5ab7809a9
5
private static Interface getHID (Device dev) throws IOException { Configuration config; Interface retval = null; DeviceDescriptor info = dev.getDeviceDescriptor (); if (info.getDeviceClass () != 0) throw new IllegalArgumentException ("dev class"); config = dev.getConfiguration (); for (int i = c...
9175ec98-bc4c-4f69-8c5a-70bda282d52b
3
private void touchRotate(final double X, final double Y, final Rotate ROTATE) { double theta = getTheta(X, Y); interactiveAngle = (theta + 90) % 360; double newValue = Double.compare(interactiveAngle, 180) <= 0 ? (interactiveAngle + 180.0 + getSkinnable().getStartAngle() - 360) ...
3ac8cd22-04b6-449c-a171-06eb1ba7ef72
0
@Override public String toString(){ return "id= "+this.getId()+", "+this.getName()+"\n"+getTime()+"\n"+"Диаметр: "+this.getHig()+"\n"+"Длин окружности: "+this.getLengh()+"\n"+"Координаты центра: ("+this.getX() +" , "+this.getY()+")"+"\n"+"S=: "+this.getArea()+" V=: "+this.getVolume()+"\n"; }
2aa9a9ab-4f8c-4e1f-b704-522af1e2e27a
8
void lookForHbonds(NucleicPolymer other, BitSet bsA, BitSet bsB) { // Logger.debug("NucleicPolymer.lookForHbonds()"); for (int i = monomerCount; --i >= 0;) { NucleicMonomer myNucleotide = (NucleicMonomer) monomers[i]; if (!myNucleotide.isPurine()) continue; Atom myN1 = myNucleotide.getN1(); Atom bes...
92996e83-f6b9-42e7-b56b-f2feea295604
4
public void setUtilityVisible(JButton button) { String caseString = button.getActionCommand(); switch(caseString) { case "diceRollerLaunch": setPanelVisible("dicePanel"); break; case "calculatorLaunch": setPanelVisible("calculatorPanel"); break; case "audioPlayerLaun...
52bc07eb-7a04-43b6-9be1-764bb642764c
6
@Override public boolean execute(RuleExecutorParam param) { Rule rule = param.getRule(); List<String> values = Util.getValue(param, rule); if (values == null || values.isEmpty()) { return false; } boolean retValue = true; for (String value : values) { String compareValue = rule.getValue(); if (rul...
d02987f4-d65e-43e8-aa0c-dd96aa084939
1
public void updateImage() { //we will update animation when delay counter reaches delay, then reset delay counter delayCounter++; if(delayCounter>delay) { delayCounter=0; frameNumber++;//updates frame to next frame frameNumber%=totalFrame;// if surpass 3rd frame, back to frameNumber 0 //sets image to s...
4db2d9d6-6415-4543-b300-54ff2f80875a
0
protected void initialize() { _setDistance(Robot.vision.getCurrDistance()); super.initialize(); }
f7c9ba62-e18f-42c4-a210-3794f3fea2a3
0
public void setDumping(boolean b) { dumping = b; }
3dc28691-aed3-4ae8-bd00-b911b7af5191
7
private void prepare(){ this.year = Integer.parseInt(split[0]); this.title = split[1]; this.rating = Float.parseFloat(split[2]); if(split.length > 3){ if(!split[3].equals("")){ this.genre = split[3].split("\\|"); for (int i = 0; i...
8d574084-bb70-4e14-96a1-711978cc1318
1
public void init(int nplayers, int[] pref) { this.nplayer=nplayers; this.pref=pref; this.position=this.getIndex();// position start from 0 this.record = new int[2*nplayer]; if(nplayers-position<=9) magic=magic_table[nplayers]; else magic=(int) Math.round(0.369*(npla...
45fc7423-7e19-43ba-a2dc-9ebe3445956f
6
private SaveState computeSaveState(Issue edited, Issue issue) { try { // These fields are not editable - so if they differ they are invalid // and we cannot save. if (!equal(edited.getId(), issue.getId())) { return SaveState.INVALID; } ...
00ff5cf2-f6ae-46cb-886f-b415dd1df350
9
@Override public int getdir(String path, FuseDirFiller dirFiller) throws FuseException { Iterable<EntityInfo> iterator; try { iterator = fileSystem.listDirectory(path); if (iterator == null) System.err.println("Your file system returned null for readDirectory(" + path + ")"); } catch (PathNotFoundExcep...
cb1807ec-68c9-4cd1-a3b9-937a7d92b306
3
public static double getAngle(Vector2D vector) { double x = vector.x; double y = vector.y; if (x > 0) { return Math.atan(y / x); } else if (x < 0) { return Math.atan(y / x) + Math.PI; } else if (y > 0) { return -Math.PI / 2; } e...
777b6105-3a13-489d-8a1b-743a00e90aa8
6
@Override public void keyPressed(KeyEvent nappain) { switch(nappain.getKeyCode()) { case KeyEvent.VK_LEFT: ohjaus.annaKomento(Komento.SIIRTO_VASEMMALLE); break; case KeyEvent.VK_RIGHT: ohjaus.annaKomento(Komento...
fa1b380d-4990-4597-9e07-74cbc2ac6d41
8
public static void handleEvent(int eventId) { // Changes focus to Main Ship Shop Menu if(eventId == 1) { System.out.println("Exit Ship Shop Hulls menu to Main Ship Shop Menu selected"); Main.ShipShopHullsMenu.setVisible(false); Main.ShipShopHullsMenu.setEnabled(false); Main.ShipShopHullsMenu.setFocus...
b2e6ea99-6b7e-4358-b091-a99745cddc61
1
public ModelProxy<?> getModelProxy() { return modelProxy; }
4bc3253a-cfc1-4f80-bc8a-67f3ab0dd31c
8
public Reference getRef(int i) throws ClassFormatException { if (i == 0) return null; if (tags[i] != FIELDREF && tags[i] != METHODREF && tags[i] != INTERFACEMETHODREF) throw new ClassFormatException("Tag mismatch"); if (constants[i] == null) { int classIndex = indices1[i]; int nameTypeIndex = indi...
a7d63208-3a1e-47ea-97b9-abafaafa8137
5
@Override public void run() { while (!ctx.isShutdown()) { if (ctx.isPaused()) { paused = true; ctx.sleep(1000); } else { paused = false; int delay; try { delay = loop(); } catch (Throwable throwable) { throwable.printStackTrace(); delay = -1; } if (delay >= 0) {...
776f961b-31f8-45d7-b97d-ac5bca850e42
4
private static void doUpdateTest() { try { System.out.print("Testing update command "); // make mvd & load it String testData = TEST_DATA+File.separator+BLESSED_DAMOZEL; File testDataFolder = new File( testData ); String mvdName = createTestMVD( testDataFolder ); File mvdFile = new File( mvdName ...
31384177-4d48-4abd-bf35-e92f54270a50
4
public PongView(PongModel model) { //initialize the View members: this.model = model; WIDTH_PXL = 600; HEIGHT_PXL = WIDTH_PXL*((int)model.getFieldSize().getHeight())/((int)model.getFieldSize().getWidth()); this.ball = new Ball(); this.bars = Collections.unmodifiableMap...
24e39c56-3b0e-4acc-b485-7fe342338403
0
public static void main(String[] args) { ListGenericFoo<LinkedList> foo1 = new ListGenericFoo<LinkedList>(); ListGenericFoo<ArrayList> foo2 = new ListGenericFoo<ArrayList>(); LinkedList[] linkedList = new LinkedList[10]; foo1.setFooArray(linkedList); ArrayList[] arrayList = new ArrayList[10]; f...
608a1b01-6731-44e5-8bcd-b01b5a579df9
4
public Connection getConnection() { Context context = null; try { context = new InitialContext(); DataSource dataSource = (DataSource) context.lookup(JNDI_NAME); return dataSource.getConnection(); } catch (NamingException ex) { throw new DAOException(JNDI_NAME + " niet ge...
7eefb040-b21b-4330-8c28-255415c64e4c
4
@Override public Double getScalarValue(Word word) { for (Word word1:wordList) { if (word1.getKeyWord().equals(word.getKeyWord())){ if(word1.getSpamLabel().equals(word.getSubkey())){ return word1.getSpamCount(); }else if(word1.getGenuineLabel()...
4c9f705c-89c6-48f3-b6ca-bf0ee52fdebf
6
public void printVector(PrintableStringWriter stream) { { FloatVector self = this; if (self.arraySize == 0) { stream.print("|i|[]"); } else { { int i = 0; int limit = 9; stream.print("|i|["); { double element = Stella.NULL_FLOAT; FloatVec...
c820a018-df20-4b0b-a4ac-51175e5f5f1d
8
public static void mouseMoved(MouseEvent mouseEvent) { Iterator<PComponent> it = components.iterator(); while(it.hasNext()) { PComponent comp = it.next(); if(comp == null) continue; if (shouldHandleMouse) { if (comp.shouldHandleMouse())...
5fb1f1e1-73ac-4c0d-9b82-5c33a06ce367
1
public Object leerObjeto (String path, String nom) /*throws FileNotFoundException, IOException*/ { Object ob = null; File f = new File("./Data/Barrios/" + path + nom + ".o"); try{//FileWriter fw = new FileWriter(f); FileInputStream fis = new FileInputStream(f); ObjectInpu...
aedf83a5-a93d-48a8-8cbb-62cc52ab1464
5
@Test(expected=BadPostfixException.class) public void evaluatePostfix2() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException { try { postfix.addLast("5"); String result = calc.evaluatePostfix(postfix); } catch (...
d3eeb607-97e8-4ac9-a81e-9a50cb019c22
7
@Override public void repaint(TextGraphics graphics) { graphics.applyTheme(graphics.getTheme().getDefinition(style)); graphics = transformAccordingToAlignment(graphics, calculatePreferredSize()); if(textColor != null) graphics.setForegroundColor(textColor); i...
8ed42f30-f223-4948-937e-611efd21857e
7
public void addOpenHouses() { nextCheckForhouses = System.currentTimeMillis() + 600000; // 10 minutes final String json = IOUtil.readString(URL_GET_HOUSES, ctx.useragent); try { JsonObject jsonObject = JsonObject.readFrom(json); final JsonValue open_houses = jsonObject.get("open_houses"); if (open_house...
56d99c1d-4259-45f2-9cae-b639fae94889
3
public static boolean isNumber(String num) throws LexicalException { Long lowerBound = -4294967296L; Long upperBound = 4294967295L; try { Long.valueOf(num).longValue(); } catch (NumberFormatException nfe) { return false; } Long temp = Long.valu...