method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
206f9971-689e-443d-ab2e-6573bc318681 | 1 | public void output() {
ListElement current = head;
while (current != tail.next()) {
System.out.print(current.getValue() + " ");
current = current.next();
}
System.out.println();
} |
ed71319d-94bf-4cec-b39f-e494575994fa | 9 | private int calculateMinN(List<Predicate> predicates) {
count = new HashMap<String, Integer>();
for(Predicate predicate : predicates) {
if(predicate instanceof BinaryContains) {
// ignore them for the time being
} else if(predicate instanceof Contains) {
this.addToCount(((Contains) predicate).ge... |
2cd73660-dfbd-412b-b059-37984232a296 | 5 | private static void appendJSONPair(StringBuilder json, String key,
String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
}
} catch (NumberFormatException e) {
... |
d880f05b-51ed-44a2-b1bb-22d096e26aa7 | 0 | public static void main(String[] args) {
MyClass myClass = new MyClass();
} |
4d15a9d4-f93d-4f0c-9b0c-42557faf4627 | 0 | @Override
public String toString(){
return monster.toString();
} |
34a2fbb8-a40d-4b36-9635-0ffca548b254 | 5 | private void talkCommand(String input) {
if (currentRoom.getNPCsInRoom() != null) {
boolean pass = false;
if (input.equals("")) { //If the player doesn't specify someone
currentRoom.getNPCsInRoom()[0].printDefaultDialogue();
}
else {
... |
f2da8874-9d87-41f4-ba1f-adbbc18e688e | 2 | @Override
public void setBounds(int x, int y, int width, int height) {
if (mIgnoreResizeOK || mResizeOK) {
super.setBounds(x, y, width, height);
}
} |
cf82c2af-0ad7-479a-a6db-7a59e1860816 | 1 | public double getAllweight() {
double weights = 0;
for(ValueFace vf : this.valuesFaces){
weights += vf.weight;
}
return weights;
} |
ca2dfb7e-fa35-470b-b3a7-137119e84390 | 6 | private void createItems()
{
//Create all items from XML file and set all properties
Map<Integer, HashMap<String, String>> parentMap = itemsXML.getXMLData();
Iterator<Map.Entry<Integer, HashMap<String, String>>> parentXML = parentMap.entrySet().iterator();
int itemRoomID = 0... |
3dc20d35-617b-45f2-8242-f26c72c39f51 | 7 | public final static void main(final String[] args) {
Random rnd = new Random();
int len = rnd.nextInt(90)+10;
System.out.print("Test Counting Bloom Filter\n");
System.out.print("==========================\n");
CountingBloomFilter cbf = new CountingBloomFilter(len);
System.out.print("Created empty filter.\n"... |
83198311-a371-4d2f-8bfe-0e605119b51f | 2 | private void fillBoxes() {
for (int i = -5; i <= 5; i++) {
cmbYear.addItem(calendar.get(Calendar.YEAR) + i);
}
for (int j = 1; j <= 12; j++) {
cmbMonth.addItem(j);
}
cmbYear.setSelectedItem(calendar.get(Calendar.YEAR));
cmbMonth.setSelectedItem(cal... |
c4e76521-5a31-4925-838b-d4cbd1a2bc00 | 8 | public static void printDarsSection(final DARSInfo.CLASS[] darsClass) {
try {
File file = new File("bwskfcls.P_GetCrse.htm");
final BufferedReader br = new BufferedReader(new FileReader(file));
String input = null;
M: while ((input = br.readLine()) != null) {
if(input.startsWith(VAR.CLASSKEY)) {... |
bb3367db-f779-4fb0-8fc4-3f5b92eb32c9 | 1 | public AnnotationVisitor visitAnnotation(
final String desc,
final boolean visible)
{
AnnotationVisitor av = super.visitAnnotation(desc, visible);
if (mv != null) {
((TraceAnnotationVisitor) av).av = mv.visitAnnotation(desc, visible);
}
return av;
} |
4484c729-c84b-478a-b514-233b9a478265 | 0 | ParticipantListItf deserializeFromJson(String json) {
AutoBean<ParticipantListItf> bean = AutoBeanCodex.decode(factory, ParticipantListItf.class, "{\"participants\": " + json+ "}");
return bean.as();
} |
8b4e7fd2-f17d-4cc4-a611-ec486069f797 | 0 | public AddTrapStatePane(AutomatonEnvironment environment)
{
myAutomaton = (FiniteStateAutomaton) environment.getAutomaton().clone();
JFrame frame = Universe.frameForEnvironment(environment);
setLayout(new BorderLayout());
JPanel labels = new JPanel(new BorderLayout());
JLabel mainLabel = new JLabel();
J... |
6d998b10-7f9a-436e-85d3-81ea63d684aa | 6 | public void ControlMaster(Vector<String> labels, Vector<String> instruct, Vector<String> operator, Vector<String> comments, Vector<String> machCod, Vector<String> contLoc) {
for(int i = 0 ; i < 24; i++)
{
((JTextField) a [i]).setText(labels.elementAt(i));
}
for(int j = 0 ; j < 24; j++)
{
((JTextF... |
cefd6251-19a2-4750-9c46-e194c593fbee | 1 | private static int buildLeavesSet(final String filePath) throws IOException{
File leavesFile = new File(filePath);
FileReader leavesFileReader = new FileReader(leavesFile);
BufferedReader br = new BufferedReader(leavesFileReader);
int count = 0;
String line;
while((line = br.readLine()) != null){
count++... |
11cee14b-6615-4e6c-b844-bf8b813205b7 | 5 | public int solve() {
int wordLength = myCombinations[0].length();
// if myLength is even less than wordLength, return 0 (impossible)
if (myLength < wordLength)
return 0;
preprocess();
// rolling array
int currentBeadLength = wordLength; // length for dp1
int[] dp1 = new int[myCombinations.length];
in... |
3d48ed68-3916-45dd-88ed-276cad088c0b | 5 | @Override
public boolean equals(final Object obj)
{
if (obj == this)
{
return true;
}
if (SampleRoundingContext.class.isInstance(obj))
{
final SampleRoundingContext other = (SampleRoundingContext) obj;
if (currencyPair.equals(other.currencyPair) && tenor.equals(other.tenor))
{
if (getRole() == nu... |
b1a05e8a-54a8-41dc-aa4a-884874644c04 | 1 | public void addRow(Object[] array) {
// data[rowIndex][columnIndex] = (String) aValue;
// add row to database
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
Project newRecord = projectService.createProject((String) array[0],
(String) array[1], (String) array[2], (S... |
45d03b5f-0376-4a06-b8e4-9f79bf887cd5 | 3 | public void render(int xMovement, int yMovement, Renderer gfx) {
gfx.setOffset(xMovement, yMovement);
int x1 = xMovement / Tile.SIZE;
int x2 = (xMovement + gfx.getWidth() + 16) / Tile.SIZE;
int y1 = yMovement / Tile.SIZE;
int y2 = (yMovement + gfx.getHeight() + 16) / Tile.SIZE;
... |
1c90666a-c8dd-41d8-8b41-71631e2c76c5 | 7 | public boolean canDeselect(DefaultMutableTreeNode node) {
boolean permission = true;
if (node instanceof NumberNode) {
NumberNode iteratorChild = (NumberNode) m_TreeModel.getChild(this,
1);
NumberNode maxChild = (NumberNode) m_TreeModel.getChild(this, 2);
//the one case whe... |
e8f4ea05-06b1-4d76-89e1-52a1690bc569 | 3 | @Override
public void actionPerformed(ActionEvent event) {
Component comp = getFocusOwner();
if (comp instanceof JTextComponent) {
((JTextComponent) comp).cut();
} else {
Cutable cutable = getTarget(Cutable.class);
if (cutable != null && cutable.canCutSelection()) {
cutable.cutSelection();
}
}
... |
970216d4-22a5-4a68-ba78-f9d51e0ffd19 | 2 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int sum = 0;
String bin = Integer.toBinaryString(n);
for(int i = 0; i < 32; i++)
{
if((n&1) == 1)
{
sum++;
}
n=n>>1;
}
System.out.printf("%s - %s",bin,sum);
} |
0bc4dac4-9bf0-4707-ae02-15d9361dde53 | 9 | private String formatCreateTable(String sql) {
StringBuffer result = new StringBuffer().append( "\n " );
StringTokenizer tokens = new StringTokenizer( sql, "(,)'[]\"", true );
int depth = 0;
boolean quoted = false;
while ( tokens.hasMoreTokens() ) {
String token = tokens.nextToken();
if ( isQuote( t... |
9db625df-fec1-4114-8515-51dd9c9f3468 | 7 | 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... |
ebc42908-eb46-4131-bc28-aae5c8ee5b93 | 3 | public int cdlShootingStarLookback( )
{
return ((( ((( (this.candleSettings[CandleSettingType.BodyShort.ordinal()].avgPeriod) ) > ( (this.candleSettings[CandleSettingType.ShadowLong.ordinal()].avgPeriod) )) ? ( (this.candleSettings[CandleSettingType.BodyShort.ordinal()].avgPeriod) ) : ( (this.candleSettings[Ca... |
6e57acaa-fe89-4ad0-bdc3-51546e48d0bf | 8 | public void findMainLabels() {
clusters = new int[nLabels + 2];
nClusters = 0;
/* only one label */
if (nLabels == 1) {
nClusters++;
clusters[nClusters] = 1;
clusters[nClusters + 1] = Integer.MAX_VALUE;
} else {
boolean reached[] = new boolean[nLabels+1];
int... |
782b9378-b080-4ef4-98d7-c02fcd063619 | 9 | private void gameLoop() {
// This value would probably be stored elsewhere.
final double GAME_HERTZ = 30.0;
// Calculate how many ns each frame should take for our target game
// hertz.
final double TIME_BETWEEN_UPDATES = 1000000000 / GAME_HERTZ;
// At the very most we will update the game this many times b... |
52b4fd67-1e83-4972-b3a2-6935c4b2d76b | 0 | public String getFolderPath() {
return folderPath;
} |
ad4e4849-12fe-438d-9547-5198b406d9fc | 6 | public void leaveClan (int playerId, int clanId) {
Client c = (Client)PlayerHandler.players[playerId];
if(clanId < 0) {
c.sendMessage("You are not in a clan!");
return;
}
if(clans[clanId] !=null) {
if(PlayerHandler.players[playerId].playerName.equalsIgnoreCase(clans[clanId].owner)) {
messageToClan... |
22d29eed-2bb3-43d4-add2-41a52206d0c6 | 7 | public void setInstances(Instances ins) throws Exception {
if (ins.numAttributes() > 512) {
throw new Exception("Can't display more than 512 attributes!");
}
if (m_span == null) {
m_span = new JPanel() {
private static final long serialVersionUID = 7107576557995451922L;
public void pa... |
334ca40f-d1e3-4685-8b2d-216a0ece79df | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
01d2d2f0-013c-4ce8-8e45-2e8328660af2 | 1 | @Override
public int compareTo(VideoSection o) {
int startCompare = this.start.compareTo(o.start);
return startCompare != 0 ? startCompare : this.end.compareTo(o.end);
} |
7a58e6b9-b189-4c46-96ba-e27e028a9229 | 5 | public void moveEntityLeft() {
for (Entity entity : entitys) {
boolean blocked = false;
for (Entity platform : platforms) {
if (platform.entityType == EntityType.Solid) {
if (platform.intersects(new Square(entity.getX() -6, entity.getY(), entity.getWid... |
f46b356c-685a-41a3-a639-34b9265dab1a | 0 | public void setMsgID(String msgID) {
this.msgID = msgID;
} |
1c547f04-cacc-438a-b7af-75afe6b69cf8 | 1 | String forgotPass() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(url, dbUser, dbPass);
Statement stm = con.createStatement();
String q2 = "... |
cc138d3d-f00c-4d6b-ad6a-bafa5c669e6e | 2 | public Key delMin()
{
if (N == 0)
throw new RuntimeException("Priority Queue Underflow");
Key min = pq[1];
pq[1] = pq[N]; // half exchange
pq[N--] = null;
sink(1);
// resize
if (N == pq.length / 4)
pq = resize(pq, pq.length / 2);
return min;
} |
3bdb1c00-be54-4616-8fc1-04c2e9dfa3be | 0 | public List findBySampleInput(Object sampleInput) {
return findByProperty(SAMPLE_INPUT, sampleInput);
} |
42bfac69-40ba-4f9e-9576-34a63b729761 | 9 | public static void main(String[] args) throws IOException{
DBInterpreter interpreter;
DBUserController userController;
DBExecutor executor;
Query query;
InputStream input;
if (args.length != 1) {
System.out.println("Use: minidbms <... |
089ffad9-63cb-4775-a241-e3f9b55cc4e2 | 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... |
6b7050ba-79dc-4aec-8c9c-142fbea6ffc9 | 5 | public static void deplacement(int posxa,int posya,int direction)
{
int ppf= 5;
for(int i=0; i<2; i++)
{
switch(direction)
{
case 1:
posxa+=ppf;
break;
case 2:
posxa-=ppf;
break;
case 3:
posya+=ppf;
break;
case 4:
posya-=ppf;
break;
... |
84a80201-ce18-4350-8f34-3566106bce6b | 6 | public boolean entityFree(int x, int y) {//Free for entities (meaning no blockable entities or tiles currently here)
int key = genKey(x, y);
boolean tileFree = false;
if (tileHashMap.containsKey(key)) {
tileFree = tileHashMap.get(key).isPassable();
}
boolean entFree =... |
8f8d71f5-d22a-4dfc-82b2-916d29399a99 | 6 | private void goRoom(Command command)
{
if(!command.hasSecondWord()) {
// if there is no second word, we don't know where to go...
System.out.println("Go where?");
return;
}
Direction direction = null;
try {
direction = Directi... |
225a2231-38da-4fca-97ce-2878e148d499 | 4 | public void printBreadthFirst()
{
NoeudRN z= racine;
Queue<NoeudRN> noeuds= new LinkedList<NoeudRN>();
if(z != sentinelle){
noeuds.add(z);
while(!noeuds.isEmpty()){
z= noeuds.remove();
System.out.println(z.toString());
if(z.getGauche() != sentinelle)
noeuds.add(z.getGauche());
if(z.... |
1b709c11-e3d0-443e-a399-1a632f45262b | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
0192b650-d75a-4166-adb9-e749774fad57 | 2 | @Override
public String getOnePersonAsJson(long id) {
for (Person person : persons) {
if (person.getId() == id) {
return trans.toJson(person);
}
}
return null;
} |
8a9619f3-bc0c-40c7-a4cd-5b79f75e3fd5 | 3 | public boolean equals(Object var1) {
if(this == var1) {
return true;
} else if(var1 != null && this.getClass() == var1.getClass()) {
J_JsonStringNode var2 = (J_JsonStringNode)var1;
return this.field_27224_a.equals(var2.field_27224_a);
} else {
return false;
}
... |
decb5639-fc09-4935-b53f-8c06aff48e7f | 1 | public void setTimeout(long timeout) {
if (timeout < 1) {
throw new ComponentException("Illegal timeout value: " + timeout);
}
this.timeout = timeout;
} |
e3df41b2-9d66-4596-9dda-dd0ecfe3d4c5 | 1 | public boolean _setLevel(int level)
{
if(level > 0)
{
this.level = level;
return true;
}
else
{
return false; // Invalid level given.
}
} |
07b0c320-b5ea-4dd5-a082-799a4a7849d5 | 1 | public void setOperandAt(final Block block, final Def def) {
if (def != null) {
operands.put(block, def);
} else {
operands.remove(block);
}
} |
aad12920-bc40-4946-b5ee-83953d059514 | 6 | public static void cppOutputSignatures(Keyword accesscontrolmode, Cons signatures) {
Stella.cppIndent();
if (accesscontrolmode == Stella.KWD_PUBLIC) {
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.println("public:");
}
else if (accesscontrolmode == Stella.KWD_PRIVATE) {
((Outp... |
44fd6e72-f0f4-45b9-a678-078791360246 | 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... |
dce0cfbb-4bd7-4da9-a1ff-9a2b53f9a700 | 7 | @Override
public List<Tile> getDiscardCandidates(Set<Tile> aliveTiles, Collection<Tile> candidates) {
// 先保证顺子刻子的定义都是3张牌、将牌是2张牌
if (SHUNZI.size() != 3 || KEZI.size() != 3)
throw new RuntimeException();
if (JIANG.size() != 2)
throw new RuntimeException();
if (aliveTiles.isEmpty())
return emptyList();
... |
fab32874-6a12-4ac2-887f-7c96bb030bfc | 6 | @Override
protected void lock() {
while (true)
if (!calcLocker.isWriteLocked() && calcLocker.writeLock().tryLock())
if (calcLocker.getWriteHoldCount() != 1)
calcLocker.writeLock().unlock();
else if (hasAdjustment() == PRO_ADJ_PAR
... |
583a22a1-6ba2-49eb-87c1-6258d480dbf5 | 6 | public synchronized void addPlayer(String data) {
try {
boolean exists = false;
int count = 1;
String log = "";
StringTokenizer ST = new StringTokenizer(data);
ST.nextToken(); // Zieladresse, ist hier uninteressant
String name = ST.nextToken();
int min = Integer.parseInt(ST... |
25425ecb-9ec6-4416-ab60-f4129747e699 | 8 | public void performSorting()
{
for(Racer r : racers)
{
int bucketIndex = (Math.abs(r.getStart() - minStartTime)) % racers.length;
for(int i = 0/* bucketIndex*/ ; i < bucket.length ; i++)
{
if(bucket[i].maxEndTime < r.getEnd())
{
... |
40acce8c-d71e-4231-9fab-8ec08fb13f70 | 2 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = 0, cnt = 1;
HDOJ1069 hdoj1069 = new HDOJ1069();
while ((n = scanner.nextInt()) > 0) {
hdoj1069.init();
while (n-- > 0) {
hdoj1069.handleInput(scanner.nextInt... |
671992ae-a79c-4a4b-b3bb-dd44256b6c8f | 3 | @Override
public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp)
throws Exception {
if (st.size() < 2)
throw new Exception("RESTA: faltan operandos");
Valor op1 = st.pop();
Valor op2 = st.pop();
if (op1 instanceof Entero && op2 instanceof Entero) {
st.push(new Entero(((int) op2.getValor()) -... |
5676d963-e0ca-4e42-aa20-55160890aacb | 3 | public static void handlePart(String channel) {
if ( channel.isEmpty() ) {
channel = getActiveTab().getTabName();
if ( !isChannelTabActive() ) {
showNotActiveChannelWarning();
return;
}
}
ChannelTab channelTab = getCurrentServe... |
e0bcca31-4e74-45ed-92c3-b4e58267358c | 4 | private Rectangle getBounds(PaddlePosition pos)
{
Rectangle r = null;
if(pos == PaddlePosition.BOTTOM){
this.bounds = new Rectangle(GamePanel.GAMEWIDTH/2, GamePanel.GAMEHEIGHT/2, 100,20);
r = new Rectangle(0,GamePanel.GAMEHEIGHT-50,GamePanel.GAMEWIDTH,50);
col = n... |
20b2f2ba-ed18-4855-a1e6-2fd198c3b83e | 9 | public static String balance(String s) {
StringBuilder sb = new StringBuilder();
boolean valid[] = new boolean[s.length()];
char[] str = s.toCharArray();
Stack<Integer> st = new Stack<Integer>();
for (int i = 0; i < str.length; i++) {
if (str[i] == '(') {
st.push(i);
}
else... |
ef85f3be-cef3-4276-9147-998cdd7d8bfc | 4 | public Map<String, Integer> call() throws Exception {
Map<String, Integer> tmpMap = new HashMap<>();
// Tant qu'il reste des données à traiter
while (i < stringArray.length) {
try {
if ((i+intervalle)>=stringArray.length) {
tmpMap = proxy.calcul(Arrays.copyOfRange(stringArray, i, stringArray.... |
67ea197b-a9b2-4ec5-9f99-7de2733a2607 | 1 | public static void setBreedingProbability(double breeding_probability)
{
if (breeding_probability >= 0)
Grass.breeding_probability = breeding_probability;
} |
477dc6a0-d1b9-4f00-8c51-c24535e23ea1 | 3 | @Override
public boolean containsAll( Collection<?> collection )
{
for (Object element : collection)
{
if (!trie.containsKey( element ))
{
return false;
}
}
return true;
} |
3e0e6bf8-b5f1-4462-b6c6-5f390099bb97 | 2 | public synchronized void setMyLunchTime(double arrivalTime) {
if(arrivalTime < 300)
{
lunchTime = (randNumber.nextInt(300 - (int)arrivalTime) + 300);
}
else if (arrivalTime == 300)
{
lunchTime = 300; // represents 30 minutes simulated time (300ms)
}
} |
465293ff-7341-4cbf-bb28-029ebe7edd4f | 8 | public static boolean isValidType(String type, Symtab st) {
if (!(type.equals("int")
|| type.equals("decimal")
|| type.equals("String")
|| type.equals("message")
|| type.equals("boolean") || type.startsWith("list") || st.lookup(type) != null))
return false;
if (type.startsWith("list"))
return ... |
85516099-4ac9-44e8-9e36-4f77ae41c801 | 9 | public void act() {
if (backToMenuButton.wasClicked()) {
// go to start state
gameScreen.setState(gameScreen.getStartState());
}
String key = gameScreen.getKey();
if (arrowLeftButton.wasClicked() || (key != null && key.equals("left"))) {
currentHighscoreLevel--;
if (currentHighscoreLevel < 1) {
... |
70f21937-f7d9-48aa-a2c8-caee485577e0 | 6 | public boolean importData(JComponent receiverComp, Transferable t) {
if (canImport(receiverComp, t.getTransferDataFlavors())) {
try {
for (int i = 0; i < GridMouseResultsModelTransferable.flavors.length; i++) {
if (t.isDataFlavorSupported(GridMouseResultsModelTran... |
1d509748-8bfa-4300-b221-208a86143631 | 0 | @Override
public void characters(char ch[], int start, int length) throws SAXException {} |
41f0a274-0166-4a0d-8cfe-7fc0cdba839b | 8 | public void PrintSetupSimple(Layout setup)
{
for (int i = setup.getGenMin(); i <= (setup.getGenMax() * 1.5) - 2; i++)
{
System.out.print(" ");
}
System.out.println("[" + setup.RoomCount() + "]");
for (int i = setup.getGenMin(); i <= (setup.getGenMax() * 3) + 1; i++)
{
System.out.print("■");
}
Sys... |
65bcd6fe-1337-4645-9032-7f7256fb2586 | 0 | @Override
public String toString() {
return "fleming.entity.Historialclinico[ idHistorialClinico=" + idHistorialClinico + " ]";
} |
8f666152-f715-49dd-8745-3bda3d48cfc0 | 2 | public Channel(ResultSet rs, ChannelStyle style) throws SQLException {
clients = new ArrayList<Client>();
name = rs.getString("name");
size = rs.getShort("size");
topic = rs.getString("topic");
String gameName = rs.getString("game");
if (gameName == null) {
game = null;
} else if (gameName.equals("MAF... |
9fe424cf-e82b-4295-8767-4c0b5ba5322a | 4 | public void loadDays(String[] input, int day) {
int index = 0;
for (int j = 0; j < 6; j++) {
for (int i = 0; i < 7; i++) {
if(days[i][j] != null)
{
day--;
if(day == 0)
{
days[i][j].loadData(input);
}
}
}
}
} |
bd549f57-f2ec-4817-babc-a739d2aa2ebd | 4 | @Override
public Shape getShape(String shapeType){
if(shapeType==null){
return null;
}
if (shapeType.equalsIgnoreCase("CIRCLE")){
return new Circle();
}
else if (shapeType.equalsIgnoreCase("RECTANGLE")){
return new Rectangle();
}
... |
783a430a-188d-48bc-a5cb-3624fe804dc7 | 8 | public boolean next(Buffer _buf) throws Exception{
int i,j;
switch(state){
case SSH_MSG_KEXDH_REPLY:
// The server responds with:
// byte SSH_MSG_KEXDH_REPLY(31)
// string server public host key and certificates (K_S)
// mpint f
// string signature of H
j=... |
2172f80f-c7ae-4963-82c7-0988979004a8 | 1 | public ArrayList<Double> getSeparateDurations()
{
ArrayList<Double> durations = new ArrayList<Double>();
for (Edge edge : edges)
durations.add(edge.getTravelTime());
return durations;
} |
384c4615-0067-40ef-bcf6-b5c9f86ac6da | 9 | public static boolean isReservedAnd(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 3;
char next;
if (candidate.length()!=3){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); i++)
{
... |
7194a231-c9ac-4a7f-8821-ad734c3141d6 | 3 | public RecordDialog(LogicSystem logicSystem, boolean isAddAction, boolean isDeleteAction) {
super();
setTitle("Add/delete record");
this.logicSystem = logicSystem;
boolean addAction = isAddAction;
boolean deleteAction = isDeleteAction;
categoryList = new JComboBox<>();
... |
1fd281db-9da6-4d9e-ab5d-46531734b7f4 | 2 | @Override
public void onMessage(WebSocket socket, String decoded) {
SessionHandler handler = new SessionHandler(null);
Client client = Server.get().getClient(socket);
// Client does not exists
if(client == null) {
client = new Client(null);
client.setToWebsocket(socket);
Server.get().addClient(cl... |
37bca805-49b1-45d6-a80c-a49155d0eceb | 1 | public void endFortify() {
for (AbstractMatter u : playerList.getCurrentPlayer().getUnitList().getAbstractMatterList()) {
((Unit)u).setFortify(false);
}
} |
98918e11-3de1-443a-b7c2-780fa92357e3 | 1 | public void move(int x, int y){
if (moveCheck()){
pos = pos.add(new Vector3f(x,y,0));
changed = true;
}
} |
fbe9709f-af63-4e7f-8229-54dc3cac5c66 | 5 | public void login(String userName, String password) {
try {
String parameters = "user=" + URLEncoder.encode(userName, "UTF-8") + "&password=" + URLEncoder.encode(password, "UTF-8") + "&version=" + 13;
String result = Util.excutePost("https://login.minecraft.net/", parameters);
if (... |
6d472329-8a20-47ee-a388-dc586f0b229c | 4 | public Plateau(int largeur, int longueur, Case[][] casesDonjons) {
this.caseDonjons = new Case[largeur][longueur];
this.mobile = new ArrayList<>();
this.largeur = largeur;
this.longueur = longueur;
for (int y1 = 0; y1 < longueur; y1++)
{
for (int x1 = 0; x1 < largeur ; x1++)
{
this.ca... |
849a831e-7f50-4545-bd39-c16d815aab40 | 1 | @Override
public final void start() {
if (anInt4 >= 0) {
anInt4 = 0;
}
} |
e6b8b451-2c1c-472a-840b-7cd26b412ad6 | 5 | public boolean obtainWord(String wordStr) {
boolean ret = false;
Iterator<Word> ite = wordList.iterator();
while ( ite.hasNext() ) {
Word w = (Word)ite.next();
if ( w.getString().equals(wordStr) ) {
ret = true;
obtainedList.add(w);
/*lςݕ\쐬ENjL*/
int dx=0;
int dy=0;
switch ( w.getOrien... |
3d5db184-72d7-486e-b6fd-ea800e879682 | 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 Cuenta)) {
return false;
}
Cuenta other = (Cuenta) object;
if ((this.id == null && other.id != null) || (this.i... |
542a9c0a-221a-4247-9325-933f0acf97b1 | 8 | private synchronized void toBuffer(int s,Object a){
a1.add(s);a2.add(a);
if(s==clear){clearBuffer();}
if(s==opaque) theOpaque=(Boolean) a;
if(s==setBackground)theBackground=(Color) a;
if(inBuffer)return;
if(isSetter(s))return;
Graphics g=getGraphics();
if(g==null)return;
Gra... |
578f1cb8-c826-4675-8144-6e84a20f2203 | 9 | protected boolean fireAndHandleEvent(WordTokenizer tokenizer, SpellCheckEvent event) {
fireSpellCheckEvent(event);
String word = event.getInvalidWord();
//Work out what to do in response to the event.
switch (event.getAction()) {
case SpellCheckEvent.INITIAL:
break;
case SpellCheckEv... |
836c3eb9-3acc-4b8b-818a-b8b9f657f209 | 5 | public void setRandomValidValue() throws NoMoreValuesException {
if (this.size() == 1) {
if (this.index_actual_argument == -1) {
this.setStateIndex(0);
} else {
throw new NoMoreValuesException();
}
} else if (this.size() > 1) {
... |
03a1679c-2d9a-4514-b9a9-c96157e6fdcb | 1 | public TraceWindow(Configuration last) {
super("Traceback");
getContentPane().setLayout(new BorderLayout());
getContentPane().add(getPastPane(last));
pack();
if (getSize().height > MAXHEIGHT)
setSize(getSize().width, MAXHEIGHT);
setVisible(true);
} |
b2920a48-c4c9-473c-aff1-bfce046b9a4a | 2 | public static double deltaMatrices(
double[][] mat1,
double[][] mat2 )
{
double[][] test = Matrix.sub(mat1, mat2);
double delta = 0.0;
int m = Matrix.getNumOfRows(mat1);
int n = Matrix.getNumOfColumns(mat1);
for ( int i = 0; i < m; ++i )
for ( int j = 0; j < n; ++j )
delta += Math.abs(test[i][j]);
return(d... |
6b9e8011-e2aa-45d3-a54c-cd390c8ed321 | 3 | protected static String getTextContent(String str, Element elem){
NodeList nodelist = elem.getElementsByTagName(str);
if (nodelist.getLength() > 0) {
Node node = nodelist.item(0).getFirstChild();
if (null != node) {
String nodeValue = node.getNodeValue();
... |
405706bc-d5a2-4209-bd65-bb4cf52444d7 | 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... |
9b71db0a-0abe-4721-b28b-4d27c6e11432 | 0 | @Test
public void itShouldDeserializeLineString() throws Exception
{
LineString lineString = mapper.fromJson("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"LineString\"}", LineString.class);
assertNotNull(lineString);
List<LngLatAlt> coordinates = lineString.getCoordinates();
PointTest.assertLngLatAlt... |
aab61f41-17ea-4497-8b7c-2d16fb046cd1 | 9 | @Override
public void initVelocityConstraints(TimeStep step) {
Body b1 = m_bodyA;
Body b2 = m_bodyB;
m_localCenterA.set(b1.getLocalCenter());
m_localCenterB.set(b2.getLocalCenter());
Transform xf1 = b1.getTransform();
Transform xf2 = b2.getTransform();
// Compute the effective masses.
final Ve... |
539f4ec4-d8c5-4fe3-b2cf-2fcf1baf8856 | 1 | public void play() {
Iterator<Roll> it = rolls_list.iterator();
while (it.hasNext()) {
Roll r = it.next();
r.doRound(this);
notifyObservers(r);
}
Historical.deleteInstance();
} |
9af2b578-def0-4818-bc30-e7157ad5a9c9 | 3 | private void setJPaneKompetenser() {
ArrayList<HashMap<String, String>> a1 = null;
try {
String query = "select KOMPETENSDOMAN.BENAMNING KOMPBENAMNING, HAR_KOMPETENS.KOMPETENSNIVA KOMPNIVA, PLATTFORM.BENAMNING PLATTBENAMNING from KOMPETENSDOMAN"
+ " join HAR_KOMPETENS on ... |
4c4a766e-7303-43e1-8130-80552f77baf4 | 6 | public void run() {
if (D) Log.d(TAG, "Socket Type: " + mSocketType +
"BEGIN mAcceptThread" + this);
setName("AcceptThread " + mSocketType);
BluetoothSocket socket = null;
// Listen to the server socket if we're not connected
while (true) {
try {
... |
e172edd1-59f3-49f7-b4de-aef28fb5fcb2 | 6 | public boolean voikoLiikuttaa(Palikka uusiPala, int uusiX, int uusiY) {
for (int i = 0; i < 4; ++i) {
int x = uusiX + uusiPala.x(i);
int y = uusiY - uusiPala.y(i);
if (x < 0 || x >= RuudunLeveys || y < 0 || y >= RuudunKorkeus) {
return false;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.