method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
15c11ac5-8bd2-4da3-90d2-90a9a932ca43 | 6 | @SuppressWarnings("unchecked")
public static <T> T[] toArray(Iterable<? extends T> list, Class<T> c) {
int size = -1;
if(list instanceof Collection<?>){
@SuppressWarnings("rawtypes")
Collection coll = (Collection)list;
size = coll.size();
}
if(s... |
2835bcba-f790-41da-b170-fc2539b1a930 | 8 | public boolean banditUpdate(double deltaSec)
{
this.requestFocus();
if (state != BanditState.DONE)
{
if (state == BanditState.IDLE)
{
if (controller.isPlayerPressingESC())
{
state = BanditState.EXIT;
running = false;
}
else
{
... |
22eda665-a83f-4998-98d1-471b7ae64c10 | 3 | * @return The starting y-coordinate for the specified row index.
*/
public int getRowIndexStart(int index) {
List<Row> rows = mModel.getRows();
int pos = getInsets().top;
for (int i = getFirstRowToDisplay(); i < index; i++) {
Row row = rows.get(i);
if (!mModel.isRowFiltered(row)) {
pos += row.getHeig... |
cc1528ff-485c-4f35-a2e0-561f4317ae97 | 9 | public LinkedList<String> bufferFill() throws IOException
{
int c;
final StringBuffer buf=new StringBuffer("");
int lastc=0;
try
{
while((c=in.read()) >=0)
{
if(c==13 || c==10)
{
if((c==13 && lastc != 10)
||(c==10 && lastc != 13))
{
inbuffer.add(globalReactionary(buf.toStr... |
ea4768b1-ac0f-4c72-864f-95ae0eab1172 | 8 | public String weekAdd(String field)
{
String newField = " ADD ";
String number = "";
for(int i = 1; i <= field.length(); i++)
{
if(isNumber(field.substring(i - 1, i)))
{
number = number + field.substring(i - 1, i);
}
... |
7ab5409f-0173-4eb6-8fb4-b05f1723ce18 | 1 | private static YamlConfiguration load() {
try {
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
return config;
} catch (Exception e) {
e.printStackTrace();
}
return null;
} |
e7c1de63-7df9-4119-8dd3-23491676bc87 | 8 | private static void extractNodeStatistic(String filename, String nodePrefix) throws Exception
{
FileReader fr = new FileReader(filename);
CsvReader csvIn = new CsvReader(fr, SEPARATOR);
csvIn.setSafetySwitch(false);
if(csvIn.readHeaders()) {
csvIn.readRecord();
System.out.println("'" +filename +"' has... |
a1217b24-c748-461d-b7d4-6c28d52239ae | 1 | public static void noPermission(Player p, String permission) {
p.sendMessage(LangUtil.noPermission());
PlayerUtil pu = new PlayerUtil(p);
if(pu.hasPermission("Nostalgia.Messages.showPermission", PermissionType.OP)){
p.sendMessage(LangUtil.showPermission(permission));
}
} |
ec1f046e-5724-4c7b-820a-6de4cad09020 | 1 | private static void run(){
AuthModule auth = new AuthModule();
moduleManager.loadModule(auth);
desktop.run();
desktop.addLinkIcon(Resources.getImageIcon("web-site.png"), Settings.domain, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
java.awt.Desktop.getDes... |
ab129c98-7175-475b-9e81-48ea2035b52d | 2 | public ResultSet getUserData (String user) {
// SELECT count(*) as userCount FROM `users` WHERE `user` = '" + user + "'
ResultSet rs = null;
try {
Statement statement = conn.createStatement();
// select the number of rows in the table
rs = statement.executeQue... |
a280d601-39d1-45e0-9c9c-379cd5c5309d | 5 | public boolean hasValidData() {
return (!"".equals(this.first_name) && !"".equals(this.last_name) && !"".equals(this.birth_year) &&
this.first_name != null && this.last_name != null && this.birth_year != null);
} |
f2f27021-980b-417f-81ff-87b1a5f96fb2 | 1 | public void deleteAudience(String userName) {
Audience viewer = manager.find(Audience.class, userName);
if (viewer != null) {
manager.remove(viewer);
}
} |
f9de870d-1a8f-486a-9516-29f464f612e8 | 4 | static void basicTest() {
Range f = new Range(1,10);
int[] arr = {1,2,3,4,5,6,7,8,9,10};
int idx = 0;
for (int val : f) {
assert(arr[idx++] == val);
}
print("Forward non-stepped test passed");
Range r = new Range(10,1);
int[] rarr = {10,9,8,7,6,5,4,3,2,1};
for (int val : r) {
assert(rarr[idx-... |
d5d0448b-ab4f-4190-a399-8de323049f48 | 4 | public void connect() throws NamingException, SQLException {
// Is this a reconnection? If so, disconnect first.
if (con != null) disconnect();
try {
String url = "jdbc:postgresql://localhost/stocksim";
Properties props = new Properties();
props.setProperty("user",... |
b908da86-68a1-447c-a179-ea5815789643 | 5 | @Override
public double getYRotation()
{
double lowest = 9001;
double highest = 0;
int y = 0;
if (getRotationAngle() == 90)
y = 20;
if (getRotationAngle() == 270)
y = -20;
for (Block block : blockArray)
{
if (block.getYValue() > highest)
highest = block.getYValue();
if (block.getYValue()... |
7894ce0e-3ccc-40ba-8dd9-9c88d33abfb7 | 0 | public void setStepOverPending(boolean b) {
stepOverPending = b;
} |
4c3b8ff0-4ba8-44f3-90f6-7b5dc0466cde | 7 | public void changeRepeatDays(DayOfWeek day) {
int convertedDay = -1; // because calendar and time can't agree on an enum
switch (day) {
case MONDAY:
convertedDay = Calendar.MONDAY;
break;
case TUESDAY:
convertedDay = Calendar.TUESDA... |
4d9d9bd8-71b2-48b5-853f-e6cf43cde970 | 0 | public void setEnableImplicitFlows(boolean enableImplicitFlows) {
this.enableImplicitFlows = enableImplicitFlows;
} |
04653f9d-8308-4fed-a5fb-b244f6601f43 | 8 | public String [] getOptions() {
String [] options = new String [9];
int current = 0;
options[current++] = "-X"; options[current++] = "" + getCrossVal();
if (m_evaluationMeasure != EVAL_DEFAULT) {
options[current++] = "-E";
switch (m_evaluationMeasure) {
case EVAL_ACCURACY:
options[... |
ff8fa60e-8148-43b5-866e-2a37dc49065d | 1 | public void addToGrid(String code) //Afegim un nou valor al Grid
{
String[] values = code.split("&");
for(String value : values)
{
String[] component = value.split(",");
int x = Integer.parseInt(component[0]);
int y = Integer.parseInt(component[1]);
int val = Integer.parseInt(component[2]);
... |
add77b72-c33e-4e90-952f-395f6dc6a263 | 6 | int numberOfDivisors(HashMap<Long,HashSet<Long>> map,long number){
HashSet<Long> newSet=new HashSet<Long>();
for(long i=2;i<=number/2;i++){
if(number%i==0){
if(!map.containsKey(i)){
numberOfDivisors(map,i);
}
if(!map.containsKey(number/i)){
numberOfDivisors(map,number/i);
}
HashS... |
50350a00-2663-42c3-84f9-9a5d06eb4b21 | 7 | private static double date_msecFromArgs(Object[] args)
{
double array[] = new double[MAXARGS];
int loop;
double d;
for (loop = 0; loop < MAXARGS; loop++) {
if (loop < args.length) {
d = ScriptRuntime.toNumber(args[loop]);
if (d != d || Dou... |
a0bfbd13-bc0d-47ee-be5f-7a2aa05b3fae | 7 | private void updateGrid() {
CourseList model = super.getModel();
Course course = model.getSelectedCourse();
int firstYear = course.getFirstYearOfOffering();
int latestYear = course.getLatestYearOfOffering();
int yearRange = latestYear - firstYear + 1;
GridBagLayout gridBag = new GridBagLayout();
GridBagCo... |
ed637d39-6252-4ba0-89d2-ad2ffdbc7b8c | 8 | static double prim(double d[][]){
PriorityQueue<double[]> cola=new PriorityQueue<double[]>(d.length,new Comparator<double[]>() {
public int compare(double[] o1, double[] o2) {
if(o1[1]!=o2[1])return o1[1]<o2[1]?-1:1;
return o1[0]<o2[0]?-1:1;
}
});
boolean vis[]=new boolean[d.length];
double mem[]=... |
57c77bbb-d5f2-45aa-b351-c7057253ca1b | 9 | public static boolean deleteDir(File dir) {
if (dir.isDirectory()) {
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
try {
// Test for symlink and ignore.
// Robocode won't create one, but just in case a user does...
if (file.getCanonicalFile().getParentFile().equals(dir.ge... |
d5972888-566d-4c8d-ab00-be487b138e3d | 3 | @Override
public void sort(int[] array) {
boolean swap;
do {
swap = false;
for(int i = 1, s = array.length; i < s; ++i ) {
if( array[i-1] > array[i] ) {
swap = true;
int swapped = array[i];
array[i] = array[i-1];
array[i-1] = swapped;
}
}
} while( swap );
} |
07a15a33-05a2-4f51-8aa4-e8df29ad570a | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (!(obj instanceof PremiumDomain))
return false;
PremiumDomain other = (PremiumDomain) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(o... |
1d30aeec-5ef7-4cfe-96f5-1d848654142b | 5 | public Object nextEntity(char ampersand) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... |
0df58660-e696-4eba-98d0-c771d7d5a70f | 1 | public Label getLabel() {
if (label == null) {
label = new Label();
}
return label;
} |
8f3a4559-b47c-49a2-be68-62f4dd30d2b7 | 1 | public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger())
popup.show(e.getComponent(), e.getX(), e.getY());
} |
00d31ae0-c792-4572-8913-20f2fc5074b3 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ResolveRecord record = (ResolveRecord) o;
if (Float.compare(record.lat, lat) != 0) return false;
if (Float.compare(record.lng, lng) != 0) return... |
193f620a-4553-44ee-9b18-b72b215ce159 | 7 | public void cursorClickMouve(MouseEvent e) {
boolean sliderLeft = mouveCursorSliderLeft(e);
boolean sliderRight = mouveCursorSliderRight(e);
if (sliderLeft) {
if (e.getX() < this.positionXSlider) {
this.left.setLocation(this.positionXSlider);
} else if (e.... |
f81d062a-93dd-409d-8082-26780e703a45 | 2 | int minCompressedLength(int n) {
Integer mcl = minCompressedLength.get(n);
// Not cached? => Calculate it
if( mcl == null ) {
// Create a trivial string length 'n'
StringBuilder sb = new StringBuilder();
for( int i = 0; i < n; i++ )
sb.append('a');
// Calculate compressed length
mcl = compres... |
882da6d4-0e73-47a9-968a-101f124659da | 7 | private static void test1_3() throws FileNotFoundException {
String test1 = "rawr\n"+"quit\n"+"yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(test1.getBytes());
System.setIn(in);
out = new PrintStream("testing.tx... |
856e40eb-8ba9-494d-9f75-d49179ccca9c | 3 | private boolean isPawnAttack(Move m) {
// TODO Auto-generated method stub
if(myGame.getPiece(m.getPreviousLocation()) instanceof Pawn)
{
Point difference = Game.getDistance(m.getPreviousLocation(), m.getCurrentLocation());
if(difference.x!=0&&difference.y!=0)//pawn must be attacking, takes care of en passan... |
f1fde5cc-e5cd-4bc4-b2dd-b00f3c0f676c | 2 | public void build_dicos() throws IOException{
String voc_word = voc_r.readl();
while(voc_word != null){
voc.put(voc_word, true);
voc_word = voc_r.readl();
}
String subvoc_word = subvoc_r.readl();
while(subvoc_word != null){
subvoc.put(subvoc_word, true);
subvoc_word = subvoc_r.readl();
}
} |
81d2d613-247a-47a5-a76e-8d6646f4df5b | 0 | public String getFilename() {
return filename;
} |
0b1a6231-3dff-421b-89e1-19bf24378a2e | 0 | public void setRight(Node<K> right) {
this.right = right;
} |
856daa84-c3ee-460f-ba16-929b43f8bf34 | 5 | public SolutionView(final BoardController board, String pathValues) {
frame = new JFrame("Solution");
nextButton = new JButton(">");
frame.add(nextButton, BorderLayout.LINE_START);
frame.add(nextButton, BorderLayout.LINE_END);
currentPos = 0;
pathValues = pathValues.substring(1, pathValues.length()-1);
fi... |
828ed111-81dd-49e6-a0cf-24a4088969b5 | 7 | public void add(Device d) {
if (d == null) {
return;
}
DeviceList newlist = new DeviceList(d);
if (this.head == null) {
this.head = newlist;
} else {
DeviceList temp = this.head;
boolean notInSet = true;
if (this.head.device == d) {
notInSet = false;
}
while (temp.next != null && n... |
23ee45c0-e6e4-4936-94db-922b7db9ffe5 | 5 | public static Boolean checkRange(Integer num, Integer min, Integer max, Boolean throwException)
{
Boolean condition;
if (min == null)
condition = num > max;
else if (max == null)
condition = num < min;
else
condition = num < min || num > max;
... |
144e1c32-8b97-4f13-836f-4df57c195ca5 | 0 | public static int warmth(int color)
{
int red = (color & RED_MASK) >> 16;
int blue = (color & BLUE_MASK);
return (red - blue);
} |
0379d397-78cf-4099-a9e9-14f06f4aaf1b | 2 | private void processCloseBracket(List<String> parsed, List<String> stack) {
while (stack.size() > 0) {
String last = stack.get(stack.size() - 1);
if (last.equals(OPEN_BRACKET)) {
stack.remove(stack.size() - 1);
break;
}
parsed.add(l... |
5403847f-7939-4b73-a548-b98137f90c4b | 1 | public void testWithDurationAfterStart3() throws Throwable {
Duration dur = new Duration(-1);
Interval base = new Interval(TEST_TIME_NOW, TEST_TIME_NOW);
try {
base.withDurationAfterStart(dur);
fail();
} catch (IllegalArgumentException ex) {}
} |
29a85e0a-267f-4565-b95a-355ee7da4987 | 0 | public String getFileName() {
return fileName;
} |
8ac0a9a0-5ec1-4f59-9369-bd7612de3769 | 3 | void loadIndices(NodeReference indexGlobal) {
if (!indexGlobal.exists()) {
return;
}
indices = new ArrayList<String>();
isUniqueIndex = new HashMap<String,Boolean>();
ValueList list = indexGlobal.getList();
for (int i=0;i<list.length()/2;i++) {
Str... |
1424b535-ee60-4b8d-b647-0cc0b5d41f10 | 6 | public void paint(Graphics g){
//status
if(Game.status == Game.STATUS_MENU){ //主菜单绘制
g.setColor(Color.WHITE);
g.fillRect(0, 0, this.mainFrame.width, this.mainFrame.height);
//背景颜色
g.setColor(Color.black);
g.fillRect(0, 0, 900, 600);
g.setColor(Color.white);
g.setFont(this.defaultFontBig);... |
95697504-7909-4289-9fdc-51c5f8de118b | 0 | public Object getInternalObject() {
return internalObject;
} |
d3e274e6-7e4a-4fc8-9bdf-2b330c7a3e6a | 9 | @Override
public boolean equals(Object obj) {
// Should normalize both values before comparing.
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Fretboard other = (Fretboard) obj;
if (( null == strings ) && ( null == other.strings ))
r... |
ba62f4d6-141e-4083-909a-93c580639353 | 8 | public Aquarium(long idC) {
oitems = new Object();
oothers = new Object();
oclasses = new Object();
classes.add(new ClassesMobiles(idC, StableFish.getImageClasse(), "StableFish"));
classes.add(new ClassesMobiles(idC, DorisFish.getImageClasse(), "DorisFish"));
for (int i = 0; i < NB_STONES; i++) {
... |
1368e520-9dc8-48dc-b135-bef4ea199ab0 | 5 | public boolean setupVault() {
Plugin plugin = this.getServer().getPluginManager().getPlugin("Vault");
if (plugin != null & plugin instanceof Vault) {
RegisteredServiceProvider<Economy> economyProvider = getServer()
.getServicesManager().getRegistration(
... |
b971921a-cc3e-4e6f-8f77-8c319f373227 | 5 | public void printRewards()
{
for(int i = 0; i < this.States.length; i++)
{
for(int j = 0; j < this.States[0].length; j++)
{
if(this.States[i][j].IsWall)
{
System.out.print("( WALL )");
}else if(this.States[i][j].GetReward() == 1 || this.States[i][j].GetReward() == -1)
{
System.ou... |
0033ad80-1309-4fb1-9213-7ae2b5f26ba6 | 3 | public void sort(int[] array) {
for (int j = 1; j < array.length; j++) {
int key = array[j];
int i = j - 1;
for (; i >= 0; i--) {
if (array[i] > key) {
//do not need swap here
array[i + 1] = array[i];
} else {
break;
}
}
array[i + 1] = key;
}
} |
86c867df-79a4-4399-9b8d-8ae2f0a9c7cf | 2 | public static double[] getLightnessAndSaturation(int color) {
double var_R = ( color >> 16 & 0xff ) / 255.0; //RGB from 0 to 255
double var_G = ( color >> 8 & 0xff ) / 255.0;
double var_B = ( color & 0xff ) / 255.0;
double var_Min = Math.min(Math.min( var_R, var_G), var_B ); //Min. value o... |
b8aa11f0-b238-412b-b892-25375c932282 | 8 | public static void setupres() {
if (ResCache.global != null)
Resource.addcache(ResCache.global);
if (Config.resurl != null)
Resource.addurl(Config.resurl);
if (ResCache.global != null) {
try {
Resource.loadlist(ResCache.global.fetch("tmp/allused"), -10);
} catch (IOException e) {
}
}
if (!C... |
21d897be-1d94-4932-a919-6832b7819125 | 2 | public void combineRec(ArrayList<ArrayList<Integer>> res, Deque<Integer> tmp, int left, int n, int s) {
if (left == 0) {
res.add(new ArrayList<Integer>(tmp));
}
for(int i = s; i <= n; ++i){
tmp.addLast(i);
combineRec(res, tmp, left-1, n, i+1);
tmp.removeLast();
}
} |
f1da2ceb-65ea-419a-9ead-70d4c7fa9313 | 3 | @Override
public void onValueChange(ValueChangeEvent<String> event) {
String token = event.getValue();
if (token != null) {
for (final Presenter presenter : presenters) {
if (token.equals(presenter.getToken())) {
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onFailure(Thro... |
9364d409-fc7f-43e3-bc1c-00e0beff8291 | 2 | public static Production createProduction(Node node) {
Map e2t = elementsToText(node);
String left = (String) e2t.get(PRODUCTION_LEFT_NAME);
String right = (String) e2t.get(PRODUCTION_RIGHT_NAME);
if (left == null)
left = "";
if (right == null)
right = "";
return new Production(left, right);
} |
0a566ddc-b7e5-465d-87c0-f89a824effbb | 1 | @Override
public void undo(UndoQueueEvent e) {
if (e.getDocument() == Outliner.documents.getMostRecentDocumentTouched()) {
calculateEnabledState(e.getDocument());
}
} |
2fcc4007-b42a-4bcd-8eaa-34189f97d8a1 | 0 | public ItemSaleModel(String itemName, String price, String quantity, String amount, Item item) {
setItemName(itemName);
setPrice(price);
setQuantity(quantity);
setAmount(amount);
setItem(item);
} |
fde7e824-7052-488c-ba94-8f6c713e6991 | 2 | @Override
public void run() {
super.run();
try {
serverSocket = new ServerSocket(Constantes.portTcpBus);
while(true){
// j'attends une connexion TCP
server.console("Attente de connexion ... Tcp Bus");
Socket socketTcp = serverSocket.accept();
ServerTCPMultithreadBus stm = new Serv... |
427dd8b0-f9e9-45e8-b507-4915e795fe01 | 1 | public static boolean fileExists() {
File file = new File(FILE);
if (file.exists())
return true;
else
return false;
} |
f23c21f7-40d2-41d8-b01a-f0b820ec81f9 | 7 | public ECPunkt sumaPunktow (ECPunkt Q,ECPunkt P)
{
if (Q.X.b.equals(P.X.b) && Q.Y.b.equals(P.Y.b))
return podwojeniePunktu(Q);
if (Q.X.b.equals(BigInteger.ZERO) && Q.Y.b.equals(BigInteger.ZERO))
return new ECPunkt(P);
else if (P.X.b.equals(BigInteger.ZERO) && P.Y.b.equals(BigInteger.ZERO))
return new EC... |
4bfe5430-9b26-45af-9bce-cdf7535bcf6b | 8 | public static void test() throws Exception {
// #########################################################################################
System.out.println("Testing packet serialization:");
/**
* Foreach packet class, create an instance, serialize it and
* unserialize it. Packet class and a random sequenc... |
63da8775-1342-4f17-ab08-fbd4d791afdc | 9 | @Override
public synchronized String registerElectrics(final Electronics E, final String oldKey)
{
final ItemPossessor possessor=(E==null)?null:E.owner();
if((E != null) && (possessor instanceof Room))
{
final Room R=(Room)possessor;
String newKey=getElectronicsKey(R);
if(R.getArea() instanceof SpaceSh... |
49670e17-6717-47ec-9748-41d62dbe9283 | 0 | public void setDealerBust(boolean x){
dealerBust=x;
} |
59a44bc9-9f5a-4acf-970e-40acbfac3990 | 6 | public static FancyHouse getRandomFancyHouse(double widthMin, double widthMax,
double lengthMin, double lengthMax,
int floorsMin, int floorsMax) {
if (widthMin > widthMax){
throw new IllegalArgumentException(
... |
3033cf29-7f51-4259-a498-411fdf1f4080 | 8 | public static void removeCircularRanges(final ControlFlowGraph graph) {
GenericDominatorEngine engine = new GenericDominatorEngine(new IGraph() {
public List<? extends IGraphNode> getReversePostOrderList() {
return graph.getReversePostOrder();
}
public Set<? extends IGraphNode> getRoots(... |
a7ddd02a-6fd6-411a-9999-60ab32d10bfd | 5 | @Override
protected void controlUpdate(float tpf)
{
if (stage == Stage.Init)
{
controlInit(tpf);
if (stage != Stage.Detach)
stage = Stage.Update;
}
if (stage == Stage.Update)
controlProcess(tpf);
if (stage == Stage.Detach)
{
controlDetach();
if (spatial != null)
spatial... |
4f4bfb37-1d89-4770-a96f-d4a22fcafef5 | 8 | public void backwardEliminate(Instances instances, int metric)
throws Exception {
// Find the best model to remove. I.e., model for which removal improves
// performance the most (or hurts it least), and remove it.
if (m_numChosen <= 1) {
// If we only have one model left, keep it, as a bag
... |
e860c622-ad00-42ef-b8e7-24cdea091589 | 6 | private void notifyConnections(MapEvent<? extends Serializable> event) {
if(isRunning && conns!=null) {
Iterator<MapServerConnection> it = conns.iterator();
while(it.hasNext()) {
MapServerConnection conn = it.next();
try {
if(conn!=event.getSource()) {
conn.onMapEvent(event);
}
} cat... |
964d07e6-53e4-4cd0-b138-db3a32355c0c | 7 | public void read(Reader reader, long offset, int count, int tag, Type type)
throws IOException
{
ImageInputStream is = reader.getInputStream();
if (!hasSubFields()) {
ReaderHandler.ValueAction action = reader.atValue(tag, getName(), count);
if ((action != null) && (action != ReaderHandler.Va... |
ade725ce-c561-4d00-990a-f069843954b2 | 4 | private void buttonSaveChangesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveChangesActionPerformed
try {
control.SaveChangesToTask(tableAllTasks,
listUsers,
listUsersOnTask,
textFieldTaskName,
... |
c9ed32e6-f6c3-43c5-9ab6-9615f389dd43 | 8 | public void sselectex(String cid, int sid){
while(true){
try{
//display all open exercise
Connection conn = DBConnection.ConnectDB();
PreparedStatement stmt = conn.prepareStatement("SELECT eid, hwname, startdate, enddate, allowattempt FROM Exercise WHERE cid=?");
stmt.setString(1, cid);
... |
abe93ccc-3cde-4162-8a2a-f578ab546425 | 8 | @Override
protected boolean canRun(ClassNode node) {
if (!node.superName.endsWith(classNodes.get("CacheableNode").name) || classNodes.containsKey("ObjectDefinition"))
return false;
ListIterator<MethodNode> mnli = node.methods.listIterator();
while (mnli.hasNext()) {
M... |
303a1040-4048-478f-bbe2-c5b8f9aeb854 | 2 | private static Node reverseLinkedList(Node n){
if(n==null) return null;
Node prev = null;
while(n.next!=null){
Node temp = n.next;
n.next = prev;
prev = n;
n = temp;
}
n.next = prev;
return n;
} |
6d9e5d4b-c643-4984-8c6d-d69793df6fde | 3 | public BufferedImage getSprite(String ref) {
if(sprites.get(ref) != null){
return (BufferedImage) sprites.get(ref);
}
BufferedImage image = null;
try {
URL url = ResourceLoader.getResource(ref);
if (url == null) {
System.out.println("Can't find ref: "+ref);
}
image = ImageIO.read(Reso... |
e21bc92f-b214-4179-919a-9d26c1b0c07c | 5 | private Color horizontalWinner() {
for (int i = 0; i < board[0].length; i++) {
Color current = Color.NONE;
int length = 0;
for (int j = 0; j < board.length; j++) {
if (current == board[j][i]) {
length += 1;
} else {
... |
52503783-f1c5-4e41-92ac-449a0fe4fbaa | 2 | public static void color420(StyledDocument doc, SimpleAttributeSet set, String message){
Random random = new Random();
for (int i = 0; i < message.length(); i++) {
char character = message.charAt(i);
//SimpleAttributeSet set = new SimpleAttributeSet();
StyleConstants.... |
4963394a-9f26-497a-b753-f9524863ce8b | 2 | public Collection reverseRoots() {
if ((roots == null) || (revRootEdgeModCount != edgeModCount)) {
revRootEdgeModCount = edgeModCount;
revRoots = new ArrayList();
buildRootList(revRoots, true);
}
return revRoots;
} |
a3364742-81ca-4881-88c2-290117205603 | 2 | public static CommandeClient SelectCommandeClientById(int id) throws SQLException {
String query = "";
CommandeClient Commande = new CommandeClient();
ResultSet resultat;
try {
query = "SELECT * from COMMANDE_CLIENT where ID_COMMANDE =? ";
Prep... |
be1f5061-4e8c-4c25-8f49-12a49ba565b8 | 0 | public String toString()
{
return buffer.toString();
} |
724d4677-972c-4cfc-97de-73f013742a25 | 8 | private static String setPuttyParameters(ConfigSession session) {
String args = "";
String host = session.getHost();
String port = session.getPort();
String user = session.getUser();
String password = session.getPassword();
String file = session.getKey();
String protocol = session.getProtocol() == null ?... |
52cbaafc-4e72-45e9-8e9d-ea5c362d7aad | 4 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
if (!isInitializer) {
writer.print("new ");
writer.printType(type.getHint());
writer.breakOp();
writer.print(" ");
}
writer.print("{ ");
writer.startOp(writer.EXPL_PAREN, 0);
for (int i = 0; i < subExpressions.len... |
4244891c-c061-48c9-9f62-9b84d3cd1feb | 2 | private void getRequest(HttpExchange he) throws IOException {
try {
String path = he.getRequestURI().getPath();
int lastIndex = path.lastIndexOf("/");
if (lastIndex > 0) {
int id = Integer.parseInt(path.substring(lastIndex + 1));
response = fac... |
738a21ba-5b39-4e88-9d14-a177686e4180 | 3 | public int KonvertBigMedSmallToPcs(String qtyString, int bigToSmall, int medToSmall){
//Asumsi Format sudah benar
int firstDot = 0, secondDot = 0;
for (int i=0;i<qtyString.length();i++){
if (String.valueOf(qtyString.charAt(i)).equals(getTheSeparator())){
if (firstDot ... |
1f4019e1-0a6c-4229-9986-d32083d45d3e | 5 | @Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
// Translate the coordinate system
g2d.translate(this.getWidth() / 2, this.getHeight() / 2);
Body[] bodies = this.cluster.getBodies();
int numBodies = bodies.length;
Point2D.Double[] pointArray... |
4498b9df-cdf0-4e70-8294-a8b2d4733a37 | 6 | public void move()
{
if(this.pathprogress >= this.path.length)
{
int x = this.x+this.world.random.nextInt(32)-16;
int y = this.y+this.world.random.nextInt(32)-16;
if(0 <= x && x < World.SIZE && 0 <= y && y < World.SIZE && this.world.getTileAt(x, y).isWalkable())
{
this.path = PathFinding.findPath(t... |
07ef8853-6cd5-49ca-999e-59eac82e4c57 | 5 | private static String map(final String type, final boolean defaultPackage) {
if ("".equals(type)) {
return type;
}
StringBuffer sb = new StringBuffer();
int index = 0;
while ((index = type.indexOf("[]", index) + 1) > 0) {
sb.append('[');
}
... |
c2c278a9-c3a3-401f-926a-d97547c8c2b7 | 2 | public void set_pwm_f(short frequency) throws IOException {
byte[] data=new byte[2];
data[0]=(byte)SET_PWM_F;
data[1]=(byte)frequency;
byte[] result = this.sendAndReceive(data, COM_TIMEOUT, 1);
if (result.length==0) throw new IOException("no answer from device");
if (result[0]!=0) th... |
dcfecf17-2271-4cd4-84bf-1d35792c1260 | 6 | public boolean aukaiseYksi(int x, int y) {
Solu solu = kentta.getSolu(x, y);
aloitaKello();
if (solu.isAuki() || solu.getFlagi() == 1) {
return true;
} else if (solu.isMiina()) {
aukaiseKaikki();
this.aikaLopussa = System... |
f0858cdc-8dbb-45b6-a291-9724bc863c2b | 1 | public static void run(Class serverClass) {
try {
executeInstance((NanoHTTPD) serverClass.newInstance());
} catch (Exception e) {
e.printStackTrace();
}
} |
8151b5fd-026c-4d72-8e2c-18a1cf689cfd | 6 | private List<Point> createLine() {
List<Point> line = new ArrayList<>();
EndPointAttachement source = getSourceEndPoint().getAttachement();
EndPointAttachement target = getTargetEndPoint().getAttachement();
Point sl = source.getLanding();
Point sa = source.getApproach();
Point ta = target.getApproach();
... |
9d4de4eb-5e93-41bf-83bb-5255983e4b63 | 0 | @Override
public void fly() {
System.out.println("I fly just like a sparrow.");
} |
03fd1296-3b2b-4f6f-a783-83028451715e | 0 | public void setGerberas(int gerberas) {
this.gerberas = gerberas;
} |
e34d4e1c-12b6-4601-88b4-b3d1f0e14308 | 2 | @SuppressWarnings("unchecked")
public void loadDb() {
try {
this.setMusicBuffer((HashMap<String, PersistentMusic>)
this.getMusicDbIn().readObject());
this.setUserBuffer((HashMap<Email, PersistentUser>)
this.getUserDbIn().readObject());
} catch (IOException e) {
this.setMusicBuffer(new Has... |
61d61506-61e5-498d-80fc-07c966fda0cf | 7 | public double weightedVariance_of_ComplexModuli() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
boolean hold2 = Stat.nEffOptionS;
if (nEffReset) {
if (nEffOptionI) {
Stat.nEffOptionS... |
73a55856-8ac1-4a8a-9913-d3375d78206e | 9 | private void AIServe(Paddle paddle, Ball ball) {
if((paddle.isLeft() && ball.isServingLeft()) || (!paddle.isLeft() && ball.isServingRight())) {
AIDelay++;
if(AIDelay < 5)
paddle.setGoal(rand.nextInt(Settings.getFrameHeight()-paddle.getHeight()/2));
if(AIDelay > 50) {
paddle.serve(ball);
AIDelay ... |
76bb99c3-04bd-4836-bb32-cb9c5bae53b1 | 5 | private static void translateProtocolLine(String serverAnswers)
{
String[] tbPL = serverAnswers.split(";");
String translation = "";
//Client
if(tbPL[2].equals("A"))
{
translation +="The Client ("+tbPL[0]+") send to Server ("+tbPL[1]+") :";
translation += "I want buy "+tbPL[4]+" "+tbPL[3]+".";
}
... |
35d565ca-d529-4cc9-94d5-fbccfe2b1e3f | 0 | protected void onDisconnect() {} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.