method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cc9110c5-ce96-4d96-8555-97c3525b5389 | 7 | private static String jovoKijelentoAlanyi(Szo szo, SzamSzemely szamSzemely) {
String szoto = szo.getSzo();
if (szoto.endsWith("ni")) {
szoto = szoto.substring(0, szoto.length() - 2);
}
switch (szamSzemely) {
case EGYES_SZAM_ELSO_SZEMELY:
return s... |
188cd3d6-f761-4c6a-9fea-ded6a73bf42a | 4 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int intLevel = 9;
boolean isNoWrap = Boolean.parseBoolean(request.getParameter("nowrap"));
boolean isCompress = Boolean.parseBoolean(request.getParameter("compress"));
boolean isDeflateHeader... |
9eb5b7cc-7075-4e8a-b35f-7c57d7217c32 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
// when this spell is on a MOBs Affected list,
// it should consistantly prevent the mob
// from trying to do ANYTHING except... |
4454e97f-4477-40da-adba-428bfa4322b5 | 4 | public Node getNode(int x, int y) {
if (x < 0 || x > size-1 || y < 0 || y > size-1) {
return null;
}
return matrix.get(x).get(y);
} |
2a64a8da-90b0-4f36-b37b-a37c3c93fd6c | 7 | public void set(int key,int value){
Node n ;
if(!map.containsKey(key)){
n = new Node(key,value,null,null);
if(list.size != list.count){
n.next = list.first;
if(list.count != 0){
list.first.pre = n;
}else{
... |
a557091f-c287-45a9-80f8-8c6061413602 | 2 | public List<User> getAllUsers () throws SQLException
{
List<User> allUsers = new ArrayList<User>();
User user;
String uName = null;
String uIp = null;
int uStatusInt = 0;
String getAllUsers = "SELECT * FROM " + tableName ;
ResultSet rs = this.database.statement.executeQuery(getAllUsers);
while (rs.n... |
8d83d5df-a857-4f04-8bd6-184b1f4547c0 | 4 | private void checkCollision() {
if (r.intersects(Robot.rect) || r.intersects(Robot.rect2) || r.intersects(Robot.rect3) || r.intersects(Robot.rect4)){
System.out.println("collision");
}
} |
ea841fae-4044-4306-83db-166c71c51f8a | 7 | private boolean isEqual(Object instance){
if (instance instanceof DateTime){
DateTime dateTime = (DateTime)instance;
if ((dateTime.getYear() == this.getYear())
&& (dateTime.getMonth() == (this.getMonth())
&& (dateTime.getDay() == this.getDay()))
&& (dateTime.getHour() == this.... |
1a355930-0447-4ffc-8be7-7aed320f90ab | 9 | public void warn(Event event) {
switch(event.getTypeEvent())
{
case ROBOT_DETECTED :
if(state > -1) {
saveState = state;
state = -1;
}
else
ignore();
break;
case WHITE_DETECTED :
case COLOR_DETECTED :
state = 1;
break;
case NOISE_DETECTED :
state = 2;
break;
case BUMP :... |
6797cd15-5cbf-4720-b011-c72df9618c63 | 8 | public static String[] getCommand(String userCommand){
assert userCommand != null;
dataPacket = new String[DATAPACKET_SIZE];
String firstWord = getFirstWord(userCommand);
String commandInfo = removeFirstWord(userCommand);
String commandType = TypeParser.getCommandType(firstWord);
switch(commandType) {
c... |
310dfe6d-8d47-47ca-8373-f008af79f4e2 | 5 | public ArrayList<Employee> checkEmployee(Date date)
{
availableEmployees.clear();
int count = 0;
String res = createDate(date);
for (int i = 0; i < employeesList.size(); i++)
{
count = 0;
for (int j = 0; j < employeesList.get(i).getDates().size(); j++)... |
926e834b-d10c-4523-8258-7a78be3c3460 | 2 | @Override
public int compare(Player a, Player b) {
return a.hand.highCard.value < b.hand.highCard.value ?
-1 : a.hand.highCard.value == b.hand.highCard.value ? 0 : 1;
} |
3bcda382-ba8c-4cc9-9195-8806c524d61f | 7 | public void updateAsScheduled(int numUpdates) {
if (numUpdates % 10 == 0 && structure.intact()) {
HoldingExtra.updateExtras(this, extras, numUpdates) ;
}
super.updateAsScheduled(numUpdates) ;
if (! structure.intact()) return ;
consumeMaterials() ;
updateDemands(upgradeLevel + 1) ;
... |
6e2728bb-930f-4d22-9a0d-087900990c4b | 5 | public Property<?> getFirstProperty(String name){
if(name == null){
return null;
}
for(Property<?> property : properties){
if(name.equals(property.getName())){
return property;
}
}
return null;
} |
b9526dfd-71b9-4129-bfc6-02a5b5b4b444 | 8 | public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
JSONArray ja = new JSONArray();
for (; ;) {
String value = getValue(x);
if (value == null) {
return null;
}
ja.put(value);
for (; ;) {
... |
509765a9-5e62-47f7-a91d-a6bc81a8b3f9 | 7 | public void doSaveAs() throws IOException
{
_fileChooser = new JFileChooser();
ExtensionFileFilter filterPNG = new ExtensionFileFilter("PNG Image Files",
".png");
ExtensionFileFilter filterJPG = new ExtensionFileFilter("JPG Image Files",
".jpg");
_file... |
2c57be67-0d6b-4696-81a7-e6fcbcbbb694 | 8 | public int longestValidParentheses(String s) {
if (s == null || s.length() < 2)
return 0;
int[] A = new int[s.length() + 1];
A[0] = 0;
A[1] = 0;
int max = 0;
for (int i = 2; i <= s.length(); i++) {
if (s.charAt(i - 1) == '(')
A[i] = 0;
else {
if (s.charAt(i - 2) == '(') {
A[i] = A[i - ... |
e277da3e-448d-4af7-81a6-d9b7e2e7f3db | 7 | public void mettreAJour(Carte carte) {
for (int caseCouranteX = 0; caseCouranteX < Carte.TAILLE_X_CARTE; caseCouranteX++)
for (int caseCouranteY = 0; caseCouranteY < Carte.TAILLE_Y_CARTE; caseCouranteY++) {
Position positionCourante = new Position(caseCouranteX,
caseCouranteY);
// Afficher les positi... |
1fcddf3d-e13a-45b4-96ba-c192606b543c | 1 | public void setupResidence() {
if (manager.isPluginEnabled("Residence")) {
plugin.getLogger().info("Successfully hooked into Residence");
}
} |
40a1211f-71b2-44b2-8fa1-215b466c9768 | 7 | static final String method2347(byte i) {
if (i != -119)
return null;
anInt6343++;
if (Class5_Sub1.aBoolean8335
|| BitmapTable.aClass348_Sub42_Sub12_3963 == null)
return "";
if (((((Class348_Sub42_Sub12) BitmapTable.aClass348_Sub42_Sub12_3963)
.aString9601) == null
|| (((Class348_Sub42_Su... |
aaf8d13c-8cfa-4e62-b0bb-ff70fc7aba63 | 2 | public MuokkaaElokuvaJDialog(ElokuvarekisteriUI parent, boolean modal, int id) {
super(parent, modal);
muokattavaId = id-1;
initComponents();
Elokuva elokuva = this.elokuvamalli.getElokuvaAt(id);
nimiTxtField.setText(elokuva.getNimi());
ohjaajaTxtField.s... |
2f205456-f8ff-46da-b09e-d3861d548836 | 3 | public boolean containsSymbol(String identifier, boolean checkParentScopes)
{
return definedSymbols.containsKey(identifier)
|| (checkParentScopes && parent != null && parent.containsSymbol(identifier, true));
} |
58a68eaf-53fa-4e4d-8872-01014ba1988f | 3 | public static void main(String [] args) throws SQLException, ClassNotFoundException
{
String JDBCDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String connecterString = "jdbc:odbc:test";
Connection con = null;
Statement stmt = null;
ResultSet res = null;
Class.forName(JDBCDriver);
con = DriverManager.getConnec... |
fda42b36-e9f2-449e-b6ea-c56d83dfd31d | 6 | @Override
public void write() {
ArrayList<String> players = new ArrayList<String>(props.stringPropertyNames());
players.remove("join-string-format");
players.remove("log-every-player");
Collections.sort(players, new Comparator<String>(){
public int compare(String s1, String s2) {
return s1.toLowerCase()... |
25bebccf-e2f6-4a03-aa4b-c39eadcaead8 | 9 | private void afficherNoeud(final Node node) {
final String name = node.getNodeName();
//Le noeud est egal a question
if (name.equals("question")
|| name.equals("answer")
|| name.equals("questiontext")) {
final Node suivant = node.getFirstChild();
Node fils = null;
if (suivant != null) {
fils... |
44b59e4c-5fb6-4ceb-a734-c35257d1cd1a | 1 | @Override
public void init() throws ServletException {
super.init();
gameTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
try {
tick();
} catch (RuntimeException e) {
log.error("C... |
e7e3d93e-acd2-40f5-b60b-98033898a8f6 | 2 | public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out"... |
54388dfc-11ac-404d-b3df-224eeb32a8ea | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, ContentDocument__typeInfo... |
29471869-ad07-4225-9001-4d7e67a75b80 | 2 | public void openEffect(String string) {
// TODO Auto-generated method stub
if(GameLoopState.isPlaySound){
this.filename= string;
new Thread(this).start();
auIndex++;
if(auIndex==auline.length)auIndex=0;
}
} |
30ffae44-2f6b-4cd7-8e1c-b0fd6d6165a4 | 8 | @SuppressWarnings("deprecation")
private void setFluid(World world, int x, int y, int z, boolean lava, boolean neighbourStone)
{
int fluid = lava?Material.LAVA.getId():Material.WATER.getId();
if(setAirIfAllowed(world, x, y, z, false))
{
setBlock(world, x, y, z, fluid);
if(neighbourStone)
{
if(getBl... |
46fc3309-9e7f-4d1d-9f9e-2ab9c78864f7 | 4 | public void update(Observable obs, Object arg) {
if (obs instanceof PlayerParty) {
Party player = (PlayerParty)obs;
Coordinate coord = player.getLocation();
if(EnemyLocator.encounter(coord)) {
Party enemy = EnemyLocator.getEncounter();
System.out.println("There's a fight!");
Fight fight = new Fig... |
a4295ca4-789b-4b9c-8b03-72d23dd68221 | 2 | public static void main(String[] args) {
Hashtable<Integer, Integer> ht;
HashMap<Integer, Integer> hmHashMap;
// TODO Auto-generated method stub
//Collection<Integer> collection = new List<Integer>();
//Collection<Integer> collection = new Collection<Integer>();
//java.util.List<Integer> alist =new List<Int... |
8382d46f-ed45-46d1-9175-e97f2b477020 | 7 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
Element element = HtmlFactory.getElement(localName);
if (isWithinElement) {
isWithinElement = false;
BufferedWriter writer = null;
try {
writer = ne... |
c571fa58-c495-47c3-acde-757466868187 | 1 | public void printArray() {
for (int i : array) {
System.out.println(i + " ");
}
} |
a385b608-e39b-455f-980e-7a83193c5be3 | 9 | addToDatabase(String accName, String accUName, String accAddress,String accPw) throws DatabaseException
{
if(accName != null && !accName.isEmpty())
{
if (accUName != null && !accUName.isEmpty())
{
if (accAddress != null && !accAddress.isEmpty())
{
if (accPw != null && !accPw.isEm... |
ab7b3e39-cbb5-494f-a6a9-0bab71ed4e56 | 9 | public void updateNPC(Player plr, Stream str) {
synchronized(plr) {
updateBlock.currentOffset = 0;
str.createFrameVarSizeWord(65);
str.initBitAccess();
str.writeBits(8, plr.npcListSize);
int size = plr.npcListSize;
plr.npcListSize = 0;
for(int i = 0; i < size; i++) {
if(plr.RebuildNPC... |
1aa71d9d-49cd-436c-9e25-3e5ecf5502c3 | 2 | private static String makeIDNum(int whatGrade, boolean whatGender,
String whichStudent) {
// ///////////////GRADE/////////////////
String grade = String.valueOf(whatGrade - 9); // Convert int to String
// if(grade.length() < 2) { grade = "0" + grade; }
// /////////////GENDER//////////////////
String gende... |
bd8e8e9c-66b8-4a76-a16e-f9bd005c3a41 | 1 | public static void printInteger(Integer i, int depth)
{
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("Integer: " + i);
} |
97c99614-02e2-4883-a662-26a33a0f93a4 | 5 | public static int findLIS(int size) {
int[] dp = new int[size];
Arrays.fill(dp, 1);
int ans = 1;
for (int i = 0; i < dp.length; i++)
for (int j = 0; j < i; j++)
if (match(j, i) && dp[i] + 1 > dp[j])
dp[i] = Math.max(dp[i], dp[j] + 1);
for (int i = 0; i < dp.length; i++)
ans = Math.max(ans, d... |
e8928b7e-1554-48ad-9de8-f9057717115a | 7 | public static int findShortestDistance(String[] words, String word1,String word2){
int min = Integer.MAX_VALUE;
int lastWord1Position = -1;
int lastWord2Position = -1;
for(int i = 0; i < words.length; ++i){
if(words[i].equals(word1)){
if (lastWord2Position != -1) {
if((i - lastWord2Position) < min){... |
e936cb0a-99c6-4988-8c35-5f65f9a84983 | 7 | @Override
protected void writeAttributes(XMLStreamWriter out)
throws XMLStreamException {
super.writeAttributes(out);
if (upgradesFrom != null) {
out.writeAttribute("upgradesFrom", upgradesFrom.getId());
}
out.writeAttribute("workplaces", Integer.toString(workPla... |
3798813b-633f-4222-a357-74d174249eae | 1 | public void destroy()
{
ThreadsInformation threadInfo;
for(int i=0; i < Agent.getAgentListSize(); i++)
{
threadInfo = Agent.getThreadInformationList(i);
AgentNetworkController.SendMessage("disconnect#" + threadInfo.agentId + "," + threadInfo.agentType);
}
} |
1eb4cc11-8c3e-4620-94b0-f8f743fe3f38 | 3 | private void createFailureEvent(int id, int eventType, double startTime, double endTime, boolean flag) {
// with this option we could start the failure from anywhere in the trace file
if (startTime-TraceStartTime < 0)
return;
if (nodeEvent==null){
nodeEvent = new FailureEvent(id,eventType,start... |
3d5fcba7-1173-4c64-9428-60baf7dd5993 | 3 | private void getDataFromSectionTable () {
try {
connection = DriverManager.getConnection(Utils.DB_URL);
statement = connection.createStatement();
resultSet = statement.executeQuery("select Word.[motherlang_word] as motherlangword, Word.[foreignlang_word] as foreignlangword, \... |
28e496cf-ce92-45bd-93bb-1dc6137f7d4f | 2 | public static Jori getInstance() {
if (instance == null) {
try {
Image img = new Image("res/characters/jori.png");
Logger.log(img+"","jori image");
//TODO: Get jori to make frames
Image[] frames = {img};
instance = new Jori(frames);
} catch (Exception e) {
e.printStackTrace();... |
40166833-8f59-4553-9af5-e9b52b342ea3 | 6 | public static ArrayList<ArrayList<ArrayList<String>>> getProfData(String prof, Professions plugin) {
Boolean v = true;
Integer i = 0;
Integer c;
ArrayList<ArrayList<ArrayList<String>>> j = new ArrayList<ArrayList<ArrayList<String>>>();
String action;
Str... |
2a07050a-18ef-48c1-99ab-fe4b0ca8f24d | 3 | private void getDataFromEvent(Sim_event ev)
{
IO_data io = (IO_data) ev.get_data();
// if the sender is not part of the overall network topology
// whereas this entity is, then need to return back the data,
// since it is not compatible.
if (link_ != null)
{
... |
7d3c663b-bab1-4d5b-b709-5a2b68a1a943 | 4 | public static void setOpaque(Window window, boolean opaque) {
String version = System.getProperty("java.runtime.version");
if (version.startsWith("1.7")) {
window.setBackground(new Color(0, 0, 0, 0));
} else {
try {
Class<?> awtUtilsClass = Class.forName(... |
defcff30-a8e6-4273-8e6f-90e582238eae | 8 | private String prepareConfigString(String configString) {
int lastLine = 0;
int headerLine = 0;
String[] lines = configString.split("\n");
StringBuilder config = new StringBuilder("");
for(String line : lines) {
if(line.startsWith(this.getPluginName() + "_COMM... |
a76a9487-5fa7-4e9f-8e04-1d00de1c37e6 | 9 | protected void move() {
for (Organism org : Ecosystem.getRed()) {
if (getDist(org) < 50) {
int x = posX - org.posX;
int y = posY - org.posY;
double d = Math.sqrt(x * x + y * y);
movX += 10 * (x / d);
movY += 10 * (y / d);
}
}
for (Organism org : Ecosyst... |
e3674719-466c-474a-b733-aef426180b7e | 4 | public static void copy(File from, File to) throws IOException {
FileInputStream fis = new FileInputStream(from);
FileOutputStream fos = new FileOutputStream(to);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = fis.read(buf)) != -1) {
... |
744e2127-a023-4d91-bacd-240476aeee46 | 7 | public Emprunt emprunter(Livre livre, Adherent adherent) throws Exception {
if (livre == null) {
throw new NullPointerException("Livre null !");
}
if (adherent == null) {
throw new NullPointerException("Adhérent null !");
}
if (!livre.isDisponibilite()) {
... |
3e5b367f-b9a6-4658-b95c-6168d7e04c16 | 7 | public void processMsg(boolean benchmark) {
switch (state_) {
case RFBSTATE_PROTOCOL_VERSION: processVersionMsg(); break;
case RFBSTATE_SECURITY_TYPES: processSecurityTypesMsg(); break;
case RFBSTATE_SECURITY: processSecurityMsg(); break;
case RFBSTATE_SECURITY_RESULT: proc... |
0852f4ea-a728-43ca-8e93-0fc167661da9 | 9 | private String generateIrrigationUrl(IrrigationRequest request) {
long valve1 = 0;
long valve2 = 0;
long valve3 = 0;
long valve4 = 0;
long valve5 = 0;
long valve6 = 0;
long valve7 = 0;
long valve8 = 0;
for (Zone z : request.getZones().keySet()) {
// EtherRain8 takes minutes by... |
ae3e5d85-1cfd-4dc1-b0a4-0c6fed866985 | 6 | private static double Gauss(Matrix x, Matrix mu, Matrix sig) {
// TODO 自動生成されたメソッド・スタブ
Matrix mu_x = x.minus(mu);
double det = sig.det();
double a = Math.sqrt(Math.pow(2 * Math.PI, x.getRowDimension()) * det);
double b = mu_x.transpose().times(sig.inverse()).times(mu_x).get(0, 0);
double pdf = Math.exp(-... |
f0e95007-c8ba-44c7-b3ed-33f10e3e8071 | 1 | public static Application getInstance() {
if (instance == null) {
instance = new Application();
}
return instance;
} |
2ba9fbad-9f62-486d-8c43-3fc3a261c69c | 4 | private BDD restrict(BDDFactory f, BDD rule, int[] trues, int[] falses) {
BDD restrictions = null;
for(int n: trues) {
if(restrictions == null) {
restrictions = f.ithVar(n);
} else {
restrictions = restrictions.and(f.ithVar(n));
}
}
for(int n: falses) {
if(restrictions == null) {
rest... |
f3f78621-eab5-4a69-92a7-4ecc6a81c981 | 3 | @Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
for (Callback callback : callbacks)
{
if (callback instanceof NameCallback)
{
NameCallback nameCallback = (NameCallback) callback;
nameCal... |
56754269-40e5-471d-811b-7603f481ed6a | 9 | public static GridReference valueOf(String s) {
if (s == null)
return null;
s = s.toUpperCase().trim();
int len = s.length();
if (len == 0)
return null;
while (len > 0 && Character.isDigit(s.charAt(len - 1)))
len--;
String column = s.su... |
113c0ce9-3299-4bb6-992b-84b2d9951e0d | 5 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreakEvent(BlockBreakEvent event)
{
if(plugin.posIsWithinColdBiome(event.getBlock().getX(), event.getBlock().getZ()))
{
// Check if broken block is a block which may be used as fuel for a fire *********... |
487c7dc3-5dbf-4b6d-93a6-d2960ecc850e | 9 | public List() {
setTitle("JList models");
model = new DefaultListModel();
model.addElement("Amelie");
model.addElement("Aguirre, der Zorn Gottes");
model.addElement("Fargo");
model.addElement("Exorcist");
model.addElement("Schindler list");
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout... |
4806cdf6-c853-4cf0-b8d8-fd6eae1cc8f9 | 9 | @Override
protected void sort() {
// initialize fields
mmfLengths = new int[project.size()];
mmfPrecursors = new int[project.size()][];
int initialCount[] = new int[project.getPeriods()];
int initialPeriods[] = new int[project.size()];
int initialNpv = 0;
int ... |
d17e1de6-d072-4310-a691-d2dc5edee57a | 9 | private static void splitWordsAndDefs(String[] str)
{
ArrayList<String> wordList = new ArrayList<String>();
ArrayList<String> defList = new ArrayList<String>();
for(String s : str)
{
String word = "";
String def = "";
char[] ch = s.toCharArray();
int section = 0;
for(int i = 0; i < ch.le... |
28aa8e53-197f-4d99-a410-def926f2e190 | 6 | public void updateBottom(){
if(bottom > 0){
for(int i=0; i<width+left-right; i++){
for(int j=originalHeight; j<originalHeight+bottom; j++){
drawDiamond(i, j);
}
}
}
else if (bottom < 0){
for(int i=0; i<width+... |
cb96b4fa-6551-4c3e-99ad-ff8553da4f1b | 9 | public static boolean wallAt(State s, ObjectInstance r, int x, int y){
int top = r.getDiscValForAttribute(ATTTOP);
int left = r.getDiscValForAttribute(ATTLEFT);
int bottom = r.getDiscValForAttribute(ATTBOTTOM);
int right = r.getDiscValForAttribute(ATTRIGHT);
//agent along wall of room check
if(((x == ... |
618aaf6b-6add-4ee6-9731-34dabcec0494 | 8 | public static void chooseLoad(Component c){
final JFileChooser fc = new JFileChooser();
FileFilter filter = new ExtensionFileFilter("Nightmare Level File (*.nml)", new String[] {"nml"});
fc.setFileFilter(filter);
int returnVal = fc.showOpenDialog(c);
if (returnVal == JFileChooser.APPROVE_OPTION){
String fP... |
a5bd9428-ba9f-48f6-b918-7b543b8726aa | 4 | private static String parseClasspath(String[] cp){
StringBuilder sb = new StringBuilder();
String sep = System.getProperty("file.separator");
for(int i = 0; i < cp.length; i++)
if(i == 0)
sb.append((cp[i].endsWith(".jar") ? cp[i].substring(cp[i].lastIndexOf(sep) + 1) : cp[i]));
else
sb.append(" :... |
fbfd0ad0-cd5a-4281-b75e-aaf89451c9f9 | 5 | public static int numDistinct(String S, String T) {
int m = T.length();
int n = S.length();
if (m > n) return 0; // impossible for subsequence
int[][] path = new int[m + 1][n + 1];
for (int k = 0; k <= n; k++)
path[0][k] = 1; // initialization
for (int ... |
6b26fa05-e849-4437-9842-5842a9c40cb6 | 1 | private int getYearOfBirth() {
view.printYearOfBirthInputRequest();
int yearOfBirth = ConsoleInputUtils.readIntValue();
List<ValidateException> validateExceptionList = new DOBValidator().validateYear(yearOfBirth);
if (!validateExceptionList.isEmpty()) {
view.printValidateEx... |
94f51924-666f-41f5-b680-4bd862735c2c | 6 | public static ArrayList Ticket_ComboBox(Integer ID) {
ArrayList number = new ArrayList();
Database db = dbconnect();
String query;
Object noEmployee = "";
boolean _int = false;
try {
switch (ID) {
case 1: query = ("SELECT CID ... |
215df247-5801-4d43-a1e7-44af40b67fde | 3 | @Override
public void mouseReleased(MouseEvent e)
{
if (!e.isConsumed() && start != null)
{
int dx = Math.abs(start.x - e.getX());
int dy = Math.abs(start.y - e.getY());
if (graphComponent.isSignificant(dx, dy))
{
e.consume();
}
}
start = null;
} |
4d67b410-9211-412c-9d19-a2bfe23ccf17 | 0 | private boolean fireReceiveExceptionEvent(ExceptionEvent evt) {
return true;
} |
52260b16-160d-4f58-a89e-757b005642e6 | 2 | public static void main(String args[]) {
int numHands = Integer.parseInt(args[0]);
int cardsPerHand = Integer.parseInt(args[1]);
List<Cards> deck = Cards.newDeck();
Collections.shuffle(deck);
for (Cards card : deck) {
System.out.println(card.rank() + " of " + card.su... |
ea7ffa32-fa4e-4a77-bb55-fa9abdecfb3e | 1 | public void print(final PrintStream out) {
out.println(" " + entry);
final Iterator e = paths().iterator();
while (e.hasNext()) {
final Block[] path = (Block[]) e.next();
out.println(" path: " + path[0] + " -> " + path[1]);
}
} |
ab70e0bd-342f-459a-8978-b9aa595ec44e | 2 | @Override
public double getScore(Object userAnswer) {
if (userAnswer == null)
return 0;
String ans = (String) userAnswer;
String trueAns = (String) answer;
if (ans.equals(trueAns))
return score;
return 0;
} |
d8d07ae8-18fc-4511-9584-edf147c53c24 | 1 | public void initializeGame() {
for (Player player : this.players) {
player.shuffle();
player.draw(7);
}
} |
6119d0fc-bda8-4c67-9719-ad8becacf5d5 | 5 | public void body() {
// wait for a little while for about 10 seconds.
// This to give a time for GridResource entities to register their
// services to GIS (GridInformationService) entity.
super.gridSimHold(10.0);
double previous = 0;
Iterator it = jobs.iterator(... |
26361e3e-6638-478a-a2ed-6703a3d6d015 | 3 | private void checkForFloating(){
Point position = this.getPosition();
Block[][] blocks = this.currentWorld.getBlocks(
position.x,
position.y+height*POSITION_MULTIPLYER,
position.x+width*POSITION_MULTIPLYER-1,
position.y+height*POSITION_MULTIPLYER
);
for(Block[] r : blocks){
for(Block b :... |
03e6190b-a120-44b0-82a2-1a77cde7e90c | 0 | public void pause() {
pause_egress();
pause_ingress();
} |
cbdb6355-f4a4-4795-b5af-e13abfc71a20 | 6 | static final String method2367(byte i,
Class348_Sub42_Sub12 class348_sub42_sub12) {
anInt3962++;
int i_41_ = 9 / ((79 - i) / 46);
if (((Class348_Sub42_Sub12) class348_sub42_sub12).aString9595 == null
|| ((Class348_Sub42_Sub12) class348_sub42_sub12).aString9595
.length() == 0) {
if ((((Class348_... |
f717d3ae-a29a-45c2-8d36-6faa62e1484c | 9 | public void update() {
if (walking) animSprite.update();
else animSprite.setFrame(0);
if (fireRate > 0) fireRate--;
int xa = 0, ya = 0;
if (anim < 7500) anim++;
else anim = 0;
if (input.up) {
ya--;
animSprite = up;
} else if (input.down) {
ya++;
animSprite = down;
}
if (input.left) {
... |
abbc1862-a7ac-4d6a-a02e-9b2d06823f77 | 3 | private static void printElement(Element e) throws ParsingException
{
if(e.isText())
{
System.out.println("------------------------------------TEXT----------------------------------------");
System.out.println(e.getText());
}
else
{
System.out.println("---------------------------------ELEMENT-------... |
9f55453a-3bb3-41e8-b73b-12ef1b2a1441 | 3 | private boolean recContains(T element, BSTNode<T> tree) {
if (tree == null)
return false; // element is not found
if (element.compareTo(tree.getInfo()) == 0)
return true; // element is found
if (element.compareTo(tree.getInfo()) < 0)
return recContains(element, tree.getLeft()); // Search ... |
5a5e4c45-3929-4430-8e64-dd6abad3feaf | 9 | public static String getMouseName(int mouseCode) {
switch (mouseCode) {
case MOUSE_MOVE_LEFT: return "Mouse Left";
case MOUSE_MOVE_RIGHT: return "Mouse Right";
case MOUSE_MOVE_UP: return "Mouse Up";
case MOUSE_MOVE_DOWN: return "Mouse Down";
case MOUSE... |
bc9a2263-1c7c-43c5-8007-00afc185b573 | 2 | public void saveToConfig(Configuration conf) {
clearTitles();
ConfigurationSection cfgs = conf.getConfigurationSection("titles");
cfgs = (cfgs != null) ? cfgs : new MemoryConfiguration();
for(Entry<String,String> title : titleMap.entrySet()) {
cfgs.set(title.getKey(), title.getValue());
}
} |
1af1fcc9-bfc8-44b5-b249-1e0cae77d286 | 1 | public void render(float delta) {
spriteBatch.begin();
spriteBatch.draw(this.name2texture.get("background"),0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
for(GameButton gameButton : buttons){
spriteBatch.draw(this.name2texture.get(gameButton.getName()),gameButton.getX(),gameButton.getY());
}
sprit... |
2ace9205-bcf5-4d5b-b02e-000ea3d89af0 | 4 | public void writeLine(String line) throws IOException {
String now = DATE_FORMAT.get().format(new Date());
if (line.indexOf('\n') >= 0 && line.indexOf('\n') < line.length() - 1) {
write((String.format("%s\t\t%s:\n", now, name)).getBytes());
for (String l : line.split("[\\r\\n]+")) {
write((String.format("... |
0e0787b2-4742-493a-ae29-ace316b4243c | 2 | public void naytaSeuraava(){
String naytettava = kertain.annaSeuraava();
if (kertain.getKertauksenTila() == KertausmaatinTila.KANJI){ //jos ollaan alussa, näytetään ekassa tekstikentässä, muuten tokassa
ekaTekstikentta.setText(naytettava);
} else if (kertain.getKertauksenTila() == Ke... |
ea0a527b-b592-459c-ae94-d43232ee146f | 2 | @Override
public int compare(QuizTakenRecord record1, QuizTakenRecord record2) {
if (record1.timestamp.getTime() > record2.timestamp.getTime())
return -1;
else if (record1.timestamp.getTime() < record2.timestamp.getTime())
return 1;
else
return 0;
} |
9cc42068-ae45-4ee4-8ccd-aa2be638a80a | 9 | final public Object parse() throws ParseException {
/*@bgen(jjtree) parse */
SimpleNode jjtn000 = new SimpleNode(JJTPARSE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));Object o;
try {
booleanSentence();
jj_consume_token(0)... |
933ec1f6-d709-4137-9923-97e360beb52b | 6 | @EventHandler
public void SnowmanRegeneration(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getsnowgolemConfig().getDouble("Snowm... |
3c02fb5c-e8a8-48d4-ab0e-f6cf373cb94e | 8 | public void act()
{
Lvl2BkgDesert myWorld = (Lvl2BkgDesert)getWorld();
count++;
//Detects when the dart hits the rock. When it does, the action follows.
List<Actor> mylist = (List<Actor>) getObjectsInRange(30,Darts.class);
//Actor Darts=getOneIntersectingObject(Darts.cla... |
ee2028b0-7011-4089-abff-bd02fbc031bb | 2 | @Test
public void insertKeepsMinimumValueAtTop() {
int minimumValue = Integer.MAX_VALUE;
Random r = new Random();
for (int i = 0; i < 100; i++) {
int thisValue = r.nextInt(5000);
h.insert(new Vertex(0, thisValue));
if(thisValue < minimumValue) {
... |
17df31e8-28c9-4401-b871-05ce725735a4 | 3 | private void param() throws ParseException {
String name = text;
next();
if (token == Token.EQUALS) {
next();
StringBuilder val = new StringBuilder();
if (token == Token.PIPE) { // handle cases like hotspot=!auth
val.append(token);
... |
73d4eaa3-baaa-4b4b-80dd-c58e01d372f2 | 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... |
07ac98db-ec18-4d47-adab-f206efb1e6c4 | 7 | public static Stella_Object walkMvExpressionTree(Stella_Object tree, List targettypes, Symbol operator, Object [] MV_returnarray) {
{ Object old$Targettype$000 = Stella.$TARGETTYPE$.get();
try {
Native.setSpecial(Stella.$TARGETTYPE$, ((targettypes.length() == 1) ? ((StandardObject)(((StandardObject)(... |
ae01ef0c-73f5-4575-8560-5240ba4e2286 | 0 | public String getOrderStatus() {
return this.orderStatus;
} |
f2f0a310-f76e-4111-adf7-1e5f4226625e | 0 | ClientCommand (int id, String name) {
this.id = id;
this.name = name.toLowerCase();
} |
04bd1759-fa44-4b3f-9fe6-8ebb339a5b9e | 6 | private void printBoard()
{
if (knightsTour != null)
{
boolean[][] board = knightsTour.getBoard();
int rows = knightsTour.getRows(),
columns = knightsTour.getColumns();
Point knight = knightsTour.getKnight();
for (int y = 0; y < rows; y++)
{
for (int x = 0; x... |
34aceca4-dbde-4298-99f0-b3982ae67f74 | 4 | public MiniXMLToken getTokenComment(MiniXMLToken oMiniXMLToken) {
if (!getString().startsWith("!--"))
return oMiniXMLToken;
oMiniXMLToken.append(getNext());
while (testNext() != '-' || testNext() != tError) {
oMiniXMLToken.append(getNext());
if (oMiniXMLToken.getValue().endsWith("-->")) {
oMiniXMLTok... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.