method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9736c2af-77e1-446d-b576-d6fe6785b656 | 0 | @Inject
public void setJobFactory( JobFactory jobFactory )
throws SchedulerException
{
scheduler.setJobFactory( jobFactory );
} |
8c7b81dc-f9c6-43ac-959d-226b479c9f7c | 7 | public EntityLightningBolt(World par1World, double par2, double par4, double par6)
{
super(par1World);
this.setLocationAndAngles(par2, par4, par6, 0.0F, 0.0F);
this.lightningState = 2;
this.boltVertex = this.rand.nextLong();
this.boltLivingTime = this.rand.nextInt(3) + 1;
... |
e2366968-749c-44d5-a1c9-679149f41d01 | 2 | public Image complete() {
Image completed = original.shallowClone();
for (Cluster cluster : clusters) {
for (Point p : cluster.points) {
completed.setPixel(p, RED, cluster.mean.x);
completed.setPixel(p, GREEN, cluster.mean.y);
completed.setPixel(p, BLUE, cluster.mean.z);
}
}
return completed;
... |
786cc7af-39da-402a-be4a-8d2bef53f624 | 9 | public int findTwoBiggestDistinct(int[] arr) {
if (arr.length < 2) {
//no such numbers
System.out.println("no such numbers");
return arr[0];
}
int big1 = arr[0];
int big2 = arr[1];
int i = 2;
while (i < arr.length && big1 == big2) {
big2 = arr[i];
i++;
}
if (big1 != big2) ... |
d2b674d6-6a69-4d4e-a96e-3830e83fee24 | 4 | public void placeOrder(TradeOrder order)
{
Trader t = order.getTrader();
String msg = "New order: ";
if (order.isSell())
{
msg += "Sell ";
} else
{
msg += "Buy ";
}
msg += this.symbol;
if (!"".equals(this.companyName))
{
msg += " (" + this.companyName + ")\n";
}
msg += order.getSh... |
c11d504a-aba9-462f-870a-db1759cee9ff | 1 | public ArrayList<Item> createArrayList(int items) {
ArrayList<Item> array = new ArrayList<Item>();
for (int i=0;i<items;i++) {
Item item = genItem(i,items);
array.add(item);
}
return array;
} |
b2cd41ab-fbed-44cb-b0f4-78fbc4b682ec | 6 | @Override
public boolean test(String value) {
// TODO Auto-generated method stub
if(value == null || value.equals(""))
return true;
else if( value.length() != 3) {
return false;
}
else {
char c1 = value.charAt(0);
char c2 = value.charAt(1);
char c3 = value.charAt(2);
if( Character.isDigit(c... |
331ecda2-3550-4181-a399-6841fe7d80bf | 0 | @Override
public int getBits() {
// TODO Auto-generated method stub
return 0;
} |
d01d32e1-28b9-4733-86cb-651f9e145088 | 9 | private boolean impossibleAlmostMill(GameBoard board, GamePiece p, Team other){
int pNext = (p.getP()+1) % 8; //next spot on the ring
int pPrev = p.getP()-1; //p minus one mod eight
if (pPrev < 0) {
pPrev+=8;
}
//--MILL DETECTION---------------------------------------
if(p.getP() % 2 == 0) { ... |
21c7714c-4386-496f-a6fb-164a657d0061 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
262c20af-236e-46c9-b13b-4da5326ebc76 | 4 | public static void main(String[] args) {
int[][] arr ={{1,2,3,4},{5,0,7,8},{9,10,11,12},{13,14,15,16}};
for(int[] a : arr){
for(int b : a){
System.out.print(b);
System.out.print(' ');
}
System.out.println();
}
setZero(arr);
for(int[] a : arr){
for(int b : a){
System.out.print(b);
... |
9c1d4a4b-bbda-4551-941e-6bb8b4c31c30 | 9 | public void paintComponent(Graphics g){
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
for(int row = 0; row < game.getBoard().getLength(); row++){
for(int col = 0; col < game.getBoard().getWidth(); col++){
Rectangle rec = new Rectangle(col *23,row*23,23,23);
if(game.getBoard().getValue(... |
d6de2b7c-0a9e-444a-97d6-e9829ee2af6c | 4 | public void initWorld() {
if(restart) {//The player has restarted the game
/*Reset the level counter*/
levelNumber = 0;
/*Load the first level*/
loadNextLevel();
/*Reset the paddle's position*/
Paddle paddle = player.getPaddle();
paddle.setXPos(paddleStartX);
paddle.setYPos(paddleStartY);
/... |
dcc0e24a-ee30-4011-b937-a20dc3231a2e | 9 | public static int candy(int[] ratings) {
if (ratings == null && ratings.length == 0) {
return 0;
}
if (ratings.length == 1) {
return 1;
}
int[] tables = new int[ratings.length];
tables[0] = 1;
for (int i = 1; i < ratings.length; i++) {
... |
481d465c-95f8-4804-ab6e-599e2acad63c | 4 | public boolean inBounds(int x2, int y2){ //If we clicked the object
if(x2 >= x && x2 <= x+bwidth
&& y2 >= y && y2 <= y+bheight){
return true;
}
return false;
} |
889d9222-2fdd-4632-b5fb-a10a875bf7e9 | 8 | private void b_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_loginActionPerformed
if ("".equals(f_login.getText()) || "".equals(String.valueOf(f_password.getPassword()))) {
JOptionPane.showMessageDialog(rootPane, "Digite seu login e senha para Continuar!", "CadoreSis... |
d077ac70-8470-4907-8aad-fe1fad4cf8aa | 5 | private int getCmd(String command) {
try {
if (command.equals("/rg")) {
return 0;
} else if (command.equals("/l")) {
return 1;
} else if (command.equals("/cmd")) {
return 2;
} else if (command.equals("/q"))
return 3;
} catch (Exception e) {
System.out.println(e.getMessage());
}
r... |
4b0f57dd-3f87-4db8-8ca2-144c3614c78e | 6 | private void paintList(Graphics g, List highlights) {
int len = highlights.size();
for (int i = 0; i < len; i++) {
HighlightInfo info = (HighlightInfo)highlights.get(i);
if (!(info instanceof LayeredHighlightInfo)) {
// Avoid allocating unless we need it.
Rectangle a = textArea.getBounds();
Inse... |
d252a764-cab9-4b93-9031-632dc3d585b2 | 3 | private boolean istGueltigePosition(int x, int y)
{
return (x >= 0 && x < _arraySpaltenzahl && y >= 0 && y < _arrayZeilenzahl);
} |
3acc8499-2d6c-44c5-a365-56aa5fb00c5d | 7 | public static String [] partitionOptions(String [] options) {
for (int i = 0; i < options.length; i++) {
if (options[i].equals("--")) {
// ensure it follows by a -E option
int j = i;
while ((j < options.length) && !(options[j].equals("-E"))) {
j++;
}
/* if (j >= options.length) {
return new... |
9290df27-c738-4a71-8113-2d4a8103e546 | 9 | public boolean camposobrigatoriospreenchidos() {
if (TfDescOperacao.getText().equals("")) {
msg.CampoObrigatorioNaoPreenchido(LbNotificacao, "Digite a descrição desta operação!");
TfDescOperacao.grabFocus();
return false;
}
if (TfCodFuncionario.getText().equal... |
12001d16-9d92-4b66-8ce4-65a8984a741b | 1 | public void testSetInterval_RInterval3() {
MutableInterval test = new MutableInterval(TEST_TIME1, TEST_TIME2);
try {
test.setInterval(null);
fail();
} catch (IllegalArgumentException ex) {}
} |
8f68a0f4-d203-4ec8-b4ae-869a6ed85512 | 7 | private static long largestPrimeFactor(long number) {
// If number is less than 2 then simple return -1
if (number < 2) {
return -1;
}
// If number is 2 or 3 then simply return the number
if (number == 2 || number == 3) {
return number;
}
// Start factoring from smallest prime number which is 2
... |
c302471e-1248-47e9-97fa-9bad7a853a80 | 9 | public PhotoList<Photo> getRecentForContacts(Date lastComment, ArrayList<String> contactsFilter, Set<String> extras, int perPage, int page)
throws FlickrException {
PhotoList<Photo> photos = new PhotoList<Photo>();
Map<String, Object> parameters = new HashMap<String, Object>();
param... |
666cc1b6-b611-4869-8463-8b2a69e5e732 | 8 | public void checkSolution( Contestant submitter , String solution ) {
try {
//determine the cards that must be used
String cards = "";
for ( int i = 0 ; i < this.m_cards.length ; i++ ) {
cards += this.m_cards[ i ] + " ";
}
cards = cards.trim();
//check the user's solution
Process runC... |
77d2d594-430e-4f88-ba02-9cbd54b8ef7e | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Oven other = (Oven) obj;
if (temperature != other.temperature) {
return f... |
eaa7fb6d-e0af-44f0-98e1-bab1fbe2199a | 6 | public static Properties loadConfig() throws IOException {
File configFile = new File("config.properties");
if (!configFile.exists()) {
configFile.createNewFile();
}
FileInputStream configInputStream = new FileInputStream(configFile);
Properties configProperties = new Properties();
configProperties.load(... |
26ebfa8a-fa9d-4b33-9f38-d498a609fb6f | 0 | @Test
public void test_squareContentSprite(){
assertNotNull(board);
ArrayList<Pawn> pawns = getAllPawn(board);
//if current Pawn
assertEquals(board.squareContentSprite(pawns.get(0).getX(), pawns.get(0).getY()), 'c');
board.removeAllPawns();
numberOfPawns=0;
... |
586414bc-dc60-4470-87bb-5fe4c5dad055 | 9 | public void nonStaticMain(String[] args) {
if (args.length == 0)
args = new String[] { "help" };
String command = args[0];
String[] args2 = new String[args.length - 1];
for (int i = 1; i < args.length; i++)
args2[i - 1] = args[i];
// Figure out which ha... |
ae0c50fe-fb75-46c6-aa31-cbd3e8130002 | 0 | @Override
public String getHouseNumber() {
return super.getHouseNumber();
} |
56ae91d9-c1ba-487a-8c5d-d5c8ecb4a0ff | 7 | static public BigInteger det(final BigInteger[][] A) throws ArithmeticException
{
BigInteger d = BigInteger.ZERO ;
/* row size */
final int rL = A.length ;
if ( rL == 0 )
throw new ArithmeticException("zero row count in matr... |
7b862588-e118-4eff-a073-c595858e602d | 3 | private void initGUI() {
mnuItemSave.setEnabled(true);
Dimension d = new Dimension(132, 20);
lblGeneral.setPreferredSize(d);
lblContestants.setPreferredSize(d);
lblPlayers.setPreferredSize(d);
lblBonus.setPreferredSize(d);
conPanel = new ContestantPanel();
playerPanel = new PlayerPanel();
bonusPanel... |
69f53666-b341-44be-846d-f4f966dd6953 | 5 | public void body()
{
// get the destination entity ID
this.destID_ = GridSim.getEntityId(destName_);
int packetSize = 500; // packet size in bytes
Sim_event ev = new Sim_event(); // an event
// a loop waiting for incoming events
while ( Sim_system.runn... |
b3f34e16-2dfa-418a-8311-86e269bfce40 | 4 | @Override
public boolean willAcceptFirstEnvelope(Envelope e1, Envelope e2) {
boolean numberAccepted;
double p1 = mRandom.nextTrueDouble();
double p2 = mRandom.nextTrueDouble();
if (p1 > p2) {
double tmp = p2;
p2 = p1;
p1 = tmp;
}
do... |
b8e7c849-f948-434b-b2c6-b9c0189d0ba3 | 5 | private void myRepaint() {
Graphics2D graphics = (Graphics2D) canvas.getBufferStrategy().getDrawGraphics();
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, //Enable antialiasing
RenderingHints.VALUE_ANTIALIAS_ON);
if (keys[0]) { yDraw -= MOVE_SPEED; }
... |
5c35e623-ea00-4b6b-ae83-08b35da47fff | 7 | protected void incrementAge(){
age +=1;
if (!mature && !thirsty && age + Math.random()*maturationRandomMax >= maturationThreshhold){
mature = true;
}
else if (Math.random() < productionChance && !thirsty && mature)
harvestable = true;
if (Math.random() < thirstyChance)
thirsty = true;
} |
9d9f7c4e-f536-4a6b-b3b8-8362651b8099 | 1 | public Boolean isEmpty() {
return (counter == 0) ? true : false;
} |
c5a1fc52-ee68-415a-88da-8443b73ebc03 | 4 | public static void setCurrentTrack(Track newCurrent) {
if(newCurrent == null)
return;
MediaPlayer oldCurrent = currentPlayback;
currentTrack = newCurrent;
String trackPath = "file:///" + newCurrent.get("filepath").replace("\\","/");
try {
trackPath = par... |
7c8a9820-fd25-4bdc-a0b0-a0ff7b0c3ddc | 4 | public void ExecuteTaskPeriodically(int amount, int UnitTime, TimerTask task)
{
long ExecutionTime = 0;
switch (UnitTime)
{
case HOURS:
ExecutionTime = amount * oneHour;
break;
case MINUTES:
ExecutionTime = amount ... |
5c70b06c-5dc1-4f40-ad6c-34192b8bc1a0 | 0 | public State getState() {
return state;
} |
653453be-e686-4a39-8c9a-59e4ecc48e51 | 8 | public String validaDatosArticulo(String codigoArticulo, String descripcion,String proveedor)
{
String errorLog ="";
Articulo articuloValida = new Articulo(true);
Long tmpCodigoArticulo = null;
Float tmpPrecioVenta = null;
Float tmpPrecioCompra = null... |
fac75c60-e89e-4488-9647-b38eec139222 | 7 | @Override
public String executer(HttpServletRequest req) throws CommandeException
{
Facade f = new Facade();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
ClientBean cb = new ClientBean();
if (((String) (req.getParameter("creerClient"))) != n... |
50b615c5-7947-4aa7-99d6-49c54ff16c2e | 9 | private void grabOSArchitecture() {
if (Main.VERBOSE) {
System.out.println("[INFO] Determining OS architecture...");
}
String arch = "32 Bit";
if(isWindows) {
if(new File("C:\\Program Files (x86)").exists()) {
arch = "64 Bit";
}
... |
76595b9c-0344-4a35-a26d-29098fc2a21b | 8 | private int[] termCoefficient(String term){
String firstChar = term.charAt(0) + "";
if(!term.contains("x") && !term.contains("/")){
int result[]={Integer.parseInt(term),1};
return result;
}
if(!term.contains("/")){
if(firstChar.equals("x") || t... |
858d7989-ac53-49f4-89f8-b610226dbf1a | 7 | private static String decrypt(final int key, final String text) {
String decryptedText = "";
logger.log(Level.INFO, "Encrypted text: {0}", text);
char temp[] = new char[text.length()];
int c = 0;
for (int level = 0; level < key; level++) {
for (int n = 0; n < text.len... |
31b8d592-f8a4-480f-8b90-22c177bd0fb1 | 4 | private String updateBasedOnPop(){
String pop = (String)navigationStack.pop();
if(pop.equals("person")){
if(!personStack.isEmpty()){
updatePersonCard((Person)personStack.pop());
}
} else if(pop.equals("movie")){
if(!movieStack.isEmpt... |
74d4b580-3da3-43a0-8199-c0587465fe78 | 0 | @Override
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
// onBar1(instrument, period, askBar, bidBar);
onBar2(instrument, period, askBar, bidBar);
// 日付
// String date = DATEFORMAT.format(new Date(askBar.getTime()));
// if (this.aliveOrder != null &... |
672dde5c-5724-4d3b-b6b3-85780229f601 | 2 | public AwesomeThresholdingMenu() {
super("Video threshold");
setEnabled(true);
JMenuItem awesomeImage = new JMenuItem("Single Image");
JMenuItem awesomeImageNotMerged = new JMenuItem(
"Unmerged Single Image");
JMenuItem awesomeVideo = new JMenuItem("Video");
JMenuItem unmerged = new JMenuItem("Unmerge... |
4f13a9c7-e31d-4434-b13a-3c6ad117fa51 | 6 | public int getGameAction(int keyCode){
Integer ga = ((Integer) gameActions.get(new Integer(keyCode)));
if (ga != null){
return ga.intValue();
}
switch(keyCode){
case DEFAULT_KEYCODE_UP: return Canvas.UP;
case DEFAULT_KEYCODE_DOWN: return Canvas.DOWN;
... |
188881f2-0807-4e28-a059-703b163ef567 | 0 | private void addActions(){
JButton buttonOK = noteEditorFrame.getButtonOK();
buttonOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ICommand command = new EditNoteCommand();
command.execute();
... |
41a67c7d-41d9-4aee-9e96-e89e838169c4 | 1 | public void visit_dup_x2(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 4;
} |
801ff67e-591b-4f10-9a0d-7b1c8c089a93 | 8 | private StringBuffer actualizarRegistro() {
//Es el punto que sera comparado
int punteo = playerManager.Punteo;
StringBuffer CadenaRegistro = new StringBuffer();
String linea;
//Preparando para leer el registro
FileReader fr = null;
BufferedReader br = null;
... |
04b89a14-0261-4765-b598-55804671fd98 | 4 | public static void main(String args[]) throws Exception {
module = MODULE;
testFile = System.getProperty("testFile");
if(System.getProperty("device")!=null)
device = System.getProperty("device");
if(System.getProperty("persist")!=null)
persist = Boolean.parseBool... |
6119ffd7-97d8-4653-b236-6b6257ae79dd | 5 | private ConsoleCanvas()
{
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
//super.componentResized(e);
int w = e.getComponent().getWidth();
int h = e.getComponent().getHeight();
if(w < 1) w = 1;
if(h < 1) ... |
ca3790f8-4736-483a-bdb6-d3fa11da287e | 0 | public static FileNameFilter getFullNameFilter(String keyword) {
return new FileNameFilter(keyword, false);
} |
81f2f088-8bdf-4d20-9a10-7d70d73f5a86 | 8 | private File getDefaultFile(){
File home = new File(System.getProperty("user.home"));
if(!home.exists())
return null;
String s = System.getProperty("os.name").toLowerCase();
if(s.contains("win")){
File file = new File(home,"AppData/Roaming/.minecraft");
return file.exists()?file... |
9f46da4a-4d91-4a6f-8aca-ff2ef98d5f99 | 7 | public static void playSound(byte[] in) {
ByteBuffer b = ByteBuffer.wrap(in);
b.get();
int sound = b.getInt();
boolean surface = b.get() == 1;
String soundName = "";
switch(sound) {
case 1:
soundName = "/sound/effects/explosions/hullboom_1.wav";
break;
case 2:
soundName = "/sound/effect... |
bb3ff44b-cec5-4835-9c4f-9c5a7e743ca8 | 5 | private int sink(int i)
{
Key t = heap[i]; // Save key for later restoring
while (2 * i + 1 <= N) // while heap[i] has both the children
{
int j = 2 * i + 1; // rightmost child
// 1st comparision: Making j point to the least of the two
// children as heap[i] should sink to j
if (greater(heap[j], hea... |
86b27d28-6f40-4e5b-b054-fd258be41e93 | 5 | static /* package scope */ void addProfile(LangProfile profile, int index, int langsize) throws LangDetectException {
String lang = profile.name;
if (instance_.langlist.contains(lang)) {
throw new LangDetectException(ErrorCode.DuplicateLangError, "duplicate the same language profile");
... |
b98c7d6b-e772-4f13-860b-24b80d644d0e | 2 | public static void main (String[] args) {
new Lawnchair();
LOGGER.log(Level.INFO, "INIT. Sitting in Lawnchair.");
int reply = JOptionPane.NO_OPTION;
saveScorecard();
if (Manager.getInstance().getProfiles().size() == 0) {
LOGGER.log(Level.INFO, "No profiles found. Prompting user to create one.");
r... |
97412069-29e1-4376-80f4-9f7422bd7ab6 | 7 | public FieldAnalyzer getField() {
ClassInfo clazz = getClassInfo();
if (clazz != null) {
ClassAnalyzer ana = methodAnalyzer.getClassAnalyzer();
while (true) {
if (clazz == ana.getClazz()) {
int field = ana.getFieldIndex(ref.getName(),
Type.tType(ref.getType()));
if (field >= 0)
retu... |
f7b9b634-0f6c-4612-b349-019a2464af86 | 1 | private static String getTemperature(String date, String state, String bound)
{
DB db = _mongo.getDB(DATABASE_NAME);
DBCollection coll = db.getCollection(COLLECTION_TEMPERATURE);
BasicDBObject query = new BasicDBObject();
query.put("year", "" + getYear(date));
query.put("month", "" + getMonth... |
b0bbfd1f-78ec-4f3d-8cf3-16754e814c4f | 3 | public static <T> void swap(List<T> items, int index1_, int index2_) {
if (index1_ == index2_)
return;
T item1 = items.get(index1_);
T item2 = items.get(index2_);
if (item1 != null)
items.set(index2_, item1);
if (item2 != null)
... |
3aa33842-473b-4bb9-ae68-2063263f3073 | 3 | private void imposeConstraints(Particle p) {
if (outOfRange(p.getNewPos().x, 0, rangex)) {
p.getVelocity().x = 0;
}
if (outOfRange(p.getNewPos().y, 0, rangey)) {
p.getVelocity().y = 0;
}
if (outOfRange(p.getNewPos().z, 0, rangez)) {
p.getVelocity().z = 0;
}
p.getNewPos().x = clampedConstraint(... |
e4fecb34-167a-47ae-8e51-3104be8d660e | 0 | @Before
public void Setup()
{
patternSix = new Pattern("alan,friend,warbyparker,*,five,it");
patternTwoWildCards = new Pattern("alan,friend,*,*,five,it");
} |
4500c090-7589-4e7c-bbf7-9c9702bcc579 | 5 | void compress() {
if (getCount < GET_THRESHOLD)
if (!isModified() && ClassPool.releaseUnmodifiedClassFile)
removeClassFile();
else if (isFrozen() && !wasPruned)
saveClassFile();
getCount = 0;
} |
6abdea5a-0445-4258-ab7d-94d4a6f29b43 | 7 | public static ChessBoardEntity moveChessmen(final ChessBoardEntity b, final ChessmenEntity c, final PositionEntity p, final boolean promote) {
ChessBoardEntity board = null;
if (isMoveChessmen(b, c, p, promote)) {
List<ChessmenEntity> chessmens = new ArrayList<ChessmenEntity>();
for (ChessmenEntity chessmen :... |
c893fb8c-b597-4115-be02-4bf862ec2bbd | 6 | private boolean isValid(String str)
{
if(str==null || str.length()>3)
return false;
int num = Integer.parseInt(str);
if(str.charAt(0)=='0' && str.length()>1)
return false;
if(num>=0 && num<=255)
return true;
return false; ... |
8cd652df-bde4-4b07-876c-21f6f340acad | 4 | public void save() {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/factions"));
String line;
StringBuilder fileContent = new StringBuilder();
String newLine = null;
while((line = reader.readLine()) != null) {
String[] temp = ... |
ae38dc9a-e509-4cb2-ab98-aabcd571ff71 | 8 | public List<Cell> exploreWay(Cell [][]cells, int xStart, int yStart, int xGoal, int yGoal) { // A* alogoritm
List<Cell> openset = new ArrayList<Cell>(); // will explore
List<Cell> closeset = new ArrayList<Cell>(); // was explored
int tentativeScore;
boolean tentetiveIsBetter;
List<Cell> pathMap = ne... |
cc6961fc-d8eb-499a-a792-37723837005a | 3 | public String closestWeekday(String field)
{
String newField = "";
for(int i = 1; i <= field.length(); i++)
{
if(isNumber(field.substring(i - 1, i)))
{
newField = newField + field.substring(i - 1, i);
}
... |
34d32283-cb87-4606-9815-e04fd9450ad1 | 3 | public void deleteDataBase(JList<String> log){
ArrayList<String> alstLog = new ArrayList<>();
try {
alstLog.add("Loading driver...");
log.setListData(alstLog.toArray(new String[0]));
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
alstLog.add("Driver loaded");
log.setListData(alstLog.toAr... |
ae480c66-b38f-485f-8110-5a2828b6b883 | 1 | public ArrayList<BESong> getAll() throws SQLException {
ArrayList<BESong> result = new ArrayList<BESong>();
Statement stm = DBConnection.getConnection().createStatement();
stm.execute("select * from song inner join Artist on Song.artistID = artist.id inner join Category on Category.ID = song.Ca... |
f75a4fdf-dadb-4a1f-ba71-b94701fb1ebc | 9 | private static int chooseUseIndex(SingleAttributeUse[] uses) {
for (int i = 0; i < uses.length; i++)
if (uses[i] != null && uses[i].getType() == null && uses[i].getDefaultValue() == null)
return i;
int firstIndex = -1;
for (int i = 0; i < uses.length; i++) {
if (uses[i] != null) {
... |
b3e8e775-7f41-4184-a928-c49dee16036b | 5 | public boolean isSpaceAboveRobot() {
if(robot.getLocation().y <= 0) return false;
if(robot.getLocation().y <= GROUND_LEVEL) return true;
for(Rectangle hole:currentPlanet.getHoles()) {
if(((hole.y + hole.height) == robot.getLocation().y) &&
(robot.getLocation().x == hole.x)) {
return true;
}
}
r... |
f0f926b3-7c31-4dc2-8d7b-78d899eda24d | 0 | private void jButtonPrecedentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPrecedentActionPerformed
((CtrlVisiteur)controleur).visiteurPrecedent();
}//GEN-LAST:event_jButtonPrecedentActionPerformed |
6c0ca2b2-787a-455c-8512-28cc8df9529c | 3 | public void statusChanger(){
if (status == "Heavy"){
speed /= 2;
waveHealth *= 2;
}
else if(status == "Light"){
speed *= 2;
waveHealth /= 2;
}
if (boss){
size *= 2;
waveHealth *= 5;
}
} |
d2de48d2-ecbb-4022-8b57-997cdf8ec427 | 0 | public void setId(String value) {
this.id = value;
} |
e1ed2b5d-6172-4d12-8ce2-58d2de88ad2f | 7 | @Override
protected int drawUnselectedText(Graphics graphics, int x, int y, int p0, int p1) throws BadLocationException {
Document doc = getDocument();
String text = doc.getText(p0, p1 - p0);
Segment segment = getLineBuffer();
SortedMap<Integer, Integer> startMap = new TreeMap<Int... |
9a87cfa0-9c7e-478e-8e60-ea5af141a3d7 | 1 | private double f(double b) {
double PrB=1, p=probLessThan(b);
for (int i = 0; i < futureBowls; i++) {
PrB*=p;
}
double PrA=1-PrB;
double ExA=exptGreaterThan(b);
double ExB=exptLessThan(b);
double Ex2=PrA*ExA+PrB*ExB;
return Ex2;
} |
5f254be0-e0ed-465a-b5bf-90754dd17003 | 9 | void compress(int init_bits, OutputStream outs) throws IOException {
int fcode;
int i /* = 0 */;
int c;
int ent;
int disp;
int hsize_reg;
int hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits =... |
6de8b03f-5753-4e9f-a0a4-f881532ec4d5 | 3 | public String insertionSort(String a) {
char[] arr = a.toCharArray();
char tmp;
int j;
for (int i = 1; i < arr.length; i++) {
tmp = arr[i];
j = i;
while (j > 0 && tmp < arr[j - 1]) {
arr[j] = arr[j - 1];
j--;
}
arr[j] = tmp;
}
return new String(arr);
} |
0b17a545-6637-4701-97b4-c024fccd50b8 | 5 | private void showWord(IIndexWord idxWord, IDictionary dict) {
StringBuffer sb = new StringBuffer();
sb.append("<html><body>");
if (idxWord != null) {
List<IWordID> wordIDs = idxWord.getWordIDs();
for (IWordID wordID : wordIDs) {
IWord word = dict.getWord(wordID);
sb.append("<h4>");
sb.append(w... |
66e07f07-f373-4584-ae14-943d86475af5 | 7 | private void foundStraight(Card firstCard) {
boolean add = false;
Card last = null;
for (Card card : hand) {
// Purposeful optimization
if (card == firstCard) {
add = true;
}
if (add) {
if (last == null || last.getRa... |
94c8939a-301d-4e5c-9f2d-48b96742c2da | 2 | public static void main(String args[]){
emailValidator = new EmailValidator();
for (String temp : validEmailIds) {
boolean valid = emailValidator.validateEmail(temp);
System.out.println("Email ID "+temp+" is valid? " + valid);
}
System.out.println("\n\n");
... |
8886ba20-723d-46fd-8eaa-f0ee7b4abf87 | 7 | private String parseTokenChecked(String str, int ichStart, int ichMax) {
int ich = ichStart;
char ch;
while (ich < ichMax && ((ch = str.charAt(ich)) == ' ' || ch == '\t'))
++ich;
int ichNonWhite = ich;
while (ich < ichMax && ((ch = str.charAt(ich)) != ' ' && ch != '\t'))
++ich;
ichNe... |
55d57b8f-4161-4b23-9585-212cc104a74a | 9 | public ArrayList<String> replaceObjects( ArrayList<String> tokenizedInput,
LanguageKeywords language ) {
// Acquire a temporary copy of the tokenized input to be filled with the new tokenize input
ArrayList<String> tempTokenizedInput = new ArrayList<String>();
// Acquire an iterator for the tokenized input
... |
cfbbaed8-8d5a-4c73-8352-4ca41ba6e51b | 7 | @Override
public void moveCustomerToSellerQueue(int currentPhase, Queue lineQueue,
ArrayList<TicketSeller> sellers) {
for(int j = 0 ; j < Define.theNumberOfTicketSeller && !lineQueue.isEmpty() ; j++){
TicketSeller tmpSeller = sellers.get(j);
if(tmpSeller.sellerQueue.isEmpty()){
int previ... |
7c17535d-e940-47f0-9b0d-fb03652f61df | 0 | public GridFactoryException(Exception e) {
super(e);
} |
e822c324-a953-4f86-8715-b6174c4be97d | 5 | @Override
public boolean equals(Object other)
{
if (!(other instanceof DecodedAudio))
return false;
DecodedAudio otherAudio = (DecodedAudio)other;
// Formats are unequal; so audio objects are not equal.
if (!(mFormat.equals(otherAudio.mFormat)))
return false;
// Number of channels are diff... |
ecaf88e6-076e-407e-9e5b-98907dad943c | 1 | public boolean delete(Administrador admin){
PreparedStatement ps;
try {
ps = mycon.prepareStatement("DELETE FROM Administradores WHERE userName=?");
ps.setString(1, admin.getNombre());
return (ps.executeUpdate()>0);
} catch (SQLException ex) {
Logg... |
63c82768-a1ba-438c-a267-5c080f140106 | 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... |
189c1b2a-8a7d-43f3-9fa9-46d1e5204dd6 | 5 | public static void setDisabled(Container c,
HashMap<Component, Boolean> wasEnabled, Component[] notEdit) {
List<Component> notEditList = null;
if (notEdit != null && notEdit.length > 0) {
notEditList = Arrays.<Component> asList(notEdit);
} else {
notEditList = new ArrayList<Component>();
}
Component... |
449dc61c-6e06-4942-b41f-2497d99f1103 | 6 | public static boolean checkHasGround(int x, int y, int z) {
if ( (x == 0) || (y == 0) || (z == 0) || (x == dimX-1) || (y == dimY-1) || (z == dimZ-1) )
return true;
return false;
} |
447858b4-76fe-471a-8222-abea7ced65d2 | 9 | public final void ChangeLang(){
if(!(TextStyles.containsKey("UserText")&&
TextStyles.containsKey("PwdText")&&
TextStyles.containsKey("ProfilesText")&&
TextStyles.containsKey("RememberMe")&&
TextStyles.containsKey("LoginBtn")&&
TextStyles.containsKey("ProfileFormat"))
){System.out.println("--*Theme Er... |
641c5fb6-3e4a-4855-92c2-efe2fb980e9c | 7 | public static Iterator allSupercollections(LogicObject self) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_ALL_SUPERCOLLECTIONS_MEMO_T... |
f2487623-74b2-4501-b9a7-7f77bac55f99 | 0 | static int readBlockSize(RandomAccessFile raf) throws IOException {
// read size
byte b[]=new byte[3];
MediaFileUtil.read_sure(raf,b);
return ((b[0]& 0xff)<<16) + ((b[1]& 0xff)<<8) + (b[2]& 0xff);
} |
9c5d334b-5d2e-4cfc-a417-47bfa0877515 | 4 | public void render(Graphics g) {
update();
g.setColor(color);
if (text == "Pistol" || text == "SMG" || text == "Shotgun"){
g.setFont(new Font(g.getFont().getFontName(), Font.BOLD, 20));
}
else g.setFont(new Font(g.getFont().getFontName(), Font.BOLD, 14));
if (text != null) {
g.drawString(text... |
0d186637-1442-4b1f-897f-b8cb75e6b0c6 | 5 | public List<PastMeeting> getPastMeetingList(Contact contact)
{
List<PastMeeting> result = new ArrayList<PastMeeting>();
PastMeetingImpl tempM = null;
PastMeeting tempPM = null;
try
{
if(!contactList.contains(contact))
{
throw new IllegalArgumentException();
}else{
for(Meeting m : meeting... |
559323db-5470-41fd-906b-468cc6a31e27 | 9 | private boolean redo() throws IOException, ParseException {
if (redoList.isEmpty()) {
messageToUser = MSG_CANNOT_REDO_ANYMORE;
return false;
}
ActionEntry ae = redoList.pop();
Action done = ae.getAction();
Task t = ae.getTask();
actionList.push(ae);
Command command = done.getCommand();
Task task ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.