method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c384b937-ab2c-4bba-9282-890f579742c4 | 8 | public Square move(PieceDirection direction, int diff) {
switch (direction) {
case Back:
return this.moveBack(diff);
case Front:
return this.moveFront(diff);
case Left:
return this.moveLeft(diff);
case LeftBack:
... |
8e6cbc05-1f29-4772-8dcb-37f2e6649f7f | 8 | private static String printClusterStats(Clusterer clusterer,
String fileName)
throws Exception {
StringBuffer text = new StringBuffer();
int i = 0;
int cnum;
double loglk = 0.0;
int cc = clusterer.numberOfClusters();
... |
3edd0410-6ad1-4046-94ad-a132b3c3b423 | 4 | private void add(E e) {
Rect rect = e.getAABB();
int beginx = (int) (rect.x - rect.w2) / width;
int beginy = (int) (rect.y - rect.h2) / height;
int endx = (int) (rect.x + rect.w2) / width;
int endy = (int) (rect.y + rect.h2) / height;
//Vec2i pos = new Vec2i(0, 0);
... |
18927fbf-1e95-4592-b7b2-dc7ad7a849b4 | 6 | private boolean isCorrectTarget(Placeable currentEnemy) {
if (tower.getLastTarget() != null || !isInRange(currentEnemy)) { // if no last target skip below and return
if (attackData.isRememberOldTarget()) { //if it does not care about keeping track of old target
if (tower.getLastTarge... |
b5ac0b2f-9721-4b58-a2cd-c589fe0254eb | 5 | public static void tulostaYhteydet(Sitsit sitsit) {
System.out.println("\n" + "Yhteydet" + "\n");
Hakemisto<Sitsaaja, Hakemisto> kaikkiYhteydet = sitsit.palautaYhteydet();
int moneskoYhteys = 0;
int moneskoSitsaaja = 0;
int moneskoyhteydellinen = 0;
for (Vektori<Sitsaaja... |
384b2c46-7711-4bbb-bcc3-7ee3b493fb27 | 0 | public HttpPlayer() {
client = new DefaultHttpClient();
} |
745a5efa-b52f-424b-a31a-ebd7bf34d76c | 7 | public void testRemoveManyWithNulling() {
RingBufferSeqno<Integer> buf=new RingBufferSeqno<>(10, 0);
for(int i: Arrays.asList(1,2,3,4,5,6,7,9,10))
buf.add(i, i);
List<Integer> list=buf.removeMany(true, 3);
System.out.println("list = " + list);
assert list != null && l... |
9efcb38a-c27a-43f7-b0fe-78ae3f73a865 | 4 | public void testEmptyClass () {
FieldAccess access = FieldAccess.get(EmptyClass.class);
try {
access.getIndex("name");
fail();
} catch (IllegalArgumentException expected) {
// expected.printStackTrace();
}
try {
access.get(new EmptyClass(), "meow");
fail();
} catch (IllegalArgumentException e... |
80bea9c0-b200-421a-a3e2-b620870cd15b | 0 | public String getNombre() {
return nombre;
} |
fb93826c-1a31-4bb7-884e-db35cdeacb68 | 3 | public int Run()
{
char c = 0;
System.out.println("Please enter a command:");
do{
try {
c = (char) System.in.read();
if ( CurrentRoom.Options.get(c)!=null){
//CurrentRoom.Options.get(c).runCommand(c);
DoTheOption(c);
System.out.println("Please enter a command:");
... |
e3e43b5c-cfb2-406c-ad24-5310999d2765 | 0 | float getZ(int x) {
return x * 2.0f;
} |
fc647ebf-4d51-43b6-a5bc-7f3929ba6abd | 2 | public String readUrl(String urlString) throws Exception {
BufferedReader reader = null;
try {
URL url = new URL(urlString);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buffer = new StringBuffer();
int read;
... |
82de3b98-f64b-4146-a180-4df46cc07f16 | 4 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_UP) { //Presiono flecha arriba 1
direccion = 1;
buenoMov = false;
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) { //Presiono flecha abajo 2
direccion = 2;
buenoMov = fal... |
c908e632-d05b-4315-869e-9a3814d341fa | 8 | @Override
public void run() {
double unproccessedSeconds = 0;
long lastTime = System.nanoTime();
double secondsPerTick = 1 / 60.0;
int tickCount = 0;
while (running) {
long now = System.nanoTime();
long passedTime = now - lastTime;
lastTime = now;
if (passedTime < 0) {
passedTime = ... |
173ad6f4-647a-413b-afbf-e3bfea6d834a | 7 | @Override
public void visitIincInsn(final int var, final int increment) {
if (currentBlock != null) {
if (compute == FRAMES) {
currentBlock.frame.execute(Opcodes.IINC, var, null, null);
}
}
if (compute != NOTHING) {
// updates max locals
... |
bd940523-0c28-4b1a-814a-071516219f46 | 0 | public int[] getDecomposition()
{
return myDecomposition;
} |
5ad04f21-f321-4b2a-9b53-4fe27f85b9fe | 5 | @Override
public void mouseReleased(MouseEvent e)
{
if (e.getButton() == MouseEvent.BUTTON1)
{
if (down)
{
if (Hub.simWindow.loadGenesButton.isChecked())
loadGenes(file.getName());
else if (Hub.simWindow.deleteGenesButton.isChecked()
&& J... |
0136a356-cfa0-4a2f-be28-63f363f99539 | 6 | private void Run()
{
isRunning = true;
int frames = 0;
long frameCounter = 0;
final double frameTime = 1.0 / FRAME_CAP;
long lastTime = Time.GetTime();
double unprocessedTime = 0.0;
while(isRunning)
{
boolean render = false;
long startTime = Time.GetTime();
long passedTime = st... |
37fdb09f-d00b-4eee-9d0b-6ed3ef7ba122 | 4 | public boolean accept(File dir, String name){
File f = new File(dir.getAbsolutePath() + name);
BufferedReader br = null;
String s = null;
try {
br = new BufferedReader(new FileReader(f));
while((s=br.readLine())!=null ){
if(pattern.matcher(name).matches() == true)
return true;
}
} catch (Fi... |
312f2266-19f4-4669-ac57-ebadc3ab0bf8 | 3 | public static ArrayList<Double> averageChunks(List<Double> ary,
int numChunks) {
ArrayList<Double> result = new ArrayList<Double>();
double chunkSize = ((double) ary.size()) / (double) numChunks;
int start = 0; // index of start of current chunk
double bound = 0; // decimal value of upper bound for current c... |
579f3c04-d235-4432-b268-fcc57c4be85e | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point other = (Point) obj;
if (lat == null) {
if (other.lat != null)
return false;
} else if (!lat.equals(other.lat))
return false;
... |
0685eb07-6acb-4860-8d82-40f46ef5d39b | 8 | static void checkSyntax(String attrName, Expr value) throws InvalidAttributeValueException, IllegalArgumentException {
if (value.type == Expr.ERROR) {
throw new IllegalArgumentException(attrName + ": syntax error, unable to parse the value");
} else if (value.type == Expr.STRING) {
checkAttribute(attrName, ((... |
bde4cdb9-c370-4fc6-9486-138ef017d39c | 4 | public Packet read(short id, ByteBuffer buf) {
try {
/*short id = buf.getShort();
short len = buf.getShort();
ByteBuffer data = buf.slice();
data.limit(len);
buf.position(len);*/
Class<? extends Packet> packetClass = packetMapping.get((int)id);
if (packetClass == null) throw new IllegalArgumentE... |
1262406e-61a5-4372-9d10-7ba9a0b282ed | 2 | public void save() {
try {
sql.Query.save(this);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
} |
c9505da9-19b3-40dc-b784-eebc26942947 | 6 | public boolean hayLugarEnPlan (int id_padre, String codigo_plan_padre){
boolean haylugar = false;
try {
r_con.Connection();
ResultSet rs = r_con.Consultar("select COUNT(*) from "+nameTable+" where pc_id_padre="+id_padre);
rs.next();
int futuroHijo = rs.getI... |
d02782fd-3f93-47bf-aee5-14a848c0de57 | 5 | @Override
public void paintComponent(Graphics g) {
Graphics2D graph = (Graphics2D) g;
graph.setBackground(new Color(1, 0, 0));
graph.clearRect(0, 0, this.getWidth(), this.getHeight());
if (entityList != null) {
for (Entity e : entityList) {
int eCenterX = Math.round(e.getxPos()) - xPos;
int eCenter... |
4da04c16-c49c-40cf-bb58-9bf0b653ca82 | 3 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
setUser((User) session.get("User"));
Criteria ucri = myDao.getDbsession().createCriteria(Campaign.class);
ucri.setMaxResults(100);
all... |
5f3b0711-ce8e-4ebb-a9c3-2097ee2da56f | 9 | public void transform(JavaMethod javaMethod) {
String shortName = javaMethod.getName();
String fullName = javaMethod.getQualifiedName();
String parameterName = javaMethod.getQualifiedSignature();
if (!javaMethod.isStatic() && (INSTANCE_METHODS.contains(shortName) || INSTANCE_METHODS.contains(fullName) || INSTAN... |
20dbaf0a-8ec1-4eb8-abc4-eece0b15046a | 2 | public int getWallDecorationUid(int z, int x, int y) {
GroundTile groundTile = groundTiles[z][x][y];
if (groundTile == null || groundTile.wallDecoration == null) {
return 0;
} else {
return groundTile.wallDecoration.uid;
}
} |
bda5c49d-4784-4dc9-b55b-440a15b6fe64 | 0 | public void fireKeyEvent(KeyEvent event) {
processKeyEvent(event);
} |
3b8549e2-0f61-4144-b5b9-b7cdda8eb2d3 | 1 | public ClientGUI() {
try {
UnicastRemoteObject.exportObject(this, 0);
mInstance = this;
} catch(RemoteException ex) {
System.out.println(ex.getMessage());
}
mUserName = "";
mUserPass = "";
mMessageWindows = new HashMap<String, MessageWindow>();
mListWindow = new UserListWindow(this);
} |
ceac03fd-160f-419d-a58c-f859f687652c | 6 | public Type intersection(Type type) {
if (type == tError)
return type;
if (type == Type.tUnknown)
return this;
Type top, bottom, result;
bottom = bottomType.getSpecializedType(type);
top = topType.getGeneralizedType(type);
if (top.equals(bottom))
result = top;
else if (top instanceof ReferenceTy... |
9be8887e-f238-4131-b283-f98c9693690a | 4 | @Test
public void insertTest() {
final int n = 10_000;
Array<Integer> seq = emptyArray();
for(int i = 0; i < n; i++) seq = seq.snoc(i);
assertEquals(n, seq.size());
for(int i = 0; i <= n; i++) {
final Array<Integer> seq2 = seq.insertBefore(i, n);
assertEquals(Integer.valueOf(n), seq2... |
725ae304-878f-4b0f-84fe-22ba02133e8a | 2 | @Override
public void setLoadStatus(double d) {
if (d >= 0 && d <= 1)
loadStatus = d;
} |
f092ab65-560c-4b66-af02-d0da605b721e | 6 | @Override
public void executeTask() {
System.out.println(this.getClass().getSimpleName() + " EXECUTING");
if (m_ServerSocket == null) {
try {
m_ServerSocket = new ServerSocket(PORT);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
do {
String ... |
8a847d7a-1179-43c3-90e1-e2977f24b1fe | 2 | public RootPane getRootPane() {
if (rootPane == null) {
rootPane = createRootPane();
if (rootPane.getState() != this) {
throw new IllegalStateException("rootPane.getState() != this");
}
}
return rootPane;
} |
c2e9028e-c05f-4f71-8592-baf07fdcdaf9 | 6 | public static OS getPlatform() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("win")) return OS.windows;
if (osName.contains("mac")) return OS.macos;
if (osName.contains("solaris")) return OS.solaris;
if (osName.contains("sunos")) return OS.solaris... |
9170b568-c2ba-4c89-add9-9d49f02996a6 | 1 | private boolean checkPngEncodingSupport() {
String encodings = System.getProperty("video.snapshot.encodings");
return (encodings != null) && (encodings.indexOf("jpeg") != -1);
} |
db920750-d87e-4ece-a532-47a539ce405a | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if((mob.isMonster())&&(mob.isInCombat()))
return Ability.QUALITY_INDIFFERENT;
final Room R=mob.location();
if(R!=null)
{
for(final Enumeration<Ability> a=R.effects();a.hasMoreElements();)
{
final Ability ... |
aab90ade-4046-4677-a533-5e5ea0819199 | 8 | private void renderUnits(Graphics g){
if (settings.isDisplayAllPaths()){
for (int i = 0; i < world.getPlayer().getUnits().size(); i ++){
Unit u = world.getPlayer().getUnits().get(i);
int speed = u.getMaxMovement();
for (int j= 0; j< u.getPath().size(); j ++){
Color color = j == 0 ? PathGenerato... |
14376d3d-25c5-4057-be5b-93e96cf60e30 | 7 | public void deathAni()
{
switch (aniNum)
{
case 0:
sprt = imgD1.getImage();
if(Game.tickCount2 == game.DELAY){
aniNum = 1;
}
break;
case 1:
sprt = imgD2.getImage();
if(Game.tickCount2 == game.DELAY){
aniNum = 2;
}
break;
case 2:
sprt = imgD5.getImage();
if... |
119810f9-301e-46ed-a506-3535591b8870 | 0 | public String getUserId() {
return userId;
} |
a128e78b-2051-49b7-80d4-03ea23a5f582 | 2 | public int nbMaxCercle (){
Coord dim = this.env.getDimension();
int[] dist = new int[4];
dist[0] = this.coord.distance(Coord.NULL);
dist[1] = this.coord.distance(new Coord(dim.x, 0));
dist[2] = this.coord.distance(new Coord(0, dim.y));
dist[3] = this.coord.distance(dim);
int gdist = 0;
for(int i = 0... |
971a3a47-10f3-4357-9cd2-6d4ea8d53270 | 5 | protected long packChildren(String destination, long parentDirOffset, long nextAddrOffset) {
long currentOffset = nextAddrOffset;
Iterator<VDKInnerDirectory> it = getChildren().iterator();
List<VDKInnerDirectory> directoryList = new ArrayList<VDKInnerDirectory>();
while (it.hasNext()) {
VDKInnerDirector... |
3c0a42fc-a1d1-4722-a8ff-816074abb1cc | 4 | public static void main(String[] args) {
Treap<Integer> t;
Random rand = new Random();
double sommeLog = 0.0;
int sommeHauteur = 0;
for (int j = 0; j < 100; j++) {
for (int nombreElement = 1; nombreElement < 100; nombreElement++) {
t = new Treap<>();
... |
f049a1d8-d5b4-4bd5-a8fb-b36934be8f5f | 5 | public void readFeat(String path) throws IOException {
FileInputStream is = null;
DataInputStream dis = null;
try{
is = new FileInputStream(path);
dis = new DataInputStream(new BufferedInputStream(is));
int frames = (dis.readInt())/39;
//System.out.println(frames);
feat = new float[frames][39];
... |
39f63653-8c5e-4089-9a38-c61b6cf120ed | 5 | @SuppressWarnings("unchecked")
public synchronized long generateRelationId(String key, List<Long> ids, List<String> types, List<String> roles, List<String[]> tags, List<String> shapesId){
Long id = null;
if (totalRelations.get(key) == null)
totalRelations.put(key, new ConcurrentHashMap<RelationOsm, Long>());
... |
72a4b7f1-598b-4b6c-a8ca-7fe7bbfc29e7 | 6 | public boolean lisaaTunnusPari(Tunnus tunnus1, Tunnus tunnus2) {
for (TunnusPari tunnusPari : getTunnusParit()) {
if ((tunnusPari.getTunnus1().equals(tunnus1) || tunnusPari.getTunnus2().equals(tunnus1))
&& (tunnusPari.getTunnus1().equals(tunnus2) || tunnusPari.getTunnus2().equals... |
42f9c0fe-bf8c-4b15-883c-ad0413a2ba7b | 0 | @Override
public void run() {/**/} |
e4b966e6-dbc4-40a5-8d79-73fb764c4d4c | 9 | static int longestPalSubstr(char[] str)
{
int maxLength = 1; // The result (length of LPS)
int start = 0;
int len = str.length;
int low, high;
// One by one consider every character as center point of
// even and length palindromes
for (int i = 1; i < len;... |
c5fc5980-7642-4ded-a9c8-8ada7fa899f9 | 1 | public MOCOM_Comparator(int col, boolean decreasing_order) {
this.col = col;
if (decreasing_order) {
order = -1;
} else {
order = 1;
}
} |
5a30e49e-bb25-4f20-9b43-2fea8c954604 | 9 | public boolean batchFinished() throws Exception {
if (getInputFormat() == null) {
throw new IllegalStateException("No input instance format defined");
}
if (m_removeFilter == null) {
// establish attributes to remove from first batch
Instances toFilter = getInputFormat();
int[] at... |
ba1af83a-b1cd-41fa-ad6d-9c0ce13ebfe6 | 9 | private void setMine(int mineNum){
unknowArea = this.ROWS * this.COLS - mineNum;
Random random = new Random();
int count = 0;
//初始化并放入MineField
for(int i = 0;i<cas.length;i++){
for(int j = 0;j<cas[i].length;j++){
cas[i][j] = new CurrentArea();
cas[i][j].setVx(i);
cas[i][j].setVy(j);
cas[... |
3e6c9969-0f65-4914-8110-2ce15ce0a132 | 9 | private void jLabelAceptarMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelAceptarMouseReleased
try {
//Asigna en variables los jTextField
String nombreCancion = jTextFieldNombre.getText().trim();
String nombreAlbum = jTextFieldAlbum.getText().trim();
... |
bc93ec0d-57b0-4514-8243-10193f2508f5 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Cliente)) {
return false;
}
Cliente other = (Cliente) object;
if ((this.id == null && other.id != null) || (thi... |
f1f9399f-5ce8-42c9-afb0-86692baecea9 | 0 | public String getSpeech() {
return speech;
} |
19a6dd5d-fac5-4f0d-a50b-9e4863747097 | 7 | private String translateTransitions(STS sts, Object translatedEntity) {
String translation = "";
Set<Set<Transition>> transitionGroups = new HashSet<Set<Transition>>();
for (State state : sts.getStates()) {
// System.out.println("Looking at state " + state);
Set<Transition> transitions =
sts.getTrans... |
aab77ed6-020a-4da1-b68a-694ad484680a | 5 | @Override
public boolean wipeTable(String table) {
Statement statement = null;
String query = null;
try {
if (!this.checkTable(table)) {
this.writeError("Error at Wipe Table: table, " + table + ", does not exist", true);
return false;
}
statement = connection.createStatement();
query = "DELET... |
b920800e-58d5-44b4-9995-6ac4e251760b | 1 | public void calculateTotalsW() {
for (double w : consumptionWatt)
systemConsumptionW += w;
systemConsumptionW=Math.round(systemConsumptionW*100)/100000.0;
} |
0cf94f5b-a7a7-4327-a52c-30ee7b128f61 | 2 | public void updateIO(Elem tek)
{
for(int i = 0; i < inputNo; i++)
inputNodes[i].setActivation(tek.X[i]);
for(int i = 0; i < outputNo; i++)
outputNodes[i].setYAccuali(tek.actualY[i]/scale);
} |
cf330269-a16f-46f7-a3fe-8c877395aadd | 0 | public int GetTime()
{
return TIME;
} |
725174dc-33d0-4e8b-b318-bf05873509cb | 3 | public void step() {
Grid<Actor> gr = getGrid();
ArrayList<Actor> actors = new ArrayList<Actor>();
for (Location loc : gr.getOccupiedLocations())
actors.add(gr.get(loc));
for (Actor a : actors) {
// only act if another actor hasn't removed a
if (a.getGrid() == gr)
... |
aa1c62bc-5d8c-4919-9738-aa9349c2a5db | 7 | public String[] getOptions() {
int i;
Vector result;
String[] options;
File file;
result = new Vector();
options = super.getOptions();
for (i = 0; i < options.length; i++)
result.add(options[i]);
if (getOutputClassification())
result.add("-classification");
if (getRe... |
9bc26483-14eb-4a10-854f-9dacb8c282d5 | 1 | private static History HistoryObject(ResultSet rs) {
History newHistory = null;
try {
newHistory = new History(rs.getInt(rs.getMetaData().getColumnName(1)),
rs.getString(rs.getMetaData().getColumnName(2)),
rs.getS... |
c194aff7-a682-4286-9bf3-e2f500c1a521 | 1 | public void gananciaDelDia(){
for (int len = ventas.size(), i = 0; i < len; i++) {
Venta unaVenta = ventas.get(i);
ganancias+= unaVenta.prenda.precioFinal();
}
System.out.println("Las ganancias del dia son:" +ganancias);
} |
3ff510a6-fc58-4c71-95b2-a3b2ba075339 | 1 | private final void addUser(String channel, User user) {
channel = channel.toLowerCase();
synchronized (_channels) {
Hashtable users = (Hashtable) _channels.get(channel);
if (users == null) {
users = new Hashtable();
_channels.put(channel, users);
... |
3e0e9d84-3f48-4c40-a6fd-0ea8647f0116 | 4 | @Override
public void calculate(Loan loan)
{
if (loan.getCalculationWanted() == CalculationAction.MONTHLY_PAYMENT)
{
// increment the payment number
loan.setPaymentNumber(loan.getPaymentNumber() + 1);
// only perform the monthly paym... |
998ddf7d-b615-4518-8b18-139461b474a8 | 2 | @Test
public void testReadCluster() throws UnsupportedEncodingException {
System.out.println("extractFile");
boolean expResult = true;
boolean result = false;
f32Extractor.openFAT(new File(PATH));
f32Extractor.searchFAT32Element();
byte[] actualArr = f32Extra... |
b080696a-6e91-4076-820d-274d6386b13d | 2 | public MainForm(String[] args) {
initComponents();
try {
List<QueryDefinition> queries = Settings.getInstance().getQueries();
for(QueryDefinition query : queries) {
this.addServiceTab(query);
}
} catch (Exception e) {
logger.error("Error loading tabs.", e);
... |
18bff43e-0a8c-4679-be94-cc78dca9fddd | 9 | public void Update(ArrayList<Sprite> targets) {
checkLives();
arrowtimer++;
if (arrowtimer > 200) {
arrowtimer = 0;
if (target == Window.blankSprite) {
for (int i = 0; i < 4; i++) {
try {
target = targets.get(num - i);
boolean tmoving = target.moving;
double di... |
0f11ea0c-59f6-4e5d-8a65-dc0d98a561c2 | 9 | */
protected int scoreTradeOutcome(ResourceSet tradeOutcome)
{
int score = 0;
ResourceSet tempTO = tradeOutcome.copy();
if ((ourPlayerData.getNumPieces(PlayingPiece.SETTLEMENT) >= 1) && (ourPlayerData.hasPotentialSettlement()))
{
while (tempTO.contains(Game.SETTLEMEN... |
8f5438ef-1678-4799-a116-9b650a1d7862 | 9 | public void testResetAfterTimeout() {
try {
final CyclicBarrier start = new CyclicBarrier(3);
final CyclicBarrier barrier = new CyclicBarrier(3);
for (int i = 0; i < 2; i++) {
Thread t1 = new Thread(new Runnable() {
public void run() {
... |
83c71ab6-ee56-4570-a8b1-36df17d30201 | 7 | public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]);
sum = sum + a[i];
}
if (sum > 1.0 + EP... |
eac0d173-6606-4b93-ab96-8edff03201e0 | 2 | private void save(String litraV,String oximaV){
/*
* apothikeuei ta stoixia sthn vash elegxei an apothikeutikan kai emfanizei minima epituxia i apotuxias antistoixa
*/
String query="insert into anefodiasmoi(litra,oxima_id) values(?,?)"; //dhmiourgia query
try {
con.pS=con.conn.prepareStatement(query);
con.pS... |
0348454d-25f1-4f50-aa43-1da621436e73 | 9 | @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerInteract(PlayerInteractEvent event) {
Player p = event.getPlayer();
if (!p.isOp()) return;
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
if (p.getItemInHand().getType() == Material.CARROT_STICK) {
... |
98cc7efc-b603-4214-bbbe-cc7df23ffd62 | 9 | public static void doPagination(String table, String where, Class clazz, HttpServletRequest request, HttpServletResponse response) {
try {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
if ((request.getParameter("page") != null) &&... |
b0c65ab4-cf37-4549-b236-de57a70a0273 | 8 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try
{
String methodType = request.getPara... |
443758e1-a5f7-4216-9677-6e26ebcd5e71 | 6 | public void write(int i, byte abyte0[]) throws IOException {
if (closed)
return;
if (hasIOError) {
hasIOError = false;
throw new IOException("Error in writer thread");
}
if (buffer == null)
buffer = new byte[5000];
synchronized (this) {
for (int l = 0; l < i; l++) {
buffer[buffIndex] = abyt... |
df0fecc1-79b9-40c6-b243-a5b1ecf95c01 | 9 | protected void filter()
{ // if we are in the comment state
if(state.equals(State.COMMENT))
{ // if we are just entering this state
if(comment == null)
{ // The token is supposed to be a comment.
// We keep a reference to it and set the count to one
comment = (TComment) token;
... |
0306ce3f-e86c-4fe1-bc6c-03514f9fb7d5 | 3 | public void remove( BKnoop<E> aChild ) {
if( aChild == null )
throw new IllegalArgumentException(
"Argument is null" );
if( !isChild( aChild ) )
throw new IllegalArgumentException(
"Argument is geen kind" );
if( aChild == leftChil... |
8987a850-16a1-4784-a811-b17ed5ae6160 | 3 | @DBCommand
public boolean leave(CommandSender sender, Iterator<String> args) {
if(!sender.hasPermission("db.leave")) {
sender.sendMessage(ChatColor.RED + "You don't have permission to use this command!");
return true;
}
if(!(sender instanceof Player)) {
se... |
a1e0fd6d-d671-4ab6-a70b-4f2e6b8e32ed | 1 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
reload();
} catch (IOException ex) {
logger.log(level.ERROR, "Error while loading devices! Stack trace will be printed to console...");
JOptionPane.sh... |
e490f1ce-c727-4973-bbed-ba0f89e09c47 | 9 | private JButton getBoton() {
if (boton == null) {
boton = new JButton();
boton.setText("Anular");
boton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
int[] res;
String[] anulaciones;
int selec=0;
boolean b;
for... |
5e79b38c-fc04-4281-bd78-aa9fe5f2ce8c | 2 | public boolean peutSupprimer(Utilisateur utilisateur) {
return utilisateur != null && (utilisateur.equals(getAuteur()) || utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur());
} |
3df32e70-1eee-498c-9417-781d9a2008e0 | 3 | public static boolean libraryCompatible( Class libraryClass )
{
if( libraryClass == null )
{
errorMessage( "Parameter 'libraryClass' null in method" +
"'librayCompatible'" );
return false;
}
if( !Library.class.isAssignableFrom( librar... |
86699281-6463-4448-8b6c-69a0a4366ac2 | 5 | protected void updateView(String machineFileName, String input, JTableExtender table) {
ArrayList machines = this.getEnvironment().myObjects;
Object current = null;
if(machines != null) current = machines.get(0);
else current = this.getEnvironment().getObject();
if(current in... |
1ed13f7c-72ff-4ee9-bcb2-37556e6a66fb | 0 | public TMConfiguration(State state, TMConfiguration parent, Tape[] tapes, AcceptanceFilter[] filters) {
super(state, parent);
this.myTapes = tapes;
myFilters = filters;
} |
f1d25d2e-5f14-4246-9087-6915bc28ad58 | 8 | public Player2ColorSelectMenu(Game game, JFrame frame, int stateToNotShow) {
super(game, frame);
this.stateToNotShow = stateToNotShow;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
header = new JLabel(" Player 2: Choose Color");
header.setFont(smallFont);
blackBu... |
5f7a3ae9-313a-48c6-a5b3-162ef8ef9c9d | 6 | @Override
public AttributeValue getExampleAttributeValue(Example e) {
int playerToken = e.getResult().currentTurn;
int height = e.getBoard().height; // 6
int width = e.getBoard().width; // 7
int numTokensCountingFor = 2; // checking for 2 in a row
int countOfTokensEncounteredVertically = 0; // counter
/... |
4853138d-826f-4e67-bde5-e1937b8cec71 | 6 | public void Guerra() {
General.Reclutar(exerc1, pantalla);
General.Reclutar(exerc2, pantalla);
Formacio(exerc1);
Formacio(exerc2);
while (exerc1.size() != 0 && exerc2.size() != 0) {
if (General.Acorrer(exerc1, pantalla) == exerc1.size() && !exerc1.get(0).getTipus().equals("Mag")) {
General.Perdre(ex... |
dafdc145-9100-4120-af3f-96352d6b0a0c | 6 | @SuppressWarnings("unused")
public boolean eval(LinkedHashMap<Variable,Value> row, JTextArea console) throws TypeException{
boolean result = true;
LinkedHashMap<Variable,Value> localvar = new LinkedHashMap<Variable,Value> ( row);
Iterator<Statement> i = statement.iterator();
while (i.hasNext() && result) {
... |
478e3a1b-6b7c-4a63-9528-fb2c766810a5 | 0 | @Subscribe
public void when( ApplicationEvent applicationEvent )
{
eventNotified = true;
} |
ac0aaf16-605a-4aec-bd02-d226ebad6b34 | 9 | @Override
public void recoverPhyStats()
{
super.recoverPhyStats();
if(mode!=null)
switch(mode)
{
case STUN:
phyStats().setDamage(1);
break;
case NORMAL:
case MAIM:
case KILL:
case LASER:
case SONIC:
break;
case DISINTEGRATE:
case DISRUPT:
phyStats().setDamage(1+(phyStats().damage()... |
34abeb4d-0877-4a08-994f-b5ea43c3fcb8 | 3 | public int getPlacesBooked(Booking b) {
DiningHall dh = b.getDiningHall();
int countBookings = 0;
Iterator<Booking> iter;
iter = bookings.iterator();
while (iter.hasNext()) {
Booking booking = iter.next();
if (booking.getDiningHall().equals(dh)
&& (booking.getDate().compareTo(b.getDate()) == 0)) {
... |
6a262d8a-1dc5-459c-85d0-e3842e3658a4 | 2 | public void setFullScreen(boolean f) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice dev = env.getDefaultScreenDevice();
this.setBackground(Color.BLACK);
if (f) {
this.setResizable(false);
this.removeNotify();
... |
d50e806a-1429-4d55-93fa-cdd56fc81211 | 0 | public void setNom(String value) {
nom = value;
} |
215d5f42-e0f7-42bf-98e6-7ce8a8522507 | 7 | public SpellGroup getSpellGroup(String NAME)
{
SpellGroup grpStore;
for (int i=0;i<vctSpellGroups.size();i++)
{
grpStore = (SpellGroup)vctSpellGroups.elementAt(i);
if (NAME.equalsIgnoreCase(grpStore.strName))
{
return grpStore;
}
}
try
{
grpStore = new SpellGroup(NAME);
RandomAccessFi... |
4f6d65a3-91d8-4f9f-8d92-62b576512958 | 8 | public void draw(Graphics g)
{
if (!settings.isActive())
{
if (drawingImage.getWidth() != size.x || drawingImage.getHeight() != size.y)
{
drawingImage = new BufferedImage(size.x, size.y, BufferedImage.TYPE_INT_ARGB);
}
G... |
16546834-59ba-463f-8392-6bb6a291fc7c | 4 | public void replaceSeq(String newSeq) {
if (newSeq.length() != seq.length()) throw new RuntimeException("Cannot replace by a sequence with different length: Operation not supported!");
seq = newSeq;
// Invalidate some tags
for (int i = 0; i < tags.length; i++) {
if (tags[i].startsWith("MD:Z:")) tags[i] = nu... |
4d1fdb00-cc94-40cf-a6d3-54fb015be10c | 4 | public void run()
{
ItemStack[] p1OfferedItems = p1inv.getOwnItems();
ItemStack[] p2PendingItems = p2inv.getOthersItems();
if (!Arrays.equals(p1OfferedItems, p2PendingItems)) {
p2inv.setPendingItems(p1OfferedItems);
try {
cancelAccept(p2);
} catch (PlayerNotFoundExeption excepti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.