method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2cb0e102-e753-4b59-9ac1-60696bc103ab | 6 | @EventHandler
public void onRespawn(PlayerRespawnEvent e) {
if(RushPlugin.isGameFinished()) {
e.getPlayer().teleport(RushPlugin.getPodiumLoc());
e.getPlayer().setGameMode(GameMode.ADVENTURE);
}
else {
Player p = e.getPlayer();
RushPlayer rp = RushPlugin.getRushPlayer(p);
if(!e.isBedSpawn() && Rush... |
fdca065e-f565-4535-be7f-fa8ab8fe59e5 | 9 | public int search(int[] A, int target) {
int l = A == null ? 0 : A.length;
if (l == 0) return -1;
int low = 0, high = l - 1;
while (low + 1 < high) {
int mid = low + (high - low) / 2;
if (target == A[mid]) {
return mid;
} else if (A[mi... |
a1033871-976a-4015-b57d-f3fa6b1dd655 | 9 | public void setQuestionState() {
frame.question.setText(Client_Loader.currentQuestion);
frame.question.setVisible(true);
for(int i = 0; i < frame.categories.length; i++) frame.categories[i].setVisible(false);
for(int i = 0; i < frame.questions.length; i++) frame.questions[i].setVisible(f... |
47230932-8d1b-4a15-b7b2-e8a548f6d43e | 4 | public static void main(String[] args) {
boolean[] grid = new boolean[2000001];
for(int i = 2; i < Math.sqrt(2000000)+1; i++)
{
for(int j = 2*i; j < 2000000; j=j+i)
{
grid[j] = true;
}
}
long res = 0;
for(int i = 2; i < 2000000; i++)
{
if(!grid[i])
{
res += i;
System.ou... |
9640d536-e011-486c-9104-c9104c6dbd53 | 7 | private static SortedMap<String, String> createParameterMap(final String queryString) {
if (queryString == null || queryString.isEmpty()) {
return null;
}
final String[] pairs = queryString.split("&");
final Map<String, String> params = new HashMap<>(pairs.length);
for (final String pair : pairs) {
if... |
52f5a2dc-a866-400b-be32-bcf5dfbf5c9b | 4 | @Override
public double[] simulateBlockedOvershoot(AbstractStochasticLotSizingProblem problem,
AbstractStochasticLotSizingSolution solution)
throws ConvolutionNotDefinedException, SolvingInitialisiationException {
//Check the inputs
if (problem.getPeriods().length != solution.getAmountVariableValues().len... |
cef1aced-f212-4631-8db5-05cf7407841b | 9 | @SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent e) {
if (log.isDebugEnabled())
log.debug("Method call. Arguments: " + e.getActionCommand() + " "
+ e.getSource());
try {
if ("AddGroup".equals(e.getActionCommand()))
... |
a0a7d4e5-2043-46b5-b6dc-a0e6fd50eae1 | 0 | public void setLast(Items last) {
this.last = last;
} |
dc70f269-deae-4e11-8093-2393a1acce61 | 6 | public int jump(int[] nums) {
if (nums == null || nums.length == 0) {
return 0;
}
int[] step = new int[nums.length];
step[nums.length - 1] = 0;
for (int i = nums.length - 2; i >= 0; i--) {
int min = step[i + 1];
for (int j = 2; j <= nums[i]; j++) {
if (i + j < nums.length && step[i + j] < min) {... |
cdf918d2-ac89-4a5f-89ea-7f00ca1e514d | 4 | public void writeKnownAttributes(GrowableConstantPool gcp,
DataOutputStream output) throws IOException {
if (lvt != null) {
output.writeShort(gcp.putUTF8("LocalVariableTable"));
int count = lvt.length;
int length = 2 + 10 * count;
output.writeInt(length);
output.writeShort(count);
for (int i = 0;... |
85ba5f75-43fd-4cb3-84b4-698eb94b3641 | 0 | public static String removeFormattingAndColors(String line) {
return removeFormatting(removeColors(line));
} |
12223919-6ed5-4f8c-8088-442b2e31abf5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Snake other = (Snake) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (s == null) {
if (other.s != nu... |
03c0c6cf-1d88-4a50-8f93-8a0720dd04ce | 1 | public void buildApp(int fn)
throws IOException
{
FileReader fr = new FileReader(appDir+fn+".txt");
BufferedReader textReader = new BufferedReader(fr);
int numberOfTextLines = 3;
int numberOfNumberLines = 2;
String[] textData = new String[numberOfTextLines];
int[] numberData = new int... |
c558dcff-14f1-4dcf-a77b-dccc39bab29a | 5 | public Wave15VermillionGym(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 275; i++){
if(i < 175){
if(i % 2 == 0)
add(m.buildMob(MobID.VOLTORB));
else
add(m.buildMob(MobID.MAGNEMITE));
}
else{
if(i % 7 == 0)
add(m.buildMob(MobID.RAICHU));
else if (i % 2 == 0... |
19ac86dc-c108-4efe-b74a-55512c90103a | 0 | public String getName() {
// The assetName is the name of the asset's file.
return assetPath.substring(assetPath.lastIndexOf('/') + 1, assetPath.lastIndexOf('.'));
} |
d3003a2b-7513-494f-91a0-dc4cbcdc374d | 7 | public Process getNextProcess(Integer processor)
{
Process currentProcess = runningProcesses.get(processor);
if(currentProcess != null)
{
Integer timeRemaining = currentProcess.getTimeRemaining(),
timeTotal = currentProcess.getTimeTotal();
Boolean pree... |
b7b54c45-efd3-49de-b76e-e2c985fc3f04 | 2 | private void setupImages() {
String[] imageNames = {"bishop_black.png","bishop_white.png","king_black.png","king_white.png","knight_white.png","knight_black.png","pawn_black.png","pawn_white.png","queen_black.png","queen_white.png","rook_white.png","rook_black.png"};
for(String name:imageNames)
{
BufferedIm... |
034be57b-db64-43f0-af8b-a08c6863bc8b | 0 | public void startLiveWindowMode() {
_led.setRaw(0);
_table.addTableListener("Value", _listener,
true); // immediateNotify
} |
4cef5b0a-4cb1-41ac-954f-b08d9645e75c | 0 | public TileType getType() {
return type;
} |
9ad99d1f-ee5e-4adb-9231-5f01b83f1ec3 | 9 | @Override
public void actionPerformed(ActionEvent e) {
if ("pause".equals(e.getActionCommand())) {
if (paused == false) {
paused = true;
pauseButton.setText("resume");
pauseButton.setToolTipText("Resume Simulation");
} else {
paused = false;
pauseButton.setText("pause");
}
reverseBut... |
f05d0990-cffc-4a47-a06e-617b6a409463 | 7 | protected void doPrintHeader() {
if (m_Header.classAttribute().isNominal())
if (m_OutputDistribution)
append(" inst# actual predicted error distribution");
else
append(" inst# actual predicted error prediction");
else
append(" inst# actual predicted error");
if (... |
eed7569b-3d19-4257-ab69-9270d452749f | 0 | public void setPostalCode(String postalCode) {
PostalCode = postalCode;
} |
c93dba27-343e-4bfd-92ab-acb08330c95b | 1 | public void setCollideBehaviour(CollideBehaviour cb) {
if(cb == null)
throw new IllegalArgumentException("Illegal CollideBehaviour.");
this.collideBehaviour = cb;
} |
11ef16f0-7119-4e3b-99f0-e59762d02dcb | 5 | private boolean contains(Iterable<Class<?>> classes, Class<?> clazz) {
for (Class<?> c : classes)
if (clazz.isAssignableFrom(c))
return true;
return false;
} |
cb694ed7-d4a4-4af4-be28-c1859daadf76 | 7 | public String toString() {
String s = super.toString();
switch (useFlag){
case USED:
s += "[pos: " + String.valueOf(resolvedPosition) + "]"; //$NON-NLS-2$ //$NON-NLS-1$
break;
case UNUSED:
s += "[pos: unused]"; //$NON-NLS-1$
break;
case FAKE_USED:
s += "[pos: fake_used]"; //$NON-NLS-1$... |
a4f0ed1c-5c9c-493d-894b-e59160043f34 | 2 | public void showError(Throwable t, String resource) {
String text;
try {
text = resources.getString(resource + ".text");
} catch (MissingResourceException e) {
text = resources.getString("error.text");
}
String title;
try {
title = resources.getString(resource + ".ti... |
e0eaec52-5c3b-48c1-8205-162370ca6fa3 | 3 | @SuppressWarnings("deprecation")
@Override
public void run() {
// TODO Auto-generated method stub
try {
while((message = reader.readLine()) != null && !message.equals(".")) {
System.out.println("Client received message: " + message);
controller.MessageReceived(message);
}
} catch (IOExcep... |
62ad63a9-cad7-4fe2-9237-b8a0cea60b1a | 0 | private RoboBase() {
robots = new Hashtable<String, Robot>();
} |
16e8dbc4-7bcd-483b-bf1a-41d264d96e53 | 5 | @Around("execution(* ProfileServiceImpl.unshareProfile(..))")
public void aroundUnshare(ProceedingJoinPoint joinPoint) throws Throwable{
ProfileServiceImpl profileService = (ProfileServiceImpl)joinPoint.getTarget();
Object [] args = joinPoint.getArgs();
System.out.println(args[0] + " unshares the profile to " ... |
f9901cc7-6301-4c8f-92c8-1cd308aa0e23 | 2 | @Override
public int getLockReadCount(String objectType) {
int result = 0;
String lockStart = objectType + lockSeparate;
for (int i = 0; i < readLocks.size(); i++) {
String lockName = readLocks.get(i);
if (lockName.startsWith(lockStart)) result++;
}
return result;
} |
9ec6f141-0cb2-427b-8531-3db814ca8458 | 7 | protected String getCommonSuperClass(final String type1, final String type2) {
Class<?> c, d;
ClassLoader classLoader = getClass().getClassLoader();
try {
c = Class.forName(type1.replace('/', '.'), false, classLoader);
d = Class.forName(type2.replace('/', '.'), false, cla... |
0675da51-2d12-42ca-8d54-18bc3cdd5dab | 8 | public static String to_stems(String str){
Stemmer s = new Stemmer();
String ret="";
InputStream in = new ByteArrayInputStream( str.getBytes() );
char[] w = new char[501];
try
{ while(true)
{ int ch = in.read();
if (Character.isLetter((char) ch))
{
... |
e2773407-4a22-4791-b3d0-c95e518ce2ff | 7 | static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... |
0767ad03-8c05-47a4-8799-974949c2d6ec | 8 | public ListNode sortList(ListNode head) {
if(head == null || head.next == null){
return head;
}
ListNode h1 = head;
ListNode d1 = new ListNode(0);
d1.next = head;
ListNode p = head, pp = d1;
while(p != null && p.next != null){
pp = pp.next... |
88e04c5b-090d-44ef-b400-201df64c98f6 | 4 | private static void findAll(Object cmp, Map<String, Access> ins, Map<String, Access> outs, Notification ens) {
Class cmpClass = cmp.getClass();
Class infoClass = infoClass(cmpClass);
for (Field f : infoClass.getFields()) {
try {
if (f.getAnnotation(In.class) != null) ... |
f341df86-2a8d-4871-a791-d018a53f3bf0 | 9 | public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int firstNum;
int secondNum;
int evenSum; //holds the sum of the even numbers
int oddSquareSum; //holds the sum of the squares of the
//odd numbers
//get input from user
System.out.print("Pleas... |
23dbae0f-ffd1-4f74-a4d8-3bdfd8e1be3d | 9 | @Override
protected void processElement(final XMLStreamReader reader,
final Ulice item) throws XMLStreamException {
switch (reader.getNamespaceURI()) {
case NAMESPACE:
switch (reader.getLocalName()) {
case "Geometrie":
Utils... |
6bd4f9b2-adda-4c0a-8d70-dd03a10867c3 | 0 | public static void truncate(String tableName) throws SQLException {
PreparedStatement statement = connect.prepareStatement(" truncate `" + tableName + "` " );
statement.executeUpdate();
} |
508ed583-ca2c-4467-b9ac-571846c636b6 | 7 | void radb4(int ido, int l1, final double cc[], double ch[],
final double wtable[], int offset)
{
final double sqrt2=1.414213562373095D;
int i, k, ic;
double ci2, ci3, ci4, cr2, cr3, cr4;
double ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
int iw1, ... |
1117eb0c-3365-44dc-a71b-b2ce47d67ab3 | 4 | public static void benchmarkPriority() {
List<String> results = new ArrayList<String>();
for (int i = 0; i <= 0; i+=1) {
int nonPrefCount = 0;
for (int j = 0; j < 10; j++) {
ProblemDefinition problem = benchPriority(i,50);
SolverState state = bench... |
7db516a8-d1cb-426f-8cd8-8301b1060c4a | 0 | public static void Library() {
currentRoomName = "Library";
currentRoom = 5;
RoomDescription = "After taking one step into the badly lit room, the big wooden doors slam behind you from a gust of " +
"warm wind. There is no light switch and the room has a stench of old books. There is a door at the end of the... |
8e074813-b529-45af-abb6-ef37643011f9 | 8 | private double closest(Point2D[] pointsByX, Point2D[] pointsByY, Point2D[] aux, int lo, int hi) {
if (hi <= lo) return Double.POSITIVE_INFINITY;
int mid = lo + (hi - lo) / 2;
Point2D median = pointsByX[mid];
// compute closest pair with both endpoints in left subarray or both in right ... |
db3245c0-be93-441e-96af-497059894c48 | 9 | protected void insertCell(Object cell, Object parent) {
Object mxCell = null;
GraphModel jModel = jgraph.getModel();
Object value = jModel.getValue(cell);
if (jModel.isEdge(cell)) {
mxCell = graph.insertEdge(parent, null, value, null, null);
if (edges == null) {
edges = new Hashtable<Object, Object>()... |
16d2496f-8d86-476e-a94b-3d9219ad2a16 | 0 | public String readLabel() {
return label;
} |
1677cd32-0d4f-435b-b88d-658d1c8617fa | 6 | public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
Input input = gc.getInput();
// Clear the key-pressed record.
input.clearKeyPressedRecord();
// If the user presses up or down, scroll through the high scores.
if (input.isKeyDown(Input.KEY_DOWN)){
dy++;
}
... |
5c26f487-a771-42b4-b51a-c23c78af3c94 | 7 | static final public void operadores_relacionais() throws ParseException {
trace_call("operadores_relacionais");
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMPARACAO:
jj_consume_token(COMPARACAO);
break;
case DIFERENTE:
jj_consume_token(DIFERENTE);
break... |
2bf636c0-3831-4aa5-81a0-671003c923a3 | 9 | private void setVisibilityFlags2(BitSet bs) {
int displayModelIndex = viewer.getDisplayModelIndex();
boolean isOneFrame = (displayModelIndex >= 0);
boolean showHydrogens = viewer.getShowHydrogens();
for (int i = atomCount; --i >= 0;) {
Atom atom = atoms[i];
atom.shapeVisibilityFlags &= (~JmolConstants.ATO... |
adaad619-ad82-4273-89d1-dc3492a15261 | 6 | public void initDNA(int mutationMod, Actor... parents) {
//
// First, if required, we sample the genetic material of the parents-
final boolean free = parents == null || parents.length == 0 ;
final char material[][] ;
if (free) material = null ;
else {
material = new char[parents.length][... |
d90a47e3-8d68-4edb-bc65-016a2989b37d | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
701e3034-acf1-4968-a998-7529b5cc51c0 | 1 | public Class<?> contextType() {
return contextType;
} |
1ca0c8d9-43c1-4af4-aa3f-229ad9df603f | 1 | public static String hash(String password, String salt) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-512");
md.reset();
//muutetaan message digestin algoritmilausetta lis��m�ll� siihen suola muutettuna merkkijonosta bin��riin.
md.update(salt... |
a84bfa42-8f44-4df2-8840-c3d387d40073 | 4 | public GamePanel() {
super();
// build the score box
buildScoreAmmo();
setLayout(null);
// build the fire button
buildButtons();
// make your ship
pirateShip = new Ship();
// make all of the clouds
... |
e9d9eb89-86ca-4bf0-a5b3-6a30efdd8ca2 | 1 | public void testToStandardSeconds_overflow() {
Duration test = new Duration(((long) Integer.MAX_VALUE) * 1000L + 1000L);
try {
test.toStandardSeconds();
fail();
} catch (ArithmeticException ex) {
// expected
}
} |
7de05bef-701c-409a-b522-8a69144fc17a | 3 | public void execute()
{
switch(selectedItem)
{
case 1:
marioWorld.newGame();//reset
marioWorld.setWhatcha(Doing.SELECTSTAGE);
break;
case 2:
MarioData marioData = loadAndSave.load();
marioWorld.se... |
b95c4e5f-55b1-452a-a122-d10abaa6dd8d | 4 | public static void main(String[] args) {
// create two guitar strings, for concert A and C
double CONCERT_A = 440.0;
double CONCERT_C = CONCERT_A * Math.pow(1.05956, 3.0);
GuitarString stringA = new GuitarString(CONCERT_A);
// GuitarString stringC = new GuitarString(C... |
dcf41926-b7bd-44c8-a091-a5dded3c09e8 | 2 | private void siftDown(int pos) {
if (2 * pos >= size)
return;
else {
int maxIndex = getMaxInd(2 * pos, 2 * pos + 1);
if (heap[maxIndex] > heap[pos]) {
swap(maxIndex, pos);
siftDown(maxIndex);
}
}
} |
43e7223f-3037-4198-b3d2-9712e953e487 | 5 | @Override
public void caseAVardecl(AVardecl node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(VarDecl");
inAVardecl(node);
if(node.getType() != null)
{
node.getType().apply(this);
}
if(node.getIdentifi... |
3167585f-2972-447b-8b47-c97b93ab87bd | 4 | public boolean generate(World var1, Random var2, int var3, int var4, int var5) {
for(int var6 = 0; var6 < 64; ++var6) {
int var7 = var3 + var2.nextInt(8) - var2.nextInt(8);
int var8 = var4 + var2.nextInt(4) - var2.nextInt(4);
int var9 = var5 + var2.nextInt(8) - var2.nextInt(8);
... |
afedbc80-c441-42b3-929a-fb97fc2a4f5c | 7 | public int sub_search(int[] A, int l, int r, int t) {
if (l > r)
return -1;
int m = l + (r - l) / 2;
if (A[m] == t)
return m;
if (A[m] >= A[l]) { // 左边有序
if (t < A[m] && t >= A[l])
return sub_search(A, l, m - 1, t);
return sub_search(A, m + 1, r, t);
}
// 右边有序
if (t > A[m] && t <= A[r])
... |
c608364d-d1ab-44cb-8895-b97b1c8ec734 | 3 | public static Appointment create(long initiatorId, String name,
long venueId, long startTime, long endTime, String info,
int frequency, long lastDay, long[] aWaitingId) throws SQLException {
int freqHelper = Appointment.computeFreqHelper(frequency, startTime);
Appointment rtn = new Appointment();
rtn.init... |
fb7f1b9d-1187-4604-a776-77076dc81130 | 0 | @Test
@Ignore
public void runTestReflection3() throws IOException {
InfoflowResults res = analyzeAPKFile("Reflection_Reflection3.apk");
Assert.assertEquals(1, res.size());
} |
be5c1e76-ac5b-4321-acca-c266210b9688 | 0 | public Pawn(char n, int x, int y, Board board) {
this.letter = n;
this.x = x;
this.y = y;
this.board = board;
this.hitpoints = 2;
this.gold = 0;
} |
fe905f14-7b12-4d13-845d-269386537762 | 7 | @Override
public void run() {
while (this.keepRunning()) {
readCommand("jServe >");
try {
if (cmdl.startsWith("shell")) {
if (cmdl.equals("shell")) {
System.out.println("+----------------------------+");
... |
f39fd437-86a5-41eb-a11e-256a1552030a | 1 | @Test(expected = BillNotFoundException.class)
public void findBillsNotExistByHouseholdTest()
throws BillNotFoundException {
Household hh = null;
try {
hh = familyService.findHousehold(0);
} catch (InstanceNotFoundException e) {
fail("Household not found");
}
billService.findBillsByHousehold(hh);
} |
992bf43c-fe59-4b0d-b897-2d204815b105 | 1 | public void visit_fdiv(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
76eb3193-75cb-4666-969f-a2c1cdbaf0d5 | 9 | private void button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button1ActionPerformed
if (order1code1tf.getText().equals("1001"))
{
o1c1destf.setText("Chicken Nugget");
}
if (order1code1tf.getText().equals("1002"))
{
o1c1de... |
b095e758-662f-4080-b7e8-ea9a257dfb6b | 3 | public boolean isFull(){
for (int i = 0; i < fieldSize; i++){
for (int j = 0; j < fieldSize; j++){
if(field[i][j] == DEFAULT_CELL_VALUE){
return false;
}
}
}
return true;
} |
a35bb431-9df1-4837-9ae9-f131be79d04f | 4 | private static void validateFIO(String name) throws TechnicalException {
if (name == null || name.isEmpty() || name.length() > FIO_SIZE) {
throw new TechnicalException(FIO_ERROR_MSG);
}
String regex = "[а-яёA-ЯЁ a-zA-Z\\'\\-]+";
Pattern p = Pattern.compile(regex);
Mat... |
4c5c6151-588b-4054-a264-4b8bf0beb24d | 5 | public void helpSetPreparedStatement(int index, PreparedStatement ps) {
try {
switch (this.type) {
case Types.CHAR:
case Types.VARCHAR:
ps.setString(index, (String)this.getValue());
break;
case Types.TIMESTAMP:
ps.setTimestamp(index, (java.sql.Timestamp)this.getValue());
break;
ca... |
698508bd-6321-4cb3-accb-0a87593ca338 | 0 | public void mousePressed(MouseEvent event) {
} |
4361877e-25a0-4a13-9109-7314cf1e4ade | 7 | @Test
public void test_allGetMethods_hasExpired_allShouldFail()
{
// Take the standard descriptor and make it expire.
descriptor.expire();
// Ensure all getters refuse to return a value.
for (int i = 0; i < MoleculeDescriptor.class.getDeclaredMethods().length; i += 1)
{
Method getter = MoleculeDescrip... |
f5f014e8-5cf7-4310-859e-184cde2127e0 | 8 | public SingleLine(String text, FontConfiguration fontConfiguration, HorizontalAlignement horizontalAlignement,
SpriteContainer spriteContainer) {
if (text.length() == 0) {
text = " ";
}
this.horizontalAlignement = horizontalAlignement;
final Splitter lineSplitter = new Splitter(text);
for (HtmlCommand ... |
56aa5a46-05a3-4de4-b8d8-487096fa5d1d | 7 | public SimpleAvi toSimpleAvi() {
SimpleAvi avi = new SimpleAvi();
avi.dwMicroSecPerFrame = 34296875 / 512;
avi.dwRate = 65536;
avi.dwScale = 4389;
avi.width = WIDTH;
avi.height = HEIGHT;
avi.totalFrames = framePixels.length;
avi.frames = new long[avi.totalFrames][HEIGHT][WIDTH];
l... |
eca6b08b-94e3-45d4-b15f-2f4f318f7b55 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.direction");
try {
Criteria criteria = new Criteria();
Direction currDirection = (Direction) request.getSessionAttribute(JSP... |
d1ae9dff-d277-4ca0-b5c6-23d2b5c37df9 | 4 | int getB(String s1, String s2) {
int b = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) {
continue;
}
if (s1.charAt(i) == s2.charAt(j)) {
b++;
}
}
... |
06931123-f3b6-4f68-b894-d642c0de8631 | 1 | public void deleteFile(String fileID) {
Files file = manager.find(Files.class, fileID);
if (file != null) {
manager.remove(file);
}
} |
104a69a2-0529-434f-aec5-1973ce8e3a8c | 2 | public void addDefault(String path, Object value) {
Configuration root = getRoot();
if (root == null) {
throw new IllegalStateException("Cannot add default without root");
}
if (root == this) {
throw new UnsupportedOperationException("Unsupported addDefault(Strin... |
86525730-b2ed-4b3e-86c3-0759655e7398 | 6 | @SuppressWarnings({"BroadCatchBlock", "TooBroadCatch"})
private void launchReadInterface(final int page) {
Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "launchReadInterface", page);
new Thread(() -> {
Logger.getLogger(MainInterface.class.getName... |
6a65c37f-f046-423d-850f-2905063c02f3 | 3 | public boolean move(int x, int y, ArrayList<int[]> walkList)
{
if(Game.inMap(x, y))
{
if(Game.paths.getMove(x, y) <= mov && Game.map.getUnit(x, y) == null)// && Game.paths.getMove(x, y) <= mov && mov != 0)
{
//pX = this.x;
//pY = this.y;
... |
8105933c-661e-4da8-9fd2-28c0b9a04fcf | 4 | private double normaliseScore(Board b)
{
int count = 0;
//sum all the squares
for (int i = 0; i < 4; i++){
for (int j = 0; j < 4; j++){
//if (b.boardState[i][j] >= 3 )
count += b.boardState[i][j];
}
}
//store the max possible score in maxscore
//tileS goes from the highest single cell size d... |
950dcec8-3f43-430f-8575-bbe03a285afb | 9 | public static void main(String[] args) throws IOException {
RTP rtpProtocol=null;
Scanner sc = new Scanner(System.in);
// lllegalArgumentException("Parameter(s)' <Server> <Word> [<Port>]");
if ((args.length < 3) || (args.length > 4)) {
throw new IOException("Invalid Argument");
}
//client port
... |
67ea4ce1-a246-41a9-9a58-dcbff768f733 | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
DAO dao = new DAO();
response.setContentType("text/html;charset=UTF-8");
... |
38d817a3-6cd0-4e59-b20a-d0707207ece7 | 2 | public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
DefaultMutabl... |
e311aee1-e255-468b-b630-d8d1673d12cf | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
0556a19c-3d77-45b9-897f-f229f8b98626 | 8 | static String showHundreds(int[] mas, int div) {
StringBuilder res = new StringBuilder();
int n = mas[div * 3 + 2];
if (n != 0) { //hundreds
res.append(digits[n]).append(" hundred");
if (n != 1) { //plural
res.append("s");
}
}
boolean hasTeens = false;
n = mas[div * 3 + 1];
if (n != 0... |
fd41df20-65ef-4152-8f0b-9ca20315e9bc | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected instanceof MOB)
&&(msg.targetMinor()==CMMsg.TYP_ENTER)
&&(msg.source()==affected)
&&(msg.target() instanceof Room)
&&(msg.tool() instanceof Exit)
&&(((MOB)affected).location()!=null... |
5c838b45-fda0-441c-9320-40592759c4ca | 6 | @EventHandler
public void onBlockBreak(BlockBreakEvent event){
Player eventPlayer = event.getPlayer();
if(eventPlayer.getItemInHand()!=null){
if(eventPlayer.getItemInHand().equals(plugin.tool)){
if(eventPlayer.hasPermission("sd.tool")){
event.setCancelled(true);
return;
}
}
}
if(e... |
2f9ce5d7-c226-4d08-805f-d5bb432f4bf2 | 2 | @Override
public int matches( S sequenceA, int indexA, S sequenceB, int indexB, int count )
{
for (int i = 0; i < count; i++)
{
char a = sequenceA.charAt( indexA + i );
char b = sequenceB.charAt( indexB + i );
if (Character.toLowerCase( a ) != Character.toLowerCase( b ))
... |
e745717c-6412-4a46-9843-f5ba6ebdff74 | 1 | private void setDefaultSettings() {
for (int i = 0;i < INDENT_LENGHT_DEFAULT;i++) {
indentString = indentString + INDENT_CHAR_DEFAULT;
}
extraBraces = false;
} |
8cce04d1-8f09-4a9c-9380-734ee044c6d9 | 6 | public static int findMaxPointsOnSameLine(int[][] points) {
int maxPoints = 0;
if(points == null) {
return maxPoints;
}
Map<Double, Integer> slopMap = new HashMap<>();
for( int i = 0; i< points.length; i++) {
for( int j = i+1; j<points.length; j++) {
... |
1092d92a-5956-4415-ad9f-d059b021b103 | 0 | public Constant(Integer i) {
this.i = i;
} |
fbedc62f-93b8-47f9-ace8-95440d88ebed | 3 | @Test
public void getBookingPrizeTest() {
Booking b = null;
Student s = null;
try {
b = bookingService.find(0);
s = b.getStudent();
} catch (InstanceNotFoundException e) {
assertTrue("Booking not found", false);
}
List<Booking> lb = bookingService.getStudentBookingsByDate(s,
b.getDate());
... |
8cb78a94-6864-43cb-8de5-2d916544e2fb | 3 | public void visitEnd() {
// compute SVUID and add it to the class
if (computeSVUID && !hasSVUID) {
try {
cv.visitField(Opcodes.ACC_FINAL + Opcodes.ACC_STATIC,
"serialVersionUID", "J", null, new Long(computeSVUID()));
} catch (Throwable e) {
throw new RuntimeException("Error while computing SVUID... |
9a6e485b-bf6e-4a3a-8a6c-f5654f026eb9 | 2 | public boolean hasListArg() {
String s = peek();
return (!s.isEmpty() && s.charAt(0) == '[' && s.charAt(s.length() - 1) == ']');
} |
c0813a1a-96e0-4d9c-809e-9446a950315c | 3 | public void addBaudRate(double baudRate)
{
if (baudRates_ == null) {
return;
}
baudRates_.add( new Double(baudRate) );
if (bandwidth_ < 0 || baudRate < this.bandwidth_) {
this.bandwidth_ = baudRate;
}
} |
6169cefd-1e10-4661-832b-b70a6c7d7fed | 2 | public boolean addClasspath(String s) {
boolean added = false;
if (s != null) {
StringTokenizer t = new StringTokenizer(s, File.pathSeparator);
while (t.hasMoreTokens()) {
added |= addComponent(t.nextToken());
}
}
return added;
} |
e64912c1-7696-44dd-99bf-b155b22037c3 | 7 | static void dradf2(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index) {
int i, k;
float ti2, tr2;
int t0, t1, t2, t3, t4, t5, t6;
t1 = 0;
t0 = (t2 = l1 * ido);
t3 = ido << 1;
for (k = 0; k < l1; k++) {
ch[t1 << 1] = cc[t1] + ... |
b2084f19-7254-4c36-9288-bcf191748044 | 2 | @Override
public String encrypt(String input, String key) throws Exception {
String output = "";
SecretKeySpec tempKey = null;
if (input.length() < 1) {// string is empty
return null;
}
// if user has put in the key, generate a key by the string that user
// has put in
if (key != null) {
tempKey = ... |
6c4c8c99-97d9-4589-a25c-4b50bcdf5fbb | 7 | public void durumDegis(String masaAdi, Bilgisayar.Durum durum){
JLabel masaLabel = masaBul(masaAdi);
if(masaLabel != null) {
switch(durum) {
case SINIRSIZ_ACIK:
masaLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resimler/acik.png")));
... |
b452bed8-b0b7-40ff-a4e3-739b004b4ef8 | 2 | public <T extends Component> Set<UUID> getAllEntitiesPossessingComponent(
Class<T> componentType) {
synchronized (componentStores) {
HashMap<UUID, ? extends Component> store = componentStores
.get(componentType);
if (store == null) {
retur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.