method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3d51c369-336e-4363-88a3-65dded7bfb3e | 8 | public void setAnswerFiledFilled(int rowNum){
int i;
for(i=1; i<7; i++){
switch (i){
case 1: areaA.setTextArea(Question.readCellContent(i+1, rowNum));
break;
case 2: areaB.setTextArea(Question.readCellContent(i+1, rowNum));
break;
case 3: areaC.setTextArea(Question.r... |
5f0237ed-6445-4fd3-b88a-215d6ba010a1 | 5 | public comet_fines() {
initComponents();
try{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/library_management", "root", "welcome6" );
java.sql.Timestamp date = new java.sql.Timestamp(new java.util.Date().g... |
ead2d7f8-b668-4582-bd77-050238e4fdc5 | 0 | private static long longRandomPrime() {
BigInteger prime = BigInteger.probablePrime(31, new Random());
return prime.longValue();
} |
26beb320-1e49-4b5b-8ea0-9b958a0c4f2b | 6 | public Response postAuction(CreateAuction createAuction) throws InvalidInputException{
Auction auction = new Auction();
int id = OurTestAuctions.size()+1;
auction.setId(id);
if(createAuction.getOwnerId() < 0 || createAuction.getName() == null)
throw new InvalidInputException();
auction.setName(createAuctio... |
e48b9301-084a-4d83-84c2-4ae5e48bd59b | 0 | public void setThirst(int thirst) {this.thirst = thirst;} |
7cec3667-ad6b-4d67-a3bb-6e77fdcb2d69 | 0 | public List<IautosSellerInfo> getSellers() {
return sellers;
} |
435ff3bf-64e6-4096-9721-1b6fc20e9b3c | 8 | static SftpATTRS getATTR(Buffer buf){
SftpATTRS attr=new SftpATTRS();
attr.flags=buf.getInt();
if((attr.flags&SSH_FILEXFER_ATTR_SIZE)!=0){ attr.size=buf.getLong(); }
if((attr.flags&SSH_FILEXFER_ATTR_UIDGID)!=0){
attr.uid=buf.getInt(); attr.gid=buf.getInt();
}
if((attr.flags&SSH_FILEXFER_A... |
fa81f483-9427-48ca-8365-4bed1aab2359 | 7 | public int getX(){
// Generates a number in range of 0 - 600
if (Settings.level == 1){
randX = randGen.nextInt((600 - 0 + 1) + 0);
}
// Generates a number in range of 0 - 590
else if(Settings.level == 2){
randX = randGen.nextInt((590-0+1) + 0);
}
// Generates a number in range of 0 - 570
else if(... |
0ae74452-7d54-4d27-a98b-c08be890117f | 5 | public static ContactNymDetails getContactNymDetails(Contact contact,int index){
ContactNymDetails data = new ContactNymDetails();
List serverList = new ArrayList();
if(contact!=null && index>-1){
ContactNym contactNYM = contact.GetContactNym(index);
if(conta... |
fbdbadfd-de21-4514-963d-87740e60f5a0 | 3 | public Balloon(double radius, double fullness) {
if (radius <=0) {
throw new IllegalArgumentException(
"Illegal radius, must me positive");
} else {
this.radius = radius;
}
if (fullness < 0 || fullness > 1) {
throw new IllegalArgum... |
1e2f448d-efb1-4ba6-ad5c-23a8af124769 | 2 | public void close() throws IOException {
InputStream inShadow = this.in;
if (inShadow != null) {
try {
if (inShadow != System.in) {
inShadow.close();
}
} finally {
this.data = null;
this.in = null... |
e409f8cf-612d-4fe0-bc8d-265269bb6daa | 2 | private void reportDetailInfoPosition(Integer start, Integer end)
{
if(dataSource != null)
{
List<Integer> hopList = dataSource.getHops(start, end);
for (AggregatePositionListener listener : listeners)
{
listener.setDetailedHops(hopList, this);
}
}
} |
e1249aec-6e00-4a45-b24e-66dcd519dd7b | 4 | public static boolean checkMatchName(Match match, boolean isNew) {
boolean res = false;
try {
PreparedStatement pr = connection.prepareStatement("" +
"SELECT match_id FROM match\n" +
"WHERE UPPER(match_name) = UPPER(?)");
pr.setString(1, ma... |
71d732f7-79f2-4ab3-b3d1-870dcfb29416 | 2 | synchronized public void writeSetDesktopSize(int width, int height,
ScreenSet layout)
{
if (!cp.supportsSetDesktopSize)
throw new ErrorException("Server does not support SetDesktopSize");
startMsg(MsgTypes.msgTypeSetDesktopSize);
os.pad(1);
os.writeU16(width);
os... |
0fc0626b-3726-430f-a4e2-dbf4b08d97e6 | 3 | public static void setTeachers()
{
for(int i=0; i<postList.size(); i++)
for(int j=0; j<teacherList.size(); j++)
if ( postList.get(i).getUID() == teacherList.get(j).getUID() )
{
postList.get(i).setTeacher(teacherList.get(j));
break;
}
} |
10c8150b-a712-4784-85a7-ba69a2c0e832 | 3 | public SignatureVisitor visitReturnType() {
if (type != METHOD_SIGNATURE
|| (state & (EMPTY | FORMAL | BOUND | PARAM)) == 0) {
throw new IllegalArgumentException();
}
state = RETURN;
SignatureVisitor v = sv == null ? null : sv.visitReturnType();
CheckSignatureAdapter cv = new CheckSignatureAdapter(TYPE... |
98b75d54-1f5b-4e9c-b805-e4dd835fe764 | 8 | public boolean canPerformAction(EInterfaceAction binding, Construct selected) {
switch(binding) {
case Bind_InsertAfter:
case Bind_InsertBefore:
case Bind_InsertPaste:
case Bind_InsertReplace:
case Bind_InsertChild:
case Bind_InsertWrap:
case Bind_Insert:
case Bind_InsertUsurp:
return t... |
67ec8e62-495a-4f60-9049-aefaa980c504 | 1 | public void add(long n) {
if (arrIndx == len) {
arrIndx = 0;
listIndx++;
list.add(new long[len]);
}
list.get(listIndx)[arrIndx] = n;
arrIndx++;
} |
fe192a13-942f-48fd-b53b-73fcad489312 | 4 | private List<String> wrapText(FontRenderContext context, String text, int width)
{
int MAX_WIDTH = width - LEFT_MARGIN - RIGHT_MARGIN;
List<String> result = new ArrayList<String>();
try(Scanner scanner = new Scanner(text))
{
scanner.useDelimiter("\\s+");
String line = "";
while(scanne... |
c84b8f44-b5bd-411a-8697-4d3b3c4c8713 | 6 | public boolean canPlaceBlockAt(World var1, int var2, int var3, int var4) {
int var5 = var1.getBlockId(var2, var3 - 1, var4);
return var5 == this.blockID?true:(var5 != Block.grass.blockID && var5 != Block.dirt.blockID?false:(var1.getBlockMaterial(var2 - 1, var3 - 1, var4) == Material.water?true:(var1.getBloc... |
ef7575db-c374-4745-832d-de3978713ad8 | 9 | @Override
protected int doReadInput( final CharSequence aChars )
{
if ( aChars == null )
{
throw new IllegalArgumentException( "Chars cannot be null!" );
}
int idx = getAbsoluteCursorIndex();
for ( int i = 0; i < aChars.length(); i++ )
{
char c = aChars.charAt( i );
swit... |
61b6231c-7bae-4fa9-9654-fd6a6fdac17e | 0 | public SetPrefCommand(String name) {
super(name);
} |
a24ae8f1-b8be-4445-b734-6c1a297839f2 | 7 | static public BigDecimal cos(final BigDecimal x)
{
if ( x.compareTo(BigDecimal.ZERO) < 0)
return cos(x.negate());
else if ( x.compareTo(BigDecimal.ZERO) == 0 )
return BigDecimal.ONE ;
else
{
... |
097924fa-224e-4921-af3d-74c5c1169393 | 9 | public static Action getAction(List<Action> available) {
while(true) {
output.print("Available actions: ");
if(available == null) {
for(int i=0; i<Action.values().length; i++)
output.print(Action.values()[i].name().toLowerCase() + " ");
}
else {
for(Action action : available)
output.pri... |
b7e03ccd-f82d-4115-a069-6271162c91d3 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((!mob.isInCombat())||(mob.rangeToTarget()<1))
{
mob.tell(L("You really should be in ranged combat to cast this."));
return false;
}
for(int i=0;i<mob.location().numItems();i++)
{
fi... |
3030233b-fa31-4c7f-be34-cfe74f78ef7a | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
eac2d0cd-0e70-4141-83d9-dbbc5b3cf070 | 5 | private Map<?,?> asMap(Object object) throws InvalidDescriptionException {
if (object instanceof Map) {
return (Map<?,?>) object;
}
throw new InvalidDescriptionException(object + " is not properly structured.");
} |
26f8a326-63df-4b6f-a1b0-aeb2e2aadece | 4 | public boolean validProperties() {
return props.getProperty("X") != null && props.getProperty("Y") != null
&& props.getProperty("height") != null
&& props.getProperty("width") != null
&& props.getProperty("tree") != null;
} |
38b7a931-d680-413d-b676-ac964eb80016 | 6 | final synchronized public Number getNumber(final int index) throws Exception, IndexOutOfBoundsException
{
switch (type)
{
case BOOL:
case SINT:
return new Byte(data.get(type.element_size * index));
case INT:
return new Short(data.getShort(type.element_... |
0205df39-3478-4e3e-ab28-41ad1fc67924 | 8 | @Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("INSERT INTO ");
sB.append(this.into.replace("#__", this.db.getPrefix()));
sB.append("\n");
sB.append("(");
for(int i = 0; i < this.fields.size(); ++i) {
if(i... |
5057c30e-ced7-4cfc-be0e-db8d3b2716dc | 9 | private BufferedImage getSpellTreeImage(ArrayList<SpellsStage> spells, int stage, int selected)
{
BufferedImage im = new BufferedImage(1000, 100+(spells.size()*100), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = im.createGraphics();
g2d.setColor(Color.BLACK);
for (int i = 0; i < spells.size(); i++)
{
S... |
6216fa1a-9ad8-4080-b04b-b71d4e02c46f | 5 | public float getDeterminant() {
if(!isSquare())
throw new IllegalArgumentException("Non-square matrix");
if(numRows == 1) return elements[0][0];
if(numRows == 2) {
return elements[0][0] * elements[1][1] - elements[0][1] *
elements[1][0];
}
float sum = 0;
for(int i = 0; i < numRows; i++) {
M... |
80ad2de8-104a-4fac-9302-71b9edad0a49 | 3 | @Override
public boolean validateAndStartPatchRun() {
//Warn about hash differences
boolean lCanRun = validatePatchRun(getDatabaseConnection().getLoggingConnection());
String lHashDifference = getPatchScript().getPatchFileHash().equals(mPreviousHash) ? "" : " - PREVIOUS HASH DIFFERENT";
if(l... |
107fcf5b-3e20-43dc-bdf2-fbba1d468945 | 1 | public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} |
4cb463ca-6854-46b2-8c56-9ca9afaacff5 | 2 | public int selectLayer() {
int layer_size = Math.min(getHeight(), getWidth() / layerCount);
if (currentMousePosn != null) {
int s = currentMousePosn.x / layer_size;
if (s >= layerCount) {
return -1;
} else {
return s;
}
... |
4eb389ae-70b5-49de-8c28-aad2840e6dc5 | 7 | public static void getBest(int id, BufferedWriter writer) {
Integer bid = new Integer(-1);
Integer sid = new Integer(-1);
Integer tid = new Integer(-1);
Double dmin = new Double(9999);
int indx = -1;
for (int i=0; i<Scores.size(); i++) {
if (Scores.get(i) < dmin) {
dmin = Scores.ge... |
c15ad67a-b328-4846-bb21-54d7f23584ec | 4 | void parseNumber(String number) {
// Parse number field
if (number.equals("A")) vcfInfoNumber = VcfInfoNumber.ALLELE;
else if (number.equals("R")) vcfInfoNumber = VcfInfoNumber.ALL_ALLELES;
else if (number.equals("G")) vcfInfoNumber = VcfInfoNumber.GENOTYPE;
else if (number.equals(".")) vcfInfoNumber = VcfInf... |
73aaad7b-d05e-475d-8715-d9b27a621a7d | 9 | private void importStructureFile(RunnerLongTask task) {
identifier = new ConstanceIdentifier(current_file,
config.separator, tempTablePrefix);
schema = null;
try {
int currank = 0;
if (task != null) {
currank++;
task.setProgressExternal(currank);
}
identifier.loadTechnicalDescription();
... |
01207f7c-37d8-4a21-aa61-5ccfde3ed162 | 6 | protected static TriangleIntersection compute_intervals_isectline( Triangle t, float vv0, float vv1, float vv2,
float d0, float d1, float d2,
float d0d1, float d0d2 )
{
if ( d0d1 > 0 ) // D0, D1 are on the same side, D2 on the other or on the plane
return intersect( t.getPo... |
0d0f267c-4691-4504-a71e-d6d4b8b3897b | 0 | public static boolean zipFolder(File srcFolder, File destZipFile) {
File[] ar = new File[1];
ar[0] = srcFolder;
return zipFolders(ar, destZipFile);
} |
6a71a792-8ad1-49bd-9cf9-24c477e1106c | 3 | public static void sendPlayerToProxySpawn(BSPlayer player, boolean silent) {
if(!doesProxySpawnExist()){
player.sendMessage(Messages.SPAWN_DOES_NOT_EXIST);
return;
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream( b );
try {
... |
f43e95cb-39aa-44ca-9f95-a4d9d0140046 | 1 | @Override
public int retrieveId(String mess) {
try {
JSONObject obj = new JSONObject(mess);
return obj.getInt("PacketID");
} catch (JSONException e) {
}
return 0;
} |
a89f0473-de6c-49a4-940d-821e1cac4605 | 0 | public static void main(String[] args) {
// int x; // Error
int x = 34;
// Autoboxing
Integer X = new Integer(x);
X = new Integer(34);
X = 34;
// Unboxing
x = X;
// Autoboxing
ArrayList<Integer> arrayList = new ArrayList<Integer>();
arrayList.add(34);
arrayList.add(new Integer(15));
// ... |
69f7e620-0818-4d3d-abfb-d912e46cb39c | 8 | private String makeQueryString(QueryData query, QueryType type, String newData){
String queryData = "";
// Create appropriate query string
switch (type){
case COMPANY:
queryData = "UPDATE adjusters SET company='" + query.getCompany()
+ "' WHERE name='" + query.getName()
+ "' AND phone='" + query.ge... |
4be8abe5-5ffe-4e75-985b-55bd383dfc56 | 6 | public static void maxProduct(int[] input) {
int lastMax = input[0];
int lastMin = input[0];
int lastMaxStart = 0;
int lastMinStart = 0;
int maxProduct = Integer.MIN_VALUE;
int maxLeft = 0;
int maxRight = 0;
for(int i = 1; i< input.length; i++) {
... |
0447f9d0-30a0-43ae-8335-645144413bf9 | 9 | @Override
public void handleDamageSpamSummary(final MOB mob)
{
if((mob.isAttributeSet(MOB.Attrib.NOBATTLESPAM))
&&(mob.playerStats()!=null))
{
int numEnemies=0;
final Room R=mob.location();
for(final Enumeration<MOB> m=R.inhabitants();m.hasMoreElements();)
{
final MOB M=m.nextElement();
if((... |
d0ed0873-dad1-4416-bb47-0b8c9a51d161 | 2 | protected Integer getIntegerField(String fieldName) {
Integer i;
while (true) {
try {
i = io.getInteger(fieldName + ": ");
break;
} catch (NumberFormatException ex) {
io.println("Invalid number!");
continue;
... |
a5111374-6c6a-4329-9c0a-27ec7e6adade | 1 | public static void updatePays(int id, String pays) throws SQLException {
int result;
String query;
try {
query = "UPDATE PAYS set PAYS=? WHERE ID_PAYS=?";
PreparedStatement pStatement = (PreparedStatement) ConnectionBDD.getInstance().getPreparedStatement(query);
... |
e6959b33-9853-40f1-9931-bfa4c2de989c | 8 | public boolean isScramble(String s1, String s2) {
if(s1.equals(s2)) return true;
int val1 = 0, val2 = 0;
int size = s1.length();
for(int i = 0; i < s1.length(); ++i){
val1 += s1.charAt(i) - 'a';
val2 += s2.charAt(i) - 'a';
}
if(val1 != val2) return false;
for(int i = 1; i < s1.length(); ++i){
if(... |
b25115f6-9000-4458-932f-ec592098dcdc | 4 | public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
buf.setLength(0);
buf.append("{\n");
buf.append("mv = cw.visitMethod(");
appendAccess(access);
buf.append(", ");
appendConstant(name);
buf.append(", ");
append... |
ae13e39c-eae4-4e07-9a96-c9c5fa3cc040 | 5 | public void openDoors(Vector3f pos, boolean exitLevel){
for(Door d : doors){
if(d.getTransform().getTranslation().sub(pos).length() < OPEN_DISTANCE){
d.open();
}
}
if(exitLevel){
for(Vector3f exit : exits){
if(exit.sub(pos).len... |
8af8d9fb-dfc0-4e35-8bc8-507fc6711b43 | 3 | public void cambiarPosicionJugado1(){
for(int x=0;x<8;x++){
for(int y=0;y<8;y++){
if(pd.mapa_jugador2[x][y].equals(codigo))
pd.mapa_jugador2[x][y]="";
}
}
int x=rd.nextInt(0)+7;
int y=rd.nextInt(0)+7;
set... |
104e977d-a14b-427f-9808-69d4a585feba | 0 | public void setType(int type) {
mType = type;
} |
53aafd9f-571d-4bdf-b4e0-78eaf97e199d | 0 | public ArrayList<Integer> getDeck(){
return shuffledDeck;
} |
32f45716-a337-4a8d-b9b2-73eaad317ad6 | 2 | @Override
public boolean openFile(DocumentInfo docInfo) {
String msg = null;
String path = PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PATH);
try {
docInfo.setInputStream(new FileInputStream(path));
return true;
} catch (FileNotFoundException fnfe) {
msg = GUITreeLoader.... |
27e677d4-8d9f-4dc0-9530-7bef1d2d667a | 2 | @Override
protected void channelRead0(ChannelHandlerContext ctx, HttpRequest req) throws Exception {
if (req.getUri().equals("/status") || req.getUri().equals("/status/")) {
String url = req.getUri();
controller.IncreaseCount();
controller.addToIpMap(ctx);
res... |
e9315e95-3533-4bfc-8ad0-95c686230e5d | 0 | @Override
public String getKey() {
return String.valueOf(getBumoncode());
} |
7130107a-c869-4d65-aa8b-540816b67a0a | 4 | public byte[] encryptData(byte[] msg){
try {
try {
this.cipher.init(Cipher.ENCRYPT_MODE, this.key, this.ivspec);
} catch (InvalidAlgorithmParameterException e) {
LOGGER.log(Level.SEVERE, "Error building security cipher. [" + e.getMessage() + "]");
}
... |
26d9e18c-adb1-4226-84c7-e6b4bb71818b | 0 | public Collection<List<V>> values() {
return this.map.values();
} |
a02b409c-f29c-44d2-bd47-739ea6832d8f | 0 | public File getFile() {
return file;
} |
3efc1c6b-5b2d-4536-befe-969c993eae9e | 3 | public static int countPairs(int N, int M) {
int totalNumber = 0;
for(int i=1;i<=N;i++){
for(int j=1;j<=M;j++) {
if(isInt(i,j)){
totalNumber++;
}
}
}
return totalNumber;
} |
e7e2df5e-58a3-401b-9ed1-b3646ba5bcd7 | 3 | public static void main(String[] args){
listeGare = new ArrayList<Gare>();
monServeurBilletterie = new ServeurBilletterie();
//Création gare
for (int i=0; i<NB_GARES; i++){
Gare gare = new Gare("Gare n°"+i, monServeurBilletterie);
listeGare.add(gare);
}
... |
39b18a0c-f5c2-4ae4-87e1-e82900b4cbd9 | 4 | private static void secondresult(int numberpicker, Character hero, NPC baddie) {
switch (numberpicker)
{
case 1: System.out.println("You charge in screaming like the idiot you are and attack");
battleEvent(hero, baddie);
break;
case 2: System.out.println("You talk to the ______ and end up being best... |
321f0750-c925-4a89-b77d-225556c068e6 | 8 | private void getCompletedCitiesRecursive(HashSet<BoardPosition> searched,
HashSet<BoardPosition> toSearch,
ArrayList<HashSet<BoardPosition>> cities,
ArrayList<Integer> incompleteCities) {
// Take a position from the toSearch map to search.
Iterator<BoardPosition> toSearchIterator = toSearch.iterator();
... |
3254d7fc-9e28-4f06-8e66-fb0594746c0a | 2 | @Override
public List<Double> transform(List<Double> in) {
List<Double> out = new ArrayList<Double>();
for (int i = 0; i < in.size(); i++){
if(in.get(i).equals(Matrix.UNKNOWN_VALUE)){
out.add(columnCentroids.get(i));
}
else{
out.add... |
d88e8b53-112d-4340-acdb-7cd5e8ab8567 | 6 | private void handle(String line) throws IOException {
try {
String[] args = line.substring(1).split(" ");
// handle commands which do not use gamenetwork:
if (args.length == 0) {
LOG.warn("Illegal Command: " + line);
return;
}
... |
64de6b06-8291-4d78-a063-633f435d1d3b | 4 | @Override
public void die(){
if(ParticleSystem.isEnabled() && particleGenerators != null)
for(ParticleGenerator<? extends Particle> particleGenerator : particleGenerators)
ParticleSystem.removeGenerator(particleGenerator);
delete();
} |
ef451cc4-1e5b-4b3e-aea7-871acf03d2d6 | 6 | public boolean ok(String[] board,int row, int col,int n){
for(int i =0 ; i < row; i++){
// 确保列上不会重复
if(board[i].charAt(col) == 'Q')
return false;
// 确保对角线不会重复
int temp = col - row +i;
if(temp >=0 && board[i].charAt(temp) == 'Q')
... |
a2e2dd95-59b1-4a50-a719-058209b415eb | 4 | private void CheckHTML(String html, String url) {
if (null == html || html.length() < 5)
throw new IllegalArgumentException("Enter a HTML document to analyze.");
if (null == url || url.length() < 10)
throw new IllegalArgumentException("Enter an URL to analyze.");
} |
4b8b1857-d1c2-4aaf-b2b8-215fc75829b3 | 1 | public static void write (org.omg.CORBA.portable.OutputStream ostream, pgrid.service.corba.PeerReference[] value)
{
ostream.write_long (value.length);
for (int _i0 = 0;_i0 < value.length; ++_i0)
pgrid.service.corba.PeerReferenceHelper.write (ostream, value[_i0]);
} |
641a0b71-f5c5-4329-bf8c-394a240e7ea0 | 7 | public Set<Rules> getRulesOnName(String name,Change change){
Set<Rules> retRules=new HashSet<Rules>();
Rules retRule=rules.get(name);
if(retRule!=null){
if((change==null && retRule.getChange()==null) || (change!=null && change.equals(retRule.getChange()))){
retRules.add(retRule);
if(retRule.getInclude... |
b860718d-5eb8-48ad-8ffc-478f4fe78f66 | 0 | public boolean getLineEndingAtEnd() {
return lineEndingAtEnd;
} |
4f6d06dc-0827-461a-b662-9a8f1211b1d3 | 4 | public static String selectAccountType(){
Scanner scan = new Scanner(System.in);
do{
System.out.printf("\n***TIPOS DE CUENTA***\n1-%s\n2-%s\n3-%s\nEscoja uno: ",
PLANILLA, NORMAL, VIP);
int opt = scan.nextInt();
switch(opt){
case 1: ret... |
f7854087-ad99-486f-badd-3d651fcefb83 | 7 | public final void computeRadiusIncremental(Morph newMorph, boolean addition) {
if (morphsById.size() == 1) {
radius = 16; // FIXME put that morph radius into the Morph class
}
if (addition) {
float distance = 0;
for (Morph m : morphsById.values()) {
distance = newMorph.getPosInShip().distance(m.getP... |
42d068e3-4fa5-44e8-a48e-1fbd88b30f0c | 9 | public void add(int num) {
if(minHeap.size() == 0 && maxHeap.size() == 0) {
maxHeap.offer(num);
return;
}
if(minHeap.size() == 0) {
if(maxHeap.peek() > num) {
minHeap.offer(maxHeap.poll());
maxHeap.offer(num);
} els... |
348a8480-2fe3-4ae5-99f2-911a34f385d4 | 5 | public void draw(Graphics2D g2, int xStart, int yStart, int xEnd, int yEnd) {
g2.setColor(Color.RED);
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
if (isInTileSet(x, y) && (getTileID(x, y) != LevelTexture.AIR)) {
if (getTileID(x, y) < 10) {
g2.drawImage(levelTextur... |
d1bac419-5158-4bad-b82a-599a3f8bbd5c | 6 | @Override
public void startEvent(){
if(valid == false){
valid = true;
graphP.resetGraph();
graphK.resetGraph();
try{
newLength = convertToDF
(Double.parseDouble(lengthTextField.getText()));
currentLength... |
eff036e2-e6cc-4d47-af25-1f1f9d526f62 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Property other = (Property) obj;
if (attributes == null) {
if (other.attributes != null)
return false;
} else if (!attributes.equals(oth... |
9d59e734-9501-4c85-9c17-c9116744481c | 7 | void init(){
//super("GraphicEditor");
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e){System.exit(0);}});
node.setText("Node");
link.setText("Link");
link.setMargin(new Insets(8,1,12,10));
node.addActionListener(newNode);
link.addActionListener(linkN... |
c0b6bafa-b975-43ba-b7be-b2ad6062708b | 0 | public double performOperation(double a, double b, Operator operator){
this.a = a;
this.b = b;
this.operator = operator;
operator.accept(this);
return result;
} |
68df5137-fabe-4a30-b4cc-43a67d22128e | 0 | private ParticipantListJsonConverter() {
} |
fefa04ca-22ef-4ab6-9512-14b46b56b3c5 | 4 | public void printPage() throws IOException {
try {
ensureOut();
if (completeHTML) {
out.format(
"<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>%n");
out.format("<html>%n");
out.format("<head>%n");
o... |
3fd33adb-ea48-4c29-b0bd-34bce820e952 | 7 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generateD methoD stub
if(stage == INIT_STAGE) {
System.out.println("Init Stage click " + Clickcount);
setInitButtonImage();
Clickcount++;
stage = FIRST_STAGE;
}
else if(stage == FIRST_STAGE) {
System.out.println("first St... |
34132456-58c6-4d38-9285-746721ab3a0c | 4 | Fastq(final String description, final String sequence, final String quality, final FastqVariant variant) {
if( description == null ) { throw new IllegalArgumentException("description must not be null"); }
if( sequence == null ) { throw new IllegalArgumentException("sequence must not be null"); }
if( quality == nu... |
1c4ce291-fd3e-4482-aef9-946a81d6493f | 9 | @Override
public void setVisible(boolean visible) {
if (visible!=isVisible()) {
if (visible) {
installKeyBindings();
lastLine = ac.getLineOfCaret();
selectFirstItem();
if (descWindow==null && ac.getShowDescWindow()) {
descWindow = createDescriptionWindow();
positionDescWindow();
}
... |
b581188f-016d-4ee1-bf11-d6ddddf82d69 | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
06e4fe9b-42f0-4d94-9e61-955fdf55a02a | 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 TaxonObservationDownloadStatistics)) {
return false;
}
TaxonObservationDownloadStatistics other = (TaxonObservationDown... |
3adba718-4a3c-4b64-842b-bafaf2cff870 | 3 | public void deletePath() {
if (!dir.exists()) {
return;
}
if (dir.list().length != 0) {
return;
}
if (!dir.delete()) {
throw new DataBaseException("Cannot delete a directory!");
}
} |
b5e19c7f-0b89-4fd6-8c1b-15aa0068fb5a | 7 | private void getConfigIni(int APIKeyId) {
try {
BufferedReader config = new BufferedReader(new FileReader("/usr/local/skysql/config/components.ini"));
String keyString;
while ((keyString = config.readLine()) != null) {
Pattern p = Pattern.compile("^" + APIKeyId + "\\s*=\\s*\"(\\w+)\"");
Matcher m = p... |
68a827bd-8b8d-41cc-9008-f0a8caaf670a | 7 | public void go(int dir, float n,int image) {
float temp = n;
if(crouch == true){
temp /= 2;
if (current != image) {
removeAnimation(crouching[current]);
current = image;
addAnimation(crouching[current]);
currentAnimation = crouching[current];
}
if (crouching[current].isStoppe... |
867bb97b-b78b-436d-8771-3ccbfa55987d | 2 | public static void main(String[] args) {
int arrayLength = 10; // length of arrays for this exercise
int maxNumber = 20; // upper bound of random number
int minNumber = 1; // lower bound of random number
int numberToSearchFor; // number to be entered by user to search for
int[] a... |
eb709f4e-4054-470e-9009-30e97b44e049 | 9 | static int isInCcwConvex(Point p, Point[] polygon) {
int n = polygon.length;
// 凸形の内点を任意に選ぶ
Point g = polygon[0].add(polygon[n / 3]).add(polygon[n * 2 / 3])
.multiply(1.0 / 3);
if (g.equals(p)) return 1;
Point gp = p.subtract(g);
int l = 0;
int r ... |
81c7ab93-7a00-47ae-a5ed-f180a002b0e4 | 2 | public int avaliar() {
int tmp = 0;
if(!num.isEmpty()){
tmp = num.get(0).avaliar();
for(int i=1; i<num.size() ;i++){
tmp = tmp / num.get(i).avaliar();
}
}
return tmp;
} |
a2961238-a610-402c-a08d-2ce5c186023b | 5 | private int[] searchForBiggest(){
//Postcondition: this.width and this.height are set and an array of two
// ints which contains biggestHeight and biggestWidth
// Unnecessary, but don't have time to change
int biggestHeight = 0;
int biggestWidth = 0;
for(int i = 0; i < repeated.length; i++){
... |
93625fe8-46ff-4bac-bb2b-3604f9f6665e | 9 | public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if (l1 == null && l2 == null)
return null;
if (l1 == null)
return l2;
if (l2 == null)
return l1;
ListNode head;
ListNode c1, c2, last1, last2;
if (l1.val > l2.val) {
he... |
6b19b2c4-eef8-4ad9-8de9-a40dd2f72aad | 5 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Environment.InitPacket(140, Main.ClientMessage);
Environment.Append("S", Main.ClientMessage);
Environment.Append(1, Main.ClientMessage);
Environment.Append(1, Main.ClientMessage);
Environment.Append(Main... |
cbd3af85-4174-4469-a9b2-974cf9e09014 | 5 | public synchronized boolean closeSlot(int slotID) {
if (!_isOpen) {
return false;
}
if ((slotID < 0) || (slotID >= _slots.size())) {
return false;
}
if (!_slots.get(slotID).isOpen()) {
return false;
}
_slots.get(slotID)... |
cf9e97cd-f2d4-42d8-a0c1-5a084f5a38be | 9 | public static void main(String[] args) {
if (args.length == 0) {
printDetails(); // Write out the program details
System.exit(0);
} else if (args.length == 1) {
source = new File(args[0]); // Create source file
} else if (args.length > 1) {
source = new File(args[args.length-1]); ... |
246e47a4-0a4e-4fbb-850d-76b4eb50f19f | 7 | private static void readProperties(NodeList children, Properties props) {
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if ("property".equalsIgnoreCase(child.getNodeName())) {
final String key = getAttributeValue(child, "name");
... |
8502debd-42f9-48fa-b1d2-787f710b4306 | 8 | @Override
public String toString(){
switch(ordinal()){
case 0: return "KKMMM";
case 1: return "HHMMM";
case 2: return "MMMKM";
case 3: return "MMMHH";
case 4: return "MMKHH";
case 5: return "MMKHM";
case 6: return "MMHHM";
case 7: return "MMKKM";
default: return "";
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.