method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
873fdc3b-d0a6-46d2-8f24-52fe33c548de | 1 | public static void main(String[] argsv) {
// Setting op a bank.
Bank christmasBank = new Bank();
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100)));
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000)));
// Print the balanc... |
12eddb21-9997-4a8d-9dcb-8e8794f48cff | 8 | private boolean r_perfective_gerund() {
int among_var;
int v_1;
// (, line 71
// [, line 72
ket = cursor;
// substring, line 72
among_var = find_among_b(a_0, 9);
if (among_var ... |
786933a8-0824-4084-8da6-d3b97fe31fda | 1 | private static String createFolder(String folderPathName) {
folderPathName = folderPathName + OS_SEPARATOR + folderNameSf.format(dt);
File file = new File(folderPathName);
boolean exists = file.exists();
if (!exists) {
file.mkdir();
}
return folderPathName;
... |
be327d5e-50ce-4cea-9320-b340e608ec48 | 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 Feedback)) {
return false;
}
Feedback other = (Feedback) object;
if ((this.getId() == null && other.getId() != ... |
0f34534f-51de-412d-9b89-53a2fbb03048 | 1 | public AboutDialog(JFrame parent, String title, String message) {
super(parent, title, true);
if (parent != null) {
Dimension parentSize = parent.getSize();
Point p = parent.getLocation();
setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
}
JPanel messagePa... |
ea116a76-3d45-4752-b44a-c7b368a95caf | 0 | @Override
public String toString() {
return eWord +" - " + rWord;
} |
f17e0cb8-e8a2-43d1-b6f7-1b674dc82aff | 4 | public List<String> addChild(List<String> nameList) {
List<String> returnNames= new ArrayList<String>();
List<Identifier> tempIdentifierList = children;
Iterator<String> tempStringIterator = nameList.iterator();
Identifier currentIdentifier = this;
String currentName = null;
... |
a20c8088-7573-419a-bf31-c04c57fb2231 | 7 | public void characters(char[] ch, int start, int length) throws SAXException {
// we're only interested in this inside a <phone.../> tag
if (currentVoyageur != null) {
// don't forget to trim excess spaces from the ends of the string
if (idTag.equals("open")) {
St... |
fdfe9583-454d-4f83-80d8-945303c6d742 | 9 | DpDistribution(double volume,double [] demands,double [] weights,int discretization)
{
if (volume<0) System.out.println("ERROR the volume is below 0 in knapsack algorithm");
int timesteps = demands.length;
int disk=discretization+1;
double cal_matrice[][] = new double [timesteps][disk];
... |
8e591ad3-3a95-4ec2-81f9-79956c8bf557 | 2 | public TriangleDivisionNormalDistributedDemandGenerator(
int numberOfForerunPeriods, int offSet) {
if (numberOfForerunPeriods < 1 || offSet < 0) throw new IllegalArgumentException();
this.numberOfOrderPeriods = numberOfForerunPeriods;
this.offSet = offSet;
} |
63e0060e-b39a-477c-afad-440f5b327ffd | 9 | protected void actualizar(){
if(this.materias != null && this.alumnos != null && this.dias != null && this.faltas != null){
AlumnoVO[] alumnos;
alumnos = this.alumnos.toArray(new AlumnoVO[0]);
String [] titulo = new String[this.dias + 2];
String [][] contenido = new String [alumnos.length][this.dias + 2]... |
94b1a792-83e3-4d1a-bb41-db548b49b73e | 4 | @Override
public void onUpdate(World apples) {
if ((apples.isSolid(X, Y)))
{
// apples.ground.FillCircleW(X, Y, radius, World.STONE);
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
for (Player p:apples.playerList)
{
if (apples.pointD... |
676294ac-7d02-42ab-95cb-271ac0857be9 | 8 | private void method362(int i, int ai[], byte abyte0[], int j, int k, int l,
int i1, int ai1[], int j1)
{
int k1 = -(l >> 2);
l = -(l & 3);
for(int l1 = -i; l1 < 0; l1++)
{
for(int i2 = k1; i2 < 0; i2++)
{
byte byte1 = abyte0[i1++];
if(byte1 != 0)
ai[k++] = ai1[byte1 & 0xff];
els... |
a637fa9a-a8a9-4ff5-b851-74b1988471b3 | 9 | public static void placeObject(Location loc, Player player) {
if(loc.getBlock().getType().equals(Material.STONE)) {
}
if(loc.getBlock().getType().equals(Material.COBBLESTONE)) {
double x = loc.getX();
double y = loc.getX();
double z = loc.getX();
Location locnew = new Location (player.getWorld(), x+1,... |
90d7c644-8b88-4cf9-8b8e-a72d2e22c6ca | 4 | private static void nearNeighbour(float p) {
ImageData imageData = original.getImageData();
int[][] two1 = new int[imageData.height][imageData.width];
for (int i = 0; i < imageData.height; i++) {
for (int j = 0; j < imageData.width; j++) {
two1[i][j] = imageData.getPixel(j, i);
}
}
int[] one1 = Im... |
2550f894-351b-4fc8-a9d1-618828c987f8 | 3 | public Link(String name, double baudRate, double propDelay, int MTU)
throws ParameterException, NullPointerException
{
super(name);
String msg = name + "(): Error - ";
if (baudRate <= 0) {
throw new ParameterException(msg + "baud rate must be > 0.");
}
... |
359fe33a-251e-441c-aa67-44cf20452a1c | 7 | private void initializeNetwork(int insnum,int outsnum){
int i;
int f;
for(i=0;i<insnum;i++){
InputNeuron_Add neuron=new InputNeuron_Add();
neuron.setInputID(i);
if(tracker==null)
System.out.println("Historical Tracker is null :: NeuralNetwork")... |
7505b372-1a34-4a36-8263-2537f5f6ff03 | 1 | public String getStatusFrequencyOverHours() {
Map<Integer, Integer> map = analytic.getStatusFrequencyOverHours();
StringBuilder sb = new StringBuilder();
List<Entry<Integer, Integer>> entries = new ArrayList<Entry<Integer, Integer>>(map.entrySet());
Collections.sort(entries, new Comparator<Entry<Integer, Int... |
eaf64ce6-a87a-494c-98de-8b720d3d2045 | 5 | public Library getLibrary() {
Connection con = null;
Statement stmt = null;
Library lib=null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
d40bd349-2750-42a6-bb79-dd5041829c8e | 5 | private boolean initialize(int numOfRows, int numOfColumns) {
if (isInitialized) {
Iterator<List<Passenger>> rowIterator = passengerList.iterator();
while(rowIterator.hasNext()){
List<Passenger> _passengers = rowIterator.next();
for (int i = 0; i < _passen... |
89653145-877d-4844-85f6-afc10cc13ca0 | 3 | protected void completeHeaders() {
if(! statusSent) throw new IllegalStateException("Must send status " +
"before headers");
if(headersSent)
throw new IllegalStateException("Headers already completed");
try { out.write("\r\n".getBytes()); }
catch (IOException e) { e.printStackTrace(); }
headersSen... |
23e3bc39-4c7f-4a3d-8515-21531e3ab5ae | 4 | public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(10);
//buffer.limit(7);
System.out.println(buffer.limit() + "." + buffer.position());
//init data
for(int i=0;i<buffer.capacity();i++){
buffer.put((byte) i);
System.out.println(buffer.limit() + "." + buffer.position());
... |
3d767bb9-6e7b-44e2-a470-a7c7718cc62f | 5 | public String getRole() {
String libelle="";
switch(this.type){
case 1:
libelle = "administratif";
break;
case 2:
libelle = "etudiant";
break;
case 3:
libelle = "prof";
... |
fddbf2e4-2a84-490c-b5b0-869555340bbb | 7 | public SortedMap<Long, Boolean> berechneVonBis(long von, long bis)
{
Map.Entry<Long, Boolean> start = berechneNaechstenZustandsWechsel(von);
Map.Entry<Long, Boolean> ende = berechneLetztenZustandsWechsel(bis);
if (start == null || ende == null)
{
return null;
}
Date d = new Date();
... |
95391af6-4ece-4711-819f-d9c9c543dfd2 | 6 | private void advanceTutorial()
{
tutorialNum++;
if (tutorialNum == 1)
{
showComponents(false);
backgroundImage = sprites.get("tutControls");
}
else if (tutorialNum == 2)
{
backgroundImage = sprites.get("tutEnemy");
}
else if (tutorialNum == 3)
{
backgroundIm... |
fe609db1-1038-44dd-ad21-dd35b920171b | 3 | public static NSMBView read(ArrayReader inp, ArrayReader cam)
{
NSMBView v = new NSMBView();
v.X = inp.readShort();
v.Y = inp.readShort();
v.Width = inp.readShort();
v.Height = inp.readShort();
v.Number = inp.readByte();
int camID = inp.readByte();
v.... |
74af8f8c-1f33-458d-8c59-519870b62774 | 5 | private void acao133() throws SemanticError {
if (!(idAtual instanceof IdentificadorVariavel || idAtual instanceof IdentificadorParametro))
throw new SemanticError("Esperado variável ou parâmetro");
if (idAtual instanceof IdentificadorVariavelVetor)
throw new SemanticError("Vetores devem ser indexados");
... |
7a539ee2-b166-48a8-8375-dafbdb941bc8 | 7 | private int checkEdgeCrossings(S2Loop b, S2EdgeUtil.WedgeRelation relation) {
DataEdgeIterator it = getEdgeIterator(b.numVertices);
int result = 1;
// since 'this' usually has many more vertices than 'b', use the index on
// 'this' and loop over 'b'
for (int j = 0; j < b.numVertices(); ++j) {
... |
e08c077b-087f-4de3-bd8f-41ae851e8b7d | 4 | void rebuildBest(int numOfTries){
Expression[] best = expressions.clone();
int dep= depth();
double bestF= recalcule();
while(numOfTries-- >0){
Expression[] newTry= new Expression[getArity()];
for(int i=0; i<getArity(); i++)
newTry[i]= generateRandomTree(Expression.maxDepth-dep);
rebuild(newTry);
... |
fbf6a1ed-9775-42d2-8ae5-14a12c742b9e | 3 | private void initRunwaysList() {
try{
RecentLaunchSelections recent = RecentLaunchSelections.getRecentLaunchSelections();
runways = DatabaseUtilities.DatabaseDataObjectUtilities.getRunways();
List<Runway> recentRunways = recent.getRecentRunway();
for (int i = 0; i... |
3b676629-914f-4cd4-aa9b-f1ce0c86f0a8 | 3 | public String Connexion(String username, String password){
try{
session.beginTransaction();
Query req = session.createQuery("SELECT membre.motPasse, type.typeDescFr FROM BiMembres membre, BiTypesmembres type WHERE membre.login = '"
+ username + "' AND type.ty... |
7f1117e0-67c7-47ea-9fbd-18e330eac9be | 0 | public void setSintomaCollection(Collection<Sintoma> sintomaCollection) {
this.sintomaCollection = sintomaCollection;
} |
5ef0943c-3247-4b61-aec8-65084e79ea73 | 3 | public int decodeBit(short[] probs, int index) throws IOException {
int prob = probs[index];
int newBound = (Range >>> kNumBitModelTotalBits) * prob;
if ((Code ^ 0x80000000) < (newBound ^ 0x80000000)) {
Range = newBound;
probs[index] = (short) (prob + ((kBitModelTotal - p... |
6dffb571-4487-40bf-94d7-908fad5c305a | 6 | @Override
public void createPreview(JTextArea ContentBox) {
ContentBox.append("Files found : " + this.getFiles().size() + "\n");
for (int i = 0; i < files.size(); i++) {
ContentBox.append("File : " + this.getFiles().get(i).getFilename() + "\n\nTools : \n");
for (int t = 0; t < this.getFiles().get(i).getTools... |
0edda3a4-f1ee-478f-8f9b-125580dc93df | 6 | public boolean selectWithMouse(MouseEvent mouse) {
Tool tool = GUI.controls.getTool();
Object o = getObject(mouseGetX(mouse), mouseGetY(mouse), tool);
if (o == null)
return false;
if (o instanceof Vertex) {
if (mouse.getClickCount() == 2 && player.state == RunSta... |
f681c799-9a53-4757-80f1-034ff6379e4c | 6 | @Override
public Dimension minimumLayoutSize(Container parent) {
Insets insets = getInsets();
int count = getComponentCount();
int width = 0;
int height = 0;
boolean foundTab = false;
for (int i = 0; i < count; i++) {
Component component = getComponent(i);
if (component instanceof DockTab) {
if (... |
676a5185-80b2-4571-98a7-6b1b6348118d | 4 | public String toString(){
String res=" 0 1 2 3 4 5 6 7\n ---------------------------------\n";
for(int row=0; row<8;row++){
res += row+" |";
for(int column=0; column<8; column++){
if ((column+row)%2==1)
res+=" |";
else{
if(board[row][column]==null)
res+=" _ |";
... |
f4bb1ce0-4214-4494-921a-f2e18da1997e | 9 | public File fetch() throws Exception
{
logger.info("------------ Export Data from ProdNav ----------");
logger.info("This could take few minutes.");
File topTempDir = FileSystem.createTempDirectory("download-",
this.m_WorkingDir);
HtmlSubmitInput button;
Htm... |
f72e9e1c-c66b-4de9-ac86-1bcc480e0ad7 | 0 | public static byte[] encryptByPrivateKey(byte[] data, String key)
throws Exception {
// 对密钥解密
byte[] keyBytes = SecurityCoder.base64Decoder(key);
// 取得私钥
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key privateKey = ... |
ad6470d0-9ed9-4ff5-9dc7-489cfa348142 | 5 | public void respawn() {
int rndVertical = rnd.nextInt(bHeight-2)+1;
int rndHorizontal = rnd.nextInt(bWidth-2)+1;
if (direction == Direction.LEFT)
setLocation(bWidth-1, rndVertical);
else if (direction == Direction.RIGHT)
setLocation(0, rndVertical);
else if (direction == Direction.UP)
setLocation(rn... |
f55a7273-9153-470c-ae86-db205ffc2ded | 9 | public static ParserResultExaminer getExaminerByParserResult(
ParserResult result) {
String opertionName = result.getOperationName().toLowerCase();
ParserResultExaminer examiner = null;
if (opertionName.equals("select")) {
examiner = new SelectExaminer();
} else if (opertionName.equals("rollup")
|| op... |
4bea6ed2-a7f2-4fcd-932d-a6e38dc27a45 | 9 | public void physics(double scale) {
super.physics(scale);
//Figure out which direction the player is pointing, in degrees
rotation = Math.toDegrees(Math.atan((StdDraw.mouseY() - position.y)/(StdDraw.mouseX() - position.x))) - 90;
if (StdDraw.mouseX() < position.x) rotation -= 180;
rotation *= -1;
if(D... |
e610c64a-1bee-4634-9fd4-87f195df50c9 | 7 | public void promoteFile(ScriptRunner pScriptRunner, PromotionFile pPromotionFile)
throws ExPromote {
PromotionController lController = pScriptRunner.getPromotionController();
boolean lPromoteFile = lController.validateAndStartFilePromote(pPromotionFile);
if(lPromoteFile){
//Do the pro... |
995a299c-6def-4dab-a766-3c1c30a1b476 | 2 | public float[][] getM() {
float[][] res = new float[4][4];
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
res[i][j] = m[i][j];
return res;
} |
3ee0af44-8d83-4d81-abff-5993f760eb14 | 0 | public void setSleepTime(int sleepTime) {
this.sleepTime = sleepTime;
} |
5c36a23e-01e7-4d05-a208-874fa04f064c | 1 | public void tick()
{
fixOutOfBounds();
updatePerm(perm);
adjustAir();
adjustWater();
// call tick method of all molecules
for(Molecule mole : molecules)
mole.tick();
} |
c90a9a22-4c8b-4f29-9327-b1a0995d1baa | 9 | protected Object[][] getData() {
ArrayList result = new ArrayList();
for(Field field : this.model.getClass().getDeclaredFields()){
if (field.isAnnotationPresent(CRRCSimEditorField.class)){
try {
field.setAccessible(true);
result.add(fie... |
083d4de0-7b81-42f9-beb3-07ffe8ccf12f | 2 | private boolean jj_3R_22() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_5()) {
jj_scanpos = xsp;
if (jj_3_6()) return true;
}
return false;
} |
b988b4f0-e397-49f4-b259-4eeade1803fe | 8 | @Override
public boolean isVisibleAt(int posX, int posY) {
int newOriginX = originX, newOriginY=originY, newWidth=width, newHeight=height;
if(width<0 && height<0){
newOriginX = originX+width;
newOriginY = originY+height;
newWidth = width*-1;
newHeight = height*-1;
}else if(width<0){
newOriginX = o... |
595b7801-187b-4695-9769-f3ead06991b7 | 5 | @Override
void update() {
super.update();
angle = angle + ((2 * Math.PI) / ROTATION_SPEED);
if (!remove && Player.x + Player.SIZE > x && Player.x < x + SIZE && Player.y + Player.SIZE > y && Player.y < y + SIZE) {
explosionBuffer.add(new Explosion(x, y, SIZE));
explosi... |
df77a46e-c24c-491d-ab46-f33212e5626a | 8 | public int raw_seek(int pos){
if(!seekable)
return (-1); // don't dump machine if we can't seek
if(pos<0||pos>offsets[links]){
//goto seek_error;
pcm_offset=-1;
decode_clear();
return -1;
}
// clear out decoding machine state
pcm_offset=-1;
decode_clear();
// ... |
352f8914-32dd-41ad-8470-d5dcf159f6b6 | 1 | private int getNextIndicator() throws IOException {
if (this.indicator == 0) {
this.indicator = in.read();
}
return this.indicator;
} |
13ba0c81-3ed0-4b69-b5bf-ac03885b8d37 | 3 | public static float pedir_saldo_retirar(){
float retirar=0;
do{
try{
System.out.print("Saldo a retirar => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
retirar=Float.parseFloat(stdin.readLine());
if(retirar<1){
System.out.println("El saldo a retirar debe ser mayor... |
a2f028f6-747f-4e77-a6c4-4e91bb98270e | 9 | final Object loadStub(int oid, Object obj, Class cls) {
long pos = getPos(oid);
if ((pos & (dbFreeHandleFlag | dbPageObjectFlag)) != 0) {
throw new StorageError(StorageError.DELETED_OBJECT);
}
byte[] body = pool.get(pos & ~dbFlagsMask);
ClassDescriptor desc;
int typeOid = ObjectHeader.getType(body, 0);... |
ca100de7-2ba2-4496-9b06-59a6523c9147 | 0 | public boolean isEmpty() {
return stack.isEmpty();
} |
f6da82d3-6297-4f72-a90c-6beffe8c072a | 7 | public ChangePasswordPanel() {
setLayout(null);
picPanel.setSize(700, 425);
picPanel.setBounds(0, 0, 700, 425);
oldpf.setBounds(228, 124, 240, 30);
newpf1.setBounds(228, 168, 240, 30);
newpf2.setBounds(228, 212, 240, 30);
btn.setBounds(339, 256, 130, 35);
add(oldpf);
add(newpf1);
add(newpf2);
a... |
cab8175a-166d-4a25-887c-3fee4b67860c | 5 | public ArrayList<Auction> searchWinner(String username) {
try {
ArrayList<Auction> auctions = new ArrayList<Auction>();
String[] keywords = username.split(" ");
String sql = "select * from " + tableName + " WHERE ";
for (int i = 0; i < keywords.length; i++) {
if (i != 0)
sql = sql + "OR ";
sq... |
701e2c4f-0dfb-45d9-96f4-f9012466f415 | 8 | private static boolean choixAbonnement(Croakos follower) throws Exception {
follower = service.path("getUser/" + follower.getNom()).get(Croakos.class); // On met à jour l'user actuel
MultiCroakos allCroakos = getAllCroakos();
List<Croakos> listCroakos = allCroakos.liste;
int lis... |
31b744a1-cb88-4e85-97cf-44884a447199 | 9 | public void crearArchivoMsj(String username) {
// String[] nombre = usuario.split("@");
String sFichero = dir_mensajes+username+ ".xml";
File fichero = new File(sFichero);
if (!fichero.exists()) {
try {
// A partir del objeto File creamos el fichero... |
76fc4974-ded1-42a0-b9e7-cbab4a76cc47 | 7 | private void executeSSH() throws Exception {
SSHClient sshClient = null;
Session session = null;
try {
sshClient = createSSHClient();
String sandbox = scheduler.getProperties().getProperty(Configuration.SSH_SANDBOX);
session = sshClient.startSession();
Command createSandboxCommand = session.exec("... |
ce98db69-e9c0-422f-afab-c1d8530708d5 | 0 | public void estadoUTodosFuncionarios(final long cedula){
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query query = session.createQuery("update PosFuncEstado set fesEstado = 'U' where f... |
6837f3ed-6705-4d96-810f-c08948c1ed32 | 0 | private void activarDatos(){
descripFt.enable();
refFt.enable();
precioFt.enable();
combFt.enable();
} |
3af05dc4-db63-4e01-9d17-9a5f54f0bca1 | 8 | @Test
public void testRandomInitializer() {
Environment.getInstance().setUseWeightsSharedMemory(true);
NeuralNetworkImpl nn = NNFactory.mlp(new int[] { 3, 2 }, true);
NNRandomInitializer rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.1f, 0.1f), 0.5f);
rand.initialize(nn);
for (Layer l ... |
7c6eb563-ba97-4f0f-8af8-e5c19a389863 | 7 | public static boolean logIn(String username, String password, JFrame frame){
try {
System.out.println("Checking username and password with my boss...");
if(username.equals("") || username.contains(" ")){
JOptionPane.showMessageDialog(frame, "The username is invalid, please try an other one.", "Invalid Usern... |
8ab54ed8-b331-424f-b007-9166452683d5 | 1 | public Connection abrirBanco(Connection con) throws ClassNotFoundException, SQLException{
//System.out.println("jdbc:derby:"+dbPath);
try {
Properties props = new Properties();
props.put("create", "false");
props.put("user", user);
props.put("password", se... |
b4a12dd4-3108-4ae0-b33c-453a3f71ac99 | 7 | @Override
public void think(){
Random rand = new Random(System.currentTimeMillis());
if (!hasTarget){
ArrayList<AbstractMob> targetslist = Boot.getNPCList().findNearMobs(xLoc, yLoc, 6, getID());
if (targetslist != null){
AbstractMob target = findBestTarget(targetslist);
if (target != null){
ha... |
5e43af6e-dfd4-4113-8e9a-02ba3453d7d1 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
a386b1d1-7e44-4d31-940b-b2d88132bd1d | 7 | private void changeValueRandomly(Random r, int numOfValues,
int indexOfAtt,
Instance instance,
boolean useMissing) {
int currValue;
// get current value
// if value is missing set current value to nu... |
d3d4f453-0fb6-466b-8bce-d0ac12bbbcca | 6 | @EventHandler
public void EnderDragonMiningFatigue(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.getEnderDragonConfig().getDouble... |
bb75d50e-e138-4a18-9aba-944a8a694966 | 6 | public double calculateCraftPrice(){
Item coreP = null;
int woodItems=0;
int metalItems=0;
int miscItems=0;
for(int x=0; x<craftWidth; x++){
for(int y=0; y<craftHeight; y++){
//System.out.println(x + ", " + y);
if(itemGrid[x][y].getPreName().equals("Core")){
coreP = itemGrid[x][y];
}
i... |
83f28c3a-c704-4c8c-a847-92c6f450aa64 | 2 | public String getCursor() {
String cursor = null;
// api returns empty string cursor when there is no data left
if(this.cursor != null && !this.cursor.isEmpty()) {
cursor = this.cursor;
}
return cursor;
} |
2b2aadab-3cb4-48d9-b5b4-f0ea805ccbde | 7 | @Override
public String loginin(String id, String password) {
// TODO Auto-generated method stub
if (id.charAt(0) == 's') {
Member member = memberDaoImpl.getSingleMemberBaseInfo(id);
if (member != null) {
if (member.getPassword().equals(password)) {
if (!member.getStatus().equals(
MemberStatu... |
1091c950-6181-4020-9db7-f1416387e5a4 | 6 | public static Map<String, String> loadSetting(String filePath) {
loadSetting = new HashMap();
Map finalResult = new HashMap();
String filePathMD5 = MD5Utils.MD5(filePath);
if (!loadSetting.containsKey(filePathMD5)) {
String configBaseDir = "", outputDirectory = "", versionInf... |
a624b5c0-a2ec-48a3-a55e-545bde6f0da3 | 0 | private void czajowniaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_czajowniaButtonActionPerformed
// TODO add your handling code here:
EventDescriptionWindow newWindow = new EventDescriptionWindow();
EventDescriptionWindow.setEventDesription(knowledge.czajownia.getEve... |
a6a21aa0-fdf5-4758-a965-ab53911e7978 | 5 | @Test
public void testMultipleJobs() {
System.out.println("multipleJobs");
final Counter counter = new Counter();
c.setAssignmentListener(new AssignmentListener() {
@Override
public void receiveTask(Assignment task) {
try {
Object ... |
b52723ba-e2db-49e1-8253-2b2f9dc0d6d5 | 3 | public static String searchDirectory() {
try(BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
prop.load(reader);
return prop.getProperty("searchDirectory");
} catch (IOException ex) {
try {
PropHandle.reset();
... |
5138fee7-d237-4644-9b0e-ff81e9777158 | 2 | public void test_01() {
String fileName = "tests/intStats_test_01.txt";
String file = Gpr.readFile(fileName);
String lines[] = file.split("\n");
for( String line : lines ) {
String recs[] = line.split("\t");
// Get stats results
int min = (int) Gpr.parseDoubleSafe(recs[0]);
int max = (int) Gpr.par... |
90cb33ff-8708-45d0-8598-ba3a99c31447 | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 174
v_1 = limit - cursor;
// tomark, line 174
if (cursor < I_pV) {
return false;
}
cursor = I_pV;
v_2 = limit_backward;
limit_backward = cursor;
cursor = limit - v_1;
// (, line 174
// [, line ... |
af58c809-3840-4c55-8c02-ed89cfc061df | 7 | public PlotPoints( )
{
BoneRecs = new Vector();
xDim = 0.0;
yDim = 0.0;
xSize = 0;
ySize = 0;
zoom = 0.0;
detail = 0.0;
xt = 0;
yt = 0;
xt2 = 0;
yt2 = 0;
xp = 0;
yp = 0;
xmin = 961.478445;
ymin = ... |
5bc1f5f3-0f81-42b2-bc49-c6caa8f13b04 | 0 | public PageNotReadException(Exception e, String name){
super(e, name);
} |
b7488c48-86c6-4f54-a48a-28e9b949947d | 9 | @Override
public void sectionBegin(String secName, boolean inverted)
throws MustacheParserException
{
final ValueReference valueReference = findValue(secName);
final ValueSource valueSource = valueReference.valueSource;
// gather information we need to decide what to instantiate... |
c61d4095-3b45-4188-90e9-c1cf93677b39 | 7 | @Override
public JSONObject doCommand(JSONObject input) throws JSONException {
int x = -1;
int error = -1;
int id = -1;
boolean won = false;
JSONArray command = null;
JSONObject retObj = new JSONObject();
try {
id = input.getInt("ID");
command = input.getJSONArray("COMMAND");
} catch (JSONExc... |
a901b170-b98b-4dcc-9f24-ce7dfb421f16 | 2 | public static void main(String[] args) throws IOException {
// Set the thread size
int tpSize = 4;
int count = 1; //@MS
RejectedExecutionHandler executionHandler = new MyRejectedExecutionHandlerImpl();
// Start the thread pool
ThreadPoolExecutor pool = new Thread... |
b795b9cd-9d31-41fc-b46b-c9b895a51f72 | 9 | public EnvironmentState executeAction(Agent ag, Action action){
GridAgent agent = (GridAgent) ag;
// Reset collision value
agent.setCollision(false);
if (action.equals(TURN_90_RIGTH)){
this.turnHeading(agent, 1);
updatePerformanceMeasure(agent, TURN_90_RIGTH_MEASURE);
} else if(action.equals(TURN_90_... |
7b417f92-00cc-491b-b820-81531d2aa75f | 8 | private static void config(String[] args, Gui gui) {
if (args.length == 0) {
gui.setConfigLocation(null, null);
return; // no configuration
}
if (args.length != 2 || !"-conf".equals(args[0]))
printHelpThenExit();
JSONParser parser = new JSONParser();
try {
JSONObject json = (JSONObject) parser.par... |
cdb2b3b8-618f-4ad9-b53d-62424d6bf634 | 6 | private boolean filter(int a, int b) {
boolean x = a >= 0;
boolean y = b >= 0;
if(x && y) {
return a < b;
}
if(!x && y) {
return a > b;
}
if(x && !y) {
return a + b < 0;
}
... |
bf9b0aee-5d52-4cc5-b53b-12b7a30b77b7 | 6 | public void run()
{
if (DEBUG) log("Attempting to run CourseAddition command");
//course = new Course(courseName);
if (DEBUG) log("Get courses from TaskCommander and add this course to the list");
TaskCommander.getCourses().add(course);
if (taskViewToUpdate != null)
{
if (DEBUG) log("Add... |
6766f9bd-b485-4eb0-b2ec-fe0b0a2998c1 | 0 | public int roll(int damage)
{
return (int)Math.round(0.4 * damage + 0.6 * damage * Math.random());
} |
aa0d7e82-de5e-4e28-acf5-cc117799f00b | 4 | public static UnsafeAllocator create() {
// try JVM
// public class Unsafe {
// public Object allocateInstance(Class<?> type);
// }
try {
Class<?> unsafeClass = Class.forName("sun.misc.Unsafe");
Field f = unsafeClass.getDeclaredField("theUnsafe");
f.setAccessible(true);
fin... |
32f924e3-c53c-430a-832c-f96560855d93 | 5 | public static String getNextId(String tablename){
int id=0;
String newId=null,role=null;
try{
con=DBConnection.getConnection();
Statement stmt=con.createStatement();
//generate unique id
System.out.println("New Id technique implemented");
ResultSet rs=stmt.executeQuery("select max("+tablename+"id) ... |
d68865b8-070d-4aba-955e-7cd5750e3741 | 2 | private boolean isFileRequest(String path)
{
return path.endsWith(".png") || path.endsWith(".ico") || path.endsWith(".jpg");
} |
d3129441-29a5-44f0-a251-2b5ae6983541 | 3 | @Override
public void deserialize(Buffer buf) {
houseId = buf.readShort();
if (houseId < 0)
throw new RuntimeException("Forbidden value on houseId = " + houseId + ", it doesn't respect the following condition : houseId < 0");
guildInfo = new GuildInformations();
guildInfo... |
c09af49e-96cc-43eb-8e05-975e340b97d3 | 0 | @Override
public void setID(String iD) {
super.setID(iD);
} |
e7e00433-02d1-4263-af89-ab9653b5d167 | 6 | private JSONObject getResponseJson(String last, Map<String, String> previousIdps, boolean setLast, boolean setPrev) {
JSONObject json = new JSONObject();
if (setLast) {
try {
json.accumulate("lastIdP", last);
} catch (JSONException ex) {
LOG.log(Le... |
685790d2-7727-4e27-af7d-e8a3df2f485d | 1 | private void assertLengthField(ConcreteMessage msg, int... expected) {
byte[] bytes = msg.toBytes();
assertEquals("Length header has wrong size", expected.length, bytes.length - 1);
for(int i = 0; i < expected.length; i++) {
byte exp = (byte) expected[i];
assertEquals("Mismatch in length field on index " + ... |
53bc8edb-a2a5-4d5b-8a96-1a9aa7084413 | 7 | public int getNumberOfPlayers(){
if(playerIds.isEmpty())
{
for(int i : sentinel)
{
if(i != 0)
{
playerIds.add(i);
}
}
for(int i : scourge)
{
if(i != 0)
... |
69b4c1c3-97a4-436c-b913-9da80c640d74 | 7 | public static void main(String[] args) {
//Setting up game stuff
FieldDescriptorsFactory fdf = args.length != 0 && args[0] == "sq" ?
new SquareFieldDescriptorsFactory() :
new HexFieldDescriptorsFactory();
Field.init(15, 15, fdf);
Field.getInstance... |
1e91fe60-4341-4c74-baf2-e7c3c7065df3 | 4 | public Recipe(String name, int time, int calories, String source, List<RecipeSection> sections, int portions){
if(name == null){
this.name = "";
} else {
this.name = name;
}
this.time = time;
this.calories = calories;
if(source == null){
this.source = "";
} else {
this.source = source;
}
... |
4f9635d6-1f17-4b77-a83d-53b47f60f7e0 | 7 | @Override
public void actionPerformed(ActionEvent e) {
int buttonSelected = Integer.parseInt(((JButton) e.getSource()).getName());
switch (buttonSelected) {
case 1:
isCorrect = bool1;
break;
case 2:
isCorrect = bool2;
... |
2787a41a-02e7-43fd-81e9-1b87930ee2e9 | 5 | public static String tileToString(byte t) {
switch (t) {
case WATER:
return "Water";
case GRASS:
return "Grass";
case SNOW:
return "Snow";
case SAVANNAH:
return "Savannah";
case SAND_DESERT:
return "Sand_Desert";
default:
return "Grass";
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.