method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5ea5e4b0-81e1-48b9-9bdd-f441d79f21fe | 0 | public void afficherComptesRendus(){
CtrlPrincipal ctrlP = new CtrlPrincipal();
ctrlP.action(EnumAction.COMPTESRENDUS_AFFICHER);
} |
a1a3fbdf-ad26-4f16-bd36-78b76365063a | 8 | private Player getPlayer(String target, CommandSender searcher) throws BadPlayerMatchException {
final List<Player> players = new ArrayList<Player>();
for (final Player player : plugin.getServer().getOnlinePlayers()) {
if (searcher instanceof Player && !((Player) searcher).canSee(player)) ... |
b8e81acb-b6d3-4e0f-91bc-4139bc821765 | 9 | private static boolean isPrime(int n) {
if (n < 10) {
return n == 2 || n == 3 || n == 5 || n == 7;
}
if (n % 2 == 0 || n % 3 == 0)
return false;
int end = (int) Math.ceil(Math.sqrt(n));
for (int i = 5; i <= end; i += 6)
if (n ... |
f4a54381-496c-4dd7-9bc5-7c7ebadcc70b | 0 | public void update(int id, TravelTrip travelTrip){
travelTripDao.update(id, travelTrip);
} |
d226fac8-51f6-43eb-9be0-a28fc7731033 | 0 | public void clearBreakpoint() {
breakpointSet = false;
} |
53f41cd5-32d6-44b0-8d7f-894c200d8da9 | 3 | private boolean isColWin(int col){
if(model.getField().getCell(col, 0)==Field.DEFAULT_VALUE) return false;
if(model.getField().getCell(col, 0) == model.getField().getCell(col, 1) &&
model.getField().getCell(col, 0) == model.getField().getCell(col, 2))
return true;
els... |
6ed28b06-3291-4abf-a434-9ec5728b8788 | 4 | @Override
public Object get(long i)
{
if (ptr != 0) {
short objLen = objectLengths.getShort(i);
if (objLen < 0) return null;
long offset = sizeof * i * maxObjectLength;
for (int j = 0; j < objLen; j++) {
byteArray[j] = Utilities.UNSAFE.getB... |
94bcf038-615c-4822-9605-de503ee9140b | 2 | protected static String getStringOutputLine(String titel, String referenz, JSONObject obj) throws JSONException,
IOException {
if (obj.has(referenz)) {
if (obj.get(referenz).toString().length() < 35) {
return titel + ": " + obj.get(referenz) + "\n";
} else {
// JSONObject childobj = fetchObject(refer... |
2b8a14f8-6705-4ee7-a245-4a60be314a4b | 8 | public static Move[] possibleMoves(Board bd, int col){
Move[] possibleMoves = new Move[500];
Chip[] currentChips = bd.getCurrChips(col);
int counter = 0;
int x = 0;
Move currMove;
//ADD moves
if(bd.getPieces(col) < 10){
for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
currMove = ne... |
aa5b692c-f81b-4385-8997-86c81aba695c | 3 | public static void main(String[] args) {
/*
1
12
123
1234
1234
12345
*/
for(i=1;i<=10;i++)
{
if(i%2!=0) {
for(j=1;j<=i;j++)
System.out.print(j);
System.out.println("");
}
{
}
}
} |
287970f3-0303-498f-ba75-ec1202dc14ca | 8 | @Test
public void testMultiThreadedBehaviorIsFair() throws InterruptedException {
simpleTestSetup();
final AtomicInteger www1 = new AtomicInteger(0);
final AtomicInteger www2 = new AtomicInteger(0);
final AtomicInteger www3 = new AtomicInteger(0);
int numThreads = 100;
Thread[] threads = new Thread[numThr... |
2ff2fafd-01ae-427e-8ee4-5d8ee4549151 | 8 | public void visit_lstore(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_lstore);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... |
13c025ae-396c-4f52-be35-693bfc9bc68f | 8 | private boolean parseExample(BufferedReader reader,
Collection<RankInput> exampleInputs,
Collection<RankOutput> exampleOutputs) throws DatasetException,
NumberFormatException, IOException {
// List of items of this query. Each item is a list of features.
LinkedList<LinkedList<Integer>> items = new LinkedLi... |
e478f38a-d8ec-4af0-89b9-c9c0be3e61f6 | 9 | @Override
public VersionAlgorithm createAlgorithme(final String line) {
if (isEmpty(line.trim())) {
return new IdentityAlgo();
}
final StringTokenizer tokenizer = new StringTokenizer(explodeLine(line), BLANK_SPACE);
final List<AlgoNode> nodes = new ArrayList<AlgoNode>();
... |
2dc9c593-d0f0-4743-83e6-33d4ba334ede | 2 | private String getOtherPlayerId(List<String> ids, String cId) {
String result = "";
for (String id: ids){
if (!id.equals(cId)){
result = id;
break;
}
}
return result;
} |
7014dff8-4062-443c-bdd8-320cf4ccb4ea | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=(givenTarget instanceof MOB) ? givenTarget : mob;
if(target==null)
return false;
if(!(target instanceof MOB))
{
mob.tell(L("You can't cast this spell on that."));
... |
964f8542-778a-4980-b023-3b5feb35176f | 4 | public void remove(Activity activity) throws InstanceNotFoundException {
boolean found = false;
Iterator<Activity> iter;
Activity aux;
iter = activities.iterator();
while (iter.hasNext() && !found) {
if ((aux = iter.next()).equals(activity)) {
found = true;
activities.remove(aux);
Persistence.g... |
cbaac3f6-6a96-491d-a8fd-89fd75947f23 | 8 | protected void checkBuffer(){
int touch = _buffer.indexOf("Touch");
int end = _buffer.indexOf("End");
Matcher m = _pattern.matcher(_buffer.toString());
if(touch != -1){
//System.out.println("Touch");
_buffer.delete(0, touch+ "Touch".length() + 1);
_touched = true;
}
else if (m.find()) {
... |
2e1c6a6c-ca63-407d-a21a-3533f7c1d163 | 1 | public void drawPanel2() {
panel2 = new JPanel();
panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS));
registerPanel = new JPanel();
registerPanel.setMaximumSize(new Dimension(400, 400));
registerPanel.setAlignmentX(CENTER_ALIGNMENT);
registerPanel.setAlignmentY(TOP_ALIGNMENT);
registerPanel.s... |
1864bae7-0824-4598-96ce-3e5bad5d545e | 3 | public int compareTo(Gaussian that) {
if(this.equals(that))
return 0;
else if(this.norm2() == that.norm2())
return this.argument() > that.argument()? 1: -1;
else
return this.norm2()-that.norm2();
} |
76730904-518e-4e3c-867e-fe61c5bd9cdf | 1 | private void initTablasClientes(){
tabCli = (DefaultTableModel) tablaClientes.getModel();
clientes = taller.searchClientes("");
tabCli.setNumRows(clientes.size());
for(int i=0; i<clientes.size(); ++i){
tablaClientes.setValueAt(clientes.get(i).getNombre(), i, ... |
bbe65ae4-4d89-47da-8e88-82d775b3dae3 | 2 | public void setZoom(double zoom) {
this.zoom = zoom;
if (zoom < 0.1) {
this.zoom = 0.1;
} else if (zoom > 90.0) {
this.zoom = 90;
}
} |
66d12e02-c5bd-413d-8be7-c52d0adcb9b6 | 1 | static public String composeApiCommand(String function, Object... arguments) {
StringBuilder apiCmd = new StringBuilder(256);
apiCmd.append('(');
apiCmd.append(function);
for (Object arg : arguments) {
apiCmd.append(" ");
apiCmd.append(DefaultCycObject.stringApiValue(arg));
}
apiCmd.... |
6e3db749-9ba4-4223-b961-1c9fcb92fca7 | 2 | private String obten_tabla_usuarios(String login) {
ConexionBD con = new ConexionBD();
ArrayList<String[]> usuarios = con.buscaNombreLogin(login);
String tabla = "";
tabla += "<center><table style=\"width:100%\" id=\"tablaResultado\">\n"
+ " <tr>\n"
... |
77ad3701-9649-492c-a452-f7c270a7cc1f | 0 | public ArrowAction(Game game, String cmd) {
this.game = game;
this.cmd = cmd;
} |
bcc261a3-7346-4e9c-9422-d474f618666f | 1 | public static void saveBound() throws FileNotFoundException,
UnsupportedEncodingException {
PrintWriter w = new PrintWriter(boundFile, "UTF-8");
for (int i = 0; i < 4; i++) {
w.println(poolUpperBound[i]);
w.println(poolLowerBound[i]);
}
w.close();
} |
a6fbf43a-c5da-45b2-9969-2c9de1675e24 | 7 | private String generateReply(String message) {
String[] s = message.split("\\s+");
String reply = message.replaceFirst(s[0], " ").trim();
switch (s[0]) {
case ("LOWERCASE"):
reply = reply.toLowerCase();
break;
case ("UPPERCASE"):
... |
cf7e7df0-5812-41d8-9f01-3a6f2108a991 | 8 | final int method3785(int i, int i_253_) {
anInt7682++;
if ((i ^ 0xffffffff) == -5122 || i == 5120)
return 1;
if (i_253_ != 4)
((OpenGlToolkit) this).aBoolean7793 = false;
if (i == 5123 || i == 5122)
return 2;
if (i == 5125 || i == 5124 || (i ^ 0xffffffff) == -5127)
return 4;
throw new IllegalA... |
0639beb5-5d10-4643-bb30-fc7e5c6289fd | 4 | public void loadLegend(String legendFile) throws FileNotFoundException, BadConfigFormatException {
//setup filereader and scanner
FileReader reader = new FileReader(legendFile);
Scanner scan = new Scanner(reader);
String temp = null;
//loop through to add rooms
while( scan.hasNextLine() ) {
if( scan.has... |
c84532a0-a7d0-4ba0-acc9-99e1411ecee8 | 0 | public void set(Unit ally, Unit enemy)
{
this.type = 1;
this.ally = ally;
this.enemy = enemy;
//might want to render hp/mp values to 100 before loading so the bars decrease to current hp/mp instead of random
allyBar[0].set(ally.getHPRatio());
allyBar[1].set(a... |
cc86158f-9f56-475b-b773-283daa9c9bb8 | 6 | @Override
public Candidato inserir(IEntidade entidade) throws SQLException {
if (entidade instanceof Candidato) {
Candidato candidato = (Candidato) entidade;
PessoaDao pdao = new PessoaDao();
pdao.inserir(candidato);
String sql = "INSERT into candidato ("
... |
e3c3353b-1baa-4985-8b30-333fd565ed72 | 9 | public void executeTask() {
Validator valid = new Validator();
List<String> invalidValues = null;
if (isModifyAction()) {
} else {
String COURSE_TYPE = getSelectedCourse().getType();
if(getSelectedStudentRegisteredCourse()==null){
showError("To s... |
683462bd-1f4c-4dbe-a8f6-2424332d7133 | 6 | */
public void iniciar() {
/* 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://download.ora... |
b3cb8eee-17aa-4a74-9801-72591c354a28 | 2 | public static int getCriticalityByName(String name, List<Partition> lop) {
for (Partition p : lop) {
if (p.getName().equals(name))
return p.getCriticality();
}
return -1;
} |
b42f46ff-4f6f-4ce9-ad10-c25ebcb68e07 | 3 | public void applyPreserveRule(IdentifierMatcher preserveRule) {
if (preserveRule.matches(this)) {
System.err.println("preserving: " + this);
setReachable();
Identifier ident = this;
while (ident != null) {
ident.setPreserved();
ident = ident.getParent();
}
}
for (Iterator i = getChilds(); i... |
7f2018e0-1d5d-41b3-a2c8-bdf5cb21abb5 | 7 | protected DrawableTree readFile(BufferedReader buf) throws IOException, FileParseException {
StringBuffer treeString = new StringBuffer();
int parenDepth = 0;
char[] c = new char[1];
boolean reading = false;
DrawableTree tree;
while( buf.read(c) > -1) {
if (reading) {
treeString.append(c);
if ... |
24abbf78-a249-419c-9c56-1981be24b747 | 7 | @Override
public void undo() {
// Shorthand
Node youngestNode = ((PrimitiveUndoableMove) primitives.get(0)).getNode();
JoeTree tree = youngestNode.getTree();
if (isUpdatingGui()) {
// Store nodeToDrawFrom if neccessary. Used when the selection is dissconnected.
OutlineLayoutManager layout = tree.getDocu... |
3aad489c-8784-4f32-89d0-bae2c5dab2d2 | 0 | public void countDimmension()
{
width = (y2Coordinate - yCoordinate);
height = (x2Coordinate - xCoordinate);
} |
04202d5d-7ba7-46da-b9c4-c4fbcf058220 | 3 | private static int method187(int arg0, int arg1) {
if (arg0 == -1) {
return 12345678;
}
arg1 = arg1 * (arg0 & 0x7f) / 128;
if (arg1 < 2) {
arg1 = 2;
} else if (arg1 > 126) {
arg1 = 126;
}
return (arg0 & 0xff80) + arg1;
} |
39677d40-f70b-418e-871b-4fc700287c69 | 3 | private ArrayList<Card> easyStrategy(ArrayList<Card> cards) {
ArrayList<Card> toExchange;
do {
toExchange = new ArrayList<>();
for (int i = 0; i < cards.size(); i++) {
if (random.nextBoolean()) {
// losuj karte o indeksie i
... |
3b51650a-58f6-45f7-8a17-573cdd65647f | 8 | private JsonNode getLastTrackNode() {
JsonNode result = null;
// setup API url
URI uri = null;
try {
uri = getApiUri().addParameter("method", "user.getrecenttracks").addParameter("user", config.getUser())
.addParameter("api_key", config.getApiKey()).addParameter("format", "json")
.addParameter("li... |
9a879573-4118-4bc3-a9f3-ec1cf062e954 | 3 | private void addIcon(String path, String filename, String trueFilename, boolean disabledVersion){
try{
ImageIcon icon = null;
if(!cache.containsKey(trueFilename)){
if(disabledVersion){
ImageIcon baseicon = new ImageIcon(getClass().getResource(pat... |
a4a3bfe2-59e6-4e83-9698-d32c12d5920e | 7 | public static void removeLineFromFile(String file, String lineToRemove)
{
try
{
File inFile = new File(file);
File tempFile = new File(inFile.getAbsolutePath() + ".tmp");
BufferedReader br = new BufferedReader(new FileReader(file));
PrintWriter pw = new PrintWriter(new FileWriter(tempFile))... |
1ae89c41-fd85-45e4-9822-f62acd5e5479 | 1 | static void waitClerkButton(int id) {
long sleep = (long)(Math.random() * 60000);
try {
Thread.sleep(sleep);
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
2a9fe67e-6846-4820-a375-fca1de170b9b | 0 | public DataCalc(DataStructures dataIn, int numberOfPoints){
this.dataIn = dataIn;
this.numberOfPoints = numberOfPoints;
} |
39ebf2c6-9627-4e0a-ace0-0c7952a5b5d5 | 1 | public Double getExpressionValue() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException {
if(hasBeenEvaluated) {
return this.expressionValue;
} else {
return calculateExpressionValue();
}
} |
a142dcd7-46fa-4e12-a5bb-d193b273b1be | 9 | @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 Department)) {
return false;
}
Department other = (Department) object;
if ((this.idDepartment == null && other.... |
acebcb3e-a3ed-4382-bf82-8d7794b862bd | 5 | private void addMTWCs(MTWData data, int x, int y, int dx, int dy) {
// Create set of tuples with coordinates - with annoying syntax
Set<Tuple<Integer, Integer>> set = new HashSet<Tuple<Integer, Integer>>();
// Trace in the given direction and it's opposite direction
Tuple... |
fe0ed504-cbc2-40aa-ba87-a39502c9ba88 | 9 | private void resolveConflict(int row, int column, ArrayList<HumanAgent> humans,
ArrayList<ZombieAgent> zombies) {
final double zombieDefaultWinLoseRatio, zombieWinLoseRatioAgainstArmedHuman,
zombieKillInfectRatio, humanKillEscapeRatio;
dou... |
bdc417e2-2506-4318-b8cd-2bb3ffb06d94 | 0 | @Override
public String getColumnName(int column) {
return columnNames.get(column);
} |
13b39a6b-a44e-4ce0-89e3-df35d518f373 | 6 | private List<FSQEvent> processEventData(List<FSQEvent> events, List<Foursquare> fsqData) throws ParseException {
// TODO Auto-generated method stub
List<FSQEvent> list=new ArrayList<FSQEvent>();
try {
for (Foursquare fsq : fsqData) {
JSONObject eventJson=new JSONObject(fsq.getData());
long dateEpoch=... |
7d4e10be-62b8-440a-9c78-5fd921f0c470 | 6 | private boolean add() throws UnsupportedEncodingException {
if(addStoreName == null || addStoreName.isEmpty())
return false ;
if(addStoreAddr == null || addStoreAddr.isEmpty())
return false ;
String tempName = new String(addStoreName.getBytes("ISO-8859-1"),"UTF-8") ;
Session se = HibernateSessionFactor... |
38fa728b-d973-477d-9fc1-a79053188899 | 2 | public static List<TileSprite> autoConstructSprites(Image[][] image) {
List<TileSprite> sprites = new ArrayList<TileSprite>();
for(int y = 0 ; y < image.length ; y++) {
for(int x = 0 ; x < image.length ; x++) {
sprites.add(new TileSprite(image[x][y]));
}
}
return sprites;
} |
c4bdabad-e3a0-4486-9abd-858391f8b120 | 2 | public void close() {
EIError.debugMsg("Closing");
if (serverSocket != null) {
try {
sendData("goodbye");
serverSocket.close();
} catch (IOException e) {
//oh well, ain't no thang
}
}
keepRunning = false;... |
d0dddbd9-5a1f-4f31-8b89-f24ae743848c | 5 | @Override
public PersonInterface createPerson() {
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
/* save all arguments into an array */
Object[] args = new Object[0];
Class<?>[] argsType = new Class<?>[0];
PersonInterface ret = null;
try {
ret = (PersonInterface)super.... |
637742d1-18dc-4c27-b0f5-871f1227b175 | 9 | * @return Cons
*/
public static Cons listModules(boolean kbOnlyP) {
if (kbOnlyP) {
{ Cons value000 = Stella.NIL;
{ Module m = null;
Iterator iter000 = Stella.allModules();
Cons collect000 = null;
while (iter000.nextP()) {
m = ((Module)(iter000.value));
... |
4224b67b-305f-4e91-9155-dff392e793f1 | 7 | private void scaleByMax() {
//ammendment to what i may have commented before
//this takes the lowest x and highest x and uses that as the scaling
//factor
double l_x = 5000,h_x = -5000;
for (int noa = 0;noa < m_groupNum;noa++) {
if (l_x > m_groups[noa].m_left) {
l_x = m_groups[noa].m_left;
... |
00d1041e-f0b5-4b78-a0ea-46c95fef3d15 | 6 | public void fill(int x, int y, int bw, int bh, int color){
//Fills in a colored rectangle of width = bw, heigth = bh
int x0 = x;
int x1 = x + bw;
int y0 = y;
int y1 = y + bh;
if (x0 < 0) x0 = 0;
if (y0 < 0) y0 = 0;
if (x1 > this.width) x1 = this.width;
if (y1 ... |
a1df4e6d-06d5-4853-b0d0-ff2605863900 | 3 | @Override
public void deleteUser(UserDTO user) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(user);
session.getTransaction().commit();
}... |
50dd31fa-fd19-46e5-b00b-ede542144567 | 8 | public void update(boolean force) {
//boolean DEBUG= false;
if (isDirty() || force) {
if (statusLineExist()) {
statusLine.setRedraw(false);
// NOTE: the update algorithm is non-incremental.
// An incremental algorithm requires that SWT item... |
b0094013-f89f-4404-b74b-f319729af3fa | 8 | public double imposeForces() {
double[] forces = new double[DIMENSIONS];
sumError = 0.0;
for (int j = 0; j < numberOfTerms; j++) {
Term term = terms.get(identifiers[j]);
Arrays.fill(forces, 0); //initialize result
double[] coord = term.getPosition(); //get coords for distance
int ar... |
2c7bb64d-8952-4a11-9388-b914fd212966 | 4 | private void genMj(int itemId) {
int itemRatedNumber = DataInfo.itemlist[itemId].length; //项目被评过分的个数
if (itemRatedNumber == 0) {
for (int j = 0; j != DataInfo.featureNumber; j++) {
DataInfo.itemFeature[itemId][j] = 0;
}
return;
}
int[] columnIndexes = new int[itemRatedNumber];
doub... |
75bd0edd-170b-44af-a2f6-5079160cc7b9 | 7 | @Command(cmd = {"ftc", "fairytailcraft", "ft", "fairytail"},
firstArg = {"mymagics"})
public boolean returnSenderMagics(CommandSender sender, String cmd, String[] args) {
if (sender instanceof Player) {
Player sent = (Player) sender;
String magic = Util.getPlayerConfig(sent).getM... |
e83171cb-f623-469d-89bb-818518a66fb3 | 0 | public static void main(String[] args) {
Integer n1 = 129;
Integer n2 = 129;
System.out.println(n1 == n2);
System.out.println(n1 != n2);
// Do this for String
} |
daf57b53-5f2a-49dc-96da-61cc1c42f4b6 | 4 | private void decodeEntries() {
int entryCount = data.getReferenceTableSmart();
ids = getIds(entryCount);
addEntries();
if (hasIdentifiers())
decodeEntryIdentifiers();
decodeCrcs();
if (hasUnknown2())
decodeUnknown2();
if (hasWhirlpool())
decodeWhirlpools();
if (hasUnknown1())
decodeUnknown1(... |
5ecbecdf-e13c-4cfd-9e9a-d790d7da6503 | 9 | @Override
public boolean process(Player player) {
if (ingredients == Ingredients.TORSTOL && otherItem.getId() != VIAL) {
if (!player.getInventory().containsOneItem(15309)
|| !player.getInventory().containsOneItem(15313)
|| !player.getInventory().containsOneItem(15317)
|| !player.getInventory().cont... |
8b0b978c-3849-4508-abae-26a4aecb934b | 9 | public int nextInt() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
int result;
if (p == PEEKED_LONG) {
result = (int) peekedLong;
if (peekedLong != result) { // Make sure no precision was lost casting to 'int'.
throw new NumberFormatException... |
762de5f5-9261-496b-83c7-f50cba87bf86 | 4 | public String postRequest(String request, String uri, String data) {
StringBuffer response = new StringBuffer();
try
{
String url = uri;
java.net.URL obj = new java.net.URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//add request h... |
e2c627c1-9469-4807-b45c-278cb70d3a32 | 7 | private final void method291(int i, int i_1_,
ByteBuffer class348_sub49) {
if ((i ^ 0xffffffff) != -2) {
if (i == 2) {
((Class22) this).anInt331
= class348_sub49.getShort();
if (((Class22) this).anInt331 == 65535)
((Class22) this).anInt331 = -1;
} else if ((i ^ 0xffffffff) != -4) {
if ... |
2dc10eb0-0e4e-40e5-8e91-fcd1d12f2671 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((center == null) ? 0 : center.hashCode());
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result +
((lightColor == null) ? 0 : lightColor.hashCode());
result = prime ... |
72e3bf56-9ccc-4b9d-9138-1fc8dcb2d37b | 7 | private Object getValeur(int index, String nom) throws Exception {
Object res;
JComponent champ = listeChamps.get(nom);
int type = listeAttributs.get(index).getType();
try {
switch (type) {
case Constantes.INTEGER : res = strToInt(((JTextField)champ).getText()); break;
case Constantes.DOUBLE : res = str... |
bae11d8f-21ae-4b66-b108-51b402a28070 | 0 | public teacher getT1() {
return t1;
} |
6271bf6d-680d-4a97-98be-41d35133f13a | 4 | public void update() {
checkTileMapCollision();
setPosition(xtemp, ytemp);
if(dx == 0 && !hit) {
setHit();
}
animation.update();
if(hit && animation.hasPlayedOnce()) {
remove = true;
}
} |
1bc9e8bd-52f4-415a-bc14-a1dac458d1c5 | 1 | @Test(timeout = 1000)
public void randomQuestion() throws Exception {
ExcSet excSet = Jcp1ExcSet.getInstance();
QuestionGeneratorImpl rnd = new QuestionGeneratorImpl(excSet);
Set<Class> wasQuestionClass = new HashSet<>(4);
while (wasQuestionClass.size() != 4) {
Question q... |
cf0ccbcb-11a1-4a1f-91a7-d4c8af35cd7a | 3 | private String request(String url, String... params) {
String per_page = params.length > 0 ? params[0] : "none";
String page = params.length > 1 ? params[1] : "none";
String label = params.length > 2 ? params[2] : "none";
url = this.url + "/tickets.json?auth_token=" + this.auth_token
+ "&per_page=" + per_pa... |
d3f2a39b-1f84-4e82-a0b1-4c247a7f69b7 | 8 | public static int[] getScanTable(int dim, boolean zigzag)
{
switch (dim)
{
case 4 :
return (zigzag == true) ? ZIGZAG_SCAN_4x4 : MORTON_SCAN_4x4;
case 8 :
return (zigzag == true) ? ZIGZAG_SCAN_8x8 : MORTON_SCAN_8x8;
case 16 :
return (zigzag... |
2c504ec9-d5ec-476f-86aa-fad0a44193a9 | 2 | public void saveItem(ItemStack toSave, ConfigurationSection configSection, String searchPrefix) {
if (toSave != null && toSave.getItemMeta() != null) {
configSection.set(searchPrefix + "name", toSave.getItemMeta().getDisplayName().replace(ChatColor.COLOR_CHAR, '&'));
configSection.set(se... |
83a74aad-1462-41f1-b63b-a7cc59cf5f67 | 0 | private void jComboBoxSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxSearchActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxSearchActionPerformed |
593cfae1-a8c2-4f8a-86fb-9717161049b3 | 0 | private static void oldJavaWay() {
Collections.sort(users, new Comparator<User>() {
public int compare(User u1, User u2) {
return u1.id.compareTo(u2.id);
}
});
printListOldWay("by ID");
Collections.sort(users, new Comparator<User>() {
... |
38e500df-85b2-4987-89f1-c803c6aa2488 | 8 | public String checkConjecture(Automata<String> automata) {
if (!this.automata.equals(automata)) {
String[] charAlphabet = new String[alphabet.size() - 1];
for (int i = 1; i < alphabet.size(); i++) {
charAlphabet[i-1] = alphabet.get(i);
}
for (int j = 1; j < 5; j++)... |
6c0d68f3-52c3-45e4-8a63-3e8e849ca2f2 | 1 | @Override
public void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
;
g = (Graphics2D) graphics;
// super.paintComponent(graphics);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
R... |
1c65cf24-5863-4000-9d5c-9f738d5c819d | 2 | private BeanstreamApiException handleException(Exception ex, HttpsURLConnection connection) {
String message = "";
if (connection != null) {
try {
int responseCode = connection.getResponseCode();
message = responseCode+" "+connection.getContent().toString();
... |
9e519d29-43d1-43eb-86fd-678e88c0977e | 8 | private static void addSomeMetadata(BufferedReader reader,
BufferedWriter writer,
HashMap<String, List<RawDesignMatrixParser>> metaMap,
HashMap<String, MBQC_SampleParser> mbqcSampleMetaMap) throws Exception
{
writer.write("fromRDPsampleID\tmbqcSampleID\tr1OrR2\thasLookup\tmbqcID\twetlabID\twetlabExtr... |
932bd4b3-e899-4634-84f3-ed324045b262 | 5 | WordDefinition getWord(Token t) throws CompileError {
switch( t.type ) {
case DOUBLE_QUOTED_STRING:
return new ConstantValue(t.text);
default:
Matcher m;
if( (m = DEC_INT_PATTERN.matcher(t.text)).matches() ) {
return new ConstantValue(Long.valueOf(("-".equals(m.group(1)) ? -1 : 1) * Long.parseLong(m.... |
9fdf88a5-3013-4cc5-a76f-610ceb6fd111 | 9 | public Properties toProperties() {
Properties ret = new Properties();
if (applicationUri != null) {
ret.setProperty(APPLICATION_URI, applicationUri);
}
if (applicationTarget != null) {
ret.setProperty(APPLICATION_TARGET, applicationTarget);
}
St... |
4a840d11-0e1c-45d8-8bf5-c60f1f65681f | 5 | public void run()
{
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
lastTimer = System.currentTimeMillis();
double i1 = 0;
while (running == true)
{
long now = System.nanoTime();
i1 += (now - lastTime) / nsPerTick;
... |
94c7c3f8-1100-43cc-ac48-66aa4aba2c29 | 1 | @Override
public List<ValidateException> validate(String parameter) {
List<ValidateException> validateExceptionList = new LinkedList<>();
final int passportNumberLength = 8;
if (!ValidateUtils.stringLengthValidation(parameter, passportNumberLength)) {
String exMsg = "entered wro... |
56911dfa-c851-4e75-8387-81dd9f6e20db | 7 | public void loadData(String filePath, Long offset, Long count) throws RemoteException{
log("loadData(" + filePath + ", " + offset + ", " + count);
if(working>0 || workQueue.size()>0){
throw new RemoteException("Work queued for loaded data, cannot load new data");
}
Runnable t... |
ee9fe57a-811a-4ca8-aeaf-a3c9606df6d2 | 7 | public ContrastDialog(final Panel panel) {
setBounds(1, 1, 270, 230);
Toolkit toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel panR = new JPanel();
pan... |
6fa1f2d6-e130-4680-b97d-645bd82feba2 | 1 | @Override
protected String fetchArticleHtml(HtmlPage page, List<IResource> resources) {
HtmlDivision articleDiv = page.getFirstByXPath("//div[contains(@class,'nopaddings')]");
HtmlElement head = page.getFirstByXPath("/html/head");
StringBuilder newHtml = new StringBuilder();
newHtml.... |
6cebf2f4-e7bb-4bc5-aebc-df3c0d693158 | 2 | public void endElement(String namespaceURI, String localName, String rawName)
{
if(Debug.debugLevel() >= 5)
{
Debug.println("End of element received:", 5);
Debug.println(" Namespace URI: " + namespaceURI, 5);
Debug.println(" Local Name: " + localName, 5);
Debug.println(" Raw Name: " + rawName, 5);
... |
257b8b46-677a-4542-a85b-2c5aa9a43928 | 3 | public PanelBiseccion(){
c1Field = new JTextField(5);
c2Field = new JTextField(5);
expField= new JTextField(5);
c3Field = new JTextField(5);
aField = new JTextField(5);
bField = new JTextField(5);
errorField = new JTextField(5);
c1Label = new JLabel("Coeficiente del termino cuadratico");
expLa... |
22f02fe4-9e01-4774-a871-cb808a431e16 | 7 | private boolean ruleInvocation(final int pos) {
boolean change = false;
for(int i = pos; i < chart.size(); i++) {
final Edge e = chart.get(i);
if(!e.isActive()) {
for(final String lhs : grammar.withLeftmost(e.lhs)) {
for(final String[] rhs : grammar.rhs(lhs)) {
if(!rhs[... |
c9500306-0487-4c8d-a40e-35c80258eaa1 | 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... |
9fe25754-5ecf-4c66-9682-32d76340e509 | 2 | public Boolean teamIsWipedOut(String matchName, String teamName){
try {
cs = con.prepareCall("{call GET_TEAMNAME_AND_ALIVECOUNT(?,?)}");
cs.setString(1, matchName);
cs.setString(2, teamName);
ResultSet rs = cs.executeQuery();
if(!rs.next()){
return true;
}
} catch (SQLException e) {
... |
cac43260-ee0a-4b72-9bc3-5e3a023abcf7 | 5 | @Override
public boolean isValid(File file) {
// Get the extension of the file
String filename = file.getName();
int seperatorIndex = filename.lastIndexOf(EXTENSION_SEPERATOR);
String extension = "";
if (seperatorIndex > 0) {
extension = filename.substring(seperatorIndex + 1,filename.length());
}
... |
1550d8a8-d680-459e-8724-776d842cafb4 | 0 | public static EnvironmentFrame frameForEnvironment(Environment environment) {
return (EnvironmentFrame) environmentToFrame.get(environment);
} |
f31fda2f-b1b1-4ada-88cf-1f8f16cdce04 | 1 | public String getUserStringWithURL(boolean isNewpage) {
StringBuilder sb = new StringBuilder();
sb.append("<a class=\"link-style-dominant\" href=\"/QuizWebsite/userpage.jsp?id=");
sb.append(userID + "\"");
if (isNewpage) {
sb.append("target=\"_blank\"");
}
sb.append(">" + username + "</a>");
return sb.... |
362d58b2-1a41-430c-939f-61522fef7cfe | 8 | @Override
public void spring(MOB mob)
{
final MOB invoker=(invoker()!=null) ? invoker() : CMLib.map().deity();
if((!invoker.mayIFight(mob))
||(invoker.getGroupMembers(new HashSet<MOB>()).contains(mob))
||(CMLib.dice().rollPercentage()<mob.charStats().getSave(CharStats.STAT_SAVE_TRAPS)))
mob.location().show... |
e2051c6a-9e35-4381-8c52-fbb65dffa619 | 9 | public static String getFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
FileInputStream in = new FileInputStream(filename);
Exception exception = null;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in,"UTF-8"));
Exception innerEx... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.