method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c427d2bc-79f3-4c4a-90e5-74d1afb09241 | 6 | @Override
public int compareTo(GeneratorTask o)
{
if (op < o.op)
return 1;
if (op > o.op)
return -1;
if (z < o.z)
return -1;
if (z > o.z)
return 1;
if (x < o.x)
ret... |
9a7284e5-8b6a-4fb8-ae7b-9ccc7c441ef3 | 5 | private void enableEvents(boolean b) {
enableAttachEvents(b && attachListeners.size() > 0);
enableDetachEvents(b && detachListeners.size() > 0);
enableErrorEvents(b && errorListeners.size() > 0);
enableServerConnectEvents(b && serverConnectListeners.size() > 0);
enableServerDisconnectEvents(b && serverDisconn... |
1f29ce0e-87cc-4262-826d-e6e6b3449911 | 8 | public static void addUser(ConcordiaDatabase database){
Scanner myKey = new Scanner(System.in);
boolean successful = false;
//Prompts user for basic information
System.out.print("What is the first name of this individual? ");
String firstName=myKey.next();
System.out.print("What is the last name of " + ... |
c0781a88-2bf2-4aae-918f-5eb9272ec372 | 2 | public static <T extends DC> Similarity getIndexedSim(Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> done)
{ if(done!=null)
{ if(done.getNext()!=null)
{ return new Similarity(done.getFst().fst().delta(done.getFst().snd()).simi().getValue()+(getIndexedSim(done.getNext()).getValue()));
}
else
... |
c048653e-e156-44a4-b4b2-23c9e8e00335 | 6 | public void freegame(String[] split, String command)
{
if (split.length != 6)
{
PrintMessage("Syntax:!freeplay [name] [eastplayer] [southplayer] [westplayer] [northplayer]");
return;
}
String name = split[1];
String east = split[2];
String south = split[3];
String west = split[4];
String north = ... |
cd176645-1be4-45f1-85f6-b5acf4f0219b | 4 | @Override
public void actionPerformed(ActionEvent e) {
if(firstTime){
drawRandomNode();
drawSnake();
firstTime = false;
}
Node last;
if(e.getSource() == timer){
last = snake.move(food);
if(snake.getIsDead()){
stop();
System.out.println("snake was dead");
}else{
if(snake.eat(food))... |
7dfcc02c-5ae8-4406-ac5e-543e75a2f01a | 3 | public static String getColorLang(String langKey, String ... keyMap) {
String result = getLang(langKey);
if (result == null) {
result = langKey;
}
for (int i = 0; i < keyMap.length; i += 2) {
if (i+1 >= keyMap.length) {
break;
}
String key = keyMap[i];
String value = keyMap[i+1];
... |
48b8a21e-39a2-4245-9cab-47d435247ec0 | 3 | private void drawYValues() {
mySketch.fill(0);
mySketch.textSize(valueSize);
mySketch.textAlign(PApplet.RIGHT);
float ySize = plotY2 - plotY1;
float nextYPlace = plotY1;
float fixedXPlace = plotX1 - 5;
float yValue = yMax;
float yInterval = (yMax - yMin) / valueDivisions;
DecimalFormat decimalForm ... |
f5507aec-bf1f-47f3-998e-8338b39e97f5 | 3 | protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
} else if ("STATUS".equals(PROPERTY)) {
updateStatus();
} else if ("COLOR".equals(PROPERTY)) {
icon.setBackground(new Background(new BackgroundFill(... |
39e5ba38-dc18-4f4a-a54d-f81b155380c0 | 9 | @Override
public void mouseDragged(MouseEvent e) {
if (e.getPoint().x >= 0 && e.getPoint().x <= getWidth() && e.getPoint().y >= 0 && e.getPoint().y <= getHeight()) {
if (right) {
MapTile tile = getTile();
moveMap(start.getGX(mapLoc) - tile.getGX(mapLoc), start.get... |
9cbf7577-06e8-4388-8422-6af397f3af8e | 1 | public void clik() {
for (ClickListener l : listeners) {
l.doClick();
}
} |
a5e80bb1-2d4a-48f4-a3bf-ffb27b59ec68 | 3 | public String getAsHiddenString() {
StringBuilder builder = new StringBuilder();
for (int x = 0; x < SIZE; x++) {
for (int y = 0; y < SIZE; y++) {
int value = fField[x][y];
if (value == VALUE_SHIP)
builder.append(VALUE_FREE);
else
builder.append(value);
}... |
3788845d-be29-4cf3-b424-e6363cf864af | 7 | private void assertValidFields ()
{
if (_name == null) throw new IllegalArgumentException("The PackageName cannot be null.");
if (_version == null) throw new IllegalArgumentException("The PackageVersion cannot be null.");
if (_section == null) throw new IllegalArgumentException("The PackageS... |
02b56715-4741-4fb0-b5bb-86f26d4d52d9 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[0]; // Get
// ... |
b09d3a45-c954-42a1-b5fe-cedb04219ad6 | 1 | @Override
public void actionPerformed(ActionEvent e) {
// File Menu
if (e.getActionCommand().equals(CANCEL)) {
setCanceled(true);
}
} |
2076ae4c-fa78-4d2e-b14f-201a9e706427 | 5 | public static void start(String a_port)
{
port = Integer.parseInt(a_port);
ServerSocket ss = null;
try
{
InetAddress thisIp = null;
NetworkInterface ni = NetworkInterface.getByName("wlan0");
Enumeration<InetAddress> inetAddresses = ni.getInetAddresses();
while(inetAddre... |
0ef10fe6-dd22-4dbd-9fec-9df67c3b5364 | 9 | public final Number parse(String text) throws TypeConversionException {
if (text == null || "".equals(text)) {
return null;
}
if (pattern == null) {
try {
return createNumber(text);
}
catch (NumberFormatException ex) {... |
a23d61ca-5be8-4787-8d74-6587e5183d6f | 5 | private void moveForward() {
int newX = getPositionX();
int newY = getPositionY();
switch (getFacing()) {
case NORTH:
newY++;
break;
case EAST:
newX++;
break;
case SOUTH:
newY--;... |
f6ddd06a-e4aa-4515-bdcd-238f3ee8fda3 | 3 | public boolean higher(String a, String b) {
int i = 0, limit = Math.min(a.length(), b.length());
while (i < limit - 1 && LOWER.to(a.charAt(i))
== LOWER.to(b.charAt(i)))
++i;
return a.charAt(i) < b.charAt(i) || a.length() <= b.length();
} |
f7d764f2-feef-4b32-a063-fa6ef4fee835 | 5 | public void actionPerformed(ActionEvent e) {
String[] args = getArgs(e);
String channel = args[0];
String sender = args[1];
String message = args[2];
if (message.contains("youtube.com/watch") || message.contains("youtu.be/"))
if (acebotCore.ha... |
557af2db-a242-4d02-80a7-ddd383bbbdf0 | 8 | private ArrayList<Object> chooseEquation(int flag){
ArrayList<Object> ret = new ArrayList<Object>();
String headerCommentP = null;
String[] commentsP = null;
String[] boxTitlesP = null;
switch(flag){
case 0: headerCommentP = "Choose a fitting equation";
... |
50575bba-3cbf-4dc6-8e92-5011ed04809b | 7 | public static ArrayList<postInfo> getPosts(long offering_id, boolean privilegeFlag){
try{
PreparedStatement pstmt;
if (!privilegeFlag){
pstmt = conn.prepareStatement("select S.post_id, S.parent_post_id, S.student_id, student.name, S.mytime, "
+ "(s... |
6e1ef7be-31be-4c5b-8ffc-8ad3d61a6ebc | 7 | public void recalculate(final double OFFSET) {
List<Stop> stops = new ArrayList<>(sortedStops.size());
for (Stop stop : sortedStops) {
double newOffset = (stop.getOffset() + OFFSET) % 1;
if(Double.compare(newOffset, 0d) == 0) {
newOffset = 1.0;
sto... |
d8ca8f7b-58a6-4dbe-a795-78140dc604a5 | 0 | @Test
public void TallennuksenKasittelijaLoytaaTasonNumeronArrayListista() {
ArrayList<String> rivit = new ArrayList();
rivit.add("Taso: 4");
int x = k.etsiTasonNumero(rivit);
assertTrue("taso oli väärä!", x == 4);
} |
3a60cab3-f902-458f-9504-640e274a9571 | 9 | private void attackCalculation(Player attacker, Player defender)
{
if (attacker.checkIfAlive() && defender.checkIfAlive())
{
// Defender HP lost = difference between attacker's strength and defender's constitution.
int attackCalc = attacker.getStrValue() - defender.getConValu... |
bce0370a-6e98-46e0-9bb4-39db6609b5d8 | 8 | public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof RingPlot)) {
return false;
}
RingPlot that = (RingPlot) obj;
if (this.separatorsVisible != that.separatorsVisible) {
return false;
}
... |
c0ec1262-306f-4ee5-ab02-9a175bb75ed9 | 2 | public static int checkStage(int stage)
{
if(stage>6)
return 6;
else if(stage<-6)
return -6;
else
return stage;
} |
7e6f5fb7-175a-4f0f-b1ee-5b6539d966d9 | 0 | public JButton getjButtonClose() {
return jButtonClose;
} |
32db356f-735b-494b-954d-3757ae102565 | 9 | protected void processTraverseEvent(int columnIndex, ViewerRow row,
TraverseEvent event) {
ViewerCell cell2edit = null;
if (event.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
event.doit = false;
if ((event.stateMask & SWT.CTRL) == SWT.CTRL
&& (feature & TABBING_VERTICAL) == TABBING_VERTICAL) {
cell2e... |
5f6a49c3-9dbc-494f-97d7-c77dfe2896b8 | 4 | byte[] getBrushWithAA(CPBrushInfo brushInfo, float dx, float dy) {
byte[] nonAABrush = getBrush(brushInfo);
int intSize = (int) (brushInfo.curSize + .99f);
int intSizeAA = (int) (brushInfo.curSize + .99f) + 1;
for (int y = 0; y < intSizeAA; y++) {
for (int x = 0; x < intSizeAA; x++) {
brushAA[y * intSi... |
aea7366b-61fb-4d70-b762-d531f3b4803f | 6 | protected void parseHost() {
final int i = this.message.indexOf(' ');
String hostAddress = null;
String hostName = null;
if (i > -1) {
final String providedHost = this.message.substring(0,i).trim();
hostAddress = this.inetAddress.getHostAddress();
if (providedHost.equalsIgnoreCase(hostAddress)) {
... |
7699cbc6-85de-4e10-b682-cbfc94753444 | 4 | private static void loadFEP() {
try {
FileInputStream fstream;
fstream = new FileInputStream("fep.conf");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
HashMap<Stri... |
cfaca6e3-b546-4148-8e19-0b92931d93d4 | 3 | public void walkRight() {
face = 1;
if (!(x == Realm.WORLD_WIDTH - 1) && !walkblockactive)
if (!Collision.check(new Position(x, y), face)) {
x += walkspeed;
setWalkBlock(walkblocktick);
}
} |
b83a3808-1b98-423b-a3a7-5307b38e08d6 | 6 | public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
input.useLocale(Locale.US);
System.out.println("Inserisci un aggettivo :");
String aggettivo = input.next();
input.close();
//aggiungo la lettera maiuscola
aggettivo = aggettivo.toUpperCase().substring(0,1)+a... |
eb03867e-f025-4585-9329-655abb43c457 | 1 | public static boolean isReleased(int i) {
return !keyState[i] && prevKeyState[i];
} |
90952572-9511-4075-968f-af557d623dcf | 8 | public void PKz() {
if(PlayerHandler.players[KillerId] != null) {
if(KillerId != playerId){
if(PlayerHandler.players[KillerId].combat > combat){
lnew = 1;
}
else if(PlayerHandler.players[KillerId].combat < combat){
lnew = 3;
}
else if(PlayerHandler.players[KillerId].combat... |
4d08ee8a-a64e-46a8-9e71-372254304eb0 | 9 | public String getConfigPath(String filename) {
if (eng.isApplet()) return null;
File jgamedir;
try {
jgamedir = new File(System.getProperty("user.home"), ".jgame");
} catch (Exception e) {
// probably AccessControlException of unsigned webstart
return null;
}
if (!jgamedir.exists()) {
// try to ... |
8812658a-a3e5-41bc-a853-047d364267a8 | 5 | private final void method2855(int i, byte i_56_) {
anInt8927++;
if (i_56_ < -42) {
for (Class348_Sub43 class348_sub43
= ((Class348_Sub43)
((Class348_Sub16_Sub1) aClass348_Sub16_Sub1_8958)
.aClass262_8848.getFirst(4));
class348_sub43 != null;
class348_sub43
= ((Class348_Sub43)
((C... |
8a13073c-5429-4440-9f14-bd25405fb3f9 | 7 | public static double incompleteBetaFraction1( double a, double b, double x ) {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, thresh;
int n;
k1 = a;
k2 = a + b;
k3 = a;
k4 = a + 1.0;
k5 = 1.0;
k6 = b - 1.0;
k7 = k4;
k... |
145802f3-12c9-40e1-b37a-00b304c42c56 | 3 | @Test
public void randomShapeGeneration() {
RandomShapeGenerator rsg = new RandomShapeGenerator();
for (int i = 0; i < 1000; i++) {
Shape newShape = rsg.getNewShapeAtRandom();
for (Shape shape : shapeCount.keySet()) {
if (newShape.getClass().getName().equals(s... |
06332186-083b-455c-9f93-9a3b61ba32e6 | 5 | private List<Integer> getMailNumberList() {
String response;
List<String> responseList = new ArrayList<String>();
List<Integer> MailNumberList = new ArrayList<Integer>();
try {
sTrace.debug("Try Stat Command");
writeToServer("List");
response = readFromServer();
while(!response.equals(".")){
res... |
af36790c-6f71-46fd-bf09-26ca87d1bee6 | 5 | public void addMissileToOrefPanel(String destination, int time, int flyTime) {
// exclude messages with # - to prevent showing interception alerts
if(!(destination.contains ("#"))){
// time % 2 - to make the alert blink every second
if (time < ALERT_DISPLAY_TIME && time % 2 == 0) {
topAlert.setText("Alert in... |
1d767621-e685-49ee-ace5-be335171cdb6 | 4 | @Override
protected void wildCardPlayed(TurnContext state) {
System.out.print("You have put down a wildcard. ");
if (state.selection == null && state.g.canDraw() && state.currentPlayable.isEmpty()) {
System.out.println("Since cards can be drawn, you must draw and you cannot put down any more cards.");
} else ... |
5515da3d-0f91-4e5d-8887-a2c1c693fcc1 | 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... |
28eeb715-6acf-4e6b-a451-c835fe2f095f | 0 | public void IncrementPersonsCreated()
{
personsCreated += 1;
} |
fb214e47-e871-4674-af46-4fccc9d179a5 | 7 | public synchronized DataInputStream getChunkDataInputStream(int x, int z) {
if (outOfBounds(x, z)) {
debugln("READ", x, z, "out of bounds");
return null;
}
try {
int offset = getOffset(x, z);
if (offset == 0) {
// debugln("READ", x... |
70aedb98-2e48-4304-bda1-2f938541f789 | 3 | @Override
public void deleteIngredient(int i) {
Ingredient ingredient = getIngredient(i);
for(int parent : ingredient.getParentIngredients()){
for(Ingredient child : getChildrenIngredients(ingredient)){
child.addParent(parent);
updateIngredient(child);
}
}
try(Connection connection = DriverManage... |
3554766e-7b99-42fb-808f-af70e3d0c580 | 0 | public void move(int dx, int dy) {
AffineTransform at = new AffineTransform();
at.translate(dx, dy);
((GeneralPath) shape).transform(at);
canvas.repaint();
} |
2b65ba23-261d-4170-be89-d75897584056 | 7 | public static Cons mergeConsLists(Cons list1, Cons list2, java.lang.reflect.Method predicate) {
{ Cons cursor1 = list1;
Cons cursor2 = list2;
Cons result = Stella.NIL;
Cons tail = Stella.NIL;
Cons temp = Stella.NIL;
for (;;) {
if (cursor1 == Stella.NIL) {
if (tail ==... |
2b617c6f-6458-4505-9caa-86cfab4346c4 | 5 | public CheckResultMessage checkL6(int day){
int r1 = get(17,5);
int c1 = get(18,5);
int r2 = get(30,5);
int c2 = get(31,5);
if(checkVersion(file).equals("2003")){
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if(0!=getValue(r2+6, c2+day, 10).compareTo(getValue(r1+2+day... |
65d2c639-4d61-418e-9412-c04c43497ab4 | 0 | public void setThumbUrl(String thumbUrl) {
this.thumbUrl = thumbUrl;
} |
340c6b3d-5ef1-46bb-bb4b-cd3d24b60f54 | 5 | public static String formatPackets(long paramLong, boolean MB, boolean GB) {
if (paramLong >= 1000000000L && GB) {
return paramLong / 1000000000L + " B";
}
if (paramLong >= 10000000L && MB) {
return paramLong / 1000000L + " M";
}
if (paramLong >= 1000L) {
return paramLong / 1000L + " K";
}
return... |
33b7ed34-fca4-476b-a6ad-962fb82229d7 | 4 | @Test
public void testSerialize() {
ThriftyList<Integer> list = new ThriftyList<Integer>();
int testCount = 10;
for (int j = 0; j < testCount; j++) {
list.add(j);
}
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(out);... |
dbf7d669-f93a-4c30-801e-c0c698626f21 | 7 | @Override
public ParserResult specialCheckAndGetParserResult(ParserResult result,
SyntaxAnalyser analyser) throws GrammarCheckException {
Map<String, String> dimensionLevelInfo = result.getDimensionLevelInfo();
boolean conditionIsOk = dimensionLevelInfo.size() == 2;
for (Iterator<String> iterator = dimensionL... |
b02986a6-db3b-48f5-9210-1bb8f3a47368 | 2 | private static boolean canBeAbundant(int n){
for(Integer a : abundant){
if (abundant.contains(n-a)) return true;
}
return false;
} |
2faaa944-9750-4f6c-a0f2-d9b707ae66ee | 0 | public void atBat() throws PopFoul {
} |
fc011a34-c18e-401b-9f1a-8d0e792fe60f | 0 | public void setPrpMoaConsec(int prpMoaConsec) {
this.prpMoaConsec = prpMoaConsec;
} |
29c1aaf7-b759-4c1b-a478-1f15d0f0574f | 8 | @Override
public void giveIMC2ChannelsList(MOB mob)
{
if((mob==null)||(!imc2online()))
return;
if(mob.isMonster())
return;
final StringBuffer buf=new StringBuffer("\n\rIMC2 Channels List:\n\r");
final Hashtable channels=imc2.query_channels();
buf.append(CMStrings.padRight(L("Name"), 22)+CMStrings.padR... |
c005e33c-6e77-47b6-a1e1-fa3cb0f8b906 | 0 | @Override
public void setHouseNumber(String houseNumber) {
super.setHouseNumber(houseNumber);
} |
eeb3dd66-c8f6-45a1-91a3-e42d9995575a | 7 | public static boolean isValidDate(int day, int month, int year) {
if (isMonthWith31Days(month)) {
return (day >= 1) && (day <= 31);
} else if (month == 2) {
if (isLeapYear(year)) {
return (day >= 1) && (day <= 29);
} else {
return (day >= 1) && (day <= 28);
}
} else {
return (day >= 1) && (... |
aa9f1d7d-d3da-4169-8202-6e8156ab24d3 | 3 | public StopwatchTimer(String author, long time, long period) {
this.author = author;
baseTime = time;
remainingTime = time;
if(period != 0 && baseTime > period)
this.period = period;
else if(baseTime > 60)
this.period = 60;
} |
9bd62acd-3bc7-4e4e-b894-a440a66ea955 | 4 | public Integer convert(Object object,Integer defultValue,Object... args) throws HeraException{
if(object instanceof Double){
return new DoubleIntegerConverter().convert((Double)object, defultValue, args);
} else if(object instanceof Long){
return new LongIntegerConverter().convert((Long)object, defultValue,... |
16abbddc-6a50-4886-b995-8bc9c8434324 | 2 | private static void viewAStudent(String first, String last) {
String allInfo = new String();
if (studentExists(first, last) >= 0) {
Student tempStudent = new Student(
(Student) Students.get(studentExists(first, last)));
allInfo = ("Name: " + tempStudent.getfName() + " " + tempStudent
.getlName());
... |
74213d0e-733f-4f19-a75b-f4f9655af2e8 | 3 | public static void rullTilbake(Connection forbindelse) {
try {
if (forbindelse != null && !forbindelse.getAutoCommit()) {
forbindelse.rollback();
}
} catch (SQLException e) {
skrivMelding(e, "rollback()");
}
} |
a36c4c6f-59e3-42bc-95d3-9307694aeac7 | 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... |
9aa89bce-1b51-4d06-a7cf-2bc477d58444 | 4 | private BufferedImage getMaskedImage(BufferedImage bi) {
// get the color of the current paint
final Paint paint = state.fillPaint.getPaint();
if (!(paint instanceof Color)) {
// TODO - support other types of Paint
return bi;
}
Color col = (Color) paint;... |
75b6ad26-5a33-4290-b496-57c12ee170ae | 3 | public static void main(String[] args) throws InterruptedException {
ApplicationContext context = new ClassPathXmlApplicationContext("main-context.xml");
WorldFactory worldFactory = context.getBean(ToroidalArrayWorldFactory.class);
UniverseFactory universeFactory = context.getBean(UniverseFactor... |
22328578-4ed1-487e-8e97-2655692670b6 | 6 | public Checker getChecker(int x, int y)
{
for(Checker checker: redCheckers)
{
if( (checker.checkX(x)) && (checker.checkY(y)) )
{
return checker;
}
}
for(Checker checker: blackCheckers)
{
... |
0a783dda-d137-4dcc-b4a8-aca249d5c77d | 9 | private void addAttackers(int color, int target, int excludedSquare) {
// This function pushes the attackers found on top of the stack in MV (Move-value) order:
// e.g. king -> queens -> rooks and so on so we do NOT have to worry about AttackerStacks
// pushIntoPlace() until we begin to add hid... |
2c15ebe4-3d7e-4724-89a3-c96feb407086 | 9 | private static List<Element> find(Node root, String nsUri, String localName, boolean recursive) {
List<Element> result = new ArrayList<Element>();
NodeList nl = root.getChildNodes();
if (nl != null) {
int len = nl.getLength();
for (int i = 0; i < len; i++) {
... |
2eb41337-cbcb-4817-8a46-feaeedd76107 | 8 | public void visitStackManipStmt(final StackManipStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
genPostponed(stmt);
// All the children are stack variables, so don't so anything.
switch (stmt.kind()) {
case StackManipStmt.SWAP:
method.addInstruction(Opcode.opcx_swa... |
17fb989e-35ec-4ea7-917f-7b0c71591ee8 | 7 | public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
Page page= new Page();
HttpSession session = request.getSession(getURI(request).indexOf("new")>0);
... |
24586173-327b-4b5d-b4b2-7f8549d66044 | 2 | private static void GetGraphlist() throws FileNotFoundException {
// TODO Auto-generated method stub
GraphList.clear();
File f = new File("src/kargerMinCut.txt");
Scanner s = new Scanner(f);
int i = 0;
int j = 0;
while (s.hasNext()) {
Scanner sl = new Scanner(s.nextLine());
sl.nextInt();
java.ut... |
a171d027-ffc7-4cd2-9a51-2ff7d7c37417 | 1 | public Point getViewPosition() {
return (viewIsUnbounded() ? getPanCenterPoint() : super.getViewPosition());
} |
b0fca663-0016-480e-9c6a-bbcf59ea78b6 | 5 | public static Mouse newMouseDialog()
{
JTextField mouseName = new JTextField(12);
JTextField mouseBirthDate = new JTextField(12);
JTextField mouseColour = new JTextField(12);
JPanel namePanel = new JPanel();
namePanel.add(new JLabel("Name:"));
namePanel.add(Box.createHorizontalStrut(22));
namePanel.add(... |
58290290-67d2-4db5-8cf4-6ada606e73f6 | 9 | public static String LFSR(String semSuc, String pol, int sizeOutput) {
int output = 0;
StringBuffer sucAux = new StringBuffer();
int[] vec = new int[sizeOutput]; //Se crea el vector que hace de buffer de tamaño pasado desde la interfaz o igual (2^n-1)*2 por defecto
//Copia la semilla ... |
977f5921-ddf3-4f21-8913-bcc6562a6ffb | 0 | public String getDescription() {
return description;
} |
ec682020-81fa-418d-9cbc-441a6773a5af | 1 | @Test
public void filtersByAuthorLastnameWorks2() {
citations.add(c1);
citations.add(c2);
citations.add(cnull);
filter.addFieldFilter("author", "Isoherra");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c2) && filtered.size() == 1);
... |
65cfa2aa-2068-4e3a-b3d7-7e1f595a195b | 9 | public void resolveSymbol() {
switch (m_lex.tok().type()) {
case INT:
case FLOAT:
case CHAR:
case STRING:
updateCurrent(m_symbols.get("{literal}"));
break;
case ID: {
Symbol smb = m_symbols.get(m_lex.tok().value());
if (smb == null) {
smb = m_scope.find(m_lex.tok().value());
}
updat... |
1d5c69f2-3926-416d-9bd0-a0b7e189fea5 | 9 | private void spawnResources(ResourceType rt, int count, int level) {
Point p;
int y;
for (int i = 0; i < count; i++) {
p = rt.getNewXY(gameController.getMapWidth(), level);
if (p.x > 0 && p.y > 0) {
Resource r = new Resource(registry, this, rt, p.x, p.y, 0... |
12979def-5595-470e-86f2-ae4e556d94c1 | 6 | private void accept(){
if (verifyAddress(Adress.getText())){
if (port.getText().matches("[0-9]+") && port.getText().length() > 0){
if(!Adress.getText().trim().equals("")){
try {
catalogue.setNameServer(InetAddress.getByName(Adre... |
a1b23eed-5062-4e5d-944d-323331c28333 | 3 | private void handleFileClick(FindReplaceResult result) {
try {
String filepath = result.getFile().getCanonicalPath();
Document doc = Outliner.documents.getDocument(filepath);
if (doc == null) {
// grab the file's extension
String extension = filepath.substring(filepath.lastIndexOf(".") + 1, filep... |
25c89bc4-1515-45b9-b4fb-18cc84bbd54d | 6 | private static int readIntNum(CompileInfo ci, String p, boolean decimal){
int radix = 10;
p = p.trim();
if(!decimal){
if(ci.replacements!=null){
Integer num = ci.replacements.get(p.toLowerCase());
if(num!=null)
return num;
}
if(p.startsWith("0x")){//$NON-NLS-1$
p = p.substring(2);
ra... |
7cae812f-67cf-4811-b21f-39c63062ada4 | 5 | public void start() throws InterruptedException {
boolean test = false;
if (test || m_test) {
System.out.println("Othello :: start() BEGIN");
}
boolean m_Trace = false;
if(m_Trace) { System.out.println("Game::Start() - Game has started");}
setWindow(new GameWindow(this));... |
99164aea-4312-4f0c-9047-1e4775908c26 | 3 | public String getSessionCookie() {
if (sessionCookie == null) {
sessionCookie = "";
for (Cookie cookie : request.getCookies()) {
if (cookie.getName().equals(SESSION_COOKIE)) {
sessionCookie = cookie.getValue();
}
}
}
return sessionCookie;
} |
ab60b825-32ca-4d57-b658-66762f082741 | 3 | public void exportManagementToCSV() throws FileNotFoundException
{
JFileChooser saveFileChooser = new JFileChooser();
int returnVal = saveFileChooser.showSaveDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = saveFileChooser.getSelectedFile();
S... |
055410b4-20df-430e-8a4f-218d22cd1f1c | 7 | public static int goalHashCode(ControlFrame frame) {
{ Proposition proposition = frame.proposition;
Surrogate operator = Proposition.cachedGoalOperator(proposition);
Vector arguments = proposition.arguments;
int code = 0;
code = ((Context)(Stella.$CONTEXT$.get())).hashCode_();
if (fra... |
b6aa2a22-dd06-40fb-8d94-884f211e4d33 | 7 | @Override
public void run(int interfaceId, int componentId) {
switch(stage) {
case -1:
sendNPCDialogue(GRILLEGOATS, 9827, "Tee hee! You have never milked a cow before, have you?");
break;
case 0:
sendPlayerDialogue(9827, "Erm... no. How could you tell?");
break;
case 1:
sendNPCDialogue(GRILLEGOA... |
ab2f1c97-7104-41fd-95b0-db62ea6cbc68 | 5 | private static int checkAndAddFile(List<File> list, File f) {
if (Utilities.getFileExtention(f) != null && Utilities.getFileExtention(f).equalsIgnoreCase("PNG")) {
try {
BufferedImage image = ImageIO.read(f);
int w = image.getWidth(null);
int h = image... |
6dad6de4-3ca9-4be7-8620-01e423252df0 | 9 | private void renameRemote() {
final int select = remoteList.getSelectedIndex();
if (select < 0 || select > remotefiles.length || client == null) {
return;
}
showDialog(remotefiles[select].getFileName(), new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == 27)
... |
37a67b17-03b5-4210-9d47-f26549fc14e8 | 0 | public static void main(String[] args) {
new AntLabMain().printOutMessage();
} |
a0c2acd1-3fbc-4ec6-a285-85daa8fe1795 | 9 | private final void method1065(ByteBuffer class348_sub49, int i,
int i_0_) {
if ((i_0_ ^ 0xffffffff) == -2)
((Class117) this).aChar1778
= Class50_Sub1.method462(class348_sub49.getByte(), -128);
else if ((i_0_ ^ 0xffffffff) == -3)
((Class117) this).aChar1779
= Class50_Sub1.method462(class348_sub49.g... |
abd8e73d-49d1-4185-84de-9dd198a09212 | 1 | public void feedDrink(int index)
{
DrinkObject drink = Drink.getDrink(index);
if (!canAfford(drink.getPrice()))
return;
thirst += drink.getAmount();
// money -= food.getMoney();
// "Purchased" + food.getName();
// TODO Add Food on the screen.
// TODO adding hunger is placeholder
} |
dce69caf-84af-4f31-9451-5a84937366e3 | 4 | public Reader openStream(String publicID,
String systemID)
throws MalformedURLException,
FileNotFoundException,
IOException
{
URL url = new URL(this.currentReader.systemId, systemID);
if (url.getRef() != null) {
String ref = url.getRef... |
c8621b7b-d9c3-4ba9-b26c-ae6f92f51775 | 6 | private void censored(int row) {
if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) {
return;
}
PaidDetail selectedRow = result == null ? null : result.get(row);
if (selectedRow != null) {
int result = JOptionPane.showConf... |
34c31ecb-b75e-44c3-9921-482a17eb067e | 3 | private void writeXRefTable() throws IOException {
// Link each deleted entry to the next deleted entry by iterating
// backwards through the entries, which are sorted by object number.
// End chain by pointing to head. If none del, chain back on itself.
int nextDeletedObjectNumber = 0;... |
dde9629c-95b0-4fe1-b76a-12bfb2520524 | 5 | public final void start(final MapleClient c, final int npc) {
try {
if (!(cms.containsKey(c) && scripts.containsKey(c))) {
final Invocable iv = getInvocable("npc/" + npc + ".js", c);
final ScriptEngine scriptengine = (ScriptEngine) iv;
if (iv == null) {
return;
}
final NPCConversationManager cm = ... |
269e6991-4518-4eaf-94f4-c0b1f08b8b05 | 4 | public void extractConfig(final String resource, final boolean replace) {
final File config = new File(this.getDataFolder(), resource);
if (config.exists() && !replace) return;
this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin... |
3b9b656c-bf20-4549-9dfb-c0051b34b45d | 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... |
42396ed7-ee07-4c5c-8a2f-de9b2e207115 | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Integer.parseInt(line.trim());
if (size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.