method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a9b03863-aba1-413e-a517-ce96db050631 | 6 | public void process() {
int taskNum = 0;
List<PWMWithThreshold> thresholds = collectThreshold();
Collections.sort(thresholds, new Comparator<PWMWithThreshold>() {
@Override
public int compare(PWMWithThreshold o1, PWMWithThreshold o2) {
return o1.pwm.getName().compareTo(o2.pwm.getName());... |
2608541f-ac8d-4951-bd07-0da0e7e822d0 | 3 | private void makePrefab(){
prefab = new Prefab(x1, y1, x2, y2);
boolean found = true;
int filenumber = 0;
String pathTag = "HousePrefab";
String path = "";
do {
path = "data/" + pathTag + String.valueOf(filenumber) + ".pfb";
File f = new File(path);
if (!f.isFile()){
found = false;
} else... |
f9ccdb63-06d9-4a79-8ad6-de03ee545635 | 9 | private static void selectDB() throws Exception {
int menuChoice;
do {
System.out
.println("*** Willkommen zu " + NAME + " " + VERSION + " ***\n\n"
+ "Welche Datenbankzugriffsart möchten sie nutzen? \n\n"
+ "1 SQL-D... |
1e796e05-7423-4392-a66b-89e39d7d2474 | 2 | private int swim(int i)
{
Key t = pq[i]; // Save key for later restoring
while (i > 1 && less(pq[i / 2], pq[i]))
{
// exch(pq, i / 2, i);
pq[i] = pq[i / 2]; // half exchanges
i = i / 2;
}
pq[i] = t; // restore key
return i;
} |
e149b3c4-2620-4702-9f02-3d2cc246b1dd | 0 | public Geometry<T> add(T elements)
{
coordinates.add(elements);
return this;
} |
95f10e1e-615e-4729-b4c5-0c7d2078f1bf | 0 | public static void main(String[] args) {
String q = "howdy";
System.out.println(q); // howdy
String qq = upcase(q);
System.out.println(qq); // HOWDY
System.out.println(q); // howdy
} |
8a6a87de-7176-46a9-853a-0cb75c6d4f21 | 9 | public void messageBroadcasted(final Blackboard.BlackboardMessage message)
{
if (message instanceof MatrixPatch)
{
final MatrixPatch patch = (MatrixPatch)message;
synchronized (queuedPatches)
{
queuedPatches.offerLast(patch);
queuedPatches.notifyAll();
}
}
else if (message instanceof Loc... |
a22b1d02-803b-444e-bcdf-99e3e5182bcf | 7 | public static boolean heuristicAcronymP(String itemstring) {
{ boolean letterfoundP = false;
boolean numberfoundP = false;
{ char c = Stella.NULL_CHARACTER;
String vector000 = itemstring;
int index000 = 0;
int length000 = vector000.length();
for (;index000 < length000; ... |
391abdb1-a6ad-4615-bbbc-d0997c4b4249 | 9 | public void setZeroes(int[][] matrix) {
int[] rows = new int[matrix.length];
int[] cols = new int[matrix[0].length];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[0].length; j++) {
if (matrix[i][j] == 0) {
rows[i] = 1;
cols[j] = 1;
}
}
}
for (int i = 0; i < rows.... |
b6ae7a23-2387-4095-ae7f-0843ebfcc0cf | 5 | private void solve() {
if (isAllOnes()) {
minimisedExpression = "1";
} else {
if (isAllZero())
minimisedExpression = "0";
else {
arrayList = new ArrayList<KarnaughNode>();
for (int i = 0; i < kmap.getRow(); i++) {
for (int j = 0; j < kmap.getColumn(); j++) {
if (kmap.getCellValue(i,... |
b26f4715-c1f0-4be2-8790-f5a2568c1a9c | 0 | public void schedule(Runnable childStatement) {
executor.submit(childStatement);
} |
0b2d98b3-0402-4da9-a1c9-319a8407ddb2 | 3 | @Override
public void writeTo(WordWriter out)
throws IOException {
WordReader in = new WordReader(new FileInputStream(file), littleEndian);
int wordsWritten = 0;
try {
int word;
while(true) {
word = in.readWord();
if(word == -1)... |
a62cd029-942e-43b9-9cc1-57ab47c41ff7 | 5 | private Chunk getChunk(int x, int z)
{
for(int i = chunks.size() - 1; i > 0; i--)
if(chunks.get(i).getX() == x && chunks.get(i).getZ() == z)
if(i < chunks.size() && i >= 0)
return chunks.get(i);
return null;
} |
67744306-51aa-424f-93d9-7fccf1282975 | 1 | public List[] getReplacements(String symbol) {
List[] toReturn = (List[]) symbolToReplacements.get(symbol);
return toReturn == null ? EMPTY_LIST : toReturn;
} |
30e61d02-d730-4773-97f6-cf1926b86d3a | 8 | public static void main(String[] args) {
String text;
int k = 0;
if (args.length == 1) {
k = Integer.parseInt(args[0]);
}
System.out.print("Enter string: ");
Scanner s = new Scanner(System.in);
text = s.nextLine();
MyHashMap<String, Markov> hash = new MyHashMap<String, Markov>();
int distinct = 0;
for (... |
2e0717a4-3492-4023-ade6-bb04024ec055 | 9 | static public void statisticMonth(){
Statement stmt = null;
ResultSet rs = null;
for(int month = 1; month <=12; month ++)
try {
String monthStr = "" + month;
if(month < 10) monthStr = "0" + monthStr;
stmt = conn.createStatement();
String sqlTxt = "select count(*) as cnt from tweet_2011_" ... |
b10c0264-3be7-4c3a-a5ba-a5e5f328ff3f | 9 | static String escapeStringForASCII(String s) {
String out = "";
char[] cArray = s.toCharArray();
for (int i = 0; i < cArray.length; i++) {
char c = cArray[i];
if (c > 127) {
//non-ASCII Unicode
out += "\\U";
String hex = Int... |
c3bc3927-ff1e-48ac-8e80-82ca12e5fa4b | 2 | private static ConfigurableConnectionText goodLocation( PathedGraphConnection connection, float j ) {
if( j == 0 ) {
ConfigurableConnectionText text = new ConfigurableConnectionText( connection );
text.setText( "Source" );
text.setPosition( TextStrategyFactory.positionNearSource() );
text.setAngle( TextSt... |
c0da158e-fab6-4cce-a870-fb59c657ebb5 | 5 | public void caretUpdate(CaretEvent e) {
boolean boldFound = false;
boolean italicFound = false;
boolean underlineFound = false;
int dot = e.getDot();
int mark = e.getMark();
if (dot == mark) {
wordProcessor.copy.setEnabled(false);
wordProcessor.cut.setEnabled(false);
boldFound = checkS... |
750bf260-43fd-453b-9fd9-a551ad39299a | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TDatsriPK other = (TDatsriPK) obj;
if (!Objects.equals(this.transNo, other.transNo)) {
return... |
5c9d75c9-f729-460d-bae2-51763f1ada34 | 6 | private void drawEdges(Graphics2D g2, List<Edge> edges, boolean drawBorder, int zoomLevelToDrawName, BasicStroke roadStroke, BasicStroke borderStroke, Color roadColor, Color borderColor)
{
for (Edge edge : edges)
{
double x1 = edge.getFromNode().getxCoord();
double y1 = edge.getFromNode().getyCoord();
dou... |
4d42b515-f8a5-4526-8e34-110e353397ba | 0 | public static Forme I() {
ArrayList<Vecteur> liste = new ArrayList<>();
liste.add(new Vecteur(0, 0));
liste.add(new Vecteur(0, 1));
liste.add(new Vecteur(0, 2));
liste.add(new Vecteur(0, 3));
Vecteur<Integer> _centre = new Vecteur(0, 1);
return new Forme("I", lis... |
35123899-83ed-404a-a970-ed0e3262c1cf | 7 | public String[][] fileReadIn(String fileDirectory) throws IOException{
ToolBag tool = new ToolBag();
BufferedReader fileReader = null;
try {
fileReader = new BufferedReader(
new InputStreamReader(getClass().getResourceAsStream(fileDirectory)));
} catch (NullPointerException propertiesReaderNPE) {
try... |
0e08f25a-2532-4cb2-b4d0-363617672965 | 1 | public static void close(){
clearCache();
for(String id : staticClips.keySet()){
stop(id);
staticClips.get(id).close();
}
staticClips.clear();
} |
94065c34-4776-4d99-b081-a0d40acbc54d | 0 | public String getDesignacao() {
return designacao;
} |
6f097211-702d-4434-ac9d-8e94c4514bd2 | 2 | public void open() {
Display display = Display.getDefault();
createContents();
shlPoliciesList.open();
shlPoliciesList.layout();
while (!shlPoliciesList.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} |
d4c49fad-fbc7-4c34-9514-821e2245ea8f | 2 | public static void makeNextWhiteMoves(){
boolean incorrectOption = true;
while(incorrectOption)
{
Move move = UserInteractions.getNextMove(Player.white);
if (CheckValidMoveForWhiteHuman(move.initialRow, move.initialCol,
move.finalRow, move.finalCol... |
717a1438-7da1-4cf7-89f9-f5ee1e8f4adc | 2 | @Test
public void TestCustomConnectionParameters() {
RequestConfig reqC = RequestConfig.custom()
.setSocketTimeout(10) // 1/100 of a second in miliseconds
.setConnectTimeout(10) // 1/100 of a second in miliseconds
.build();
HttpClient client = HttpClients.... |
cefcc079-0373-4020-8f54-ef8bc528e49d | 6 | private void findMinimalDistances(Vertex node) {
List<Vertex> adjacentNodes = getNeighbors(node);
Vertex lasttarget = null;
for (Vertex target : adjacentNodes) {
System.out.println("target.toString() " + target.toString());
if (getShortestDistance(target) > getShortestDi... |
2ab080f1-414c-49ee-88d7-b36b551c18f0 | 5 | public OptionFileMenu(final boolean ouvrir) {
setPreferredSize(new java.awt.Dimension(600,400));
final JFileChooser arbre = new JFileChooser();
if(ouvrir) {
setTitle("Ouvrir...");
} else {
setTitle("Enregistrer...");
arbre.setApproveButtonText("Sauvegarder");
}
getContentPane().add(arbre);
arb... |
d2f8e9c1-9dce-44b2-8164-23f435e59f7a | 9 | @Override
public void act() {
if (canMove()) {
if (head.getSteps() == 0) {
oldDirection = direction;
direction = head.getDirection();
}
switch (direction) {
case NORTH:
this.animation = upAnimation;
... |
892019f5-1cf8-4d5f-9cc1-29fd68d84942 | 1 | public Shape addItem(Shape item) {
if (item == null) {
return null;
}
items.add(item);
repaint();
return item;
} |
bec5a165-4147-4475-9d9c-db5f0158ac3d | 2 | private void getTimerPage(HttpServletResponse response, UserSession session, Map<String, Object> pageVariables) throws ServletException, IOException {
Long userId = (session != null) ? session.getId() : null;
if (userId != null) {
pageVariables.put("time", new Date().toString());
... |
6e23495f-21a0-4bc0-838d-6d0c29e8fc4b | 9 | private int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Can not deal with null strings");
}
if (s.length() == 0) return t.length();
if (t.length() == 0) return s.length();
int n = s.length();
int m = t.length();
int d[][] = new int[... |
d676130f-e2da-45a7-a34c-e4eef59e0678 | 0 | public Piece(TorrentByteStorage bucket, int index, int offset, int length,
byte[] hash) {
this.bucket = bucket;
this.index = index;
this.offset = offset;
this.length = length;
this.hash = hash;
// Piece is considered invalid until first check.
this.valid = false;
// Piece start unseen
this.seen =... |
141690d8-5fb4-480a-9fda-2058e89bbcb9 | 1 | public void setLocationManually(Point point) {
moving = true;
myAutoPoint = point;
if(myView != null){
setLocation(myView.transformFromAutomatonToView(point));
}
} |
675b4f83-5b02-40a3-9b0a-977902a7e40a | 0 | public void Init()
{
Decoder.InitBitModels(Models);
} |
6dd312a6-d478-4149-976c-3b5ac16dc507 | 5 | @EventHandler
public void onPlace(BlockPlaceEvent e) {
Player player = e.getPlayer();
Location loc = e.getBlockAgainst().getLocation();
if (e.getBlockAgainst().getType() == Material.SIGN
|| e.getBlockAgainst().getType() == Material.SIGN_POST
|| e.getBlockAgainst().getType() == Material.WALL_SIGN) {
... |
c0c395a9-d480-4040-97e7-80259ec54dbe | 6 | public ListNode reverseKGroup(ListNode head, int k) {
if (k <= 1 || head == null) {
return head;
}
ListNode lastTail = null;
ListNode tail = head;
int count = 0;
Stack<ListNode> stack = new Stack<ListNode>();
while (tail != null) {
stack.push(tail);
tail = tail.next;
count++;
if (count >= k... |
f31ccf41-15e7-4a59-bea3-5de1c2632198 | 6 | boolean detectNegation() {
for (int i = 0; i < elements.length; i++) {
//termes permettant de valider une négation
if (Pattern.matches("ne|pas|jamais|rien|aucun|aucune|n|impossible|moins|peu", elements[i])) {
// expression regulière
return true;
... |
ee67c839-09c3-432b-a611-7dabfe40c105 | 0 | @Override
public TKey getKey() {
return _key;
} |
307bbd73-89c7-4dfd-bdb8-6d01dfe1b218 | 2 | public static UnitTag getName(char tag) {
if (mapping == null) {
mapping = new HashMap<Character, UnitTag>();
for (UnitTag ut : values()) {
mapping.put(ut.tag, ut);
}
}
return mapping.get(tag);
} |
329c4adb-5afd-4ac4-9cfa-080ebe5d31c9 | 1 | public boolean addStudent(Student stu) {
String insert = "INSERT INTO STUDENT VALUES(?,?,?,?,?,?,?)";
int n = 0;
try {
PreparedStatement ps = conn.prepareStatement(insert);
ps.setString(1, stu.no);
ps.setString(2, stu.name);
ps.setString(3, stu.sex);
ps.setDate(4, stu.birthday);
ps.setString(5, ... |
f0daa1db-3fd7-45f9-b4b0-9dd80591843e | 2 | public Command getCommand(int commandCode) throws Exception
{
Class<? extends Command> cls = dictCodeToClass.get(commandCode);
if(cls == null )
throw new UnknownCommandException();
return cls.newInstance();
} |
284545c2-3c7a-464a-ac9f-0d380b9580d2 | 5 | public static void main(String[] args) {
// -------------------------Initialize Job Information------------------------------------
String startJobId = "job_201301181454_0001";
//String startJobId = "job_201212172252_0001";
//String jobName = "uservisits_aggre-pig-256MB";
//String jobName = "SampleWordCountWi... |
1fb3d2b4-1476-4445-9626-32ab2b8839c5 | 1 | public static StationDAO getInstance(Connection conn){
if(instance == null)
instance = new StationDAO(conn);
return instance;
} |
7004a1ba-a514-4950-886d-d129a637387e | 8 | public boolean equals(Object obj) {
if (obj == this) { // simple case
return true;
}
// now try to reject equality...
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof XYDrawableAnnotation)) {
return false;
... |
e4aee7b5-05d5-4eb5-8fa9-0d51777dd47a | 1 | private void render(){
BufferStrategy bs = this.getBufferStrategy();
if(bs == null){
this.createBufferStrategy(3);
return;
}
Graphics graphic = bs.getDrawGraphics();
graphic.setColor(Color.black);
graphic.fillRect(0, 0, getWidth(), getHeight());
obejectHandler.render(graphic);
... |
6ed663de-3d7a-48e6-812f-deb61d5b862a | 2 | private byte[] encrypt(EncryptableObject o, Key key) throws Exception{
String Algrithem;
if(key instanceof PublicKey){Algrithem = "RSA";}
else{Algrithem = "AES";}
ByteArrayInputStream i = new ByteArrayInputStream(o.toByteArray());
Cipher cipher = Cipher.getInstance(Algrithem);
cipher.init(Cipher.ENCRYPT_MOD... |
e23a6e79-5307-4a2a-9899-276b999f05cc | 5 | public Games()
{
super(new BorderLayout());
addGame(Zombies.class);
addGame(Testing.class);
addGame(Monsters.class);
addGame(AsteroidMission.class);
addGame(PolyCreator.class);
setBackground(Save.PLAYER_COLOR);
final JPanel topRow = new JPanel();
topRow.setBackground(Save.PLAYER_COLOR);
topRow.se... |
12a1e979-1ea2-4b78-bae2-021c28b1b74a | 5 | public static int reverseBits(int n) {
for (int i = 0; i < 16; i++) {
int j = 31 - i;
int a = n & (1 << i);
int b = n & (1 << j);
if ((0 == a && 0 == b) || (0 != a && 0 != b)) continue;
n = n ^ (1 << i);
n = n ^ (1 << j);
}
return n;
} |
8aacd5c5-0c6a-467b-9edf-5cee1e382295 | 2 | public void report_error(String message, Object info)
{
System.err.print(message);
System.err.flush();
if (info instanceof Symbol)
if (((Symbol)info).left != -1)
System.err.println(" at character " + ((Symbol)info).left +
" of input");
else System.err.println("");
else System.err.p... |
6df661e7-a091-4eb1-9d9b-8b5913be939e | 3 | protected void fireClientConnectEvent(ConnectOnServerEvent evt) {
if (clientConnectListenerList != null) {
Object[] listeners = clientConnectListenerList.getListenerList();
for (int i=0; i<listeners.length; i+=2) {
if (listeners[i]==ConnectOnServerListener.class) {
((ConnectOnServerLis... |
90654db9-e4f5-494b-ac75-5d9093e8ebd1 | 9 | public void alignBottom(ArrayList<Element> selectedElements) {
/* Most lowest */
int minBottom = Integer.MIN_VALUE;
int currentBottom = 0;
for (Element e : selectedElements) {
if (e instanceof AbsPlace) {
AbsPlace a = (AbsPlace) e;
currentBotto... |
26ae364f-e87b-44e5-9604-e7cf5abf7e35 | 3 | public String toString ()
{
StringBuffer buf = new StringBuffer (20);
buf.append ("usb");
buf.append ('-');
buf.append (busId);
if (port.length != 0) {
buf.append ('-');
for (int i = 0; i < port.length; i++) {
if (i != 0)
buf.append ('.');
// workaround for kjc 1.0.6 bug where
// port[i]... |
e35dc440-4967-44d4-acef-b9ac06c81abc | 3 | public static ActionStatusEnumeration fromString(String v) {
if (v != null) {
for (ActionStatusEnumeration c : ActionStatusEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
3f55e9c1-ddc5-456c-99c7-0af25c678bc0 | 6 | public void opRel(){
int op = stop.pop();
switch (op) {
case EGAL : iegal();
break;
case DIFFERENT : idiff();
break;
case INF : iinf();
break;
case INFOUEG : iinfegal();
break;
case SUP : isup();
break;
case SUPOUEG : isupegal();
break;
default : System.out.println("erreur ... |
40cb68b0-344d-4287-9cd1-b227205f2069 | 5 | @Override
public void run() {
String data = this.plugin.getFileMan().read(this.plugin.chatFile());
JSONArray jArray;
try {
jArray = (JSONArray) new JSONParser().parse(data);
for(int i=0;i<jArray.size();i++){
JSONObject json = (JSONObject) jArray.get(i);
String time = (String) json.get("time");
... |
170df934-fc9c-4262-863e-438a6810fe84 | 0 | public BSplaynForm (ArrayList<Excel> allEx)
{
allex = allEx;
setColoredExes();
} |
b730c73a-3b6e-40c7-9004-41957dd1a071 | 6 | public Command(String command, ClientCluster c){
try{
System.out.println("["+c.getID()+"] "+c.getClient().getUsername()+") " + command);
command = command.replaceFirst("Command ", "");
if(ClientHandler.getDataQueuer().isRealUser(c.getClient())){
if(ClientHandler.getDataQueuer().getUserConfig(c.getClient(... |
deeeac57-67e6-4de8-a323-730de89acdd0 | 2 | public void visitInnerClassType(final String name) {
if (state != CLASS_TYPE) {
throw new IllegalStateException();
}
CheckMethodAdapter.checkIdentifier(name, "inner class name");
if (sv != null) {
sv.visitInnerClassType(name);
}
} |
c5e334e8-cd7b-4271-9a04-f508f6d0148b | 8 | private void startGetSchemaElement(String name, Attributes attrs) {
if (name.equals("slideshow")) {
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("xsi:noNamespaceSchemaLocation")) {
// get the schema path
String path = attrs.getValue(i);
// ensure unix type file path... |
3db5935b-be9c-44cd-b5f5-84002ce5bd58 | 8 | final public void GrammarComponent(GrammarSection section, Scope scope) throws ParseException {
ParsedElementAnnotation e;
Annotations a;
a = Annotations();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 5:
case IDENTIFIER:
case ESCAPED_IDENTIFIER:
Definition(section, scope, a);
break;... |
90d0726a-0687-4658-8864-55b83b3af83d | 8 | public void keyPressed(KeyEvent e) {
char keychar = e.getKeyChar();
int keycode = e.getKeyCode();
if (keycode>=0 && keycode < 256) {
keymap[keycode]=true;
lastkey=keycode;
lastkeychar=keychar;
if (wakeup_key==-1 || wakeup_key==keycode) {
if (!eng.isRunning()) {
eng.start();
// key is cle... |
8dd13507-d0de-416f-8e1d-c0f274e7f812 | 5 | @Override
public void setCell(int x, int y, boolean live) {
if (y<0 || y>=getHeight()) return;
if (x<0 || x>=getWidth()) return;
if (live)
world[y][x] = 0;
} |
9392dfe0-8c4c-4224-8008-a64cc43d1986 | 1 | public static JGSystem getInstance() {
if (instance == null) {
instance = new JGSystem();
}
return instance;
} |
8815bef8-3d02-48c7-8084-8616a666b436 | 6 | public static Symbol destructureMethodNameTree(Stella_Object nametree, Object [] MV_returnarray) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(nametree);
if (testValue000 == Stella.SGT_STELLA_CONS) {
{ Cons nametree000 = ((Cons)(nametree));
if (!Stella_Object.symbolP(nametree0... |
2c254a4e-d667-4d11-9b6b-67ce2d39101d | 4 | public static Boolean canUnowned(PermissionFlag flag) {
if (flag.equals(ChunkyPermissions.BUILD))
return getBoolean(UNOWNED_BUILD);
if (flag.equals(ChunkyPermissions.DESTROY))
return getBoolean(UNOWNED_DESTROY);
if (flag.equals(ChunkyPermissions.ITEM_USE))
ret... |
42795f68-6066-455c-b7d8-e70807db84b8 | 3 | public boolean exist(ValueType value) {
if (!this.isEmpty()) {
SetElement<ValueType> help = head;
while (help != tail.getNext()) {
if (help.getValue() == value) {
return true;
}
help = help.getNext();
}
... |
28b1db50-5700-42a5-aa39-7ac8878f2140 | 7 | public String[] getInput() {
Scanner inFile = new Scanner(System.in);
System.out.println("\n\t________________________________________________________________________");
System.out.println("\n\t You must enter names for two players before starting a two player game.");
... |
a5bcbc6c-23a5-4f70-8594-18fed619677b | 6 | public void insert(int bno)
{
Node temp, fNode, parent;
temp = new Node(bno);
try
{
if(root == null)
root = temp;
else
{
fNode = root;
while(true)
{
parent = fNode;
if(bno < fNode.getbno())
{
fNode = fNode.getLeft();
if(fNode==null)
{
parent.setLe... |
fcbf5a3a-d8e6-46a1-944b-845e2bd79ac9 | 5 | public void mouseDragged(MouseEvent e)
{
if(e.getX()>x && e.getX()<x+width)
{
if(e.getY()>y && e.getY()<y+height)
{
selected=true;
}
}
if(selected)
{
mouseX=e.getX();
mouseY=e.getY();
}
} |
29ba83f4-af6e-456d-93b2-8b6b7fc03e1e | 6 | @Override
public void run() {
while (isRunning) {
if (direction == 'u') {
moveCol(-1);
}
if (direction == 'd') {
moveCol(1);
}
if (direction == 'l') {
moveRow(-1);
}
if (dir... |
d7624e43-6c71-4523-ad50-75ad4d460124 | 6 | public void printAllInterleavingsRecurr(String str1, String str2, String interleaving, int m, int n) {
/* If we used all characters from str1 and there are some left in str2 */
if (m == str1.length() && n < str2.length()) {
System.out.println(interleaving + str2.substring(n));
return;
}
/* If we use... |
6d87c735-d802-4551-8e79-1a665951bfdf | 1 | private Type simplePeek(Frame frame) {
Type type = frame.peek();
return (type == Type.TOP) ? frame.getStack(frame.getTopIndex() - 1) : type;
} |
1a5181af-cd8a-4bba-b1d3-6ccc7e770ff5 | 8 | private void debugPrintMoveList() {
for(int move : moveList) {
switch(move) {
case Move.RIGHT:
System.out.println("right");
break;
case Move.DOWN:
System.out.println("down");
break;
case Move.UP:
System.out.println("up");
break;
case Move.LEFT:
System.out.println("left");
... |
5c1d1a7c-3873-4ed8-8823-a6b4919d8d16 | 2 | public void Clear(){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
this.block[i][j] = 0;
}
}
} |
f96a3c97-f270-4d08-b4ef-f698065f40b1 | 4 | public static long inverseModulo(long a, long m) {
if (a <= 1 || m <= 1 || Num2.euclideEtendu(a, m)[0] != 1) throw new IllegalArgumentException();
long x0 = Num2.euclideEtendu(a, m)[1];
while (x0 < 0) {
x0 += m;
}
return x0;
} |
ab895feb-0213-46de-8369-5f379eca8385 | 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... |
914b2d69-2ef4-458e-80ef-81dfedf89956 | 1 | @Override
public double getVariance() throws VarianceException {
if (alpha > 2) {
return Math.pow(beta / (alpha - 1), 2) / (alpha - 2);
} else {
throw new VarianceException("InverseGamma variance alpha > 2.");
}
} |
5fd75ff8-de2c-42c7-ba20-78f063ab621d | 0 | public String getDescription() {
return description;
} |
83e2b786-0780-4984-955e-78daaa48d1de | 8 | public void sendReply_cgibin_zoomin_cgi(MyHTTPServer socket, List<HTTPRequestData> getData, String cookie) throws Exception
{
List<String> reply = new ArrayList<String>();
addHTTP200(reply, cookie);
addPageHeader(reply, "");
int width = 920;
int height = 150;
String host = null;
HTTPRequestData hostDa... |
5b0462d9-9fea-4fe8-9a10-b8b2631e8355 | 1 | private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
} |
11d0f542-b9bd-4efd-9df2-98944106c289 | 4 | private void createProperties(){
Properties prop = new Properties();
OutputStream output = null;
String fileName = System.getProperty("user.dir") + "/config/config.properties";
File file = new File(fileName);
//if ( !(file.exists())) {
//Create properties file
File directo... |
395a919b-e524-438d-97ae-83d1691d1469 | 0 | public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File("students.xml"));
Element root = doc.getDocumentE... |
57266e97-a939-496e-bb71-d6f1776a5cd2 | 2 | private boolean jj_3_49() {
if (jj_3R_68()) return true;
if (jj_3R_66()) return true;
return false;
} |
c865e75c-c16a-4b6b-b473-e74fdf65919a | 3 | private Row[] getViewToModel()
{
if (viewToModel == null)
{
int tableModelRowCount = tableModel.getRowCount();
viewToModel = new Row[tableModelRowCount];
for (int row = 0; row < tableModelRowCount; row++)
{
viewToModel[row] = new Row(row);
}
if (isSorting())
{
Arrays.sort(viewToModel)... |
d15a1cde-f200-438d-9a1b-34fac8858a5d | 6 | void updateSizes( direction d )
{
edge f;
switch( d )
{
case UP:
f = head.leftEdge;
if ( null != f )
f.updateSizes( direction.UP );
f = head.rightEdge;
if ( null != f )
f.updateSizes(direction.UP);
topsize++;
break;
case DOWN:
f = si... |
22fc940b-3ff4-4dae-a3e3-32ca387a2b7b | 7 | public void pop(String function, boolean result)
{
Integer start = startStack.pop();
callStack.pop();
if (traceOn)
{
System.out.println(
"<- " + level-- +
": " + function +
"(" + (result ? "true" : "false") +
",s=" + start +
",l=" + (index - start) + ... |
2af622ed-4cf5-4ade-aa1f-45b7182b274e | 6 | private int handleCH(String value,
DoubleMetaphoneResult result,
int index) {
if (index > 0 && contains(value, index, 4, "CHAE")) { // Michael
result.append('K', 'X');
return index + 2;
} else if (conditionCH0(value, index)) {... |
5f747407-e4ac-49a3-b281-14078110c84c | 8 | public static void main(String[] args) {
make_translate();
String delimiter = "\t";
String infile = "C:\\Users\\kbaas.000\\Documents\\autoredistrict_data\\vtd_data.txt";
String outfile = "C:\\Users\\kbaas.000\\Documents\\autoredistrict_data\\vtd_data_out.txt";
Vector<String[]> records = readDelimited(ne... |
9210d079-5150-425d-929b-5727ce1ef711 | 4 | public JButton getConnect4Button() {
boolean test = false;
if (test || m_test) {
System.out.println("GameSelecter :: getConnect4Button() BEGIN");
}
if (test || m_test) {
System.out.println("GameSelecter :: getConnect4Button() END");
}
return m_conn... |
2f4ab8a3-5c28-4ee2-8ef4-26152a2c6e12 | 6 | final void s(int i) {
anInt5445++;
if (aClass290_5520 != null)
((Class290) aClass290_5520).aBoolean3709
= Class264.method2015(i, anInt5472, 7);
if (aClass290_5460 != null)
((Class290) aClass290_5460).aBoolean3709
= Class183.method1379(4, anInt5472, i);
if (aClass290_5482 != null)
((Class290) aCla... |
9e381deb-387a-4985-9097-dc2ae62c6f22 | 9 | public void executeSQL(String sql) {
if (conn == null)
return;
try {
Statement stmt = null;
if (sql.contains("?") && handler != null) {
PreparedStatement pstmt = conn.prepareStatement(sql);
handlerCall(pstmt);
stmt = pstmt;
} else {
stmt = conn.createStatement();
}
if (stmt instanc... |
d1f6f882-825e-48a4-b48b-bb698473c78e | 8 | public Villager makeBaby(){
if(village.getPopulation() <= village.getMAX_POP()){ //there is room
if(!dude){ //girl
if(kids <= MAX_BABIES){ //if less than the maximum amount of babies
if(health > 18 && health < 60){ //18 - 60
if(babyCoolDown == 0){ //wants kids
if(villag... |
0b1263da-e44f-49a1-9373-0a1c9e135b7f | 6 | public static boolean doLauncherUpdate(Stack<String> updateQueue, JSONObject versionsConfig) {
Logger.info("Updater.doLauncherUpdate", "Starting update...");
//Show progress
GlobalDialogs.showProgressDialog();
GlobalDialogs.setProgressCaption("Cleaning...");
Glo... |
3b6abafa-3238-4fc3-bfb9-e12dbcbb7158 | 1 | public TextResourceFile(String filename) {
is = ClassLoader.getSystemResourceAsStream(filename);
if (is == null)
throw new MissingResourceException(filename, null, null);
} |
0283a884-c50c-49d4-aa79-afcad14f2891 | 9 | public void processLeft(Stack<XPathContext> contextStack, Stack state) throws XPathException {
XPathContext context = contextStack.peek();
final Controller controller = context.getController();
XPathContext c2 = context.newMinorContext();
c2.setOrigin(this);
Result result;
... |
6dcb534e-8a85-4eb9-b1e1-67a27b4963fe | 3 | private void setGeneratorsToPopulation() {
if (mapAdders != null) {
for (int i = 0; i < mapAdders.length; i++) {
mapAdders[i].stopAdding();
}
}
List<GeneratorIndividual<T>> individuals = gaPop.getIndividuals();
mapAdders = new CloudMapThread[generators.size()];
for (int i = 0; i < generators.size();... |
a729feaf-22d4-4a58-b8b8-262979d50162 | 6 | public String getMethodAccessor(String name, String desc, String accDesc,
MethodInfo orig)
throws CompileError
{
String key = name + ":" + desc;
String accName = (String)accessors.get(key);
if (accName != null)
return accName; // al... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.