method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d3502b57-90f2-4779-8931-8359e0c08ba9 | 3 | public void write(int x, int y, String text) {
final char[] chars = text.toCharArray();
int posX;
int posY;
for (int iteration = 0; iteration < chars.length; iteration++) {
posY = y + iteration / width;
posX = x + iteration % width;
if (posX < width && posY < height) {
buffer[posX][posY] = new Sc... |
9a9f87e9-e4e4-4f1f-8d65-5518277ed98f | 4 | @Override
public boolean execute(Player player) {
if(!this.hasSecondWord()) {
GameEngine.gui.println("Eat what?");
return false;
}
String name = this.getSecondWord();
if (!player.getInventory().hasItem(name))
{
GameEngine.gui.pr... |
71d82cba-aa80-4461-8193-83cd86087ed4 | 6 | public boolean isSymmetricLevel(TreeNode left,TreeNode right){
if(left == null && right == null)
return true;
if(left == null || right == null)
return false;
if(left.val != right.val)
return false;
return (isSymmetricLevel(left.left, right.right) && is... |
caa6c994-a6da-4338-81b5-6b11aaf4d015 | 4 | public static void main(String [] args){
long start = System.currentTimeMillis();
double end = System.currentTimeMillis();
double time = end - start;
int sum = 0;
int largestNum = 0;
for( int x = 100; x < 1000; x++) {
for( int y = 100; y < 1000; y++) {
sum = x * y;
if( palindrome(sum)) {
i... |
21eb6e8b-0350-440d-b626-db966b6ee8cc | 3 | public void execute(CommandSender sender, String[] args) {
if (!sender.hasPermission("bungeeannouncer.admin")) {
sender.sendMessage(FontFormat.translateString("&4You do not have permission to use this command"));
return;
}
if (args.length != 0) {
sender.sendMessage(FontFormat.translateString("&7Usage: /a... |
0f36bcc6-4185-4d9c-9d92-2403a5fd1b24 | 7 | private void prepareMaps(final Path drumMaps) {
final String[] files = drumMaps.toFile().list();
if (files != null) {
this.initState.setSize(InitState.DRUM_MAP, files.length);
for (final String f : files) {
if (f.startsWith("drum") && f.endsWith(".drummap.txt")) {
final String idString = f.substring(... |
9f71f615-26e8-4403-9d44-0e1e7fdd8e9f | 1 | private boolean isEmpty(Vecteur<Integer> Vec) {
if (isIn(Vec)) {
return plateau[Vec.get(0)][Vec.get(1)] == 0;
} else {
return false;
}
} |
d8bc1416-2625-4cd3-a8c9-1084a0149005 | 4 | public static boolean checkCollision(final IShape pA, final IPixelPerfectMask pMaskA, final IShape pB, final IPixelPerfectMask pMaskB) {
//Transformation from B's local space to A's local space
final Transformation bLocToALoc = pB.getLocalToSceneTransformation();
bLocToALoc.postConcat(pA.getSceneToLocalTransform... |
8195d5eb-e987-4f22-a849-ff77d9009bf5 | 9 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
PrintWriter out = response.getWriter();
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload fileUpload = new Servl... |
c4aaec4b-5288-42bc-84f0-dbfa11a2d89a | 2 | private void calculate(String mask) {
Matcher matcher = cidrPattern.matcher(mask);
if (matcher.matches()) {
address = matchAddress(matcher);
/* Create a binary netmask from the number of bits specification /x */
int cidrPart = rangeCheck(Integer.parseInt(matcher.gro... |
0bd2059f-6977-4212-b305-9381ea279434 | 0 | private String classNameToFileName(String className) {
return className.replace(
'.',
System.getProperty("file.separator").charAt(0))
+ ".class";
} |
7a37ba79-3e57-4e7a-83f6-cb07b602ee9f | 0 | Expression(String expression){
this.expression = expression;
} |
8e0d2d91-c281-488b-b45a-364370278254 | 1 | public void allocReturnAddresses(final FlowGraph cfg,
final RegisterAllocator alloc) {
// Allocate registers for the returnAddresses. Don't bother trying
// to minimize the number of locals, just get a new one.
final Iterator e = cfg.subroutines().iterator();
while (e.hasNext()) {
final Subroutine sub = ... |
d170e710-221d-4e73-8715-695228089209 | 2 | public String asString() {
try {
String old = (String) reference.get();
if (old.equals(string))
return string;
string = old;
reference = null;
distributeChangeEvent(old);
} catch (NullPointerException e) {
}
return string;
} |
0e45a6bc-dfd7-462a-ba9f-6e76a3695d8e | 6 | public static void main(String[] args){
cars = new ArrayList<Car>(); // Create array of Cars
int step = 0; // Initalize the steps
highway = new int[ARRAY_SIZE];
//Initialize the car to a random spot on the array
//
Random rng = new Random(0);
for(int i = 1; i <= NUM_CARS; i++){
int car_pos = rng... |
25641410-c609-49e8-b34c-526930974732 | 7 | private static int partion(int[] n, int start, int end) {
int tmp = n[start];
while (start < end) {
while (n[end] >= tmp && start < end) {
end--;
}
if (start < end) {
n[start++] = n[end];
}
while (n[start] < tmp && start < end) {
start++;
}
if (start < end) {
n[end--] = n[start]... |
0a48829f-e8de-4ece-8139-8e2bb344e8b6 | 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... |
94e2444d-6f4e-4eb8-9ff5-070db0a3cd8e | 3 | public void remove(int id) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(this.getById(id));
session.getTransaction().commit();
} catch (Exception e) {
JOptionP... |
eb69439c-a55b-4c62-9a42-79a56af1e6f1 | 0 | public static void question5() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("Does it bothers you when it rains?");
questionNumberLabel.setText("5");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
radioB... |
e557ac83-a631-4a48-b15c-f48cc18970ec | 7 | private String getTitleString() {
switch(currentLevel) {
case 1: return "APC";
case 2: return "S-Cdk";
case 3: return "p53";
case 4: return "Delta-Notch";
case 5: return "TGF-Beta";
case 6: return "Hedgehog";
case 7: return "Wnt";
}
return "";
} |
47ae4774-9c93-40b0-91e5-c62a4928ca3f | 7 | public int[] findStones(int maxWeight) {
for(int i = 1; i <= maxWeight; i++) {
for(int j = i + 1; j <= maxWeight; j++) {
for(int k = j + 1; k <= maxWeight; k++) {
int l = maxWeight - i - j - k;
if(i < j && j < k && k < l) {
int[] stones = new int[4];
stones[0] = i;
stones[1]... |
6a96fd96-bc48-4ed8-9027-3ff4a05dbc97 | 5 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String action = request.getParameter("profileButton");
switch (action)
{
case ("Create Profile"): //the user wishes to create a profile
{
String email = request.getParameter("email... |
88125653-9bab-4219-9aed-b6aa64a97b84 | 7 | private static BigDecimal toDecimal(int precision, int scale, byte[] value) {
boolean positive = (value[0] & 0x80) == 0x80;
value[0] ^= 0x80;
if (!positive) {
for (int i = 0; i < value.length; i++) {
value[i] ^= 0xFF;
}
}
int x = precision ... |
aa24fba1-adbf-4744-80a4-4876df6e986f | 9 | void run(){
Scanner sc = new Scanner(System.in);
for(;;){
int n = sc.nextInt(), m = sc.nextInt();
if((n|m)==0)break;
int[] p = new int[n+1];
for(int i=0;i<n;i++)p[i]=sc.nextInt();
int[] a = new int[(n+1)*(n+2)/2];
int N = 0;
for(int i=0;i<=n;i++)for(int j=i;j<=n;j++)if(p[i]+p[j]<=m)a[N++]=p[i]+... |
3481a903-3097-4e84-8dfb-777f8dabaea2 | 4 | public static void main(String[] args) {
System.out.print("Please input router number: ");
int router_number = 0;
Scanner scan = new Scanner(System.in);
router_number = scan.nextInt();
scan.close();
System.out.println();
Router router = null;
try {
router = new Router(router_number)... |
e550d073-c8ac-48f8-bed0-f79c9251baa3 | 1 | public List<Monitor.Stats.Do> getDo() {
if (_do == null) {
_do = new ArrayList<Monitor.Stats.Do>();
}
return this._do;
} |
6f009429-0e3d-47b4-acc5-323dc0436dbc | 3 | public synchronized void actualiza(long tiempoTranscurrido){
if (cuadros.size() > 1){
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal){
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
}
while (tiempoDeAnimacion > getCuadro(ind... |
a021b942-aac5-48e1-9734-4189b77817fc | 7 | public static void lerArquivo() {
try {
try (BufferedReader in = new BufferedReader(new FileReader("presents.csv"))) {
String str;
int i = 0;
int somaAltura = 0;
while (in.ready()) {
if (i > 999) {
... |
aab41873-ee02-4ff8-81a7-760345867bed | 2 | public void setSecurityMenuPadding(int[] padding) {
if ((padding != null) && (padding.length != 4)) {
IllegalArgumentException iae = new IllegalArgumentException("The padding-array must not be null and must have four elements!");
Main.handleUnhandableProblem(iae);
}
this... |
d493bf67-81e9-43a4-989b-3ec2d885ccd9 | 0 | @Override
protected void dragg(Excel start, Excel end) {
} |
f84b8388-32c6-4a2d-8cf5-c2458152a1c4 | 4 | public double bonusAttaque(Territoire from, Territoire to) {
double bonus = 0.0;
if (from != null && from.has(SalleInfo.class)) {
Iterator<Territoire> it = territoiresOccupes.iterator();
while (it.hasNext()) {
if (it.next().has(SalleInfo.class)) {
bonus++;
}
}
}
return bonus;
} |
727b2e58-75d7-4e88-bf94-d13820d7e1ae | 4 | private Point approach( Point landing, Side side ){
Point approach = new Point( landing );
switch( side ){
case EAST:
approach.x += landingOffset;
break;
case WEST:
approach.x -= landingOffset;
break;
case NORTH:
approach.y -= landingOffset;
break;
case SOUTH:
ap... |
46449dd7-15a9-403a-84ca-c620ae4f6c3e | 2 | public double variance_of_ComplexImaginaryParts() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double[] im = this.array_as_imaginary_part_of_Complex();
double variance = Stat.variance(im);... |
50188874-2f09-439d-ab1d-0f7450aa26d5 | 0 | @After
public void tearDown() throws Exception
{
} |
7bd7a71d-b531-4eff-8993-fd3a37fe83ad | 6 | public void run() throws CruiseRuntimeException {
for (CreateActorStatement create : creates) {
ActorIdentifier act = create.getConcreteTarget();
String atypeName = create.getActorType();
instantiateActor(atypeName, act, create.getParameters());
}
for (SendMessageStatement msg : messages) ... |
0565d6fa-e9aa-4b36-85af-c66d39913872 | 2 | public void mergeKill(SlotSet kill) {
grow(kill.size());
big_loop: for (Iterator i = kill.iterator(); i.hasNext();) {
LocalInfo li2 = (LocalInfo) i.next();
if (!containsSlot(li2.getSlot()))
add(li2.getLocalInfo());
}
} |
efd1d046-a134-4b39-8a6a-897c0fa8b92a | 5 | private void populateTable() {
//check so we arent already trying to update the table, might get nasty results (i did when i made this) if we update the table from alot of different threads.
if (thread != null && thread.getState() == State.TERMINATED || thread.getState() == State.NEW) {
thre... |
f9ce6cd2-e01b-4a0c-bd14-39868f413401 | 9 | void outerHtmlTail(StringBuilder accum, int depth, Document.OutputSettings out) {
if (!(childNodes.isEmpty() && tag.isSelfClosing())) {
if (out.prettyPrint() && (!childNodes.isEmpty() && (
tag.formatAsBlock() || (out.outline() && (childNodes.size()>1 || (childNodes.size()==1 && !... |
d4194e8c-f852-46aa-b950-d9c50838b106 | 2 | public static void main (String [] args)
{
Student[] students = new Student[10];
for (int i = 0; i < 10; i++) {
students[i] = new Student(i);
}
HashMap<Integer, Student> sMap = buildMap(students);
System.out.println("Students are:");
for (int i = 0; i < 10... |
59017fe9-1fc0-444d-81ce-8a7aa394a0f1 | 8 | public boolean stackAttack(ArrayList<GameEntity> attacker, ArrayList<GameEntity> defender)
{
if (attacker.size() == 0) return false;
if (defender.size() == 0) return true;
int iDef = 0;
for (int i = 0; i < attacker.size(); i++)
{
//attacker.get(i).attack(conflictSystem.attack(attacker.get(i), defender.get... |
821b8b47-3385-43ab-836a-5c6139005dc3 | 7 | void renderPulse(float[] dest, int nsamples) {
// This follows the same general pattern as renderTriSaw above, except
// this time the waveform is a pulse wave with variable pulse width,
// which means we get very simple integrals. The state machine works
// the exact same way, see above for description.
//CO... |
f406ee71-4fb3-4481-bbc8-9af820faf59c | 3 | private void listRoots(DefaultMutableTreeNode racine) {
for(File file : File.listRoots()){
DefaultMutableTreeNode lecteur = new DefaultMutableTreeNode(file.getAbsolutePath());
if(file.isDirectory()){
for(File nom : file.listFiles()){
DefaultMutableTreeNode node = new DefaultMutableTreeNode(n... |
e15bd8db-f7f8-4f23-89a4-430f078d1c7d | 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... |
7ac0ff40-b3b3-444e-8218-d73232414dfe | 5 | public InputNode parse() {
InputNode inputNode = new InputNode();
String ss;
while ( true ) {
ss = this.xp.getNextString();
if ( ss.equals("/Input")) {
return inputNode;
}
else if ( ss.equals("Name")) {
inputNode.setName(this.xp.getNextString());
this.xp.getNextString();
}
else if ( ... |
2148d5ae-4d7b-481e-be3e-0bb6cd44a80b | 1 | public void jsFunction_craftItem(boolean all) {
deprecated();
if(all)
JSBotUtils.craftItem(1);
else
JSBotUtils.craftItem(0);
} |
ebc94855-75d4-4a44-8a81-270f89c64db2 | 6 | protected static byte[] encrypt(byte[] data, Algorithm algorithm,
SecretKey secretKey, byte[] iv) throws JironException {
Cipher cipher;
try {
cipher = Cipher.getInstance(algorithm.transformation);
} catch (NoSuchAlgorithmException e) {
throw new JironException("Encryption algorithm "
+ algorithm.t... |
49257470-a507-433a-a503-e94ec19a0af5 | 2 | public void test_10() throws IOException {
String vcfFileName = "tests/test.chr1.vcf";
Random random = new Random(20130216);
// Index file
System.out.println("Indexing file '" + vcfFileName + "'");
FileIndexChrPos idx = new FileIndexChrPos(vcfFileName);
idx.setVerbose(verbose);
idx.setDebug(debug);
idx... |
dfaba707-bb54-412d-9d92-df5468939bea | 2 | private static boolean trunRight(int n, int[] p){
String ns = Integer.toString(n);
while(ns.length()>1){
ns = ns.substring(0, ns.length()-1);
if (p[Integer.parseInt(ns)]==0) return false;
}
return true;
} |
72e079ea-51c7-4cdf-8fdf-1680a7759d9b | 6 | final void method2995(int i, int i_0_) {
if (i != 0 || i_0_ != 0) {
if (anIntArray6881 == null
|| anIntArray6881.length != anIntArray6884.length)
anIntArray6881 = new int[anIntArray6884.length];
int i_1_ = anIntArray6884.length;
int i_2_ = i;
int i_3_ = anInt6880 - 1;
int i_4_ = anInt6880 ... |
9bc07f7d-bc6c-4e34-a78a-902b2f8834df | 2 | public static boolean isEmpty(CharSequence str) {
if (str == null || str.length() == 0) {
return true;
} else {
return false;
}
} |
b5667157-dfa9-419a-bc86-e71c5721600b | 1 | public boolean isScrollPositionOnStatus() {
if(frame == null) buildGUI();
return scrollStatus.isSelected();
} |
b7abb877-c9ef-4f0a-8d70-4270d91821b6 | 9 | public void search (BayesNet bayesNet, Instances instances) throws Exception {
m_random = new Random(m_nSeed);
// determine base scores
double [] fBaseScores = new double [instances.numAttributes()];
double fCurrentScore = 0;
for (int iAttribute = 0; iAttribute < instances.numAttributes()... |
34794cfa-726e-48e7-a057-a2a05b986943 | 9 | public static TreeNode<?> findNext(TreeNode<?> node) {
if(node == null) {
return null;
}
/* if it has right subtree */
if (node.right != null) {
/* get the leftmost of the subtree */
TreeNode<?> leftMost = node.right;
while (leftMost.left != null) {
leftMost = leftMost.left;
}
return left... |
a5832b05-aaa0-4802-bbd8-3a2e48534bb6 | 5 | @Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
MaNode node = (MaNode) value;
switch (node.getTyp... |
dbdfe1bc-6b23-4f8a-a87c-aa056b2ad8a8 | 2 | private void copyResource(InputStream resource, File file)
{
try
{
OutputStream out = new FileOutputStream(file);
int length;
byte[] buf = new byte[1024];
while((length = resource.read(buf)) > 0)
out.write(buf, 0, length);
out.close();
resource.close();
}
catch (Exception e) {e.printS... |
2f46b412-6746-422a-bbe3-d2c3e65c8aef | 9 | protected SpawnerWorldConfig(World world)
{
FileConfiguration cfg = getConfig(WORLDS_FOLDER + File.separatorChar + world.getName(), SpawnerComponent.SPAWNER_CONFIG_NAME);
super.setCfg(cfg);
boolean spawnMobs = getAndSet("SpawnMobs", true);
if (spawnMobs && MMComponent.getLimiter().getWorld(world) == n... |
03e5d9e4-2481-4f2f-96e6-24b056ca35db | 1 | private String display() {
String displayString = "";
if (this.contents == null) {
return displayString; //Will update display with blank string if contents is empty
}
displayString += this.contents;
return displayString;
} |
b9d8edbd-7bae-4778-81fa-88a752ee8d0f | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Vertrag)) {
return false;
}
Vertrag other = (Vertrag) object;
if ((this.id == null && other.id != null) || (thi... |
a4b2dcc7-37b6-4cc2-9ed6-a83ec34f9067 | 1 | public int update(Product p) {
try {
String sql = "UPDATE stock SET productName = ?, count = ?, price = ?, feature = ? where productId = "+p.getpId();
PreparedStatement ps = StatusController.connection.prepareStatement(sql);
ps.setString(1, p.getpName());
ps.setInt(2, p.getAmount());
ps.setDouble... |
7bf19db4-0d90-43af-b577-1fd81e39dbbe | 2 | public Block pathSource(final Block block) {
for (int i = 0; i < paths.size(); i++) {
final Block[] path = (Block[]) paths.get(i);
if (path[1] == block) {
return path[0];
}
}
return null;
} |
dde5143e-0b10-4c70-9226-a2a65c5212ae | 1 | public static TicketDAO getInstance(){
if (instance==null) {
instance= new TicketDAO();
}
return instance;
} |
e8ec4eec-67e9-4ae5-a52b-1ac772bf0f6e | 9 | public void writeTo(DataOutput dout) throws IOException {
// Write out the size (number of entries) of the constant pool.
int size = getSize() + 1; // add one because constant 0 is reserved
if (size >= 65535) {
throw new IllegalStateException
("Constant pool entry co... |
d30572d0-23e3-4a90-a9a6-5087375c08b2 | 1 | @Override
public List getNomColonnes(ResultSet rs) throws SQLException {
ArrayList listeResultat = new ArrayList();
ResultSetMetaData rsmd = rs.getMetaData();
for (int i = 0; i < rsmd.getColumnCount(); i++) {
listeResultat.add(rsmd.getColumnName(i + 1));
}
return ... |
066e719d-1c85-4ace-ba73-e981afe7539f | 2 | private void rx(DatagramSocket socket, byte[] data) throws Exception
{
try
{
DatagramPacket packet=new DatagramPacket(data, data.length);
//System.out.println("Attente du paquet");
socket.receive(packet);
//System.out.println("Parsage du paquet");
dataPacket = Packet.parseUDPdata(data);
//System... |
946b20f4-3702-4a1e-abc3-7d83e4eac50f | 8 | public boolean equals (Object chunk)
{
if(chunk == this)
return true;
if(!(chunk instanceof AbstractChunk))
return false;
if(!equalsID(chunk))
return false;
for (Map.Entry<? extends Object, ? extends Dimension> e : ((AbstractChunk)chunk).entrySet())
if(!containsKey(e.getKey()) || !containsValue(e.g... |
065d68c9-4308-4ac1-abbc-9f7d32d4fc60 | 3 | private void addWord(StringBuilder word, boolean addFirst) {
//removing all none chars from the end.
while(mLangInnerChars.contains(word.charAt(word.length()-1)))
word.setLength(word.length()-1);
String typedWord = word.toString();
String wordFound = typedWord.toLowerCase();
if (mWords.containsKey(wordFoun... |
4bbbd53a-435d-4fcc-8431-72127420c063 | 2 | private void LoadSpecialCharMap(String strSpecialCharMap) {
logger.entering(loggerName, "LoadSpecialCharMap");
try {
File specialCharMap = new File(strSpecialCharMap);
docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setName... |
2c8f3b0a-769e-4f31-8b14-321298b9bf45 | 1 | public void showMatrixF()
{
System.out.print("First column");
for(int j=0; j<rows; j++)
{
System.out.print(matrix[0][j]);
}
} |
a0e8e3b3-668d-4c34-a1ea-8fed0f0373db | 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)
{
... |
937421dc-8b52-466a-8a8f-883426a127bc | 2 | private void saveAsDialog(){
JFileChooser fileSave = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter(
"Algorythm workspace files .wks", "wks");
fileSave.setFileFilter(filter);
fileSave.setDialogTitle("Save file...");
if (fileSave.s... |
f2fbb5aa-8443-43c0-abd2-ed05d5628e6a | 7 | public List<String> getMessage(boolean info, boolean warn, boolean error) {
List<String> listToReturn = new ArrayList<String>();
StringBuilder s;
for (Element e : doc.getRootElement().getChild("logs").
getChildren("entry")) {
s = new StringBuilder();
if (e.getAttributeValue("level").cont... |
03ed594d-c2b2-46cc-ad2c-febac0988bbb | 4 | private static boolean validate(WidgetChild... children) {
if (children == null)
return false;
for (WidgetChild wc : children) {
if (wc == null || !wc.validate())
return false;
}
return true;
} |
596f9603-2ce2-452e-a606-72d137740d77 | 8 | public AttributeMessage(BinaryReader in, Superblock sb, long address) throws IOException {
in.setOffset(address);
this.m_address = address;
short nameSize, typeSize, spaceSize;
byte flags = 0;
byte encoding = 0; // 0 = ascii, 1 = UTF-8
this.m_version = in.readByte();
if (this.m_version == 1) {
... |
89434f3a-3739-492d-91ef-99992fabcd17 | 0 | private void action(final String time1StringView, final String time2StringView) {
float res1 = calcDistance(time1StringView);
float res2 = calcDistance(time2StringView);
System.out.println(res1);
System.out.println(res2);
} |
0c4ccb92-74ed-4073-91f6-163e78c69b33 | 0 | public String getFax() {
return Fax;
} |
ded488ce-90a7-46d1-b4ce-cb61c51ca06e | 2 | private boolean checkRight(int x, int y, int z){
int dz = z - 1;
if(dz < 0){
return false;
}else if(chunk[x][y][dz] != 0){
return true;
}else{
return false;
}
} |
b5859437-abc3-44aa-8a31-3fc0b758fa10 | 7 | @Override
public void run() {
while (parent.isConnected()) {
try {
int i = 0;
while (!parent.getQueue().isEmpty()) {
try {
final String message = parent.getQueue().remove();
parent.write(message +... |
5e64c601-ba95-4009-b6b3-0058af586dff | 1 | public Expression simplify() {
if (local.getExpression() != null)
return local.getExpression().simplify();
return super.simplify();
} |
f260ac0d-6dad-4037-895e-73371671ddeb | 1 | public void addEdge(Object s1, Object s2){
int indexOfS1, indexOfS2;
if(s1 instanceof String){
indexOfS1 = sVertices.indexOf(s1);
indexOfS2 = sVertices.indexOf(s2);
}
else{
indexOfS1 = nVertices.indexOf(s1);
indexOfS2 = nVertices.indexOf(s2... |
70274b84-0832-4a1b-9204-9fffe868bf78 | 5 | @Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y))
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
for (Player p:apples.playerList)
{
if (maker!=p.ID&&p.checkCollision((int)X, (int)Y))
... |
8e17c3b5-011e-4cc7-bd84-660414d32f06 | 0 | @Override
public boolean supportsEditability() {return true;} |
7f3f2d1f-e676-4039-88fd-022426c1ecb9 | 8 | public void mouseMoved(MouseEvent me) {
GraphNode n;
Dimension d = m_gp.getPreferredSize();
//System.out.println("Preferred Size: "+this.getPreferredSize()+
// " Actual Size: "+this.getSize());
x=y=nx=ny=0;
if(d.width < m_gp.getWidth())
nx = (int)((nx... |
9f25f5fe-8bde-4ee3-ad3e-79d5903c3a9c | 0 | public Sprite getPlayer() {
return player;
} |
361d3df0-0c5c-48c2-9963-cdf1b0f312a8 | 2 | public Job checkout(int id) {
for(Job job : queue){
if(job.getId() == id){
job.checkout();
return job;
}
}
return null;
} |
3e371f67-c624-4577-9f6a-e3114fcfeba7 | 6 | public static void addValue(int x, int y, int value) {
if (value > 0 && value < 10 && x > 0 && x < 10 && y > 0 && y < 10) {
puzzle[x-1][y-1] = value;
}
} |
cda920cb-ef52-4deb-97da-4f52b2e668b2 | 2 | @Override
protected void performTask(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
String action = request.getParameter("action");
Syst... |
1664739e-4874-4c34-9e57-7f5231a361b7 | 3 | public static String multiplierToString(double d)
{
if(d==0)
return "It had no effect!";
else if(d<1.0)
return "It's not very effective...";
else if(d>1.0)
return "It's Super Effective!";
return "The Attack Hit!";
} |
96b81654-720f-46e0-a899-1377f095a09b | 3 | private boolean checkValid() {
if ((inChar[0]==false)&&(inChar[6]==true)&&(bcount>=7)) return true;
else return false;
} |
8decea5a-c07e-45a0-b1f4-486e8f089e38 | 4 | private boolean isTraversable(int dx, int dy)
{
final boolean[][] t = traversable;
final int rx = cursorX + dx;
final int ry = cursorY + dy;
return ry >= 0 && ry < t.length && rx >= 0 && rx < t[ ry ].length && t[ ry ][ rx ];
} |
3040375d-0fa5-4206-b00b-7343a0b3f42d | 7 | boolean isValid()
throws IOException
{
if (_cached.isUptoDate())
{
if (_mostRecentlyUsed!=this)
{
CachedMetaData tp = _prev;
CachedMetaData tn = _next;
_next=_mostRecentlyUsed;
... |
49d6bfa9-8bc7-4ee7-9998-cd8900bbd471 | 5 | public boolean equals(
Object o)
{
if (o == null || !(o instanceof DERInteger))
{
return false;
}
DERInteger other = (DERInteger)o;
if (bytes.length != other.bytes.length)
{
return false;
}
for (int i = 0; i != bytes... |
63e5a800-eca0-4e3b-8928-dc589061e0e1 | 4 | public long getTime() {
if (this.runningState == STATE_STOPPED
|| this.runningState == STATE_SUSPENDED) {
return this.stopTime - this.startTime;
} else if (this.runningState == STATE_UNSTARTED) {
return 0;
} else if (this.runningState == STATE_RUNNING) {
return System.currentTimeMillis() - this.start... |
0589866d-c2af-4119-a6dd-376d96569a1c | 3 | public float[] calculate(float[] x) {
// create output array
float y[] = new float[x.length * C0.length];
float yValue;
// for each y value, apply exponential interpolation function
for (int i = 0; i < x.length; i++) {
// C0 and C1 should have the same length work thr... |
f7143470-c477-4e99-b9ff-16534cdafdfe | 0 | public IntNode(int initialData, IntNode initialLink)
{
data = initialData;
link = initialLink;
} |
efe60aae-6a19-4808-822c-4bcd9df265bb | 3 | private static Move ForwardRightForBlack(int r, int c, Board board){
Move forwardRight = null;
if( r>=1 && c>=1 &&
board.cell[r-1][c-1] == CellEntry.empty
)
{
forwardRight = new Move(r,c, r-1, c-1);
}
return forwardRight;
} |
4c1e594b-c372-46af-a70a-ca793da8f26c | 2 | public static boolean insertar_nuevo(Producto x){
try{
//abrimos el fichero en modo lectura con la opción append para insertar el nuevo producto en final del fichero
BufferedWriter escribe=Files.newBufferedWriter(path,
java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.APPEND); ... |
0da61563-07fd-41b7-8b73-3f5ed802edb5 | 7 | @Override
public Set<Integer> sample(Map<Integer, Set<Integer>> cluster,List<sei.buaa.program.analyzer.TestCase> tests) {
Set<Integer> result = new HashSet<Integer>();
Set<Integer> failedTestCaseIDS = new TreeSet<Integer>();
for (sei.buaa.program.analyzer.TestCase test : tests)
if (test.isPassed() == fal... |
978d63ec-43bd-4435-bab5-56c06ab8085f | 1 | private void initComponentsNorth() {
northPanel = new JPanel();
ActionListener myActionListener = new BookGUIActionListener(this,
loginUser);
searchLabel = new JLabel("Suchkriterium auswählen ");
searchLabel.setFont(new Font(textFont, labelStyle, textSize));
searchCombo = new JComboBox<String>();
se... |
dbfe1d29-f8df-472c-8a79-83a6127aced8 | 7 | private void updateLogic() {
// not started state
if (gameInfo.getState() == GameInfo.GameState.NOT_STARTED) {
stateController.changeState(bufferedKeyboard, gameInfo);
}
// dead state
if (gameInfo.getState() == GameInfo.GameState.DEAD) {
stateController.changeState(bufferedKeyboard, gameInfo);
}
... |
46c4aae3-84c0-4595-9fd1-cc36d704c9dc | 2 | public static void main(String[] args) {
// initialize ivars
filename = args[0].toString();
numThreads = Integer.parseInt(args[1]);
transQueue = new ArrayBlockingQueue<Transaction>(numThreads);
latch = new CountDownLatch(numThreads);
// initialize accounts
accounts = new Account[NUM_ACCTS];
for (i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.