method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e2fcd2af-8d82-44e8-8ed1-894e8e6a6aca
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(myHost instanceof MOB)) return super.okMessage(myHost,msg); final MOB myChar=(MOB)myHost; if(!super.okMessage(myChar, msg)) return false; if((msg.amITarget(myChar)) &&(msg.targetMinor()==CMMsg.TYP_DAMAGE) &&(msg....
a47c14d1-81c0-4b48-82df-0b978aad4161
6
public void compile(ClassFile cf) { if (m==null) { // load the local variable with a given number // int[][] load={ // //wide shrt 0 1 2 3 // {0x15c4,0x15,0x1a,0x1b,0x1c,0x1d}, // Z // {0x15c4,0x15,0x1a,0x1b,0x1c,0x1d}, // B // {0x15c4,0x15,0x1a,0x1b,0x1c...
5590de81-1458-4791-a0a3-64621899d5eb
8
private static double[] poissonRandCalc(Random rr, double mean, int n) { double[] ran = new double[n]; double oldm = -1.0D; double expt = 0.0D; double em = 0.0D; double term = 0.0D; double sq = 0.0D; double lnMean = 0.0D; double yDev = 0.0D; if (mean < 12.0D) { for (int i = 0; i < n; i++) { if...
5da5f16e-9eea-46db-803a-9132c9ffaaad
9
public int nbLignes(ArrayList<Station> chemin){ int nbchangement=0; for (int i = 0; i < chemin.size(); i++) { if(i>=2){ int ligne=chemin.get(i).getLigne(); int lignechange = chemin.get(i-2).getLigne(); if(ligne!=4 && ligne!=5 && ligne!=6 && lignechange!=4 && lignechange!=5 && lignechang...
eb26b22e-59f2-4f8c-b723-95d96bf3851f
2
public static void main (String[] args){ Scanner reader = new Scanner(System.in); /*Runs main method repeatedly until user * requests otherwise*/ char loop = 'y'; while (loop == 'y'){ Scanner sc = new Scanner(System.in); Random rand = new Random(); List<Integer> array = new ArrayList<Integer>(); int ...
bfe9cb88-a9eb-47cb-b5a0-1cfabce3e3b4
9
private void findDeclaredPaths(final File parent, final File file, final Map<String, ResourceType> resourceTypes, final Map<String, SortedMap<String, Resource>> resources) { if (file.isDirectory()) { for (final File child : file.listFiles()) { if (!child.isHidden()) { ...
7c2a9459-ec60-4d7d-a650-d0a85584ec78
3
private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); f...
acc716fb-88a0-4e32-a20f-12ce60b9ced6
5
public static void main(String[] args) { LineNumberReader reader = null; if (args.length < 1) { System.out.println("Usage: java LineCounter < filename"); System.exit(0); } try { // introduce a wrapper on FileReader object reader = new LineNumberReader(new FileReader(args[0])); while (reader.readL...
f39b91bb-ab29-44e3-b1ee-c47fe52078c1
5
@Override public int hashCode() { int result = idTrack; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (filePath != null ? filePath.hashCode() : 0); result = 31 * result + (price != null ? price.hashCode() : 0); result = 31 * result + (dur...
1b7f64cd-9c4a-4c9b-8032-0f78989eaf0a
6
@Test public void depthest02vsdepthest21opponent3() { for(int i = 0; i < BIG_INT; i++) { int numPlayers = 6; //assume/require > 1, < 7 Player[] playerList = new Player[numPlayers]; ArrayList<Color> factionList = Faction.allFactions(); playerList[0] = new Player(chooseFaction(factionList), new S...
0fb9b448-ad3e-4ea3-906c-687ba2a36a48
4
private static String getParam (Properties params, String toGet, boolean required, String def) { String res = params.getProperty(toGet); if (res == null) { if (required) { throw new IllegalStateException(toGet + ERROR_NO_PARAM); } else { if (__log ...
af81eb82-aa1a-4c85-b847-c66f14806bc7
5
private String checkPath(String pathToCheck, String extention) { String[] tokens = null; StringBuilder retval = new StringBuilder(); // ako primljena eksenzija ima tocku na pocetku ona se brise if (extention.substring(0, 1).equals(".")) { extention = extention.substring(1); } // ako je primljena "ekste...
f55b307c-b290-4ea7-bc57-93c53a2b1378
7
public static void main(String[] args) { if (args == null || args.length != 1 || args[0] == null || args[0].isEmpty()) { throw new RuntimeException("Error : Application requires a single argument; the filename containing ghost data"); } String fileName = args[0]; File inputFile = new File(fileName); if ...
811f39c7-b7c4-4fcd-a9f3-da6152e123db
5
private void createMainParser() throws UnsupportedFormatVersionException { try { // Obtain a new instance of a SAXParserFactory. SAXParserFactory factory = SAXParserFactory.newInstance(); // Specifies that the parser produced by this code will provide support for XML namespaces. factory.set...
dc207588-d772-40ab-b261-e1c53b14a952
8
private synchronized void finishMerges(boolean waitForMerges) throws IOException { if (!waitForMerges) { stopMerges = true; // Abort all pending & running merges: for (final MergePolicy.OneMerge merge : pendingMerges) { if (infoStream != null) message("now abort pending merge "...
5d464a3e-c1d8-4cbc-bbab-1bed78d61152
6
public static void LogWritter(String Status, String Message){ String msgFormat = "", methodname = "", MethodTrail = "", consoleFormat = ""; try{ StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); methodname = stacktrace[2].getClassName() + "." + stacktrace[2].getMethodName(); for...
cf57a1da-9f76-4e4c-9c99-0c7d35057899
5
public static byte[] encryptDataFile(String filename, SecretKey skey, DataOutput os) { DataInputStream is = null; try { Cipher cipher = Cipher.getInstance(AES_ALGORITHM); // Initialisierung cipher.init(Cipher.ENCRYPT_MODE, skey); // Der Initialisieru...
05dd50b5-746c-48fb-bb20-6af7885f4058
8
private static List<Pair> getAllNeighbour(Pair source, int [][] maze) { List<Pair> neighbours = new ArrayList<>(); if(source.y - 1 >= 0 && maze[source.x][source.y-1] != 1 ) { neighbours.add(new Pair(source.x, source.y-1)); } if(source.x - 1 >= 0 && maze[source.x-1][source.y] !...
2a3dddcb-3708-485c-94f8-a4e74f4b1490
3
private void func_785_b() { for (int var1 = 0; var1 < this.connectedTracks.size(); ++var1) { RailLogic var2 = this.getMinecartTrackLogic((ChunkPosition) this.connectedTracks.get(var1)); if (var2 != null && var2.isConnectedTo(this)) { this.connectedTracks.set(var1, new Chu...
f57a93bc-db58-4ee3-8abf-e60ec97a001b
6
@Override public void mousePressed(MouseEvent me) { int x = me.getX(); int y = me.getY(); if(mainModel.getState() == State.INVENTORY){ //if you click off it closes inventory and deletes any item in hand if(x > 700 || x < 100 || y > 500 || y < 100){ if(mainModel.getPlayer().HUD.inMouse != mainModel.getP...
1dd71d05-ee51-4bc8-b3f9-63cf749cb6ab
3
public static List<Kurssi> haeKurssit(String nimi) { Connection c = connect(); if (c == null) return null; try { List<Kurssi> kurssit = new ArrayList<Kurssi>(); PreparedStatement ps = c.prepareStatement("SELECT * FROM kurssi WHERE nimi LIKE ?;"); ps.setString(1, "%" + nimi + "%"); ResultSet rs = p...
4108bcab-d50e-4d5b-b1d7-a54fd178ed3d
8
public void setCpkPercent(int percent) { synchronized (lock) { viewer.setPercentVdwAtom(percent); if (model != null) { int n = model.getAtomCount(); if (fullSizeUnbondedAtoms) { for (int i = 0; i < n; i++) { if (model.getAtom(i).isBonded()) { viewer.setCpkPercent(i, percent); } ...
c462034b-688f-406e-b306-5b7f79cd3a2a
4
public boolean addRequiredFile(String fileName) { // if the list is empty if (requiredFiles_ == null) { requiredFiles_ = new LinkedList(); } // then check whether filename already exists or not boolean result = false; for (int i = 0; i < requiredFiles_.size(...
05a7127b-9ec6-4865-be2a-53fe51ff1247
6
private void cleanField() { for (int i = 0; i < 5; i++) { while (this.currentRow < this.totalRows) { Movement.addInstruction(new MovementInstruction( Movement.Type.DRIVE, this.rowLenght, 20.0)); // Sofern er in der letzten Bahn ist soll er nicht mehr in die // naechste Bahn gehen if (this.cu...
e5affd36-73d3-4792-9913-6c61b18cce3b
8
private void listagemTurma() { final Main m = new Main(); JLabel NomeTurma = new JLabel("Turmas:", JLabel.CENTER); String[] v5 = new String[m.turmas.size() + 1]; v5[0] = " "; for (int i = 1; i < m.turmas.size() + 1; i++) { v5[i] = m.turmas.get(i - 1).toStringSigla();...
e68e0e12-3eaa-4552-aedd-fa5f81b4e7eb
1
public int abs(int x){ return x > 0 ? x : -x; }
3991c1b3-cd6d-45c3-89fd-ea949b92d98b
1
public void action() { if(log.isLoggable(Logger.WARNING)) log.log(Logger.WARNING, "(de-)register agent..."); ACLMessage msg; msg = new ACLMessage(ACLMessage.REQUEST); msg.setSender(myAgent.getAID()); msg.addReceiver(((HunterAgent) myAgent).getGameAgentDescription().getName()); // /* // * Der A...
fe607be1-55aa-40d2-8c1c-0df94ef53f65
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S...
c90ad5a1-cba2-4238-bc34-e7c1ba4f7262
9
private final void method2453(int i, AbstractToolkit var_ha, int i_32_, AnimatableToolkit class64, int i_33_, int i_34_, Class101 class101, int i_35_) { do { try { anInt10548++; if (i_33_ == 0) { int i_36_ = i * i + i_34_ * i_34_; if ((i_36_ ^ 0xffffffff) <= -262145 && i_32_ >= i_36_) ...
357ac1e2-ae0c-43b2-bb63-961948213a5a
4
private static int first (final int[] array, int i, final int nodesToMove) { final int length = array.length; final int limit = i; int k = array.length - 2; while ((i >= nodesToMove) && ((array[i] % length) > limit)) { k = i; i -= (limit - i + 1); } i = Math.max (nodesToMove - 1, i); while (k > (...
73d78186-57a9-464a-8dd2-492acda56901
0
public void setIsDataFileEnd(boolean isEnd) { isDataFileEnd = isEnd; }
5a6b9b72-c1cb-4f60-80e9-a4c6f3009c60
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...
1c3d2d3c-2890-44fe-85a9-d8a5beb281d5
6
private void buildLoginBox(boolean offline) { loginBox.removeAll(); loginBox.setLayout(new BorderLayout(0, 8)); final TransparentPanel titles = new TransparentPanel(); titles.setLayout(new GridLayout(0, 1, 0, 2)); titles.add(new TransparentLabel(Translater ...
dfd288d4-ea13-4d45-8c76-8df7600e008e
0
public void setId(Integer id) { this.id = id; }
f16ed333-de40-47b8-93b1-da8eb2a3a167
8
private void init() { //scelta del tipo di partita e richiesta dei nomi dei giocatori String[] scelte = {"Player vs Player", "Player vs CPU", "CPU vs CPU"}; Object scelta = JOptionPane.showInputDialog(null, "Selezionare il tipo di gioco", "Seleziona giocatori", JOptionPane.INFORMATION_MESSAGE, n...
1b6c0876-15d9-41c5-a82d-bd7eeb9c9f87
6
private static void setupPieceOrientations(boolean refl, boolean rot) { p = new ArrayList<ArrayList<Piece>>(); for(int x = 0; x < puzzle.getPieces().size(); x++) { ArrayList<Piece> l = new ArrayList<Piece>(); l.add(puzzle.getPieces().get(x)); for(int i = 0; i < 7; i++) l.add(null); if(refl && rot) ...
deb4eeff-60f0-4712-953e-ac00a1c5d136
4
public static Scope parse(HtmlElement element, String str){ switch(str){ case "col": return COL; case "row": return ROW; case "colgroup": return COLGROUP; case "rowgroup": return ROWGROUP; default: return null; } }
9f0b81ad-7602-47aa-9d18-4639e7e87c07
0
@Before public void setUp() throws Exception { this.cacheKey = new CacheKey("mockService", 123); this.cache = new InMemoryCache(); }
d9c3bc4a-a436-49d0-89fb-e3884b0273bc
2
public static void printResults() { if (Solutions.isEmpty()) { System.out.println("No solution found. \n"); }else { for (int i = 0; i < Solutions.size(); i++) { String soln = Solutions.get(i); System.out.println("Solutions found: "); System.out.println(soln); } System.out.println("all done....
eec83374-26b0-450a-becf-364b85b7ed0f
9
public void applyDestruction(int ex, int ey, Shell shellType) { // wprowadza efekty napierdalania się int x0, y0, x1, x2, y1, y2; int range = shellType.getRange(); // obliczamy brzegi prostokąta, w ktorym zawiera się eksplozja: // x1 = e.getX(); // x2 = x1 + e.getRange()*2; // y1 = e.getY(); // y...
094a78aa-245e-4eaf-885e-2c1ba1d66082
5
private boolean removeItem(AbstractNode node, Object item) { Boundable childToRemove = null; for (Iterator i = node.getChildBoundables().iterator(); i.hasNext(); ) { Boundable childBoundable = (Boundable) i.next(); if (childBoundable instanceof ItemBoundable) { if ( ((ItemBoundable) childB...
7863fb9f-a3b5-46f1-ac62-96f0a481ea4b
4
static boolean test(boolean showLog) { boolean res = true; if (res) { PolygonTester polygonTester = new PolygonTester(); res = polygonTester.test(showLog); if (showLog) System.out.println(); } if (res) { TriangleTester triangleTester = new TriangleTester(); res = triangleTester.test(sh...
9a4a922a-0055-4cf2-8846-26a5fd02b553
3
@Override public void delete(SondageReponse obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("DELETE FROM SondageReponse where id=?;"); pst.setInt(1, obj.getId()); pst.executeUpdate(); System.out.p...
4b69aacc-9ca0-4bfd-aa60-3cd87164b823
9
protected TripleDouble getInDelSubRates(Map<Integer, Map<Integer, Integer>> map) { double sub = 0; double ins = 0; double del = 0; double sum = 0; for (int v = 0; v < 6; v++) { for (int b = 0; b < 6; b++) { sum += map.get(v).get(b); } ...
88f737e7-3465-48a3-bb0d-485913c3264c
8
private boolean appletCheck(boolean msg){ boolean isApplet; SecurityManager s = System.getSecurityManager(); if(s != null){ try{ s.checkAccess(Thread.currentThread()); isApplet = true; if(msg) ...
dabcb474-47e2-47ae-8486-483405cce4e0
2
public static void addIfNotEmpty(Set container, String str, int distance, String description){ if (str.length() > 0) { if (!container.contains(str)) { container.add( new Word(str, distance)); // System.out.println("Adding new word : [" + description + "] " + str); ...
132aa14c-d8dd-439f-bbe3-bc688c49cfbb
7
public boolean equiv(Object obj){ if(!(obj instanceof Map)) return false; if(obj instanceof IPersistentMap && !(obj instanceof MapEquivalence)) return false; Map m = (Map) obj; if(m.size() != size()) return false; for(ISeq s = seq(); s != null; s = s.next()) { Map.Entry e = (Map.Entry) s.first(); b...
c8ea0287-98af-4afe-af31-162a9358cf11
9
private void checkPlayerCollision(Player player, boolean canKill) { if (player.isAlive()) { // Henter inn et eventuelt kolliderende vesen. Entity collidingEntity = getCollidingEntity(player); if (collidingEntity != null) { if (collidingEntity instanceof Item) ...
276b251a-0a24-40e2-b35e-0cb1d54068ec
9
@Override public synchronized PathWatchKey register(Path path, Kind<?>[] kinds, Modifier[] modifiers) throws IOException { PathImpl pathImpl; try { pathImpl = (PathImpl)path; }catch(ClassCastException ccx){ throw new IllegalArgumentException("the provided Path was not created by the newPath factory method ...
cc7da915-82af-4606-bb5f-57b1ebac3ae0
6
protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { this.minecartType = par1NBTTagCompound.getInteger("Type"); if (isPoweredCart()) { this.pushX = par1NBTTagCompound.getDouble("PushX"); this.pushZ = par1NBTTagCompound.getDouble("PushZ"); ...
2235629f-2b2f-411d-b9c9-aea0e5f823c4
9
private static boolean shouldClip(Point p1, Point p2) { double w1 = p1.getCoordinate(3); double w2 = p2.getCoordinate(3); // check if the x's are too far left or right double x1 = p1.getCoordinate(X); double x2 = p2.getCoordinate(X); if (x1 < -w1 && x2 < -w2) { return true; } if (x1 > w1 && x2 > w2)...
a36e2de6-81fd-43a1-b560-758e6cae76fb
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Request request = (Request) o; if (accessKey != null ? !accessKey.equals(request.accessKey) : request.accessKey != null) return false; if (data...
ee875913-ee5c-4d52-84a7-c23243b47cd6
1
public Map<String, String> getStyles() { if (styles == null) { styles = new HashMap<String, String>(); } return styles; }
9a65dfe9-472d-4e3c-bb94-77a766e62647
0
@Test public void setReplacesCorrectElement() { a.insert(v); a.set(0, new Vertex(0, 149)); assertEquals(149, a.get(0).getDistance()); }
3bad2403-5f12-436f-bea3-6bb464362c4d
3
public Method factoryMethod(Object... args) { for (Method m : factoryMethods()) { Class<?>[] argTypes = Lang.evalToTypes(args); if (isMatchArgTypes(argTypes, m.getParameterTypes())) { return m; } } throw Lang.uncheck(new NoSuchMethodException()); }
18573308-01a3-4694-b3b3-ce736c275eec
4
public void update() { up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; shift = keys[KeyEvent.VK_SHIFT]; }
8be80e62-7ee6-4b57-8832-de47b5c94ba5
7
private void updateBugDetails() { final ObservableIssue selectedIssue = getSelectedIssue(); if (details != null && selectedIssue != null) { if (displayedIssueLabel != null) { displayedBugId = selectedIssue.getId(); displayedBugProject = selectedIssue.getProjec...
e3a516cf-8ccc-45b5-a9c8-5d0c84d11384
7
@Override public void setStat(String code, String val) { if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0) CMLib.coffeeMaker().setGenItemStat(this,code,val); else switch(getCodeNum(code)) { case 0: setPowerCapacity(CMath.s_parseLongExpression(val)); break; case 1: activate(CMath.s_bool(val));...
6629a30d-d969-42d3-8a14-b12d8b167196
0
public static void main(String[] args) { EvenChecker.test(new SynchronizedEvenGenerator()); }
a87b28a2-7c36-4fde-8caa-2421be6740f4
8
private void redoTransactions(Integer[] taIds) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("TransactionLog")); String line = reader.readLine(); String[] values; while (line != null) { values = line.split("\\|"); // Go through all Log entries if (...
b0a5507f-7598-40b3-96bd-38e195dc91bd
4
public boolean runTests () { System.out.println ("\n" + "Running " + testName() + " tests...." + "\n"); // Kill anything that might be hanging around String newdbpath; String newlogpath; String remove_logcmd; String remove_dbcmd; String remove_cmd = "/bin/rm -rf "; newdbpath ...
5548050d-c2de-4484-a4f1-7dd90dc85f5d
2
public void showSongs() { try { BLLSong ds = new BLLSong(); System.out.println("All songs: "); for (BESong aSong : ds.getAll()) { System.out.println(aSong.getId() + ": " + aSong.getTitle() + ": " + aSong.getArtist() + " - Duration: " + aSong.getLength() + " -...
a6ccf3ab-2dae-4913-978d-67d0cd66a7d2
7
public static List<GregorianCalendar> identifyFeiertage(int year) { final List<GregorianCalendar> holidays = new ArrayList<GregorianCalendar>(); // Ostern vorab berechnen final GregorianCalendar ostersonntag = MoreDate.osterdatum(year); GregorianCalendar tmp; //CHECKSTYLE:OFF...
345a1c69-81eb-4e05-b6af-4b7257f36bb4
8
public Vertex getMinDegreeVertexNotInsulated() { Integer[] degrees = new Integer[vertices.length]; for (int i = 0; i < degrees.length; i++) { degrees[i] = 0; } for (Edge edge : edges) { Vertex start = edge.getVertexStart(); Vertex end = edge.getVertexE...
dade9454-dd6c-42c8-b6c4-54ce407898c4
4
public void fireSelectionEvent(final SelectionEvent EVENT) { final EventType TYPE = EVENT.getEventType(); final EventHandler<SelectionEvent> HANDLER; if (SelectionEvent.SELECTED == TYPE) { HANDLER = getOnSelect(); } else if (SelectionEvent.DESELECTED == TYPE) { ...
620a6962-b4ab-4d97-b5eb-0407a9acc1fb
8
public static synchronized void registerDaoWithTableConfig(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } if (dao instanceof BaseDaoImpl) { DatabaseTableConfig<?> tableConfig = ((BaseDaoImp...
bbce1906-04b6-4986-96f8-d5da1e4fec8d
0
@Override public <T extends PersistentObject> T delete(Class<T> entityClass, Long id) { return (T) dataStore.remove(id); }
231ce097-22ab-4032-8db6-548f02165db4
4
private boolean getSymbolFreqBin (CircularDataBuffer circBuf,WaveData waveData,int start) { boolean bit; double early[]=do80FFTBinRequest(circBuf,waveData,start,lowBin,highBin); start=start+((int)samplesPerSymbol50/2); double late[]=do80FFTBinRequest(circBuf,waveData,start,lowBin,highBin); double lowTotal=ear...
71357d81-c30e-4c16-9f42-fe079bd83fef
7
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken()); int b = Integer.parseInt(st.nextToken()); for(int ...
3432cc37-8105-45c3-a5c8-16dc59d4749b
9
public static Statement isHead2Block(Statement head) { if (head.getLastBasicType() != Statement.LASTBASICTYPE_GENERAL) { return null; } // at most one outgoing edge StatEdge edge = null; List<StatEdge> lstSuccs = head.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (!lstSuccs.isEmpty()) { ...
a856ab20-8cf9-41ad-9b19-af1d796413ba
2
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/empresa/form.jsp"); EmpresaBean oEmpresaBean; EmpresaDao oEmpresaDao; oEmpres...
8412faf7-369a-41c6-b373-f500f12d4265
9
private void processTrigger(int[] side, int[] v) { p.println("side "+side); int key = v[1]; int note = v[2]; int depth = v[3]; int channel = 0; if (key == -1) { // note off p.println("stop sound 0"); if (side[0] != -1) { p.println("stop sound 1"); if(side[1] > 1){ channel = 1; }...
ab3b3099-94d6-4f9e-a2af-162c8b3c97ad
7
protected boolean tryMove(int width, int height) { boolean collided = false; for(BB bb : level.collidables) { if(bb.intersects(this.x + this.xa, this.y, width, height)) { if(this.xa > 0) { this.x = bb.getX() - width; } else if(this.xa < 0) { this.x = bb.getX() + bb.ge...
3a54f472-ea18-4625-ad42-d62a4e6d74a0
8
private void buildOutlineElement(Node node, String lineEnding, StringBuffer buf) { indent(node, buf); buf.append("<").append(ELEMENT_OUTLINE).append(" "); if (node.getCommentState() == Node.COMMENT_TRUE) { buf.append(ATTRIBUTE_IS_COMMENT).append("=\"true\" "); } else if (node.getCommentState() == Node.COM...
fcf20cd0-628d-46fe-849a-6357c4d542ff
6
static int readType(StringBuffer sbuf, int pos, String desc) { char c = desc.charAt(pos); int arrayDim = 0; while (c == '[') { arrayDim++; c = desc.charAt(++pos); } if (c == 'L') while (true) { ...
a869afc8-65ed-4be8-bc83-ebb4e5f70268
3
public static void setup(){ System.out.println(clearScreen()); if (debugMode) { player1 = "P1"; player2 = "P2"; return; } do{ System.out.print("Player 1 Name: "); player1 = scanStr.nextLine(); System.out.print(clearScreen() + "Player 2 Name: "); player2 = scanStr.nextLine(); if ...
93ce0011-b622-4d69-86df-af00d1534c24
7
private void loadImages() { try { bgImage = ImageIO.read(getClass().getResource("/tetris.png")); // Draw blocks background Graphics2D gg = (Graphics2D) bgImage.getGraphics(); for (int x = 0; x < model.getColumns(); x++) { for (int y = 0; y < model...
c9c163fd-3485-48d1-9c56-335b8b1b072e
4
public void LeerArchivo(JTextArea textArea) { FileReader leerArchivo=null; try { //Ruta del Archivo ya creado File archivo = new File ("D:\\SmartCliente\\Documents\\persona.txt"); leerArchivo = new...
89c79f8e-e8eb-4d89-890c-90e450161971
0
public static Map<String, Object> initKey() throws Exception { KeyPairGenerator keyPairGen = KeyPairGenerator .getInstance(KEY_ALGORITHM); keyPairGen.initialize(1024); KeyPair keyPair = keyPairGen.generateKeyPair(); // 公钥 RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); // 私钥 RSAPrivate...
a5209209-8a45-419f-910b-d9f5b59c63dc
3
void attaclkPlaceDiagonallyAboveLeft(int position, char[] boardElements, int dimension, int attackPlacesOnTheLeft) { int positionLeftAbove = 1; while (attackPlacesOnTheLeft > 0) { if (isPossibleToPlaceDiagLeftAbove(position, dimension, positionLeftAbove) && isBoardElemen...
deb97782-0e35-468c-adc7-70ef59019017
2
public boolean deleteItem(int index){ // unacceptable index if(index < 0 || index >= getItemCount()) return false; leafItems.remove(index); return true; // success }
e317ae58-cb72-4e3a-a362-4ed1bf7be8d4
1
@Override public boolean equals(Object obj) { if (obj == null) { return false; } return getSuppliercode() == ((Suppliers) obj).getSuppliercode(); }
0b3c0afe-bffa-48dc-a05f-f76dc00a2a6f
4
public void simplify(double simpNum) { if(points.size()>=3) { int i=0; int j=1; while(i<points.size()-1) { while(j<points.size()) { if(getR(points.get(i), points.get(j))<simpNum) {...
4dc46934-b41c-41b6-bb8c-5abc0015305c
1
@Override public int hashCode() { int hash = 3; hash = 79 * hash + (this.string != null ? this.string.hashCode() : 0); return hash; }
42bcc87d-ced1-4367-a317-4d85c5928900
3
@Override public void run() { keep_running = true; readStringFromFile(); last_timestamp = fl_file.lastModified(); while(keep_running) { long cur_timestamp = fl_file.lastModified(); if(last_timestamp != cur_timestamp) { readStringFromFile(); ...
2135e5b1-d048-42ea-903b-73f3e8e7d868
2
public boolean[] getArray(String str, int length) { boolean[] mask = new boolean[length]; List<Integer> idx = new ArrayList<Integer>(); if (length > 1) { idx = parse(str, length); } else // parseRange not happy with "0-*" for length of 1. { idx.ad...
511db91e-0a9a-4b91-a283-32af9c03999d
1
public void visit_pop2(final Instruction inst) { // Form 1 pops two category 1 values off the stack. Form 2 pops // one category 2 value off the stack. final Set top1 = (Set) currStack.removeLast(); final int category = checkCategory(top1); if (category == 1) { // Pop another category 1 off final Set...
446854b6-9ab0-4b8a-ae9b-6d8368bcec43
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Champion other = (Champion) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) retur...
a3e65c12-de0e-4526-8b34-a0e217dbc46d
1
public void setAbstract(final boolean flag) { int modifiers = classInfo.modifiers(); if (flag) { modifiers |= Modifiers.ABSTRACT; } else { modifiers &= ~Modifiers.ABSTRACT; } classInfo.setModifiers(modifiers); this.setDirty(true); }
5944c661-6c32-4f40-ab4c-8efad7b6451e
3
private void setMode( final Mode mode ) { switch( mode ) { case LOAD_FILE: dialog.setMode( FileDialog.LOAD ); break; case SAVE_FILE: dialog.setMode( FileDialog.SAVE ); break; case CHOOSE_DIR: dialog.setMode( FileDialog.LOAD ); dialog.setFilenameFilter( new FilenameFilter() { @O...
36dcd10f-7c95-477b-b3dd-f3477bad7be4
7
public static void evaluateNewProposition(Proposition self) { if (Logic.descriptionModeP() || ((BooleanWrapper)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTIVEp, Stella.FALSE_WRAPPER))).wrapperValue) { return; } { World world = Logic.lookupConstraintPropagationWorl...
ba57019f-2f1a-4c3e-b0bb-cede551204a4
4
public BoardCell pickLocation(Set<BoardCell> targets) { // Create lists to have possible targets. Only pick from rooms not visited if there are any List<BoardCell> choices = new ArrayList<BoardCell>(); List<BoardCell> unvisitedRooms = new ArrayList<BoardCell>(); Random generator = new Random(); for (BoardCe...
8ae6f681-949b-4bab-9197-f65ec0a8e2de
1
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(...
bcc5b1bb-8cef-4d65-92c8-ae45580cbe3e
9
public static final boolean isHaveAnCondition(Class<?> clazz,Class<?> abstractClass,Class<?> interfaceClass,Class<? extends Annotation> annotationClass){ boolean optionCondition=(abstractClass!=null&&IOTypeValidator.isHaveAbstractClass(abstractClass, clazz));// Abstract sınıfa sahip olabilir optionCondition=optionC...
8a34e5c6-4d49-4036-8a03-15c6e7478278
4
public int getHandValue() { Iterator<Integer> it = cards.iterator(); int ret = 0; boolean haveAce = false; while(it.hasNext()) { Integer i = it.next(); int val = getCardValue(i); if( val == 1) { haveAce = true; } ret = ret + val; } if(haveAce && ret<=11) ret+=10; return ret; }
c5efa399-1c37-4ff8-9d96-cec6a2a7a1c0
0
public void pointerReleased(int x, int y) { recognize(); }
c27739de-c673-4c24-89ff-958857ca2ddf
9
public void interrupt() { int a = dcpu.registers[0]; if (a == 0) { for (int i = 0; i < keyBuffer.length; i++) { keyBuffer[i] = 0; } krp = 0; kwp = 0; } else if (a == 1) { if ((dcpu.registers[2] = keyBuffer[(krp & 0x3F)]) != 0) keyBuffer[(krp++ & 0x3F)] = 0; ...
e8cc39ab-edb9-4fcf-bbb9-19447691427a
5
public static void checkGrabbables(){ //Check and respond to hitting grabbables long px = Math.round(player.xCoord); long py = Math.round(player.yCoord); int n; for (n=0;n<grabbable.allGrabbables.size();n++){ if (grabbable.allGrabbables.get(n).world==player.world){ long x = Math.round(grabbable.allGrabb...
91dcf347-9474-4239-b93d-82bd0018aa94
7
public void normalizeTerrain(float value) { float currentMin, currentMax; float height; currentMin = heightData[0][0]; currentMax = heightData[0][0]; //find the min/max values of the height fTemptemptempBuffer for (int i = 0; i < imageHeight; i++) { for (int...
313eb26b-95fa-48a5-b763-1e4485107e75
9
@Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String path = request.getRequestURI(); boolean go = false; String fbdW = PropertiesGetter.getProperty("urlConverter.shorten.f...