method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
73ca9894-9cd0-4354-863f-a4f21e5d9a6b | 6 | @Override
public void keyTyped(KeyEvent event) {
char ch = event.getKeyChar();
if (ch == '\n' || ch == '\r') {
if (canOpenSelection()) {
openSelection();
}
event.consume();
} else if (ch == '\b' || ch == KeyEvent.VK_DELETE) {
if (canDeleteSelection()) {
deleteSelection();
}
event.consum... |
03e74ce2-6fed-420e-87c9-e87cc02fd0ee | 9 | public void solve(char[][] board) {
if (board == null || board.length == 0 || board[0].length == 0) {
return;
}
int length = board[0].length - 1;
int height = board.length - 1;
for (int i = 0; i < length; i++) {
fill(board, 0, i);
fill(board, height, length - i);
}
for (int j = 0; j < height; j++... |
eefd636c-b341-45ee-901d-6cbbc22964cf | 4 | @Override
public Program mutate(Program program) throws InvalidProgramException {
if (!(program instanceof ProgramImpl)) {
throw new InvalidProgramException();
}
Random randomGenerator = new Random();
ProgramImpl program1 = (ProgramImpl) program.clone();
List<Reaction> reactions = program1.getReactions();... |
66b8b277-6844-4921-822b-c40dc899469f | 2 | public String update(String string, String string2) {
// TODO Auto-generated method stub
for (int i = 0; i < clientObj.length; i++) {
if((clientObj[i].getPassword()).equals(string)){
clientObj[i].setEmail(string2);
return clientObj[i].getEmail();
}
}
return null;
} |
d0d8935e-90d8-4096-906e-f170a0d608d4 | 7 | public OptionsPanel(Handler handler, boolean optioncollapsed, int random) {
super();
if(random == 0) color = "_green";
else if(random == 1) color = "_blue";
else color = "_orange";
this.setLayout(new MigLayout("fill"));
this.setBackground(Color.black);
JPanel t... |
8589a643-b110-48e6-bbb6-e491bdf9296c | 8 | public void AllPairsShortestPath(int[][] matrix) {
int numberVertices = matrix.length;
// create new storage container for path and weight information
pathWeights = new int[numberVertices][numberVertices];
// Initialise containers;
for (int i = 0; i < numberVertices; i++) {
for (int j = 0; j... |
d9088622-6051-4188-ae3a-2c3c7ad7ddd6 | 4 | public boolean matches(String word) {
if (word.length() != string.length()) {
return false;
}
for (int i=0; i<word.length(); i++) {
if (string.charAt(i) != ANY_CHAR && string.charAt(i) != word.charAt(i)) {
return false;
}
}
return true;
} |
6d9e682e-d8dd-495d-95ad-1cf07d10a15d | 2 | public void tilesetLaden(BufferedImage set){
tiles = new ArrayList<Tile>();
int Anzahl_x = set.getWidth()/32;
int Anzahl_y = set.getHeight()/32;
for(int x=0;x<Anzahl_x;x++){
for(int y=0;y<Anzahl_y;y++){
Tile t = new Tile((set.getSubimage(x*32, y*32, 32, 32)));
/*index
* 0 gras
* 1 ... |
69f362f8-2f04-4ac5-8ccb-87c057054669 | 6 | public static Integer[][] crossover(Integer[] parent1, Integer[] parent2)
{
Integer[] child1 = new Integer[matrixSize] ;
Integer[] child2 = new Integer[matrixSize] ;
Integer[][] result = new Integer[2][matrixSize] ;
int i = 0, parent1Pos = 0, parent2Pos = 0 ;
... |
e23d1d9a-5107-44d4-9deb-e05b2b7d795f | 7 | public void put(long key, E value) {
int i = ContainerHelpers.binarySearch(mKeys, mSize, key);
if (i >= 0) {
mValues[i] = value;
} else {
i = ~i;
if (i < mSize && mValues[i] == DELETED) {
mKeys[i] = key;
mValues[i] = value;
... |
0450d148-9771-42a5-bb4f-5a5ac854d232 | 1 | public static void defineEnemies(int level){
enemyDim.clear();
enemyDim.put("skeleton", new int[]{26, 46});
try {
skeleton.add(ImageIO.read(CharacterManager.class.getClassLoader().getResourceAsStream("images/Skeleton1.png")));
skeleton.add(ImageIO.read(CharacterManager.class.getClassLoader().getResourceAsSt... |
427a5094-9297-4f92-8c7e-a7da3c5f5ff1 | 9 | private void loadGUIFromOperator() {
String code = operator.getCode();
String filialCode = operator.getFilialCode();
String firstName = operator.getFirstName();
String surName = operator.getSurName();
String parentName = operator.getParentName();
String password = operator.getPassword();
Boolean contr... |
4fe0c96f-de30-46f1-92fa-4ced86943aad | 3 | @Override
public void deserialize(Buffer buf) {
id = buf.readShort();
if (id < 0)
throw new RuntimeException("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0");
finishedlevel = buf.readShort();
if (finishedlevel < 0 || finishedlevel... |
7c3af751-1589-415f-8efc-51f6f04d74d9 | 8 | @Override
protected List<CharPoint> getNeighbors(CharPoint field) {
List<CharPoint> neighbors = new ArrayList<CharPoint>(this.neighbors.length);
int x = field.getX();
int y = field.getY();
for (int xx = x - 1; xx <= x + 1; xx++) {
for (int yy = y - 1; yy <= y + 1; yy++) {
if (xx == x && yy == y)
co... |
c29666a6-e699-49e1-97df-9d3ade31abe5 | 2 | public ChatChannel[] getAllChatChannels(){
ChatChannel channels[] = null;
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sqlState... |
43874550-8803-47d5-82be-77e30f220530 | 7 | public int accessMemVictimCache(int smpIndexFrom, int numCPUFrom, int smpIndexTo, int numCPUTo, int cacheIndex, int startTime){
int n = getNumberSyncObjectsUntil(smpIndexTo);
SMPNodeConfig smpNodeCfg=Configuration.getInstance().smpNodeConfigs.get(smpIndexTo);
n+=1+smpNodeCfg.cacheConfigsPT.size();
if(smpNodeCfg... |
38e93f99-927f-4d51-a086-57ee66dbf910 | 3 | public Main_Window() {
// TODO Auto-generated constructor stub
final JFrame main_frame = new JFrame("stt");
main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JScrollPane content = new JScrollPane();
//content.setLayout(new FlowLayout());
main_frame.add(content);
source_code.setBorder(BorderFacto... |
53f1b13f-18a4-45ef-b361-ce99d901b708 | 5 | public int compareTo(Point o) {
if (getX() < o.getX()) {
return -1;
} else if ((getX() == o.getX()) && (getY() == o.getY())) {
return 0;
} else if ((getX() == o.getX()) && (getY() < o.getY())) {
return -1;
}
return 1;
} |
f573b3e1-095d-41db-ad9d-3b31a5b70fbd | 6 | private void calculerHeuresLivraison() throws HorsPlageException {
int tempsSecondes;
List<Troncon> listTroncons;
PlageHoraire plage = null;
Calendar heureDebut = Calendar.getInstance();
double vitesseKmH=0;
for(Chemin chemin : this.getCheminsResultats()) {
... |
ace7f79b-ed94-4fbe-9397-a43dcb0e3f8e | 9 | public StackFrame()
{
// first create the buttons and widgets to put on the frame
pushButton = new JButton("Push Item");
popButton = new JButton("Pop Item");
peekButton = new JButton("Peek At Stack");
showButton = new JButton("Show Stack");
sizeButton = new JButton("... |
819139b9-a18a-49f1-80f7-7007bba2eb6c | 8 | public boolean isAnyKindOfOfficer(Law laws, MOB M)
{
if((M.isMonster())
&&(M.location()!=null)
&&(CMLib.flags().isMobile(M)))
{
if((laws.officerNames().size()<=0)
||(laws.officerNames().get(0).equals("@")))
return false;
for(int i=0;i<laws.officerNames().size();i++)
{
if((CMLib.english().co... |
65d01527-dd8b-4a65-9da9-70e30661c92c | 0 | public double getVitality() {
return vitality;
} |
dbd39aab-26cc-446b-b0d5-ce35446ab8ff | 4 | public void setTool(int tool) {
hp.setTool(tool);
if(tool == 0) {
pencil.setSelected(true);
} else if(tool == 1) {
fill.setSelected(true);
} else if(tool == 2) {
chooser.setSelected(true);
} else if(tool == 3) {
line.setSelected(true);
}
curTool = tool;
} |
e22ce793-07f2-4f7b-b19c-a45f92aa3298 | 4 | public String readUntil(char c) throws IOException {
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
line.clear(); // reuse
while (lookaheadChar != c && lookaheadChar != END_OF_STREAM) {
line.append((char) lookaheadChar);
if (lookahea... |
d7e2418c-a723-46af-9488-515d1e40937a | 3 | public tile searchMap(TriPoint t){
tile Tile = new tile(t);
for(int i = 0; i < tiles.size(); i++){
Tile = tiles.get(i);
if(t.x == Tile.coords.x){
if(t.y == Tile.coords.y){
return Tile;
}
}
}
return... |
bf025f75-c1b2-4a6c-b76b-07adf0ad4e65 | 0 | protected void end() {} |
d02aa707-4127-4939-a5d9-05b8edc9b7a5 | 4 | static void destroy() {
while (! queue.isEmpty()) {
try {
ProxyConnection conn = queue.take();
if (conn != null && conn.isValid(DB_ISVALID_TIMEOUT)) {
conn.reallyClose();
}
} catch (InterruptedException | SQLException ex... |
ddb0adeb-3a97-4151-86ee-5bc2fb2727b9 | 0 | public void setLines(ArrayList<PathItem> lines) {
this.lines = lines;
} |
db13a96f-cf32-45e0-92ae-f0fe4a2b5935 | 6 | public boolean export(String filename){
try {
StringBuilder sb = new StringBuilder();
sb.append(frozen).append('\n');
int i = layers.size();
for (Node[] layer: layers){
//Account for bias weights
int layer_size = layer.length;
if (--i != 0) layer_size--;
sb.append(layer_size).append('\t');... |
0c98b38d-ffa4-4746-8b16-b7a2d581c5ca | 8 | private static int decode4to3(
final byte[] source, final int srcOffset,
final byte[] destination, final int destOffset, final int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
}... |
2ae710ed-95ab-4e1b-be5d-a8dc0e033f46 | 2 | public ConfigGetDb(String fileName)
{
FileInputStream inputFile = null;
try
{
inputFile = new FileInputStream(fileName);
} catch (FileNotFoundException e)
{
System.out.println(fileName + ":" + e);
e.printStackTrace();
}
Properties props = new Properties();
InputStream in = new Buff... |
d0b899c7-e0cc-4d25-ad84-4f897db3c348 | 2 | @Override
protected void readCacheSelf(Element e) throws ProblemsReadingDocumentException {
for (String key: Arrays.asList(XMLCacheDataKeys)) {
String value = e.getAttributeValue(key);
if (value==null)
value = ""; // keep existing value of same name if possible
setProperty(key,value);
}
} |
2a558df0-3243-444d-9dc8-13181044184a | 7 | public static String checkForCacheUpdates(boolean verbose, String currentVersion, JSONObject versionsConfig) {
if (Util.versionIsEquivalentOrNewer(currentVersion, versionsConfig.get("latestcache").toString())) {
//Jump out if the launcher is up to date
Logger.info("... |
094e177e-748a-4029-b483-27c3f2667d25 | 8 | public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
boolean needBrace = thenBlock.needsBraces();
writer.print("if (");
cond.dumpExpression(writer.EXPL_PAREN, writer);
writer.print(")");
if (needBrace)
writer.openBrace();
else
writer.println();
writer.tab();
thenBl... |
515b5cfd-a599-4b74-8a41-02f1b7941e6e | 0 | public static void main(String[] args)
{
String str = null;
System.out.println(str.length());
} |
e67e6b85-c5ce-476b-9ec7-a150993697ba | 5 | public void resizeMap(int newWidth, int newHeight, int widthOffset, int heightOffset) {
setMapWidth(newWidth);
setMapHeight(newHeight);
HashMap<Point, Tile> newMap = new HashMap<Point, Tile>();
for (Point p : tileMap.keySet()) {
Tile t = tileMap.get(p);
short newX = (short) (p.getX() + widthOffset);... |
b9a3905d-d875-4786-840e-10fd83f1cab6 | 1 | @After
public void tearDown() {
try
{
AqWsFactory.close(clientProxy);
}
catch(Exception ex)
{
fail("tearDown failed: " + ex.toString());
}
} |
e4490f35-b873-4985-a844-3768c46d01f0 | 4 | @Override
protected void onKick(String channel, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason)
{
super.onKick(channel, kickerNick, kickerLogin, kickerHostname, recipientNick, reason);
int targettab = 0;
int i = 0;
while(true)
{
try
{
if(Main.gui... |
454d274c-9b8e-42f8-b48e-6a8aadaa072b | 4 | public void buildTrie(Set<String> col) {
for (String str : col) {
Trie[] trieArray = sons;
for (int i = 0; i < str.length(); ++i) {
Trie tmpTrie;
if (trieArray[str.charAt(i) - 'a'] == null) {
tmpTrie = new Trie();
tmpTrie.ch = str.charAt(i);
trieArray[str.charAt(i) - 'a'] = tmpTri... |
435f1663-bc0f-45bf-9984-2e2dccb3be80 | 2 | private final boolean vowelinstem()
{ int i; for (i = 0; i <= j; i++) if (! cons(i)) return true;
return false;
} |
d1fd7caa-5812-4bf1-b851-593a9254e43a | 0 | public void setIdSolicitud(int idSolicitud) {
this.idSolicitud = idSolicitud;
} |
77345ba0-3536-4bf1-8847-62dd8a4430ca | 0 | public void raiseSalary(double byPercent)
{
double raise = salary * byPercent / 100;
salary += raise;
} |
141629de-3b98-495e-bf82-3d45ed23c63a | 6 | public boolean CanBePickedUp(Item item) {
switch (direction) {
case DIR_UP:
if (mazeHeight == 1) {
return false;
}
mazeHeight--;
break;
case DIR_DOWN:
mazeHeight++;
break;
... |
8635dca2-7f32-4a7b-9290-73ca1f4f1947 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
retur... |
db31c667-d75a-4a9b-b41a-673b74907fec | 2 | * @return a List of the matching meetings
*
*/
private List<Meeting> listForContact(Set<Meeting> meetingSet, Contact contact)
{
List<Meeting> list = new ArrayList<Meeting>();
for(Meeting meeting : meetingSet)
{
if(meeting.getContacts().contains(contact))
{
list.add(meeting);
}
}
return ... |
b5d871bd-c3db-4645-9d51-8256c8c3fe85 | 6 | public void drawCoordinateSystem(Graphics g) {
g.setColor(Color.lightGray);
g.drawLine(0, startY, PLOT_WIDTH, startY);
g.drawLine(startX, 0, startX, PLOT_HEIGHT);
for (int x = startX - (int) zoom; x > zoom; x -= (int) zoom) {
String num = "" + (x - startX) / (int) zoom;
g.drawString(num, x, startY);
}
... |
2777592f-e25a-4898-ad6e-7796f11766ab | 5 | public MixinProxy(TwoTuple<Object, Class<?>>... pairs) {
delegatesByMethod = new HashMap<String, Object>();
for(TwoTuple<Object, Class<?>> pair : pairs) {
for(Method method : pair.second.getMethods()) {
String methodName = method.getName();
// The first interf... |
50fb884f-64dc-4f68-b3e2-42d510ea1165 | 2 | public static boolean isField(Member m) {
return (m instanceof Field) || ((m instanceof LocalField)
&& !(m instanceof LocalMethod));
}; |
1828d468-b2f2-498f-938e-31cdfb0b8a0d | 8 | public static void main(String [] args){
buildOptions();
buildUI();
//scoreBoard.setHighScore(0);
//scoreBoard.setHighScore(0);
while(true) {
if(theRedButton ) {
score = 0;
wins = 0;
streak = true;
optionsDone = false;
theRedButton = false;
}
if(optionsDone && streak) {
setu... |
9557164c-0a53-4ae7-ad91-d18c8038786b | 3 | @SuppressWarnings("static-method")
protected String getData(Row row, Column column, boolean nullOK) {
if (row != null) {
String text = row.getDataAsText(column);
return text == null ? nullOK ? null : "" : text; //$NON-NLS-1$
}
return column.toString();
} |
4044292d-6aff-4fad-9af3-4c25d57dda1c | 6 | public static void main(String[] args){
try{
BufferedReader in=null;
if(args.length>0){
in = new BufferedReader(new FileReader(args[0]));
}
else{
in = new BufferedReader(new InputStreamReader(System.in));
}
ArrayList<String> input = new ArrayList<String>();
String inp = in.readLine();
... |
7110d4d1-8929-4af1-8a2b-b09a8110c890 | 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... |
7dcd9f89-ad2a-43d7-bf7f-315f2deef07f | 3 | public Optgroup(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "disabled":
disabled = Disabled.parse(this, v);
break;
case "label":
label = Label.parse(this, v);... |
2a3963a0-4aea-4608-8e81-e8639fbfa824 | 9 | public void closure(Production p){
System.out.println("------------------------- Closure " + p.toString()+ " ------------------------------");
State s = new State();
List<Production> prList = new ArrayList<>();
prList.add(p);
for(int i = 0; i < prList.size(); i++){
Production prod = prList.get(i);... |
bcae9dd1-edab-4517-a64a-b7308b5bd11f | 5 | public static boolean isPrime(int i) {
if (i < 2) {
return false;
} else if (i % 2 == 0 && i != 2) {
return false;
} else {
for (int j = 3; j <= Math.sqrt(i); j = j + 2) {
if (i % j == 0) {
return false;
... |
4284839e-62a6-45eb-8b84-5dac764946ef | 8 | @Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (kirjaudutaankoUlos(request)) {
kirjauduUlos(request, response);
} else if (... |
7ae2c36e-a24a-43bd-aab5-e9838bf2967c | 8 | public void displayStory() {
for (String[] akt : fressakte) {
Leckerbissen l1 = find(akt[0]);
Leckerbissen l2 = find(akt[1]);
if (l1 == null || l2 == null) {
System.err.println("Fressakt konnte nicht ausgeführt werden: " + akt[0] + " frisst " + akt[1]);
}
if (!(l1 instanceof Fisch)) {
Syste... |
8a6c2263-83b5-4f02-9fe5-421ac2c117d6 | 1 | private void setUpGeneralGraphData() {
bars = setUpBars(Database.statistics.get(categoryId).histogram);
for (Entry<Float, float[][]> allData : Database.DB_ARRAY.entrySet()) {
// get all company data (all 87 pts) for each collected set
timeSeriesCompayData.put(allData.getKey(), allData.getValue()[id]);//
}... |
91cdeff2-259b-4f2d-a78c-4fd07170a8b7 | 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... |
5492541e-0faf-4923-adf8-df2e9123b35f | 9 | public void fillIt() {
while (index != -1) {
cur = pixels[index];
--index;
if (cur.y + 1 < bim.getHeight()
&& bim.getRGB(cur.x, cur.y + 1) == old) {
bim.setRGB(cur.x, cur.y + 1, fill);
++index;
pixels[index] = new Point(cur.x, cur.y + 1);
}
if (cur.y - 1 >= 0 && bim.getRGB(cur.x, cur.y... |
f8985c2a-f923-4ec1-9f52-817dc2af42f4 | 7 | public void exitGroup()
{
Object root = model.getRoot();
Object current = getCurrentRoot();
if (current != null)
{
Object next = model.getParent(current);
// Finds the next valid root in the hierarchy
while (next != root && !isValidRoot(next)
&& model.getParent(next) != root)
{
next = mo... |
233082be-b487-47d3-8664-7ee551ea4a42 | 1 | public JPanelMainFrameHeader() {
super();
try {
GUIImageLoader imgLdr = new GUIImageLoader();
biHeader = imgLdr.loadBufferedImage(GUIImageLoader.GREEN_MAINFRAME_HEADER);
} catch (Exception e) {
e.printStackTrace();
}
} |
5b0c82fd-a9d1-4e2a-bd94-3b0ce68a69f4 | 3 | public static void saveLifestone(String bWorld, int bX, int bY, int bZ) throws SQLException {// Block
// block
String table = Config.sqlPrefix + "Lifestones";
Connection con = getConnection();
PreparedStatement statement = null;
int success = 0;
String query = "select * from " + tab... |
48c5c211-8951-4c09-afb6-14b2a6b84a5a | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String folderPath=null;
String fileName=null;
Writer writer=response.getWriter();
List<FileItem> items;
System.out.println("In FilesReciveServlet");
try... |
51106f62-3e47-4301-84e9-eae0de5b60ac | 6 | private boolean checkCondition(Map<String, String> conditionMap,
List<ConditionBean> list) {
boolean flag = true;
for (ConditionBean conditionBean : list) {
if (conditionMap.containsKey(conditionBean.getId())
&& conditionBean.getValue().equals(ALL)) {
continue;
}
if (!conditionMap.containsKey(... |
765bcdb5-399d-4538-be69-942579578e21 | 9 | @Override
public void keyPressed(KeyEvent e)
{
map.keyPressed(e);
switch (e.getKeyCode())
{
// Floor changes. Not handled here, but tracked for re-painting:
case KeyEvent.VK_PAGE_UP:
case KeyEvent.VK_PAGE_DOWN:
... |
69fc6a68-5b31-41dd-8219-6eb8eda5e54d | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
jEditorP... |
134ade54-e54b-442b-8695-48b66de6dfb7 | 1 | public void testConstructor_ObjectStringEx2() throws Throwable {
try {
new MonthDay("T10:20:30.040+14:00");
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} |
59c92ca5-4bc3-4522-ad73-db139f574a14 | 6 | public int[] getTouchingVoxel( int x, int y, int z ) throws UnsupportedOperationException
{
switch ( this )
{
case LEFT:
return new int[] { x - 1, y, z };
case RIGHT:
return new int[] { x + 1, y, z };
case BOTTOM:
... |
ed83a475-3d96-4e3e-9ab6-7ecc9f527cdd | 8 | public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectFloatMap ) ) {
return false;
}
TObjectFloatMap that = ( TObjectFloatMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectFloatIterator ite... |
b13d0388-a1b9-4f96-bbf1-b1037b9cda08 | 1 | public NSDictionary createDay(Date date,
String name,
List<NSDictionary> events){
NSDictionary day = new NSDictionary();
day.put("date", date);
day.put("name", name);
Integer i = 0;
for (NSDictionary nsd: events){
day.put("events" + Integer.toString(i), nsd);
i++;
}
return day;
... |
9d928e9d-7a17-4d9b-a001-16cdbc73ddea | 5 | public void setSocketOption(byte option, int value) throws IllegalArgumentException, IOException {
switch(option){
case SocketConnection.DELAY:
socket.setTcpNoDelay(option == 0);
break;
case SocketConnection.KEEPALIVE:
socket.setKeepAlive(option != 0);
... |
38aee15d-2626-4e43-9559-040bb69a8899 | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
fed59c43-1fcd-4b9f-9e2c-281baf79aa19 | 3 | private void createRooms() {
HashSet<String> roomPaths;
try {
roomPaths = KvReader.getKvFiles("./rooms");
} catch (IOException e){
e.printStackTrace(System.err);
return;
}
for (String s : roomPaths) {
HashMap<String, String> roomAtt... |
02e3a5e9-5e07-4c68-8fbd-2c29e36f07e1 | 2 | private void jMsgRActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMsgRActionPerformed
jTable1.getColumnModel().getColumn(0).setCellRenderer(new CustomCellRender_Message());
jTable1.setModel(modele);
jTable1.setAutoCreateRowSorter(true);
Color c = new Color(63... |
dac6580c-dc76-4267-a3b7-2bcf68bcbe49 | 0 | @Override
public String toString() {
return "Chunck at "+xPos+" "+zPos+" in "+parent.toString();
} |
2ebf2a66-f4f5-4d7d-be5b-891cf0657a47 | 3 | private static void printEllipsisRow(int width, int printWidth,
int startX) {
System.out.print("|");
if (startX > 0) // Print an extra column of "..."s at the beginning.
System.out.print("...,");
for (int x = 0; x < printWidth; x++)
System.out.print(" ... ");
if (printWidth < width)... |
5b78045a-6dd8-4601-9286-dd98353609ae | 9 | public boolean evaluateDarkCheckmate(Chessboard boardToCheck)
{
Chessboard chessboardCopy = new Chessboard(boardToCheck);
Tile[][] tileBoardCopy = chessboardCopy.getBoard();
boolean isInCheckmate = false;
ArrayList<Piece> offendingPieces = new ArrayList<>();
ArrayList<Location> safeAreas = new ArrayList<>... |
bb6f551c-6df6-4f16-a2de-9ccba47bcdf8 | 3 | public Select cache(Boolean cache) {
if (cache == null) {
this.cache = null;
return this;
}
if (cache)
this.cache = Cache.SQL_CACHE;
else if (!cache)
this.cache = Cache.SQL_NO_CACHE;
return this;
} |
9d1522e0-6d35-407d-9c1b-ec7251c168c1 | 2 | public HysteresisThresholdDialog(final Panel panel){
setTitle("Hysteresis Threshold");
setBounds(1, 1, 250, 220);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width/3 - getWidth()/3, size.height/3 - getHeight()/3);
this.setResizable(false);
setLayout(null);
JPanel pan1 = new JPanel();
... |
27343f17-3275-4c56-bbc7-e396006ca30f | 4 | public static void save(String filename) {
File file = new File(filename);
String suffix = filename.substring(filename.lastIndexOf('.') + 1);
// png files
if (suffix.toLowerCase().equals("png")) {
try { ImageIO.write(onscreenImage, suffix, file); }
catch (IOExcep... |
7a47c8f8-df5d-46c2-8cfa-22f1b681b1b9 | 2 | public static void writeLargeFile(){
(new Thread() {
public void run() {
for (int i = 1; i <= 10; i++) {
StringBuffer sb = new StringBuffer();
for (int j = 0; j < 100000; j++) {
sb.append("chris");
}
FileProcess.write("demo" + i + ".txt", sb.toString());
}
}
}).start();
} |
794d2e98-0aef-43eb-a667-2c4537e66763 | 3 | public static void main(String[] args) {
Cube cube;
if (args.length <= 0) {
cube = new Cube("input/valid_input1.txt");
} else {
cube = new Cube(args[0]);
}
Boolean validCube = Cube.verifyCube(cube.state);
if (validCube) {
boolean verbose = false;
if (args.length > 1) {
verbose = Boolean.pars... |
56c68a71-e407-489d-bc2f-9d89203ceb52 | 2 | @Override
public void keyReleased(KeyEvent arg0) {
int code = arg0.getKeyCode();
if(code < 0 || code >= keys.length)return;
keys[code] = false;
} |
dc05cfb9-9cef-402d-b505-5375322f4158 | 4 | public GlyphText addText(String cid, String unicode, float x, float y, float width) {
// keep track of the text total bound, important for shapes painting.
// IMPORTANT: where working in Java Coordinates with any of the Font bounds
float w = width;//(float)stringBounds.getWidth();
flo... |
d71d49f3-e45f-4f64-9eb7-5f17081f383f | 1 | private void newServer() {
// status
BTServerStateListener serverStateListener = new BTServerStateListenerImpl(
serverUI);
// recv
BTObservableHandlerListenerImpl handlerListener = new BTObservableHandlerListenerImpl(
serverUI);
BTObservableHandlerFactory handlerFactory = new BTObservableHandlerFact... |
9da1fe3d-8bad-4816-a991-8086dd3d90ac | 8 | public double getFruitProbs(int pos, int fruits, int score)
{
double prob = 0.0, innerprob, curprob;
if(pos == length - 1)
{
if(fruits <= distribution[pos] && score == fruits)
prob = 1.0;
}
else
{
for(int i = 0, s = 0; (i <= fruits) && (s <= score) && (i <= distribution[pos]); i++, s = s + (len... |
54b1937c-13a1-474b-ae0f-8b582aa1a350 | 4 | private Node putRoot(Node x, Key key, Value value)
throws DuplicateKeyException {
if (x == null)
return new Node(key, value, 1);
int cmp = key.compareTo(x.key);
if (cmp == 0)
throw new DuplicateKeyException();
else if (cmp < 0) {
x.left = putRoot(x.left, key, value);
x = rotateRight(x);
} else ... |
bacd356d-84e7-41b8-be59-cd84ea5b9d3f | 4 | public void update(long delta) {
time += delta;
if (time > nextFruitTime && !stopped) {
nextFruitTime = rate.getTime();
time = 0;
Transform3D t3dOffset = new Transform3D();
int x = rand.nextInt(xGridCount);
int y = rand.nextInt(yGridCount);
t3dOffset.setTranslation(new Vector3d(xgrid[x][y], yg... |
36b3aff3-aeef-4134-a23c-53841a8a69f9 | 9 | public Map<String, String> userJobList(int uid) {
Map<String, String> jobList = new HashMap<String, String>();
// fetch related data from database
String sql = "select u_clubs,u_clubs_level from user where uid=" + uid;
// parse the data
Map<?, ?> map = (Map<?, ?>) (Object) querySql(sql).get(0);
String clubD... |
6b40fa0f-c6fe-4aaf-b00b-7a21cfb4fc52 | 6 | private static PrinterResolution extractFromResolutionString(String buffer) {
if (buffer != null && buffer.length() > 0) {
int sep = buffer.indexOf('x');
int x;
int y;
if (sep != -1 && sep < buffer.length() - 1) {
x = Numbers.getInteger(buffer.substring(0, sep), 0);
y = Numbers.getInteger(buffer.... |
2a6f7764-7f25-48ad-8851-2a9999f9c60a | 4 | @Override
public void mouseWheelMoved(MouseWheelEvent e) {
int a = e.getWheelRotation();
if (a < 0) {
for(int i = 0; i < -a; i++) {
keys[KeyEvent.VK_UP] = true;
updateStatus();
keys[KeyEvent.VK_UP] = false;
... |
d5e8e67a-3ea9-41b9-aa88-ba1a5b3a34fd | 6 | @Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if (args.length==0) {
String[] text = new String[] {
"§a§lJoin a team",
"§9§lBLUE §8- §e§l"+Blue.getSize(),
"§a§lGREEN §8- §e§l"+ Green.getSize(),
... |
f0030720-4250-4a74-81cf-6a8cce56e3dd | 1 | public void stopDecryptingHands() {
try {
decryptSub.remove();
decryptionCount = 0;
} catch (Exception e) {
// do nothing
}
decryptSub = null;
} |
e5b1feda-c4d1-4175-8588-a2a0f8f83d13 | 9 | private static DataSet[][][] aggregateTraces(String[] nodeClasses,
String[] approaches, String[] metrics) {
DataSet[][][] allData = new DataSet[nodeClasses.length][approaches.length][metrics.length];
for(int i = 0; i < nodeClasses.length; i++) {
// VirtuaTraces
... |
6c5ec163-fdd9-4da4-a5ce-b34688fb7965 | 3 | public void play(Channel c) {
if (!active(GET, XXX)) {
if (toLoop)
toPlay = true;
return;
}
if (channel != c) {
channel = c;
channel.close();
}
// change the state of this source to not stopped and not paused:
stopped(SET, false);
paused(SET, false);
} |
e2239dc3-e322-4d17-a3ea-3ed642f17225 | 2 | private static void playres(Resource res) {
Collection<Resource.Audio> clips = res.layers(Resource.audio);
int s = (int)(Math.random() * clips.size());
Resource.Audio clip = null;
for(Resource.Audio cp : clips) {
clip = cp;
if(--s < 0)
break;
}
play(clip.clip);
} |
661c431f-6854-416e-8c54-4b5dd7e54237 | 2 | public static DelayCodeEnum fromValue(String v) {
for (DelayCodeEnum c: DelayCodeEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
6a2720fa-732f-4231-9570-b0471e7aaa81 | 5 | ArrayList<Stack<String>> join(boolean[][] res, int begin, String s,
HashMap<Integer, ArrayList<Stack<String>>> dp) {
int n = s.length();
ArrayList<Stack<String>> resArr = new ArrayList<Stack<String>>();
if (begin == n) {
resArr.add(new Stack<String>());
return resArr;
}
if (dp.containsKey(begin))
... |
5c526190-f8c5-4a39-bc12-e0e1a8d4b5be | 4 | private void calculateBalance(){
int[] rowWeights = ((CargoLifter) getWorld()).getRowWeights();
int weightTop = 0;
int weightBottom = 0;
weightDifference = 0;
for(int i = 0; i < rowWeights.length / 2; i++)
weightTop += rowWeights[i];
for(int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.