method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f7f68bd4-cd6a-4c64-b844-3639644e2cd3 | 7 | static final String encode(final String s) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c < 0x20 || c > 0x7f) {
sb.append("\\u");
... |
b2afa968-1a6c-462a-93aa-d4193ce0b391 | 1 | public void run(){
Polygon poly = new Polygon();
System.out.println("Inside the Thread");
for(int i = 0; i < points.length; i++){
poly.add(new Point(points[i]));
//System.out.println("Point #" + i + "out of " + points.length);
}
poly.setColor(org.jzy3d.colors.Color.BLUE);
Syst... |
6a1fd501-25e1-4d57-9ad7-7079c683db27 | 8 | public static void decompress(bitReader br, bmpWriter out) {
try {
System.out.print("Decompressing file... ");
long initTime = System.currentTimeMillis();
int width = out.getWidth();
int height = out.getHeight();
byte[] filters = readFilters(br, width, height, filterZoneDim);
... |
27a9b5a6-f865-4c41-8d78-67cf39585377 | 0 | public LoggingInterceptor(){
} |
48dcdc08-0584-4d86-aadb-907217edaae0 | 5 | @Override
protected Object doInBackground() throws Exception {
System.out.println("================ Running thread =============");
String prevString = "";
while(true){
Thread.sleep(10000);
String urlString = "http://localhost:8080/WebServer/UserListFetcher";
URL url;
String ... |
5f12e568-12dc-4f33-8504-b5bca52dc99e | 5 | public static void main(String[] args) throws Exception {
OrderService orderSystem = new OrderSystem();
orderSystem.add(OrderLedger.getInstance());
String userAuthToken = "tom@example.com";
String searchString = "";
int timeDelay = 0;
DataInputStream dataInputStream = new... |
efbcbf81-177c-4e93-9079-30e41b9ac047 | 7 | public static void main(String arg[]) {
Connection conn = null;
Statement stmt = null;
try {
// STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
// STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS)... |
ebb24de5-f997-4aa3-a5fa-3e71297c8057 | 9 | public double[] convolve_cols_gauss(double[] h,double[] mask)
{
long j, r, c, l;
double sum;
double[] k;
int n;
n=(int) ((mask.length-1)*0.5);
k=new double[(int) (width*height)];
// Inner region
for (r=0; r<height; r++) {
for (c=n; c<width-n; c++) {
l = LINCOOR(... |
72e41973-0226-420d-8a9d-15379659994c | 0 | public void dosomething() {
System.out.println("功能A");
} |
792a65cd-2f1b-42fd-a9f9-ad50b8540612 | 8 | private void saveAndCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAndCloseButtonActionPerformed
// TODO add your handling code here:
matchReader read = new matchReader();
ArrayList<MatchObject> matches = null;
try {
matche... |
1fb325ee-8b5a-4b05-aeb2-b9d8a259ef40 | 6 | @Override
public void parseCommandLine(CommandLine line)
{
if ( line.hasOption("ftpserver") )
{
setDomain(line.getOptionValue("ftpserver"));
}
if ( line.hasOption("ftpuser") )
{
setUsername(line.getOptionValue("ftpuser"));
}
if ( line.hasOption("ftppassword") )
{
setPassword(line.getOpt... |
aea3c503-e2c9-4110-9c88-90e54f11ba93 | 3 | public void actualizaMarcador(String cod_Competicao, HashMap<String, Integer> Jogadores1, HashMap<String, Integer> Jogadores2)
{
try {
Statement stm = conn.createStatement();
Set set = Jogadores1.keySet();
Iterator iter = set.iterator();
while (i... |
f3d0c52a-a01c-40ae-8549-cdb98b57668a | 1 | public float getTextureWidth() {
if(texture != null) {
return (float)texture.getTextureWidth();
}
else {
System.err.print("RoyalFlush: Texture2D.getTextureWidth - No texture has been loaded.\n");
return -1.0f;
}
} |
c69746ff-e783-40ce-a3c1-b18d4592ccec | 2 | public static long getLongValue(String value) {
if(value != null) {
try {
return Long.parseLong(value);
} catch(NumberFormatException exception) {}
}
throw new IllegalArgumentException("Invalid value");
} |
028880b5-6447-4e8b-9731-0f64fdcf9719 | 2 | public void doPost(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
String str1 = "";
//
str1=request.getParameter("opiton");
System.out.println("option is"+str1);
Connection conn;
Statement stmt;
PrintWriter out=response.getWriter();
response.setContentType("te... |
b15c82a4-103e-47c2-973b-0a8353df62d1 | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
4e1bb6a1-23e5-41df-8974-d9cfd801743b | 9 | private boolean isConflictWith(long startTime, long endTime, int frequency,
long lastDay) {
// day span
long startDay1 = DateUtil.getStartOfDay(this.startTime);
long startDay2 = DateUtil.getStartOfDay(startTime);
long endDay1 = this.lastDay;
long endDay2 = lastDay;
if (endDay2 < startDay1 || endDay1 < s... |
ebc49e6f-f93b-4870-9997-bc33597c6f0d | 4 | public void kill() {
try {
// kill receiving thread and wait for it to close out
if (username!= null) {
try {
exitComplete.setValue(false);
makeRequest("exit "+username).join();
timeout(exitComplete, timeoutLength, "Exiting");
} catch (InterruptedException e) {
e.printStackTrace();
... |
c761c845-1174-4969-a733-d574abafdc00 | 2 | @Override
public boolean shouldKeepAlive(int i, int j) {
return (getCell(i, j).isAlive())
&& (numberOfNeighborhoodAliveCells(i, j) == 2 || numberOfNeighborhoodAliveCells(i, j) == 3);
} |
dd2d2333-364c-4c3a-8801-45c398365663 | 1 | public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
cp.newUTF8(desc);
if (visible) {
cp.newUTF8("RuntimeVisibleParameterAnnotations");
} else {
cp.newUTF8("RuntimeInvisibleParameterAnnotations");
}
return new AnnotationConstantsCollector(... |
79526851-376e-4b03-bcee-e13f838c369d | 1 | @Override
public void cast(Player p) {
if (super.attemptCast(p)) {
p.setVelocity(p.getLocation().getDirection().multiply(3.45).setY(1.35));
p.setFallDistance(0);
exempt.add(p.getName());
}
} |
f55d4db9-88a3-45e7-9c29-546e293891fc | 1 | public void addAchievementToDB() {
try {
String statement = new String("INSERT INTO " + DBTable
+ " (type, name, url, description, threshold)"
+ " VALUES (?, ?, ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new String[] {"aid"});
stmt.setInt(1, type);
stmt.s... |
b9d0d4bc-55b9-4973-b9ae-a797ed3e7bf4 | 5 | private void generateSelectExpression(MySqlSelectQueryBlock stmt, MVContext context) {
List<SQLSelectItem> selectList = stmt.getSelectList();
if(selectList != null && selectList.size() > 0) {
String sql = "insert into mview_expression(type, mview_id, expression, expr_order) values('select', ... |
80f4e9a4-05f4-4462-943d-2c4bff50d1c7 | 4 | public void setClobField(Clob clobField) {
this.clobField = clobField;
BufferedReader reader = null;
try {
reader = new BufferedReader(clobField.getCharacterStream());
setClobData(reader.readLine());
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} f... |
0e7738c2-cb1a-4c8b-beb9-c3ad322c06db | 4 | private void addControlPanel(){
controlPanel = new JPanel();
FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT);
controlPanel.setLayout(flowLayout);
controlPanel.setPreferredSize(new Dimension(frameWidth, controlPanelHeight));
controlPanel.setMinimumSize(new Dimension(frameWidth, controlPanelHeight));
... |
2d7f1368-9782-4751-b6ab-b7f1c0dbf86f | 6 | public static String tableSchemaFromMetaData(
ResultSetMetaData rsMetaData) throws SQLException {
final StringBuilder createQuery = new StringBuilder();
for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
if (i != 1) {
createQuery.append(",");
}... |
30c166c7-7c8f-42b0-8f35-ed7b4eb8b925 | 4 | @Test(groups = { "Integer-Sorting", "Fast Sort" })
public void testRadixSortInt() {
Reporter.log("[ ** Radix Sort ** ]\n");
try {
RadixSort testRadix = new RadixSort(
fastShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array : ");
timeKeeper = System.currentTimeMillis();
testRadix.... |
4a0a1bdc-5ef9-430c-8520-565bf634c0c4 | 3 | private static boolean isValidKnightMove(Board b, Move m, int opponentColor) {
try {
if (b.spaceIsEmpty(m.end) || b.spaceHasOpponent(m.end, opponentColor)) {
return true;
}
return false;
} catch (IndexOutOfBoundsException e) {
// Since we're not checking bounds before passing the possible move
//... |
a3172822-d0e3-4f3b-96cc-3443ce56cf88 | 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... |
024afe5b-4c31-4b3a-b5b5-dc0c89a5337f | 8 | public void analyzeCode(MethodIdentifier methodIdent, BytecodeInfo bytecode) {
this.bytecode = bytecode;
TodoQueue modifiedQueue = new TodoQueue();
MethodInfo minfo = bytecode.getMethodInfo();
for (Iterator iter = bytecode.getInstructions().iterator(); iter
.hasNext();) {
Instruction instr = (Instructio... |
51c3b077-ec57-4ad8-a6bd-b8b620005629 | 2 | private void delimit ()
{
if (state == State.active) {
state = State.delimited;
return;
}
if (state == State.pending) {
outpipe = null;
send_pipe_term_ack (peer);
state = State.terminating;
return;
}
// Delimiter in any other state is in... |
f51a71bd-8566-43a3-b541-7a8d23fd46b6 | 5 | private static void addParameter(INIFile file, String line, INISection section){
String[] data = line.split("=");
String name = data[0];
String value = data[1];
INIParameterType type = INIParameterType.UNKNOWN;
if(StringParser.isBoolean(value)){
type = INIParamete... |
9d89dfcc-407c-4f64-ba7a-9b611e0cb419 | 0 | @Override
public void rotate(int angle)
{
super.rotate(angle, center);
setColoredExes();
} |
5dfca9b9-803f-4689-a9f7-436e8f5d77e1 | 6 | public static int encryptPlayerChat(byte[] is, int i_25_, int i_26_, int i_27_, byte[] is_28_) {
try {
i_27_ += i_25_;
int i_29_ = 0;
int i_30_ = i_26_ << -2116795453;
for (; i_27_ > i_25_; i_25_++) {
int i_31_ = 0xff & is_28_[i_25_];
int i_32_ = anIntArray233[i_31_];
int i_33_ = aByteArray235... |
09fb5999-b7a1-43db-9a82-a11d82337e30 | 6 | public static String decodeUTF8(String s) {
if (s == null)
return "";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '+':
sb.append(' ');
break;
case '%':
try {
// 将16进制的数转化为十进制
sb.append((char) Integer.par... |
9931f9d9-7779-4fb7-9224-84dc69db81fe | 4 | private void addToList(Class<?> c, Listener l){
if(map.containsKey(c)){
if(map.get(c)!= null){
if(!map.get(c).contains(l)){
map.get(c).add(l);
}
}
}
} |
17ca6f9b-a6e4-4028-9936-9981322cec54 | 5 | protected void checkType() {
for (int x = 0; x < getWidth(); x++) {
for (int y = 0; y < getHeight(); y++) {
double r = red.getPixel(x, y);
double g = green.getPixel(x, y);
double b = blue.getPixel(x, y);
if (r != g || r != b || g != b) {
type = ImageType.COLOR;
return;
}
}
}
ty... |
d8329572-c5bf-4207-bb98-f6f28077d6a3 | 4 | public MemoryNode construirKDTree(ArrayList<double[]> puntos, int splitAxis) throws IOException{
if (puntos.size() == 1) {
return new MemoryNode(puntos.get(0)[0] , puntos.get(0)[1], 'y', -1, -1);
}
// generar eje nuevo
double newSplitAxis = getSplitAxis(puntos, splitAxis);
// separar los puntos en dos grup... |
aa2cffd0-55c8-4d49-b0ac-3c6a038e0337 | 5 | public void setInputParamReal(final int paramIndex, final Object array) throws IllegalArgumentException, NullPointerException {
if (array==null) throw new NullPointerException(ARRAY_IS_NULL);
InputParameterInfo param = getInputParameterInfo(paramIndex);
if ((param==null) || (param.type()!=InputP... |
0e4ec1c7-16ae-4b2b-ae00-6cfa923ea169 | 9 | private boolean haveIWonYet(){
for (int i = 2; i < 5; i++) {
for (int j = 2; j < 5; j++) {
Tile tile=null;
try {
tile = (Tile) target.board[i - 2][j - 2].clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tile.setX(t... |
a38cd8be-4cf4-4ae7-b212-8db44f486763 | 3 | public String getLongestItemName(){
String longest = "";
for(int i = 0; i < items.size(); i++){
if (items.get(i) == null){return longest;}
if (items.get(i).getName().length() > longest.length()){
longest = items.get(i).getName();
}
}
re... |
a93bcd2a-5a40-4e58-ac3d-a5f683523c89 | 1 | public boolean add(Usuarios u){
PreparedStatement ps;
try {
ps = mycon.prepareStatement("INSERT INTO Usuarios VALUES(?,?,?)");
ps.setString(1, u.getCodigo());
ps.setString(2, u.getNombre());
ps.setString(3, u.getDNI());
return (ps.executeUpdate... |
1b6f2e61-54bf-4190-b531-3faca5eb13e0 | 0 | public static boolean isApplicable(Object object) {
return object instanceof Automaton;
} |
9734f528-f6d2-45fa-8584-0c05b5715be5 | 1 | private static URL __getWsdlLocation() {
if (HELLOWWORLDIMPLSERVICE_EXCEPTION!= null) {
throw HELLOWWORLDIMPLSERVICE_EXCEPTION;
}
return HELLOWWORLDIMPLSERVICE_WSDL_LOCATION;
} |
5c6e8aa0-f022-41c6-8c58-b512fa93b490 | 5 | public void heapify(int indeksi) {
int vasen = vasen(indeksi);
int oikea = oikea(indeksi);
int suurin;
if (oikea + 1 <= keko.size()) {
if (keko.get(vasen) > keko.get(oikea)) {
suurin = vasen;
} else {
suurin = oikea;
... |
1ee70368-b8fa-4d66-a116-df0b0076df77 | 8 | public final void oper_list(SS_script script, SS_statement stat) throws RecognitionException {
ParserRuleReturnScope x =null;
ParserRuleReturnScope y =null;
try {
// SayScript.g:145:48: (x= oper[$script] ( COMMA y= oper[script] )* )
// SayScript.g:145:50: x= oper[$script] ( COMMA y= oper[script] )*
{
... |
ea7d7215-c538-42cf-a346-72d3db939e8f | 9 | public boolean setItemsCompra(String [][] data){
boolean ok= false;
String [][] nuevosItems= data;
try{
PreparedStatement pstm = this.getConexion().prepareStatement("");
for (int i=0; i<this.getItems().length; i++) {
String [] itemDB=this.getItems()[i];
... |
0d5efca4-3d05-4805-9772-a39ca71ae512 | 2 | private void poistaTiedote(HttpServletRequest request,
HttpServletResponse response, TiedoteService service, String action)
throws IOException, ServletException {
// otetaan buttonin valuesta irti tiedotteen id
String id = action.substring(7);
try {
TiedoteForm validoitavaId = new TiedoteForm(i... |
5dd745a8-cbdc-48f7-8810-65ad0e69ca4f | 8 | public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3)
{
GL11.glPushMatrix();
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);
if (customRenderer != null)
{
GL11.glBindTexture(GL11.GL_TEXTURE_... |
733ce327-0f0d-471c-9ada-eed5de55b1ef | 3 | public void setChallenge(byte[] challenge) {
this.challenge = challenge;
if (needAuth() && (getDigest() == null || getDigest().length == 0)) {
digest();
}
} |
d45291f9-3b61-4aa8-917e-459feb15e415 | 7 | static Event makeEvent(GreenhouseControls gc, Map.Entry<String, Long> me) {
String key = me.getKey();
Long value = me.getValue();
if(key.equals("Bell")) {
return new BellFactory().getEvent(gc, value);
} else if(key.equals("LightOn")) {
return new LightOnFactory().... |
55daae32-83d0-45d8-bcc2-fbf3ced6729e | 0 | public void setNum(long num) {
this.num = num;
} |
3847c62a-dff7-4985-83a7-999241595ae2 | 0 | public Unit(String id, int spawnX, int spawnY){
ID = id;
x = spawnX;
y = spawnY;
} |
6ae3a959-c71f-43b5-9411-431fd3ca11a4 | 1 | @Override
public void mouseDragged(MouseEvent event) {
if (mDragColumnDivider != -1) {
Point where = event.getPoint();
mViewArea.convertPoint(this, where);
dragColumnDividerAndScrollIntoView(where);
}
} |
5483706c-a6f1-4907-9ef3-6914951239df | 5 | @Override
public MyGraph readCSVFile(String filename) {
BufferedReader CSVFile = null;
try {
CSVFile = new BufferedReader(new FileReader(filename));
} catch(FileNotFoundException e1) {
System.err.println(e1.getMessage());
}
g = new MyGraph();
try {
String dataRow = CSVFile.readLine();
whil... |
6048f03a-2a74-4d95-bbce-3de553dab9c0 | 9 | private void drawSprites(Graphics2D bufferGraphics) {
int xDraw = getVirtualX(model.getPlayerX() - SPRITE_SIZE/2);
int yDraw = getVirtualY(model.getPlayerY() - SPRITE_SIZE);
model.canChat = false;
if (xDraw >= 0-SPRITE_SIZE && xDraw <= width && yDraw >= 0-SPRITE_SIZE && yDraw <= height)
bufferGraphics.... |
f11001f1-d4e4-4c7a-b82c-aff1a3aa9dfd | 9 | static void estimationCal(String[] hashRecord,File segFile,int sampleNumPerSeg,Map<String, long[]> estimateBase ) throws FileNotFoundException {
/*
* Load the input file into the index,
* initialize the uniqueRecord,sampledRecord,hashRecord
* if sampled, compare it to the index:match? extract FP from th... |
3b8646f8-abc1-49da-9073-6885a465f967 | 7 | public void startGame() {
if (playersInBoat() > 2) {
gameTimer = GAME_TIMER;
waitTimer = -1;
//spawn npcs
spawnNpcs();
//move players into game
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
if (Server.playerHandler.players[j]... |
d1f5e280-2a78-43ff-8942-e659156767f1 | 3 | @Override
public void paint(Graphics g)
{
g.setColor(this.getBackground());
g.fillRect(0, 0, this.getWidth(), this.getHeight());
Color colBorder1, colBorder2, colBack1, colBack2, colSlider, colSliderBorder;
if (this.isEnabled())
{
colBorder1 ... |
55b7f67f-8011-4aa3-8b39-07f369f241d7 | 7 | public static boolean isSingle(char c) {
return (c == '(' || c == ')' || c == '[' || c == ']' || c == ':'
|| c == ';' || c == ',' || c == '=');
} |
14539603-2c58-4ee5-83cc-365c5928efef | 9 | @Override
public boolean unload(Class<? extends Unloadable> clazz) {
for (Injectable i : getInjected()) {
if (i.getClass().getName().equalsIgnoreCase(clazz.getName())) {
if (i instanceof Unloadable) {
UnloadEvent ue = new UnloadEvent((Unloadable) i);
... |
052a494b-4bff-4a58-af1f-7067628f15fb | 4 | public boolean setPlayer2(Player p2) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setPlayer2() BEGIN");
}
m_player2 = p2;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setPlayer2(... |
021d8577-9445-4c17-8b6c-f60e63440774 | 6 | private void finishLeftDiagonal(int playerNumber) {
int i = 0;
int j = 0;
switch (playerNumber) {
case 1: {
while (i < gameField.getFieldSize()) {
if(!gameField.isFill(i,j)) {
gameField.putX(i,j);
b... |
75728ddf-a5aa-4dcf-9c4d-0cfc3c9e91d1 | 7 | public void renderLevelDetails(Graphics2D g2)
{
// GET THE CURRENT LEVEL
pathXLevel level = data.getLevel();
PropertiesManager props = PropertiesManager.getPropertiesManager();
g2.setFont(FONT_TEXT_DISPLAY);
HashMap<TextAttribute, Object> map = new HashMap<TextAttrib... |
ff2a00b4-7938-473c-920e-21a613699ab6 | 1 | public static String formatXML(String input) {
try {
Source xmlInput = new StreamSource( new StringReader(input) );
StringWriter stringWriter = new StringWriter();
StreamResult xmlOutput = new StreamResult(stringWriter);
TransformerFactory transformerFactory = Tra... |
96792e33-d5eb-4382-9842-896a1add2747 | 6 | double getAggregate( int aggType )
{
switch ( aggType )
{
case AGG_MINIMUM:
case AGG_MAXIMUM:
case AGG_AVERAGE:
case AGG_FIRST:
case AGG_LAST:
return values[0];
case AGG_TOTAL:
return (values[0] * values.length) ;
}
return Double.NaN;
} |
2915efee-048b-4d5b-bfab-92498d650805 | 4 | public static String selectUserType(){
Scanner scan = new Scanner(System.in);
do{
System.out.printf("\n***TIPOS DE USUARIO***\n1-%s\n2-%s\n3-%s\nEscoja uno: ",
ADMINISTRADOR, CONTENIDO, LIMITADO);
int opt = scan.nextInt();
switch(opt){
... |
56bf785a-2676-4cec-9e5a-6e3b1f561835 | 3 | private float calculateParsed(List<String> parsed) {
float result = 0;
while (parsed.size() > 1) {
for (int i = 0; i < parsed.size(); i++) {
String element = parsed.get(i);
if (isOperation(element)) {
result = performCalculations(parsed, el... |
eadce984-cd52-491a-89af-3d1d4ac3b4ca | 9 | @Override
public void update(GameContainer gc, StateBasedGame arg1, int delta)
throws SlickException {
if(firstRun) {
gc.getInput().isKeyPressed(Input.KEY_ENTER);//reset ENTER key state
firstRun = false;
}
if(battle.isOver()) {
if(gc.getInput().isKeyPressed(Input.KEY_ENTER)) {
selectedMove = -1;
... |
ee3e3b21-48cd-4dd0-b882-0f9c5d5f3c35 | 1 | public String tempsToChrono(int temps){
String chrono = (temps - temps%60)/60 + ":";
if (temps%60 < 10){
chrono = chrono + "0" + temps%60;
}else
chrono = chrono + temps%60;
return chrono;
} |
5670ff9f-f5f2-47c2-88c4-d8e7aa8b75ab | 8 | public ArrayList<CellStringPair> findStrings(){
ArrayList<CellStringPair> result = new ArrayList<CellStringPair>();
int width = getWidth();
int height = getHeight();
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
if(!isBlank(x, y)){
Cell start = new Cell(x, y);
String str = St... |
9c77f9d7-30ce-46c2-83bd-33e50f014357 | 8 | public static void fizzbuzz(){
for (int i = 1; i <= 100; i++) {
switch (i % 15) {
case 0:
System.out.println("FizzBuzz");
break;
case 3:
case 6:
case 9:
case 12:
... |
d6d33c56-ed1c-4b48-b1bc-b73047867125 | 9 | public static int pieceValue(int piece, int square) {
if ((square & 0x88) != 0) return 0; // TODO: throw exception
int result = 0;
int pieceType = piece & 31;
switch (pieceType) {
case Position.ROOK:
result = 510;
break;
case Position.KNIGHT:
result = 300;
break;
case Position.BISHOP:
resu... |
ece93f15-d45f-4b75-8c0f-254f83892078 | 2 | private static void readInMessage(Core output, Document xml, String updateId) {
long source = Long.parseLong(xml.getElementsByTagName(SOURCE).item(HEAD).getTextContent());
long target = Long.parseLong(xml.getElementsByTagName(TARGET).item(HEAD).getTextContent());
String titulo = xml.getElementsB... |
aaf7c468-1d5e-4dfb-b352-4eba6cbec733 | 1 | private void write(BufferedWriter out) {
StringBuffer sb = new StringBuffer();
sb.append("db." + JSONWriter.COLLECTION_NAME + ".insert({");
sb.append("year: \"" + _year + "\"");
sb.append(", month: \"" + _month + "\"");
sb.append(", quarter: \"" + _quarter + "\"");
sb.append(", NSW: " + _ns... |
48aa9626-a46e-41fb-9c60-72cf925e097e | 5 | @SuppressWarnings("unchecked")
@Override
public String displayQuestionWithAnswer(int position, Object userAnswer) {
ArrayList<String> questionList = (ArrayList<String>) question;
String questionStr = questionList.get(0);
ArrayList<String> answerList = (ArrayList<String>) answer;
ArrayList<String> userAnswerLi... |
7e43e067-7757-4b87-8ad1-02c2a341bd68 | 7 | public void processButton(int programButton) {
if (programButton == 0 && currentThread.isAlive()) {
currentThread.interrupt();
}
if (!currentThread.isAlive()) {
switch (programButton) {
case 0:
currentThread = new WashingProgram0(mach... |
652a0300-866c-4ca2-a9c9-3be055337ab4 | 2 | @EventHandler
public void onFurnaceSmelt(FurnaceSmeltEvent event) {
plugin.cancelEvent(event);
plugin.debugMessage(event);
plugin.godMode(event);
if (event.getSource().getType().equals(Material.SAND)) {
event.setResult(new ItemStack(Material.BONE, 2, (short) 0));
... |
d861b4e4-59c3-44d1-b31d-07e4db943817 | 7 | public void set_point( int point, int tick, int ampl, boolean delta ) {
if( point >= 0 && point < ticks.length ) {
if( point == 0 ) {
tick = 0;
}
if( point > 0 ) {
if( delta ) tick += ticks[ point - 1 ];
if( tick <= ticks[ point - 1 ] ) {
System.out.println( "Envelope: Point not valid (" + t... |
d275ac32-310d-418d-9cd3-26fc26c1911e | 1 | public void show(){
for(T key : histogram.keySet()){
System.out.println(key + ": " + histogram.get(key));
}
} |
2ec145fa-8453-49c6-b16e-81f14f7f5d38 | 4 | public static void DoRandomBotTurn(PlanetWars pw) {
Random random = new Random();
Planet source = null;
List<Planet> myPlanets = pw.MyPlanets();
//Randomly select source planet
if (myPlanets.size() > 0) {
Integer randomSource = random.nextInt(myPlanets.size());
source = myPlanets.get(randomSource);
... |
4c5999c1-688c-4d92-9476-5af7c9a4bc7d | 7 | public Component getListComponentForDataSection(TaskObserver taskObserver, String dataSectionName, List list, Iterator indexIterator) throws InterruptedException
{
if (dataSectionName == DATA_SECTION_UNKNOWN0) { return getGeneralPanel(taskObserver); }
else if (dataSectionName == DATA_SECTION_VISIBLE... |
0dec02d2-319b-4ad5-9bfc-35205b83723f | 9 | public void selectObject(MouseEvent evt) {
Object obj = window.getPetriNetGraph().getObjectPosition(evt.getX(), evt.getY());
if (obj != null) {
selectObj = obj;
if (selectObj instanceof PlaceUI) {
// window.placeAction.setSelectedPlace((PlaceGraph) selectObj);
// window.placeAction.enablePlaceInfo();
... |
736a7103-6d2b-454e-a123-ace8164347de | 0 | public Sprite getBackground() {
return background;
} |
f41d9394-dcea-4869-b55c-61305c73915c | 3 | public static void main(String[] args) {
List<String> list = new ArrayList<String>(
Arrays.asList("cat", "dog", "horse")
);
System.out.println(list);
ListIterator<String> it = list.listIterator();
while (it.hasNext())
System.out.println(it.next());
System.out.println();
while (it.hasPre... |
869b83ac-3976-4bec-bba7-cc2b51c19290 | 5 | public AirCreep(int id){
if (id > 0 && id < 4){
if (id == 1){
maxHp = 50;
armor = 10;
speed = 3f;
}else if (id == 2){
maxHp = 500;
armor = 15;
... |
50521bf1-ea84-4cc2-a14f-0131591838c2 | 0 | public Rectangle getBoundingBox()
{
return recognizer.boundingBox;
} |
68ca6f7a-06b3-49e1-83fd-a2a0f3ceaad2 | 4 | public final boolean matchesSub(Identifier ident, String name) {
if (ident instanceof PackageIdentifier)
return true;
if (ident instanceof ClassIdentifier) {
ClassIdentifier clazz = (ClassIdentifier) ident;
return (clazz.isSerializable() && (!onlySUID || clazz.hasSUID()));
}
return false;
} |
366f1588-981c-42b4-818a-34dcb48bd146 | 1 | public void removeItem (final SoldItem soldItem){
StockItem stockItem = getItemById(soldItem.getId());
if(stockItem.getQuantity() < soldItem.getQuantity()) {
throw new IllegalArgumentException("invalid remove count: " + soldItem.getQuantity()
+ " | have: " + stockItem.getQuantity());
}
stockItem.setQuan... |
de71557f-57b6-426c-a3b2-2ce1102ae43b | 4 | public ChatController() {
settings = Settings.getInstance();
participantList = ParticipantList.getInstance();
chatHistory = ChatHistory.getInstance();
chatCore = new ChatCore();
chatGui = new ChatGui();
trayView = new TrayView();
settingsGui = new SettingsGui();
chatGui.addChatGuiListener(this)... |
66cfb1a6-14da-47e3-841c-b909e7099d31 | 0 | public int getType() {
return type;
} |
54748f5f-f262-4749-ac38-928145f18107 | 3 | public void addComment(String fileName, String path, String... comments) {
if (isFileLoaded(fileName)) {
for (String comment : comments) {
if (!configs.get(fileName).contains(path)) {
configs.get(fileName).set("_COMMENT_" + comments.length, " " + comment);
}
}
}
} |
f395224c-e5a4-43d0-ad9c-02d82e15e4a5 | 9 | public vector2d better_avoid(ArrayList<Obstacle> obs, double waga, int dl) {
vector2d value = new vector2d(0, 0);
double min = Double.MAX_VALUE;
int minn = -1;
for (int i = 0; i < obs.size(); i++) {
double odl = this.getOdl(obs.get(i));//szukam najbliższej przeszkody
... |
fb57ee4e-8eab-44e4-945b-cc9d190c754f | 8 | public Point pixelChooser() {
// if (used == true) {
// used = false;
// right = true;
// a += 1;
// return lastPoint;
// }
if (right == true) {
if (lastPoint.x + 3 < c) {
newPoint = new Point(lastPoint.x + 3, lastPoint.y);
... |
37b910ff-8ed3-47ee-9bf4-19e48a4fcd34 | 4 | protected String addMGameFeatures()
{
myMDisplay = new JTextField(10);
((JTextField)myMDisplay).addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
try
{
reset();
... |
2df1bb39-043d-40a9-84ab-ca4231c52ed1 | 7 | private static IntJoukko mikaJoukko() {
String luettu;
Scanner lukija = new Scanner(System.in);
luettu = luku();
while (true) {
if (luettu.equals("A") || luettu.equals("a")) {
return A;
} else if (luettu.equals("B") || luettu.equals("b")) {
... |
b45b2526-d634-4168-bbfc-48e7b62b30a5 | 9 | boolean isAdherentStrikeout(TextStyle style) {
if (this == style)
return true;
if (style == null)
return false;
if (strikeout != style.strikeout)
return false;
if (strikeoutColor != null) {
if (!strikeoutColor.equals(style.strikeoutColor))
return false;
} else {
if (style.strikeoutColor != ... |
3f9c65a3-2546-4cf1-9963-63bfeb8a9e97 | 5 | public static double WagnerFischer(String s, String t) {
int l1 = s.length(), l2 = t.length();
int[][] matrix = new int[l1 + 1][l2 + 1];
for (int row = 1; row < l1 + 1; row++)
matrix[row][0b00000000000000000000000000000000] = row;
for (int col = 1; col < l2 + 1; col++)
matrix[0][col] = col;
for (int j =... |
f72031ea-0ee2-493c-b2da-df2322c35ec1 | 0 | @Override
public Set<String> getEntities() {
return getList("entities");
} |
3d98976a-e2c4-4a19-9d8f-cacb01b36bf2 | 1 | @Override
public void append(Framedata nextframe) throws Exception {
if (unmaskedpayload == null) {
unmaskedpayload = ByteBuffer.wrap(nextframe.getPayloadData());
} else {
ByteBuffer tmp = ByteBuffer
.allocate(nextframe.getPayloadData().length
+ unmaskedpayload.capacity());
tmp.put(unmaskedpay... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.