method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f43a5a73-c6c4-4ac6-afcf-4ef72b844191 | 4 | protected static String getWord(final Map<Integer, Set<String>> words, int startIndex, int length) {
Set<String> wordsByIndex = words.get(startIndex);
if (wordsByIndex == null || wordsByIndex.isEmpty())
return null;
for (String word : wordsByIndex)
if (word.length() == le... |
cc13ddb2-ee85-4b98-8031-b0350f13541e | 7 | public boolean checkFrequency(Player player, double frequency) throws IOException{
File myFile = new File("plugins/CakesMinerApocalypse/frequencies.txt");
if (myFile.exists()){
Scanner inputFile = new Scanner(myFile);
String setFrequency = "";
while (inputFile.hasNextLine()){
String name = inputFile.ne... |
870f3ff8-79b8-4124-9da1-bebdbc4507ed | 9 | public long zkey(){
final int count = hm.get(zkey);
assert count >= 0;
long castleKey = 0;
if(!kingMoved[0] && !rookMoved[0][0]) castleKey ^= zhash.canCastle[0][0];
if(!kingMoved[0] && !rookMoved[0][1]) castleKey ^= zhash.canCastle[0][1];
if(!kingMoved[1] && !rookMoved[1][0]) castleKey ^= zhash.canCastle... |
36e75743-ee7b-43b6-b7d1-65dac6a793e2 | 1 | @Override
public void onEnable(){
loadConfig();
registerListeners();
registerCommands();
if(enable==false){
Bukkit.getPluginManager().disablePlugin(this);
}
dm = new DoorManager();
dm.startup();
new SignManager();
logger.info("[StarDoor] Plugin enabled!");
} |
19c6ad1c-5e3d-47a3-a125-90d867c6e6e5 | 6 | public void saveGame() {
System.out.println("What do you want the filename to be? This is used to load it.");
try {
mainfileName = cache.readLine();
} catch (IOException ex) {
System.out.println(ex.getMessage());
System.exit(-1);
}
System.out.p... |
c8375542-3855-4f10-ae33-29048836eae9 | 2 | private static void printSummary() {
GlobalOptions.err.println();
if (failedClasses.size() > 0) {
GlobalOptions.err.println("Failed to decompile these classes:");
Enumeration enum_ = failedClasses.elements();
while (enum_.hasMoreElements()) {
GlobalOptions.err.println("\t" + enum_.nextElement());
}
... |
613e7547-3026-4ea6-922b-0e3c1d7f095d | 9 | @Override
public int processMessage(String msg) {
String[] action = msg.split(":");
if(!players[player].getId().equals(action[0])) {
return 0;
}
if ( canPlay() ) {
String[] pos = action[1].split(",");
int x = 0, y = 0;
if ( pos.length !... |
2178b17a-df89-40e3-a2eb-561f3be0957d | 2 | public static final boolean isInt(Object value) {
return value != null && (value instanceof Integer || isNumber(value.toString()));
} |
73bb71aa-0b52-456f-9747-b406e6e4999d | 8 | public static void testsEvaluationMoyenne() {
double nbr = 0;
System.out.println("\n--------------------------------");
System.out.println("TESTS EVALUATION MOYENNE");
System.out.println("--------------------------------\n");
double eval;
System.out.print("Evaluation mo... |
c0d98a86-a403-4e0b-8176-84a859de8197 | 0 | public double getYCoordinate()
{
return yCoordinate;
} |
7d59e627-7fd3-43e7-ae9a-b3fb57895a1d | 9 | public SampleBuilderSpec<P> blanks2blanks(Map<BlankBuilderSpec<?>, BlankBuilderSpec<?>> blanks2blanks) {
verifyMutable();
if (this.blanks2blanks == null) {
this.blanks2blanks = new HashMap<BlankBuilderSpec<?>, BlankBuilderSpec<?>>();
}
if (blanks2blanks != null) {
for (Map.Entry<BlankBuilderSpec<?>, Blan... |
fa97f651-d884-4d6f-8602-3539f79627d4 | 6 | public Boolean isStageFinished(String jobID, Global.STAGE stage) {
int processedTask = getCommittedTask(jobID, stage).size();
if (stage == Global.STAGE.MAP )
logger.debug("Done " + processedTask + " maps, waiting for " + numSplits);
else
logger.debug("Done " + processedTask + " reduces, waiting for " + numR... |
88ca5d9f-73d5-427f-ae8e-3a06bf3e56e7 | 7 | private void fight() {
if (info.getRound() < 3) {
cpu.generateWeapon(1, info.getRound());
} else {
cpu.generateWeapon(difficulty, info.getRound());
}
int result = comparator.compare(user.getWeapon(), cpu.getWeapon());
if (!info.matchOver()) {
... |
bf22a163-5862-44cd-a42a-98ef3370831f | 8 | protected void undoAllQualifysList()
{
for(final String abilityID : reverseAbilityMap.keySet())
{
final Map<String, AbilityMapping> revT = reverseAbilityMap.get(abilityID);
final LinkedList<String> deleteThese=new LinkedList<String>();
for(final String ID : revT.keySet())
{
final AbilityMapping abl... |
38cb679d-111c-44d8-9b54-0de2a092ef0b | 9 | public static boolean getDataMaskBit(int maskPattern, int x, int y) {
if (!QRCode.isValidMaskPattern(maskPattern)) {
throw new IllegalArgumentException("Invalid mask pattern");
}
int intermediate, temp;
switch (maskPattern) {
case 0:
intermediate = (y + x) & 0x1;
break;
... |
0cfce5f2-a5cf-4cdc-abe5-0f21b6bc1a9e | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
// TODcoO add your handling code here:
StudentDao sd=new StudentDao();
sd.insertStudent("Holo hola","hele hele");
} catch (SQL... |
45eb7063-ffab-4ebf-a8b1-e8ba0cc4f0e0 | 4 | public static String run(String origCode){
String minifiedJS = "";
try {
BufferedReader br = new BufferedReader(new StringReader(origCode));
String ostr = null;
System.out.println("Original\n-----------------------");
while((ostr = br.readLine()) != null){
System.out.println(ostr);
}
Syste... |
6b39d7ad-3382-488d-9f4f-7dbdf651109f | 4 | public boolean touches(int x, int y)
{
if (
(x <= size)
&& (x >= 0)
&& (y <= size)
&& (y >= 0)
) {
return true;
}
return false;
} |
c9d2aa9e-e632-4cba-8f2e-88ea2a00e33c | 6 | SegmentTermEnum(IndexInput i, FieldInfos fis, boolean isi)
throws CorruptIndexException, IOException {
input = i;
fieldInfos = fis;
isIndex = isi;
maxSkipLevels = 1; // use single-level skip lists for formats > -3
int firstInt = input.readInt();
if (firstInt >= 0) {
// orig... |
58abcad4-4559-46e7-8443-1527a426c98a | 1 | @Override
public void render( Shader shader, RenderEngine renderingEngine )
{
shader.bind();
shader.updateUniforms( getTransform(), material, renderingEngine );
if ( resource != null )
draw();
} |
337b03c7-af14-48f6-b655-b18c0805dc94 | 3 | public static void print_card(int card) {
int r;
char suit;
String rank = "23456789TJQKA";
r = (card >> 8) & 0xF;
if ( (card & 0x8000) !=0 )
suit = 'c';
else if ( (card & 0x4000)!= 0 )
suit = 'd';
else if ( (card & 0x2000)!=0 )
... |
52b6c61d-1cd2-486b-9113-a60c579db0a9 | 9 | public static TypeCase getType(int typeCase) {
switch (typeCase) {
case 0:
return TypeCase.RIEN;
case 1:
return TypeCase.MUR;
case 2:
return TypeCase.CAISSE;
case 3:
return TypeCase.CAISSE_OK;
case 4:
return TypeCase.OBJECTIF;
case 5:
return TypeCase.MARIO_HAUT;
case 6:
return Type... |
9cde1153-c4fd-4e96-93c6-d841832135e9 | 5 | @Override
public void actionPerformed(ActionEvent e) {
JButton button = (JButton) e.getSource();
if (button == jbnChangePass) {
if (jtfNewPass.getText().equals("") || jtfConfirmNewPass.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Please, fill all empty fi... |
f706bb8d-3505-4521-814f-d6d9db2bc39c | 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();
... |
a3076b99-c27d-4911-b6eb-d1d4a57fa959 | 2 | public VariableStack mapStackToLocal(VariableStack stack) {
// first the try block.
VariableStack after = subBlocks[0].mapStackToLocal(stack);
for (int i = 1; i < subBlocks.length; i++) {
// now merge the catch blocks; they start on empty stack.
after = VariableStack.merge(after,
subBlocks[i].mapStackT... |
d33b8825-77b5-4601-8933-ad2b323e23fb | 8 | public BinaryStrings(double mutationRate, double recombinationRate,
int recombinationSplit, int maxMutations){
try{
if(recombinationRate > 1.0 || recombinationRate < 0.0){
throw new Exception("Crossover rate outside range 0.0-1.0");
}
this.recombi... |
bd81c890-d14b-4a21-8156-0a05ec355b07 | 6 | @Override
public Dimension getPreferredSize() {
if (isMaximized()) {
return new Dimension(getParent().getWidth(), getParent().getHeight());
}
int scrollBarWidth = Outliner.jsp.getVerticalScrollBar().getWidth();
int maxWidth = getParent().getWidth() - scrollBarWidth;
int maxHeight = getParent().getHeigh... |
ad20fca4-26d1-4b50-9eea-1513c43b79e7 | 1 | public void visitVarExpr(final VarExpr expr) {
if (expr instanceof LocalExpr) {
visitLocalExpr((LocalExpr) expr);
}
} |
1130cbb8-6b73-4991-a0fd-e8c9b9660fc5 | 6 | @Override
public double[] computeValue(final char refBase, FastaWindow window, AlignmentColumn col) {
double count = 0;
double varCount = 0;
if (col.getDepth() > 0) {
Iterator<MappedRead> it = col.getIterator();
while(it.hasNext()) {
MappedRead read = it.next();
if (read.hasBaseAtReferencePos(col.g... |
63fde46d-472e-450f-9eff-9003846843b1 | 9 | public void load(Minecraft mc, MinecraftClass mcClass)
{
minecraft = mc;
Class<?> clazz = mcClass.getClazz();
int i = 0;
try
{
if (hasParameters)
{
for (; i < paramNames.length; i++)
{
paramClasses[i]... |
a5dffe1d-5ab1-4c85-82e4-ae1d0765b4aa | 0 | @Test
public void pisteenSiirtaminenToimii() {
p.siirra(1, 1);
assertTrue("Väärä siirretyn pisteen x", p.getX() == 1);
assertTrue("Väärä siirretyn pisteen y", p.getY() == 1);
} |
ea03a7a0-2e64-495f-b45a-e28451a599c7 | 6 | public static double absDiffLog(double[] obs, double[] sim, double missingValue) {
sameArrayLen(obs, sim);
int N = obs.length;
double abs = 0;
for (int i = 0; i < N; i++) {
if (obs[i] > missingValue) {
double measured = obs[i];
double simulated... |
f8b1775f-64b5-4a98-aa7e-838b94e71834 | 1 | public static void stop(Component component) {
MouseCapture capture = MAP.remove(component);
if (capture != null) {
capture.mGlassPane.removeMouseListener(capture);
capture.mGlassPane.removeMouseMotionListener(capture);
capture.mGlassPane.removeHierarchyListener(capture);
capture.mGlassPane.setCursor(nu... |
f835e2db-8a96-4a4b-856c-a3bfb2461ae8 | 4 | public void fillData(){
for(String l: outLables){
AbstractUnit next = nextUnits.get(l);
for( AbstractUnit unit : units){
if(unit instanceof OutputPin){
if(((OutputPin)unit).name.equals(l)){
AbstractUnit pred = ((Out... |
dd9953dd-6eef-4c3a-8827-472d543dae80 | 4 | public Tile(int type) {
super();
this.type = type;
if(type == GRASS){
setImage(ImageLoader.GRASS);
}else if(type == DIRT){
setImage(ImageLoader.DIRT);
}else if(type == ROCK){
setImage(ImageLoader.ROCK);
}else if(type == WATER){
setImage(ImageLoader.WATER);
}
} |
7b4b4cdc-797a-4eda-b3c8-41ce2e3a64f2 | 9 | @SuppressWarnings("unchecked")
private void regroupe() {
int x = (int) log2(kmap.getColumn() * kmap.getRow());
ArrayList<KarnaughNode> array = new ArrayList<KarnaughNode>();
for (int i = 1; i < x + 1; i++) {
for (int j = 0; j < arrayList.size(); j++) {
for (int k = 0; k < arrayList.size(); k++) {
if ... |
161d2ece-7937-4cd7-9fdc-35e1b205a3fc | 2 | private static short matchVersionAndKey(String version, String key) {
/* If the version of the client sent with the handshake is incorrect this statement will trigger. */
if(!Database.getSettingsOption(DBConstants.SETTINGS_SERVER_VERSION).equals(version)) {
return ValidatedHandshakeResponse.CAUSE_INCORRECT_VE... |
9eb41011-534c-4317-b50d-4ce8cda7a0ab | 3 | public void guardarArchivoOrigen()
{
byte c[];
try
{
FileOutputStream file=new FileOutputStream("articulos.txt");
String n="~";
clsEnArticulo[] arreglo1=lista.toArray(this.arreglo);
c=n.getBytes();
file.write(c);
for(int... |
f1f9c706-60fa-442b-bcfa-fd991ea9fab2 | 9 | static final void method2312(int i, int i_14_, Deque class262,
int i_15_, AbstractToolkit var_ha) {
do {
try {
anInt4811++;
Class289.aClass262_3705.removeAll(125);
if (!Class348_Sub1_Sub1.aBoolean8805) {
for (Class348_Sub21 class348_sub21
= (Class348_Sub21) class262.getFirst(4);
class... |
c99d2139-3b67-4120-af48-bade985c162f | 9 | @Override
public void handlePacket(final Player p, int packetSize, int packetType) {
final String[] command = p.getInStream().readString().split(" ");
if (command[0].equals("tele")) {
try {
p.toX = Integer.valueOf(command[1]);
p.toY = Integer.valueOf(command[2]);
p.height = Integer.valueOf(command[3... |
7c530a18-b307-4b97-bad0-aa965d550241 | 5 | public static boolean cannotGrief(Player p) {
if(p.isOp()) {
return false;
}
if(RushPlugin.isGameRunning() && !RushPlugin.isGameFinished() && RushPlugin.isARushPlayer(p)) {
if(RushPlugin.getRushPlayer(p).isDisqualified())
return true;
else
return false;
}
else {
return true;
}
} |
6f0ed319-5863-44fc-8843-5d6e3fbe5df9 | 4 | private void renderUnit( Unit unit, int posX, int posY, int level ){
switch (unit.getLoyalty()){
case BLUE:
GL11.glColor3f(0.068f, 0.568f, 0.836f);
break;
case GREEN:
GL11.glColor3f(0.384f, 0.88f, 0.072f);
break;
... |
3e1ad881-e5a8-424c-b881-888a552f3a7e | 0 | public CommandSVCheat() {
super("Cheat", "svcheat", 1, "Allow cheating. This may disable game features.");
// TODO Auto-generated constructor stub
} |
899503d2-72d6-48d9-91b8-ed8a8bfa8e42 | 9 | public AddNewBookDialog(LibrarianView parent, Controller session) {
setResizable(false);
setTitle("Add New ");
this.parent = parent;
this.mySession = session;
listModelSubjects = new DefaultListModel<String>();
listModelAuthors = new DefaultListModel<String>();
ImageIcon img = new ImageIcon("res/library-i... |
aa2ac243-b245-4bb5-ad04-82159afddca5 | 0 | public void onStart(IContext context) throws JFException {
engine = context.getEngine();
indicators = context.getIndicators();
this.console = context.getConsole();
console.getOut().println("Started");
} |
3b79b07c-f600-4130-99dd-0eb05c7e54c0 | 1 | public void listarGerentes() {
UsuarioBO gerente = new UsuarioBO();
try {
tbResultadoBusca.setModel(DbUtils.resultSetToTableModel(gerente.preencheTabelaGerente()));
} catch (SQLException ex) {
}
} |
49da3a9c-15a5-4ca5-ada5-7495d38bd5c8 | 9 | private PrimitiveSite getCompatibleSiteFromTile(int row, int col,
PrimitiveType type) {
if ((row < 0) || (col < 0) || (row > rows - 1) || (col > cols - 1))
return null;
if (type == null)
return null;
PrimitiveSite[] sites = design.getDevice().getTile(row, col)
.getPrimitiveSites();
if (sites != nul... |
87713a8f-858f-4e22-88be-6a2dc6e5123e | 9 | @Override
public List<Map<String, ?>> datosTrabajador(String direccion, String dep, String area, String sec, String puesto) {
List<Map<String, ?>> Lista = new ArrayList<>();
String sql = "select * from ";
try {
if (!direccion.equals("")) {
sql += " RHVD_FILTRO_CON... |
e7608027-1570-4cd8-b863-5554dcee71ba | 3 | private boolean isVerOK() {
boolean retVal = false;
if (this.request.GetHttpVer().equals("HTTP/1.1") && this.request.getHeaderValue("Host") != null) {
retVal = true;
}
if (this.request.GetHttpVer().equals("HTTP/1.0")) {
retVal = true;
}
return retVal;
} |
f9f15200-391c-4fca-82e2-98c61288c9f6 | 8 | private void firstRun()
{
InputStream defStream = getResource("config.yml");
if(defStream != null)
{
java.io.Writer writer = null;
try
{
File configFile = new File(getDataFolder(), "config.yml");
if(configFile.createNewFile(... |
a4fa32e8-de09-40d8-9014-2d86f57de542 | 4 | public static void main(String[] args) throws IOException {
JLinkedListVector alv = new JLinkedListVector();
double [] arr = {0.5, 1.2, 5.5};
alv.addAll(arr);
System.out.println("Записываем вектор alv в символьный поток ");
Writer d = new PrintWriter(new FileOutputStream("C:\\us... |
04b04100-36cd-4697-a51f-44e7d65d5dd0 | 7 | public void testConstructor_int_int_int_Chronology() throws Throwable {
DateMidnight test = new DateMidnight(2002, 6, 9, GregorianChronology.getInstance());
assertEquals(GregorianChronology.getInstance(), test.getChronology());
assertEquals(TEST_TIME_NOW_LONDON, test.getMillis());
assert... |
bd404c1a-d585-4a87-9f6c-84dd22d67336 | 1 | public GenericDAO<Customer> getDAO() {
if (_customersDAO == null) {
_customersDAO = new GenericDAO(Customer.class);
}
return _customersDAO;
} |
8a76f7d2-f5c1-412d-b7af-a754eeaf023c | 2 | public boolean removeCensoredWord(String word) {
if (censoredWords == null) censoredWords = Lists.newArrayList();
if (!censoredWords.contains(word.toLowerCase())) return false;
censoredWords.remove(word.toLowerCase());
return true;
} |
d4f486b6-f3ec-419e-a340-2f204b42940a | 5 | @Override
public void execute(TransitionEvent event) throws Exception {
if(this.out == null) {
this.out = this.bean.getOut();
}
if(this.sender == null) {
send(Statics.RX_HELI_ACK);
initializeDataSender();
}
if(Statics.ACK.equals(event.getIdentifier())) {
Object parameter = event.getParamete... |
d0703215-c376-43ac-a90f-adbab84c8013 | 7 | @Override
public Sensor.Status readSensor(Sensor sensor) throws L8Exception
{
try {
Response response = this.client.get("/l8s/" + this.simul8torToken + "/sensor/" + sensor.getName());
if (response.getCode() == 200) {
JSONObject json = (JSONObject)response.getJSON();
if (sensor.equals(Sensor.TEM... |
426fe317-5a90-4c58-9ff0-e6190dcb11d2 | 4 | @Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof DHCPOption)) {
return false;
}
DHCPOption opt = (DHCPOption) o;
return ((opt.code == this.code) &&
(opt.mirror == this.mirror) &&
... |
e1d6cac4-efc5-45da-b151-774f5d4dea39 | 3 | public boolean notOnScreen() {
return ((xScreen + xmap + width) < 0)
|| (((xScreen + xmap) - width) > GamePanel.WIDTH)
|| ((yScreen + ymap + height) < 0)
|| (((yScreen + ymap) - height) > GamePanel.HEIGHT);
} |
57f530b7-027f-4783-a04e-5fdda4a3af35 | 5 | public static boolean isCacheSafe(Class<?> clazz, ClassLoader classLoader) {
Assert.notNull(clazz, "Class must not be null");
ClassLoader target = clazz.getClassLoader();
if (target == null) {
return false;
}
ClassLoader cur = classLoader;
if (cur == target) {
return true;
}
while (cur != null) {
... |
06b88c92-1cae-4506-9579-4a6cff1413a2 | 8 | public boolean compareOutputs(String unitTestName)
{
System.out.println("Comparing the outputs of Distributed query and local query for unit test cast : " + unitTestName);
BufferedReader br1 = null;
BufferedReader br2 = null;
try
{
br1 = new BufferedReader(new FileReader("unit_tests/" + unitTestName + "/o... |
38f97050-85e6-4929-9d32-5ccf646ee3f1 | 8 | public static int compare(String cp1, String cp2)
{
StringTokenizer p1 = new StringTokenizer(cp1, mxCellPath.PATH_SEPARATOR);
StringTokenizer p2 = new StringTokenizer(cp2, mxCellPath.PATH_SEPARATOR);
int comp = 0;
while (p1.hasMoreTokens() &&
p2.hasMoreTokens())
{
String t1 = p1.nextToken();
Stri... |
4ebf1b11-bc4d-4dba-a39d-1a6f5236dc46 | 4 | @Test
public void NotFoundTest() {
ArrayList<String> ingredient = new ArrayList<String>();
ArrayList<String> tool = new ArrayList<String>();
tool.add("fork");
ingredient.add("sugar"); //tomato
try {
DialogTest.currentDialog.updateState(null, ingredient, null);
} catch (WrongStateClassException e) {
/... |
84efaa94-6d58-4a50-b349-be601df93458 | 2 | public List<officeNode> getOffices() {
ArrayList<officeNode> offices = new ArrayList<officeNode>();
NodeList officeNodes = node.getChildNodes();
for (int i = 0; i < officeNodes.getLength(); i++) {
Node node = officeNodes.item(i);
if (node.getN... |
26c063bd-84b1-4510-b87a-1b078a1e88ef | 7 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < tile.sprite.SIZE; y++) {
int ya = y + yp;
for (int x = 0; x < tile.sprite.SIZE; x++) {
int xa = x + xp;
if(xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break;
if(xa <... |
5ced77b2-4f1e-4d13-944e-c787673b16bd | 9 | private boolean LockConflict(DataObj dataObj, BitSet bitset) throws DeadlockException, RedundantLockRequestException {
Vector vect = this.lockTable.elements(dataObj);
DataObj dataObj2;
int size = vect.size();
// as soon as a lock that conflicts with the current lock request is ... |
36e8ab5a-cec3-4e11-a615-922abcbff4e3 | 8 | public String bet(int minBet,int maxBet){
double avrgOppAPW = getAvrgOppAPW(match.holeCards.size());
if (avrgOppAPW != 0.0) {
double avrgOppWin = getAvrgOppWin(match.holeCards.size());
if (avrgOppAPW <= 0.35) {
if (avrgOppWin >= (match.stackSize / 4)) {
weight *= 1.5;
windowFactor *= 2;
}
... |
540418fb-f2a0-4ab5-8346-d6fa87f5d6ce | 2 | @Override
public StageFlipper init(StageFlipper nothing) {
SG = new SnakeGUI();
SG.render();
SG.achtungPanel.addKeyListener(this);
SG.startGame.addActionListener(this);
SG.startGame.addKeyListener(this);
SG.leaveGame.addActionListener(this);
while (loop) {
try {
String mess = receiveMessage();
... |
cc80b35b-96bc-4e7b-885d-a471e00bdb02 | 5 | public Customer getCustomer(int id) {
Customer cust = null;
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
41d81731-1c64-456d-96a7-8178ca6e581e | 3 | public ArrayList<Point> getMovingSqaures() {
ArrayList<Point> tmp = new ArrayList<Point>();
for (int i = 0; i < nbTilesY; i++)
for (int j = 0; j < nbTilesX; j++)
if (map[i][j] == 10)
tmp.add(new Point(j, i));
return tmp;
} |
f9264e8c-12cb-4d98-b213-b2cc2364630d | 4 | private List<Hex> getRandomTiles(List<Hex> defaultHexes) {
ArrayList<Hex> randomResources = new ArrayList<Hex>(defaultHexes);
List<String> randomNames = ModelDefaults.getDefaultResourceNames();
randomizeList(randomNames);
int desertIndex = randomNames.indexOf("desert");
int oldDesertChitValue = -1;
if(... |
a7b0667c-97cb-4940-8fe3-637e7eeb458a | 8 | private static Object getObjInstance(LuaState L, Class clazz)
throws LuaException
{
synchronized (L)
{
int top = L.getTop();
Object[] objs = new Object[top - 1];
Constructor[] constructors = clazz.getConstructors();
Constructor constructor = null;
// gets method and argume... |
9ded1f71-82ed-45f8-adc4-ac6bfcc6f2b3 | 3 | void assignBalWeights( double[][] A )
{
edge e;
e = depthFirstTraverse( null );
while ( null != e )
{
if ( e.head.leaf() || e.tail.leaf() )
e.WFext(A);
else
e.WFint(A);
e = depthFirstTraverse( e );
}
} |
dbed2f9f-71ee-420b-a28a-daf016a5094b | 7 | private void igualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_igualActionPerformed
y=Double.parseDouble(cuadro.getText());
numero="";
if(signo=='+')
{
resp=x+y;
cuadro.setText(resp+"");
}
if(signo=='-')
... |
11d217d1-ef38-413d-97eb-a8536a4cae85 | 8 | private void createDragTypes(Composite parent) {
parent.setLayout(new GridLayout());
Button textButton = new Button(parent, SWT.CHECK);
textButton.setText("Text Transfer");
textButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (Button)e.widget;
if... |
695cf886-7739-45d5-a03c-e7956f5b327b | 7 | public boolean isValidPosition()
{
//Si el jugador que no tiene el turno se encuentra
//en jaque la posición no es valida
if(getTurn() == Colour.WHITE)
{
if(isInCheck(Colour.BLACK))
return false;
}
else
{
if(isInCheck(Colour.WHITE))
... |
79ea430e-f8e5-4d24-9cb0-835b29533229 | 1 | public void method474(int i) {
int k = Model.modelIntArray1[i];
int l = Model.modelIntArray2[i];
for (int i1 = 0; i1 < vertexCount; i1++) {
int j1 = yVertex[i1] * l - zVertex[i1] * k >> 16;
zVertex[i1] = yVertex[i1] * k + zVertex[i1] * l >> 16;
yVertex[i1] = j1;
}
} |
72ae0782-2655-4970-bcd4-d12d905f2ef5 | 0 | public Main() {
super("Base64 Encoder / Decoder");
setLayout(new GridLayout());
setResizable(false);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
quit();
}
});
add(new Panel());
pack();
setLocationRelativeTo(null);
setVisible(... |
8b6c484c-8f80-4813-97fe-9925b4739f47 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
list = new AppetizersDao();
} catch (SAXException ex) {
Logger.getLogger(addItemToAppetizerMenu.class.getName()).log(Level.SEVERE, null, ex);
} catch (Par... |
3da76c50-e629-4511-93d9-01d342acf7c9 | 6 | protected ObjectEntry(String name, String type, ObjectStateFactory facto, SyncStrategy syncStrat) {
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("name is null or empty");
}
if (type == null || type.isEmpty()) {
throw new IllegalArgumentException("type is null or empty");
}
if... |
8fb08f4f-080a-4b64-bdb5-6ed0f8fcd2fb | 4 | @Override
public void setTransient(Registry rg) {
super.setTransient(rg);
try {
for (String key : placeables.keySet()) {
Placeable placeable = (Placeable) placeables.get(key);
//convert town halls to cabins
if (placeable.getType().equals(... |
afad7d39-fe97-4a21-9a54-2b66aa59926c | 9 | public void run() {
logger.entering("run", this);
began_at = System.currentTimeMillis();
final byte[] buffer = new byte[bufferSize];
int cursor = 0;
boolean input_ended = false;
final Timer in_timer = new Timer(), out_timer = new Timer();
try {
while (... |
2266c42c-0bff-4da3-97ab-69f1e2c93c4d | 2 | public Expression simplify() {
if (value == 1) {
int op = (getOperatorIndex() == OPASSIGN_OP + ADD_OP) ? INC_OP
: DEC_OP;
return new PrePostFixOperator(getType(), op, getLValue(), isVoid())
.simplify();
}
return super.simplify();
} |
048c9bb3-a79f-4f65-9054-b6b8f88dd021 | 3 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
String username = params.get("username");
String passwordClear = params.get("password");
String fullName = "";
String email = "";
if(params.containsKey("fullName")) full... |
883952f6-7fd7-49d0-9a69-af327851508c | 3 | @Override
public String toString() {
String result;
//Terminal?
if (isTerminal()) {
result = "\n\t\t\t\t\t<t";
for (Map.Entry<String, String> attribute : attributes.entrySet()) {
result += " " + attribute.getKey() + "=\"" + StringEscapeUtils.escapeXml(attribute.getValue()) + "\"";
}
result += "/>... |
b90e8ca9-fe14-4954-9174-c9c1f6e43af6 | 7 | @Override
public void KeybindTouched(KeybindEvent e) {
if(selection != -1) {
get(selection).setSelected(true);
if(e.getKeybind().clicked()) {
switch(e.getKeybind()) {
case UP:
changeSelection(0);
break;
case RIGHT:
changeSelection(1);
break;
case LEFT:
chan... |
891876aa-f9be-42a3-b0ea-cc198887d92a | 1 | public static boolean name(String name){
if(name.matches("[A-Z][a-z]{2,30}"))
return true;
return false;
} |
6434e165-d45a-45c3-8c57-c69e5c5bd69f | 2 | @Override
public void caseAExprest(AExprest node)
{
inAExprest(node);
if(node.getExp() != null)
{
node.getExp().apply(this);
}
if(node.getComma() != null)
{
node.getComma().apply(this);
}
outAExprest(node);
} |
ac7cf5a1-7f56-4f77-a230-25cd51dcb52b | 4 | public void checkSenseCollision(){
for(Character character : characters){
if(character instanceof EnemyCharacter){
EnemyCharacter enemy = (EnemyCharacter) character;
Ellipse2D.Double area = enemy.getArea();
if(area.intersects(player.getBounds()) ){
if(!enemy.hasDetectedPlayer()){ // I... |
b116aff4-79d6-4b37-b45e-10c40bdbe66c | 4 | public Square getSquare(int x, int y) throws IndexOutOfBoundsException
{
if ( (x < 0) || (y < 0) || (x >= gridSize) || (y >= gridSize))
throw new IndexOutOfBoundsException("Square coordinates must be inside grid. X: "+x+", Y: "+y);
return squares[x][y];
} |
38876ed5-bf48-44d9-9c43-6ce9fa50cad4 | 2 | public void createApp() throws IOException
{
int cNum = numOfApps;
Scanner in = new Scanner(System.in);
System.out.println("What is the App's name?");
String n = in.nextLine();
System.out.println("What is the App's de... |
59eb52f3-5650-40c8-9fbf-11a571fe59c1 | 9 | public void ConnectExistingBalloons()
{ /* BEGIN ConnectExistingBalloons*/
mass_Geometry ();
if (BallList.size()>0)
{
Balloon B = (Balloon)(BallList.get(0));
contacts = new int[N][max_n0];
for (int i=0;i<N;i++) { for (int j=0;j<B.n0;j++) { contacts[i][j] = -10; } } // no contact
}
else { IJ... |
52984ce8-ce5e-4e3f-8945-cb490587c889 | 5 | public void savePlayers(Gold gold, Elixir elixir, DarkElixir darkElixir, Gems gems, Trophies trophies) {
for (String player : gold.getGold().keySet()) {
this.$getPlayers().set("player." + player + ".gold", gold.getGold(player));
}
for (String player : elixir.getElixir().keySet()) {
this.$getPlayers().set... |
7c903f81-7dde-4d9d-a915-02ab89f63c2d | 1 | @Override
public void notifyObservers() {
Iterator it = observerVector.iterator();
while (it.hasNext()){
((Observer)it.next()).update();
}
} |
346b6065-b886-4f81-b2dd-589898d0e622 | 5 | public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
// set line attributes
gc.setLineWidth(20);
gc.setLineCap(SWT.CAP_ROUND); // round line ends
gc.setAntialias(SWT.ON); // smooth jagged edges
Pattern pattern = null;
if (foreground.... |
9ad93edb-7da4-4b2d-a610-719c2491619b | 5 | private void rechercherPostesVisibles(){
for(Poste poste : postes){
poste.initialiserPostesVisibles() ;
for(int orientation = Orientation.NORD ; orientation <= Orientation.NORDOUEST ; orientation += 1){
Position positionCible = Position.voisin(poste.getPosition(),orientation) ;
if(Position.estPositionVa... |
dc0fd887-d158-4cb1-8f62-e55a2e54d0c1 | 4 | @Override
protected void paintComponent(Graphics g) {
int viewWidth = getWidth();
int viewHeight = getHeight();
Model m = model;
int modelWidth = m.getWidth();
int modelHeight= m.getHeight();
int sizeX = viewWidth / modelWidth;
int sizeY = viewHeight / modelHeight;
g.setColor(Color.WHITE);
g.fi... |
7299f6b1-0106-4dac-ae92-b0a7acc4ea70 | 9 | public Boolean start() {
Boolean mameFound = false;
try {
createFiles();
boolean b = Boolean.valueOf(FileIO.readSettingsFile(settings,
"use_system_mame"));
String systemPath = FileIO.readSettingsFile(settings,
"system_mame_path");
if (b && !systemPath.equals("null")) {
mameFound = true;
... |
efad8d59-6d09-49af-938e-05ce01f9e496 | 2 | @Override
public void recibirMensaje(Mensaje mensaje) {
if (!updateIdsList.find(mensaje.getIdentifier())) {//busca que el mensaje no se haya recibido anteriormente
updateIdsList.append(mensaje.getIdentifier()); //agrega el identificador del mensaje
if (mensaje.getTarget() == this.id)... |
a768029e-c47a-421c-b525-16a192d48710 | 5 | public static void main(String args[]) {
//VARIABLES
int nums[] = {99, -10, 100123, 18, -978, 5623, 463, -9, 287, 49};
int a, b, t;
int size;
size = 10;
//DISPLAY ORIGINAL ARRAY
System.out.print("Original array is:");
for (int i = 0; i < size; i++)
... |
b6492cc1-5afb-4ef0-96a2-74f0577a7512 | 9 | private MoveEvalScore alphabeta(BoardMove node,int depth, int hole, MoveEvalScore alpha, MoveEvalScore beta)
{
//if depth = 0 or node is a terminal node
//display("AlphaBeta called \ndepth: " + depth);
if(depth == 0 || Kalah.gameOver(node.getBoard()))
{
//heuristic value of node
MoveEval... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.