method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9e33ce56-5807-4111-b79f-8312de50e8cf | 8 | private void Light()
{
if (hasFireBuilt)
{
battery = ps.getBattery();
gum = ps.getGum();
Dialog.message("\nHow should I light the fire?");
if (battery >= 1 && gum >= 1)
{
Dialog.message("\nHey I still have a cou... |
5ab0217f-05d3-40ba-960d-6887cc47c04c | 0 | public void edit(T entity) {
getEntityManager().merge(entity);
} |
b8ad8965-6b8c-49ac-91cd-ed3cd036baf8 | 4 | public static int sizeOfRawVarInt(final int value) {
if ((value & (0xffffffff << 7)) == 0) {
return 1;
}
if ((value & (0xffffffff << 14)) == 0) {
return 2;
}
if ((value & (0xffffffff << 21)) == 0) {
return 3;
}
if ((value & (0xffffffff << 28)) == 0) {
return 4;
}
return 5;
} |
a46a047a-003b-4eea-af98-d61dda8b8f3b | 1 | private void execSalvarCrlv() throws ClassNotFoundException, SQLException{
ModelCRLV c = new ModelCRLV();
c = jifCrlv.getModelCrlv(c, "adicionar");
int result = daoCrlv.insert(c);
gcrlv.addCrlv(c);
if(result == 1){
JOptionPane.showMessageDialog(null, "Registro i... |
8765d8db-2494-4619-876e-7a3f2e3d417c | 8 | static Method getMethod(Class cls,String name,Object [] args) {
Class [] args_cls = new Class[args.length];
for (int i=0; i<args.length; i++) {
if (args[i] instanceof Boolean) {
args_cls[i] = Boolean.TYPE;
} else if (args[i] instanceof Character) {
args_cls[i] = Character.TYPE;
} else if (args[i] i... |
db50c5e6-73b0-49ed-a32e-52718fae8387 | 7 | public void InstrLoad() throws ParseException {
switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
case LDI:
InstrLDI();
break;
case LD:
InstrLD_variant();
break;
case LDD:
InstrLDD();
br... |
d7215a17-aaf6-4f03-bdca-45fd08c431b9 | 0 | @Override
public String toString() {
return "POP " + new Integer(levelsOfStackToPop).toString();
} |
1ebb4922-5842-4c57-8a70-b8cd8834de31 | 9 | public InputStream pcmstream() {
return (new InputStream() {
private byte[] buf;
private int bufp;
private boolean convert() throws IOException {
float[][] inb = decode();
if (inb == null) {
buf = new byte[0];
... |
e53e9302-59ee-48c9-a939-65845a4250c1 | 6 | synchronized void method87(byte i) {
if (i > -11)
paint(null);
if (Class305.canvas != null) {
Class305.canvas.removeFocusListener(this);
Class305.canvas.getParent().setBackground(Color.black);
Class305.canvas.getParent().remove(Class305.canvas);
}
anInt7++;
Container container;
if (Class34.aFr... |
1ab3825b-3727-4012-86e3-1b94accdc8d9 | 5 | public void actionPerformed(ActionEvent e) {
JMenuItem source = (JMenuItem)e.getSource();
System.out.println(source.getText() + " pressed.");
if (source.getText() == "New")
newFile();
else if (source.getText() == "New Layer")
newLayer();
else if (source.getText() == "Open")
openFile();
else if (sou... |
a34c42d8-6926-4e2e-8051-a887410861ee | 3 | public Object invokeMethod(Reference ref, boolean isVirtual, Object cls,
Object[] params) throws InterpreterException,
InvocationTargetException {
if (isWhite(ref))
return super.invokeMethod(ref, isVirtual, cls, params);
MethodIdentifier mi = (MethodIdentifier) Main.getClassBundle()
.getIdentifier(ref)... |
39d1f161-c682-4764-ad90-45ac6e40d5c7 | 0 | protected void setPeriod(double period){
_period = period;
} |
3bab3662-6f1e-435f-a0a6-898d194721b2 | 9 | public static int computeRawVarint64Size(long value) {
if ((value & (0xffffffffffffffffL << 7)) == 0)
return 1;
if ((value & (0xffffffffffffffffL << 14)) == 0)
return 2;
if ((value & (0xffffffffffffffffL << 21)) == 0)
return 3;
if ((value & (0xffffffff... |
924eb655-ca25-4c54-b9f9-53b232d89736 | 7 | public void add(double d) {
Double lows_max = lows.peek();
Double highs_min = highs.peek();
if (lows_max != null && highs_min != null) {
if (d < lows_max) {
lows.add(-d);
lows_count++;
} else {
highs.add(d);
highs_count++;
}
} else if (lows_max == null) {
lows.add(-d);
lows_cou... |
22639501-c514-4341-9716-6005a4c2180a | 8 | @Override
public int compare(Body b1, Body b2) {
int res=0;
if (sortMode==0){
if (b1.getId()>b2.getId()) res=1;
else if (b1.getId()<b2.getId()) res=-1;
}
else if (sortMode==1){
res=b1.getName().compareTo(b2.getName());
}
else if (sortMode ==2){
... |
da5321d5-3d36-4709-b633-33cae0d937a6 | 3 | public void moveHorizontal(int movement) {
stopHor = false;
moveHor = movement;
if(moveHor != 0) moveHor += movement / 10;
if(moveHor < -50) moveHor = -50;
if(moveHor > 50) moveHor = 50;
} |
6447f016-66fc-4917-ba12-22788d3d2fb9 | 1 | public void startMysql() throws IOException
{
ServerSocket socket = new ServerSocket(0);
port = socket.getLocalPort();
socket.close();
dbDir = File.createTempFile("mysqldb", ".db");
Assert.assertTrue(dbDir.delete());
Assert.assertTrue(dbDir.mkdir());
mysqld... |
12c9582d-5094-4c43-94d4-f235ad834e6f | 0 | @Override
public void windowIconified(WindowEvent arg0)
{
} |
c939fbfa-33c3-4115-8039-98565e5b1d5a | 8 | public void update(E object, AABB volume) {
if (traversalCount != 0) {
throw new ConcurrentModificationException("Index cannot be modified during traversal.");
}
Node node = leafMap.get(object);
if (node == null) {
return;
}
if (node != root) {
Node parent = node.parent;
for (int i = 0; i < ... |
8a9192e3-1004-43e0-93b7-419ba213afdf | 0 | @Override
public void setReceiveMessage(IReceiveMessage receiveMessage) {
this.receiveMessage = receiveMessage;
} |
cf9f0903-4652-4a6c-b460-61fcce7ee23b | 9 | public static void extractFromJar(String fileName) {
JarFile jar = null;
InputStream in = null;
OutputStream out = null;
try {
String path = Chunky.class.getProtectionDomain().getCodeSource()
.getLocation().getPath();
path = path.replaceAll("%2... |
8f1f12df-6fb2-4b6c-8787-a2e898ba34dc | 3 | public static void loadSpawnPoint(File file) {
Spawn newpoint;
try {
newpoint = Spawn.loadConfig(file);
FearTheReaper.SpawnPointList.put(newpoint.getName(), newpoint);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
... |
ecad6f67-3102-49e0-8e05-02016872e2d9 | 6 | private void checkOpenConnections() {
if (stopping) {
return;
}
// do routine checks on active connections
synchronized (m_OpenConnections) {
for (Iterator<Connection> iter = m_OpenConnections.iterator(); iter.hasNext();) {
Connection conn = iter.n... |
97817829-bf4f-4f8d-94f1-ccce308b7419 | 0 | public int getLength() {
return getFollowingGlieder();
} |
25b74286-e50d-48c9-a633-073a2340e6d9 | 9 | public Boolean isStringValid(String in) {
//System.out.println("M " + in + " M");
Boolean returnVal=Boolean.TRUE;
if (in==null || in.length()==0) return returnVal;
try {
for (int i=0; i<in.length(); ) {
int start=startChars.indexOf(in.charAt(i));
if (start!=-1) {
int end=... |
80b8e11a-1412-4913-90f9-10569b3acb5e | 2 | public static int getUnreadCount(User user) {
int unreadCount = 0;
try {
String statement = new String("SELECT COUNT(mid) FROM " + DBTable + " WHERE uid2 = ? and isConfirmed = false and isRejected = false");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, user.userID);... |
66d65ad9-4118-468b-80fe-d9b3beb5bda3 | 9 | public RUBTClient(String[] args){
// the following is a check to make sure the command line arguments were
// stored correctly
input = new Scanner(System.in);
if(args.length != 2 && args.length != 3){
System.err.println("Please enter command line arguments: <torrentfile>.torrent <saveFile>.<ext>");
Sys... |
47d78bb2-8afe-4682-8c19-d696f4a3afac | 4 | public void modify(int value)
{
if (stack.empty())
{
stack.push(value);
return;
}
if (value == 0)
return;
if (stack.peek() != -3 || value == -4)
{
stack.pop();
stack.push(value);
}
} |
a7a95279-30ca-489c-9eb4-d15255417ba1 | 5 | public static void main(String[] args) {
if (args.length != 1)
throw new IllegalArgumentException("Incorect parameters count. Expected count is 1 that is assumed as threads count," +
"but current is " + args.length);
threadsCount = Integer.parseInt(args[0]);
//--... |
a8b8ed37-3593-45ea-a14a-f2eb8911a8b5 | 6 | public boolean process(boolean peakX, boolean peakY, boolean peakZ, Double xValue) {
/*
if (peakY) {
if (bottomYcounter < WINDOW_SIZE) {
bottomYcounter = 0;
bottomOk = false;
} else {
bottomOk = true;
}
peakYcount... |
2c5e11b7-e9a0-438b-9a47-aef1b2291dd6 | 4 | public ArrayList<Ligne> getLignesStation(Station s) {
if(s == null || metro == null) return null;
ArrayList<Ligne> res = new ArrayList<Ligne>();
for(Ligne ligne : metro) {
if(ligne.existeStation(s)) res.add(ligne);
}
return res;
} |
f9b9c78a-f0ed-44fe-9a99-952c760ecb6b | 5 | private boolean func_151635_b(int[] p_151635_1_, int[] p_151635_2_, int p_151635_3_, int p_151635_4_, int p_151635_5_, int p_151635_6_, int p_151635_7_, int p_151635_8_)
{
if (p_151635_6_ != p_151635_7_)
{
return false;
}
else
{
int k1 = p_151635_1_[p_... |
174090dc-0816-4b57-a4b2-189d8770fbd6 | 2 | protected boolean isInterface(final Type t) {
if (currentClass != null && t.equals(currentClass)) {
return isInterface;
}
return getClass(t).isInterface();
} |
f283f452-e3c5-4ff3-b22e-baafc46b4736 | 3 | private static ArrayList<Fact> loadFacts()
{
ArrayList<Fact> facts = new ArrayList<>();
int k = da.getNumberOfFacts();
for(int i=1; i<=k; i++)
{
Fact fact = new Fact(i,
da.getFact(i),
da.getFactTex... |
01c8f722-5d20-4d7e-a9e0-ed6e6acf319c | 1 | public String getStyle(String key) {
if(styles!=null)
return styles.get(key);
return null;
} |
a6bc057d-9493-4bdf-b565-3ae5c56a842d | 3 | @Override
public void deleteProduct(Product product) throws SQLException {
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(product);
session.getTransaction().commit();
}catch(Exception e){
e.printStackTrace();
}finall... |
3052f589-fe63-4974-8a4c-831dcc864f28 | 0 | public JTextField getTxtNom() {
return txtNom;
} |
0d5db370-0acb-4d5d-81cf-95fc9c3cb950 | 1 | public void list(String path) throws IOException {
FileStatus[] status = fs.listStatus(new Path(path));
for(int i=0;i<status.length;i++){
System.out.println(status[i].getPath());
}
} |
b205b792-d4c0-41ef-95f6-c89a1593a45d | 5 | @Override public double nextDouble() throws IOException {
JsonToken token = peek();
if (token != JsonToken.NUMBER && token != JsonToken.STRING) {
throw new IllegalStateException("Expected " + JsonToken.NUMBER + " but was " + token);
}
double result = ((JsonPrimitive) peekStack()).getAsDouble();
... |
47702fc4-5ebe-429c-b97c-3717ababe4f6 | 9 | public int getInt(String Pos) {
switch (Pos) {
case "a1":
return 0;
case "a2":
return 1;
case "a3":
return 2;
case "b1":
return 3;
case "b2":
return 4;
case "b3":
return 5;
case "c1":
return 6;
case "c2":
return 7;
case "c3":
return 8;
default:
return 10000;
}
} |
e844c38e-fc09-476b-b167-c6b78131786b | 4 | public static List<String> defineDescription(HashMap<String,List<String>> pDictionary) {
// category
String namespaceCat = "http://vocabularies.wikipathways.org/wp#category";
String namespaceDes = "http://purl.org/dc/terms/description";
comments.clear();
List<String> tempList = new ArrayList<String>()... |
6f134530-0042-468f-8a49-6fe8b2ac3506 | 0 | public void addItemtoUndo(ArrayList<UndoableItem> udi) {
undoStack.push(udi);
} |
2674be5d-e3a4-4089-9fc9-ca40e5a80e96 | 2 | private void addProgram( String text, int type )
{
int shader = glCreateShader( type );
if ( shader == 0 )
{
System.err.println( "Shader creation failed: Could not find valid memory location when adding shader" );
System.exit( 1 );
}
glShaderSource( shader, text );
glCompileShader( shader );
if ... |
454a51ca-39df-4776-9c28-763cad05053b | 7 | private void processLogin2Msg(byte[] pktBuffer, DatagramPacket rcvPkt) {
try {
DataInputStream dis = new DataInputStream(
new ByteArrayInputStream(pktBuffer));
dis.readByte();
int len = dis.readInt();
byte[] encName = new byte[len];
dis.read(encName);
len = dis.readInt();
byte[] retCookie = ne... |
34fcecc5-831f-4384-86cb-749c968116ab | 9 | public void detection_region(Image image) {
long start = System.currentTimeMillis();
long end;
int region = 1;
liste = new ArrayList();
Color noir = new Color(0, 0, 0);
//On init à 0 les pixels noirs ( frontières )
regions.add(new Region(0));
for(... |
d5fe2e46-b33a-4e33-b258-a7d9ad4de656 | 8 | public int minYDistance(int y) {
if (type == TYPE_POLY) {
int p=10000;
for (int i=0; i<poly.npoints; i++) {
int np=poly.ypoints[i];
if (Math.abs(y-np) < Math.abs(y-p))
p=np;
}
return p;
} else if (type == TYPE_RECT) {
int[] points =... |
edd61694-7e95-4e1a-b9a2-afd0dc1b2727 | 6 | public void decryptFile(File read, File write) {
InputStream filein = null;
InputStream in = null;
OutputStream fileOut = null;
try {
cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
filein = new FileInputStream(read);
fileOut = new FileOutputStream(w... |
f8d4a7c4-c2e5-4c8d-a31d-0ec0dbdff64e | 3 | protected Window getParentWindow()
{
Container container = getParent();
while(container != null) {
if(container instanceof Window)
return ((Window)(container));
else if(container instanceof Component)
container = ((Component)container).getParen... |
85ecdc4b-29b8-475e-ab98-e566225d9ba0 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
ec5df700-25b3-47c9-94b4-9ae3008dca89 | 9 | private void setKey(byte[] key)
{
int[] k32e = new int[MAX_KEY_BITS/64]; // 4
int[] k32o = new int[MAX_KEY_BITS/64]; // 4
int[] sBoxKeys = new int[MAX_KEY_BITS/64]; // 4
gSubKeys = new int[TOTAL_SUBKEYS];
if (k64Cnt < 1)
{
throw new IllegalArgumentExc... |
8360f600-e851-4eed-a89f-7d28ecd076fa | 0 | public static String xsddatetime(long date) {
/*******************************************************************
* Finally, we succeed in creating ISO conform dateTime strings!
*******************************************************************/
DateTimeFormatter formatter = ISODateT... |
d882fcef-cca7-45d7-ad9f-6414ecb4245c | 6 | public Type intersection(Type type) {
if (type == tError)
return type;
if (type == Type.tUnknown)
return this;
Type newBottom = getSpecializedType(type);
Type newTop = getGeneralizedType(type);
Type result;
if (newTop.equals(newBottom))
result = newTop;
else if (newTop instanceof ReferenceType
... |
62841faa-945a-4685-bf6e-70b6b2737634 | 5 | public static CrowdAgentState swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (int i = 0; i < swigValues.length; i++)
if (swigValues[i].swigValue == swigValue)
return swigValues... |
2b230de3-5a4e-44b8-9ae8-cf7da91886a2 | 4 | public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: Main numOfHints");
System.exit(1);
}
// Informative output
System.out.println("Using K=" + K);
// Create
BitSet message = generateRandomBitSet(64);
// Informative output
System.out.println("\nOriginal Me... |
61fe82f2-1037-441e-9b9a-28e038abe559 | 8 | public String getContent(){
String content = "";
if(containsRock){
content = content + "#";
}
else if(containsRedAntHill){
content = content + "+";
}
else if(containsBlackAntHill){
content = content + "-";
}
if(isClear){
content = content + ".";
}
if(containsAnt){
if(ant.getColou... |
0e863ffe-3cc7-42e0-81c9-37fb06385abb | 2 | private static void measure(Benchmark run)
{
for (int i = 0; i < WARMUP_REPEATS; i++)
{
run.run();
}
long time = 0;
for (int i = 0; i < TEST_REPEATS; i++)
{
final long startT = System.nanoTime();
run.run();
time += System.nanoTime() - startT;
}
System.out.printf("%1$s: %2$,d nannos/run (total: %3... |
31187887-d62d-4df4-9a09-d21f476ba2eb | 5 | public static Karaoke leerArchivoKaraoke(String ruta) {
File archivo = new File(ruta);
FileInputStream fileInputStream = null;
ObjectInputStream objectInputStream = null;
try {
fileInputStream = new FileInputStream(archivo);
objectInputStream = new ObjectInputStream(fileInputStream);
} catch (FileNotFou... |
1c12a133-a321-40de-bcff-7d506d29823f | 6 | protected void initialize() {
Logger.log((Settings.UsePondaration ? "using" : "not using") + " pondarated random");
frame = new JFrame();
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
try {
UserManager.getUser().save();
} catch (Excepti... |
6dfbb9b5-0a4c-4c92-b183-a8c671e4d3f9 | 0 | @Override
public String getDesc() {
return "DoubleAttack";
} |
26244171-34ad-4a05-8a30-8c6cba1f7ac8 | 4 | public double standardizedPersonMean(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
if(!this.varia... |
8340b856-2345-473b-a15d-310d2a3d4a9e | 8 | public Terminated<Element> create() {
if (ready() == false) {
throw new IllegalStateException();
}
final String header = getDataSource().next().getElement();
assert header.startsWith("{");
TableStrategy strategy = TableStrategy.DRAW_NONE;
if (header.length() == 2) {
strategy = TableStrategy.fromChar(... |
dc277da4-369e-4ff7-bf40-ed020cc0e9f1 | 8 | public void update() {
if (Game.keys.isDown(KeyEvent.VK_RIGHT))
pos.x += 5;
else if (Game.keys.isDown(KeyEvent.VK_LEFT))
pos.x -= 5;
else if (Game.keys.isDown(KeyEvent.VK_DOWN))
pos.y += 5;
else if (Game.keys.isDown(KeyEvent.VK_UP))
pos.y -... |
15c0c2d9-a8ef-4d12-b205-1d29ec9bfe59 | 3 | public void reset()throws TableException{
String createString;
java.sql.Statement stmt;
try{
createString = "drop table " + ADDRESS_TABLE_NAME + ";";
stmt = sqlConn.createStatement();
stmt.executeUpdate(createString);
} catch (java.... |
cb5ab48a-5c03-4452-8f44-7e7eef48305f | 2 | static private void ajouterNoeud(Integer a, Integer b,TreeMap<Integer, TreeSet<Integer> > noeuds)
{
TreeSet<Integer> tmp = noeuds.get(a);
if(tmp == null)
{
tmp = new TreeSet<Integer>();
}
tmp.add(b);
noeuds.put(a, tmp);
tmp = noeuds.get(b);
if(tmp == null)
{
tmp = new TreeSet<In... |
d3255fcf-b425-4d4f-bf0a-75e206fb5aa3 | 1 | public FieldVisitor visitField(final int access, final String name,
final String desc, final String signature, final Object value) {
if (owner.startsWith("java/")) {
System.out.println(owner + ' ' + name);
}
return null;
} |
751b0d04-254b-4d1f-9c25-9e666db7e5f6 | 2 | private static HashMap clonePreexists(final HashMap old) {
final HashMap clone = new HashMap();
final Iterator vars = old.keySet().iterator();
while (vars.hasNext()) {
final LocalVariable var = (LocalVariable) vars.next();
final HashSet set = (HashSet) old.get(var);
if (set == null) {
clone.put(var, ... |
31afbf28-924b-44c0-925a-673c1cb68f73 | 2 | public Server() {
super("SERVER");
/*init ligne */
try {
InfoLigne = Utile.getStation();
TabLigne[0]=true;
ID_controleur[0]=true;
for (int i = 1; i < TabLigne.length; i++) {
TabLigne[i]=false;
ID_controleur[i]=false;
}
} catch (IOException e) {
// TODO Auto-generated ca... |
a9fb1175-b4d7-40c5-b9fe-27e9e3606b37 | 9 | public static final boolean isAllowedContainsAny(final MOB mob, final Room room, final SecGroup secGroup)
{
if(mob==null)
return false;
if(isASysOp(mob))
return true;
if((mob.playerStats()==null)
||((mob.soulMate()!=null)&&(!mob.soulMate().isAttributeSet(MOB.Attrib.SYSOPMSGS))))
return false;
final ... |
bb400fa7-2023-4372-a335-3934c96cefae | 8 | public boolean containsResend(){
if(len<6) return false;
for (int i = 0; i < len-3; i++) {
if(array[i]=='R' && array[i+1]=='e' && array[i+2]=='s' && array[i+3]=='e' && array[i+4]=='n' && array[i+5]=='d') return true;
}
return false; //ASCII
} |
12fc68ef-2647-4cb9-af38-e0cb81b0ed15 | 4 | public static String[] getTactics(String name) {
try {
TacticsLogFile help = new TacticsLogFile(
Output.getInstance().htmlPath);
JSONObject content = new JSONObject(help.read("{}"));
if (content.has(name)) {
JSONArray t = content.getJSONObject(name).getJSONArray(
"tactics");
String[] tacti... |
bbce93e7-0c83-4c3e-8cf6-4355496c36ff | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
7766cac2-d0db-4bdd-85ef-3693021131d7 | 3 | private void setPixels(int originalOffset, int width, int pixels[], int originalPixels[], int originalDeviation, int height, int deviation, int alpha, int offset) {
int color;
int alphaValue = 256 - alpha;
for (int k2 = -height; k2 < 0; k2++) {
for (int l2 = -width; l2 < 0; l2++) {
color = originalPixels[o... |
0944218f-5144-4ae6-94dd-532272b25a6f | 2 | public Communicator() {
try {
sender = new OSCPortOut();
reciever = new OSCPortIn(57111);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (SocketException e) {
e.printStackTrace();
}
this.addListeners();
} |
de33094d-8696-4357-96f6-18608a4608a4 | 9 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(exitProgram)) {
System.exit(0);
}
if (e.getSource().equals(loadFile)) {
operations.loadMap();
}
if (e.getSource().equals(saveFileAs)) {
operations.saveMapAs();
... |
54606929-9583-4662-8863-ea6290208945 | 8 | @Override
public int evict(int evictionQuota) {
int counter = 0;
for(ConcurrentSkipListMap<IndexValue, EvictableServerEntry> priority : getPriorities().values())
if(counter == evictionQuota)
break;
else if(priority.isEmpty())
continue;
else {
Iterator<EvictableServerEntry> iterator = priori... |
fb538514-ffb6-4c65-8065-3372b4e12fe1 | 7 | @Override
protected int findPrototypeId(String s)
{
int id;
// #generated# Last update: 2007-05-09 08:16:01 EDT
L0: { id = 0; String X = null;
L: switch (s.length()) {
case 4: X="exec";id=Id_exec; break L;
case 7: X="compile";id=Id_compile; break L;
... |
f094d7e9-a959-4476-a2df-e695d0276171 | 9 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if(e.isCancelled())
return;
if(e.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if(e.getClickedBlock().getType() != Material.SIGN && e.getClickedBlock().getType() != Material.SIGN_POST && e.getClickedBlock().getType() != Material.WALL_SI... |
0fab1f27-93f1-4169-9685-c5adee0cd369 | 2 | public static String capitalise(String s) {
String finalString = "";
if (s.contains(" ")) {
StringBuilder builder = new StringBuilder();
String[] sp = s.split(" ");
for (String string : sp) {
string = string.substring(0, 1).toUpperCase() + string.subst... |
6abfbe61-3af6-4054-aa95-cfc32f7cfa6c | 8 | StringBuffer leerAsm(Scanner entrada){
StringBuffer contenido = new StringBuffer();
while(entrada.hasNextLine()){
String linea = entrada.nextLine();
if(!linea.startsWith(";") && !linea.contains(";") && !linea.equals("")){
contenido.append(linea);
contenido.append("\n");
}else if(linea.contains(";... |
c58deb0f-a150-4ecc-9678-6f8d9b9df9d6 | 6 | @EventHandler
public void onInventoryClick(InventoryClickEvent event){
if(event.getInventory().getHolder()!=null && event.getInventory().getHolder() instanceof Player){
Player eventPlayer = (Player)event.getInventory().getHolder();
if(event.getInventory().getTitle().contains("Welches Stockwerk?"... |
58928e89-1995-4ed6-8217-84f7d62fae0e | 4 | public MeterHoras(Principal Obj) {
initComponents();
this.setLocationRelativeTo(null);
this.setVisible(true);
this.Obj = Obj;
Obj.principal.diaActual = 0;
mostrar();
String key;
Iterator iterator = Obj.principal.claves.keySet().iterator();
while (... |
e2756209-59d4-449c-8df7-7afc09e7dddf | 4 | @Override
public void emitterUpdated(EmitterInterface e) {
if (this.connections_.contains(e)) {
if (!this.isCompatible(e)) {
this.deconnect(e);
}else if (this.getType()==ValueType.VOID||getType()==ValueType.NONE){
this.setType(e.getType());
}
}
} |
9cfc0d15-ceda-4d63-9760-c7537761fc6f | 3 | private Connection getConnection() throws LoginException {
final String dsJndi = this.getProperty(PARAM_DATASOURCE_JNDI);
final String dbUser = this.getProperty(PARAM_DB_USER);
final String dbPassword = this.getProperty(PARAM_DB_PASSWORD);
try {
/*String nonTxJndiName = dsJn... |
ef21d3de-bb0a-4339-94c2-f4f0e8b8e22f | 8 | public WorldInitPanel(Player gamemaster, Vector<World> worlds) {
this.worlds = worlds;
// - initialize miglayout manager
this.setBorder(BorderFactory.createEmptyBorder());
this.setLayout(new MigLayout("width 400!", "[]10[]10[]"));
this.setOpaque(false);
// - introduction
JLabel introduction = new JL... |
807f6e85-2ab0-4089-a8c5-328f2b33b647 | 2 | public static void doTxWork( Work work ) {
// Non-managed environment idiom
Session sess = getSessionFactory().openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do some work
work.work(sess);
tx.commit();
}
catch (RuntimeExcep... |
e59890f8-9f25-42dc-bd2d-42d7e85e5a87 | 7 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("Please input a serial number to search for: ");
inputSerialNumber = new Scanner (System.in);
unitSerialNumber = inputSerialNumber.nextLine();
fromDir1 = new File("//mri-fileserver/SMW Shipping/55... |
5ef1f3a3-08c6-4aa6-b002-017b748db310 | 0 | public Game() {
Framework.gameState = Framework.GameState.GAME_CONTENT_LOADING;
Thread threadForInitGame = new Thread() {
@Override
//run the thread for game class
public void run() {
// Sets variables and objects for the game.
Initia... |
6cc3468d-1213-4e86-a0f9-4f5aa636490c | 4 | public String useSkill(int skill, Characters enemy)
{
if (mana >= skillSet.getCost(skill))
{
int damage = roll(skillSet.getValue(skill));
String message = skillSet.getDescription(skill);
if (damage > 0)
{
message = message + " " + enemy.getName() + " suffers " + damage + " damage.";
}
... |
e17cc47d-2f3a-4ff6-a4d8-771e743e68ca | 7 | @Override
public void execute(String inputFile, String outputFile) throws IOException {
final List<PropertiesFile> inputPropFiles = PropertiesFileUtils.findFiles(inputFile);
Collections.sort(inputPropFiles, new PropertiesFileComparator());
final List<String> keys = new ArrayList<String>();
for (PropertiesFi... |
5fdebdf9-1575-43e6-af7d-fb942b1fbdcc | 8 | public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
Picture that = (Picture) obj;
if (this.width() != that.width()) return false;
if (this.height() != that.height()) return... |
e1ad8e44-afbd-4971-8882-6f1bcb16553e | 4 | public HiloBean get(HiloBean oHiloBean) throws Exception {
if (oHiloBean.getId() > 0) {
try {
oMysql.conexion(enumTipoConexion);
if (!oMysql.existsOne("hilo", oHiloBean.getId())) {
oHiloBean.setId(0);
} else {
oH... |
27054ced-43aa-4149-bbc8-6283ea25f70e | 6 | public void paintComponent(Graphics g) {
super.paintComponent(g);
int w = getWidth()-1;
int h = getHeight()-1;
g.setFont(font);
FontMetrics fm = g.getFontMetrics(font);
String heading = "Items in "+name+": "+content.size();
switch(direction) {
case EAST:
g.setColor(Color.black);
g.drawString(headi... |
6a5f005c-d825-4256-b697-d0f5deb6fe6f | 8 | public int getType(TextGrid grid) {
if(typeIsValid) return type;
typeIsValid = true;
if(size() == 1) {
type = TYPE_OPEN;
return TYPE_OPEN;
}
int typeTrace = getTypeAccordingToTraceMethod(grid);
if(DEBUG){
System.out.println("trace: "+typeTrace);
}
if(typeTrace == TYPE_OPEN) {
type = TYPE_... |
9e93e174-b8d8-4e20-a455-c85b5d6be8b4 | 9 | void next() {
while (input.hasNext()) {
final char currentCharacter = input.next();
// Must be befor whitespace check, because \n is also whitespace
if ('\n' == currentCharacter) {
if (scanNewline()) {
continue;
}
... |
ab69149d-4f9d-41cc-94da-fc8338854ccd | 6 | @Override
public void onDisable()
{
// 'Attempt to' Cancel all tasks
getServer().getScheduler().cancelTasks(this);
Component.disableComponents();
p = null;
// Backup the current files
if (updater != null && updater.getResult() == Updater.UpdateResult.SUCCESS)
{
File destination = new File(... |
3faf215e-df4e-4022-adfc-b5cf73efa3a2 | 2 | @Test
public void testThatJumpheightCannotBeSetToABadValue() {
corridor.setJumpheight(0);
assertTrue("Jumpheight can't be 0 or smaller.", corridor.getJumpheight() < 4 && corridor.getJumpheight() > 0);
corridor.setJumpheight(4);
assertTrue("Jumpheight can't be 4 or larger.", corridor.getJumpheight() < 4 && c... |
51a9d41f-91db-41dd-9bba-059cb5dbaa17 | 9 | @Override
public void act()
{
// Cleans unnecessary handleds
removeDeadHandleds();
// Informs all listeners of the last changes
for (int i = 0; i < getHandledNumber(); i++)
{
AdvancedKeyListener listener = getListener(i);
if (listener == null)
continue;
// Informs if a key was presse... |
94d8aafd-8fe7-411a-a2cc-947cd596e612 | 6 | public String loginSuivant(String nomPersonne) {
String res = "";
nomPersonne = nomPersonne.toLowerCase();
String dernierLogin = this.dernierDuNom(nomPersonne);
if ("".equals(dernierLogin)) {
int taille = Math.min(4,nomPersonne.length());
String partieNom = nomPe... |
d8072a91-50b3-4390-a89d-74f6531414cc | 8 | public Rectangle2D calibrate(Graphics2D g2, Node node) {
RootedTree tree = treePane.getTree();
nodeBar = null;
Line2D barPath = treePane.getTreeLayoutCache().getNodeBarPath(node);
if (barPath != null) {
double height = tree.getHeight(node);
double upper = height;
double lower = height;
boolean h... |
c6a81c50-73d2-4588-a44b-f00c30873a6c | 6 | private Token scaenNumber(CharStream line) throws AssemblerSyntaxException {
if (!CharUtils.isNumeric(line.getCurrentChar())) {
throw new AssemblerSyntaxException(
String.format("Number must start with digit at index %d!", line.getIndex()),
line.getLineNumber(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.