method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8aec188e-a591-44f1-b244-dacdab016503 | 2 | public static void ChooseHarrish ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Harrish";
Game.CharacterOneHP = CharacterStats.HarrishHP;
Game.CharacterOneAttack = CharacterStats.HarrishAttack;
Game.CharacterOneMana = CharacterStats.HarrishMana;
Game.CharacterOneRegen = Charac... |
29e57695-0531-427d-9784-14053f8a57f6 | 2 | public void operateMatrix(Matrix[]... srcs) {
Matrix[] srcU = srcs[0];
Matrix[] srcV = srcs[1];
for (int colNo = 0; colNo < super.matWidth; colNo++) {
multiplyAndStackUV(srcU[0].getArray(), srcV[0].transpose().getArray(), super.arrY, colNo, srcV[0].getColumnDimension(), srcU[0].getRo... |
78e03176-0760-4bb7-85a9-a266a61da797 | 3 | public String getTooltipExtraText(final Province current) {
// Default is to only show extra text for land provinces
if (!editor.Main.map.isLand(current.getId()))
return "";
final String prop = mapPanel.getModel().getHistString(current.getId(), name);
if (prop == nul... |
4b652ac1-ec22-49d6-beeb-1f00d68959a7 | 0 | @Before
public void setUp() throws Exception
{
} |
34937123-9ea8-4dfc-b8eb-07fc4b644b47 | 0 | public UpperCaseField(int cols) {
super(cols);
} |
003de739-e67a-4655-a5ea-d8de2fd30673 | 5 | public static void main(String[] args)
{
// TODO code application logic here
String cadena1 = "";
String cadena2 = "";
cadena1 = (JOptionPane.showInputDialog("Ingrese Cadena 1:"));
cadena2 = (JOptionPane.showInputDialog("Ingrese Cadena 2:"));
int longitud1 = cadena1.l... |
1654c38a-5095-4ad3-979e-b6eb92d0f440 | 0 | public void setRap_num(int rap_num) {
this.rap_num = rap_num;
} |
58b19cbd-af1e-4c2e-970c-2e1e9c20012e | 6 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(args.length == 0) {
return false;
}
if(args[0].equalsIgnoreCase("create")) {
doCreateCommand(sender, cmd, label, args);
} else if(args[0].equalsIgnoreCase("list")) {
doListCommand(sender, cmd, label... |
8c821757-61e6-4b6d-b29c-169e3fc018a9 | 3 | public String getLyricsFromURL(String url) {
InputStream lyricsPageInputStream = this.getInputStream(url);
BufferedReader br = new BufferedReader(new InputStreamReader(lyricsPageInputStream));
StringBuilder sb = new StringBuilder();
String line = "";
try {
while((line = br.readLine()) != null) {
sb.app... |
b40ea121-1550-4236-8a28-639b3401bc96 | 0 | public final Result getUpdateStatus() {
return this.result;
} |
b6d9eab0-afdd-4443-9861-f72f063f57b7 | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
a4c23531-3f5b-4a44-b656-f053168b1a16 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String version = this.plugin.getDescription().getVersion();
if (title.split(" v").length == 2) {
final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ... |
fca8f14d-8e70-4a4d-8042-ae0ee98de8cd | 3 | @Override
public boolean abort() throws LoginException
{
if (debug)
{
LOG.debug("aborting authentication");
}
if (!succeeded)
{
return false;
}
if (!commitSucceeded)
{
resetData();
succeeded = false... |
83fe0874-28d9-4f15-a433-ed766cba09d0 | 6 | private void removeReservation(ServerReservation res) {
boolean inProg = res.getReservationStatus() == ReservationStatus.IN_PROGRESS;
// returns the time slot to the profile
profile.addTimeSlot(res.getStartTime(),
res.getExpectedFinishTime(), res.getPERangeList());
LinkedList<Sch... |
66b328a4-44be-4e3a-8009-3c6353fa9333 | 2 | public boolean isFriend(User user){
for (int i=0; i<friends.size();i++)
if (friends.get(i)==user) return true;
return false;
} |
60664069-04a2-46a2-a46d-34bbbda0eaa2 | 2 | private LinkInfo getCachedInfo(String videoID) {
for (LinkInfo li : cache)
if ( li.hasVideoID(videoID) )
return li;
return null;
} |
a37722ff-d322-417d-a545-4717cf55b7d2 | 2 | public boolean updatePosListaPrecioDisable(final PosListaPrecio itemOracle){
Session hbSessionOracle = getSession(); // SESSION ORACLE
Transaction tsOracle = hbSessionOracle.beginTransaction();
boolean successOracle = false;
try {
getHibernateTemplate().execute(new HibernateCallback() {
@O... |
ebc90255-bd24-4012-99e2-929bf424757a | 5 | static final void method3189(int i, String[] strings) {
if (i == 0) {
anInt9537++;
if (strings.length > 1) {
for (int i_4_ = 0; i_4_ < strings.length; i_4_++) {
if (strings[i_4_].startsWith("pause")) {
int i_5_ = 5;
try {
i_5_
= Integer.parseInt(strings[i_4_].substring(6));
} catc... |
c3b6aec9-1f05-4619-ae17-0fd6b64a2d58 | 5 | static public String trimNumber(String s) {
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
while (s.endsWith("0")) {
s = s.substring(0, s.length() - 1);
}
if (s.endsWith(".")) {
s = s.substring(0, s.length() - 1);
... |
054cedee-1422-4f0e-868f-b390dafb8090 | 1 | public void testToStandardHours() {
Days test = Days.days(2);
Hours expected = Hours.hours(2 * 24);
assertEquals(expected, test.toStandardHours());
try {
Days.MAX_VALUE.toStandardHours();
fail();
} catch (ArithmeticException ex) {
// e... |
6be0a037-0db8-4f2c-907c-1484cbb5ae45 | 4 | public char toLowCase(char c){
if(c>= '0' && c <='9')
return c;
else if(c>= 'A' && c<='Z'){
return (char) (c-'A'+'a');
}
return c;
} |
c66aa6a0-1040-4d73-8c9c-bffbee5cd8a3 | 4 | public void dprint(){
System.out.println("-------");
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
int v = 0;
if (grid.get(i).get(j) != null)
v = grid.get(i).get(j).getValue();
if (v != 0) {
System.out.print("|" + v + "|\t");
}else{
System.out.print("| |\t");
}
... |
453f5de9-0f3b-4a1f-9678-d54a738509f6 | 0 | public static void main(String[] args) {
Cups.cup1.f(99);
} |
e8d6f990-80a2-4e8d-ab3b-48cfe3dd7dba | 9 | protected void calcLaValue() {
// 拉格朗日插值的运算
double t = 0.0;
int i, j, k;
double result = 0.0;
double[] x = new double[Def.N];
double[] y = new double[Def.N];
try {
t = Double.parseDouble(laTTextField.getText());
} catch (NumberFormatException e) {
// t值输入格式错误
JOptionPane.showMessageDialog(null... |
7b56d605-659b-4845-9552-fa16cf0ba78a | 5 | private void center() {
float[] min = new float[] {Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE};
float[] max = new float[] {Float.MIN_VALUE, Float.MIN_VALUE, Float.MIN_VALUE};
for(Vertex v : vertices) {
for(int a = 0; a < 3; a++) {
min[a] = Math.min(min[a], v.data[a]);
max[a] = Math.max(max[a], v... |
6c88776a-acde-43cd-90c9-43dc5b864482 | 2 | public void buildrightomposite()
{
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.marginWidth = gridLayout.marginHeight = 0;
rightComposite.setLayout(gridLayout);
Composite titleComposite = new Composite(rightComposite, SWT.NONE);
GridData gd = new GridData(GridData.FILL_BO... |
2f6a5ec9-8f3a-4d73-a0ee-e0677d8edb41 | 7 | public String readCEWWBracket(Title title, Reader reader, String type) throws IOException {
int val = 0;
StringBuilder builder = new StringBuilder();
while ((val = reader.read()) > -1) {
switch (val) {
case ')':
String data = builder.toString().tr... |
8b330ec9-1d5e-43a4-8a0f-ac67189adc84 | 9 | public static final String removeMnemonics(final String text) {
int index = text.indexOf('&');
if (index == -1) {
return text;
}
int len = text.length();
StringBuffer sb = new StringBuffer(len);
int lastIndex = 0;
while (index != -1) {
// ignore & at the end
if (index == len - 1) {
break;
... |
dc8df08c-2d01-42ba-80d6-8954b3ee4b9d | 0 | protected GameElement(Rectangle masse, IntHolder unit) {
super(masse);
this.unit = unit;
} |
7a6b1035-0358-497b-9a55-24427f3224c5 | 0 | public static ResultSet _find(String tableName, String field, String value) throws SQLException {
PreparedStatement statement = connect.prepareStatement(" select * from `" + tableName + "` where `" + field + "` = ? " );
statement.setString(1, value);
ResultSet result = statement.executeQuery();
return result;
... |
4de8c497-bc00-4d80-9c6c-ea00838d6b6a | 8 | @Override
public ArrayList<Move> generateMovesForThisPiece(Chessboard chessboard) {
int toX = -1, toY = -1;
final ArrayList<Move> moves = new ArrayList<Move>();
final String positionPiece = chessboard.getPositionPiece(this);
final int getX = Helper.getXfromString(positionPiece);
final int getY = Helper.get... |
45fb0c8b-64eb-4184-926a-5942103b4cc3 | 1 | public static final boolean badPosition(int pos) {
if (pos == -1) {
new ErrorLog("Falsche Position\n\n" + Control.current.lastResponse);
return true;
}
return false;
} |
20e51023-cb15-42e3-b9fe-343c8c991d8c | 7 | @Override
public void run() {
MongoClient mongoClient = null;
// First verify there is stuff to work with - this is hiding the bug
// that this thread should not start unless the data is good to go
if ((myDb == null) || (myCollection == null) || (myFilter == null)) {
return;
}
try {
// TODO - more ... |
9ed8cf12-ff63-4c74-a2a9-8053a24437a3 | 1 | private void checkExistsPseudo(String psd) throws Exception {
UserModel user = DataStore.getUserByPseudo(psd);
if(user !=null) {
throw new Exception( "Ce pseudo n'est pas disponible." );
}
} |
63c6d4f3-41fa-48b2-b786-9c723a9812a5 | 7 | public static void outPutBlockToTrack(Track[] t){
try{
jxl.Workbook readWorkBook = jxl.Workbook.getWorkbook(new File("Output_File.xls")); //唯讀的Excel工作薄物件
jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("Output_File.xls"), readWorkBook); //寫入
jxl.write.WritableSheet writeSheet ... |
9be3471e-3d1a-4d99-9449-b77095fa4613 | 1 | public XMLReaderStAX getStAXReader() {
if (staxReader == null) {
staxReader = new XMLReaderStAX();
}
return staxReader;
} |
894fb362-8501-4cfd-bea9-61d0fd2814b5 | 1 | public static void main (String [ ] args) {
int x = 1;
int y = 1;
while (x < 5) {
y = x - y;
System.out.print (x + "" + y + " ");
x = x + 1;
}
System.out.println ( );
} |
8773c07b-a338-4ba2-97ad-a0b51111f72f | 4 | private static boolean filtersAcceptComponent(EntityRef clientEntity, EntityRef entity, Class<? extends Component> componentClass, Iterable<? extends EntityComponentFieldFilter> componentFieldFilters) {
for (EntityComponentFieldFilter componentFieldFilter : componentFieldFilters) {
if (componentFiel... |
f8712296-1b72-4264-a64b-57360f643064 | 1 | public void setImageIcon(String name, ImageIcon icon) {
Component comp = fetchComponent(null, name);
if (comp instanceof JLabel) {
JLabel label = (JLabel) comp;
label.setIcon(icon);
}
} |
1f55a94d-d958-4cab-aea0-84059ca8e5be | 5 | public void processInput(String input) {
String[] words = input.split(" ");
if(words[0].equalsIgnoreCase("clear")) {
td.clear();
}
else if(words[0].equalsIgnoreCase("disablecomp")) {
Application.get().getLogic().disableComponent(words[1]);
}
else i... |
805f64c2-a8b6-411f-b211-20c282481364 | 1 | @Override
public void sortedStructure() {
for (int i = 0; i < data.kitSize(); i++){
Arrays.sort((String[]) data.getFromKit(i));
}
data.setState("Sorted");
} |
154ed949-9dde-4055-88d3-fef258f53ac9 | 3 | public Leaderboard(FileConfigurationWrapper fcw_, String name_, String header_, String countSuffix_)
{
name = name_;
header = header_;
fcw = fcw_;
countSuffix = countSuffix_;
playerNameList = getNames();
playerCountList = getCounts();
//If the topkillers board hasn't been made yet, then....
if (p... |
a5547ef3-9eb8-473a-b403-c72fcac02cfb | 3 | private void initializeLogger() {
this.log = Logger.getLogger(this.getClass().getName());
try {
FileHandler fh = new FileHandler(this.getClass().getName()
.replace("class ", "")
+ ".log");
fh.setFormatter(new SimpleFormatter());
this.log.addHandler(fh);
} catch (SecurityException e1) {
// TO... |
da722c16-75ab-4fa8-af4b-f28c9241314e | 5 | @Override
public void delete(Element element, String outerBlockNames)
throws RemoteException {
if((null == element.toString()) || ("" == element.toString())){
return;
}
// outerBlockNames is "" search all conf
if("".equals(outerBlockNames.trim())){
confText = ReadConf();
... |
01dd4a26-429d-4151-9978-da2da34c2eb0 | 6 | private boolean validOr(String filter, String value) {
filter = filter.trim();
filter = filter.substring(1, filter.length() - 1);// clear ( )
String[] temp = filter.split(OR);
int require = temp.length;
int op[] = new int[temp.length];
String filterValue[] = new String[temp.length];
int cnt = 0;
for (St... |
805e5743-fbc2-4806-8b8a-8edf12f6e521 | 0 | private ChokeMessage(ByteBuffer buffer) {
super(Type.CHOKE, buffer);
} |
8e6d8f42-d286-4ede-9eff-c2b430860657 | 5 | public void populate(int input, int hidden, int output)
{
//add neurons
for(int i=0;i<input; i++)
{
addInputNode();
}
for(int i=0;i<hidden; i++)
{
Neuron newron = addHiddenNode();
//add connections from previous layer
for(Neuron n : inputNeurons)
{
n.addConnect... |
a8c34326-f5aa-4bb5-94e3-f1c9f4f96e11 | 2 | @Override
public int compareTo(Object card2) throws ClassCastException{
if (!(card2 instanceof Card))
throw new ClassCastException("A Card object expected.");
if(this.cmc == ((Card) card2).getCmc())
return this.cardName.compareTo(((Card) card2).getCardName());
return ((Card) card2).getCmc() - th... |
a35e7484-d30d-40f4-81a7-c46b8686d4e2 | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
int t = Integer.parseInt(in.readLine().trim());
for (int i = 0; i < t; i++) {
int n = Integer.parseInt(in.readLine().trim());
Item[... |
242cbbd1-fb24-4388-a847-4449088638ed | 6 | public boolean nextP() {
{ QuerySolutionTableIterator self = this;
{ QuerySolutionTable table = self.theTable;
QuerySolution cursor = self.cursor;
QuerySolution previous = cursor;
if (self.firstIterationP) {
previous = null;
cursor = table.first;
self.fi... |
057bbe62-f79d-429f-951d-db003e95ced3 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
fd16ec90-49e4-4e7c-b83c-f71a5fb293f1 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SKI", scope = X509DataType.class)
public JAXBElement<byte[]> createX509DataTypeX509SKI(byte[] value) {
return new JAXBElement<byte[]>(_X509DataTypeX509SKI_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
} |
b4f06269-aa26-4cc5-b581-8361ba856b6e | 1 | @Override
public void save(IArticle article) throws ArticleWriteException {
try {
em.getTransaction().begin();
persistResources(article);
em.persist(article);
em.getTransaction().commit();
} catch (IOException e) {
throw new ArticleWriteExc... |
5ab0145c-f021-4dd2-bf35-7bc269e9b26f | 1 | private void login(String userName, char[] password){
//load login information
logAc = logAc.load(logAc);
if ((mode = Doctor.checkLogin(db,logAc,userName,password))!=0){
//when password match, saved mode : 1:Doctor 2:admin
this.userName = userName;
doctorID = userName;
db = db.load(db);
menuPage... |
b78bdd81-cb08-43c7-ae10-ece3fe8e5942 | 5 | public Vector substitution(Matrix matrix, Vector b, SubstitutionDirection direction) throws ArithmeticException
{
Double term0 = 0d;
Double term1 = 0d;
Double term2 = 0d;
Vector y = new Vector();
if (direction == SubstitutionDirection.FORWARD)
{
y... |
b3f8b413-1506-48fd-a2c6-32b8a0c90ed1 | 7 | public Sprite(BufferedImage ss, BufferedImage ds, BufferedImage cs, BufferedImage ts)
{
for(int i = 0; i < uROWS; i++)
{
for(int j = 0; j < uCOLUMNS; j++)
{
unit[i][j] = ss.getSubimage(j * Game.TILESIZE, i * Game.TILESIZE, Game.TILESIZE, Game.TILESIZE);
... |
6207d189-01ba-4906-97db-e121cbab439d | 7 | public void reset() {
if(comboMaterial.getItemCount() > 0) {
comboMaterial.setSelectedIndex(0);
}
if(comboMachine.getItemCount() > 6) {
comboMachine.setSelectedIndex(6);
}else {
if (comboMachine.getItemCount() > 0) {
comboMachine.setSe... |
6e2cc979-b242-4f41-a972-d2042c6a0b9c | 4 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//TilastointiService service = new TilastointiService();
ArrayList<Integer> vuodet;
String vuosistr = "";
if(request.getSession().getAttribute("vuosi") != null) {
vuosistr = (Str... |
c7b77553-be41-4d0e-bb4c-ac439f226b10 | 8 | @Override
public boolean exists() {
try {
URL url = getURL();
if (ResourceUtils.isFileURL(url)) {
// Proceed with file system resolution...
return getFile().exists();
}
else {
// Try a URL connection content-length header...
URLConnection con = url.openConnection();
ResourceUtils.useC... |
3955cc84-80f5-4015-92d9-6008fd77ec51 | 8 | @Override
public String getSVG( HashMap<String, Double> chartMetrics, HashMap<String, Object> axisMetrics, ChartSeries s )
{
double x = chartMetrics.get( "x" );
double y = chartMetrics.get( "y" );
double w = chartMetrics.get( "w" );
double h = chartMetrics.get( "h" );
double max = chartMetrics.get( "max" );... |
a2b4f35b-318a-4885-8208-86bd24d8f114 | 5 | @Override
public void saveOrder(List<FoodCombo> orderList) throws RuntimeException {
try {
List colDescriptors = new ArrayList();
List colValues = new ArrayList();
db.openConnection(FoodOrderDAO.DRIVER, FoodOrderDAO.URL,
FoodOrderDAO.USER, FoodOrderDAO... |
6f91e4ee-9e25-43ae-a289-3aa74b7cd74a | 5 | public static void checkForMIFUUpdate(){
//Check latest version available
String latest = null;
Download.downloadfile(CONSTS.FILEZ+"/mifuv.txt", CONSTS.MIFUDIRS, "/version.txt");
try {
File file = new File(CONSTS.MIFUDIR+"/version.txt");
FileReader fileReader = new FileReader(file);
StringBuffer string... |
865aeaca-3d92-449f-9f97-4cd83ef8199e | 9 | public boolean iterate(Board board) {
if(board.getRemainingBlocks().isEmpty()) {
return checkWinStatus(board);
}
Direction direction;
for(Block b : board.getRemainingBlocks()) {
for(int i = 0; i < 4; i++) {
Board copy = board.copy();
... |
2ca5d144-1d76-495b-bf0e-e22cf0b9aab7 | 8 | public List<Integer> findSubstring(String S, String[] L) {
Map<String, Integer> numOfSubstrings = new LinkedHashMap<>();
for (int i = 0; i < L.length; i++) {
if (numOfSubstrings.containsKey(L[i])) {
numOfSubstrings.put(L[i], numOfSubstrings.get(L[i]) + 1);
} else {
numOfSubstrings.put(L[i], 1);
}
... |
5c941bec-bf09-4e75-ac19-2547df408155 | 1 | @Override
public void run() {
arr_data = Ticket.showAll();
data = new Object[arr_data.size()][];
for (int i = 0; i < arr_data.size(); i++) {
data[i] = arr_data.get(i).Array();
}
this.fireTableDataChanged();
} |
ef4920ca-92f0-49e5-bfbe-0d4ff99e5790 | 0 | public Employee(String n, double s)
{
name = n;
salary = s;
} |
5738ef65-3392-4b9d-9925-0ad02fe4146d | 0 | public void reset() {
state = STATE_RELEASED;
amount = 0;
} |
fb968695-c944-4d8c-a146-c73f82e48850 | 0 | private void setReadyButtonClick() {
_view.active.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Map<String, Object> m = new HashMap<String, Object>();
m.put("action", "ready");
_model.sendMessage(m);
_view.active.setEnabled(false);
_view.... |
6a03d7e2-99fc-449c-91f1-6e4f960623df | 0 | @Override
public void stop() throws Exception {
super.stop();
ConnectionPool.close();
} |
33695018-8972-42f7-8921-fbd7f2958bd7 | 5 | public static int findPeakElement(int[] num) {
if (null == num || 0 == num.length) return -1;
int len = num.length;
int low = 0, high = len - 1;
int mid = 0;
if (1 == len) return 0;
while (low < high) {
mid = (low + high) >> 1;
if (num[mid] < num[mid +... |
d261e9aa-4896-4062-8001-cfed1a776469 | 3 | public static List<TestInstanceInfo> getTestInstances(HierarchicalConfiguration testsetData)
{
List<TestInstanceInfo> testInstances = null;
List<HierarchicalConfiguration> testInstancesData = testsetData.configurationsAt(TESTINSTANCE_TAG);
if (testInstancesData != null && !testInstancesData.isEmpty... |
95f10633-e696-489c-b9fc-5f8920ef9ab4 | 1 | @Override
public void putAll(CSProperties p) {
super.putAll(p);
for (String s : p.keySet()) {
Map<String, String> m = p.getInfo(s);
setInfo(s, m);
}
getInfo().putAll(p.getInfo());
} |
c0c31c95-ec3b-461a-9135-fa9224e0cbba | 2 | private EnemyView getEnemyView(Enemy e) {
for (EnemyView ev : enemies) {
if (ev.getEnemy().equals(e)) {
return ev;
}
}
//if it's not already in the list create a new and add it
EnemyView ev = new EnemyView(e);
enemies.add(ev);
return ev;
} |
3df84dcb-5505-4a73-be8a-37aa6b97b84e | 8 | public Vector2 getNextObj(Vector2 start, int direction){
MenuObj m = getObj(start);
float x = projections.get(m).x;
float y = projections.get(m).y;
Vector2 next = start.cpy();
switch (direction){
case 1: // UP
y = y > 0 ? y - 1 : vertical.size - 1;
next = vertical.get((int) y).getMenuMapping();
... |
b867666d-6f44-4e9f-8e6c-fd959ff37b57 | 9 | @Override
public void paintComponent(Graphics graphics) {
int xOrigin = (int) (xOffset - ((getCanvasWidth() * getScale()) / 2D));
int yOrigin = (int) (yOffset - ((getCanvasHeight() * getScale()) / 2D));
for (int x = 0; x < getCanvasWidth(); x += 8) {
for (int y = 0; y < getCanvas... |
3db2ae22-8fec-4496-aba8-d51404ed3dd2 | 5 | public static void main(String[] args)
{
long startTime = System.currentTimeMillis();
int limit = 10000000;
boolean[] isNotPrime = new boolean[limit+1];
for (int i=2;i... |
a2bd61ed-c81a-42b6-aa35-46203294f723 | 4 | private void SelectJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SelectJButtonMouseClicked
//if merchant was not selected then pop warning
int[] rowsSelected = merchantJTable.getSelectedRows();
if(rowsSelected.length > 0 && rowsSelected.length < 2){
//store th... |
45d87b36-abeb-48f1-9c87-7643b99a52da | 8 | @Override
public void run() {
try {
while(!Thread.interrupted() ) {
try {
setupSocket(hostname, portNumber);
} catch (IOException e1) {
Thread.sleep(rand.nextInt(1000));
continue;
}
int numAttempts = rand.nextInt(10);
for (int i =0; i< numAttempts; i++) {
... |
798af045-9560-4529-a1c8-a27ae92a6d46 | 2 | public void addNgrambyup(Connection conn,Ngram ngram) throws Exception{
String wordAfterHandle = "";
for(int i=0;i<ngram.getWordGroup().length();i++)
{
char c = ngram.getWordGroup().charAt(i);
if(c == '\'')
{
wordAfterHandle += "\\\'";
}
else
{
wordAfterHandle += c;
}
}
String sql... |
66d32def-f91e-426d-a8f7-9253c383ee16 | 5 | private void comen1(char []codigo){
int let = 0;
//Para eliminar el comentario sencillo
while(let<codigo.length-1){
if(codigo[let]=='/' && codigo[let+1]=='/'){
codigo[let] = ' ';
codigo[let+1] = ' ';
let++;
... |
04562a59-0854-430e-9eaa-f5780284bfc4 | 8 | public void endGame(){
String stillWalking = (s.whoseTurn() == "red")?"blue" : "red";
MyList blankPos = s.ownees(null);
s.fill(blankPos,stillWalking,board);
int redScore =s.getnRed() + ((stillWalking == "red")?s.getnEmpty():0);
int blueScore = s.getnBlue() + ((stillWalking == "blue")?s.getnEmpty():0);
boar... |
f3463da3-c18b-4f83-b235-eb7e85dfff33 | 3 | public void onDisable(){
log.info("Saving open slots...");
for(Player p : getServer().getOnlinePlayers()){
if(bm.getSlot(p.getName()) != null){
try {
loader.saveSlot(bm.getCurrentSlotContents(p.getName()), p.getName(), bm.getSlot(p.getName()));
} catch (Exception e) {
log.severe("ERROR: Failed ... |
4657057b-8e64-4f63-b834-d5ce52ed81e4 | 2 | public void persistRuleSet(RuleSet ruleSet) {
String sqlStatement;
dao.connect();
sqlStatement = generateInsertStmt(ruleSet);
if(dao.getErrorLogs().getErrorMsgs().size() == 0){
dao.executeUpdate(sqlStatement);
}
if(dao.getErrorLogs().getErrorMsgs().size() == 0){
dao.disconnect();
}
} |
0449ad5a-48f4-4be8-9000-5a773d4201e7 | 3 | public OceanLifeGui (String test, Ocean ocean) {
super(test);
width = ocean.getWidth();
depth = ocean.getDepth();
setLayout(null);
setResizable(false);
setLocation((((int)dim.getWidth() - width) / 2),(((int)dim.getHeight()- depth) / 2));
PaintArea oceanArea = new PaintArea(ocean);
ocean... |
eac8e413-69c4-47ba-9e94-fcd4bd345369 | 1 | public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
buf.setLength(0);
buf.append(tab).append('@');
appendDescriptor(FIELD_DESCRIPTOR, desc);
buf.append('(');
text.add(buf.toString());
TraceAnnotationVisitor tav = createTraceAnnotationVisitor();
text.add(tav.getText());
... |
cc01fa45-a95c-4553-8129-7a7e7114458a | 8 | public Element build(ServerPlayer serverPlayer) {
List<Change> c = new ArrayList<Change>(changes);
List<Element> elements = new ArrayList<Element>();
List<Change> diverted = new ArrayList<Change>();
Document doc = DOMMessage.createNewDocument();
// For all sorted changes, if it ... |
ae7d562c-4cb2-4296-8e3d-9fb599a752c4 | 6 | public void removeChar(String delStr) {
int i;
CharList tmpNode;
CharList prevNode;
firstNode = this;
for (i = 0; i < delStr.length(); i++) {
tmpNode = firstNode;
prevNode = firstNode;
while (tmpNode != null && tmpNode.ch == delStr.charAt(i)) {
prevNode = tmpNode;
tmpNode = tmpNode.next;
... |
72086e9f-427c-4343-bea6-cf23966b2d4f | 2 | @Override
public ClienteBean set(ClienteBean oClienteBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.initTrans();
if (oClienteBean.getId() == 0) {
oClienteBean.setId(oMysql.insertOne("cliente"));
}
oMysql.up... |
8092a5cc-616c-44ba-b16a-4766be95ba12 | 5 | @Override
public void layout () {
float regionWidth, regionHeight;
if (drawable != null) {
regionWidth = drawable.getMinWidth();
regionHeight = drawable.getMinHeight();
} else
return;
float width = getWidth();
float height = getHeight();
Vector2 size = scaling.apply(regionWidth, regionHeight, wi... |
25d179b3-6ee8-4b9c-b628-d07b112106e7 | 0 | public static HandlerList getHandlerList() {
return handlers;
} |
56a0c784-ad4a-4d6c-a1bd-bbd03b1e2418 | 9 | public static Class convertPrimitiveClass(final Class obj) {
if (!obj.isPrimitive()) {
return obj;
}
if (obj == Boolean.TYPE) {
return Boolean.class;
}
if (obj == Byte.TYPE) {
return Byte.class;
}
if (obj == Character.TYPE) {
... |
1291115b-8494-4444-adcf-4e65a7685dca | 4 | public List<Article> getItems() {
System.out.println(baseUrl);
List<Article> articles=new ArrayList<Article>();
try {
URL feedUrl = new URL(baseUrl);
/* SyndFeedInput: parser to process RSS feeds into SyndFeed instance*/
SyndFeedInput inpu... |
f5f8de17-40ea-4789-b002-6336f9f76813 | 7 | public static void startupMemoize() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (S... |
0cea5ca6-38e9-4338-8d8c-6a88dd764802 | 7 | @Override
public void write(ICTMC ctcm, String pathname) throws Exception {
BufferedWriter outputStrm = new BufferedWriter(new FileWriter(pathname));
Matrix tmpM;
List<Matrix> tmpTra;
int i = -1;
int max = -1;
int j = -1;
int maxT = -1;
try {
tmpM = ctcm.getQ();
max = tmpM.getRowDimension();
... |
49d78aea-234a-4f46-b5a0-c4185fedbf27 | 9 | String indentMaker(String setting, double spaces) {
String list = "";
if (setting.equals("total")) {
int x = endInd;
if (paragraphOn && !_endnoteMode) {
x = parIndent + indent;
} else if (paragraphOn && _endnoteMode) {
x = endParInd + e... |
57024d39-340d-4fc0-8300-802a21c901b8 | 5 | @Override
public void update()
{
try
{
if(currentAchievement == null)
{
currentAchievement = queue.removeFirst();
lastTime = System.currentTimeMillis();
x = BlockyMain.width/2-100;
y=-80;
}
... |
d99c0ac7-b06e-482d-bdaf-80a86952e002 | 5 | public void setCipherKey(String cipherKey) {
if (cipherKey == null || cipherKey.length() == 0) throw new IllegalArgumentException();
for (int i = 0; i < cipherKey.length(); i++) {
if(cipherKey.charAt(i)<97 || cipherKey.charAt(i)>122)
throw new IllegalArgumentException();
}
this.cipherKey = cipherKey.toLowerC... |
f6dcfab2-52f7-4926-ab30-6d03ec7e6d40 | 1 | public void testSubstituteDestructive() {
System.out.println("\n*** testSubstituteDestructive ***");
try {
CycFormulaSentence sentence = getCyc().makeCycSentence("(#$likesAsFriend ?X ?Y)");
sentence =
sentence.substituteNonDestructive(CycObjectFactory.makeCycVariable("X"), CycObjectFac... |
c8cdec8d-8e6f-40e6-bcf5-ddbaf8ea2bd8 | 7 | private int[] genericActionListener() {
int laCases = -1;
int nycCases = -1;
int chicagoCases = -1;
int atlantaCases = -1;
int denverCases = -1;
int dallasCases = -1;
int miamiCases = -1;
//la
try {
laCases = Integer.parseInt(this.losAngelesTF.getText());
} catch (NumberFormatException nfe) {
... |
59115bab-b79e-4e94-adff-743fd2132dd6 | 1 | public static void hypothesizeUseless(GrammarEnvironment env, Grammar g) {
UselessProductionRemover remover = new UselessProductionRemover();
/*
* Grammar g2 = remover.getUselessProductionlessGrammar(g); if
* (g2.getProductions().length < g.getProductions().length) {
* UselessPane up = new UselessPane(env,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.