method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5651b8fd-986c-4920-a76f-361805f812a0 | 1 | @Override
public Member getMemberByEmailId(String emailId) {
Session session = this.sessionFactory.getCurrentSession();
Query query = session.createQuery("from Member where EmailId = :emailId ");
query.setParameter("emailId", emailId);
List list = query.list();
if (list.isEmpty()) {
return null;
}
ret... |
7ace2e2d-6ffd-4348-9f70-6c28221f6b24 | 7 | public void compFinalResult() {
do {
iStage++;
compAllocation();
if (compDistribution()) {
/* deadline can not be satisfied */
if (!bDeadline) {
System.out.println("CostSufferage: THE DEADLINE CAN NOT BE SATISFIED!");
return;
} else {
System.out.println("\nNEW ROUND WITHOUT CHECKI... |
e5e74471-7003-4f41-90f8-ad865b3abfaa | 5 | @Override
public long[] run(String query) {
FUNCTION_NAME = "TJSGM";
query = query.toUpperCase();
boolean state = true;
SQLParser parser = new SQLParser();
state &= parser.parse(query + ".txt"); // file name
wrieteGlobalInfoToHDFS(parser);
long[] time = new long[4];
long startTime = new Date().getTim... |
f6766729-308e-4c2e-9e2d-dc6b59618ffa | 1 | public void notifyPeersPieceCompleted(int index) {
byte[] m = Message.haveBuilder(index);
for(Peer p : this.peerList){
p.sendMessage(m);
}
} |
34168755-ffef-4a8c-ae5e-21a2f8927a80 | 9 | private Object number() {
int length = 0;
boolean isFloatingPoint = false;
buf.setLength(0);
if (c == '-') {
add();
}
length += addDigits();
if (c == '.') {
add();
length += addDigits();
isFloatingPoint = tr... |
97d26e63-94ea-4683-8a80-3e7ea61461a2 | 8 | @Override
public void execute() {
SceneObject rock = SceneEntities.getNearest(Main.getRockIDs());
if (Inventory.isFull()) {
if (BANK_AREA.contains(Players.getLocal().getLocation())) {
if (Bank.isOpen()) {
Bank.deposit(Main.oreID, 28);
} else {
Bank.open();
}
} else if (MINE_AREA.contain... |
424062ac-003d-4cd4-93b6-a5107fd56819 | 4 | public static void main(String[] args) {
long res = 0;
int save = 0;
int runs = 0;
int tempRuns = 0;
for(int i = 1; i < 1000000; i++)
{
res = i;
tempRuns = 0;
while(res != 1)
{
tempRuns++;
if(res % 2 == 0)
res = res / 2;
else
res = (res * 3) + 1;
}
if(tempRuns > ru... |
538e28b3-0c5a-4a51-ad95-9e5e315c105e | 9 | public int solution(int A, int B, int K) {
if (B != 0 && B<K) {
return 0;
} else if (A == B) {
return (A%K == 0) ? 1 : 0;
} else if (A != 0 && A < K) {
A = K;
}
int from = (A % K == 0) ? A : A + (K-(A % K));
int range = (B-from);
int diff = 0;
if (B % K == 0) diff++;
... |
43679d26-348c-40de-b553-f90386295fd5 | 8 | @Override
public final void Paint(Graphics PanelGraphics)
{
Graphics2D Graphics = this.GameImage.createGraphics();
GeneralHelper.DrawBackground(Graphics, this.GetPanelWidth(), this.GetPanelHeight(), this.GameSize, this.GameStopped);
if (!this.GameStopped)
{
if (this.GameStarted)
{
if (this.Direction... |
0825f233-21ae-40de-b5fa-62dfb73bd9a1 | 8 | public static List<List<Integer>> getAllPolygonals() {
List<List<Integer>> polygonals = new ArrayList<List<Integer>>();
for(int i = 0; i < 6; i++)
polygonals.add(new ArrayList<Integer>());
for(int i = 1000; i <= 9999; i++) {
if(isTriangle(i)) polygonals.get(0).add(i);
if(isSquare(i)) polygonals.get(1... |
75ef7c97-6192-4220-a152-aba0c235fe71 | 1 | private void editFile(File file) {
try {
Runtime.getRuntime().exec(DEFAULT_EDITOR + " " + file.getAbsolutePath());
} catch (IOException e){
noteEditorFrame.showMessage("I/O Error", "Open editor error", JOptionPane.ERROR_MESSAGE);
}
} |
fe272e9c-4915-4bce-be54-cbf377b6a22e | 9 | private boolean jj_3R_34()
{
Token xsp;
xsp = jj_scanpos;
if (jj_3R_37()) {
jj_scanpos = xsp;
if (jj_3R_38()) {
jj_scanpos = xsp;
if (jj_3R_39()) {
jj_scanpos = xsp;
if (jj_3R_40()) {
jj_scanpos = xsp;
if (jj_3R_41()) {
jj_scanpos = xsp;
if (jj_3R_42()) {
jj_scan... |
a09a2d9b-326c-4232-9805-3606f1196a56 | 8 | public static <T extends DC> Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> getAllPairs(Set<Pair<PT<Integer>,T>> baseSetA,
Set<Pair<PT<Integer>,T>> baseSetB)
{ Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> res;
... |
04f0b6a0-0653-4384-83f9-97ab27e20f58 | 2 | private void calculateSizes()
{
if (!mDirty)
{
return;
}
mDirty = false;
mSize.width = 0;
mSize.height = 0;
Enumeration e = mComponents.keys();
while (e.hasMoreElements())
{
Component c = (Component) e.nextElement();
Point p = (Point) mComponents.get(c);
mSize.width = Math.max(mSize.widt... |
7c6ceff3-ddb8-4c90-b46f-40dadc957626 | 2 | @Override
public boolean equals(Object other) {
if (other == null)
return false;
if (other == this)
return true;
CashOffice otherCashOffice = (CashOffice) other;
return this.number == otherCashOffice.number;
} |
53a3ce70-e4b2-4347-a121-44b5df2f3d19 | 4 | public String getTranslation( int langID )
{
if ( ( langID >= 0 ) && ( langID < numberOfTranslations ) )
{
TValueEntry dummy = values[langID] ;
if ( dummy != null )
{
return dummy.value ;
}
}
// no translation but a default value
if ( defValue != null )
{
... |
1ecc96a6-ed58-4634-a16f-10e82af6d6bd | 8 | public void method390(int x, int alpha, String text, int seed, int y) {
if (text == null) {
return;
}
random.setSeed(seed);
int color = 192 + (random.nextInt() & 0x1f);
y -= trimHeight;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '@' && i + 4 < text.length() && text.charAt(i + 4) =... |
bed8a995-e25a-4863-a68d-6d95d5dd1bcf | 8 | public DrawableNode findCommonAncestor(ArrayList<DrawableNode> sample) {
if (sample.size()==0) //shouldn't happen, but just in case
return null;
DrawableNode newroot = (DrawableNode)root;
ArrayList<Node> containsSample = new ArrayList<Node>();
for(Node kid : newroot.getOffspring()) {
if (subtreeCont... |
fc7fc3b3-4366-4d7c-aac3-a4956c0b4a0f | 9 | public String toString(){
StringBuffer strbuf = new StringBuffer();
strbuf.append(this.getBeginPosition()).append("-").append(this.getEndPosition());
strbuf.append(" : ").append(this.lexemeText).append(" : \t");
switch(lexemeType) {
case TYPE_UNKNOWN :
strbuf.append("UNKONW");
break;
case TYPE_EN... |
27979ec5-a665-4656-8e61-48b2ec5cd47a | 2 | public void moveSide(Direction d)
{
if(d == Direction.RIGHT)
{
blockCol++;
updateBoard();
}
else if (d == Direction.LEFT)
{
blockCol--;
updateBoard();
}
else
{
System.out.println("UNEXPECTED ERROR, UNABLE TO MOVE");
}
} |
bf05d0e8-64e8-4c6c-8730-2a3ea5f28f2c | 9 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext()... |
d98c5364-7f4a-475b-8fdf-31552d59645f | 3 | private int calcDef() {
if (leadership > 92) { // For high Leadership commanders
return Math.round(leadership * 8 / 10 + intelligence * 2 / 10);
} else if (combatPower > 92) { // For high combatPower commanders
return Math.round(combatPower * 6 / 10 + le... |
27b1a53e-2bc0-4dae-a9eb-8840d000aa49 | 0 | public FireSword(){
this.name = Constants.FIRE_SWORD;
this.attackScore = 20;
this.attackSpeed = 15;
this.money = 1500;
} |
8cf3dd3c-d6e9-438b-8f33-6ce79bcc6370 | 3 | public void itemStateChanged(ItemEvent event)
{
if (event.getStateChange() == ItemEvent.SELECTED)
{
String fileToRead = (String)comboBox.getSelectedItem();
if (!comboBox.getSelectedItem().equals(Files.REVERT))
fileToRead += Files.PRESET_EXTENSION;
if (FileParser.readFile(fileTo... |
e2a13317-00ab-467c-9353-11b1566031df | 5 | private static void check14() {
if (!checked14) {
checked14 = true;
StringTokenizer st = new StringTokenizer(System.getProperty("java.specification.version"), ".");
try {
int major = Integer.parseInt(st.nextToken());
int minor = Integer.parseIn... |
2a8a37fb-66d3-4a80-83dc-3444c04e2695 | 0 | public void onQuestionChange(Question question)
{
setQuestion(question);
} |
e4242ec5-a402-4174-8bf8-a480193ca7f6 | 4 | private ArrayList<Position> findBoxes(ArrayList<String> board)
{
ArrayList<Position> boxes = new ArrayList<Position>();
for (int y = 0; y < board.size(); ++y)
{
for (int x = 0; x < board.get(y).length(); ++x)
{
char c = board.get(y).charAt(x);
... |
02ba6d3c-5178-4b56-ae48-646c095084de | 2 | public void run() {
while(true) {
try {
receiveData();
} catch (Exception e) {
e.printStackTrace();
}
}
} |
7058c3d3-dbae-4e33-8f3c-cd47d9a44e70 | 0 | public void setFoo1(T1 foo1)
{
this.foo1 = foo1;
} |
a7c9308b-35e5-41e1-8493-684d272d7fcd | 5 | public void mouseInteract()
{
int mouseX = MouseInfo.getPointerInfo().getLocation().x;
int mouseY = MouseInfo.getPointerInfo().getLocation().y;
if (!holdingItem && !inventoryOpen) {
interact();
}
if (holdingItem && !inventoryOpen) {
placeItemHeld(direction);
}
if (invent... |
77996c1b-4d49-4223-8a66-641e9ab696e0 | 1 | @Override
public void mouseExited(MouseEvent e) {
if(e.getComponent().getName().equals("globeMenu")) parent.getTitlePanel().hoverGlobe();
} |
26b11fdf-304a-4508-9754-2eb82450d35e | 5 | public static void main(String[] args) {
ElevensBoard board = new ElevensBoard();
int wins = 0;
for (int k = 0; k < GAMES_TO_PLAY; k++) {
if (I_AM_DEBUGGING) {
System.out.println(board);
}
while (board.playIfPossible()) {
if (I_AM_DEBUGGING) {
System.out.println(board);
}
}
if (bo... |
b7f1a057-bab8-45a2-b2e3-e34bf441347c | 4 | public String[] split(String message) {
char[] array = message.toCharArray();
String toadd = "";
ArrayList<String> temp = new ArrayList<String>();
for (int i = 0; i < array.length; i++) {
toadd += "" + array[i];
if (i % 64 == 0 && i != 0) {
temp.add(toadd);
toadd = "";
}
}
if (!toadd.equals... |
5e474700-dcd3-4d59-a2f2-d9910ddc4b70 | 5 | public String interpret(Symtab st) {
String result = "";
if (oa != null) {
//SymtabEntry id1Entry = st.lookup(oa.getID1().toString());
//struct interpretation
if (!oa.getObjectType(st).equals("message")) {
result += oa.toString() + " = ";
result += parlist.interpret();
result += ";\... |
cd08febb-d588-48d6-a771-71803954836d | 0 | public void setDate(Date date) {
this.date = date;
} |
cddaec80-c6c0-4403-ad36-b61e9222f8ee | 0 | public Villager() {
this.setAdult(true);
this.setAlive(true);
this.setProffession(null);
this.setHealth(initHealth);
this.setHunger(initHunger);
this.setThirst(initThirst);
this.setTool(null);
this.setArmor(0);
pos = new Point2D.Double();
} |
8819478e-e3db-4b57-8f99-d84d67cdab66 | 5 | public static void main(String[] args)
{
try
{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
initCards();
Mat AdAs = Highgui.imread(getAbsoluteFilePath("AcesHand.png"));
for (Card card : deck)
{
if (isCardInImage(card, AdAs))
{
System.out.println("*" + card.name + " is in AdAs");
... |
828f79d6-af51-4ec1-ac56-7104f20a942c | 6 | public static ClassInfo forName(String name) {
if (name == null || name.indexOf(';') != -1 || name.indexOf('[') != -1
|| name.indexOf('/') != -1)
throw new IllegalArgumentException("Illegal class name: " + name);
int hash = name.hashCode();
Iterator iter = classes.iterateHashCode(hash);
while (iter.hasN... |
1f97b038-0a69-4c64-b15e-a6b89ceb27d4 | 7 | @Override
public void update(long delta) {
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
InputController.keyDown(delta, Keyboard.KEY_UP);
}
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
InputController.keyDown(delta, Keyboard.KEY_DOWN);
}
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
InputController.keyD... |
685ac99f-d397-42a3-bb37-21e1656c84e4 | 7 | private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
... |
b18ff711-8c01-4990-9ce7-8d94910c0f66 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.countries");
try {
Criteria criteria = new Criteria();
Country currCountry = (Country) request.getSessionAttribute(JSP_CURRE... |
fe13b83c-5831-4fe0-872a-6666de45eb85 | 1 | public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
writer.println("break" + (label == null ? "" : " " + label) + ";");
} |
aac4e9e3-77d2-4b50-9af3-17a1f428e0ce | 3 | public void visitFiles(ArrayList<String> fileNames) {
// Treat all other command line arguments as files to be read and evaluated
FileReader freader;
for (String file : fileNames) {
try {
System.out.println("Reading from: " + file + "...");
freader = n... |
09f47b2d-bcf3-4ee2-be69-37232e567961 | 1 | public void testConstructorEx_Type_int_Chrono() throws Throwable {
try {
new Partial(null, 4, ISO_UTC);
fail();
} catch (IllegalArgumentException ex) {
assertMessageContains(ex, "must not be null");
}
} |
3a21bbf5-39f7-412c-9d67-9dff08038c00 | 8 | public void run(){
try {
//System.out.println("Dwonload Incomming Connection from IP: " + clientsocket.getInetAddress().getHostAddress()+ " PORT: "+clientsocket.getPort());
ObjectInputStream in = new ObjectInputStream(clientsocket.getInputStream());
ObjectOutputStream out = new ObjectOutputStream(clientsocket.getOutput... |
be591729-4b2b-4544-80e7-6d7d1a386070 | 3 | private boolean isOk() {
lblError.setVisible(false);
boolean res = false;
boolean checkDates = Validate.startdateBeforeReleasedate(calStartDate.getDate(), calReleaseDate.getDate());
if (checkDates) {
res = true;
} else {
if (calStartDate.getDate() != null ... |
c2340f21-dec3-4d92-b4d7-b1e7a7250c25 | 5 | public static Map<String,String> getPluginFileMap()
{
Map<String,String> pluginList = new HashMap<String,String>();
try
{
File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
String parentDirName = jarLocation.getParent(); // to get the... |
31d01c66-cbe4-4a75-b488-0f7ea98f8f36 | 2 | public void score(Paddle paddle, Player player) {
if (collision(paddle)) {
paddle.catchPowerUp(type);
player.catchPowerUp(type);
switch (type) {
case 0:
toCenter();
break;
default:
i... |
97ba3659-a6da-4699-b9da-7fa61376e52e | 8 | public static void main(String[] args) {
GameMachine gameMachine = new GameMachine();
ArrayList<MainMenuHeroSlot> heroies = new ArrayList<MainMenuHeroSlot>();
//System.out.println(gameMachine);
Scanner scanchoice = new Scanner(System.in);
int choiceentry = 0;
do {
//Print out menu
System.out.... |
f7bcadb5-16e0-4bc4-9951-66201e7f51ab | 9 | public String wraplineword (int columns)
{ int n=N,good=N;
String s="";
while (n<L)
{ if (C[n]=='\n')
{ s=new String(C,N,n-N);
N=n+1;
break;
}
n++;
if (n>=L)
{ if (n>N) s=new String(C,N,n-N);
N=n;
break;
}
if (n-N>=columns && good>N)
{ s=new String(C,N,good-N);
N=good+... |
a42cae25-fd50-4e16-9cfb-9ad30cc301a3 | 3 | private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
String tempPath = txtPath.getText();
if(tempPath.isEmpty()){
JOptionPane.showMessageDialog(this, "You have to select a XML File first",
"Missing Value",JOptionPane.WARNING_MESSAG... |
c5d203e6-ac07-4779-81ef-f43d4a6bea7e | 9 | private Map.Entry<Integer, Integer> traverseTree(String curIDRef, ArrayList<String> pathFromRoot) throws IDrefNotInSentenceException {
String parentIdRef = "";
Node curNode = getNode(curIDRef);
if (curNode.getHeadIDref() == null && !curNode.isHeadChecked()) {
Node newHead = calculateHeadWord(Arrays.asList(curI... |
b643114e-3763-4cd5-a7aa-b939eeabae0e | 6 | public static void startupHtmlPprint() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/ONTOSAURUS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$... |
872718c8-4e30-4cb7-a2da-01cc75e30ae7 | 4 | private boolean onCloseButton(int x, int y) {
int xStart = getWidth() / 3;
int xEnd = xStart + width();
int yStart = getWidth() / 3;
int yEnd = yStart + SLOT_SIZE / 2;
if (x > xStart && x < xEnd && y > yStart && y < yEnd) {
return true;
}
return false;
} |
5f4806d9-dfff-4568-b019-1746c05a8c26 | 3 | public String inCar(String carID) {
String txt="";
if(isFull()) {
txt="对不起,停车场已满。";
return txt;
}
if(carID.equals("")){
txt="请输入你停的车的车牌号:";
return txt;
}
if(contain(new Ticket(carID))) {
txt="你要停的车已经停在我们的停车场里了。";
return txt;
}
Ticket ticket = in(new Car(carID));
txt = "OK,请记住你的... |
1a817150-339b-4b8e-8017-3dbf67b70d08 | 3 | public void selectionSort()
{
int maxCompare = a.length - 1;
int smallestIndex = 0;
int numSteps = 0;
// loop from 0 to one before last item
for (int i = 0; i < maxCompare; i++)
{
// set smallest index to the one at i
smallestIndex = i;
numSteps = 0;
// loop... |
6382d6d2-6e93-4b84-a684-f4fd122d009c | 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... |
9e4d43e4-427d-4d35-8e67-85aa51f69a63 | 9 | @Override
public void task(int tId) {
try {
int nRow, nCol;
int[][] mat;
int[] vec;
int[] product;
File file;
BufferedReader reader;
PrintWriter printWriter;
String line;
String[] elements;
//read the shared matrix file
file = new File("fs/exampl... |
a283f63b-6fab-43df-9096-d6f09df8328c | 1 | public static boolean addNewPatient(NewPatientPage newPatient){
Date dob = HelperMethods.getDate(newPatient.getDob());
Patient newPat = new Patient();
newPat.setFirstName(newPatient.getfName().getText());
newPat.setLastName(newPatient.getlName().getText());
newPat.setPhone(newPatient.getPhone().getText(... |
51859c69-9539-441a-82bc-e3329b69f38b | 0 | private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
dialogPane = new JPanel();
contentPanel = new JPanel();
label1 = new JLabel();
txtInterval = new JTextField();
label2 = new JLabel();
txtTimeout... |
af46f88e-8418-441c-b2e1-2e7eff15c973 | 9 | public static void main(String [] args) throws Throwable {
if (args.length < 2) {
usage();
return;
}
Class stemClass = Class.forName("org.tartarus.snowball.ext." +
args[0] + "Stemmer");
SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance();
Reader reader;
... |
c4df2224-419c-43a7-863e-ab4dc93ec67b | 2 | public void run() {
if (validArgs) {
runCrawler();
}
else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
de33b601-b808-4894-ab4a-451b9860b657 | 7 | public String[] readFromAdjacencyMatrix(String file){
ArrayList<Node> nodes = new ArrayList<Node>();
try
{
BufferedReader in = new BufferedReader(new FileReader(file));
String line;
String[] parts;
line = in.readLine();
parts = line.spl... |
dd5f45b8-03c8-4785-83c1-7307787d7f91 | 1 | public synchronized static GameSocketServer getServerSingleton() {
if (instance == null) {
instance = new GameSocketServer();
}
return instance;
} |
2db3e29c-5833-4be5-b6d6-0c8e48be9b24 | 9 | private static int getId(String functionName) {
if (functionName.equals(NAME_REGEXP_STRING_MATCH))
return ID_REGEXP_STRING_MATCH;
else if (functionName.equals(NAME_X500NAME_MATCH))
return ID_X500NAME_MATCH;
else if (functionName.equals(NAME_RFC822NAME_MATCH))
... |
0db824a8-8a51-42d9-a513-f762b6ce8f5f | 7 | public int[][] generateMatrix(int n) {
// Start typing your Java solution below
// DO NOT write main() function
int[][] res = new int[n][];
int i = 0, j = 0;
for (i = 0; i < n; i++)
res[i] = new int[n];
int round = (n + 1) / 2;
int k = 1;
for (i = 0; i < round; i++) {
// FULL
for (j = i; j <= n... |
6830fd2e-57d9-4a10-bc86-a33fa821c6a5 | 4 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = 1;
int max = 1;
String input = sc.nextLine();
String[] strArr = input.split(" ");
String largest = strArr[0];
for (int i = 1; i < strArr.length; i++) {
if (strArr[i].equals(strArr[i - 1])) {
... |
ec423c9d-5da5-4369-a72d-49a0c53e7978 | 2 | public void compose(Position singleNodePos){
singleNodePosition = singleNodePos;
JPanel cp = new JPanel();
cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
cp.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
JPanel dist = new JPanel();
dist.setBorder(BorderFactory.createTitledBorder("Node Distri... |
6243faf8-74cf-4126-bd5c-742a74f0298d | 7 | public boolean check(String attempt, String wordtype, boolean testtype){
if (testtype){
if (!wordtype.equals(type)){
return false;
}
}
if (attempt != null){
if (attempt == "") {
return false;
}
if (attempt.equals(romaji) || attempt.equals(kana) || attempt.equals(kanji)){
return true;
... |
f5a86a50-44ad-49ec-81a3-e038eacd993e | 1 | public static boolean isMagic(byte[] peerid)
throws java.security.NoSuchAlgorithmException {
if (peerid==null) return false;
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(peerid);
byte[] digest = md.digest();
int magic = (digest[digest.length-2] << Byte.SIZE) | digest[digest.length-1];
... |
fbe2fda1-88fb-49cf-b0af-7b563fec325c | 0 | @Basic
@Column(name = "CTR_MOA_CONSEC")
public int getCtrMoaConsec() {
return ctrMoaConsec;
} |
9840951c-5137-4bfb-916e-ca2f816b1254 | 4 | private void retry(String query) {
Boolean passed = false;
while (!passed) {
try {
Connection connection = getConnection();
Statement statement = connection.createStatement();
statement.executeQuery(query);
passed = true;
return;
} catch (SQLException... |
4b292d88-d45a-4e16-b74b-2e40fbb424fd | 9 | public void runGameTimedSpeedOptimised(Controller<MOVE> pacManController,Controller<EnumMap<GHOST,MOVE>> ghostController,boolean fixedTime,boolean visual)
{
Game game=new Game(0);
GameView gv=null;
if(visual)
gv=new GameView(game).showGame();
if(pacManController instanceof HumanController)... |
7c6dbb4c-073b-429c-8743-b5397700741a | 6 | private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
int opc = -1;
int row = -1;
if (row == -1) {
row = jTable16.getSelectedRow();
opc = 1;
}
if (row == -1) {
row = jTable17.getSelectedRow();
opc = 2;
}
System.out.println("" + row)... |
03f7dcff-c3b4-427a-b1f1-e405244135a1 | 5 | private boolean logoutCommand(CommandSender sender, String[] args) {
if (!xPermissions.has(sender, "xauth.admin.logout")) {
plugin.getMsgHndlr().sendMessage("admin.permission", sender);
return true;
} else if (args.length < 2) {
plugin.getMsgHndlr().sendMessage("admin.logout.usage", sender);
return true... |
29654f08-a1ee-4c3f-97b5-ec5f19b3bad1 | 2 | @Override
public ServerModel buildRoad(BuildRoadRequest request, CookieParams cookie) throws InvalidMovesRequest {
if(request == null) {
throw new InvalidMovesRequest("Error: invalid build city request");
}
ServerModel serverGameModel = serverModels.get(cookie.getGameID());
//execute
int playerInde... |
bb9683c5-8451-4801-b4a2-6faa116da03b | 8 | private BitSet selectTBonds(String str) {
int n = model.tBonds.size();
if (n == 0)
return null;
BitSet bs = new BitSet(n);
if ("selected".equalsIgnoreCase(str)) {
synchronized (model.tBonds) {
for (int i = 0; i < n; i++) {
if (model.getTBond(i).isSelected())
bs.set(i);
}
}
return ... |
7f220bb2-7f53-46ed-b644-bc997b56bd64 | 5 | public void deplacerUnite(Matrice matrice)
{
Chemin chemin = matrice.getChemin();;
Deplacement[] deplacement = matrice.getChemin().getTabDeplacements();
switch (deplacement[chemin.getIndiceDeplacement()]) {
case BAS:
Coordonnees pos_bas = new Coordonnees(this.getPos().getX(), this.getPos().getY() + 1);
... |
81753c08-7e96-4662-94f4-a0c2687e2971 | 8 | int readCorner4(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 3, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 2, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRo... |
d404dd79-18fb-473f-bddc-f6ad2027c5ca | 1 | private boolean jj_3_24() {
if (jj_3R_41()) return true;
return false;
} |
a891dd28-a86c-4be6-9ad3-b62c7b65ece7 | 3 | public void closePosition(java.lang.String positionID) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[7]);
_call.... |
a05daee8-4ed5-4c86-b160-1ce3b291b6ce | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String s;
for(int i=0;i<N;i++){
s = sc.next();
if(s.length() == 4){
System.out.println("3");
}
else{
if((s.t... |
932bffea-c501-450b-ac66-922b111e29c5 | 7 | public String convertHTMLCode2Unicode(String text) {
StringBuffer newString = new StringBuffer();
int textLen = text.length();
for (int i = 0; i < textLen; i++) {
char charAtI = text.charAt(i);
if (i + 2 < textLen && charAtI == '&' && text.charAt(i + 1) == '#' && text.charAt(i + 2) == '7') {
int indexO... |
6dbb8447-eaac-4d39-9892-62aaa1c34822 | 3 | public boolean setHigherReplicaCatalogue(String rcName)
{
// if a local RC already exists, then exit
if (localRC_ == null)
{
System.out.println(super.get_name() +
".setHigherReplicaCatalogue(): Warning - a local " +
"Replica Catalogue entity doesn'... |
f9dd3cd1-c354-47a2-aafe-4b87f2e221b5 | 7 | protected static int makeBody0(CtClass clazz, ClassFile classfile,
CtMethod wrappedBody,
boolean isStatic, CtClass[] parameters,
CtClass returnType, ConstParameter cparam,
Bytecode... |
65a5b74a-e015-43ea-8011-8e2f75891eaa | 7 | private void orderPath(Path path) {
if (path.isMarked)
return;
path.isMarked = true;
Segment segment = null;
Vertex vertex = null;
for (int v = 0; v < path.grownSegments.size() - 1; v++) {
segment = (Segment) path.grownSegments.get(v);
vertex = segment.end;
double thisAngle = ((Double) vertex.cach... |
c8819c91-8bb4-4732-a20c-ee44f9dd62b7 | 7 | private static String getClassNumByInt(int i) {
switch (i) {
case 1:
return "G06Q10/00";
case 2:
return "G06Q20/00";
case 3:
return "G06Q30/00";
case 4:
return "G06Q40/00";
case 5:
return "G06Q50/00";
case 6:
return "G06Q90/00";
case 7:
return "G06Q99/00";
}
return "";
} |
9508cc2d-4da5-4a5a-a7bc-7c7c8f078bf9 | 1 | public void printInventory(){
for(Block i : inv){
System.out.print(i.type + " ");
}
System.out.println();
} |
8d937450-1ab5-407d-b35b-0efabc04bea6 | 2 | public BigDecimal getStudentExpenses(Student s) {
BigDecimal amount = new BigDecimal(0.0);
// 1º Get activities prize
Set<Activity> activities = s.getActivities();
for (Activity a : activities) {
amount = amount.add(a.getPrize());
}
// 2º Get bookings prize
Set<Booking> bookings = s.getBookings();
fo... |
ea439e61-ef42-4ae8-9af7-a36d163098b2 | 6 | private MoveAndCost findBestMoveInternal(int[][] board, int allowedCallCnt) {
allowedCallCnt--; //this call
int n = board.length;
int m = board[0].length;
double minCost = Double.POSITIVE_INFINITY;
int[][] bestBoard = null;
Move bestMove = null;
int[][][] newBoar... |
4057e60e-a444-4a73-a646-fe503559e047 | 9 | public Photos getNotInSet(Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate,
JinxConstants.PrivacyFilter privacyFilter,
JinxConstants.MediaType mediaType, EnumSet<JinxConstants.PhotoExtras> extras,
int perPage, int page) throws JinxException {
Map<String, String> ... |
c12f9333-fc7a-4591-870e-e2a8d3de12f7 | 7 | public void addMaps(int noToAdd) {
for (int i = 0; i < noToAdd; i++) {
Map newMap = myGen.generateMap(0);
sampleMaps.add(newMap);
}
int noMaps = sampleMaps.size();
for (int x = 0; x < mapWidth; x++)
for (int y = 0; y < mapHeight; y++) {
for (int t = 0; t < converter.numOfTileTypes(); t++) {
... |
27802a29-1d0e-4413-b963-8dc000c354c3 | 5 | public boolean loadCalendar(String filename) {
BufferedReader bis = null;
try {
try {
// open file
bis = new BufferedReader(new FileReader(filename));
String s=null;
s = bis.readLine();
//while we still have even... |
218ee703-bae8-42b0-9f95-fad7750d08ed | 9 | public static String getBiomeName(int biome)
{
if (biome == -1)
return "Sea";
else if (biome == 0)
return "Ice";
else if (biome == 1)
return "Taiga";
else if (biome == 2)
return "Desert";
else if (biome == 3)
return "Steppe";
else if (biome == 4)
return "Dry Forest";
else if (biome == 5... |
66c5e93e-2b40-4806-99fc-ae7f60d3c341 | 7 | static final void method909(int i) {
anInt1598++;
if (Class348_Sub40_Sub30.aBoolean9403 && i == 3553) {
while ((Class65.lobbyWorlds.length ^ 0xffffffff)
< (Class215.anInt2834 ^ 0xffffffff)) {
LobbyWorld class110_sub1
= Class65.lobbyWorlds[Class215.anInt2834];
if (class110_sub1 == null
|| ((L... |
26710c29-f4dc-40c9-9bfb-c2e1e15e3ba4 | 9 | protected Set<Resource> findPathMatchingJarResources(Resource rootDirResource, String subPattern) throws IOException {
URLConnection con = rootDirResource.getURL().openConnection();
JarFile jarFile = null;
String jarFileUrl = null;
String rootEntryPath = null;
boolean newJarFile ... |
181e8be6-531b-425f-bf72-1b04c148d0d6 | 7 | public Dimension minimumLayoutSize(Container parent) {
ToolBarPanel panel = (ToolBarPanel) parent;
boolean isHorizontal = panel.getOrientation() == SwingConstants.HORIZONTAL;
synchronized(parent.getTreeLock()) {
Dimension dim = new Dimension(0, 0);
int majorCount = getMajorCount();
for(int i = 0; i < maj... |
dbd94d47-c602-48f9-b1a5-425fd8768e53 | 2 | public static void genererTablesDeTest() throws Exception {
System.out.println("Début création des tables de tests....");
try {
getEntityManager().getTransaction().begin();
// Créer utilisateurs
System.out.println("Utilisateurs");
Utilisateur u1 = new Uti... |
3be8f2bd-7f6a-4441-bc95-37c2bb69249d | 8 | @Override
public boolean keydown(KeyEvent ev) {
if (ev.getKeyCode() == KeyEvent.VK_UP)
APXUtils.wPressed = true;
if (ev.getKeyCode() == KeyEvent.VK_LEFT)
APXUtils.aPressed = true;
if (ev.getKeyCode() == KeyEvent.VK_DOWN)
APXUtils.sPressed = true;
if (ev.getKeyCode() == KeyEvent.VK_RIGHT)
APXUtils.d... |
fee0baa4-340f-45da-900d-76e8b9c94ba0 | 2 | public static void main(String[] args)
{
ItemTest i = new ItemTest();
InventoryWindow iw1 = new InventoryWindow();
iw1.openInventory(State.BATTLE);
while (iw1.visible)
{
try
{
Thread.sleep(15);
}
catch(Exception ignored)
{
}
}
System.exit(-1);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.