method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
da0878e2-21f7-409a-9d01-62e257722ac1 | 8 | private void processCommand(ActionEvent e) {
synchronized (playerPawns) {
String actionCmd = e.getActionCommand();
int id = Character.getNumericValue(actionCmd.charAt(0));
int cmd = Character.getNumericValue(actionCmd.charAt(1)); //get the command
logEvent("RECEI... |
ee5c871b-b49d-4ec6-a861-342490f54bad | 4 | public void setWidth(int width) {
if(rotation == 90 || rotation == 270){
if(zoom == 1){
this.height = (int) (width/zoom);
}else{
this.height = (int) (width/zoom)+1;
}
}else{
if(zoom == 1){
this.width = (int) (width/zoom);
}else{
this.width = (int) (width/zoom)+1;
}
}
} |
f4d9acf4-4b04-4f03-8b6a-fc050710135a | 7 | private final boolean addWordPhrase(String phrase){
boolean isValid = true;
// recognize optional [e] or (e) and add both variants
int index = phrase.indexOf("[e]");
if (index > 0 && Character.isLetter(phrase.charAt(index-1))) {
for (int i = 0; i < 2; i++) {
addWordPhrase(phrase.subs... |
f0c46f82-1671-43f0-aae0-2a6797da7486 | 8 | public static Contact createContact(User user){
Contact this_contact = new Contact();
// Find all methods in User that are of the form getX
for(Method m :User.class.getMethods()){
String n = m.getName();
if(n.contains("get") && !n.contains("getClass")){
String field = n.substring(3);
try {
... |
9e1dd2ef-323d-46b2-89d7-30843ab26e2a | 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... |
cb2d8e3d-0338-4ccd-bee4-0b06715ba610 | 5 | private int stringToFlow(String flowControl) {
if (flowControl.equals("None")) {
return SerialPort.FLOWCONTROL_NONE;
} else if (flowControl.equals("Xon/Xoff Out")) {
return SerialPort.FLOWCONTROL_XONXOFF_OUT;
} else if (flowControl.equals("Xon/Xoff In")) {
return SerialPort.FLOWCONTROL_XONXOFF_I... |
87bc8f57-9ab2-445c-8890-cf5ff72c350e | 3 | public synchronized void receive (Message m) {
long t__recv, dt;
double rate;
long d;
double average, deviation;
count += 1;
if (count == 1)
_t_recv = System.currentTimeMillis();
d = (System.currentTimeMillis() - Long.parseLong(m.getPayload()));
/* Accumulate */
delay += d;
delaysquared += (doubl... |
ffc4390e-b9b2-4b25-bd9d-f9279608dab9 | 0 | public String getSearchURL()
{
_read.lock();
try
{
return _searchURL;
}
finally
{
_read.unlock();
}
} |
16250c96-8ee0-42d0-9599-05dc0be09c34 | 0 | public double getMarkerLongtitude()
{
return markerRect.getLongtitude();
} |
260c7875-df60-4645-bc38-bc3318fa4e9a | 0 | public static Map<String, UserEntity> getUsers() {
return users;
} |
87119342-a16f-42eb-9acb-f12dee27c775 | 1 | public Locale pop() throws Exception {
Locale retVal = null;
// Check for stack underflow.
if (topPtr < CAPACITY) {
retVal = arr[topPtr];
topPtr = topPtr + 1;
} else {
Exception underflow = new Exception("Stack Underflow");
throw underflow;... |
37a17e76-fdc8-46eb-9695-e6f4cb26280e | 9 | public void process(boolean checkIP) {
String referrerip = null, referredip = null;
if(checkIP) {
referrerip = referrer.getIP();
referredip = referred.getIP();
if(referrerip == null || referredip == null) {
referrer.sendMessage("§4Something went wrong");
return;
}
}
ReferData referredrd = ne... |
03f311f4-46ca-4560-96e3-b48b762b611a | 9 | public List<Chambre> recherche(
Date dateDebut, // obligatoire
Date dateFin, // obligatoire
Integer ignoredReservationId,//peut être null. Utilisé lors de modification de reservation
Integer prixMin, //peut être null
Integer prixMax, //peut... |
12c3c23e-f446-480c-93cf-435473b71744 | 5 | public void run()
{
while(Integer.parseInt(fps)<80||Integer.parseInt(fps)>110)
{
frames++;
frameRateManager();
creditMusic.stop();
try
{
Thread.sleep(slp);
}
catch(Exception ignored){}
}
creditMusic.loop();
while(true)
{
repaint();
frames++;
frameRateManager();
try
... |
55c9d02d-77d5-4d4c-bada-763a7b29ca75 | 7 | public boolean pickAndExecuteAnAction() {
if (requestHousing) {
requestHousing = false;
RequestHousing();
return true;
}
if (mHouse != null) {
if(!mBills.isEmpty()){
synchronized (mBills) {
for (Bill b : mBills) {
if (b.mStatus == EnumBillState.Pending) {
PayBill(b);
r... |
4df9eb44-51cc-4086-b336-4ed939910693 | 4 | private final boolean completeService() throws MaxServices, FatalError {
try {
String s = Utils.getString("quests/start");
if (s.indexOf("/img/images2/max.jpg") != -1) {
throw new MaxServices();
}
String search = "var quests = ";
int start = s.indexOf(search);
if (start == -1) {
return f... |
87615006-b186-4e83-b36b-cc23044ce5b9 | 2 | private void redoWrite(String[] values) {
FileWriter writer = null;
String newLSN = values[0].split("\\:")[1];
String ta = values[1].split("\\:")[1];
String data = values[2].split("\\:")[1];
String pageId = values[3].split("\\:")[1];
try
{
writer = new FileWriter("page" + pageId);
writer.write("L... |
85ea49c1-0721-4a04-b142-3f1740200eb6 | 6 | public static void close(ResultSet rs,Statement st,Connection conn){
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if(st!=null){
try {
st.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if(conn!=null){
try {
conn.close... |
0962a1f7-74d3-4876-856b-cd21f62e0be6 | 3 | public void mergeDown(boolean createUndo) {
if (layers.size() > 0 && activeLayer > 0) {
if (createUndo) {
addUndo(new CPUndoMergeDownLayer(activeLayer));
}
layers.elementAt(activeLayer).fusionWithFullAlpha(layers.elementAt(activeLayer - 1),
new CPRect(width, height));
layers.remove(activeLayer);... |
c5d24bfb-fdeb-4fea-a483-6189870e2e4b | 5 | public Door getDoorFromCoords(int areaX, int areaY, int x, int y) {
for (Door e : doorAreas[areaY][areaX]) {
if ((x <= e.x + 1) && (x >= e.x) && (y <= e.y + 1)
&& (y >= e.y)) {
return e;
}
}
return null;
} |
d76d1b83-2ba2-45ac-b50b-5fe3f1fd7803 | 7 | public CBlock getControllerBlockFor(CBlock c, Location l, Material m, Boolean o) {
for (Iterator<CBlock> i = blocks.iterator(); i.hasNext(); ) {
CBlock block = i.next();
if (
c != block &&
(m == null || m.equals(block.getType())) &&
(o == null || o.equals(block.isOn())) &&
block.hasBlock(l)... |
00d7c976-25eb-4d01-8c6d-cae19bf5fc99 | 6 | public Set<Robotti> onkoEdessarobottia(Ruutu ruutu, int suunta) {
Set<Ruutu>ruudut= new HashSet<>(); //bad code
ruudut.add(ruutu);
Ruutu next=lauta.seuraavaRuutu(ruutu, suunta);
ruudut.add(next);
if (lauta.getSeinat().contains(ruudut)||!lauta.onLau... |
c58a75fd-652d-45ef-9333-aeea23f6dfde | 4 | void parse_frame() throws BitstreamException
{
// Convert Bytes read to int
int b=0;
byte[] byteread = frame_bytes;
int bytesize = framesize;
// Check ID3v1 TAG (True only if last frame).
//for (int t=0;t<(byteread.length)-2;t++)
//{
// if ((byteread[t]=='T') && (byteread[t+1]=='A') && (byteread[t+2]=='G'))
... |
b5cdff1c-aadf-445a-9c43-17c599680fc9 | 2 | private boolean isSpace(String str) {
char ch = str.charAt(0);
return ch == ' ' || ch == '\t' || ch == '\n';
} |
d11fc61a-ee16-4341-b052-0a44ef4a9c06 | 6 | public void updateFrame() {
if (isHidden()) {
return;
}
setCurrentFrame(nextIndex);
if (alternate) {
if (direction)
nextIndex++;
else
nextIndex--;
if (nextIndex >= getTotalFrames()) {
direction = false;
nextIndex--;
}
if (nextIndex == -1) {
direction = true;
nextIndex = 0;
}
}... |
bd9a0450-5f1b-4f6e-8696-3d6e5dbfa97f | 3 | public NewElectronicDocumentDialog(final Domaine domaine) {
setResizable(false);
setTitle("Choisir un fichier electronique");
setModalityType(ModalityType.APPLICATION_MODAL);
setBounds(100, 100, 450, 238);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
... |
2427cc3b-371a-497f-a870-4742ae9299c8 | 5 | public Object eval() throws Exception {
boolean cond;
try {
cond=((Boolean)chi[0].eval()).booleanValue();
} catch (Exception e) {
try {
chi[1]=new OPload(chi[1],chi[1].eval());
} catch (Exception exc) {
};
try {
chi[2]=new OPload(chi[2],chi[2].eval());
} c... |
514d7e54-6000-4714-9ace-9c7757dc8d5a | 4 | public static void setupButton(AbstractButton button, int xSize, int ySize, boolean filled, boolean border)
{
//Set button dimensions
if(xSize > 0 && ySize > 0)
{
button.setPreferredSize(new Dimension(xSize, ySize));
button.setSize(new Dimension(xSize, ySize));
... |
dece422a-9585-45a3-bf02-d66d1bae0f0e | 5 | public boolean nodeConnectionFailure(String hostname)
{
client.printTerminalError("Lost connection to node: " + hostname);
Node prevNode = null;
Node nextNode = null;
Node failedNode = null;
try
{
NodeManagerInterface iFace = (NodeManagerInterface)client.getNodeServerInterface();
String ipFa... |
1355b4b5-5852-40df-b1d3-54114833fd48 | 8 | public static String lida(String content, int index) {
StringBuffer sbContent = new StringBuffer();
int leftIndex = content.indexOf("[", index);
int rightIndex = content.indexOf("]", index);
if (leftIndex != -1 && rightIndex != -1 && rightIndex > leftIndex) {
//如果"["和"]"之前存在"... |
2b386de6-c707-4213-bbef-f6d653e2681f | 7 | private boolean checkRowOrLine(int[] toCheck){
int[] checker = new int[toCheck.length];
for (int i = 0; i < checker.length; i++) {
checker[i] = 0;
}
for (int i = 1; i < toCheck.length +1; i++) {
for (int j = 0; j < toCheck.length; j++) {
if(toCheck[j] == i){
checker[i-1]++;
}
}
}
f... |
99ae3237-504b-4b98-b86c-9bab9d106838 | 5 | public static MaplePacket scrolledItem(IItem scroll, IItem item, boolean destroyed) {
// 18 00 01 02 03 02 08 00 03 01 F7 FF 01
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM);
mplew.write(1); // fromdrop... |
203f75e6-2790-43bd-9db8-a3f512dc0e47 | 7 | private void skip()
{
if (pos != NO_POS) lastPos = pos;
if (pos == END_POS) return;
while (++pos < strChar.length)
{
if (quotes.indexOf(strChar[pos]) > -1)
inQuote = !inQuote;
if (!inQuote && delim.indexOf(strChar[pos]) > -1)
return;
... |
0cbc9b60-f1f3-473a-92d3-f914057b2f7f | 6 | public void ThreePlayer(String[] split, String command)
{
if (split.length != 5)
{
PrintMessage("Syntax:!freeplay [name] [eastplayer] [southplayer] [westplayer] [northplayer]");
return;
}
String name = split[1];
String east = split[2];
String south = split[3];
String west = split[4];
Player e = n... |
084c49ea-9c02-4c99-b7dd-f710d84b3f16 | 1 | public byte getByte( String name ){
XAttribute attribute = getAttribute( name );
if( attribute == null )
throw new XException( "no attribute known with name: " + name );
return attribute.getByte();
} |
3da88543-3e83-4230-8d18-ce9c44ab897c | 5 | public static void main(String[] args)
{
// reading the configuration file.
ConfigurationReader configuration = new ConfigurationReader(_propertiesFile);
if (!configuration.readConfigurationFile())
{
System.out.println("Failed in reading configuration file.");
return;
}
String twitterPropertiesFile ... |
9f146e00-424e-4122-a0ab-ce2150833ad3 | 3 | void jButton_savejson_actionPerformed(ActionEvent e) {
File f = null;
String propname = "";
JFileChooser chooser = new JFileChooser(this.directory);
chooser.setFileFilter(new ImageMapFilter());
chooser.setDialogTitle("Save Map File");
// chooser.setLocale(currentLocale);
if (chooser.showSaveDialog(this) =... |
4c6bbb14-b4a1-4eca-aefe-3e228f6c9b04 | 0 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long now = TimeMachine.getNow().getTime();
rtn.put("rtnCode", this.getRtnCode(200));
rtn.put("timestamp", now);
return rtn;
} |
ecaffd3e-3c3c-45e9-beb2-0f0866cbf028 | 4 | public void setRectangles() {
int currentFrame = jSlider1.getValue();
int linkSelected = jList2.getSelectedIndex();
for(int i=0; i<metaRecords.size();i++)
{
Metafile m = metaRecords.get(i);
for(int j=0; j<m.kf.size();j++)
{
... |
92b12e53-bb6d-4b61-9304-baf02ddb5c26 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
final boolean undead=CMLib.flags().isUndead(target);
if(!super.invoke(mob,commands,givenTarget,auto,a... |
26fbe488-ebd4-4a20-93fc-3302367a26da | 6 | public ServerAPP() {
initComponents();
System.runFinalizersOnExit(true);
try {
sendMessage("### --- ### --- ### --- --- ### --- ### --- ###");
sendMessage("A abrir ficheiro de configuração...");
File XMLConfig = new File("src\\LogicClasses\\Server\\... |
d9abbcd7-e479-4ef3-8bec-85090bf335e2 | 8 | public void actionPerformed(ActionEvent actionEvent) {
if (animationTimer==null){
return;
}
if (!animationTimer.isRunning()){
return;
}
if (!isAnimating()){
animationTimer.stop();
return;
}
... |
32e11979-49b1-44a5-b12e-fa69b8e720b3 | 6 | public static final void UseItem(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (!chr.isAlive()) {
c.getSession().write(MaplePacketCreator.enableActions());
return;
}
slea.skip(4);
final byte slot = (byte) slea.readSho... |
2517287b-bc8c-4e63-815f-8a0f2ee448f0 | 8 | @Override
public void update() {
if(!isBattleOver){
//For every game object in gameObjects
for(GameObject obj : objects)
{
obj.update();
}
//Update competitors
competitor1.update();
competitor2.update();
//Check for collisions
Directory.collisionManager.update();
//remove ever... |
b3b6cbcb-3484-47a9-8e8a-d94b25b2d7ba | 5 | public static int insertMstxAds(String gdis) {
int gid = MstxDao.getMaxNumber("mstx_ads");
MstxDao.updateMaxNumber(5);// 将该字段值加1
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement("insert into mstx_ads(gid,gdis) values(?,?)");
ps... |
389b6dd0-391e-4a29-90b1-e835f2d21f1a | 4 | public void setData1(Complex[] data, int power) {
this.power = power;
double angle;
count = 1 << power;
wc = new Complex[count / 2];
x = new Complex[count];
x1 = new Complex[count];
x2 = new Complex[count];
fd1 = new Complex[count];
for (i = 0; i < count / 2; i++) {
wc[i] = new Complex();
}
... |
9eef8974-d995-4b21-9a1b-0e1667f4bd3d | 1 | @Override
public void sort(int[] array) {
if (array.length > 1) {
// split array into two halves
int[] left = leftHalf(array);
int[] right = rightHalf(array);
// recursively sort the two halves
... |
e08b1e32-7cde-4fc8-a9a7-c34ecabdd973 | 5 | @Deprecated
protected long getWindowId(ComponentPeer peer) {
try {
Method m = peer.getClass().getMethod("getWindow");
return (Long) m.invoke(peer);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetExceptio... |
10a42f6e-23b0-446e-8311-8246f4605ef4 | 8 | public static Stella_Object clTranslateUnit(TranslationUnit unit) {
{ Symbol testValue000 = unit.category;
if (testValue000 == Stella.SYM_STELLA_GLOBAL_VARIABLE) {
return (TranslationUnit.clTranslateDefineGlobalVariableUnit(unit));
}
else if (testValue000 == Stella.SYM_STELLA_CLASS) {
... |
b2ef0bd5-9a15-4d1e-98be-e73a2e2f03aa | 3 | @Override
public boolean wipeTable(String table) {
//Connection connection = null;
Statement statement = null;
String query = null;
try {
if (!this.checkTable(table)) {
this.writeError("Error wiping table: \"" + table + "\" does not exist.", true);
return false;
}
//connection = open();
thi... |
2d2d2241-f933-4f2b-96dc-89aec7852b17 | 9 | final synchronized void method2501(int i, int i_124_, int i_125_) {
if (i == 0) {
method2500(i_124_, i_125_);
} else {
int i_126_ = method2493(i_124_, i_125_);
int i_127_ = method2491(i_124_, i_125_);
if (anInt9711 == i_126_ && anInt9708 == i_127_) {
anInt9715 = 0;
} else {
int i_128_ = i_124... |
69194856-5ae6-4849-90dd-6e91e104e6e4 | 9 | public static void addObject(Object o, Object arg) {
// Able to handle many different type of objects
if(o instanceof Recordable)
((Recordable)o).record(arg);
else if(o instanceof List) {
List l = (List)o;
if(l.size() != 0 && l.get(0) instanceof Recordable) {
// If have list of rec... |
b811ce3f-077b-4923-835a-b535ed1ea93f | 3 | public InterpretedLine(String source) throws AssemblyException {
this.source = source;
List<String> tokens = tokenize(source);
switch(tokens.size()) {
case 3:
label = tokens.get(0);
opCode = parseOpCode(tokens.get(1), true);
loc = tokens.get(2);
break;
case 2:
OpCode op = parseOpCode(tokens.... |
969270a2-34ad-42bf-bcd1-51a89b872caa | 6 | @Override
public void run(){
while(!super.detener){
try{
if(!this.guerreroColaAtaques.isEmpty())
recibirdaño();
if(this.objectivo.x==0&&this.objectivo.y==0){
this.objectivo=getObjectivo();
pl... |
16913f61-cf57-4c47-a43d-e4a86fbd3aa8 | 6 | public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == JButton_Exit)
JButtonExit_actionPerformed(event);
else if (object == JButton_PerAC)
JButtonPerAC_actionPerformed(event);
else if (object == JButton_CompAC)
JButtonCompAC_actionPerfo... |
bccb6c07-9773-44b6-bd75-83d86143d867 | 8 | private Partition sIB_OptimizeT(Partition tmpT, Input input) {
boolean done = false;
int change = 0, loopCounter = 0;
if(m_verbose) {
System.out.println("Optimizing...");
System.out.println("-------------");
}
while (!done) {
change = 0;
for (int i = 0; i < m_numInstances; i+... |
913852ab-2391-486c-b428-fb0e9f06cee5 | 4 | CountMacId(String pic,String username,String mac_id)
{
this.pic=pic;
this.username=username;
this.mac_id=mac_id;
int flag=0;
for(int i=0;i<studentCountMac_id.size()&&flag==0;i++)
{
if(studentCountMac_id.get(i).mac_id==mac_id)
{
flag=1;
this.count+=1;
}
}
if(flag==0)
... |
31b5183f-7205-4b38-8fc0-f9f6dcaeb679 | 9 | public EntropyDecoder newDecoder(InputBitStream ibs, short entropyType)
{
if (ibs == null)
throw new NullPointerException("Invalid null input bitstream parameter");
switch (entropyType)
{
// Each block is decoded separately
// Rebuild the entropy decoder to reset block s... |
64985698-d9cf-4447-b51f-dbaca8da37b8 | 6 | public static int createStudent() {
System.out.println("=== Creation of a student ===");
Scanner scId = new Scanner(System.in);
System.out.print("Give a name: ");
String name = "";
while (name.equals("")) {
Scanner scName = new Scanner(System.in);
name = scName.nextLine();
}
System.out.print("Give a... |
25479ed1-4f56-44b0-a816-23c40a86bc67 | 9 | public String raise(int minRaise, int maxRaise){
double avrgOppAPW = getAvrgOppAPW(match.holeCards.size());
if (avrgOppAPW != 0.0) {
double avrgOppWin = getAvrgOppWin(match.holeCards.size());
if (avrgOppAPW <= 0.35) {
if (avrgOppWin >= (match.stackSize / 4)) {
weight *= 1.5;
}
}
if (avr... |
72bb1627-0cc9-48be-af15-b53472b14fdb | 9 | public boolean birthChecker() {
switch (state) {
case NONE:
// If leftHand is below leftElbow which is below leftShoulder (or right)
if (GestureInfo.gesturePieces[GestureInfo.LEFT_HAND_DOWN]
&& GestureInfo.gesturePieces[GestureInfo.RIGHT_HAND_D... |
482b300f-8bc6-48fc-947a-4cb26d8b4c17 | 0 | public static byte[] encrypt(byte[] data, String key, String algorithm)
throws InvalidKeyException, NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException,
BadPaddingException, IllegalBlockSizeException {
Key k = toKey(SecurityCoder.base64Decoder(key), algorithm);
Cipher cipher = Cipher.... |
a3734801-9842-49de-b304-f239ea825285 | 1 | private void indent(Node node, StringBuffer buf) {
for (int i = 0; i < node.getDepth(); i++) {
buf.append("\t");
}
} |
796159f8-37b2-43d2-ab11-f00bc84cc349 | 0 | @Override
public void itemStateChanged(ItemEvent e) {
handleUpdate();
} |
b7cc80e2-873b-434e-b070-7cae2c0795e3 | 4 | public void init() {
this.setTitle("coupe");
this.setResizable(true);
this.setVisible(true);
this.setSize(200,100);
this.setLayout(new GridLayout(2, 1));
this.setLocation(ecran.getFrame().getX() + ecran.getWidth() / 2 - this.getWidth() / 2, ecran.getFrame().getY() + ecran.getHeight() / 2 - this.getHeight()... |
6a0c2fb4-87d5-4ec4-aef4-0d8b0acd8df4 | 4 | public boolean eq(Matrix B) {
Matrix A = this;
boolean isEqual = false;
if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions.");
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
isEqual = A.data[i][j] == B.data[i][j];
... |
91c22036-96ec-484a-87b8-bc5bf4deea77 | 3 | public CloudMapPanel(PPLGGGUI<T> gui, PPLGGFront<T> front) {
this.front = front;
this.converter = front.getConverter();
this.gui = gui;
sampleMaps = new ArrayList<Map>();
state = State.IDLE;
this.setSize(blockWidth * Generator.width, blockHeight
* Generator.height);
playableSamples = 0;
playtested... |
005b09cd-2101-4a38-98b5-51676f1e51a6 | 1 | public static void init() throws IOException{
File file = new File("../logic.properties");
if(file.exists()){
properties = new Properties();
properties.load(new FileInputStream(file));
}
} |
46800525-e787-4c47-b4ad-f3b2d98265e5 | 9 | synchronized HtmlPage loginuser()
{
HtmlPage hp=null;
err=0;
do
{
if(enabled)
{
hp=login();
if((hp!=null)&&hp.getTitleText().indexOf("Unknown user or password incorrect")!=-1)
{
st.showMessage... |
ec1816b9-3c27-481f-b7b0-278abb437383 | 2 | @Override
public void print(String file) {
Runtime r = Runtime.getRuntime();
Process p;
try {
String command = this.IrfanViewPath + " " + file + " /print";
System.out.println(command);
p = r.exec(command);
} catch (IOException e) {
e.pr... |
877c5039-24c9-494f-aa15-f938f84dde21 | 2 | public boolean isOnStreetNonTransit() {
return this == WALK || this == BICYCLE || this == CAR;
} |
70f708b6-1817-4280-aa62-b082d82a656e | 7 | private static Expression<?> getExpressionPathAndFunctions(
CriteriaBuilder cb, Path<String> pathString, String element,
String function) {
Expression<?> expr = null;
Path<Number> pNumber = getNumberPath(pathString, element);
if (function.equalsIgnoreCase("count")) {
/**
* field that can be numeric o... |
b58e61b2-45e1-4d82-ae33-6f52444eb6b7 | 7 | @Override
public void keyTyped(KeyEvent e) {
if (consoleInputField != null) {
/* User can enter backspaces. */
if (e.getKeyChar() == (char) 8 && consoleInputField.getCmd().length() > 0) {
String nev = consoleInputField.getCmd();
... |
17b8ec9a-a0ba-466b-bf6e-d80882f6c609 | 4 | @Override
public void attack(ArrayList<Player> players, boolean server) {
if (getPlayer().getGame().getSocketClient() == null || server == true) {
addProjectile();
} else if (getPlayer().getName().equalsIgnoreCase(getPlayer().getGame().getUserName()) && !server) {
addProjectileToServer();
}
} |
0356aec4-1245-4970-8a39-3259c22adb0c | 7 | public static Reader inputReaderFrom(final Object object) throws IOException {
if (object instanceof Reader) return (Reader)object;
if (object instanceof File) return IO._inputReaderFrom_((File)object);
if (object instanceof InputStream) return IO._inputReaderFrom_((InputStream)object);
if (object instanceof Ch... |
4a3aa186-1467-4037-9339-4c540abe55fb | 0 | public CalucularBinomioControle(BinomioEntidade e) {
super();
this.e = e;
} |
63a2137f-16ff-4deb-b837-5513fd3bed9b | 9 | public static void main(final String[] args) throws Exception {
int runs = 1;
int eat = 0;
if (args.length <= 1) {
Stats.usage();
}
for (eat = 0; eat < args.length; eat++) {
if (args[eat].equals("-run")) {
if (++eat >= args.length) {
Stats.usage();
}
runs = Integer.parseInt(args[eat]... |
ceed628b-2a24-4a6c-920a-5d1b04464be8 | 4 | public void acceptTrade(Player player) throws PlayerNotFoundExeption
{
if (player.equals(p1))
p1acc = true;
else if (player.equals(p2))
p2acc = true;
else {
throw new PlayerNotFoundExeption();
}
languageHandler.sendMessage(player, "trade.accept.self");
languageHandler.sendMes... |
510ab15b-9bce-4f6c-b4ab-f126b300b42f | 6 | @Override
public void addPoint (double distance, int index) {
if (distance >= worstDistance)
return;
if (count < capacity)
count++;
int i;
for (i = count-1; i > 0; i--) {
if (distanceIndexArray.get(i-1).distance > distance ||
(distanceIndexArray.get(i-1).distance == distance && distanceIndexArra... |
dcd6df92-10fb-4f19-8007-2fb2fbf81573 | 9 | public static final String toString(JOSObject<?,?> object){
if(object == null)
return "null";
StringBuilder toString = new StringBuilder();
toString.append(object.getClass().getName());
toString.append("[type=");
toString.append(object.getName());
if(object instanceof JOSCompound){
toString.append(", ... |
12f799ce-87af-4caf-98d4-b45816bbac85 | 7 | public static long ping(final String host, final int port,
final int timeoutMs) {
long start = -1;
long end = -1;
long total = -1;
final Socket s = new Socket();
try {
final InetAddress addr = InetAddress.getByName(host.trim());
final InetSocke... |
b4a1f68d-3cd3-41fb-9788-d3b269f507cb | 2 | private static String loadShader(String fileName) {
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader = null;
try {
shaderReader = new BufferedReader(new FileReader("./res/shaders/"
+ fileName));
String line;
w... |
4b1b1e73-dbf0-4ee2-9e31-4e00b7da7762 | 2 | public void setKickingPosition(float newPosition) {
if (newPosition <= 1.0 && newPosition > 0.0f) {
kickingPosition = newPosition;
ballImage.setPercentfromCenter(newPosition);
}
} |
6d414c81-68a0-4c08-915e-3453e98eef27 | 9 | private final void method553(byte[] bs, int[] is, int i, int i_24_, int i_25_, int i_26_, int i_27_, int i_28_, int i_29_, int i_30_, int i_31_, int i_32_, aa var_aa, int i_33_, int i_34_) {
aa_Sub1 var_aa_Sub1 = (aa_Sub1) var_aa;
int[] is_35_ = var_aa_Sub1.anIntArray5487;
int[] is_36_ = var_aa_Sub1.anIntArray548... |
d746545d-03f7-4bbd-8e6f-6905d1c2222e | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((!mob.isInCombat())||(mob.rangeToTarget()<1))
{
mob.tell(L("You really should be in ranged combat to cast this."));
return false;
}
for(int i=0;i<mob.location().numItems();i++)
{
fi... |
15e788f9-ba30-4e43-b959-299ef3ca8be5 | 1 | public void testToStandardMinutes() {
Hours test = Hours.hours(3);
Minutes expected = Minutes.minutes(3 * 60);
assertEquals(expected, test.toStandardMinutes());
try {
Hours.MAX_VALUE.toStandardMinutes();
fail();
} catch (ArithmeticException ex) {
... |
a949a224-7db2-4f90-a1cd-4b05fabda436 | 2 | public Player(String user, float startx, float starty) throws SlickException{
username = user;
Image spritesheet = new Image("data/NewSprite.png");
sprites = new Image[4][3];
for (int h = 0; h < sprites.length; h++){
for (int w = 0; w < sprites[0].length; w... |
02901b6e-06ab-47a1-b4a7-6fc599531ad4 | 6 | public static void getByUrl(URL url, String localFilename, String UA)
throws IOException {
// Setto gli stream
InputStream inStream = null;
FileOutputStream outStreamFile = null;
try {
// Apro la connessione con l'url datomi e setto lo user-agent come fossi browser
... |
cc549e9f-3924-449c-938e-20a5ef05f91d | 9 | public void detectCollisionsGameObjects()
{
for (StageObject characterObject : stage.getMapObjects())
{
if (characterObject.isAlive())
{
for (StageObject characterObjectLoop : stage.getMapObjects())
{
if (characterObject != ... |
47ab4cd5-e508-4c25-a217-225d953c7d3b | 2 | public static void main(String[] args) {
CardPower p1 = new CardPower();
p1.add(8).
add(12).
add(11).
add(10).
add(9).
add(6);
CardPower p2 = new CardPower();
p2.add(8).
add(12).
add(11).
add(10).
add(9).
add(3).
add(6);
System.out.println(p2.compareTo(p1));
ArrayList<CardPower> cp ... |
88828aa3-db08-4063-9cd3-21c651b7a33d | 3 | @WebMethod(operationName = "ReadRole")
public ArrayList<Role> ReadRole(@WebParam(name = "role_id") String role_id) {
Role role = new Role();
ArrayList<Role> roles = new ArrayList<Role>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
if(!role_id.equal... |
6daffb1e-6566-46e1-ad49-91b3264c42e3 | 6 | private void mergeDatas(Data data) throws MyExceptions {
List<Float> list = new ArrayList<Float>();
list.add(0.0f);
for(int i = 0; i < data.getRow(); ++i)
for(int j = 0; j < data.getColumn(); ++j) {
if(!list.contains(data.getMatrixValue(i, j)))
list.add(data.getMatrixValue(i, j));
}
for(int i = 0... |
f9ac24e6-33ae-46c8-b70c-f988e18b00e9 | 3 | public static FeistelCypher getFeistelCypher(FeistelCypherType type) {
FeistelCypher cypher = null;
switch (type) {
case TEA:
cypher = new TEA();
case XTEA:
cypher = new XTEA();
break;
case XXTEA:
cypher = new XXTEA();
break;
}
return cypher;
} |
86113378-42b1-4ea3-8ed0-cd2769be5b21 | 5 | public static void main(String[] args) {
final int SIZE = 10;
QueryThread[] threads = new QueryThread[SIZE];
long startTime = System.currentTimeMillis();
for (int i = 0; i < SIZE; i++) {
while (!pool.availableConnections()) {
try {
Thread.... |
4f9930f0-dad3-4c65-9cd8-7e312fda4633 | 9 | public static Message decode(final InputStream input)
throws IOException {
DataInputStream dataInput = new DataInputStream(input);
int length = dataInput.readInt();
if (length == 0) {
return KEEP_ALIVE;
}
byte id = dataInput.readByte();
switch (id) {
case (chokeID):
return CHOKE;
case (... |
90c44b90-a47a-4ba6-9781-664c216fff9a | 0 | public JLabel getjLabelOffreEchantillons() {
return jLabelOffreEchantillons;
} |
99ec4420-0454-48d3-9d9b-ed1cd5aaab97 | 3 | private long computeRemoteFileSize() {
URL url = null;
HttpURLConnection connection = null;
long result = 0;
try {
if ("Linux".equals(osName))
url = new URL("http://team-m4gkbeatz.eu/UniversalAndroidToolkit/sdkDownload/android-sdk_r22.6.2-linux.tgz");... |
0eccbc2d-b143-4cf3-b7b5-61985bb24766 | 9 | public static osd_bitmap osd_new_bitmap(int width, int height, int depth) {
osd_bitmap bitmap;
if ((Machine.orientation & ORIENTATION_SWAP_XY) != 0) {
int temp;
temp = width;
width = height;
height = temp;
}
if ((bitmap = new osd_bitmap... |
26a3e21e-406f-43ed-8f82-02b4ed71d19f | 5 | @Override
public void write(FileHandle handle, ByteBuffer buffer, long offset) throws DriveFullException, PartIsLockedException {
if (fileLocking)
{
FileLock lock = getFileLockWithinOffset(handle.getFilePath(), offset, offset + buffer.limit());
if (lock != null)
{
if (lock.handle != handle)
throw... |
7d6e6953-90af-40a7-8d32-e423b26c470d | 5 | private void mergeParts(int lowerIndex, int middle, int higherIndex) {
for (int i = lowerIndex; i <= higherIndex; i++) {
tempMergArr[i] = array[i];
}
int i = lowerIndex;
int j = middle + 1;
int k = lowerIndex;
while (i <= middle && j <= higherInd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.