method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
48272d0b-94a5-4c8d-9c5a-0cda0bb9f806 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
b956331d-5ce5-461a-90bf-3b446ebc9632 | 1 | public String getLeiterBerechtigungBezeichnung(){
Berechtigung berechtigung = dbZugriff.getBerechtigungzuLeitername(Leitername);
if(berechtigung!=null)return berechtigung.getBerechtigungbez();
else return "Keine Berechtigung";
} |
0a1262d2-be3a-48de-850b-41c0d5765ea6 | 0 | @Id
@Column(name = "PCA_POS_ID")
public Integer getPcaPosId() {
return pcaPosId;
} |
293e2a4b-11c3-4779-a9f5-cea527710188 | 3 | public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
if (args.length == 2) StdRandom.setSeed(Long.parseLong(args[1]));
double[] t = { .5, .3, .1, .1 };
System.out.println("seed = " + StdRandom.getSeed());
for (int i = 0; i < N; i++) {
System.ou... |
2dc7820b-9e40-47e1-aebd-6b9746ca419f | 2 | public String getString(String key) {
try {
if(hasKey(key))
return ((NBTReturnable<String>) get(key)).getValue();
return "";
} catch (ClassCastException e) {
return "";
}
} |
4ee241e6-9cbd-40f6-aa34-aa3d18d4782b | 4 | public boolean gEquals(Object other) {
if (other instanceof Recipe) {
Recipe that = (Recipe) other;
if (that.size() == this.size()) {
RNode k = that.head;
while (k != null) {
if (!bevatGeq(k.getElement())) {
return false;
}
k = k.getNext();
}
return true;
}
}
return ... |
77eb7988-1c20-4cc5-9910-10448d0946cb | 1 | @Override
protected void process(List<String[][]> chunks) {
int processed = 0;
while(processed < players.length) {
RemotePlayer remotePlayer = playerHandler.createRemotePlayer(100, 0, players[processed][0]);
remotePlayer.spawn(0, 0, 100, 0, parent, mapFrame);
processed++;
}
} |
399aba18-8570-4d1b-a322-e49677da14a1 | 6 | public void addArrayEntries(ConnectionWrapper cw, Long arrayId,
Object array, DelayedInsertionBuffer delayBuffer)
throws SQLException
{
ProtectionManager protectionManager = adapter.getPersist()
.getProtectionManager();
Class<?> compType = array.getClass().getComponentType();
// the table name for the ... |
2c3260f6-a452-485b-887f-2ca1e373e413 | 4 | public int[] fastCarMove(int x, int y, Direction direction, Car movingCar) {
//Precondition: direction != null; movingCar != null; x & y are coordinates on the map
//Postcondition: returns int[] with 2 elements which has coordinates on the map
int returnX, returnY;
int[] tmpInt = direction.moveStraight();
... |
d4e38580-d580-4996-8106-2e536e2b451c | 9 | public static WritableRaster RGBToCIEXYZ(Raster src,
int[] srcComponentSize,
WritableRaster dest,
int[] destComponentSize) {
checkParameters(src, srcComponentSize, dest,destCom... |
18060b28-23df-410a-8e63-e5d10cd2f172 | 3 | private void configUnique(Method method) {
Unique unique = method.getAnnotation(Unique.class);
Class<?> returnType = method.getReturnType();
if (unique != null || !ClassHelper.isTypeList(returnType)) {
isUnique = true;
} else {
isUnique = false;
}
} |
0f367a27-c83c-4ae8-8c5a-f8045c86bad1 | 6 | @EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(final PlayerChatEvent paramPlayerChatEvent) {
final Player localPlayer = paramPlayerChatEvent.getPlayer();
for (final IRCChannel c : MonsterIRC.getChannels()) {
if (c.getChatType() == ChatType.TOWNYCHAT) {
... |
7d649156-dcb6-4da4-8ac4-39a9de13ef54 | 7 | private void gameOver() {
switch (isGameOver()){
case 0:
break;
case -1:
for (Player p: players){
if (p.getHero().getTeam().getSide() == Team.Side.RIGHT){
endGame(p.getHero().getTeam());
return;
}
}
break;
case 1:
for (Player p: players){
if (p.getHero().getTeam().getSide() ... |
68a52033-742a-4d44-be3c-2eae12b65c61 | 4 | public static String buildMinimalLom(String englishTitle, String frenchTitle, String metadataLang, String location) {
Calendar cal = Calendar.getInstance();
String now = cal.get(Calendar.YEAR) + "-";
now += StringUtil.insertLeading( '0', 2, cal.get(Calendar.MONTH) + 1 + "" );
now += "-";... |
e5f4d10c-fb93-49ff-85d7-f3a59ee4c134 | 1 | public void setBytes(byte[] value, int offset){
for (int i=0; i<value.length; i++){
bytes[offset++] = value[i];
}
} |
cc1cb6e2-00ee-466d-b209-a1c88ea693ab | 4 | public static ITypeResolver arithmType(Type lh, Type rh) {
int cmp = rh.compare(lh);
if (cmp > 0) {
return new PlainOldTypeResolver(rh);
} else if (cmp == 0) {
if (rh instanceof PrimType) {
return new PlainOldTypeResolver(rh);
}
return new PlainOldTypeResolver(lh);
} else if (cmp == -1) {
r... |
7e946dbb-f11a-4880-979f-30843c70f6f1 | 7 | String ajaxCall(String dest, BufferedReader sin) {
Socket client = null;
PrintWriter out = null;
BufferedReader in = null;
// Get Ajax call
Scanner scan = new Scanner(sin);
scan.useDelimiter("\n\n");
String all = scan.next();
//res.log("Sending to " + dest + ": '" + all +"'");
// clean up de... |
c95d6162-9f5e-41da-aada-b9576af2bcb2 | 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... |
237ec411-e509-46b0-8ed5-65f4bfa83afc | 1 | void addConnection(Object from, Object to) {
List<Object> tos = graph.get(from);
if (tos == null) {
tos = new ArrayList<Object>();
graph.put(from, tos);
}
tos.add(to);
} |
128858d6-624b-4819-92b0-a4fae41b81f9 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[61];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 71; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
ec611a8a-7c80-45c8-aefc-034cb4d8e0e0 | 1 | public void setImgPath_AccessSym(Path img) {
this.imgAccessSym = handleImage(img, UIResNumbers.ACCESSSYMBOL.getNum());
if (this.imgAccessSym == null) {
this.imgAccessSym = UIDefaultImagePaths.ACCESSSYMBOL.getPath();
deleteImage(UIResNumbers.ACCESSSYMBOL.getNum());
}
... |
a7ff591d-b9b3-4517-8264-af98fe08bc14 | 6 | public static String scrambleText(String Text) {
StringBuilder Scrambled = new StringBuilder();
if (Text.contains(" ")) {
String[] Words = Text.split(" ");
for (String word : Words) {
ArrayList<Character> chars = new ArrayList<Character>(word.length());
for (char c : word.toCharArray()) {
chars.a... |
67b4c5ef-1664-4f38-8215-90e954281d35 | 3 | public Room getDeepestRoom() {
int rId = 0;
int depth = 0;
for (Room r : mapRooms) {
if (r.getDepth() > depth && !r.isCorridor()) {
depth = r.getDepth();
rId = r.getId();
}
}
return mapRooms.get(rId);
} |
557f684b-6147-474b-bea3-7037b306bd2c | 6 | public boolean allowRun(HttpServletRequest request) {
if(request.getSession().getAttribute("sessionInStr") == null || request.getParameterValues("moveDirection") == null
|| request.getParameterValues("curState") == null || request.getParameterValues("readSymb") == null
|| request... |
1f0133ce-4c9f-4b0c-9855-e8376dbd56fa | 7 | protected void drawTiles() {
showedTiles = new BufferedImage(panelWidth, panelHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) showedTiles.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CO... |
72fa0a5c-cbc6-4a3d-a52e-2f2ec5105abd | 0 | public void setName(String name) {
this.name = name;
} |
20956ad2-ad1a-4ce5-9cac-3030f4bca24c | 5 | public void getMovesFromWordPositional ( Word WORD, int x, int y,
Vector<Move> moves, boolean isUpDown, int xOrg, int yOrg ) {
boolean has = this.checkWord ( WORD, 0, x, y, isUpDown,
new Vector<Character> ( this.hand ), this.hand.size ( ) ) ;
if ( has ) {
has &= this.checkIntercept ( x, y,... |
ddeace07-2049-4d7a-b6f7-f52d508d1602 | 0 | public void noLongerAt(SharingPeer peer) {
this.seen--;
} |
a094a260-18a2-4478-a013-326dc7c7edba | 2 | public static void removeSelectedTray(Tray tray) {
if (tray == null) return;
if (StorageUnitDisplayPanel.selectedTrays.remove(tray)) StorageUnitDisplayPanel
.triggerTraySelectionChanged();
} |
ad31fb6e-39a4-45d7-8283-2a4ffa6cce06 | 0 | private boolean isValidInput(final String s) {
//in this case - everything is valid
return true;
} |
74a54ec4-47ef-4d76-b180-3503ef74afea | 7 | public Object getValueAt(int row, int col) {
int count=0;
for(Map.Entry<K,Cache.Value<ReplCache.Value<V>>> entry: map.entrySet()) {
if(count++ >= row) {
K key=entry.getKey();
Cache.Value<ReplCache.Value<V>> val=entry.getValue();
... |
38926bf5-aec8-4311-b13c-01cda304fefe | 9 | public int largestRectangleArea2(int[] height) {
// Start typing your Java solution below
// DO NOT write main() function
if (height == null || height.length == 0)
return 0;
int max = 0, tmp;
Stack<Integer> stack = new Stack<Integer>();
for (int i = 0; i < height.length; i++) {
if (!stack.isEmpty() &... |
54fcf64e-9948-44bf-9cb6-6485913d5650 | 2 | public void test_add_RP_int_intarray_int() {
int[] values = new int[] {10, 20, 30, 40};
int[] expected = new int[] {10, 20, 30, 40};
BaseDateTimeField field = new MockStandardBaseDateTimeField();
int[] result = field.add(new TimeOfDay(), 2, values, 0);
assertEquals(true, Arrays.e... |
18ce482c-13fc-4e4f-8bf1-e5ef4976eadb | 9 | public int compareTo(DBType t) {
StringType st = null;
if (t instanceof StringType) {
st = (StringType) t;
} else {
return -1;
}
String i = st.get();
if (i == null && value == null) {
return 0;
} else if (i != null && value == null) {
return -1;
} else if (i == null && value != null) {
... |
2ee4bec5-a675-4b63-bbe9-b3099349be0f | 2 | public static Node getNode(Node node, ArrayList<Node> list) {
for (Node m : list) {
if(m.equals(node)) {
return m;
}
}
return null;
} |
ee1d4a7e-52ed-4306-91de-8d8667de7c13 | 4 | public double getMean() {
if (total_size == 0) return Double.NaN;
double mean = 0.0;
if (type == Integer.class) {
for (int i = 0; i < total_size; i++) {
mean += ((int[])vals)[i];
}
mean = mean / (double)total_size;
} else {
... |
347bcda2-35eb-451f-bbf4-deb9fa64c50c | 1 | @Test
public void adicionarDoisClientesComDependentesIquais() throws ExceptionGerentePessoa {
Cliente c = setarCliente("João", "000.000.000-00");
Cliente c2 = setarCliente("Carlos","000.000.000-00");
faixada.adicionar(c);
faixada.adicionar(c2);
Assert.assertTrue("Era para ter adicionado os dependentes dos cl... |
f67f60bd-4e38-4613-b2b4-b88371700305 | 5 | @SuppressWarnings("unused")
public void move(){
if(!motionLock){
double stepX;
double stepY;
double angle;
stepX = new Random().nextInt(3);
stepY = new Random().nextInt(3);
while(!(posX + stepX > 0) &&
!(posX + stepX < settings.screenWidth - 40) &&
!(posY + stepY > 0) &&
!(posY + ste... |
c96dd4c2-31c6-4da4-9d08-976b5536c00c | 2 | @RequestMapping(value = {"/SucursalBancaria/{nombreSucursal}"}, method = RequestMethod.GET)
public void readByName(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("nombreSucursal") String nombreSucursal) {
ObjectMapper jackson = new ObjectMapper();
String json ... |
1f7d48ce-4b1c-4150-bde5-65164fddacc6 | 7 | public static void updateLearning(int action){
try { // Try to read values from the file
BufferedReader reader = new BufferedReader(new FileReader("learn.txt"));
String line = null;
line = reader.readLine();
int planetsL = Integer.valueOf(line);
line = reader.readLine();
int shipsL = Integer.valueO... |
6692a18e-cadc-437d-a2b8-6faff910dc98 | 3 | static int countCompress(String s) {
char[] charArray = s.toCharArray();
int count = 0;
int length = 0;
char currentChar = '\0';
for (char ch: charArray) {
if (ch == currentChar) {
count += 1;
} else {
if (currentChar != '\0... |
ff85d1be-fe50-4679-b1a4-43ecbb5b541e | 0 | public static GeneralValidator isGreaterThan() {
return GREATER_THAN_VALIDATOR;
} |
32c338b1-ab21-4705-a448-fafe8d9d0a9e | 7 | public boolean addShopItem(int itemID, int amount) {
boolean Added = false;
if (amount <= 0) {
return false;
}
if (Item.itemIsNote[itemID] == true) {
itemID = GetUnnotedItem(itemID);
}
for (int i = 0; i < server.shopHandler.ShopItems.length; i++) {
if ((server.shopHandler.ShopItems[MyShopID][i] - 1... |
7e0e82f2-ca31-4fc9-9739-bd0e78e99317 | 9 | public double CircleCombine(Instances train,Classifier[] cfsArray,List<Integer>[] classifyResult,List<Double> correctRateArray,double initCorrectRate, double interval,List<Double> currentResult,List<Integer> ClassifierNo,String CCAlgorithm)throws Exception{
Logger logger = Logger.getLogger(SeletiveAlgorithm.class);
... |
f7ca2628-ec6b-459e-8cf2-ec9ed5b829c2 | 9 | public void start() {
new Thread(new Runnable() {
public void run() {
while(true) {
try {
if(isPaused) {
Thread.sleep(500L);
continue;
}
double loadAvg = loadManager.getCurrentLoad();
// Check the thread cap
int maxThreads = CronFireSettings.getSet... |
f5aad31c-29b7-401c-8f31-faa436dce9e1 | 3 | public void reformTransform(Rectangle viewBounds) {
//completely unrelated
// MouseListener[] k;
// System.out.println((k = this.getListeners(MouseListener.class)).length);
// for (int i = 0; i < k.length; i++)
// System.out.println(k[i]);
//end completely unrelated
transformNe... |
1d499f19-0d96-49d4-a86e-4ddeeadf397f | 6 | private void initData() {
//System.out.println("33333333");
DataCount dc = new DataCount();
dc.init(user_name);
timemap = dc.getdata();
//排序
num = 0;
Iterator<String> iter = timemap.keySet().iterator();
while(iter.hasNext()) {
//System.out.print... |
18b57132-e3ed-4797-8480-0ac217edfce2 | 5 | @Override
public void tick(float dt) {
timeSinceLastShot += dt;
if(!shots.isEmpty()) {
ListIterator it = shots.listIterator();
while(it.hasNext()) {
Projectile shot = (Projectile)it.next();
if(shot.isDestroyed()) {
it.remove... |
dbd0487c-aefb-4a51-879e-ae387d219a6c | 5 | private void addResourcePanel(final String username) {
resourcePanel = new JPanel();
resourcePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
resourcePanel.setBorder(new TitledBorder("对应权限"));
resourcePanel.setPreferredSize(new Dimension(800, 150));
ResourceService resourceServ... |
75c59521-41ee-46ea-a318-59cd3cba7ed6 | 0 | @Override
public Iterator<Integer> iterator(){
return new Iterator<Integer>(){
private int currentColor = 0;
@Override
public boolean hasNext()
{
return currentColor <= maxVal;
}
@Override
public Integer n... |
fe6ba939-d68e-44f8-953d-3ad517b93625 | 2 | private static boolean isValidDiscount(Integer discount) {
return discount != null && discount >= DISCOUNT_MIN && discount <= DISCOUNT_MAX;
} |
50b68c21-f15e-4bca-9476-e61e6725c389 | 8 | private void applyComments(String filename, Map<String,List<Comment>> comments) throws IOException
{
// read new file's text
StringBuffer buffer = this.getNewFileSource(filename);
// create output file
File outputFile = new File(this._outDir + filename);
// make sure our file's directory exists
outputFil... |
17740170-d801-4dd8-aa14-2452ea038247 | 4 | 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... |
d1d38305-ae6d-4b61-bf8d-07c1e1b3af7e | 0 | public ComingRequestChatHandler(Socket socket, String userName) {
// TODO Auto-generated constructor stub
file = null;
comingRequestSocket = socket;
myUserName = userName;
} |
c6af5110-b461-424a-8087-268f342251dd | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Adresswechsel)) {
return false;
}
Adresswechsel other = (Adresswechsel) object;
if ((this.id == null && other.i... |
8db79fa7-5387-4bb9-b8a2-30f0468daac8 | 7 | public double getAllPointScore(Board currentBoard, int playerColor, double playerCautious ) {
if (! Board.legitPlayerColor(playerColor)) {
throw new IllegalArgumentException("bad color '" + playerColor + "'");
}
double score = 0;
for (int i=1; i<=Board.howManyPoints; i... |
6684cb4b-05a8-4d10-8e4e-736554830c54 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... |
c3ba630a-2911-4efc-bf8a-48844bfe0754 | 2 | public static void main (String[] args) throws IOException {
TorrentMetaInfo tmi = readExampleFile();
TorrentInfoSection tis = tmi.getInfoSection();
System.out.printf("Comment: %s%n", tmi.getComment());
System.out.printf("Created By: %s%n", tmi.getCreatedBy());
System.out.printf... |
2b28d6e5-48ec-4549-8404-e6188c953f21 | 9 | public boolean access(long addr, long[] wb_tag, boolean isLoad) {
// FIX ME for question 8
accessTime++;
long addr_tag = getTag(addr);
int addr_index = getIndex(addr);
long addr_block = getBlockAddress(addr);
boolean[] hit = new boolean[this.associativity];
int touchedWay = -1;
boolean hit_f = false... |
98f5196c-5f7f-48a9-a33e-8d4ca58dfe78 | 2 | public void saveAsJpg(String fileName){
BufferedImage img = new BufferedImage(drawPanel.getWidth(),drawPanel.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics2D g = img.createGraphics();
super.paintComponent(g);
unSelect();
for(TextBox t:shapeList){
t.draw(g);
}
try{
ImageIO.write(img, "JPG... |
92ef4080-d3ff-48eb-9368-9d9689f4a99d | 7 | public void processFiles() throws IOException {
// Open the destination File
PrintWriter writer = new PrintWriter(dest, "UTF-8");
for (String f : files) {
// Open a print reader and begin processing
BufferedReader br = new BufferedReader(new FileReader(f));
/... |
edbae771-805d-4afc-985f-be393cae054c | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TraderImpl)) {
return false;
}
TraderImpl other = (TraderImpl) obj;
if (login == null) {
if (other.login != null) {
return false;
}
} else ... |
348831a4-18c7-4b52-b309-9f8a76e6a801 | 9 | private boolean isPotentialCallbackMethod(SootClass currentClass, String methodName)
{
boolean existCurrentMethod = false;
List<SootMethod> currentMethods = currentClass.getMethods();
for (SootMethod method : currentMethods)
{
if (method.getName().equals(methodName))
{
existCurrentMethod = t... |
db4baf11-465b-4f88-81de-96d03a5db3bb | 4 | @Override
public String toString() {
switch(this) {
case Team1Victory: return "Team 1 has won on Arena %arena%";
case Team2Victory: return "Team 2 has won on Arena %arena%";
case TimeLimitReached: return "Time limit has been reached on Arena %arena%";
case NoPlayersLeft: return "Arena %arena% has ended... |
9479c9cd-0074-4683-935b-2af32fb3d57f | 1 | public void execute(Miner miner){
//if miner is not fatigued start to dig for nuggets again.
if (!miner.fatigued())
{
System.out.println(miner.getName() + " What a God darn fantastic nap! Time to find more gold");
miner.changeState(EnterMineAndDigForNugget.getSingleton());
}
els... |
bf7f1e65-863f-460a-b3d1-60629e19f30c | 5 | static public ArrayList SplitConfig(String comment, String splitstring) {
String temp = "";
String[] array = comment.split(splitstring);
ArrayList list = new ArrayList();
for(int i=0; i<array.length; i++) {
if (array[i].length() > 0) { /* Exclude empty rows */
... |
287762fd-3558-4d5e-a883-aa46ee6d67c6 | 0 | public List<Partner> getPartnerList() {
return partnerList;
} |
e0ea31c3-5bbd-4cf4-8d04-1536f2941e2e | 3 | @Override
public void play(String audioType, String fileName) {
// Java 8 can use Strings in switch.
switch (audioType) {
case "Mp3":
System.out.println("Playing Mp3 File :" + fileName);
break;
case "VLC":
case "Mp4":
MediaAdapter adapter = new MediaAdapter(audioType);
adapter.play(audioType, fi... |
d2aedef5-b40a-4f76-a877-20ab57425926 | 2 | public void insert(E e) {
DoublyLinkedNode n = new DoublyLinkedNode();
n.setKey(e);
if (head == null) {
head = n;
tail = n;
} else {
if (head != null) {
head.setPred(n);
n.setSucc(head);
head = n;
... |
fa574a4f-ef51-4e45-8b22-eefeefd26a0f | 5 | public static String format(final long millis) {
final StringBuilder sb = new StringBuilder();
final long totalseconds = millis / 1000L;
final long totalminutes = totalseconds / 60L;
final long totalhours = totalminutes / 60L;
final int seconds = (int) totalseconds % 60;
final int minutes = (int) totalminut... |
cd31b28a-44dd-47c9-a8df-23d9ab6fac69 | 9 | protected void changeNeuronWeight(int neuronNumber, double[] vector, int iteration){
double[] weightList = networkModel.getNeuron(neuronNumber).getWeight();
int weightNumber = weightList.length;
double weight;
if(showComments){
String vectorText="[";
for(i... |
4679606b-6afa-4c49-b74a-d8ece2e2bb6f | 1 | public static int getStandardWidth() {
if (width == -1) {
int x = Launcher.getFrameBounds().width;
x -= (x % GameModel.getUnit());
width = x;
}
return width;
} |
67d720c6-0064-4139-9632-39284144d03f | 9 | public void actionPerformed(ActionEvent arg0)
{
/**
* Vérification du nom des joueurs
*/
//obtention des noms des joueurs
ArrayList<String> joueursNames = new ArrayList<String>(4);
joueursNames.clear();
joueursNames.add(joueur1.getText());
joueursNames.add(joueur2.getText());
joueursNames.add(jou... |
51138012-ca5d-46c4-a8eb-e9d90cb7f388 | 5 | public void init(Map attributes) throws InvalidKeyException {
if (wired != null) {
throw new IllegalStateException();
}
Direction flow = (Direction) attributes.get(DIRECTION);
if (flow == null) {
flow = Direction.FORWARD;
}
int optimalSize = 0;
for (Iterator ... |
18172601-49d9-4346-aedc-71bf7b080d92 | 2 | @Override
public String toString() {
String returnString = "RETURN";
if (functionName != null) {
int indexOfLessThan = functionName.indexOf("<");
String truncatedFunctionName = functionName;
if (indexOfLessThan != -1) {
truncatedFunctionName = func... |
0d9896c8-343a-4cd6-bdae-e5c9b0380e17 | 2 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
fcAttach = new javax.swing.JFileChooser();
fcContainer = new javax.swing.JFileChooser();
btngrpContainer = new javax.swing.ButtonGroup... |
e726f005-4bf0-48b8-b6c0-b99dd0ede89e | 4 | @Override
public ByteBuf serialize(O_5x_AbstractDataType ucpOperation) {
ByteBuf bb = Unpooled.buffer();
Serialization.serializeString(bb, ucpOperation.getAdc());
Serialization.serializeString(bb, ucpOperation.getOadc());
Serialization.serializeString(bb, ucpOperation.getAc());
Serialization.serializeChar... |
8b50b64d-6a1e-4b8a-b3a4-dcf8f7bd7b83 | 0 | public void setObservacionCollection(Collection<Observacion> observacionCollection) {
this.observacionCollection = observacionCollection;
} |
09953b63-fdf5-4187-ae15-b31a43556951 | 7 | public void zoomActual()
{
mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(1)
: new mxPoint();
graph.getView()
.scaleAndTranslate(1, translate.getX(), translate.getY());
if (isPageVisible())
{
// Causes two repaints, see zoomTo for more details
SwingUtilities.invokeLater(new R... |
0f56e2c0-6133-4dcc-9545-710d7522e154 | 7 | private void setPlayerShips(String playerName) {
Scanner input = new Scanner(System.in);
int iLocation = 0;
int jLocation = 0;
Location locationObject = new Location();
String[][] listOfSpots = locationObject.makeStringListOfSpots();
System.out.println(playerName + ", e... |
d33a1ab9-55fa-4031-a00e-956e78dbf371 | 3 | public static void mkdir(String mkdirName)
{
try
{
File dirFile = new File(mkdirName); //mkdirName: path of folder
boolean bFile = dirFile.exists();
if( bFile == true )
{
System.out.println("The folder exists.");
}
... |
116f8270-3549-4865-9d1b-dd4ee16ccc0c | 7 | private void replaceForRemove(Node oldNode, Node newNode) {
// удалить newNode
removeNode(newNode);
// удалить oldNode, и вместо него поставить newNode
if (root == oldNode) {
root = newNode;
} else {
Node parent = oldNode.getParent();
if (parent.getLeftChild() == oldNode) {
... |
71f37389-469b-4203-951e-7b02dd7bda2a | 5 | public static void main(String[] args) {
try {
/* Returns the Class object associated with the class or
* interface with the given string name.
*/
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("MySQL JDBC Driver not found.");
e.printStackTrac... |
940dd0aa-1f25-4e5a-ac3f-e32aa10df874 | 5 | private static void createGraph() {
Pattern p = Pattern.compile( ",| |\n|\r" );
try {
Scanner scan = new Scanner(new FileReader(_fileName));
scan.useDelimiter(p);
int index = 0;
while( scan.hasNextLine() ) {
int ID = scan.nextInt();
... |
dac60f60-777a-42b2-9f31-5898d298a410 | 8 | @SuppressWarnings("ConstantConditions")
@Test
public void testOTUReducedRedundancyTest() {
File otuDir = new File("/home/alext/Documents/tuit/OTU Seq90/Seqs");
File tmpDir = new File("/home/alext/Downloads/tmp");
File executable = new File("/usr/local/bin/clustalw2");
File[] otu... |
bf3b44d1-7643-4554-91d2-1e76ef13ed25 | 5 | public String getConnectionsInfo(){
String str = "Conditions:";
for(String id: conditions){
str += id+" ";
}
str += "\n";
for(int i=0;i<connections.size();i++){
Connection conn = connections.get(i);
str += "Z"+String.valueOf(conn.from... |
ec8e8aed-6197-4965-96bb-ab5f8e1a3d09 | 4 | public static long getJailTime(String playerName){
long bantime = 0;
if(isJailed(playerName)){
try {
SQL_STATEMENT = SQL_CONNECTION.createStatement();
SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'");
// This loop checks all bans o... |
e7fa7189-cf2e-4c0f-9684-f24f8fc51d52 | 5 | public boolean meets() {
final String curTitle = getTitle();
return isOpen()
&& (getTitle() == null || curTitle != null
&& (curTitle.contains(getTitle()) || getTitle().contains(curTitle)))
&& hasOption(text);
} |
e4d2b233-91b8-4d30-a23b-a4be2747bc37 | 8 | Transaction openWrite(Transaction me) {
boolean cacheHit = false; // already open for read?
// not in a transaction
if (me == null) { // restore object if latest writer aborted
if (writer.isAborted()) {
rVersion.recover();
writer = Transaction.COMMITTED;
}
return null;
... |
1b6cfd48-2a28-49fa-b89a-2c6dee3fd1a9 | 4 | @Override
public String strip(String s) throws Exception {
final int length = s.length();
if (oldChars.length < length) {
oldChars = new char[length];
}
s.getChars(0, length, oldChars, 0);
int newLen = 0;
for (int j = 0; j < length; j++) {
char... |
d378ae5d-df8a-42a0-9c03-6b22392b138a | 4 | public void welcome() {
while (true) {
Socket s = null;
try {
s = ss.accept();
System.out.println("Port:" + s.getPort());
System.out.println("Address:" + s.getInetAddress());
System.out.println("LocalPort:" + s.getLocalPort());
System.out.println("LocalAddress:" +
s.getLocalAddress());... |
5de6d44f-05e6-4d09-8399-5bf1e006dd91 | 1 | public int columnsCount()
{
if(this.map[0] != null)
return this.map[0].length;
else
return 0;
} |
6a27bba0-cd12-4c89-9fdd-cf1d148ca81a | 4 | private static int[] getPositivesAndNegatives(String distinctValue,
String attribute, ArrayList<HashMap<String, String>> examples) {
int[] pn = new int[2];
for (HashMap<String, String> example : examples) {
if (attribute == null
|| example.get(attribute).equals(distinctValue)) {
if (example.get("Goal... |
0e7d50bd-5cd8-42a4-943b-c36fa71bb471 | 1 | private static boolean checkLength (int c) {
char[] charsC = ("" + c).toCharArray();
if (charsC.length == 4) return true;
else return false;
} |
a922d037-ba95-4bb1-a4e9-5c1539431456 | 8 | public boolean InRange(double px, double py, int dir, double dx, double dy) {
// System.out.println("InRange"+px+", "+py+" dir "+dir+" dx "+dx+" dy"+dy);
if (dir == 2)
{
if (Math.abs(coord[0] - px) < dx && Math.abs(coord[1] - py) < dy)
return true;
}
... |
ab844e88-7ce8-4776-966f-a33ac4016f91 | 9 | public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException {
super.initialize(flowChartinstance, chartItemSpecification);
for (String key : chartItemSpecification.getChartItemAttributes().keySet()) {
if (key.equals("id")) {
idName... |
a1fac023-13bb-439b-81f8-f939501ba5e4 | 8 | public void setMove(int move) {
//If we can't move then we souldn't change the move
if(!canMove)
return;
//For we do not update their move, we should perform a check
if(this.move == MOVE_DOWN){
switch(move){
case MOVE_LEFT+MOVE_UP:
this.move += MOVE_LEFT;
break;
case MOVE_RIGHT+MOVE_UP:
... |
f38c5042-2bb5-4665-b39e-8fbd515d8478 | 0 | protected int getDaysOfMonth(int year, int month) {
cal.set(year, month - 1, 1);
cal.roll(Calendar.DATE, -1);
return cal.get(Calendar.DATE);
} |
13d1f39a-a81b-4b9e-ab1d-c30be67e572f | 4 | public boolean isConnected() {
for (int i=0; i<this.getInput().length; i++)
if (this.getInput()[i]==null) {
return false;
}
for (int i=0; i<this.getOutput().length; i++)
if (this.getOutput()[i]==null) {
return false;
}
... |
e967c472-533f-450d-a586-4d6a7c134310 | 7 | public void draw_frame_rate(Graphics2D g2) {
if (( XHSIStatus.status.equals(XHSIStatus.STATUS_RECEIVING) ) || ( XHSIStatus.status.equals(XHSIStatus.STATUS_PLAYING_RECORDING) )) {
g2.setColor(Color.BLACK);
g2.setFont(gc.font_statusbar);
// draw scale
g2.drawStrin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.