method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b783c048-2f4c-4738-adb6-aec885419a4d
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSeq...
74822a71-8a20-4671-9bd4-f5908e585629
3
private void handleInvocation( RemoteMethodEntry entry, Object[] arguments ) throws Exception { RemoteMethod remoteMethod = entry.remoteMethod; Match readMatch = remoteMethod.readMatch(); int readStates = remoteMethod.readStates(); if (readMatch.isMatch( readStates, getStates() ) || ...
9ee26b40-ed49-4aa3-a0eb-f7182ac0ee8a
6
public void renderMap(EntityPlayer par1EntityPlayer, RenderEngine par2RenderEngine, MapData par3MapData) { for (int var4 = 0; var4 < 16384; ++var4) { byte var5 = par3MapData.colors[var4]; if (var5 / 4 == 0) { this.intArray[var4] = (var4 + var4 / 1...
9ee476c9-c3e1-47b6-bb62-1dd6c0df15d5
5
protected void onUpdateGameOver() { long time = System.currentTimeMillis(); int lap = ( int ) ( time - _gameOverStart ); if ( lap > GAME_OVER_DRAW_TIME ) { if ( !_isGameOverRev ) { if ( _gameOverPos.size() == GRID_Y ) { _isGameOverRev = true; _grid = new short[ GRID_Y ][ GRID_X ]; ...
80d4a5a0-a5b7-4162-9490-efb4abff8e9e
8
private void workloadClassify() { createRequestList(); Random rd=new Random(seed); double reservedMean=0.75; double ondemandMean=0.5; double spotMean=0.25; double std=0.3; int n=this.requestList.size(); int reservedCnt=17000; int spotCnt=120000; SortedMap<Double, RequestType> sm=new TreeMap<Double,...
86ba268e-32b0-46f3-ae0b-15cf0f3b30e2
5
public CompositeGateClass(String gateName, HDLTokenizer input, PinInfo[] inputPinsInfo, PinInfo[] outputPinsInfo) throws HDLException { super(gateName, inputPinsInfo, outputPinsInfo); partsList = new Vector(); internalPinsInfo = new Vector(); connections = new ConnectionSet(); ...
d7813e39-6a86-4a80-a9c2-4b49cc08a824
7
@Override public Auctioneer getAuctionHouse(String chain, String areaNameOrBranch) { for (final Auctioneer C : auctionHouseList) { if((C.auctionHouse().equalsIgnoreCase(chain)) &&(C.auctionHouse().equalsIgnoreCase(areaNameOrBranch))) return C; } final Area A=findArea(areaNameOrBranch); if(A==null...
e09cf8c1-50ef-43b0-99e3-45ae508f2f57
7
public ArrayList<Bank> withBanks() { if (!Constants.Banking) { return null; } Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; ArrayList<Bank> banks = new ArrayList<Bank>(); try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepa...
45ed748d-740f-4ef9-97f3-7dba6ae43d94
6
@Override public ArrayList<seed> move(ArrayList<Pair> treelist, double width, double length, double s) { // TODO Auto-generated method stub ArrayList<seed> seedlist = new ArrayList<seed>(); for (double i = distowall; i < width - distowall; i = i + distoseed) { for (double j = distowall; j < length - distowal...
49fa4764-42db-4d87-a01e-19a7b0d53305
6
public JPanel Menu() { JPanel buttons = new JPanel(); buttons.setLayout(new GridBagLayout()); buttons.setBackground(new Color(255, 231, 186)); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5,5,5,5); ImageIcon titleImg = new ImageIcon("ui/title.pn...
079659d7-162e-45a5-b9cb-124730eae005
2
private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed int linhaSelecionada = -1; linhaSelecionada = tabela.getSelectedRow(); if (linhaSelecionada >= 0) { int idUsuario = (int) tabela.getValueAt(linhaSelecionada, 0); ...
80b85b04-8f31-4827-8aa8-0ea03a41052e
8
@Override public void setImages() { if (waitImage == null) { File imageFile = new File(Structure.baseDir + "topdownturret40.png"); try { waitImage = ImageIO.read(imageFile); } catch (IOException e) { e.printStackTrace(); } } if (attackImage == null) { File imageFile = new File(Structure....
1e4b0220-8600-49a5-b816-a453206edaac
6
public void run() { while(!isClosed) { final String currentSpin = spinLabel.getText(); final String nextSpin; if(currentSpin.equals("-")) nextSpin = "\\"; else if(currentSpin.equals("\\")) nextSpi...
2d42a55d-1ffb-42b0-afb3-d35fe5812d3e
1
private static void printLines(String name, InputStream ins) throws Exception { String line = null; BufferedReader in = new BufferedReader(new InputStreamReader(ins)); while ((line = in.readLine()) != null) { System.out.println(name + " " + line); } }
26cd3ff3-c3eb-48bb-b763-df98c9a22de9
5
protected SoundPlayer() { this.buffers = new ArrayList<SoundPlay>(); AudioFormat format = new AudioFormat(44100.0f, 16, 2, true, false); try { this.line = AudioSystem.getSourceDataLine(format); this.line.open(format, 4410); this.line.start(); this.thread = new Thread(new Runnable() { @Override ...
6e12259c-e2bb-425a-9884-900908cb4d16
8
private void runTestsWithApexQuery() throws ConnectionException { List<String> declaredClassNames = this.getClassNames(); List<String> classList = new ArrayList<String>(); System.out.println("Declared classes to test: "); for (String f : declaredClassNames) { System.out.println("\t" + f); } List<String>...
941f2225-c2dd-46ba-aa0f-c1846d5b7c5d
1
@SuppressWarnings("unchecked") private Item[] resize(int newCapacity) { Item[] t = (Item[]) new Object[newCapacity]; for (int i = 0, j = front; i < size(); i++, j = (j + 1) % N) t[i] = q[j]; N = newCapacity; front = 0; return t; }
b56842fd-e14c-4d88-9abc-8af6763eceaf
5
public T get(int index) { if (index < 0 || index >= this.size) throw new IndexOutOfBoundsException(); // handle ask for head if (index == 0) return this.head.data; // handle ask for tail else if (index == this.size - 1) return this.tail.data; // handle ask for anything else else { MyNod...
39e19b33-9e2f-4771-8e71-7e808dbe2529
2
@Override public Connection open() { if (initialize()) { try { this.connection = DriverManager.getConnection("jdbc:sqlite:" + sqlFile.getAbsolutePath()); return this.connection; } catch (SQLException e) { this.wr...
26fa135d-fc10-4c8b-9e9a-e9e0186622bb
2
public void update() throws ModelException { TradeKingForeman foreman = new TradeKingForeman(); XMLHandler handler = new XMLHandler(); try { response = foreman.makeAPICall(OrdersBuilder.preview(a.getId(), b.build().toString(), ResponseFormat.XML)); } catch (ForemanException | UtilityException e) { ...
0eb3bea1-d194-40ed-90c4-44182b0ea27f
5
@Override public int getGrade(Node<T> n) { if (!(n instanceof BinaryNodePS)) { throw new DifferentNodeTypesException(); } else if (isSafe() && !contains(n)) { throw new NodeNotFoundException(); } int grade = 0; BinaryNodePS<T> bn = (BinaryNodePS<T>) n; if (bn.getLeft() != null) { grade++; } if...
7e8f926c-0f70-4ea7-9a67-0f37e9e2f568
0
public void register(PeerActivityListener listener) { this.listeners.add(listener); }
d429bace-d984-4678-9a2b-92e0fc00ed94
8
public Vector<Affix> getAffixList(String _type){ StringBuffer sb= new StringBuffer(""); String str = null; String[] affixlist; FileReader reader = null; try { if(_type.equals("p")){ reader = new FileReader("g:\\prefixlist.txt"); }else if(_type.equals("s")){ reader = new Fi...
4f4ffbf0-5fb5-480b-a70c-11aa818f6bba
9
private void predictClassLabel(Instance instance){ int size = model.getNumOfClassLabel(); double[] likelihoods = new double[size]; for(int i=0;i<size;i++){ likelihoods[i] = (double)1; } for(int i=0;i<size;i++){ double[][][] attributes_likelihoods = model.getAttributes_likelihoods(); for(int j=0;j<att...
be96a421-e1f7-4bb6-9662-a31de6ba9af9
6
public static int uniquePaths3(int m, int n) { m--; n--; double numerator = 1; double denominator1 = 1; double denominator2 = 1; int i = 1; while (true) { if (i <= m + n) numerator *= i; else break; i++; } i = 1; while (true) { if (i <= m) denominator1 *= i; else break...
e6857d12-ae6c-4e77-84e5-d930b173b750
8
@Override public Boolean modificarCliente(TCliente cliente) throws Exception { Statement query = null; Connection connection = null; String contenido_query = "UPDATE Clientes SET DNI='" + cliente.getDNI() + "', Nombre='" + cliente.getNombre() + "', Apellidos='" ...
1803845c-0bfb-48df-a071-2ed92b37fbf0
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
a2dc6bda-1cad-43f4-880c-28427ae0ef05
0
@Override public PropertyFilter getFilter(int index) throws IndexOutOfBoundsException { return (PropertyFilter) filters.get(index); }
e653b525-2582-4f60-ad02-389e5b3dbbf9
7
@Override public int hashCode() { int hash = 3; hash = 61 * hash + (this.id != null ? this.id.hashCode() : 0); hash = 61 * hash + (this.login != null ? this.login.hashCode() : 0); hash = 61 * hash + (this.password != null ? this.password.hashCode() : 0); hash = 61 * hash + (t...
b3a879fe-814f-4eb9-a4db-11cd8a3ba4fb
3
public boolean addTrainerToBooking(Connection conn) throws SQLException { boolean success = false; int trainerID = 0; String sportsType = sb.getSportsType(); String SQLString1 = "select trainerID from trainer where sportstype = ?"; String SQLString2 = "insert into trainerBooking ...
8f760765-3a36-4962-b9dc-fce9c9895c95
4
@Test public void resolve() { int N=20; long [][] grid=new long[N+1][N+1]; for(int i=N;i>=0;i--){ for(int j=N;j>=0;j--){ if(i==N||j==N){ grid[i][j]=1; }else{ grid[i][j]=grid[i][j+1]+grid[i+1][j]; } } } print(grid[0][0]); }
00b21499-6b99-4ec4-90d0-ac61b93578b8
9
private void playString(String playString) { //@TODO code to play string in morse :) //@TODO NEEDS ByteArrayOutpuStream to work! ByteArrayOutputStream bbout = new ByteArrayOutputStream(); char charToPlay; int sLength = playString.length(); byte[] playWave = new byte[32]; ...
883862ac-efc2-45e1-9970-33777b1c1374
6
@Override public boolean equals(Object obj) { Boolean totuus = false; if (obj instanceof OstosLista) { OstosLista toinen = (OstosLista)obj; if (this.size() <= toinen.size()) { OstosLista tmp = new OstosLista(this);...
dc398abe-0d34-4910-8d6a-88494b17290f
6
void initGame() { HexOperations.setXYasVertex(false); HexOperations.setHeight(HEXSIZE); HexOperations.setBorders(BORDERS); for (int i = 0; i < BSIZE; i++) { for (int j = 0; j < BSIZE; j++) { board[i][j] = EMPTY; } } //set up boa...
286d5a7f-7c93-4fce-a987-8939053b8dbb
3
public String getJson() { try { /* Create a URL obj from strings */ url = new URL((QUERY_URL.concat(word)).replace(" ", "%20")); System.out.println(fullUrl); conn = url.openConnection(); // Get the response rd = new BufferedReader(new InputStreamReader(conn.getInputStream()))...
51d3411a-cd86-4a28-b02d-c9f85cb97110
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
88675832-7392-4efb-985e-7071b3c579a5
1
public WumpusPerception eventTurnLeft(AID hunterAID) { if(log.isLoggable(Logger.INFO)) log.log(Logger.INFO, "eventTurnLeft()"); Hunter hunter = getHunter(hunterAID); hunter = hunter.turnLeft(); int xCoord = hunter.getxCoord(); int yCoord = hunter.getyCoord(); WumpusPerception perception = getP...
ac56f62e-8796-4a17-b947-75abfba07c79
0
public PisteTest() { }
94971fd3-67fc-439c-bc9f-234514769a7c
4
public void startGUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { Logger.getLogger(LoginScreen.class.getName()) .log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { ...
0b93445d-e11c-4e24-b459-a5a965d1a95f
2
private void processFiles( List<String> files ) { Parser parser = new Parser(); Table table = null; List<String> classNames = new ArrayList<String>(); for ( String file : files ) { table = parser.parse( file ); table.setPackage( basePkg ); if ( classN...
a76dd799-af9f-4313-91c6-49b926318750
4
public Subject(SubjectID primary, Node memberNode) throws XPathExpressionException { // Get the restrictions. this.restrictions = null; String restrictions = Utilities.getAttributeValue(memberNode, "restrictions"); if(!Utilities.isNullOrWhitespace(restrictions)) { this.restrictions = Restrictions.valueOf(re...
de8033e5-588b-46c6-b9d0-0804d1829e7a
9
public Token next() throws IOException { String lexeme = ""; int value = 0; int count = 0; do { value = read(); if (value == EOF) { return Token.generate(Token.Kind.EOF, lineNumber, charPosition); } if (value == WS || value == TAB) { continue; } lexeme += (char) value; if ((le...
960ca6bf-23a1-493e-9eac-9060974575c8
9
public void sendOrder() { //query the orders table by order number // ArrayList<Item> order = new ArrayList<Item>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String commandArg = null; System.out.println("Please enter the name of the manufacturer."); String manu = ""; ...
1848ab9f-78be-4bbb-82ae-b51217ba2a69
0
final public void setConfidence(int new_confidence) { throw new UnsupportedOperationException("setConfidence not implemented"); }
29c4f359-c3af-48b9-9b4a-704fccd9ce0e
8
public static void log() { boolean full = larvikGaming.getConfig().getBoolean("Full-Logger", true); boolean info = larvikGaming.getConfig().getBoolean("Info-Logger", false); boolean warning = larvikGaming.getConfig().getBoolean("Warning-Logger", true); boolean severe = larvikGaming.getConfig().getBoolean("Sever...
185cf86a-30a2-4677-8227-8b06eef0fd55
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Vak other = (Vak) obj; if (id != other.id) return false; return true; }
300cd9f7-9432-4742-a0ad-7ba67b897815
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WordAttributes other = (WordAttributes) obj; if (color == null) { if (other.color != null) return false; } else if (!color.equals(other....
2b52bce2-02bc-470d-94ab-5523a4806f4b
7
private void restoreBlogStatus() { try { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(new FileInputStream(statusFilename))); String line = null; while ((line = reader.readLine()) != null) { if (!line.contains("<article")) { continue; } Ha...
b5d2706e-cd42-4377-be85-1ba35b7d1aa7
5
private void addState(SearchState state, int dist, int edgeDist) { int estimatedDist = dist + h.estimateCostToGoal(state); if (estimatedDist >= OO) return; SearchState oldState = stateSet.get(state); if (oldState == null) { stateSet.put(state, state); oldState = state; } if (s...
50cee417-3d31-4f02-ad4b-fd446b4e335f
4
private void loadFile() throws IOException { InputStream inp = new FileInputStream(inputFile); //InputStream inp = new FileInputStream("workbook.xlsx"); Workbook wb = new XSSFWorkbook(inp); Sheet sheet = wb.getSheetAt(0); int lastRowNum = sheet.getLastRowNum(); for (int ...
81991e4d-e743-4110-a90c-fd39e1307313
1
public double reduceDamage(double damage){ double temp = damage - armorItem.getDefenseScore(); if(temp <0) temp = 0; return temp; }
52239542-f504-47e9-acd2-41b33a7a85d0
7
* @return the id of the new version */ public int newVersion( String shortName, String longName, String group, short backup, boolean partial ) { short gId = findGroup( group ); if ( gId == 0 && group != null && group.length()> 0 ) { Group g = new Group( (short)0, group ); groups.add( g ); gId = (...
b6a38368-26ee-40a0-bd67-bf690d2d5224
9
protected Hashtable<String, Object> communicateWithNeo4jServer(String json) throws SystemFailure { Hashtable<String, Object> responseData = null; HttpPost createNodePost = new HttpPost(_serverUrl); createNodePost.setHeader("Accept", "application/json; charset=UTF-8"); createNodePost.setHeader("Content-Typ...
057f5f73-4468-4b11-b6f7-2995ba5d4c44
7
protected void buildDesc(Room room, int dir, String designDescription) { synchronized(("SYNC"+room.roomID()).intern()) { room=CMLib.map().getRoom(room); if(dir>=0) { Exit E=room.getExitInDir(dir); if((!E.isGeneric())&&(room.getRawExit(dir)==E)) { E=generify(E); room.setRawExit(dir,E)...
d65c8561-3d93-4e63-92fd-9fff59e3ee74
6
public void startupScan(Path directory) { String status = db.getConfig("startupScan"); // Check if user disabled the scan if(status != null && !status.equals("true")) { logger.info("Startup scan is disabled."); return; } for(File file : directory.toFile().listFiles()) { if(file.isDirectory()) ...
6d4ff948-8eb8-47f8-b259-3daaa5272103
7
public static int[] solution(int N, int[] A) { int[] result = new int[N]; int maxCounter = 0; int inc = 0; for(int i = 0 ; i < A.length ; i++){ if(A[i] <= N){ if(result[A[i] - 1] < inc) { result[A[i] - 1] = inc; } ...
6527da8f-8921-488d-b70d-ae95abd495ec
3
public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
9f7b5e9f-14fc-4b8b-97f7-1457dc80e4a4
9
public static void main(String[] args) throws IOException { CovertChannel cc = new CovertChannel(); boolean verbose = false; //used to determine whether we will create a log file // LOW and HIGH are constants defined in the SecurityLevel // class, such that HIGH dominates LOW. SecurityLevel low = Sec...
7d0044db-f4bc-42c0-a765-88efda72b290
2
public static String analyzeMessage(UserNChatThread user, String chat){ String outputText = "null test"; if( !chat.equals("") ){ if( chat.charAt(0) == '/' ){ outputText = executeCommand(user, chat); }else{ outputText = chat; } } return outputText; }
07a17634-d4b5-4bf6-b71e-a29c96c27e9a
0
public QuestionPanel() { setFocusable(false); questionTextArea = new SingleQuestionTextArea(); answerTextArea = new SingleQuestionTextArea(); BoxLayout boxLayout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(boxLayout); add(questionTextArea); add(Box.c...
c8886c70-b23a-43a5-a6a0-8ee9eb1fd6af
5
private static Point[][] get16PlayersPositions() { int maxPlayers = 16; Point[][] pos = new Point[8][128]; for(int i = 0; i < maxPlayers;i++ ){ pos [0][i] = new Point(0,2*i); } for(int i = 0; i < maxPlayers/2;i++ ){ pos [1][i] = new Point(2 ,1+4*i); } for(int i = 0; i < maxPlayers/4;i++ ){ pos [...
92a7f49f-c194-4e4e-ad14-f5d8aa40dd8c
5
*/ private void getSpectrumForQuery(String searchName) { List<String> result = new ArrayList<String>(); try { DbAccessor.createConnection(); CompoundLogic compoundLogic = new CompoundLogic(); LOGGER.info("search records by keyword || " + searchName); List<Compound> compoundList = compoundLogic.getCo...
4445482f-004a-4863-9f41-c5f62a1246f8
7
public int longestIncreasingSub(int[] arr) { int longestSSCount = 0; int currIndex = 0; int n = arr.length; int[] lis = new int[n]; int[] path = new int[n]; for (int i = 0; i < n; i++) { lis[i] = 1; path[i] = -1; } for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { if(arr[i] > ar...
9b7df889-ff14-46db-9f3e-528a65687bff
4
public static void moveElementToHead(Vector someVector, int index) { // size is useful int size = someVector.size(); // validate parameters // also leave if element is already at the head if ((someVector == null) || (index <= 0) || (index >= size)) { return ; } // end if // grab the element to...
874fa0d1-3d90-49f9-a102-2e72196c40f0
2
public String encrypt(String inputFileName, String key) throws Exception { SecretKeySpec tempKey = null; System.out.println("Encrypted File: " + inputFileName); FileInputStream inputStream = new FileInputStream(inputFileName); // create the output file after encryption add an extension .cheng File tmpFile = n...
6f593455-76d1-4c2f-8c25-4b28070395d1
8
public static void main(String args[]) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (int N,t=1;(N=parseInt(in.readLine().trim()))!=0;t++) { String num=""; int cant=0; sb.append("Case ").append(t).append(":\n"); ...
ea52446e-b006-49ae-9f8c-edbf10822a82
0
public boolean AddUser(IrcUser user){ return Users.add(user);}
f0886d0e-721a-419f-8812-67cba1cda0f1
5
@PUT @Path("/modifyEvent") @Consumes(MediaType.APPLICATION_JSON) public Response modifyEvent(String jsonObject) { Gson gson = new GsonBuilder().setDateFormat(WS_DATE_PATTERN).create(); Event event = null; try { event = gson.fromJson(jsonObject, Event.class); } catch (JsonSyntaxException e1) { try { ...
8d0967e7-6ce3-4c08-bb93-df522f2eda2c
4
public static Mask buildSobelMask(Direction d) { switch (d) { case VERTICAL: double[][] dValues = { { 1, 0, -1 }, { 2, 0, -2 }, { 1, 0, -1 } }; return new Mask(dValues); case HORIZONTAL: double[][] aValues = { { 1, 2, 1 }, { 0, 0, 0 }, { -1, -2, -1 } }; return new Mask(aValues); case DIAGONAL: do...
e3d65e4c-d67b-470e-ae4c-11967c4a542c
4
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_A) { dx = 0; } if (key == KeyEvent.VK_D) { dx = 0; } if (key == KeyEvent.VK_W) { dy = 0; } if (ke...
b3d9c902-5e1b-48d7-9be6-efe5d99e0d87
3
protected boolean checkAreas() { boolean result = false; synchronized (planAreas) { for (PlanArea area : planAreas) { if (!area.isCommitted()) { continue; } if (area.buildFromSupply(1)) { result = true; } } } return result; }
3ec283fe-b580-4564-b891-3e702847852d
1
public void addTriangles( ArrayList<Triangle> triangles ) { int size = triangles.size(); this.triangles.addAll( triangles ); if ( resource.getVbo().capacity() > resource.getVbo().limit() + ( size * 3 * 9 ) ) { FloatBuffer tmpVbo = Utils.createFlippedBuffer( triangles ); resource.getVbo().limit( tmpVbo....
67ee7a50-db6e-421a-9f54-ca032d5c584d
1
@Override public Class<?> getColumnClass(int sarakeIndeksi) { return tyypit[sarakeIndeksi]; }
82a70eb4-027d-40fe-af4e-b67b33c60d79
6
public void updateLeft(){ if(left > 0){ for(int i=0; i<height+top; i++){ for(int j=0; j<left; j++){ drawDiamond(j, i); } } } else if(left < 0){ for(int i=top; i<height+top; i++){ for(int j=-1;...
f22c76e4-7907-4fb8-b9e9-36d59597118f
4
private int search(TreeNode root, String query, int d, int length){ if(root == null) return length; if(root.value != null) length = d; if(d == query.length()) return length; char c = query.charAt(d); if(root.children.containsKey(c)){ return search(root.children.get(c), query, d + 1, length); ...
681b6c56-e83d-40b4-af70-d7b5ad227835
5
public static void main(String[] args) { if (args.length != 3) { System.out.println(USAGE); System.exit(0); } String name = args[0]; InetAddress addr = null; int port = 0; Socket sock = null; // check args[1] - the IP-adress try { addr = InetAddress.getByName(args[1]); } catch (UnknownHostE...
bd742f60-5941-4e5a-aa1c-91a297ec8ee0
3
public static Packet parse(DatagramPacket packet) throws IllegalArgumentException, AssertionError { Packet rad; try { ByteBuffer bb = ByteBuffer.wrap(packet.getData()); int packetCode = bb.get(); int packetIdentifier = bb.get(); int packetLength = bb.getSh...
f0a14917-a9e4-4973-a8ff-edad3a070a0f
7
private List<Class<?>> getTypeHierarchy(Class<?> type) { if (type.isPrimitive()) { type = primitiveTypeToWrapperMap.get(type); } Set<Class<?>> typeHierarchy = new LinkedHashSet<Class<?>>(); collectTypeHierarchy(typeHierarchy, type); if (type.isArray()) { typeHierarchy.add(Object[].class); } ...
bbfe18d3-f015-45bb-b177-3f53017a6d85
1
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked JTextPane jtp = new JTextPane(); jtp.setBackground(Color.white); jtp.setText(text); boolean show = true; try { jtp.print(null, null, show, null, null, show); } catch (java.awt.print.PrinterException ex...
e2246164-db85-46e0-b02c-e78ca4551d96
7
public Object clone() throws CloneNotSupportedException { CompassPlot clone = (CompassPlot) super.clone(); if (this.circle1 != null) { clone.circle1 = (Ellipse2D) this.circle1.clone(); } if (this.circle2 != null) { clone.circle2 = (Ellipse2D) this.circle2.clone()...
44da2267-09c3-4287-b430-737d49cae7f8
1
public synchronized WorkerThread borrowThread() { // TODO Auto-generated constructor stub if (idleThreads.isEmpty()) { return null; } return idleThreads.remove(0); }
d032478e-71bb-4a42-ba7b-4bcd202a5c4e
9
public Elevator CallDown(int fromFloor){ //check for error cases if ((fromFloor>super.numFloors) || (fromFloor<0)){ System.out.println("This floor does not exist"); } //first we will send the first idle elevator for (Elevator e: elevators){ synchronized(e){ //if the elevator is idle //or if the ...
a416b518-aae7-406b-9b87-9cb824ac4dc5
1
public final EsperParser.forloop_return forloop() throws RecognitionException { EsperParser.forloop_return retval = new EsperParser.forloop_return(); retval.start = input.LT(1); Object root_0 = null; Token ENDFOR46=null; EsperParser.for__return for_45 =null; Object E...
054fce0f-09ea-4c0d-b414-ef94ad5084fb
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tag tag = (Tag) o; return type == tag.type && value.equals(tag.value); }
5a7b4783-6d14-4d96-b0a5-272f1032a8ce
6
public void bet (String[][] playerName,int[][] price,boolean cpu){ for(int i=0;i < menberNum;i++){ if(i==0){ if(cpu==true){ /////cpuの賭け金の設定 if(price[0][0]>cpuPrice*0.4){ //4割を切るまでは price[0][1] =(int)(price[0][0]*0.2);//10分の1を賭ける }else{ price[0][1] =price[0][0]; //4割を切ると全賭け ...
5fabca77-5dae-417d-832f-b18fcc985177
0
public UpgradeType getType() { return type; }
42fc0242-947e-493e-8190-3fe3eedf161c
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
3722ab95-0672-4666-89ef-60aa0c9c98bc
7
public String obfuscateText(String _text) { // Obfuscated code will return by using StringBuilder; StringBuilder sb = new StringBuilder(); // Change text to Char array. char ch[] = _text.toCharArray(); // Make String array per 1 character from ch[]. // This String array uses to check key character and etc....
28ada532-805b-429c-bcaf-a5e9b7a594b1
8
public static void main( String[ ] args ) throws IOException { BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); String line = in.readLine( ); int t = Integer.parseInt( line ); int arr[][] = new int[ t + 1 ][ t + 1 ]; int dp[][] = new int[ t + 1 ][ t + 1 ]; for ( int i = 0; i < ...
e0abdb08-310b-47a0-bb41-e1666d2b6bd0
6
private void getData(ProtobufDecodeMeta consumerMeta, boolean copyStepname) { if (copyStepname) { wStepname.setText(stepname); } wInputField.setText(Const.NVL(consumerMeta.getInputField(), "")); StringBuilder cpBuf = new StringBuilder(); String[] classpath = consumerMeta.getClasspath(); if (classpath !=...
ff761970-8b46-4c8e-93e1-a4883deb5b1d
5
public static Tag<Map<String, Tag>> newCompound(Map<String, ?> data) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException { Map<String, Tag> map; try { for(O...
4876c7f2-932b-42f2-aae6-b302d1ff3432
0
public void accapt(Visitor visitor) { // 关键实现 visitor.visit(this); }
37c72e88-cf88-405b-b392-fdb0ba9c0350
1
public void toggleVisible() { if(frame == null) buildGUI(); frame.setVisible(!frame.isVisible()); }
7d7c21ce-73d0-474f-924e-bd58f956f8a1
3
private void creerActions(){ actions = new HashMap<String, Action>(); for(int i = 0 ; i < 9 ; i++ ){ for(int j = 0 ; j < 9 ; j++ ){ for(int k = 1 ; k <= 9 ; k++){ actions.put(i+""+j+""+k, new DynamicAction(i+""+j+""+k)); } } } }
e8b3b265-94bd-4543-b80d-c192fcda38dc
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); session.removeAttribute("error...
8d9f4904-a1fd-43ea-af24-a3edbb6cf7e1
7
public static MultiAnswerQuestion getMultiAnswerQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) { int quizID = quiz.quizID; int position = pos; Object question = null; Object answer = null; double score = 10; int answerNumber = 0; boolean isOrdered = false; if (root.attributeMap.containsKey("isor...
18a7f6a1-a06b-4b88-af12-df4b02099e6c
7
IRCDDBExtApp.UpdateResult processUpdate ( int tableID, Scanner s, String ircUser, String msg ) { if (s.hasNext(datePattern)) { String d = s.next(datePattern); if (s.hasNext(timePattern)) { String t = s.next(timePattern); Date dbDate = null; try { dbDate = parseDateForma...
2ebc9b02-0066-40f0-93a1-9652dee9efbc
1
public JSONArray optJSONArray(String key) { Object o = opt(key); return o instanceof JSONArray ? (JSONArray)o : null; }
76abceb8-e0b0-4881-b5b3-13de233c063f
8
String[] countWords(String sentence, int returnWordCount) { // check input parameter if (sentence == null || sentence.isEmpty()) { System.out.println("Sentence not defined"); return null; } // check input parameter if (returnWordCount <= 0) { System.out.println("Return Words must be greater tha...
7061b308-c026-4d67-a85a-78b9d6794371
6
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Pair)) return false; final Pair pair = (Pair) o; if (first != null ? !first.equals(pair.first) : pair.first != null) return false; if (second != null ? !second.equals(pair.second) : pair.second != null) return false; ...