method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8cd3bca9-b499-45c4-bf88-dfed2e42d004 | 4 | public void animate() throws InterruptedException {
Thread.sleep(1000);
for(char c:"ANGRY NERDS STUDIO PRESENTS".toCharArray()) {
stringShownANSP.append(c);
image.repaint();
int sleepVal = 250;
sleepVal -= stringShownANSP.length() * 6;
Thread.sleep(sleepVal);
}
Thread.sleep(1000);
int i = 1;
... |
12fba655-fc33-45d8-bb2e-0e357ecc457f | 7 | public void build(Polygon[] polygons) {
if (polygons.length == 0) return;
if (plane == null) plane = polygons[0].getPlane().clone();
ArrayList<Polygon> front = new ArrayList<Polygon>();
ArrayList<Polygon> back = new ArrayList<Polygon>();
for (int i = 0; i < polygons.length; i++)
plane.splitPolygon(polygons... |
73c875c5-3853-4e7e-8d69-ee0e63eb3bcb | 1 | private static final void exchange(Object a[], int i, int j) {
if (i == j)
return;
Object tmp = a[i];
a[i] = a[j];
a[j] = tmp;
} |
5ec6ab92-bfce-4d58-ad77-c3798a47ce81 | 3 | public int winnerIs() {
for (int i = 0; i < cl.length; i++) {
if (getScore(cl[i])==4) {
return PLAYER_ONE;
}
else if(getScore(cl[i])==-4)
return PLAYER_TWO;
}
return 0;
} |
9db77354-9775-47b3-a446-0f6d7f6012ff | 1 | public List<Product> getAll() {
List<Product> products = null;
try {
beginTransaction();
products = session.createCriteria(Product.class).list();
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSesion();
}
return products;
} |
90279bca-d70a-4a1a-a0f8-7f4b0c11af44 | 6 | private boolean checkUpdate(Integer[] current, Integer[] online) {
if (current.length > online.length) {
Integer[] newOnline = new Integer[current.length];
System.arraycopy(online, 0, newOnline, 0, online.length);
for (int i = online.length; i < newOnline.length; i++) {
... |
3e4360af-4666-41a3-aed9-2d09c73771ab | 3 | public JSONObject toJSONObject() throws ParseException {
JSONObject obj = new JSONObject();
obj.put(KEY_TYPE, bonusType.toString());
obj.put(KEY_PROMPT, prompt);
obj.put(KEY_ANSWER, answer);
JSONArray sChoice = new JSONArray();
if(choices!=null){
for (String c : choices) {
if (c != null)
... |
cc4c1a4e-53bc-430a-af7f-911c4086c4ad | 6 | private static Boolean checkIfTrue(String[] complete) {
int max=0;
String temp;
int temp1;
int[] a=new int[complete.length];
for(int i=0;i<complete.length;i++){
//Establish our Max for the Column
for(int j=0;j<complete[i].length();j++){
temp=complete[i].charAt(j)+"";
temp1=Integer.parseInt(temp);
if(te... |
98721567-4083-4c21-a3ea-c08330a9f0d3 | 0 | public void itemStateChanged(ItemEvent aa) {
setChangeDate();
} |
02799b2b-1a6b-4c40-ac7a-3c50f56782e4 | 4 | public Thread acquirePackets(final List<Packet> buffer, final int count) {
// ArrayList of packets called List
final PacketReceiver receiver = new PacketReceiver() { // Declaration of
// a new
// packetReciever
// called
// receiver
@Override
... |
39cd57bd-032e-48b0-922d-7bf04d45d4de | 5 | public void appLoop(double mult) {
//Loads a flat surface as the base terrain
baseScene = new Scene(objLib.FlatSurf());
//Increases the terrains size by a multiple of 5
//Initializes an array of objects equal to the size the scene allows
actors = new int[baseScene.objindex];
//Adds a prebuilt box object fr... |
0ea01851-f1f1-4b4e-b3d7-0e84fe04a54c | 8 | public static void main(String[] args) {
try {
ui = new SwingWolves();
} catch (HeadlessException e){
ui = new TextWolves();
ui.displayString("Headless environment detected.\nSwitched to text only mode.");
}
NumPlayers = ui.getNumPlayers();
NumWolves = ui.getNumWolves();
DebugMode = ui.getDebug... |
798dd861-efe1-4f33-a382-b376013c542d | 1 | private ServerSocketChannel createServerSocket(int port)
throws IOException {
try {
ServerSocketChannel ssChannel = ServerSocketChannel.open();
ssChannel.configureBlocking(false);
ssChannel.socket().bind(new InetSocketAddress(port));
return ssChannel;
} catch (IOException e) {
logger.info("Port " ... |
783af427-0537-4d87-b257-b2acadd3a483 | 0 | protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/collapse.gif");
return new ImageIcon(url);
} |
4086dd12-1012-488b-a718-66a7ce20827f | 0 | public void addVillage(Village v)
{
this.village = v;
} |
f105db06-6d71-45f2-9d21-3125dc5b473e | 2 | public void loadGame() {
System.out.println("What is the filename? For maders.rsbxl2, type maders.");
try {
mainfileName = cache.readLine();
} catch (IOException ex) {
System.out.println(ex.getMessage());
System.exit(-1);
}
ReadFile read = new ... |
cbbf8204-c680-453b-a784-f2c06e230c28 | 3 | public void testReadWithVorbisAudio() throws IOException {
OggFile ogg = new OggFile(getTheoraVorbisFile());
tf = new TheoraFile(ogg);
// Check the Info
assertEquals("3.2.1", tf.getInfo().getVersion());
assertEquals(3, tf.getInfo().getMajorVersion());
assertEquals(2, tf.... |
5f0ac3c2-85e6-478d-b932-925f01d76d87 | 2 | * @return this
*/
public Request clear(String name) {
Iterator<NameValuePair> it = mParams.iterator();
while (it.hasNext()) {
if (it.next().getName().equals(name)) {
it.remove();
}
}
return this;
} |
699c0521-a999-4d7f-b7a5-1bbadb5b03e8 | 0 | @Override
public ArrayList<Excel> getColoredExes() {
return coloredEx;
} |
2072d29b-ee44-41ac-bba2-11846b665215 | 5 | public static void drawVerticalLine(int x, int y, int height, int colour) {
if (x < topX || x >= bottomX)
return;
if (y < topY) {
height -= topY - y;
y = topY;
}
if (y + height > bottomY)
height = bottomY - y;
int pointer = x + y * DrawingArea.width;
for (int row = 0; row < height; row++)
pix... |
55ff7dd0-9053-4de6-bfce-1b9aaa485563 | 3 | @Override
public void displayTable(String tableName, ResultSet rs) throws IOException, SQLException {
println("create table " + tableName + " (");
while (rs.next()) {
print("\t" + rs.getString(4) + ' ' + rs.getString(6));
int nullable = rs.getInt(11);
if (nullable == ResultSetMetaData.columnNoNulls) {
... |
fdfea43f-0fb7-4c9d-9f07-93a30cf49b42 | 8 | public int strStr(String haystack, String needle) {
if (haystack == null || needle == null)
return -1;
if (needle.length() > haystack.length())
return -1;
int base = 29;
long patternHash = 0;
long tempBase = 1;
long hayHash = 0;
for (int i = needle.length() - 1; i >= 0; i--) {
patternHash += (i... |
ffdf5082-e57c-481c-9a24-8ee04372bd72 | 1 | public void send(Message message) throws IllegalStateException {
synchronized (this.exchangeLock) {
if (this.isBound()) {
this.exchange.send(message);
}
}
} |
08218a26-c716-4c24-983f-8cfa2f910023 | 9 | public static void main(String[] args) {
System.out.println("Digite 2 caracteres para usar de chave.");
String readConsole = Main.readConsole();
KeySchedule key = new KeySchedule(readConsole);
MiniAes miniAes = new MiniAes();
miniAes.setKey(key);
key.print();
while (true) {
try {
System.out.println... |
3fc94454-3c37-425a-9c97-afe34f320a9b | 5 | public void GameStart() {
boolean passFlg = false;
int gameCnt = 0;
Bord bord = new Bord();
bord.BordInit();
System.out.println("ゲームスタート");
System.out.println(bord.toString());
// おける場所がある間はループ
while (bord.GetCount(Stone.NONE) > 0) {
// 現在の手版を取得
AiBase turnPlayer = PlayerList.get(gameCnt % 2);... |
0ac0cf65-c40a-42de-925d-ebda79f0bd28 | 4 | @Override
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
}
int count = extensions.length;
String path = file.getAbsolutePath();
for (int i = 0; i < count; i++) {
String ext = extensions[i];
if (path.endsWith(ext)
&& (path.c... |
bc0f660b-426a-45be-961d-8e3a794aba87 | 1 | public final void removeJump() {
if (jump != null) {
jump.prev = null;
jump = null;
}
} |
24f1bcf3-c5f3-4466-9716-87ccf7224376 | 8 | private void myEvent(){
saveItem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(file == null){
saveDia.setVisible(true);
String dirPath = saveDia.getDirectory();
String fileName = saveDia.getFile();
if(dirPath==null || fileName==null) return;... |
2e4aac63-0085-48c4-8180-cee6a4181159 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (jTextField1.getText() != "") {
int a = 1;
String gend = "Male";
try {
ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from librian where ... |
70d1e491-3297-4f9a-92bc-465f82091d30 | 5 | public static void remove(CommandSender sender, String[] args){
//team + player + add + player
if(args.length < 2+2){
sender.sendMessage(ErrorMessage.MissingParameters);
}
else{
String playerName = args[3];
String playerTeam = TeamsManager.getInstance().retrievePlayerTeam(playerName);
... |
2d40dfe9-c1bb-44f3-9f3b-6897f76677b0 | 2 | public static boolean isBold(JTextPane pane)
{
AttributeSet attributes = pane.getInputAttributes();
if (attributes.containsAttribute(StyleConstants.Bold, Boolean.TRUE))
{
return true;
}
if (attributes.getAttribute(CSS.Attribute.FONT_WEIGHT) != null)
{
Object fontWeight = attributes
.getAttribu... |
c6e5f1a8-6fd7-4569-8a11-b23285cb441f | 5 | public FolderHandler(File album) {
Logger.getLogger(FolderHandler.class.getName()).entering(FolderHandler.class.getName(), "FolderHandler", album);
File[] allfiles = album.listFiles();
try {
allfiles = album.listFiles();
} catch(SecurityException ex) {
Logger.getL... |
a09b19ba-80d5-44f0-81be-25f002fe769b | 4 | public void saveSupModel(String filename){
double[] weights = m_libModel.getWeights();
int class0 = m_libModel.getLabels()[0];
double sign = class0 > 0 ? 1 : -1;
try{
PrintWriter writer = new PrintWriter(new File(filename));
if(m_bias)
writer.write(sign*weights[m_featureSize]+"\n");
else
writer... |
7a82d15c-c21c-4683-af2c-a147076673c7 | 2 | public String[] getPhonenumberByUID(Statement statement,String UID)//根据用户ID获取手机号
{
int i = 0;
String[] result = new String[20];
sql = "select phonenumber from CarNumber where UID = '" + UID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result[i] = rs.getString("phonen... |
ca368b97-4cc5-4626-950d-70a12c44f5c3 | 4 | private static String[] format(Deck in){
if(!in.repeated){
return in.cards.toArray(new String[0]);
}
int size = 0;
for(int i = 0; i<in.quantity.size(); i++){
size += in.quantity.get(i);
}
String[] cards = new String[size];
int position = 0;
int count = 0;
for(int i = 0; i<size; i++){
card... |
d5e71d63-3d3c-4a8f-8ef9-c353ea299069 | 7 | protected int[] getOneSeq(int node_index){
double[][] winnerCode=new double[numF1][maxIdEvents];
for(int i=0;i<numF1;i++){
System.arraycopy(weight[node_index][i],0, winnerCode[i], 0, maxIdEvents);
}
/* for(int i=0;i<weight[node_index].length;i++){
for(int... |
bf36bcce-c05a-479b-abce-3a378dbf9f4f | 4 | public static void splitPivotFirst(int low, int high) {
int i = low + 1;
for (int j = low + 1; j <= high; j++) {
countFirst++;
if (result[j] < result[low]) {
exchange(j, i);
i++;
}
}
exchange(low, i - 1);
if (lo... |
597173af-3a07-431b-b4c6-f429fe85f8af | 2 | @SuppressWarnings("unchecked")
public static Float restoreFloat(String findFromFile) {
Float dataSet = null;
try {
FileInputStream filein = new FileInputStream(findFromFile);
ObjectInputStream objin = new ObjectInputStream(filein);
try {
dataSet = (Float) objin.readObject();
} catch (ClassCastExcep... |
66c5ad38-0eab-4f70-9005-7905cf99edde | 9 | private Token<T, ?> skipIgnored(Token<T, ?> next, final TokenListener<T, ?> capturingListener) throws IOException {
if (next != null && ignoreWhitespace && capturingListener.isCapturingWhitespace()) {
next = next();
} else if (next != null && capturingListener.isCapturingNewline()) {
lineNumber++;
if (igno... |
7626b7a7-799b-432d-af59-d58e69f0e674 | 2 | public principal(){
comboBox1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
String idioma_cadena = comboBox1.getSelectedItem().toString();
set.setIdioma(getIdioma(idioma_cadena));
}
... |
02b24c9b-b105-4e56-a0a1-35789298500b | 7 | private void searchTable() {
while (model.getRowCount() != 0) {
model.removeRow(0);
}
if (!tfEmployeeNr.getText().isEmpty()) {
Employee employee = RoosterProgramma.getInstance().getEmployee(Integer.parseInt(tfEmployeeNr.getText()));
if (employee != null) {
... |
a466fbc2-3413-4bf2-ae95-854ffdbc0a2f | 0 | public PrimaryInput(String input) {
name = input;
inputTable.put(input, new Double(0.0));
} |
32b2c0e2-d3d0-4a2a-9d10-54ed26f051d2 | 9 | public void moverse() {
Tablero.getTablero().removerNave(this);
ArrayList<Parte> partesFinal = new ArrayList<Parte>();
for (Parte parte : partes) {
Coordenada posicionInicial = parte.getPosicion();
Coordenada posicionFinal;
if (direccionMovimiento == DireccionMovimiento.ESTE) {
posicionFinal = this.m... |
341de1c9-831b-42cc-abd3-ed7905e1c8d2 | 2 | public double getDouble(String key, double def)
{
if(fconfig.contains(key)) {
return fconfig.getDouble(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} |
e6c952cb-a2dc-4dc9-a2d6-30a04b87aa1c | 4 | private void asetaLisavalinnat(ArrayList<Tilausrivi> tilausrivit, String oregStr, String vsipStr, String ltonStr,
String gtonStr, int index) {
if (oregStr != null) {
tilausrivit.get(index).setOreg(true);
} else {
tilausrivit.get(index).setOreg(false);
}
if (vsipStr != null) {
tilausrivit.get(i... |
976bdc74-e2c4-4403-a23a-f35ee03ef691 | 8 | public void line(WritableImage source, int x1, int y1, int x2, int y2) {
if (source == null)
return;
PixelWriter pw = source.getPixelWriter();
int argb = 255 << 24 | 0 << 16 | 0 << 8 | 0;
int sx = x1 < x2 ? 1 : -1;
int sy = y1 < y2 ? 1 : -1;
int dx = Math.abs(x2 - x1);
int dy = Math.abs(y2 - y1);
... |
3da5a86c-46a5-45b3-ad48-8cfad0e4b781 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((sprung)
&&(affected!=null)
&&(!disabled())
&&(tickDown>=0))
{
if(((msg.targetMinor()==CMMsg.TYP_LEAVE)
||(msg.targetMinor()==CMMsg.TYP_FLEE))
&&(msg.amITarget(affected)))
{
msg.source().tell(L("The exits a... |
887d4dfe-f463-42f3-96f0-92e77070ee77 | 6 | public void updateData() {
data = username + (location != null ? " l" + location.toString() : "") + (health > -1 ? " h" +
health : "") + (toggleAdmin ? " a" : "") + (toggleFlyMode ? " f" : "") + (toggleGodMode ? " g" : "") +
(toggleVisibility ? " v" : "");
} |
7b5e2752-d983-427b-bd2c-dfbfcfb8d995 | 3 | public int getWood(int size){
if (resource1==3){
if (size==1){
return sgenrate1;
}
else if (size==2){
return mgenrate1;
}
else {
return lgenrate1;
}
}
else{
return 0;
}
} |
6918f1e1-2a41-4da4-82c6-e535a426477c | 6 | double microbial_tournament(int[][] actionGenome, StateObservation stateObs, StateHeuristic heuristic) throws TimeoutException {
int a, b, c, W, L;
int i;
a = (int) ((POPULATION_SIZE - 1) * randomGenerator.nextDouble());
do {
b = (int) ((POPULATION_SIZE - 1) * randomGenerat... |
87ad92ee-58da-4872-abb4-0a2d85e8b5f0 | 6 | public void run() {
//double fCyclePosition = 0;
try {
AudioFormat format = new AudioFormat(44100, 16, 2, true, true);
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format, BUFFER);
if (!AudioSystem.isLineSupported(info))
throw new LineUnavailableException();
line = (SourceD... |
f90b83ce-5635-42d8-87ad-e7154d58a282 | 9 | private static Mummy[] mummyFight(Mummy[] mummyType1, Mummy[] mummyType2) {//First type win
Mummy[] mm1 = mummyType1;
Mummy[] mm2 = mummyType2;
if ((mm1.length == 0) || (mm2.length == 0)) { //No conflict for void arrays
return mm2;
}
if (mm1.getClass() != mm2.getClass... |
29fb2fdf-6859-4771-b290-58dbf265a29c | 1 | public void testWithChronologyRetainFields_invalidInNewChrono() {
YearMonthDay base = new YearMonthDay(2005, 1, 31, ISO_UTC);
try {
base.withChronologyRetainFields(COPTIC_UTC);
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} |
5dd07203-5c70-4790-b205-5a44c25e969e | 2 | public Fighter(int courtWidth, int courtHeight) {
super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth,
courtHeight);
// Set img1 to picture of the fighter jet
try {
img1 = ImageIO.read(new File(img_file1));
} catch (IOException e) {
System.out.println("Internal Error:" + e.getMessage(... |
75e44262-24a1-41d9-ac03-436f5aac07a1 | 1 | public void mergeInfo(Instruction instr, StackLocalInfo info) {
if (instr.getTmpInfo() == null) {
instr.setTmpInfo(info);
info.instr = instr;
info.enqueue();
} else
((StackLocalInfo) instr.getTmpInfo()).merge(info);
} |
684c958d-762d-40bd-acca-fb2a199eefa6 | 8 | void formEdit(ActivityList al, CaseList caselist, ContactList contactlist, boolean createRow) {
Vector<String> attorneyNames = new Vector<String>(); // creates array of Attorney and Paralegal names for JCombo Box
Vector<String> caseNames = new Vector<String>(); // creates array of Case names for JCombo Box
... |
97768d09-f2f1-4a9d-bd2c-0df96a0ed3da | 0 | @SuppressWarnings("deprecation")
@Test
public void test() {
Date start = new Date(113, 12, 20, 14, 10, 00);
Date end = new Date(113, 12, 21, 14, 10, 00);
int d = TimeCalculator.duration(start, end);
assertTrue(d == 86400);
assertEquals("24小时0分0秒", TimeCalculator.HMSFormat... |
4f7a1ec8-5aa5-47a3-bafe-f3d9a5b37d97 | 3 | @Override
public void execute(Game game, HashMap<String, String> strings, Entity target) throws ScriptException {
if (args[0].toLowerCase().equals("p")) {
game.getPlayer().setCoords(Integer.parseInt(args[1]),
Integer.parseInt(args[2]),
Integer.parseInt(args[3]));
} else if (args[0].toLowerCase().equal... |
b2355cc0-ccd8-43e0-ba30-8ac3f7a4171b | 8 | public void execute(RPSAgent agent) {
Set<Peer> slaves = agent.getSlaves();
agent.log("It was time to prepare the tournament.");
agent.log("First I had to find out how many of the " + slaves.size() + " participants was still willing to take part in the tournament.");
//Find out how many... |
a1affe87-c079-4dce-85fd-6d38f8ac0c04 | 2 | public void waitForConnection() throws IOException {
conn = serverSocket.accept();
outStream = new PrintWriter(conn.getOutputStream());
inStream = new BufferedReader(new InputStreamReader(conn.getInputStream()));
// Negotiation
while (true) {
String[] msg = inStrea... |
9895956b-f5c6-4a2e-94c6-08485f0a62a9 | 1 | public void joinChannel(Channel channel) {
synchronized (channels) {
if (channels.isEmpty()) { // logged in
Server.get().addClient(this);
}
channels.add(channel);
}
} |
64905bea-a3dd-4f8e-9248-85a479afbb1a | 0 | public Framework() {
// call constructor of extended Canvas object
super();
//set the game state
gameState = GameState.VISUALIZING;
//We start game in new thread.
Thread gameThread = new Thread() {
@Override
//start th game thread and call game... |
e3d2bd69-b9d4-42b0-b62f-35dfc7747222 | 4 | public Set<Move> getAllLegalMoves() {
Set<Move> legalMoves = new HashSet<Move>();
for (int i = 0; i < NUMBER_OF_COLS; i++) {
for (int j = 0; j < NUMBER_OF_ROWS; j++) {
Coordinate startCoord = new Coordinate(i, j);
Piece piece = getPiece(startCoord);
if (!piece.isNone() && piece.getColor() == current... |
15b2e54b-1298-4f0e-8c0c-af10dffea9e3 | 8 | public static TranslationEntry swapIn(int pid, int vpn, LoaderForCoff loader)
{
VMKernel.printDebug("Beginning swap in sequence!!!");
TranslationEntry entry;
int ppn = pageReplacementAlgorithm.findSwappedPage();
try
{
swapOut(ppn);//if only if it's already in the memo... |
acb460f0-ba85-4c93-9544-708f748d26b8 | 6 | public static Double valueOf(Object o) {
if (o == null) {
return null;
} else if (o instanceof Float) {
return (double)(Float)o;
} else if (o instanceof Double) {
return (Double)o;
} else if (o instanceof Byte) {
return (double)(Byte)o;
... |
97ac5130-8a9f-469a-9408-c35ae9d40723 | 9 | public static void copyProperties(Object dest, Object orig, boolean boo) throws Exception{
Class<?> clazzOrig = orig.getClass();
Class<?> clazzDest = dest.getClass();
Field[] fList = clazzOrig.getFields(); // 此方法可以取public参数包括父类
//if (fList == null || fList.length == 0) {
fList = clazzOrig.getDeclaredFields()... |
d48e7a84-73aa-4b67-acd6-41fc31a3b5e9 | 1 | void create_file (Object doc,String fpath)
{
Path logfile = FileSystems.getDefault().getPath(fpath);
//fileW=fpath;
String s = (String) doc;
byte data[] = s.getBytes();
try (OutputStream out = new BufferedOutputStream(
Files.newOutputStream(logfile,CREATE))) ... |
7ce4a2f9-427d-4045-b104-1f0229efa6ac | 5 | public String getDescr()
{
if( cxnSp != null )
{
return cxnSp.getDescr();
}
if( sp != null )
{
return sp.getDescr();
}
if( pic != null )
{
return pic.getDescr();
}
if( graphicFrame != null )
{
return graphicFrame.getDescr();
}
if( grpSp != null )
{
return grpSp.getDescr();
... |
2510da9b-54f5-481d-b29e-839f909ab077 | 2 | public static void main(final String[] args)
{
Server server = null;
if (args.length > 0)
{
server = Server.getInstance(Integer.parseInt(args[0]));
}
else
{
server = Server.getInstance(5042);
}
server.start();
try
{
server.join();
}
catch (final InterruptedException e)
{
e.printSt... |
b62bc497-5390-42d1-8924-29d3ec97642b | 1 | public void normalizePercentage() {
percentage = (1.0 * curValue) / maxValue;
if(percentage > 0.99) {
percentage = 1.0;
}
} |
78f9f50d-2943-43ae-96a3-65f309d86793 | 0 | @Override
public int getRank() {
return rank;
} |
c75a0b75-2785-4a7d-8fdb-c73b42d4a327 | 4 | public float get_halffloat(int offset)
{
int signbit;
int mantissa;
int exp;
float result;
if(offset >= 0)
if (pb[5] < (offset + 2))
{
val = -1; // insufficient payload length
return 0;
}
result = ((p... |
b1337f6c-1af2-4afe-897a-673985c6df43 | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for(int c = 0, C = parseInt(in.readLine().trim()); c < C; c++){
if(c == 0)in.readLine();
TreeMap<Character, Character> cypher = new TreeM... |
2b576890-751c-4b4e-8f91-267a4d5aa717 | 4 | @Override
public boolean createPosition(Position position) {
String sql = INSERT_POSITION;
Connection connection = new DbConnection().getConnection();
PreparedStatement preparedStatement = null;
boolean flag = false;
String positionId = position.getPositionId();
String positionName = position.getPositionNa... |
bf650e50-54ac-41b5-b0b7-7e65a3993432 | 7 | @Override
public String getNextTask() {
if (this.initialized == false) {
throw new IllegalStateException("Scheudlers must be initialized before they can be used.");
} else if (this.scheduleable == false) {
throw new IllegalStateException("Task set is not scheduleable.");
}
refreshTasks();
String nextTa... |
9dbef0b6-da9e-422a-b4b6-7b220418b38f | 4 | public void calculateLR(int x) {
Doodle doodle2 = (Doodle) myGuys.get(0);
int doodleX = doodle2.getX();
// if already facing left, dont do anything, same with right
if ((x < doodleX)) {
myImages.set(0, doodleLImg);
doodle2.setX(doodle2.getX());
hFacing = -1;
doodle2.setHFacing(-1);
} else if ((x ... |
1c46aa50-58b8-437c-b875-204d4f5af4f6 | 8 | @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("rowset")) {
String name = getString(attrs, "name");
if (name.equals("skills"))
skills = true;
else if (name.equals("requiredSkills"))
requiredSkills = true;
els... |
7881ae70-b940-415f-b0ad-3215938d3c70 | 8 | boolean ComprovarRes(Clausula c, ClausulaNom cn) {
boolean b = true;
for( RestGrupSessio gs : restriccionsGrupSesio){
String dia = cn.getDia();
int i;
if (dia.equals("dilluns")) i = 0;
else if (dia.equals("dimarts")) i = 1;
else if (dia.equals(... |
13411df9-ae21-4300-bd3a-e9f5447a1203 | 1 | public void inject(ARPPacket p) { // Injects the poison on the network
try {
sender = JpcapSender.openDevice(devices[deviceIndex]);
sender.sendPacket(p);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
6f1e1229-6824-4d5d-8460-b36e00128b1f | 0 | public void setValue(int newValue) {
value = newValue;
} |
cc1ce2c7-56da-4943-99a6-3771f05b7687 | 9 | public void uimsg(String msg, Object... args) {
if (msg == "tabfocus") {
setfocustab(((Integer) args[0] != 0));
} else if (msg == "act") {
canactivate = (Integer) args[0] != 0;
} else if (msg == "cancel") {
cancancel = (Integer) args[0] != 0;
} else if... |
1689732a-2092-4fe1-892a-ff30a6efa2b3 | 2 | public void visitSource(final String file, final String debug) {
if (file != null) {
sourceFile = newUTF8(file);
}
if (debug != null) {
sourceDebug = new ByteVector().putUTF8(debug);
}
} |
92d05e89-e3a2-47d2-b4a0-856a7a990bc2 | 6 | public static String unescape(String s) {
int len = s.length();
StringBuffer b = new StringBuffer();
for (int i = 0; i < len; ++i) {
char c = s.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < len) {
int d = JS... |
7929e057-9bc7-4951-bcd8-78bc8fdbd7c9 | 0 | private ParcelDestination(String whereTo) {
label = whereTo;
} |
bd475257-faa4-4117-86a9-7892895d8141 | 8 | public static void main(String[] args) throws Exception {
int numThreads = 1;
try {
Options opt = new Options();
opt.addOption("h", false, "print help");
opt.addOption("t", true, "number of threads");
opt.addOption("v", false, "verbose");
opt... |
5765274a-8acd-456b-aa40-df9f8b4ec849 | 5 | @BeforeSuite
public void initalize(){
try{
config = new Properties();
FileInputStream fp = new FileInputStream(System.getProperty("user.dir")+"\\src\\com\\nike\\automation\\smartcart\\config\\config.properties");
config.load(fp);
//loading the object repository
OR = new Properties();
fp = ne... |
0f98b6b1-a69a-4a08-9404-d13d2420130a | 8 | @SuppressWarnings({ "rawtypes", "unchecked" })
protected void invokeListeners(String interfaceName, Executable executable, boolean returnsResults) {
List<BusListener> specificListeners = getListenersFor(interfaceName, listeners);
if (returnsResults && specificListeners == null)
throw new IllegalArgumentExceptio... |
78cc1dd6-8739-46ad-9bdd-7c9d1d88227c | 4 | public void keyReleased(KeyEvent key)
{
int code = key.getKeyCode();
if(code == KeyEvent.VK_LEFT)
{
player.setLeft(false);
}
if(code == KeyEvent.VK_RIGHT)
{
player.setRight(false);
}
if(code == KeyEvent.VK_DOWN)
{
player.setDown(false);
}
if(code == KeyEvent.VK_C)
{
player.setWeapo... |
6e7673d8-6c1b-4139-98f6-4f976fbb0621 | 7 | public void generateMoves(Piece[][] squares, ArrayList<Move> validMoves, ArrayList<Move> validCaptures) {
// for each possible direction (NE, SE, SW, NW)
int xPos;
int yPos;
for (int direction = 0; direction < xMoves.length; direction++) {
xPos = xPosition + xMoves[direction];
yPos = yPosition + yMoves[d... |
40cf039b-17fd-459b-8df9-c0969cc0062f | 9 | public void run() {
Selector selector = SocketAcceptor.this.selector;
for (;;) {
try {
int nKeys = selector.select();
registerNew();
if (nKeys > 0) {
processSessions(selector.selectedKeys());
... |
d1126297-073a-4f4f-bd45-1bcfb76b1cc0 | 4 | public static void saveFile()
{
System.out.println("Pokedex save started.");
PrintWriter fout = null;
try{
fout = new PrintWriter(new FileWriter(fileName));
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Pokedex save file not found. Making new one");
try{
fout = new Print... |
191bab76-ec8d-4a4a-82ef-b8f8d1216185 | 4 | public void DisplayOpenSeats(){
int aisleTotal=0, winTotal=0;
for(int i=0;i<wSeats.length;i++){
if(wSeats[i].equals("NA") )
winTotal++;
}
for(int i=0;i<aSeats.length;i++){
if(aSeats[i].equals("NA") )
aisleTotal++;
}
System.out.println("Open Window Seats " +winTotal+"; Open Aisle Seats " +ais... |
aa57fdca-3ba2-4c82-be41-2d9452af5eda | 4 | @Test
public void testHashMapString() {
long minTime = Long.MAX_VALUE;
long maxTime = Long.MIN_VALUE;
long avgTime = 0;
long beforeTime = 0;
long afterTime = 0;
long curTime = 0;
Random random = new Random();
int value;
AbstractProcessor<Strin... |
cadc2cc2-18f1-45f0-b519-7e0e9461ba19 | 0 | public int getIdColor() {
return idColor;
} |
51bf7bcc-cfb7-4cc8-862d-44a7666b11c7 | 7 | public static String generateJavaCode(GUIObject guiObject, HashMap<String, String> allImports, Interface blueJInterface) {
StringBuilder code = new StringBuilder();
code.append(getJavaImports(guiObject, allImports)).append('\n');//Add imports
String clName = (blueJInterface != null ? blueJInt... |
ad7616be-f4d4-4f70-b787-00a9326e5fe0 | 0 | public YamlPermissionRcon(ConfigurationSection config) {
super("rcon", config);
} |
3867fdf0-479f-4db3-88d5-2cfbad83d7ea | 5 | @SuppressWarnings({ "deprecation", "static-access" })
@EventHandler
public void CheckforBasicStoof(PlayerInteractEvent evt){
if(evt.getPlayer().getInventory().contains(Keys.BasicCaseKey) && evt.getPlayer().getInventory().contains(Cases.BasicCase)){
if(evt.getPlayer().getItemInHand().equals(Keys.BasicCas... |
cab4706a-4ede-486d-80bb-e866c9062da2 | 1 | protected String getFileName(URL url) {
String fileName = url.getFile();
if (fileName.contains("?")) {
fileName = fileName.substring(0, fileName.indexOf("?"));
}
return fileName.substring(fileName.lastIndexOf('/') + 1);
} |
fd0522ce-b8df-4b10-b981-d30b9472ba09 | 4 | @Override
public void handleStartTag(HTML.Tag foundTag, MutableAttributeSet attrs, int pos) {
for (HTML.Tag wantedTag : wantedComplexTags) {
if (wantedTag==foundTag) {
if (debug) {
System.out.print("COMPLEX: ");
}
HTMLComponent comp = HTMLComponentFactory.create(foundTag, attrs);
if (debug) {... |
a8c66b3a-3330-44b7-bad8-cc86c5fafd11 | 0 | public ForwarderWorker(Socket clientSocket, String serverText) {
this.clientSocket = clientSocket;
this.serverText = serverText;
Setup.println("[ForwardingService] Conexion abierta desde: " +
clientSocket.getRemoteSocketAddress());
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.