method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b1f790d3-e395-47c8-b6e3-13c634b367dc | 3 | public void saveCustomConfig()
{
// Return if the configs are null.
if (config == null || trueFile == null)
{
plugin.getLogger().log(Level.SEVERE, "Could not save config to " + trueFile + " due to nulls.");
return;
}
// Attempt to save the files.
try
{
config.save(trueFile);
} catch (IOExce... |
1ca369a4-5100-46bd-8f67-59f6bd0314e3 | 4 | public void move(int enemyx, int enemyy){
if(getxCoord() < enemyx+30){
setxCoord(getxCoord() + speed);
}
if(getxCoord() > enemyx+30){
setxCoord(getxCoord() - speed);
}
if(getyCoord() < enemyy+80){
setyCoord(getyCoord() + speed);
}
... |
492aaaea-8895-4e60-8d9b-16d68c8bd4a9 | 6 | public static void createItemAll(int itemID, int itemX, int itemY, int itemAmount, int itemController) {
for (Player p : server.playerHandler.players){
if(p != null) {
client person = (client)p;
if((person.playerName != null || person.playerName != "null") && !(person.playerId == itemController)) {
... |
678aa5eb-06e9-40bf-a5fa-a03fd879336f | 8 | public int find_split(Context cx, Scriptable scope, String target,
String separator, Scriptable reObj,
int[] ip, int[] matchlen,
boolean[] matched, String[][] parensp)
{
int i = ip[0];
int length = target.length();
... |
a16a822b-7dc8-4d0c-abae-afffcf8e9248 | 5 | public void editMakler() {
//Menü zum selektieren des Maklers
Menu maklerSelectionMenu = new MaklerSelectionMenu("Makler editieren", service.getAllMakler());
int id = maklerSelectionMenu.show();
//Falls nicht "zurück" gewählt, Makler bearbeiten
if(id != MaklerSelectionMenu.BACK) {
//Makler laden
Makl... |
0f7da36b-5e51-42f1-89c4-9369131bf7f2 | 0 | @Override
public String getColumnName(int column) {
return colNames[column];
} |
cbc19429-bb44-417e-ae3a-0f2611c526c3 | 1 | @Override
public int getAttributeCount() {
if (attributes != null) {
return attributes.size();
}
return 0;
} |
750adf32-bb8d-4a83-943f-12f6b0b66fdb | 0 | public void setDireccion(String direccion) {
this.direccion = direccion;
} |
c7e953eb-87ee-493c-9319-14d49c424000 | 9 | protected ArrayList<Placement> densityMapping(Field[][] map, int c) {
shootDensity.clear();
for (int y = 0; y < map.length; ++y) {
for (int x = 0; x < map[y].length - shipValue + 1; ++x) {
int tmp = 0;
for (int z = 0; z < shipValue; ++z) {
... |
5734d10a-5370-4003-97f8-9f7c1d101980 | 7 | public static CalendarHMS jauD2dtf(final String scale, int ndp, double d1, double d2 ) throws JSOFAIllegalParameter, JSOFAInternalError
{
boolean leap;
int iy1, im1, id1, iy2, im2, id2, ihmsf1[] = new int[4];
double a1, b1, fd, dat0, dat12, dat24, dleap;
/* The two-part JD. */
a1 = d1;
b1 = d2;
/* Provisional c... |
4196be7c-2ee2-4861-978c-767c8a05ac05 | 5 | public boolean metodoCompare(Pessoa u ){
if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome())
&& this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha())
&&(this.id.equals(getId()))){
return true;
}
return false;
} |
c6a09156-614d-4829-b89b-2d143022987e | 9 | @Override
public void clearSky()
{
if(!skyedYet)
return;
final Room skyGridRoom=rawDoors()[Directions.UP];
if(skyGridRoom!=null)
{
if(((skyGridRoom.roomID()==null)||(skyGridRoom.roomID().length()==0))
&&((skyGridRoom instanceof EndlessSky)||(skyGridRoom instanceof EndlessThinSky)))
{
((GridLo... |
923fd49f-09ea-457a-a06d-0dd27fb2ec26 | 1 | public boolean addClient(String x)
{
try {
LoadBalancer.registerNewClient(x);
} catch (IOException e) {
System.err.println("Had an error connecting to " + x.split("::")[0] + ": " + e.getMessage());
System.err.println("Will continue to try to connect...");
LolDataServer.log.warning("Had an error connect... |
04b6db3a-0b87-4b8c-bb5c-fb2c2252eb74 | 0 | @AfterClass
public static void tearDownClass() {
} |
2db40925-afa0-4384-8920-3133cf213d6d | 8 | static final public void ClassExtendsDeclaration() throws ParseException {
jj_consume_token(CLASS);
Identifier();
jj_consume_token(EXTENDS);
Identifier();
jj_consume_token(LBRACE);
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
case INTEGER:
... |
7fd31461-7e68-4cfe-9c5e-b34c2bd08610 | 9 | protected void guessDeviceType(UserAgentInfo uaInfo) {
if (compiledDeviceRegMap == null || deviceMap == null) {
return;
}
String type = uaInfo.getType();
if (type == null || type.isEmpty()) {
return;
}
if (type.equals("Other") || type.equals("Lib... |
3a57d57d-01b5-4306-90da-14d401ca0390 | 5 | public static boolean isPermutation(String s1, String s2){
/*Firstly, compare their length*/
if(s1.length()!=s2.length())
return false;
/*Then use bitmap to do the counting
* Assume char has a range of 0 to 255*/
int map[] =new int[256];
int length=s1.length();
for(int i=0;i<lengt... |
26bcc389-3dc8-4686-9865-cf7d7887d45d | 1 | public void twoBodyCollision(Entity e1, Entity e2){
double m1 = e1.mass;
double m2 = e2.mass;
double v1x = e1.vx;
double v1y = e1.vy;
double v2x = e2.vx;
double v2y = e2.vy;
double x1 = e1.x;
double y1 = e1.y;
double x2 = e2.x;
double y2 = e2.y;
double size1 = e1.size;
double size2 = e2.size;
... |
13ef440b-7e3c-43ba-9ff0-07785fdfe6f7 | 9 | @Override
public boolean isValid(Location from, Location to) {
int fromCount = game.getCount(from);
int toCount = game.getCount(to);
Color fromColor = game.getColor(from);
Color toColor = game.getColor(to);
Color playerInTurn = game.getPlayerInTurn();
if(from == to){
return false;
}
if ( ... |
04995442-253a-496d-9419-082f74fa3586 | 8 | public static void renderEntities(Graphics g, Global global){
Verse currentVerse = global.getCurrent().getCurrentVerse();
for (int i=0; i<currentVerse.getVerseEntities().size(); i++){
Entity ent = currentVerse.getVerseEntities().get(i);
if (ent!=null){
if (ent.getEntityImg()!=null){
if (ent.getEntity... |
61008cc8-4055-4d9d-82c9-163f41928f77 | 7 | public Archive findStartMatchArchive( String consolFun, long startTime, long resolution ) throws IOException
{
long arcStep, diff;
int fallBackIndex = 0;
int arcIndex = -1;
long minDiff = Long.MAX_VALUE;
long fallBackDiff = Long.MAX_VALUE;
for ( int i = 0; i < archives.length; i++ )
{
if ( archive... |
f89b46f8-3523-4ab8-9c35-b99ab10da2ba | 9 | void createHMlut(int [] kernel, int [] lut){
int i, j, match, toMatch;
for(i=0;i<512;i++)
lut[i]=1;
toMatch=0;
for(j=0;j<9;j++){
if (kernel[j]!=2)
toMatch++;
}
//System.out.println("Debug: to match: "+toMatch);
//make lut
for(i=0;i<512;i++){
match=0;
for(j=0;j<9;j++){
if (kernel[j]... |
08da16d7-c76f-4b68-8c4a-fa9c07e1f277 | 5 | public static void main(String[] args) {
Reader in = new Reader();
int i,dg[],n;
int tc = in.nextInt();
while (0 < tc--) {
n = in.nextInt();
in.restStringLine();
ArrayList<Integer> list = new ArrayList<Integer>();
for (int j ... |
666f493e-9671-455f-947c-ef08764511ac | 6 | public void updateFiles ()
{ if (FD!=null) return;
File dir=new File(DirField.getText());
if (!dir.isDirectory()) return;
CurrentDir=DirField.getText();
if (PatternField.getText().equals("")) PatternField.setText("*");
try
{ Files.clear();
Dirs.clear();
FileList l=new FileList(DirField.getText(),
... |
9c91f79e-c032-4e07-9e86-0073450215a3 | 3 | public State getMovingDirectionState(Point destination) {
Point position = new Point(super.getIntX(), super.getIntY());
if(Point.insideAngle(Point.DOWN_LEFT, Point.DOWN_RIGHT, position, destination)) { // Move up
return State.MOVE_UP;
} else if(Point.insideAngle(Point.DOWN_RIGHT, Point.UP_RIGHT, position, dest... |
21e56732-a0ee-4d05-96e1-01d529dd4d83 | 3 | public DataSource assemble(ServletConfig config) throws ServletException
{
String dataSourceName = "jdbc/blabber";
DataSource dataSource = null;
System.out.println("Data Source Parameter " + dataSourceName);
Context envContext = null;
try
{
Context context = new InitialContext();
System.out.... |
8823b662-ecdc-404f-a567-63613d60a145 | 9 | @Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (claimNumber != null ? claimNumber.hashCode() : 0);
result = 31 * result + (claimantFirstName != null ? claimantFirstName.hashCode() : 0);
result = 31 * result + (claimantLastName !=... |
043a4342-4cbd-43dd-8aa0-85bb96ca8634 | 1 | public String getOrgaEinheitBezeichnung(){
OrgaEinheit orgaEinheit = dbZugriff.getOrgaEinheitZuidOrgaEinheit(this.idOrgaEinheit);
if(orgaEinheit!=null)return orgaEinheit.getOrgaEinheitBez();
else return "Keine Organisationseinheit";
} |
98b28d46-8ce6-43c6-84d2-edee2f8736da | 5 | public static Personne authenticate(String username, String password) {
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "margo", "margo");
if (con == null)... |
423b1698-0dae-472f-968f-fcfce490b147 | 2 | public static ArrayList<String> merge(String[] a, String[] b) {
ArrayList<String> sentence = new ArrayList<String>();
for (String s: a) sentence.add(s);
for (String s: b) sentence.add(s);
return sentence;
} |
6e4f23af-66eb-402a-a96f-bc183e19c893 | 2 | public void draw(Graphics graphics)
{
int y = 1000 / 3;
int i = 1;
graphics.drawImage(sprite.getImage(image), 0, 0, null);
for (String menuItem : menuItems)
{
if (i == selectedItem)
{
graphics.setColor(Color.red);
graphi... |
f188ae5b-b515-4681-9b42-f8cf0bf6a541 | 5 | private void updateLists(double x) {
if (n == 1) {
X[1] = x;
} else if (n > 1 && n <= maxlag) {
for (int j = 1; j <= n-1; j++) {
W[j] = W[j] + ((double)(n - 1) / n) * (x - x_bar) * (X[n-j] - x_bar);
}
X[n] = x;
} el... |
27206c21-e3b2-4efe-b3be-47feb192b043 | 2 | void compareCdfUp(double p, int k, int n, double result) {
double prob = Binomial.get().cdfUp(p, k, n);
double abs = Math.abs(prob - result);
double diff = abs / Math.min(prob, result);
if ((abs > 1E-300) && (diff > 0.00000000001)) throw new RuntimeException("Relative difference:" + diff + "\t\t" + prob + " !=... |
c9a500c5-d23f-4b7f-9d5f-c62c9c158add | 2 | public MenuItem getLlItemItem() {
if (llItem == null) {
llItem = new MenuItem("Show Lekkerland Menu");
llItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
new ReceiptListPanel();
} catch (Exception ex) {
ex.printStackTrace();
}
... |
8f2a309d-77ce-450e-b232-8febbcba268f | 0 | public static int tilesToPixels(int numTiles) {
// no real reason to use shifting here.
// it's slighty faster, but doesn't add up to much
// on modern processors.
return numTiles << TILE_SIZE_BITS;
// use this if the tile size isn't a power of 2:
//return numTiles * TIL... |
d24b84fc-55b9-4b14-a2ae-94698ae9a6e2 | 3 | String EncodeCurrentStatus()
{
String code = "";
for(int i = 0; i < sudokuSize; i++)
{
for(int k = 0; k < sudokuSize; k++)
{
if(cells[i][k].valueState != waitingValue)
code += i + "," + k + "," + cells[i][k].current + "," + cells[i][k].valueState + "," + instantiator[i][k] + "&";
}
}
ret... |
438ecf07-1de8-4d3c-933e-e36283cddcc6 | 5 | public void persistir() {
FileOutputStream fos = null;
ObjectOutputStream stream = null;
try {
fos = new FileOutputStream("arquivo.bin");
stream = new ObjectOutputStream(fos);
stream.writeObject(persistencia);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fos != null) {
tr... |
16e66891-dae2-42ce-9c33-6dff50b27d06 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SequenceImpl<?> other = (SequenceImpl<?>)obj;
if (size != other.size)
ret... |
0d1a6891-a6e7-4c7d-9270-ddeb40bbf303 | 6 | public static void ledprocess(String filepath, String result, String sn){
String finalresult = "";
int errorcode=0;// print error code in the final output file;
int errornum = 8;
File outputfile = new File(filepath);
if ((result.equals("P"))||(result.equals("p"))||(result.equals("pass"))||(result.equals("PASS")... |
4360d71a-4f4b-42a4-98a4-7aa403fdddbe | 5 | private void calculateBestFitLine() {
int count = timestamps.length, validCount = 0;
double ts = 0.0, vs = 0.0;
for(int i = 0; i < count; i++) {
if(!Double.isNaN(values[i])) {
ts += timestamps[i];
vs += values[i];
validCount++;
}
}
if(validCount <= 1) {
// just one not-NaN point
b0 = b... |
a44fd661-1eac-4d7f-83b5-64d5651b8b03 | 7 | public void loadConfig() {
configYaml = new YamlConfiguration();
try {
configYaml.load(configFile);
} catch (Exception e) {
e.printStackTrace();
}
if (configYaml.getString("config-version") != plugin.getDescription().getVersion())
{
if (configYaml.getString("config-version") =... |
1d5925d2-fddf-4187-9914-00d13e9cabe5 | 9 | private Object handleSubm(Object tos, String id, String ref) {
if (tos instanceof Header && ref != null && ((Header)tos).getSubmitterRef() == null) {
((Header)tos).setSubmitterRef(ref);
return new Object(); // placeholder
}
else if (tos instanceof Header && ref == null && ((Header)to... |
d20a2476-2fa8-4e12-87e4-acaf4424bbc5 | 9 | public void portalEffect(Player p){
int n = -1;
int lb = 0;
int ub = 3;
String head;
String textBlock;
ArrayList<String> strList = new ArrayList<String>();
head = "Outworld Portal";
strList.add("0: Decline");
if((p.inventory.contains(Card.gauntlet) || p.inventory.contains(Card.gauntletii)) && !spectra... |
3639a786-2993-46ce-8021-3edf829fd978 | 8 | private eIDTokenLoadingWindow(final String providerName, final BiConsumer<PbxUser, CertificateData> consumer) {
super("Validating your Citizen Card - Protbox");
this.setIconImage(Constants.getAsset("box.png"));
this.setLayout(null);
info = new JLabel();
setInfoWithLooking();
... |
59c228ba-82d8-41df-b4c2-a772bcb7cc1e | 0 | public void setWeight(String weight) {
this.weight = weight;
setDirty();
} |
a81bb9ef-6cb6-45dd-b8c2-a25fca2e8f14 | 6 | public static ServerType getServerType(byte t) {
switch (t) {
case 'D':
case 'd':
return DEDICATED;
case 'L':
case 'l':
return NON_DEDICATED;
case 'P':
case 'p':
return TELEVISION;
default:
throw new IllegalArgumentException();
}
} |
41958d36-c515-41da-950a-7f0a6726fbd4 | 4 | public void createAccount(String strAccountName, String strUserName,
Boolean autoPassword, int autoPassLen, Boolean autoPassAllSpecials,
String autoPassSpecials, String strPassword, Boolean seperatorTab,
FkActionEventListener delegate) {
StringBuilder sb = new StringBuilder(256);
sb.append... |
087bdb44-832d-4b19-bc38-a2441365b893 | 0 | public String getIsNull() {
return isNull;
} |
b087240e-9b9b-4f96-ac9b-40025daffb0d | 1 | public AnalysisData createAnalysisData() {
final AnalysisData analysisData = new AnalysisData();
analysisData.name = getName();
analysisData.duration = getDuration();
analysisData.properties = getProperties();
final List<String> callNames = getCallNames();
analysisData.rows = new AnalysisData.Row[callNam... |
cf9970d9-b690-4fc4-87be-5170ae0c1483 | 8 | private void setAnchorPointForRectangularShape(byte i, float x, float y, float w, float h) {
switch (i) {
case RectangleComponent.UPPER_LEFT:
anchorPoint.setLocation(x + w, y + h);
break;
case RectangleComponent.UPPER_RIGHT:
anchorPoint.setLocation(x, y + h);
break;
case RectangleComponent.LOWER_RIG... |
0730fea4-f1d8-4a63-ac57-6d73d7aa9565 | 6 | public void readFile() throws FileNotFoundException {
if (fileName != null) {
File file = new File(fileName);
Scanner scanner;
try {
scanner = new Scanner(file);
String line;
if (scanner.hasNextLine()) {
scanner.nextLine();
}
String currClass = "";
while (scanner.hasNextLine()) {... |
ac149a76-bde4-4188-b547-b98c7a8e5ce8 | 8 | @Override
public String execute() throws Exception {
User user = this.service.getCurrentUser();
if (user == null)
return SUCCESS;
List<Map<String, Object>> notifications = this.service.checkNotification(user.getUid());
if (notifications == null)
return SUCCESS;
StringBuilder sb = new StringBuilde... |
8bf82447-cd35-485d-b4ac-06d2277809a2 | 6 | public String saveXML(boolean withDialog) {
String fileName = "";
FileWriter fstream = null;
File tempFile = null;
if (withDialog == true) {
fileName = getSavedFileName();
if (fileName == null) {
return null;
}
try {
fstream = new FileWriter(fileName);
} catch (IOException e1) {
Er... |
877f8777-61c6-4f9d-a073-8681bba3899b | 3 | private boolean move(int nX, int nY)
{
//Check if valid
if (!isValidPosition(nX, nY))
{
return false;
}
pX = nX;
pY = nY;
setVisited(pX, pY);
if(hasWumpus(pX,pY))
{
score -= 1000;
g... |
ff4b2f0a-25c4-4199-9afe-89eeb4cc99c0 | 5 | public String try_user_name() throws Exception {
System.out.println("userName is " + userName);
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
if (userName.length() > 20)
return "overflow";
if (userName.length() < 7)
return "usernameShort";
try {
Class.forName("com.mysql.jdbc... |
30313d9b-1dbb-492e-9a32-91f6b2bed348 | 2 | HashMap<Variant, String> readEnsemblFile(String fileName) {
String lines[] = Gpr.readFile(fileName).split("\n");
if (lines.length <= 0) throw new RuntimeException("Cannot open file '" + fileName + "' (or it's empty).");
HashMap<Variant, String> seqChanges = new HashMap<Variant, String>();
for (String line : ... |
215cd94f-8d49-4ac6-9617-afef55534b8f | 6 | public static Double calculateAndSomething(ArrayList<String> container)
{
double answer = 0;
ArrayList<Double> values = new ArrayList<Double>();
for (int i = 0; i < container.size(); i++) {
values.add(Double.valueOf(container.get(i)));
}
answer = values.get(0);
System.out.println(answer);
Random ge... |
01ca2253-2cc2-45a0-80bc-51a76a6b4748 | 2 | public void add( Double addVal ) {
//Add value as last node, to maintain balance, completeness of tree
_heap.add( addVal );
_size++;
int addValPos = _heap.size() - 1;
int parentPos;
while( addValPos > 0 ) { //potentially swap until reach root
//pinpoint parent
parentPos = (addValPos-1) / 2;
i... |
917c1f65-8ce5-4d09-97c8-be934f1abeae | 1 | public void setIndent(boolean bIndent) {
this.bIndent = bIndent;
newLine = bIndent ? "\n" : "";
} |
09ebe172-4c51-4c89-8e77-e6a9f00ac458 | 2 | public static void main(String... args) throws InterruptedException {
GWCAConnection gwcaConnection = null;
try {
LOG.info("Executing \"Java GWCAConstants\" (version {})", Version.getVersion());
//TODO: Fill in the PID here
gwcaConnection = new NamedPipeGWCAConnecti... |
5d85e592-be8e-4e0c-9026-f57fbc95b779 | 1 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new FileReader(args[0]));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append('\n');
line = br.readLine()... |
adc056f7-5408-4f84-8622-46117f80b48e | 0 | public AppTest( String testName )
{
super( testName );
} |
b9dd6f57-1dcf-4bad-bdad-adf874eabb19 | 5 | @Override
protected byte[] generatePayload() throws MQTTException, IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
if (topicFilters.length <= 0 || QoSs.length <= 0)
throw new MQTTException(
"The SUBSCRIBE message must contain at least one topic... |
b1c5c5e1-37dc-4824-bb49-cf728d223226 | 4 | public HookingJar(String folderNameIn, String fileNameIn){
folderName = folderNameIn;
fileName = fileNameIn;
if (debug) {
filePath = ROOT_FOLDER + "\\" + folderName + "\\Testing\\" + fileName + ".jar";
} else {
filePath = ROOT_FOLDER + "\\" + folderName + "\\" +... |
a42c5e38-94d9-48d5-b954-24d3ec2d4510 | 3 | public JButton getDialogButton(String buttonName){
if(buttonName.equals("ok")){
return okButton;
}
else if(buttonName.equals("cancel")){
return cancelButton;
}
else if(buttonName.equals("close")){
return closeButton;
}
return nu... |
65ad1683-8732-4105-92c4-608c6fe3f2bd | 7 | public static boolean isData(String[] ccCode){
String[] tCodes = ccCode;
int tblestart = 0;
int tbleend = 0;
Boolean b=false;
Connection con = DBase.dbConnection();
PreparedStatement pst;
try{
String query = "Select Count(CountryCode) FROM AED";
... |
52b47c01-c3b2-4969-8ee6-515d2387b5d0 | 3 | public Error getError() {
if(isOk())
return error;
try {
JAXBContext context = JAXBContext.newInstance(Error.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
StringReader xml = new StringReader(content);
if(!content.isEmpty())
error = (Error)unmarshaller.unmarshal(new Stre... |
5b5620e2-d08f-4293-b7f7-e3681f818692 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
06975582-4fa9-498c-b126-73fa8678ee47 | 4 | @Override
public boolean ausfuehren(ServerKontext kontext, Spieler spieler,
Befehlszeile befehlszeile)
{
Raum aktuellerRaum = kontext.getAktuellenRaumZu(spieler);
Item kuchen = aktuellerRaum.getNaechstesItem();
int energie = spieler.getLebensEnergie();
if(kuchen.isKuchen())
{
energie += SpielKonstant... |
c784c9d9-fefe-41a6-9428-930952a3653b | 6 | public BooleanOperator getIntegerToBooleanOperator(String string) {
char[] chars = string.toCharArray();
for(char c : chars) {
if(c == '<') return BooleanOperator.LESS_THAN;
else if(c == '>') return BooleanOperator.MORE_THAN;
else if(c == '=') return BooleanOperator.... |
95f551a2-35fe-4780-9ca5-a0f13e945576 | 7 | public static void main(String[] args) {
if (args.length == 0) {
usage();
return;
}
if (args.length > 2) {
reportError("too many command-line arguments");
usage();
System.exit(1);
}
try {
Reader input;
... |
49706b65-a84c-4b50-b9db-ce900c18df4f | 4 | public static String getCookieValue(HttpServletRequest request,String cookieName) {
Assert.notNull(request);
Assert.hasText(cookieName);
Cookie[] cookies = request.getCookies();
if (cookies != null && cookies.length >0) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals(cookieName)) {
ret... |
70dfadd1-51db-4466-b733-23af9560aed0 | 6 | static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... |
42a2013f-702c-42d4-b5aa-e1927c9c8edd | 1 | public void setId(int id) throws ParkingException {
if (id < 0) {
throw new ParkingException("Parking id is under zero");
}
this.id = id;
} |
dfc8752e-56ed-4b77-aae6-d41f455f3c57 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
* to str... |
410308fc-7620-4d5f-9371-ab30ad871feb | 6 | private String findSepLineInFile() {
String[] lines = new String[0];
try {
lines = FileHelper.readFileAsUtf8StringArray( selectedFile );
}
catch( final Exception e ) {
return DEFAULT_SEPARATOR_LINE;
}
Arrays.sort( lines );
String candidate = DEFAULT_SEPARATOR_LINE;
int candidateCount =... |
49d5cec8-f86a-47c8-a75e-f483bdc820c4 | 6 | public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getActionCommand().equals("Cut")) {
if (tf != null) {
tf.cut();
} else {
ta.cut();
}
}
if (actionEvent.getActionCommand().equals("Copy")) {
if (t... |
c5a2d2fa-9cd8-492c-9491-ce1b5cfdff67 | 6 | @SuppressWarnings({ "rawtypes", "unchecked" })
/*
* This creates a request message from the omnilink.jar library.
* This function needs to be cleaned up.
*/
public RequestMessage createRequestMessage(Map o) {
Class commandClass = commandMap.get(o.get("command"));
try {
... |
7fa3b5d3-baed-4291-a2d9-3313615843c8 | 9 | boolean removeIfExists(Key key, T obj) {
Object s = index.get(key);
if (s instanceof Relation) {
Relation rel = (Relation)s;
Storage storage = getStorage();
int oid = storage.getOid(obj);
int l = 0, n = rel.size(), r = n;
while (l < r) {
... |
430b3cc1-76a5-47a5-8b08-51f3d7dab272 | 1 | public static void main(String[] args)
{
String a="";
String palabra=JOptionPane.showInputDialog(null,"Ingrese uns frase : ");
String []frase=palabra.split(" ");
for(int i=frase.length-1;i>=0;i--)
{
a=a+frase[i]+" ";
}
JOptionPane.showM... |
3c5c7a7d-955c-4916-af7b-389822f8b4e5 | 0 | public void actionPerformed(ActionEvent arg0) {
Component apane = environment.tabbed.getSelectedComponent();
JComponent c=(JComponent)environment.getActive();
SaveGraphUtility.saveGraph(apane, c,"PNG files", "png");
} |
7880babd-fa60-4eae-bb1b-a094c28d7ae9 | 7 | public static void DoBullyBotTurn(PlanetWars pw) {
Planet source = null;
double sourceScore = Double.MIN_VALUE;
//Select my strongest planet to send ships from
for (Planet myPlanet : pw.MyPlanets()) {
if (myPlanet.NumShips() <= 1)
continue;
double score = (double) myPlanet.NumShips();
if (score > s... |
f8affff6-8584-4874-bbc3-ce207ca9b7f2 | 1 | public static void main(String... args) {
final SimpleFetcher simpleFetcher = new SimpleFetcher();
new Thread(new Runnable() {
@Override
public void run() {
simpleFetcher.fetch(new TestCallBack());
}
}).start();
logger.info("do somethin... |
525f0b36-6e9e-4560-a2c2-13565a75d861 | 1 | public void registerEntityType(EntityType type) {
log(Level.INFO, "Registering entity type %d", type.id);
entityTypes.put(type.id, type);
type.init(this);
if (type.spawner != null) {
registerEntityType(type.spawner);
}
} |
da608ef1-0d8e-4b6f-aa48-e2a50781d35a | 6 | public static void kickPlayer(Player player, String playerName,
String kickPlayerName, String reason) {
ArrayList<Player> kickPlayers = AdminEyeUtils
.requestPlayers(kickPlayerName);
if (kickPlayers == null && kickPlayerName != null) {
StefsAPI.MessageHandler.buildMessage().addSender(playerName)
.se... |
30620372-8bcb-4da4-ae50-39045cdc88ed | 2 | public void drawRange(Graphics g, boolean nearTrack){
if (focused){
//Turret Range
g.setColor(new Color(0, 0, 0, 120));
g.fillOval(locX-(range/2), locY-(range/2), range+size, range+size);
if (nearTrack){
g.setColor(new Color(6, 65, 105, 120));
}
else{
g.setColor(new Color(178, 34, 34, 120));... |
23f24284-f1a4-4769-8941-e4c15495b245 | 5 | protected static Point getLowestPoint(Point[] points) {
if (points.length < 1) {
return null;
}
Point lowest = points[0];
for (Point temp : points) {
if(temp.y < lowest.y || (temp.y == lowest.y && temp.x < lowest.x)) {
lowest = temp;
}
... |
78e4b0b6-c96b-4342-b536-9a5d60cd2b17 | 1 | protected void readScaleFactorSelection()
{
for (int i = 0; i < num_subbands; ++i)
((SubbandLayer2)subbands[i]).read_scalefactor_selection(stream, crc);
} |
b59c52f9-833e-4393-a2d1-690d202fe095 | 0 | public Date getCheckinDate() {
return checkinDate;
} |
86e17d89-4db9-4b41-bc08-62e0cffcd47c | 4 | public static void removeFine(int fineId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStateme... |
cddfbc38-8559-4c17-ab74-dfb5fe65f78f | 1 | public static BufferedImage loadImage(String s){
BufferedImage image = null;
try {
image = ImageIO.read(Images.class.getClass().getResourceAsStream(s));
} catch (IOException e) {
e.printStackTrace();
System.out.println("Failed to load " + s + ". Shutting down system.");
System.exit(0);
}
return ... |
8577553b-459a-4a3e-b040-392bd94ade2e | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
Raster source = sources[0];
Rectangle srcRect = source.getBounds();
int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);
MediaLibAccess... |
5dec03e4-44b5-4684-9af1-81500bc86c1b | 8 | public static void drawBoard(){
String[][] result = new String[8][8];
//make the tiles white or black
boolean white = true;
for (int i = 0; i < 8; i++){
for (int j = 0; j < 8; j++){
if (white){
result[i][j] = " |";
white = false;
}else{
result[i][j] = "##|";
white = true;
... |
2a495713-a23d-458c-a77f-69352f5be3cf | 4 | public static String sendGet(String url) {
String result = "";
BufferedReader in = null;
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection connection = realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("a... |
07b009c2-c7e7-47be-abb9-014fe80556c1 | 2 | protected DisplayPiece rotatePiece()
{
DisplayPiece piece = null;
Point[] temp = new Point[body.length];
//switch x,y y,x
for (int i = 0; i < body.length; i++)
{
temp[i] = new Point();
temp[i].x = body[i].y;
temp[i].y = body[i].x; ... |
d3b68788-ff19-4395-b802-56ee474913bb | 3 | private boolean endRequest(Request request) {
if (!this.requestTransactionLiving(request))
return false;
transactionEntity tempT = this.transInfo.get(request.transaction);
for (Site site : tempT.visitedSites) {
if (!site.isRunning())
continue;
... |
7c128c28-a5c8-4787-af2b-5ddaf8ad48c3 | 8 | public boolean collidesEntity(int x, int y) {
for (Entity e: entites) {
if ((e != (Entity)p) && (e.getPos_x() == x) && (e.getPos_y() == y) && (!e.isPushable())) {
p.setHealth(p.getHealth()-e.getAttack());
e.setHealth(e.getHealth()-p.getAttack());
System.out.println("ATK, ENEMY HP " + e.getHealth());
... |
14fdb5fb-006f-45ba-920e-c308892285f1 | 8 | public List<String> allUsers() {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
List<String> users = new ArrayList<String>();
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(ALL_USERS_STMT);
rs = stmt.executeQuery();
while (rs.next()) {
u... |
8f2de1ce-7d6c-48f8-bd74-7cd2cec00bb0 | 1 | @Override
public void remove(Component component) {
if (mList != null) {
mList.remove(component);
}
} |
fd84d592-fea5-4f85-a3df-5d1be4083190 | 7 | private static boolean compareBoolean(Node node, Argument left, Argument right)
{
if (left.isNull()) return right.isNull();
if (left.isBoolean())
{
return right.isBoolean() && left.asBoolean() == right.asBoolean();
}
if (left.isString() || left.isObject())
{
return (right.isString() || right.is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.