method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
eea63f73-00e5-42fa-b07e-54892fb7f4c9 | 2 | public Piece(Position position, String couleur)
{
this.position = position;
this.Couleur = couleur;
this.Image = "";
this.positionDuMechant = null;
this.DejaDeplace = false;
this.NombreDeDeplacement = 0;
for (int i = 0 ; i < 8 ; i++)
for(int j = 0 ; j < 8 ; j++)
this.PositionPossible[i][j] =... |
07fea5f3-a0cf-4ee4-a145-9c1b9aac78f6 | 8 | private void renderWall(double x0, double y0, double x1, double y1) {
double xo0 = ((x0 - 0.5) - xCam) * 2;
double yo0 = ((y0 - 0.5) - yCam) * 2;
double xx0 = xo0 * rCos - yo0 * rSin;
double u0 = ((-0.5) - zCam) * 2;
double l0 = ((+0.5) - zCam) * 2;
double zz0 = yo0 * rC... |
b84394b1-77d0-4cb4-b5e5-f7a7f8e4d2d7 | 5 | public static Iterator toIterator(Object value, char delimiter) {
if (value == null) {
return IteratorUtils.emptyIterator();
}
if (value instanceof String) {
String s = (String)value;
if (s.indexOf(delimiter) > 0) {
return split((String)value, ... |
a10b2cbb-37a4-4402-9f66-83e10d70ee3c | 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... |
b3089552-46ab-4f7a-9adf-ff653911a213 | 4 | public boolean Chk_Pkmn(String str){
boolean bl = false;
Reader reader = new Reader();
try{
// pokomon_name.txtからポケモン名を取得.
String txt_pkmn[] = reader.txtReader(Const.POKEMONNAME_NORMAL);
// 範囲チェック.
if (!(util.isRange(str.length(), 0, 10))){
return bl;
}
// 対象ポケモン名がpokemon_name... |
23573025-cf74-43bb-b695-661da581a1c3 | 1 | public DNode getPrev(DNode v) throws IllegalStateException{
if(isEmpty()) throw new IllegalStateException("List is empty");
return v.getPrev();
} |
8f125bea-1f44-4d8e-a8f9-7dc1639fda35 | 3 | public FullGridFactory getGridFactory() {
if (inputStream != null)
if (gameTypeSelect.getSelectedItem().equals(GameType.RACE_MODE))
return new FileGridFactory(inputStream);
else
return new FileGridFactoryCTF(inputStream);
else
if (gameTypeSelect.getSelectedItem().equals(GameType.RACE_MODE))
ret... |
ebb1835c-cfea-40ab-a88b-e3a3d643fc60 | 3 | void paintFlow(CPRect srcRect, CPRect dstRect, byte[] brush, int w, int alpha) {
int[] opacityData = opacityBuffer.data;
int by = srcRect.top;
for (int j = dstRect.top; j < dstRect.bottom; j++, by++) {
int srcOffset = srcRect.left + by * w;
int dstOffset = dstRect.left + j * width;
for (int i = ds... |
d1b8b0a2-017c-4bfa-933b-3e2cc2aba81b | 4 | public DataSource assemble(ServletConfig config) throws ServletException {
DataSource _ds = null;
String dataSourceName = config.getInitParameter("data-source");
System.out.println("Data Source Parameter" + dataSourceName);
if (dataSourceName == null)
throw new ServletException("data-source must be specified... |
609f6b16-f707-4a08-bc52-8ef041e47c1b | 0 | @Override
public String toString() {
return "{id=" + id + ",intencity=" + intencity + ",fw1=" + firewallId1 +",fw2=" + firewallId2 + ",managerFw=" + managerFirewallId + "}";
} |
28b8e9a2-1357-432b-94e7-e3fedadb8a69 | 8 | private boolean evaluateProposition(Proposition prop){
switch(prop){
case IS_FRONT_CLEAR: return karel.isFrontClear();
case IS_LEFT_CLEAR: return karel.isLeftClear();
case IS_RIGHT_CLEAR: return karel.isRightClear();
case IS_FACING_NORTH:
case IS_FACING_SOUTH:
case IS_FACING_EAST:
case IS... |
e7aa93d5-9853-42bf-9bd4-79cebb30e9ee | 6 | public int lengthOfLongestSubstring(String s) {
// Start typing your Java solution below
// DO NOT write main() function
if (s == null)
return 0;
int length = s.length();
if (length <= 1) {
return length;
}
int[] f = new int[length];
f[0] = 1;
int max = 1;
Map<Character, Integer> charMap = new... |
01e2145b-8e20-47a4-ac0d-dd3f3610ee71 | 2 | public static void main(String[] args) {
System.out.println("Simple client for financial modeling server");
System.out.println("Trying to connect");
System.out.println(HOSTNAME + ": " + PORT);
System.out.println("Run client with params: <HOST> <PORT> <TIME_OUT> for changing default sett... |
d9e93c91-06cb-41cd-9a48-6ca8263edeac | 9 | public String getRepeatedChars(String one, String two) {
Map<Character, Integer> charFrequency;
StringBuilder builder = new StringBuilder();
String longer;
if (one.length() > two.length()) {
charFrequency = makeCharFrequencyMap(two);
longer = one;
} else {... |
4a6bce90-a7ae-4627-af98-0bf01f5b2220 | 5 | public static List<MorrisBoard> generateMove(MorrisBoard crtBoard) {
List<MorrisBoard> possibleBoard = new ArrayList<MorrisBoard> ();
for (int indexMoveFrom = 0; indexMoveFrom < MorrisBoard.TOTALPOS; indexMoveFrom++) {
MorrisIntersection intersection = crtBoard.getIntersection(indexMoveFrom);
if (intersect... |
7e154268-40f8-41c7-862e-a57ae42d36d0 | 1 | public void visit_fneg(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
89805776-6b55-4bd3-95f0-98714d2ccb99 | 6 | public static void createUI(String type, String userName) {
if (type.equals("Login")) {
new LoginUI();
} else {
switch (type) {
case "Admin":
new AdminUI(userName);
break;
case "SchoolDean":
new SchoolDeanUI(userName);
break;
case "DeptAD":
new DeptADUI(userName);
break;
ca... |
0aa1e9d1-7c06-469d-95ac-fc22bfac091d | 1 | public void testToStandardHours_overflow() {
Duration test = new Duration(((long) Integer.MAX_VALUE) * 3600000L + 3600000L);
try {
test.toStandardHours();
fail();
} catch (ArithmeticException ex) {
// expected
}
} |
e7b25d4a-88ef-4941-9f06-23c6d40065f0 | 9 | @Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == addItem) {
String name = itemName.getText();
String key = itemKey.getText();
String type = types[itemType.getSelectedIndex()];
Item item;
try {
item = new Item(name, key, type);
} catch (GameReaderException e) {... |
5ff87e35-bd36-488d-ae5c-571cc5b0b8a5 | 5 | public void expression3() {
if(have(Token.Kind.NOT)){
expectRetrieve(Token.Kind.NOT);
have(NonTerminal.EXPRESSION3);
expression3();
}
else if(have(Token.Kind.OPEN_PAREN)){
expectRetrieve(Token.Kind.OPEN_PAREN);
have(NonTerminal.EXPRESSION0);
expression0();
expectRetrieve(Token.Kind.CLOSE_... |
0ac77c97-0626-4bda-bd8b-38a5d8d724fe | 9 | private boolean inBoundingBox(int mouseX, int mouseY) {
int x = this.x + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0);
int y = this.y + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0);
int width = this.width - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > ... |
43ad54e5-0f43-4351-8611-ce492488a4bf | 1 | private synchronized int waitSum() {
int waitSum = 0;
for (int count : waitEntry)
waitSum += count;
return waitSum;
} |
a20bbe80-d5aa-4d4f-a2ba-5fc0cb09a58a | 5 | public static boolean searchMatrix(int[][] matrix, int target) {
int m = matrix.length;
int n = matrix[0].length;
if (target < matrix[0][0] || target > matrix[m - 1][n - 1]) return false;
int low = 0;
int high = m * n;
int mid = 0;
while (low <= high) {
m... |
b4ade5a7-9634-447c-8e91-34d8348cefb9 | 9 | @Override
public void init() {
/* 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://download.o... |
202748b3-1472-47f1-9183-fd3dfaa94a5a | 9 | private List<Opdracht> toonOpdrachtenVanCategorie() {
List<Opdracht> tempList = new ArrayList<Opdracht>();
for (Opdracht opdr : opdrachtCatalogusModel.getOpdrachten()) {
if (quizCreatieView.getCategorie().getSelectedItem()
.equals(OpdrachtCategorie.Aardrijkskunde)
&& opdr.getOpdrachtCategorie().equals(... |
e23602c9-ce7d-4a34-9014-b88ce42c59f6 | 4 | @Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String lines[] = value.toString().split(inputDelimiter);
String outputLine = "";
boolean checked = false;
for (String line : lines) {
if (line.equals(target))
checked = true;
}
if ... |
8eb81869-96cd-4a25-9adc-89eeb9e0d421 | 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 =... |
a1484a9e-fbf2-4723-87a8-a8fe46b2e19a | 5 | public void run() {
playing = true;
while (true) {
gun.init();
playGame();
if (!playing)
break;
System.out.print("Would you like to play again [y/n]? (n): ");
try {
... |
e20f6206-6989-4152-8fa6-ec3f36815aad | 7 | public int solution( String input ) {
final Deque<Character> stack = new ArrayDeque<Character>();
boolean isProperlyFormed = true;
for ( int i = 0; i < input.length(); i++ ) {
char character = input.charAt( i );
if ( isOpenBracket( character ) ) {
stack.push( character );
... |
2d54c71d-5219-4d45-93fa-1f146b2ffd2d | 4 | public void follow() {
if(centerX < -95 || centerX > 810){
movementSpeed = 0;
}
else if (Math.abs(robot.getCenterX()-centerX) < 5){
movementSpeed = 0;
}
else {
if (robot.getCenterX() >= centerX) {
movementSpeed = 1;
} else {
movementSpeed = -1;
}
}
} |
e2bd412a-12ad-4cc2-a0e3-242a81760ee7 | 7 | private final void step6()
{ j = k;
if (b[k] == 'e')
{ int a = m();
if (a > 1 || a == 1 && !cvc(k-1)) k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1) k--;
} |
12f169a0-59ad-4c00-8437-0d03e33fd0a0 | 9 | public static void recursive(String strPath) {
File file = new File(strPath);
if(file.isDirectory() && !file.getName().equals(".svn")) {
File[] listfiles = file.listFiles();
for(File f : listfiles) {
recursive(f.getAbsolutePath());
}
} else if (file.isFile() && (file.getName().contains("Jedis")
... |
2188cd3c-8491-4947-9468-6c23bf835991 | 9 | public void readFrom(InputStream in) throws IOException {
byte[] arr = new byte[32];
int[] off = { arr.length, arr.length };
ArrayList<Byte> bytes = new ArrayList<>();
try {
if (readInt(in, arr, off) < version)
return;
int i;
while ((i = readInt(in, arr, off)) != -1) {
objectIds.add(i);
}
... |
f212b717-b10b-4d40-9dca-622f7b2d0d37 | 2 | @Override
public Connection crearConexion() {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ausiasyield", "root", "bitnami");
return connection;
} catch (ClassNotFoundException ex) {
... |
9c2728ef-3caa-4b1f-b5ad-88bf5f50887d | 5 | public void updateGrbit()
{
grbit = 0;
grbit |= valType;
grbit |= (errStyle << 4);
grbit |= (IMEMode << 10);
if( fStrLookup )
{
grbit = (grbit | BITMASK_FSTRLOOKUP);
}
if( fAllowBlank )
{
grbit = (grbit | BITMASK_FALLOWBLANK);
}
if( fSuppressCombo )
{
grbit = (grbit | BITMASK_FSUPRES... |
a33c8f1a-cf91-4d8d-99c7-1e32eb52ae52 | 6 | public String getRatioOfTwoArray(List<String> list1, List<String> list2) {
int common = 0;
int total = 0;
if (list1.size() > list2.size()) {
total = list1.size();
for (String obj : list2) {
if (list1.contains(obj)) {
common++;
} else {
total++;
}
}
} else {
total = list2.size()... |
a35abf79-143e-4681-a826-529c0c10625c | 4 | public static double compositeSimpsonsRule(SingleVarEq f, double a, double b, int steps){
// N must be positive and even
if(steps < 0 || steps % 2 != 0){
throw new IllegalArgumentException("Steps must be positive and even");
}
double h = (b - a) / steps;
double endSum = f.at(a) + f.at(b); // sum the end p... |
fe1be207-7663-43f4-948d-110e31242215 | 3 | public UWECImage createMosaic(UWECImage image) {
// scales our mosaic image
image.scaleImage(horzMosaicSize, vertMosaicSize);
// create a new blank uwecimage
UWECImage blankMosaic = new UWECImage(horzMosaicSize, vertMosaicSize);
// create threads and total number of tiles to be used
int numOfThreads = (ho... |
a8939c94-5f14-49ee-a60a-36277da1ec06 | 2 | public void init() {
matches = Competition.getInstance().getCodeRedSchedule();
batteryList = new ArrayList<>();
for (Match match : matches) {
batteryList.add(match.getBattery());
}
if (matches == null) {
matches = new ArrayList<>();
}
} |
6056bdc1-2d41-4b0f-a6ac-99ada2490d13 | 8 | protected static Instances getMiningSchemaAsInstances(Element model,
Instances dataDictionary)
throws Exception {
ArrayList<Attribute> attInfo = new ArrayList<Attribute>();
NodeList fieldList = model.getElementsByTagName("MiningField");
int classI... |
f8083aa3-afb3-4a64-a0c6-bdf663d276b1 | 2 | public Set getDeclarables() {
Set used = new SimpleSet();
if (type == FOR) {
incrInstr.fillDeclarables(used);
if (initInstr != null)
initInstr.fillDeclarables(used);
}
cond.fillDeclarables(used);
return used;
} |
a34d44b0-74f8-4f2f-ab49-4001ae4f7052 | 1 | public InfoRequest(final String id, String... emails) {
this.id = id;
for (String email : emails) {
addEmail(email);
}
} |
e3987ba5-078d-47fe-a955-abc9c0b67fae | 7 | public Game()
{
//create the JFrame and add the display to it
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1024, 600);
frame.setVisible(true);
frame.add(display);
//initialize room
Environment room = new YourRoom();
//initialize lab
Environment ... |
bec33330-d62d-4efb-abbc-5ad153ef6861 | 5 | public ArrayList<ArrayList<Integer>> combinationSum(int[] candidates, int target) {
ArrayList<ArrayList<Integer>> rst = new ArrayList<ArrayList<Integer>>();
Arrays.sort(candidates);
if (target == 0)
{
rst.add(new ArrayList<Integer>());
return rst;
}
for (int i= 0 ; i < candida... |
03da9a7e-36bc-4646-ae99-00282a0e51e5 | 9 | private static void heapsort(int a[]) {
int n = a.length;
int parent, left, right, max;
makeHeap(a);
System.out.println("array after converting into heap...\n");
for (int k : a)
System.out.print(k + " ");
for (int i = n - 1; i > 0; i--) {
swap(a, 0, i);
parent = 0;
while (true) {
left = (2 *... |
b95044f1-2fa5-4157-bcf6-ac7053194341 | 0 | public void update(Observable o, Object arg) {
// TODO Auto-generated method stub
} |
ec33d10c-e19a-4631-a655-7b46ce65c9ba | 5 | protected void createRandomChromosomes() {
int[] newChromosomes = new int[numberOfChromosomes];
int crossSum = 0;
boolean startFromEnd = false;
if (getRandom() < 0.5) {
startFromEnd = true;
}
for (int i = 0; i < newChromosomes.length; i++) {
if (getRandom() < 0.25) {
conti... |
9911d2b5-7f1a-4ee0-9184-06571b7c45d6 | 6 | private void saveResource(String username) {
if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.USER_MNG)) {
return;
}
User user = MyFactory.getUserService().queryUserByName(username);
List<String> displayNames = new ArrayList<String>();
... |
3681e169-3729-4f69-abd1-f8807bfdd28e | 3 | @Override
protected void loadPlays(Position position, Player cpu, int largestCapture){
FactoryOfPlays factory = new FactoryOfCapturingsForPiece(position,cpu.getBoard());
int bestEvaluation=-100;
for(AbstractPlay play:factory){
int evaluation = evaluate(play,cpu,largestCapture);
if(evaluation>=bestEvaluatio... |
27846967-4440-4af0-87e6-eb9ce0a9cdde | 8 | public void answerCase(int id, String user)
{
switch(id){
case 1: //connected to server, got welcome message
send(id, userName, null, Main.mainData.userName);
break;
case 2: //username accepted
userName = message;
Main.gui.serverMessage("Username: " + message + " accepted!");
send(id, userName... |
76df9a96-80de-46c3-95c8-1dce664a4e9b | 9 | public Contact[] sortContacts()
{
//Stored the stored Contact[]
Contact[] sortedContactArray = new Contact[addedContactCount];
//Create a copy of the original Contact[] so the original Contact[] won't be contaminated after sorted.
System.arraycopy(contacts, 0, sortedContactArray, 0, addedContactCount)... |
20c7dfe8-fd13-4dae-b1da-123a84987ea0 | 1 | static public String composeMultipleApiCommands(String... commands) {
StringBuilder apiCmd = new StringBuilder(256);
apiCmd.append("(LIST ");
for (Object command : commands) {
apiCmd.append(command);
}
apiCmd.append(')');
return apiCmd.toString();
} |
b2e5dc18-6a76-4f9f-8d6a-a8f8e4dc6eaa | 3 | @Override
public Pixel[][] getDisplay() {
Pixel[][] display = new Pixel[thisTick.length][thisTick[0].length];
for (int row = 0; row < thisTick.length; row++) {
for (int col = 0; col < thisTick[row].length; col++) {
display[row][col]
= new Pixel(row... |
801674f0-dd53-4d0b-b1de-cf850ae0f14e | 0 | public ChocolateChip() {
print("ChocolateChip()");
} |
5b55f838-d9de-45e1-a684-6912782ae577 | 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... |
645a98d3-4e3a-40cd-b5b0-24a634cb5166 | 8 | public static void processT(String tempDir)
throws FileNotFoundException, NoSuchElementException, IOException, ProcessException {
File trigramSortedInterDataFile = FileUtil.getFileInDirectoryWithSuffix(tempDir, TrigramExternalSort.DATA_SUFFIX);
File unigramDataFile = FileUtil.getFil... |
cc12987e-0a60-4645-a1ab-282b82cbbc3b | 7 | private void addState(Element element, StateMachineBuilder builder) throws BadStateMachineSpecification{
// this will be refactored when something other than basic state is instroduced
if (element.hasAttribute(ENABLE_ASPECT_TAG)) {
int properties = StateMachineBuilder.STATE_PROPE... |
a4071889-ef70-4d63-a45f-6e4e209609be | 0 | public String getClientId() {
return clientId;
} |
1700cd95-5604-4a68-b84c-91d98e02de7a | 7 | protected boolean isCollision(Vector3d v3d) {
Transform3D t3d = new Transform3D();
tg.getTransform(t3d);
Matrix4d m4d = new Matrix4d();
t3d.get(m4d);
GMatrix gm1 = new GMatrix(
4,
1,
new double[] {
v3d.x,
v3d.y,
v3d.z,
0.0
}
);
GMatrix gm2 = new GMatrix(
4,
4,
new doub... |
d1b86d0c-2e32-4595-a06d-e4c51d2a08bc | 5 | public static void toggleToPlayersTownyChannel( String sender, String channel, boolean hasTown, Boolean hasNation ) throws SQLException {
BSPlayer p = PlayerManager.getPlayer( sender );
if ( !hasTown ) {
p.sendMessage( Messages.TOWNY_NONE );
return;
}
if ( p.getCh... |
d1fe2c5a-15cd-403f-b071-2665b88e1e21 | 2 | public void loadConfigFiles(){
try {
loadPlayerConfigFile(playerFile);
loadCardConfigFile(cardFile);
} catch (FileNotFoundException e) {
System.out.println(e);
} catch (BadConfigFormatException e) {
System.out.println(e);
}
} |
fb1facc8-c17b-4f79-9e1e-15ece53c9fe3 | 0 | public int count() {
return count;
} |
8dc8c847-66ce-4eee-9eca-98dc69321f2e | 3 | public static void dropLocalDatabaseAndUser(MySQLIdentity root, MySQLIdentity newIdentity) throws SQLException, MySQLException {
if((root.host == null) || (newIdentity.host == null)) { throw new MySQLException("Host not specified");}
if(root.host.equals(newIdentity.host) == false) { throw new MySQLException("Hosts... |
988a70a8-8708-4203-8531-542a2f5ae6b3 | 1 | public Browser getGroup() {
if (this.parent != null) {
return parent.getGroup();
}
return this;
} |
04f067a5-d180-404c-8aa9-01e8ce23c88e | 8 | public boolean pass(int[] bowl, int bowlId, int round,
boolean canPick,
boolean musTake) {
counter++;
if(counter==1){
for(int i=0;i<12;i++){
bowSize+=bowl[i];
}
//update(bowSize*6);
}
update(bowl,bowlId,round);
... |
fda29f60-b824-4407-a6d1-1ac3df15595b | 6 | private void buildProfitsArray(int[] prices, int[] leftProfits, int[] rightProfits) {
int min = Integer.MAX_VALUE;
for (int i = 0; i < leftProfits.length; i++) {
if (prices[i] < min) {
min = prices[i];
}
//leftProfits[i] = i == 0 ? 0 : Math.max(left... |
c94568a6-c081-4d12-a6e1-cbf27775ded5 | 2 | private int hasPresencePort()
{
return (port == null || port > NO_PORT) ? hasPresence(host) : 0;
} |
043a2003-16c4-4635-b52c-eeb0fe34d000 | 5 | public static void main(String[] args) {
boolean error = false;
String path = "BIGxml.xml";
try {
if (args.length > 0) {
if (isValidXML(args[0])) {
path = args[0];
} else {
System.out
... |
b7723b52-de74-42fc-b5eb-4a542ce7d913 | 3 | private void buildLists() {
Iterator iter = roots().iterator();
preOrder = new NodeList();
postOrder = new NodeList();
final Set visited = new HashSet();
// Calculate the indices of the nodes.
while (iter.hasNext()) {
final GraphNode root = (GraphNode) iter.next();
Assert.isTrue(nodes.containsValu... |
f19b878a-dd91-4fad-b01c-5524014ed639 | 7 | public static String getAlias(Class<? extends ConfigurationSerializable> clazz) {
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
if (delegate != null) {
if ((delegate.value() == null) || (delegate.value() == clazz)) {
delegate = null;
... |
409ee266-0a45-4f2b-afb2-040d6a7d6890 | 3 | public void run(){
if(true)
return;
Socket c;
try {
while((c = socket.accept()) != null){
c.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
0c41eee3-f23a-42a1-a420-dafcd19c7ec3 | 5 | public static char getCharFromPiece(Piece in)
throws IllegalArgumentException{
char out;
switch(in){
case KING:{
out = ChessConstants.KING_PIECE_CHAR;
break;
}
case QUEEN:{
out = ChessConstants.QUEEN_PI... |
be03e15f-2e04-4151-a9ad-185a6ff79101 | 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... |
1d139c8a-3a11-4744-9276-165f33a2e03c | 8 | @Override
public int getNeighborCountOf(int x, int y) {
int count = 0;
if (cellLivesAt(x, y + 1)) {
count++;
}
if (cellLivesAt(x, y - 1)) {
count++;
}
if (cellLivesAt(x - 1, y)) {
count++;
}
if (cellLivesAt(x - 1, y ... |
85465168-9280-4b5b-9cdb-9500cde3eb5c | 5 | public void execute(int ticksLeft)
{
boolean runMain = !playerQueue.isEmpty();
if (runMain)
{
// Set ticks left
this.ticksLeft = ticksLeft;
// Fetch the max number of threads
currentThreads = cfg.spawnFinderThreads;
// Find a reasonable number of threads to run the main task in
for (... |
7ef3fa14-55db-49e7-9838-2a01f69a2ebb | 3 | public int indexOf(int gridletId, int userId) {
ResGridlet gl = null;
int i = 0;
Iterator<ResGridlet> iter = super.iterator();
while (iter.hasNext()){
gl = iter.next();
if (gl.getGridletID()==gridletId && gl.getUserID()==userId) {
return i;
... |
9488929b-cb4d-444e-be69-7c101a053c0f | 1 | public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} |
bf60c9f2-11dc-41ae-90a6-ba00026d4023 | 7 | private boolean canEventResponse() {
// 豁サ菴薙�辟。逅�
if(dead) return false;
if(getCriticalDamege() == CriticalDamegeType.CUT) return false;
// 縺�s縺�s逶エ蜑阪�蜍輔¢縺ェ縺�憾諷九�辟。逅�
if(shitting) return false;
// 蜃コ逕」逶エ蜑阪�蜍輔¢縺ェ縺�憾諷九�辟。逅�
if(birth) return false;
// 縺吶▲縺阪j繧「繝九Γ繝シ繧キ繝ァ繝ウ荳ュ縺ッ辟。逅�
if(sukkiri) return false;... |
40465a2a-b434-467c-ae80-3eb6ac9a1ce0 | 4 | public void setQuantity(String quant) {
String[] strings = quant.split("-|\\s");
for (String string : strings) {
System.out.println(string);
}
if (strings.length>=2) {
System.out.println(""+strings.length);
for (String string : strings) {
i... |
b408e944-3df5-4569-9405-1f6e77a99c3a | 6 | private void setCorrectLocationDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("fontname")) {
quizSlideDef.setCorrectFont(attrs.getValue(1));
} else if (attrs.getValue(0).equals("fontsize")) {
quizSlideDef.setCorrectSize(Float.valueOf(attrs.getValue(1)));
... |
0dcdbd97-62c4-437d-8e9f-34a06361f980 | 0 | public int size() {
return count;
} |
c2bfc6af-355d-414a-a472-4635b8b237b4 | 9 | public Location getAdjacentLocation(int direction)
{
// reduce mod 360 and round to closest multiple of 45
int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE;
if (adjustedDirection < 0)
adjustedDirection += FULL_CIRCLE;
adjustedDirection = (adjustedDirect... |
0e27b68b-4660-4b77-af08-1a783178e2af | 3 | public void tick() {
/** Ticking the buttons */
for (int i = 0; i < buttons.size(); i++) {
buttons.get(i).tick();
if (buttons.get(i).getTitle().equalsIgnoreCase("online") && buttons.get(i).getClicked()) {
main.menus.get(3).init();
}
}
} |
79763ed7-95b3-4d93-9783-d839038679e2 | 9 | public void createRoleOnIncident(ArrayList<BERoleTime> roleTime, int roleNumber) {
if (roleTime == null) {
BLLError.getInstance().functionError();
return;
}
if (roleNumber > 4 || roleNumber < 1) {
BLLError.getInstance().functionError();
return;
... |
ff2deed2-45c1-4319-bcda-2f540b8dc3bc | 6 | @Override
public Object process(Object value, ValueProcessInvocation invocation) throws BeanMappingException {
// 处理下自己的业务
BeanMappingField currentField = invocation.getContext().getCurrentField();
if (value == null && StringUtils.isNotEmpty(currentField.getDefaultValue())
&& cur... |
e442c4d2-9e83-4187-acf2-6f6232548a63 | 8 | public static void OBRADI_init_deklarator(){
String linija = mParser.ParsirajNovuLiniju(); // ucitaj <izravni_deklarator>
int trenLabela = Izrazi.mBrojacLabela++;
int stogPrijeIzravnogDek_Lok = (NaredbenaStrukturaPrograma.mStog == null) ? 0 : NaredbenaStrukturaPrograma.mStog.size();
int stogPrijeIzravnogDek_Glo... |
2b850fea-32a5-4bc5-874d-35b25fe2a3d2 | 0 | public int getAVO() {
return avoid;
} |
2df1e052-6171-4be0-8ee0-3a9bcff17ca9 | 6 | public void connect(TreeLinkNode root) {
if (root ==null)
return;
if (root.next !=null&&root.right !=null&&root.next.left!=null){
root.right.next = root.next.left;
}
if (root.left!=null&&root.right!=null){
root.left.next = root.right;
}
... |
ac2302c3-d69c-4a75-b24a-06104fd3fd97 | 3 | public IntelligentLine(Connector from, Connector to) {
super(from, to);
cpFrom = from.getParent();
cpTo = to.getParent();
panel = cpFrom.getPanel();
for (Component c : cpFrom.getPanel().getElements())
add(c);
// add(cpFrom);
// add(cpTo);
Point mp = Component.getMidPoint(cpFrom, cpTo);
add(mp);
... |
f4836cd5-c3d6-4d41-ae26-43e2549525ff | 1 | public long read5bytes() throws IOException {
long b0 = read();
long b1 = read();
long b2 = read();
long b3 = read();
long b4 = read();
if (le)
return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) | (b4 << 32);
else
return b4 | (b3 << 8) | (b2 << 16) | (b1 << 24) | (b0 << 32);
} |
67397516-4061-4b29-911d-06fe9de2a675 | 1 | public static Connection getCon() {
if (con == null)
con = initConnection();
return con;
} |
ca36df88-5419-4836-9503-cc6b2fb06189 | 8 | protected void fillOutCopyStats(final Modifiable E, final Modifiable E2)
{
if((E2 instanceof MOB)&&(!((MOB)E2).isGeneric()))
{
for(final GenericBuilder.GenMOBCode stat : GenericBuilder.GenMOBCode.values())
{
if(stat != GenericBuilder.GenMOBCode.ABILITY) // because this screws up gen hit points
{
... |
6bfa393c-0a9e-4a40-aa57-51cf6be8d1a9 | 5 | public static QuestPoint createQuest(QuestType type){
QuestPoint quest = null;
switch(type){
case TEXTQUEST:
quest = new TextQuest();
break;
case CHOICEQUEST:
quest = new ChoiceQuest();
break;
case FIELDQUEST:
quest = new FieldQuest();
break;
case ORDERQUEST:
quest = new O... |
9e65abde-a506-4e11-b77c-766b9858ad4e | 2 | @Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
generateQuotes();
Thread.sleep(10);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
} |
31889161-3e8c-4da4-971f-4156695a524b | 1 | @Override
public List list(Integer firstResult, Integer maxResults) throws Exception {
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
//Query q = session.getNamedQuery("find.all");
Query q = session.getNamedQuery(g... |
e81514d3-6e98-48fd-83c5-19b1d5ec9cd4 | 1 | public void testAdd_DurationFieldType_int3() {
MutableDateTime test = new MutableDateTime(TEST_TIME1);
try {
test.add((DurationFieldType) null, 6);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals(TEST_TIME1, test.getMillis());
} |
b5d73024-950f-4250-b1cc-beb76e459648 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Endereco other = (Endereco) obj;
if (this.idEndereco != other.idEndereco && (this.idEndereco == null || !... |
09c25ed9-c55c-4417-b7ef-02c6c3fdb4e4 | 6 | public static VertexIdTranslate fromString(String s) {
if ("none".equals(s)) {
return identity();
}
String[] lines = s.split("\n");
int vertexIntervalLength = -1;
int numShards = -1;
for(String ln : lines) {
if (ln.startsWith("vertex_interval_length=")) {... |
78903d14-0199-4319-bfc5-5ecb260e3256 | 1 | @RequestMapping(value = "/hall-event-speaker-list/{hallEventId}", method = RequestMethod.GET)
@ResponseBody
public SpeakerListResponse eventSpeakerList(
@PathVariable(value = "hallEventId") final String hallEventIdStr
) {
Boolean success = true;
String errorMessage = null;
... |
89707a4e-b2bb-49df-860e-e04f35c0dd4f | 9 | public void perform(Request r) throws Exception {
PaxosMessage commit = new PaxosMessage();
commit.setRequest(r);
commit.setMessageType(PaxosMessageEnum.REPLICA_COMMIT);
commit.setSrcId(this.processId);
commit.setSlot_number(slotNumber);
//check if already performed.
for(Entry<Integer,Request> ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.