method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0f998f16-44b4-4b9d-8b2f-e7955a0e3a39 | 9 | public void calcPath() {
if (main.map == null) return;
if (main.commands == null) return;
if (main.commands.count == 0) return;
rover = new MapRover();
rover.point.x = main.map.roverStart.point.x;
rover.point.y = main.map.roverStart.point.y;
rover.heading = mai... |
396742ea-ef7b-42cc-a487-42b0424e05db | 5 | public void writeOdsCoor(String projN1, String projN2, String cycle){
ArrayList<String> odsCoor=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/common/coordinator.xml"),"UTF-8");
StringBuffer content=new StringBuffer();
String cycleTag="${coord:days(1)}";
if(cyc... |
0bf0d8ae-1e55-4bfe-abaa-6bf26c9b78b3 | 5 | private void startGame() throws InterruptedException {
OknoClass gameWindow = new OknoClass();
while(true) {
while (Constants.isRunning) {
makeStep(); // Updating Level state
gameWindow.redrawWindow(this);
try {
Thread... |
f39b35e5-8f10-44e4-b185-0d60f2f31e24 | 6 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT)
leftPressed = true;
if (e.getKeyCode() == KeyEvent.VK_RIGHT)
rightPressed = true;
if (e.getKeyCode() == KeyEvent.VK_UP)
upPressed = true;
if (e.getKeyCode() == KeyEvent.VK_SPACE)
spacePressed = true;
//ra... |
90290a9f-cca5-4e9f-8b0f-3f6a1b6536e3 | 4 | public float returnProfit(float bet) {
int sumValue = one.getValue() + two.getValue() + three.getValue();
if (sumValue == 30) {
// JACKPOT
profit = bet * 2;
} else if (sumValue >= 20) {
profit = (float) (bet * 1.5);
} else if (sumValue >= 14) {
profit = bet;
} else if (sumValue >= 8) {
profit ... |
e4ab2460-b089-477d-86d7-825e5d4465b6 | 1 | public TagConfig(Class<? extends MediaTag> tagClass, MediaProperty tagProperty, String tagVersions) {
this.tagClass = tagClass;
this.tagProperty = tagProperty;
this.tagVersions = tagVersions;
} |
2027a12c-84c8-4853-8cd1-4c6983af431d | 3 | @Override
public Cliente listById(int id_cliente) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Cliente c = new Cliente();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
... |
fc02764a-b85f-4578-8a2c-2a0a9d6266f1 | 5 | public void set_action(int act) {
currentAction=act;
if (act==ACTION_RECT)
statusBar.setText("hold down mouse button and draw rectangle, ESC to abort");
else if (act==ACTION_CIRCLE)
statusBar.setText("hold down mouse button and move right to set radius, ESC to abort");
else if (act==ACTION_P... |
6c4289fc-3719-49ba-8b57-5c84e45186ec | 7 | private JSAPResult checkParams(String[] args) {
JSAPResult jsapResult = jsap.parse(args);
if (!jsapResult.success()) {
printHelp(jsap);
}
if (!((jsapResult.getBoolean("one") ^ jsapResult.getBoolean("two")) ^ jsapResult
.getBoolean("three"))) {
printHelp(jsap);
}
if (jsapResult.getBoolean("one"... |
3919ee1e-f082-482c-ad32-dda7e03ada21 | 0 | public int getY() {
return y;
} |
cbac4774-af2f-4b82-9605-1165597e9d77 | 2 | public int Obtener_Secuencia() {
try {
int id1 = 0;
String sql = "select count(*) from entidades";
ResultSet rs;
if ((rs = conn.consultar(sql)).next()) {
id1 = Integer.parseInt(rs.getString(1));
}
return id1;
} catch... |
6fcef531-14ef-45dc-9caa-b52ddde0d787 | 3 | private void check(String owner, String member) {
if (owner.startsWith("java/")) {
String o = owner;
while (o != null) {
if (API.contains(o + ' ' + member)) {
return;
}
o = (String) HIERARCHY.get(o);
}
System.out.println("WARNING: " + owner + ' ' + member
+ " called in " + ... |
c7e5a2d4-c63c-44a2-a85f-15d297ad4b6d | 0 | public TasonLuontiTest() {
} |
e14174ac-6aa3-4cd2-9ee7-194d65dbd786 | 9 | private boolean helper(String s1, String s2, String s3) {
// trivial case
if ( s1.length()==0 ) {
return s2.equals(s3);
} else if ( s2.length()==0 ) {
return s1.equals(s3);
}
if ( s1.charAt(0) == s3.charAt(0) && s2.charAt(0) != s3.charAt(0) ){
... |
86de8d5d-712b-4a07-9eaf-d2c732caaae3 | 0 | public Date getDatetime() {
return datetime;
} |
de2d5103-828f-4c80-9d36-9dec6989b26f | 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 Email)) {
return false;
}
Email other = (Email) object;
if ((this.codemail == null && other.codemail != null) |... |
b2c949d8-8bde-4216-b46d-d5124946f9d7 | 3 | public static void searchTR() {
long cur = 0;
for (int i = 0; i < tr.length; i++) {
cur = tr[i][0];
for (int j = 1; j < tr[i].length; j++)
if(tr[i][j]==0)
searchRH(i, j-1, tr[i][0], i+"");
}
} |
4d9c695e-c6f6-4c1a-a37d-b58d74bcb18e | 0 | @Id
@Column(name = "person_id")
public int getPersonId() {
return personId;
} |
18582d59-6ad9-46b6-9de7-77bb95f53857 | 3 | @Override
public void run() {
gareDepart.getEspaceQuai().entrerVoie(this);
System.out.println(""+getNomTrain()+" : arrive en gare.");
try {
Thread.sleep(TEMPS_ARRET_TRAIN*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
gareDepa... |
2d57acc5-9026-4465-8d32-064277c78cd1 | 2 | @Override
public void onEvent(Event event) {
if (event instanceof HitWallEvent) {
onHitWall((HitWallEvent) event);
} else if (event instanceof HitRobotEvent) {
onHitRobot((HitRobotEvent) event);
}
} |
ee17b7e9-f62f-46b7-a161-3976a2c0f438 | 2 | public boolean isAncestorSelected(TreeRow row) {
row = row.getParent();
while (row != null) {
if (mSelectedRows.contains(row)) {
return true;
}
row = row.getParent();
}
return false;
} |
20f9e997-7017-4386-9c02-8f5fe20c205e | 6 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int init=in.nextInt();
String s = in.next();
if(init>n/2){
while(init<n){
init++;
System.out.println("RIGHT");
}
} else {
while(init>1){
init--;
System.out.println("LEFT");
}... |
d348fc91-8488-4b6d-8e15-0c9fa465bd62 | 7 | void saveProjectConf(String dir) throws IOException {
StringBuilder b = new StringBuilder();
for (int i = 0; i < tabs.getTabCount(); i++) {
SimPanel t = (SimPanel) tabs.getComponentAt(i);
if (t.getFile() != null) {
if (b.length() != 0) {
b.appe... |
a8a4b8da-a02a-40ae-aecd-d86847befba4 | 1 | public void visitInstanceOfExpr(final InstanceOfExpr expr) {
if (isLeaf(expr.expr())) {
firstOrder = true;
}
} |
3308c02a-9248-42fe-9738-99f327f614ef | 5 | @Test(timeout = 80000)
public void testLocks() {
LockKeeper lockKeeper = new LockKeeper(10, Bank.class, Subject.class, Payment.class);
Random rnd = new Random();
List<Bank> banks = Stream.generate(() -> Helper.generateBank(rnd)).limit(BANKS)
.collec... |
fa116cf9-1d18-4d12-aff6-83b50b0202e6 | 8 | public void receivePackage() throws IOException {
byte type = din.readByte();
int length = din.readInt();
switch (type) {
case 'I':
width = din.readInt();
height = din.readInt();
frameBuffer = new byte[width * height * 3];
break;
case 'A':
byte newActive = din.readByte();
... |
f783b79b-ac2e-4113-9499-a77c9798ca54 | 2 | public static AreaOfInterestEnumeration fromValue(String v) {
for (AreaOfInterestEnumeration c: AreaOfInterestEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
596abd6c-6b31-48e3-b7be-ad0429b99bee | 8 | private void loadFilters(Document doc) {
NodeList nList = doc.getElementsByTagName("LoggerConfig_" + this.getLoggerName());
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElem... |
b34eb5ea-b8d2-4dd2-a22e-391aa0991cc8 | 7 | private final void wrap(int[] p, BoundSize gapSize, boolean isWrap) {
boolean flowx = lc.isFlowX();
p[0] = flowx ? 0 : p[0] + 1;
p[1] = flowx ? p[1] + 1 : 0;
if (gapSize != null) {
if (wrapGapMap == null) {
wrapGapMap =
new HashMap<Int... |
138259ab-3382-443e-9bcc-b938eb43332f | 2 | public int getIndex (TreeNode n)
{
for (int i = 0; i < hubs.length; i++)
if (hubs [i] == n)
return i;
return -1;
} |
96705ff1-1968-4ea0-b5e9-56790bc95ff0 | 8 | public ChangesStatus saveAccount(Account account,
ArrayList<MapAccountCustomer> mapAccountCustomer) {
Connection connection = DBConnectionHelper.getConnection();
AccountDAO accountDAO = DAOFactory.getAccountDAO();
MapAccountCustomerDAO mapAccountCustomerDAO = DAOFactory.getMapAccountCustomerDAO();
try {
... |
a29651bb-bf57-4052-9e29-6e24b2f1f398 | 2 | @SuppressWarnings("rawtypes")
public Date convert(Class type, Object value) {
if (!(value instanceof String))
throw new RuntimeException("wrong input value");
try {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
return sdf.parse((String) value);
... |
e64537dd-6c46-4f9f-85f0-93825b8fb390 | 1 | public static void main(String[] args) {
try {
AppGameContainer container = new AppGameContainer(new Game());
container.setDisplayMode(WIDTH, HEIGHT, false); //TODO: Maybe make this full screen later? IDK
container.setShowFPS(false);
container.start();
} catch (Exception e) {
e.printStackTrace();
... |
2df3eded-2471-4997-9ced-766d54ad703b | 5 | public Set<AbstractProject> getImplementers() {
ImmutableSet.Builder<AbstractProject> builder = ImmutableSet.builder();
List<AbstractProject> allProjects = Hudson.getInstance().getAllItems(AbstractProject.class);
for (AbstractProject project : allProjects) {
if(project instanceof BuildableItemWithBuildWrappers... |
8512eeaa-088e-48cd-ab10-715d6a93853f | 1 | public List<Course> courseList(int uniId) throws SQLException {
CourseDatabaseManager dm = new CourseDatabaseManager();
String s_uniId = Integer.toString(uniId);
String sql = "select * from course where uni_id = " + s_uniId + ";";
ResultSet rs = dm.sqlQuery(sql);
List<Course> cList = new ArrayList<Course>();... |
74d5f7f8-d66e-40c4-abdc-0d711d07ad51 | 8 | public static CharProbability[] sortedCharProbabilitiesOf(String theTextStr) {
CharProbability[] charProbs = CryptoAnalysis.charProbabilitiesOf(theTextStr);
boolean sorted = false;
while (sorted == false) {
boolean swapped = false;
for (int i = 0; i < charProbs.length... |
1e2a5a36-6a4f-43e7-a5a7-0c11de68adb4 | 0 | @Test
public void testGetAnt() throws IOException {
System.out.println("getAnt");
Cell instance = new Cell(0,0);
Ant expResult = null;
Ant result = instance.getAnt();
assertEquals(expResult, result);
AntBrain ab = new AntBrain("cleverbrain1.brain");
A... |
2695202f-5aaf-49a4-a019-99e50dc95517 | 9 | public void initializeDataStorage() throws Exception
{
System.out.println("This inicialization will put values in storage and release Targets for each period");
/*
* And also put the weights on each of the component
* data will be put manual but this should be upgraded to put over a php form (internet)
... |
c515c174-6a0b-49fa-85cb-1029a6d3d89f | 6 | @EventHandler
public void EndermanBlindness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman... |
0b382a92-24df-4495-bac5-7fe9aee055c5 | 5 | public String reverseWords(String s) {
StringBuilder reversed = new StringBuilder();
int j = s.length();
for (int i = j - 1; i >= 0; i--) {
if (s.charAt(i) == ' ') {
j = i;
} else if (i == 0 || s.charAt(i - 1) == ' ') {
if (reversed.length() != 0) {
reversed.append(' ');
}
reversed.appe... |
610a6ff4-7656-4165-a54e-6f43e254af1b | 3 | public NBTTagCompound get(int i) {
if (i >= 0 && i < this.list.size()) {
NBTBase nbtbase = (NBTBase) this.list.get(i);
return nbtbase.getTypeId() == 10 ? (NBTTagCompound) nbtbase : new NBTTagCompound();
} else {
return new NBTTagCompound();
}
} |
de633ecf-57c2-410b-878c-fa2adb116ab9 | 8 | private void fillTrack(String[] values, Track track) {
//el metodo recibe los valores de las propiedades de las pista y la pista
//luego almacena los valores en la pista guarda el header y el foot de la misma.
for (String texto : values) {
String[] value = texto.split("=");
... |
d08f864c-4317-4f84-a057-459784cf3da2 | 1 | public void add(Type i) {
if (size == data.length)
resize(2 * data.length);
data[size] = i;
size++;
} |
eb74b7f1-3c80-49a2-bc5e-a11c53fd5cd2 | 5 | public BlastPacket ProcessBlastPacket(BlastPacket pkt) {// process a packet for distance updates
BlastPacket PktNext = null;
Node nbr = pkt.LatestSender;
//pkt.LatestSender = this;//?
NbrInfo FromNbr = this.Neighbors.get(nbr);// nbr is the neighbor who handed me this packet
if (this.MyAddressVector... |
5bc2584f-c6f2-4332-b71d-3c85ef56df4c | 1 | public void addRangeAtom(RangeAtom ra) {
if (rangeList == null) {
rangeList = ra;
} else {
rangeTail.next = ra;
}
rangeTail = ra;
} |
24337ff9-13ad-40c6-9c88-751f60e6db3b | 7 | void refreshForces() {
if (model.isRunning())
return;
if (forceVector || accelerationVector || showVDWLines || showChargeLines || showSSLines || showBPLines) {
model.computeForce(-1); // refresh force vectors
}
} |
be45197d-baca-4a5e-b9d5-a2fdbbfcdb9b | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(OK)) {
ok();
} else if (e.getActionCommand().equals(CANCEL)) {
cancel();
} else if (e.getActionCommand().equals(RESTORE_TO_GLOBAL)) {
restoreToGlobal();
}
} |
89454e3d-e929-4a43-adab-84bb61e2da1b | 7 | public Color idToColor(int id)
{
switch(id)
{
case -1: //testing
return TESTCOL;
case 0: //open ocean
return OCEANCOL;
case 1: //missed shot
return MISSEDCOL;
case 2: //undamaged ship
if(gameWon || !isEnemy)
return SHIPCOL;
else
return OCEANCOL;
case 3: //damaged ship
return... |
7eb31a14-107a-4b8b-b9b0-2ef97927c303 | 7 | public void renderGrid(Grid grid, Color color, boolean visible) {
if (visible) {
renderer.setProjectionMatrix(camera.combined);
renderer.begin(ShapeType.Line);
renderer.setColor(color);
for (int i = 0; i < grid.lines.size; i++) {
Grid.GridLine line = grid.lines.get(i);
if (line.x == line.x2) { /... |
7363d7bb-8826-48a7-9321-920a745f728a | 9 | public void deleteRows(){
int nodelete;
int rowtobedeleted = 0;
for(int row = 0; row<MAX_ROW; row++){
nodelete = 0;
for(int col = 0; col <MAX_COL; col++){
if(board[row][col] == 0)
nodelete = 1;
}
if(nodelete == 0){
rowtobedeleted = row;
}
}
if(rowtobedeleted != 0){
for(int ... |
a14ee3a0-9583-4b75-9a12-3675d455cedb | 5 | public static void printInstance(Instance i)
{
String data = i.toString();
PrintWriter writer = null;
try {
writer = new PrintWriter("flight_plan.html", "UTF-8");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
... |
ab10bdc9-b64d-477d-9908-6991f9417c1d | 4 | public static void main(String[] args) {
String line = "";
String message = "";
int c;
try {
while ((c = System.in.read()) >= 0) {
switch (c) {
case '\n':
if (line.equals("go")) {
PlanetWars pw = new PlanetWars(message);
DoTurn(pw);
pw.FinishTurn();
message = "";
} e... |
3bc5cb47-b3f7-4e01-8fc8-3adcdb0a5c4a | 7 | @Override
public void solve( DenseMatrix64F B , DenseMatrix64F X ) {
if( B.numCols != X.numCols || B.numRows != n || X.numRows != n) {
throw new IllegalArgumentException("Unexpected matrix size");
}
int numCols = B.numCols;
double dataB[] = B.data;
double dataX[... |
0183ca22-e7ea-410e-b57b-c913f608f927 | 0 | @Test
public void testDoMovement() {
System.out.println("doMovement");
Movimiento mov = null;
Cuenta instance = new Cuenta();
boolean expResult = false;
boolean result = instance.doMovement(mov);
assertEquals(expResult, result);
// TODO review the generated te... |
34273da1-cf96-4d86-ac33-10c9734231f9 | 0 | private boolean graphContainsVertex(Vertex vertex) {
return vertices.contains(vertex);
} |
fbde17e1-57c8-4091-81bb-3f82155fb36f | 4 | private void setEnabled(Container cont, boolean enabled, Component[] notEdit) {
List<Component> notEditList = null;
if (notEdit != null && notEdit.length > 0) {
notEditList = Arrays.<Component> asList(notEdit);
} else {
notEditList = new ArrayList<Component>();
}
Component[] comps = cont.getComponents(... |
96a681ec-a0c3-4024-b0bf-3c339353faf5 | 6 | @Override
public int hashCode() {
int result = parishionerId;
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (streetNumber != null ? streetNumber.hashCode() : 0);
... |
a41a3af4-f557-4f59-b063-785667f7c069 | 6 | private void efectuarCicle(){
// Iterator it = Main.exploradors.iterator();
// Agent ag;
// while(it.hasNext()){
// ag= (Agent) it.next();
// int x= ag.getPosicioI();
// int y= ag.getPosicioJ();
// ag.avança();
//
// }
Iterator i... |
e201224f-1f84-4cbc-8896-bf58fd8f50d9 | 3 | public static void Envia (FileDatos objeto, String hostdestino, int puerto){
try {
DatagramSocket socket;
DatagramPacket paquete;
//El protocolo IP subyacente permite longitudes de paquetes de más de 2^16 bytes,
//que incluye tanto las cabeceras como los mensajes
... |
1b95d283-ce39-4ed9-b390-474f479152a6 | 3 | public void draw(Graphics page)
{
if (hover) //Draw Hovered Parts
{
page.setColor(hoverBackgroundColor);
page.fillRoundRect(this.getX(), this.getY(), this.getWidth(),
this.getHeight(), 25, 25);
page.fillRoundRect(this.getX()+2, this.getY()-2,
this.getWidth(), this.getHeight(), 25, 25... |
71b43371-dda7-4d82-85cb-038b3d54f146 | 1 | private void loadPreviousFonts() {
this.previousFonts = new ArrayList<Font>();
for (int i = this.startFrom; i <= this.endAt; i++) {
this.previousFonts
.add(this.document.getChildren().get(i).getFont());
}
} |
e9bc779e-6e87-49bb-ba2f-1f826972d4d4 | 2 | public void drawToPostScript(EPSOutputPrintStream pw, PositionTransformation pt) {
pt.translateToGUIPosition(startNode.getPosition());
double eSX = pt.guiXDouble;
double eSY = pt.guiYDouble;
pt.translateToGUIPosition(endNode.getPosition());
Color c = getColor();
pw.setColor(c.getRed(), c.getGreen(), c.getBl... |
78e91fc5-2bb2-476f-add2-f95989abb4d8 | 1 | private void doUpdateTest() {
System.out.print("\n[Performing UPDATE] ... ");
try {
Statement st = conn.createStatement();
st.executeUpdate("UPDATE COFFEES SET PRICE=4.99 WHERE COF_NAME='chocolat'");
} catch (SQLException ex) {
System.err.println(ex.getMessage... |
1d73a785-6f35-45ad-9130-8294df4ba72f | 4 | public static void register(Class<? extends WorldObject> class_, IObjectRenderer renderer) {
if (class_ == null || renderer == null) return;
if (renderers.containsKey(class_)) return;
renderers.put(class_, renderer);
} |
f325714e-b7ca-4e51-8ac3-c224a9d7040e | 1 | public MusicController(){
Properties props = System.getProperties();
classPath = props.getProperty("java.class.path");
int temp = classPath.indexOf(";");
if (temp>0){
classPath =classPath.substring(0, temp);
}
classPath=classPath.replace("\\", "/");
... |
f89345da-45e9-48c9-9acb-101346fea2eb | 1 | public void signOut() throws SocketTimeoutException {
try {
clientSocket.Escribir("SALIR\n");
serverAnswer = clientSocket.Leer();
} catch (IOException e) {
throw new SocketTimeoutException();
}
System.out.println(serverAnswer);
} |
3d3deb45-681d-4a3e-ac53-c37e68cd849d | 0 | public Head getHead() {
return head;
} |
be2272ad-7b15-4eec-ac52-c29a6fda4791 | 4 | public void makeFp() {
fp.clear();
if (time.size() == 0)
return;
double[] t = new double[time.size()];
int i = 0;
for (double ti : time)
t[i++] = ti;
int clsIndex = 0;
int ltsIndex = 0;
for (int n = 0; n < order; n++) {
double[] v = new double[time.size()];
i = 0;
for (Matrix x : traj... |
0dc910a7-ad0b-46a7-89c3-4eac4a6fe0ea | 2 | private static boolean verifyIfNumberIsPrime(int number)
{
for (int i=2; i<number; i++)
{
if (number%i==0)
{
return false;
}
else
{
return true;
}
}
return true;
} |
490a65c0-317b-484d-8297-c88297300405 | 2 | public Timenode getTimenode(int id) {
conn = new SQLconnect().getConnection();
Timenode node = new Timenode();
try {
String sql = "select * from timenodes where display = 'true' and id = "
+ id;
Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的Statement对象
ResultSet rs = st.execute... |
4a1242d7-ddab-4088-9de4-11b4a757efff | 4 | private boolean zIntersects(Vec3D var1) {
return var1 == null?false:var1.x >= this.x0 && var1.x <= this.x1 && var1.y >= this.y0 && var1.y <= this.y1;
} |
2515031f-909c-4418-9b7d-8e064ec98884 | 6 | private Cliente get_Cliente (String codigo){
String detalle = "";
Cliente cli = new Cliente();
r_con.Connection();
try {
String sql = ( "SELECT cli_codigo, cli_nombre, cli_apellido, cli_fecha_nac, cli_cuit, loc_descripcion, cli_direccion, cli_calle, cli_sit_frente... |
95df3be7-0a15-48de-a648-5795172e104f | 0 | public void setUsuario(String usuario) {
this.usuario = usuario;
} |
e4a1bc01-899a-4dc3-9dbe-6eab3f42eecb | 2 | protected void addedToWorld(World world){
m = (Map) world;
if (target!= null && m.checkEnemy(target) == true){
turnTowards(target.getX(), target.getY());
}
} |
e0df85eb-bd9a-46c5-a6e2-957147d19ff7 | 4 | @Override
public double getAimAngle() {
if (_where)
_direction += 0.2;
if (!_where)
_direction -= 0.2;
if (_direction >= 1.6)
_where = false;
if (_direction <= 0)
_where = true;
return (Math.PI * (0.8 - _direction) / 2);
} |
de27d49d-1b8d-45d0-978a-91990400d963 | 9 | public static void main(String[] args) {
int numberOfTests = Integer.parseInt(args[0]);
int sequencesSize = Integer.parseInt(args[1]);
Random random = new Random();
Format format = new Pair();
try {
List<String> matrices = new ArrayList<String>();
for (I... |
8a78b54b-5575-4119-bc08-787f4b222677 | 7 | public GAPopulation(Genome comp)
{
individual = new ArrayList<Genome>();
parent = comp;
// reading parameters
Parameter param = Parameter.getInstance();
String paramval;
paramval = param.getParam("population size");
if (paramval != null)
size = Integer.valueOf(paramval);
else
{
System.... |
a539736a-7fea-46a8-8313-b4bc29aaee35 | 5 | @Override
public void updateRecord()
{
String ts = tempstr;
if( ts == null )
{
return;
}
if( ByteTools.isUnicode( ts ) )
{
grbit = (byte) (grbit | 0x1);
}
try
{
byte[] strbytes = null;
if( (grbit & 0x1) == 0x1 )
{
strbytes = ts.getBytes( UNICODEENCODING );
}
else
{
s... |
7972b9d2-c325-4887-b884-e034509b274d | 4 | public boolean stop(){
if((status != Status.STARTED)||(null == worker)||(!worker.isAlive()))
throw new IllegalStateException();
if(stopWork()){
doWhenBeInterrupted();
return true;
}
return false;
} |
02eddeea-0236-4979-a52f-2f12c29d8f52 | 2 | public void loadExternalModules(){
FilenameFilter filter = new FileExtensionFilter("jar");
for(File jarfile : modulesFolder.listFiles(filter)){
try {
loadExternalModule(new JarFile(jarfile));
} catch (IOException e) {
e.printStackTrace();
}
}
} |
995a4984-e265-4049-a556-b5381fd0b14b | 4 | private void doUpdateGS(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String yitouGSId = StringUtil.toString(request.getParameter("yitougsId"));
if(!StringUtil.isEmpty(yitouGSId)) {
boolean isSuccess = true;
// ObjectMapper mappe... |
aba41810-a797-46a8-8c6b-2a5c37e482d2 | 7 | @EventHandler
public void WitherWeakness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Weakne... |
609bdb34-b56f-4db9-afbd-da7e873f7278 | 1 | @Override
public void reactOnCollision(ElementField element, CollisionMan.TYPE type) {
if (element instanceof Ball) {
insertBall((Ball) element);
}
} |
6976f55a-398e-495b-84ee-1b0c076c0b6f | 1 | public Tooltip(byte[] buf) {
try {
t = new String(buf, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw (new LoadException(e, Resource.this));
}
} |
bad47a4f-319c-41a8-86b1-e1290a2ef1b3 | 4 | public static String removeWhiteSpace(char[] cArray) {
StringBuilder s = new StringBuilder();
for (char c : cArray) {
boolean isWS = false;
for(char ws : WhiteSpace) {
if(c==ws) {
isWS = true;
}
}
if(!isWS) {
s.append(c);
}
}
return s.toString();
} |
844a2aa8-5c6f-4844-90ef-971731d01fd6 | 3 | private void addItem() throws Throwable {
int units;
if(!txt_Code.getText().equals("")) {
String code = txt_Code.getText();
Items k = new Items(code);
int id = k.getID();
String prodName = k.getName();
double denom = k.getPrice();
if(txt_Units.getText().equals("")) {
units = 1;
} else {
... |
2392204f-9dd3-455a-be9a-8ea914056074 | 6 | public int getMosquitoesCaptured( Light light, int[][] board ) {
int count = 0;
// I'm just using a 20x20 square for now because it is simple
// Also, if they are more than 5 out, they may technically "belong" to another light
for ( int i = (int) light.getX()-10; i<(int) light.getX()+10; i++ ) {
for ( int j ... |
af138f70-8962-45da-a38c-65ebfc252e5d | 0 | public void setAcceptByHalting(boolean t) {
turingAcceptByHalting = t;
turingAcceptByHaltingCheckBox.setSelected(t);
} |
05639fb8-753b-49f0-be96-bdece0289238 | 8 | private boolean r_shortv() {
int v_1;
// (, line 49
// or, line 51
lab0: do {
v_1 = limit - cursor;
lab1: do {
// (, line 50
if (!(out_grouping_... |
36cc0a08-c537-4283-b302-7c3abc3e2ea8 | 0 | public Rectangle getFourthCorner() {
return fourthCorner;
} |
3de60bd0-0a5c-46b6-9975-812c3cafe217 | 4 | private void makeConnection(mode operationMode) throws SQLException
{
try
{
// Load all the drivers and initialise the database connection
Class.forName("org.postgresql.Driver");
// Check on the operation mode
System.out.println(getVersionString() + " and " + forced)... |
8dd98041-cc4b-4850-a76c-6eba60d0de96 | 3 | public void render(Graphics2D g){
Graphics2D g2d = (Graphics2D)finalBoard.getGraphics();
g2d.drawImage(gameBoard, 0, 0, null);
//rysujemy tilesy
for(int row = 0; row < ROWS; row++){
for(int col = 0; col < COLS; col++){
Tile current = board[row][col];
if(current == null) continue;
current.render(g... |
2e17f35e-86dd-47cb-9f72-a3ea64c95f73 | 6 | public static int[] merge(int[] first, int[] second) {
int[] result = new int[first.length + second.length];
int firstIndex = 0;
int secondIndex = 0;
//шикарно заимплементил почти сам
while (firstIndex + secondIndex != result.length) {
if (firstIndex < first.length... |
286c8cf8-01d2-4a09-8209-75475c02dd5c | 0 | public Stat(StatType inType, double inValue) {
type = inType;
value = inValue;
} |
19710f36-6fe8-49fc-9e45-13e0cd3d03be | 9 | public static boolean isEqual(int[][] m1, int[][] m2) {
if (m1 == null && m2 == null) {
return true;
}
if (m1 == null || m2 == null) {
return false;
}
if (m1.length != m2.length || m1[0].length != m2[0].length) {
return false;
}
for (int i = 0; i < m1.length; i++) {
f... |
ac485102-9033-43b3-9477-57b864d03858 | 4 | private ItemStack setRecipeRank(ItemStack preResult, ArrayList<ItemStack> recipeItems){
ItemStack i = preResult;
int total = 0;
int nonTotal = 0;
if(this.isaNonFoodItem(i.getType())){
nonTotal = nonTotal + 1;
}
ItemMeta meta = i.getItemMeta();
if(i.hasItemMeta()){
if(meta.hasLore() && meta.getLore(... |
dff7d2b6-4109-4ec1-ad87-7e1195e28a3b | 4 | public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
directionX = 0;
}
if (key == KeyEvent.VK_RIGHT) {
directionX = 0;
}
if (key == KeyEvent.VK_UP) {
directionY = 0;
}
if (ke... |
ec2496a2-e3dd-456e-b1fa-f6f60cfcde7e | 9 | @Override
public void itemStateChanged(ItemEvent event) {
if(event.getSource() == bSpecBranchSource) {
ParamManager.showSpecBranchSource = bSpecBranchSource.isSelected();
vis.setSpecBranchSourceVisible(bSpecBranchSource.isSelected());
}
else if(event.getSource() == bSpecBranchLin) {
ParamManager.sh... |
ee32a45c-6cec-4209-a929-db8a6b0abca4 | 9 | private void updateAgPercept(Agent ag)
{
String agName = ag.getName() ;
clearPercepts(agName);
// exit for preys
if (agName.contains("rabbit"))
{
return ;
}
// inform agent's current state
addPercept(agName, Literal.parseLiteral("life(" + ag.getLife() + ")"));
// inform agent's positio... |
1f2043b0-07c9-4f23-b0cf-c9ba84053fb9 | 7 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof XYInterval)) {
return false;
}
XYInterval that = (XYInterval) obj;
if (this.xLow != that.xLow) {
return false;
}
if (this.xHigh !... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.