method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3c044c88-d88a-4ca4-be12-328a7e366259 | 9 | public boolean pickAndExecuteAnAction() {
try {
//synchronized(Customers){
for(int i =0; i < Customers.size(); i++){
////print("" + Customers.get(i).s );
if(Customers.get(i).s == CustomerState.waiting){
seatCustomer(Customers.get(i));
return true;
}
}
//synchronized(Customers){
... |
e67f80dd-8aac-4c9f-a8cd-097de8ad88d4 | 5 | public void parseFile() throws IOException{
try{
BufferedReader br = new BufferedReader(new FileReader(filePath));
LinkedList<String> messages = new LinkedList<String>();
sentences = new LinkedList<String[]>();
//Push each massage to messages
String tempString = br.readLine();
while(tempString != n... |
be4e4afb-b9e2-4434-aabc-966172ee7384 | 4 | public Node getNode(Coordinate coordinate)
{
if (coordinate.getY() < 0 || coordinate.getY() >= nodeMatrix.size())
{
return null;
}
else if (coordinate.getX() < 0 ||
coordinate.getX() >= nodeMatrix.get(coordinate.getY()).size())
{
return null;
}
else
{
return this.nodeMatrix.get(coordinate... |
f6d217d6-f73c-4a74-93f5-5a1aac6e36c9 | 0 | public Cookie() {
print("Cookie constructor");
} |
b0accdc5-7fa4-4eeb-ae7c-9b1ec457db40 | 9 | private void updateTileButtons(Turn turn) {
if (turn == null || turn instanceof Pass)
throw new IllegalArgumentException("Turn can't be null or a pass");
if (turn instanceof Flip) {
Flip flip = (Flip) turn;
TileButton flipped = tileButtons[flip.getX()][flip.getY()];
flipped.setIcon(flip... |
46919192-f0a3-4b12-9422-eab12d9fad27 | 9 | private void setCorrectLocationInfo(Attributes attrs) {
// loop through all attributes, setting appropriate values
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("x"))
quizSlide.getCorrectStart().setX(
Integer.valueOf(attrs.getValue(i)));
else if (attrs.getQName(i).equals... |
05049c07-74f0-4d43-a4ee-346f733a6eeb | 6 | public int getInitialValue() {
throw_exception();
if (test_index>=test_network.test_numProposers)
throw new Error("Non-proposers should not be asking for initial value");
if(init_logic==1)
return test_index*(-1);
if(init_logic==2)
return test_index-5;
if(init_logic==3)
return... |
af74bcb2-bb96-458d-9ee9-c6a06a85ad6f | 8 | protected final void readCRFDraftEntries () throws IOException {
String [] headersArr = null;
int cnt = 0;
String [] tempArr;
while ((tempArr = this.crfReader.readNext()) != null) {
this.OCContainer = new ModelContainer();
CRF OCCRF = new CRF ();
... |
5f938f52-0749-4002-8a60-19b3082bb5af | 8 | @Override
public void executeTask() {
try {
String temp = "@@@" + DCServerTask.serverID + ":"
+ DCServerTask.numClients;
byte[] senddata = temp.getBytes(); // prepare valid client data for
// sending to server
System.out.println("blasting out to all servers!");
clientN = new DatagramSock... |
90cd78f0-275a-42b1-b197-8d0ee34246f6 | 8 | public void checkFloating(int rowStart, int col, int maxRow) {
if (Dime[rowStart][col] != null && Dime[rowStart][col].getBubbleColor() != null) {
if (Dime[rowStart][col].isFloating) {
Bubble.FloatCount++;
Dime[rowStart][col] = new Bubble('0');//borrar
}
... |
f3364989-0d8a-4b54-977b-31a2e7899bad | 2 | private MidiDevice getReceivingDevice() throws MidiUnavailableException {
for (MidiDevice.Info mdi: MidiSystem.getMidiDeviceInfo()) {
MidiDevice dev = MidiSystem.getMidiDevice(mdi);
if (dev.getMaxReceivers() != 0) {
//String lcName = StringUtils.defaultString(mdi.getName(... |
4dec8569-b354-49b3-8342-b09f7c47ccc8 | 0 | public Map<String, String> getExtra() {
return extra;
} |
c5b24da5-eca7-4ed9-9463-3592c6682fd6 | 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... |
1d30be71-e23a-4b6e-95f1-541e929b87b7 | 6 | @Override
public void nextIteration() {
if ( lastIterationResult == IterationResult.FINISHED_WITHOUT_RESULT) {
//minimum sigma reached, there's no point in continuation
return;
}
++iterationNo;
LOGGER.info("Iteration No. " + iterationNo);
//TODO: albo inaczej to przemyslec albo @SuppressWarnings... |
46a5c18f-039d-4386-838e-7728d024ca6e | 9 | public static String filterForHTMLValue(String _sContent) {
if (_sContent == null) {
return "";
}
// _sContent = replaceStr(_sContent,"</script>","<//script>");
// _sContent = replaceStr(_sContent,"</SCRIPT>","<//SCRIPT>");
char[] srcBuff = _sContent.toCharArray();
int nLen = srcBuff.length;
if (nLen... |
6ce90445-02f1-4030-b3e1-9a302cb09a62 | 6 | private void findPlugins(boolean activateAll) {
File[] files = fileDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".json");
}
});
for( File f : files ) {
try{
Scanner s = new Scanner(... |
ea81e841-e706-4dc2-989c-bfc23d71b8f8 | 9 | protected void paint(Event event, Object element) {
if (!isOwnerDrawEnabled())
return;
ViewerCell cell= getViewerCell(event, element);
boolean applyColors= useColors(event);
GC gc = event.gc;
// remember colors to restore the GC later
Color oldForeground = gc.getForeground();
Color oldBackground... |
097e0bbf-cfde-4b13-9ee8-f4dc29fd0365 | 0 | @Override
public final boolean setDebug(boolean d) {
return (debug = d);
} |
c7b9e6be-2ab5-47fb-8ddc-af99bdedfdb6 | 3 | @Override
public void deserialize(Buffer buf) {
dungeonId = buf.readShort();
if (dungeonId < 0)
throw new RuntimeException("Forbidden value on dungeonId = " + dungeonId + ", it doesn't respect the following condition : dungeonId < 0");
inviterId = buf.readInt();
if (invit... |
becf0f99-de33-44c1-9057-51d10cf9cb5e | 7 | public void initialize() {
lastxpos = lastypos = 0;
cellRange = cellSize; cellSize = cellRange + 2*intpad;
jPlColHeader = new JPanel() {
private static final long serialVersionUID = -9098547751937467506L;
java.awt.Rectangle r;
public void paint(Graphics g) {
r = g.getCli... |
7da86be6-f03e-4c6d-b56f-b3521b1fb2a5 | 1 | private static int[][] createRandomCoordinates(int n, Random random) {
int[][] coordinates = new int[n][2];
for (int i = 0; i < coordinates.length; i++) {
//we ignore the case that two cities have the same coordinates - it should work anyway?
coordinates[i][0] = Math.abs(random.nextInt()%MAP_SIZE);
... |
14060b77-bf71-4d2b-ac5b-f4eaf6bdc1c6 | 0 | public void setPackgeName(String packgeName) {
this.packgeName = packgeName;
} |
4e18d3c1-13f9-4882-a923-52af0c8c76e4 | 5 | private static String getImageThunb(Element work) throws Exception{
try{
Elements tmp = work.getElementsByClass("work_thumb");
if(tmp==null || tmp.size()==0) return "http://www.dlsite.com/images/web/home/no_img_sam.gif";
Element thumb = tmp.get(0).child(0);
Elements tmp1 = thumb.getElementsByTag("img");
... |
de623796-976e-4f28-9b2b-d7c14141889d | 3 | public void setFullScreen(DisplayMode dm){
JFrame f = new JFrame();
f.setUndecorated(true);
f.setIgnoreRepaint(true);
f.setResizable(false);
vc.setFullScreenWindow(f);
if(dm != null && vc.isDisplayChangeSupported()){
try{
vc.setDisplayMode(dm);
}catch(Exception ex){}
}
f.createBufferStrateg... |
09a6732e-c805-41a1-a0d7-18c159dbc9cf | 9 | private void collision(){
Rectangle r1 = pika1.getBounds();
Rectangle r2 = pikaBall.getBounds();
Rectangle r4 = pika2.getBounds();
Line2D.Double leftLine = new Line2D.Double(0, 600, 410, 600);
Line2D.Double rightLine = new Line2D.Double(410, 600, 800, 600);
Line2D.Double leftStickLine = new Line2D.Double(40... |
e6d156c7-3cda-4c50-9faa-7e5a316da605 | 3 | private Tree variableListPro(){
Tree variable = null;
VariableList variables = null;
if((variable = variablePro()) != null){
if(accept(Symbol.Id.PUNCTUATORS,",")!=null){
if((variables = (VariableList) variableListPro()) != null){
return new VariableList(variable, variables);
}
return null;
... |
fa1557c3-dde9-4dd5-a8e3-a3bad4e7edea | 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 fe... |
6b25a837-452d-48fe-ac81-2cfa90fb451b | 6 | @Override
protected void onSubmitAction(ActionRequest request, ActionResponse response, Object command, BindException errors) throws Exception {
final String targetParentPath = StringUtils.defaultIfEmpty(request.getParameter("folderPath"), null);
final String targetEntryPath = StringUtils.defaultIfE... |
827f3caa-f2d5-4d51-8583-00325c301618 | 9 | public void transfromHeadline()
{
if(this.hlDepth > 0)
return;
int level = 0;
final Line line = this.lines;
if(line.isEmpty)
return;
int start = line.leading;
while(start < line.value.length() && line.value.charAt(start) == '#')
{
... |
a5fce5f3-df89-4597-adab-9ff0bfd1f93a | 5 | public double cos(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a %= 360;
a += 360;
}
//return
if(a <= 90){
return cos[a];
}else if(a <= 180){
return -cos[180 - a];
}else if(a <= 270){
return -cos[a - 180];
}else{
return cos[360 - a];
}
} |
349bdee8-6325-4457-a50e-da5c0a61b61b | 9 | int exp2RK(ExpDesc e) {
this.exp2val(e);
switch (e.k) {
case LexState.VKNUM:
case LexState.VTRUE:
case LexState.VFALSE:
case LexState.VNIL: {
if (this.nk <= MAXINDEXRK) { /* constant fit in RK operand? */
e.info = (e.k == LexState.VNIL) ? this.nilK()
: (e.k == LexState.VKNUM) ? this.numberK(e.n... |
2de20cff-447d-414c-8e38-8e77b489fb31 | 7 | public void writeTermsToFile(String strNumber,
Hashtable<String, Double> oTermVsTFIDF) throws IOException {
String strKey = null;
Double maxValue = Double.MIN_VALUE;
String strTerms = "";
int len = oTermVsTFIDF.size() < 5 ? oTermVsTFIDF.size() : 5;
for (int i = 0; i < len; ++i) {
for (Map.Entry<Strin... |
6c443218-07d4-4157-a69d-ff7db2cb8f5d | 7 | public static void testGeneticAlgorithmDouble()
{
IMyRandomDataFunction<Double> rFunc = new IMyRandomDataFunction()
{
private final Random r = new Random();
@Override
public Double getRandom()
{
return Math.random();... |
c11249e7-a816-4562-b08f-4bd5b8975568 | 9 | public void deal()
{
Random rand = new Random();
// array of cards that have been dealt
boolean[] dealt = new boolean[21];
int r = rand.nextInt(21);
// picks some random cards for the solution
int check = 0;
String person, weapon, room;
person = weapon = room = "";
while(check < 3)
{
Card soluti... |
4cabc270-3c2b-49b9-a40a-e52013f172a8 | 1 | @Override
public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause ) throws Exception
{
if(!(cause.getCause() instanceof IllegalStateException))
cause.printStackTrace();
ctx.close();
} |
63cdc995-edcd-4588-8173-17054a43dc44 | 4 | public Boardable[] canBoard(Boardable batch[]) {
final Batch <Boardable> CB = new Batch <Boardable> () ;
if (mainEntrance() != null) CB.add(mainEntrance()) ;
if (docking != null) CB.add(docking) ;
int i = 2 ; for (Mobile m : inside()) if (m instanceof Boardable) {
CB.add((Boardable) m) ;
}
... |
122edc7e-3962-499f-8049-11f066fafb1a | 3 | public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) {
String worldName = null;
if (args.length < 1) {
if (!(sender instanceof Player)) {
Language.IN_GAME_ONLY.bad(sender);
return;
}
worldName ... |
e17489ff-2db1-4df8-a09f-9a211f6622cb | 5 | public boolean place(int x, int y) { //if all squares are free, place ship and placed == true. if not, return false
if (randomAlignment() == true) {
x = randomWithRange(0,8);
for (int i = x; i < x + 2; i++) {
if (!Grid.isSquareEmpty(i, y)) {
Grid.addTo... |
39562ca1-04b3-4b52-b1d8-e799df6b3325 | 9 | @Override
public ArrayList<DetectorHit> getHits(Path3D path) { // Initialize the hit list array
ArrayList<DetectorHit> hitList = new ArrayList<>();
if (path == null) {
return hitList;
}
// Create an intersect point object that will contain the line-face
/... |
1b3ae29c-121c-4523-9f58-2bfb7157695e | 9 | private static int getDist(Class<?> superClass, Class<?> klass) {
if (klass.isArray()) {
if (superClass.isArray()) {
superClass = superClass.getComponentType();
klass = klass.getComponentType();
} else {
// superClass must be Object. An array fitting into an Object
// must be more general than a... |
2bd28b2f-f078-490a-a3ac-7a577829205b | 9 | private int[] getStyle(int index) {
if (m_styleOffsets==null || m_styles==null ||
index>=m_styleOffsets.length)
{
return null;
}
int offset=m_styleOffsets[index]/4;
int style[];
{
int count=0;
for (int i=offset;i<m_styles.length;++i) {
if (m_styles[i]==-1) {
break;
}
count+=1;
... |
1bbd97da-d0a0-49af-8222-cc9974d4ed31 | 2 | public void destroy_socket(SocketBase socket_) {
slot_sync.lock ();
int tid;
// Free the associated thread slot.
try {
tid = socket_.get_tid ();
empty_slots.add (tid);
slots [tid].close();
slots [tid] = null;
// Remove t... |
3cadf73d-d635-4dc3-8536-f911e169cbbd | 1 | public boolean matches( Class<?> clazz )
{
return this.pattern.matcher( clazz.getSimpleName() ).matches();
} |
3864b069-d73d-4ccd-8925-93e36962c109 | 7 | @Override
protected void readAttributes(XMLStreamReader in)
throws XMLStreamException {
// @compat 0.9.x
if (in.getAttributeValue(null, ID_ATTRIBUTE_TAG) == null
&& "model.colony.colonyGoodsParty".equals(in.getAttributeValue(null, "source"))) {
setId("model.modifier.c... |
edcebb5e-04b2-45a9-8334-a2a779248094 | 1 | public void setStartTime(long startTime) {
if (this.startTime != 0) {
log.debug("請注意:進入點設了第二次:" + this.name);
}
this.startTime = startTime;
} |
969fde23-7f9d-4f0a-aef3-bacde46528ba | 3 | public String toString() {
String s = "";
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
char symbol;
switch (mapxy[x][y]) {
case 0:
symbol = '.';
break;
def... |
29e55611-be6c-44cd-858b-a127766bfd5b | 6 | public static void printXmlElementAttributes(OutputStream stream, Cons attributes) {
{ Stella_Object item = null;
Cons iter000 = attributes;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
item = iter000.value;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(item);
... |
8c98ebcb-f246-4712-a7cb-b62534aeec1e | 7 | public void run() {
while (true) {
try {
_socket = _serverSocket.accept();
System.out.println("Master connected!");
_istream = _socket.getInputStream();
BufferedReader receiveRead = new BufferedReader(new InputStreamReader(_istream));
String receiveMessage;
String[] tokens;
wh... |
e184ec5a-8b07-46f2-b395-c875079978cf | 7 | final public void selectUnionStmt() throws ParseException {
selectStmt();
label_8:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case UNION:
case UNION_ALL:
;
break;
default:
jj_la1[20] = jj_gen;
break label_8;
}
switch ((jj_ntk==-... |
31fc91c2-f558-4b6b-af73-420b1631f140 | 5 | public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("src/utilities/kdtree.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
"src/utilities/kdtree.out")));
Scanner in = new Scanner(f);
// Scanner skp=new Scanner(System.in)... |
9ddd6351-cd20-4e49-97be-9daced16d014 | 8 | public void ticketSubMenu(int ticketID) {
while (true) {
String[] standardOptions = {
"1 - View ticket details",
"2 - Add entry", // DavidE
"q - Go Back"
};
String[] adminOptions = {
"1 - View ticket details",
... |
59075b9f-60d4-476d-be9f-b5432c6646bc | 5 | public int canWalk(String side, Hexpos pos){
// 0 someone there's 1 empty but cant 2 empty and can
State state = this;
if(side != "red" && side != "blue")
return -1;
if(state.owner(pos) != null)
return 0;
MyList walkArea = pos.neighbours();
for(Object tmp : walkArea){
if(state.owner((Hexpos)tmp) ==... |
903c942c-b364-4e50-8dbf-cabd40d81f16 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node other = (Node) obj;
if (name != other.name)
return false;
if (visited != other.visited)
return false;
return true;
} |
84788e9f-9aa4-4a2a-8722-c0ff214819d8 | 3 | public List<List<Integer>> sort(List<List<Integer>> listToSort) {
int listSize = listToSort.size();
boolean swapped;
do {
swapped = false;
for (int i = 0; i < listSize - 1; i++) {
int one = listToSort.get(i).get(1);
int two = listToSort.ge... |
5948377c-7e06-4acf-a21f-b5022e2652dc | 7 | private void printIECLines() {
System.out.print("IEC/F: ");
if ((iecLines & 0x10) == 0) {
System.out.print("A1");
} else {
System.out.print("A0");
}
// The c64 has id = 1
int sdata = ((iecLines & 0x40) == 0) ? 1 : 0;
System.out.print(" C" + sdata);
sdata = ((iecLines & 0x80)... |
868e8183-595e-4c28-9af2-75d875f60e83 | 2 | protected static <K, V> K lookupKeyByValue(Map<K, V> map, V value) {
for (final Map.Entry<K, V> entry : map.entrySet()) {
if (value.equals(entry.getValue())) {
return entry.getKey();
}
}
return null;
} |
a98edfd8-f522-4686-85a2-f6d95bf17562 | 4 | public static boolean allEqualTo(byte[] data, byte value) {
if (data == null || data.length == 0) {
return false;
}
for (byte b : data) {
if (b != value) {
return false;
}
}
return true;
} |
bf2ab2d3-4aae-4405-8d3e-c1b19cb44cd0 | 7 | public String[] getMonthTable() {
setGregorian(gregorianYear, gregorianMonth, 1);
computeChineseFields();
computeSolarTerms();
String[] table = new String[8];
String title = null;
if (gregorianMonth < 11)
title = "";
else
title = "";
title = title + monthNames[gregorianMonth - 1] + "月" + "";
Str... |
36d4a8e4-1cdc-4beb-ab9f-8702e2059e73 | 9 | public Value newValue(final Type type) {
if (type == null) {
return BasicValue.UNINITIALIZED_VALUE;
}
boolean isArray = type.getSort() == Type.ARRAY;
if (isArray) {
switch (type.getElementType().getSort()) {
case Type.BOOLEAN:
case... |
01630e33-b665-4f3b-b2af-b04060fe2669 | 4 | private void seeOnMap(int id){
/*
* emfanizei ton xarth me kedro thn topothesia tou oximatos
*/
JFrame mapFrame = new JFrame("Topothesia Oxhmatos");
String[] latLon=con.getLatLon(id);
String lat,lon;
if(latLon!=null){
lat=latLon[0];
lon=latLon[1];
try {
String imageUrl = "htt... |
4439c234-57a3-49aa-817e-3b180e6dded1 | 8 | public static boolean setGuildType(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you... |
c90c53db-6c69-4f9f-9f03-c43fbd370210 | 0 | public SimpleStringProperty firstNameProperty() {
return firstName;
} |
b3b6cf8e-3414-4f30-ab21-3d9fb14e27bc | 8 | public void addAccount() {
AddAccountDialog addaccount = new AddAccountDialog(this, "Add Account");
Point loc = getLocation();
addaccount.setLocation(loc.x + 50, loc.y + 50);
addaccount.setModal(true);
addaccount.setVisible(true);
if (!addaccount.canceled()) {
String number = null;
try {
number ... |
613a5c3d-103a-489d-ab1a-500b080e24f6 | 5 | private static Move ForwardRightCaptureForWhite(int r, int c, Board board)
{
Move forwardRightCapture = null;
if(r<Board.rows-2 && c<Board.cols-2 &&
(
board.cell[r+1][c+1].equals(CellEntry.black)
|| board.cell[r+1][c+1].equals(CellEntr... |
223b7448-95fe-4910-b22f-732ecbc55dd2 | 7 | public static final Dimension getPreferredSize(Font font, String text) {
int width = 0;
int height = 0;
int length = text.length();
if (length > 0) {
TIntIntHashMap map = getWidthMap(font);
int fHeight = getFontHeight(font);
char ch = 0;
int curWidth = 0;
for (int i = 0; i < length; i++) {
ch... |
74651650-8906-448b-800a-437d5eff698b | 7 | public static void main(String[] args) {
if(args.length!=1){
System.out.println("Inappropriate arguement passed, please pass only 1 arguement");
return;
}
if(!readConfig(Constants.CONFIGFILE,Integer.parseInt(args[0]))){
return ;
}
if(!ConnectionManager.createConnections(currentNode,connecti... |
7d6995d9-c013-4ca9-bca9-19b0d7f1f392 | 0 | public BrezenhemLine(Excel ex1, Excel ex2) {
begin = ex1;
end = ex2;
setColoredExes();
} |
b305d298-b625-4681-b30a-11d3ef960691 | 8 | public void processGroups(LevelManager lm)
{
for (Group group: lm.modelManager.units.values())
{
//System.out.println(group.position);
if (group != null)
processEntities(group.entities);
}
for (Group group: lm.modelManager.improvements.values())
if (group != null)
processEntities(group.entitie... |
f8954cd7-75ce-4c8a-8e61-69d517fe5c22 | 8 | protected Background(
String name, String costumeTex, String portraitTex,
int standing, int guild, Object... args
) {
this.name = name ;
if (costumeTex == null) this.costume = null ;
else this.costume = Texture.loadTexture(COSTUME_DIR+costumeTex) ;
if (portraitTex == null) this.portrait = null... |
d8ca6126-7b9b-4a25-bdfb-02d6605b0b83 | 2 | @Override
public void init (AbstractQueue<QueueElement> queue, Properties props)
throws MalformedURLException {
this.queue = queue;
this.props = props;
String strUrl = props.getProperty("destinationURL");
if (strUrl == null) {
throw new RuntimeExcept... |
2f90d802-cb9d-48f6-9cf2-e6660c95ddac | 4 | public Console()
{
// create all components and add them
frame=new JFrame("Java Console");
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize=new Dimension((int)(screenSize.width/2),(int)(screenSize.height/2));
... |
efcc6ceb-56b3-496d-bffc-f8b8eeda6398 | 6 | public void addToAll(String text) {
try {
text = "Announce: " + text;
Scanner scan = new Scanner(this);
File temp = new File("temp");
PrintWriter pw = new PrintWriter("temp");
while(scan.hasNextLine()) {
String line = scan.nextLine();
... |
c1f1bb60-1959-4d05-98c7-0f095ae67d49 | 0 | @Basic
@Column(name = "SOL_TIPO_SOLICITUD")
public String getSolTipoSolicitud() {
return solTipoSolicitud;
} |
a85e020d-fbf3-42cb-b486-7ea178d4be90 | 8 | private void getTransitionsFromXML(Document doc, PetriNet pn) {
NodeList resourcesList = doc.getElementsByTagName("transition");
for (int i = 0; i < resourcesList.getLength(); i++) {
Node nNode = resourcesList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
... |
107fe43c-6b13-4725-a31d-26d289341eac | 0 | public void stopSleeping() {
TimerTask isNotSleeping = new TimerTask() {
public void run() {
isSleeping = false;
GUI.println("sleeping stoped");
sendGameResults();
}
};
Timer time = new Timer();
time.schedule(isNotSleeping, 20000);
} |
a0ee6046-35a8-46bd-92e0-c86832432103 | 0 | protected void onPrivateMessage(String sender, String login, String hostname, String message) {} |
5302c1d4-0f3f-4637-b6b4-ed401841ed68 | 8 | public final int partitionByCost(int lb, int ub) { // for an outline of how this works, see the partition method for name
Person pivotElement = allPersons[lb];
int max = logicalSize;
int left = lb, right = ub;
Person temp;
while (left < right) {
while ((allPersons[left].totalCostWeek() <= pivotElement.tot... |
76e52a98-1fe2-4119-92aa-251e42faae3d | 1 | @Override
public void pickUp(Player player) throws InvalidActionException {
if (isActive())
throw new InvalidActionException("You can't pick up a live grenade");
addItemToPlayersInventory(player);
} |
1e821bb8-8478-488d-8aa6-dd1167585df4 | 6 | public DFS addByteArray(int address, int length, String label, int... format) {
if (label != null)
rom.label[address] = label;
for(int i = 0; i < length; i++) {
for (int f = 0; f < format.length; f++) {
int ca = address + format.length * i + f;
rom.type[ca] = ROM.DATA_BYTEARRAY;
... |
64a2ce69-e65d-4325-b1b6-f8c679a2d2cf | 5 | public Problem validate(final Object instance,
final LowerCase annotation, final Object target,
final CharSequence value)
{
if (value == null || value.length() < 1)
{
if (annotation.required())
{
return new Problem(instance, annotation, target, value);
}
return null;
}
for (... |
e6a80562-dcca-48a3-9baf-e9d634d47c1e | 5 | public ArrayList<Link> getParentsFromLink(ArrayList<Link> parents, Link link, Link parent) {
if (this == link) {
boolean found = false;
for (Link link1 : parents) {
if (parent == link1) {
found = true;
}
}
if (!f... |
ace49a21-16a2-45a3-a395-cbe5f59f6778 | 8 | protected void initProperties(){
properties = new HashSet();
//scan methods
for (Method method : c.getMethods()) {
String name = method.getName();
if (Modifier.isPublic(method.getModifiers()) && name.startsWith("get")) {
name = lowerFirstChar(name.substrin... |
e0e49105-b95d-41f5-9762-6f7d3b8caaff | 4 | @Test
public void testFields() {
try {
postModel.getField("fake_field");
fail("Non-existent field should have thrown exception on get");
} catch (IllegalStateException e) {
}
try {
postModel.setField("fake_field", null);
fail("Non-existent field should have thrown exception o... |
b4100b2d-c2ee-4a54-988d-d2f4bbe14408 | 3 | public static BufferedImage getDepthRender(Raycaster raycaster){
Screen screen = raycaster.getBuffer();
BufferedImage render = new BufferedImage(screen.getWidth(), screen.getHeight(), BufferedImage.TYPE_INT_ARGB);
int width = screen.getWidth();
int height = screen.getHeight();
... |
d5de8049-60a2-43f1-baa2-692d728f72d8 | 0 | public long getSendTime() {
return sendTime;
} |
1e0e53bd-ce19-404b-b6c4-3ed32fb7fb23 | 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... |
8849de9b-279c-4b63-892d-44f672560a7c | 9 | * @param phase
* @param MV_returnarray
* @return int
*/
public static int computeNextMoonPhase(int n, Keyword phase, Object [] MV_returnarray) {
{ int i = 0;
double am = 0.0;
double as = 0.0;
double c = 0.0;
double x = 0.0;
double x2 = 0.0;
double extra = 0.0;
do... |
b49fdd12-d713-44fe-ac9e-1053865f8e66 | 9 | @Override
protected void finalizeRecord(RecordConfig record) {
super.finalizeRecord(record);
boolean minSet = record.getMinLength() != null;
if (stream.isStrict()) {
if (record.getMinLength() == null) {
record.setMinLength(record.getMinSize());
... |
651cb110-ff0a-4662-99fd-0cd4e82429eb | 6 | public int sqrt(int x) {
if (x <= 0)
return 0;
int k = 0;
int o = x;
int base = 5;
while (x >= 1) {
++k;
x /= base;
}
int p;
if((k & 1) == 1){
p = k / 2;
}else{
p = k/2 -1;
}
int q = k - p;
for (int i = pow(p,base); i <= pow(q,base); ++i) {
if (i * i <= o && (i + 1) * (i + 1) ... |
561a70d2-70f5-4756-9b55-f4bd11566b16 | 2 | public boolean partidoSemiCompleto() {
return (listaJugadores.size()==10) && (listaJugadores.stream().anyMatch(j -> j.getModo() instanceof Solidario)|| listaJugadores.stream().anyMatch(j -> j.getModo() instanceof Condicional));
} |
e75164e4-2873-4d5d-a4b8-40c9faff1bed | 3 | void deleteDirectory(File dirPath) {
File files[] = dirPath.listFiles();
for (File file : files) {
if (file.isFile()) {
file.delete();
} else {
String ft[] = file.list();
if (ft.length == 0) {
file.delete();
} else {
this.deleteDirectory(file);
}
}
}
dirPath.delete();
} |
8dd21e72-bf12-4593-b9dc-a3440a9b09af | 0 | public void setColumnName(String columnName) {
this.columnName = columnName;
} |
5e287f2d-a853-4847-9c59-feedfd114db4 | 1 | @Override
public void mouseMove(MouseEvent e) {
if(this.getMouseListener() != null)
{
this.getMouseListener().MouseMove(this, e);
}
} |
a74ad44b-2c01-4d1c-b856-a21e09118d5b | 0 | public Object GetNextReady()
{
//holds first object in the ready queue
Object tmp = null;
//pickup priority Object
tmp = readyQueue.poll();
//return the object
return tmp;
} |
05b89895-fdb6-4826-ac49-73068d767b4e | 6 | @Override
public int compare(String s1, String s2)
{
if (s1.equals(s2))
return 0;
if ((s1.compareTo("NIL") == 0) || (s2.compareTo("LIN") == 0))
return 1;
if ((s2.compareTo("NIL") == 0) || (s1.compareTo("LIN") == 0))
return -1;
if (s1.compareTo(s2) < 0)
return -1;
else retu... |
8272db08-9768-4cba-bb2b-31df224af83f | 2 | public int clamp(int num, int min, int max){
if(num <= min)
{
return min;
}
if(num >= max)
{
return max;
}
return num;
} |
bf35b1b1-e935-4d4e-9f33-4fb9cbcb7661 | 2 | public void eliminarUltimo(){
Nodo<T> q = this.p;
Nodo<T> t = new Nodo<T>();
if(q.getLiga() == null){
this.p = null;
}else{
while(q.getLiga() != null){
t = q;
q = q.getLiga();
}
t.setLiga(null);
}
} |
ed71968d-e147-4634-9d26-68808c059efa | 9 | @SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Pair other = (Pair) obj;
if (left == null) {
if (other.left != null)
return false;
} else if (!lef... |
4ebb6dde-d56d-4d9b-a983-9a3bd8cd40ac | 5 | private boolean isSame(DListNode node, short red, short green, short blue, byte direction){
Run test = new Run(1,red,green,blue);
if (direction == CURR){
return node.run.equalsIntensities(test);
}
else if (direction == NEXT && node.next.run != null){
return node.next.run.equalsIntensities(t... |
bf660a0c-ac5d-4ef4-89e1-8230744100ba | 0 | @Override
public void endDocument() throws SAXException {
System.out.println("end Document");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.