method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
aeb3f934-4d1d-4517-83d2-17f8cd459a7f | 4 | public int get(final int index) {
final int i0 = index >>> 23;
int[][] map1;
if (i0 != 0) {
if (map == null)
return NOT_FOUND;
map1 = map[i0];
if (map1 == null)
return NOT_FOUND;
} else
map1 = map10;
int[] map2 = map1[(index >>> 12) & 0x7ff];
if (map2 == null)
return NOT_FOUND;
... |
7663e2cf-895b-46ae-bb6a-b5d661bbfcd7 | 0 | public void exitMessage() {
UserInterface.println("Debug session finished.");
} |
e5709924-3075-4663-a284-b26ddae6b762 | 0 | public Id3v2UserTextFrame(Property property, PropertyTree parent) {
super(property, parent);
} |
1fbd85f7-c437-42b2-a630-1dc7920b58bc | 9 | public void keyReleased(KeyEvent e) {
// movement is disallowed when the level is over
if (transition)
return;
if (!level.isSolved()) {
switch (e.getKeyCode()) {
case KeyEvent.VK_DOWN:
level.getPusher().move(0,1);
break;
case KeyEvent.VK_UP:
level.getPusher().move(0,-1);
... |
b933c368-b081-4c8d-9a6b-464dcdbacd00 | 6 | @EventHandler
public void boundsCheck(PlayerMoveEvent event){
Player p = event.getPlayer();
Boolean inGame = plugin.getArena(p) != null;
Boolean spectating = plugin.isSpectating(p);
if(plugin.config.getBoolean("WorldEdit"))
if(insideBounds(p.getLocation()) && (inGame || spectating) || (!insideBounds(p.getLo... |
62fd305a-fb5b-4959-bc37-bb2c4dc0a7c7 | 4 | public int getSectorWithMostMosquitoes( int[][] board ) {
int mostMosquitoes = 0;
int sectorWithMostMosquitoes = -1; // Defaults to 0
Tuple<Integer,Integer> startingPoint = new Tuple<Integer,Integer>(1,1);
log.trace("Number of sectors is: " + sectors.size());
for ( int z = 0 ; z < assignedSectors.size() ; z+... |
8f61a15a-26fb-42a5-8614-9d876e570596 | 9 | @Override
public List<Node> neighbors(Node node) throws IOException {
// System.out.println("Calling neighbors.");
LinkedList<Node> list = null;
String input = null;
try {
StringBuilder sb = new StringBuilder("neighbors\n");
sb.append(ProtocolParser.encodeEmptyNode(node));
String output = ProtocolP... |
2472312d-a375-4f35-ab63-afdc0b631240 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "MgmtData")
public JAXBElement<String> createMgmtData(String value) {
return new JAXBElement<String>(_MgmtData_QNAME, String.class, null, value);
} |
3f288377-f5e0-4dd9-ba37-bb1d9bf1c849 | 9 | public static String decodeXmlString(XmlDoctype doctype, String input, boolean peReferenceAllowedP) {
{ int inputEnd = (peReferenceAllowedP ? (input.length() - 1) : ((int)(Stella.NULL_INTEGER)));
int referenceStart = (peReferenceAllowedP ? Stella.findReferenceStart(input, 0, inputEnd) : Native.string_position... |
8f1e3506-3820-462d-8b48-7db5e4a27d68 | 7 | private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
11bd67ac-381f-4660-a8af-1fd401fa1e32 | 5 | public void testRec(Configuration conf,byte depth){
depth++;
nbAppelListeFils++;
if (depth == 2)
System.out.println("nbappelListeFils : "+nbAppelListeFils);
ArrayList<Configuration> listeConfig = listeFils(conf);
if (depth<depthMax){
for (Configuration c : listeConfig) {
testRec(c, depth);
... |
5d89e90d-fb57-4652-b12e-8cf81dfd70b5 | 3 | public static void main(String args[]){
SLinkListHead s=new SLinkListHead();
Node n=new Node("first");
Node n2=new Node("second");
Node n3=new Node("third");
s.addFirst(n);
s.addFirst(n2);
s.addFirst(n3);
for(int c=0;c<s.getSize();c++){
Node next=null;
Node no=s.head;
if(no!=null)
next=no... |
f878c490-b908-4ae0-86e3-caa9f8731588 | 9 | public static List<Class<?>> sortClassesByLevelOfInheritance(Collection<Class<?>> classes) {
List<Class<?>> result = new ArrayList<Class<?>>(classes);
Collections.sort(result, new Comparator<Class<?>>() {
public int compare(Class<?> c1, Class<?> c2) {
int l1 = getLevelOfInheritance(c1);
int l2 = getLevel... |
9c2e70da-04c9-478a-9654-a0876b53273d | 4 | public ColHandle[] getColumns()
{
List<ColHandle> columns = new CompatibleVector();
for( Colinfo c : mysheet.getColinfos() )
{
try
{
int start = c.getColFirst();
int end = c.getColLast();
for( int i = start; i <= end; i++ )
{
try
{
columns.add( getCol( i ) );
}
ca... |
9d7d5164-420d-410d-a35c-97097d4925e7 | 6 | @EventHandler(priority=EventPriority.MONITOR)
void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().getTitle().equals(name)) {
event.setCancelled(true);
int slot = event.getRawSlot();
if (slot >= 0 && slot < size && optionNames[slot] != null) {
... |
4939f5e4-1b97-4f5c-8c14-9b6c39646352 | 1 | public String getProfileSummary() {
String rlHanded = isRightHanded ? "Right handed" : "Left handed";
String summary =
"*************************\n" +
"**** Frolf Profile ****\n" +
"*************************\n" +
"* Username: " + username + "\n" +
"* Display nam... |
4f984f0a-4c55-4046-8d0d-08d1e849d9bf | 2 | @RequestMapping("/agregar/{producto}")
public ModelAndView agregarProducto( @PathVariable String producto) {
Stock stock = Stock.getInstance();
if (!stock.existeProducto(producto)) {
stock.agregarProducto(producto);
}
Map<String, Integer> mapStock = stock.obtenerStock();
Set<String> setStock = mapS... |
1bcb0109-2c62-4a69-bf78-53c376f88697 | 0 | public Integer getStatusType() {
return statusType;
} |
fbb620ff-09d6-4090-9f65-438915371afa | 0 | public MyCanvas() {
super();
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
thisMouseClicked(e);
}
});
} |
ec25bd65-0283-47a8-8711-dcc04f720f63 | 7 | @Override
public int willingnessToMoveHere(Hero hero, Player player, float distance,
int day) {
float moveRatio = hero.getMovePoints()/(distance+1);
if (color == player.getColor()) {
if (getEndangered()) {
System.out.println(" 1 "+hero.getName());
return (int)(500*moveRatio);
} else {
int s... |
68068067-2ba1-484c-915e-ec26da2d629b | 0 | private void jButtonQuitterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonQuitterActionPerformed
((CtrlVisiteur)controleur).visiteurQuitter();
}//GEN-LAST:event_jButtonQuitterActionPerformed |
0b3c914c-f480-446a-9df4-c34a8a095cd1 | 8 | public Graph getShortestPath(int start, int end) {
Vertex vStart = vertices.get(start);
Vertex vEnd = vertices.get(end);
Queue<Vertex> queue = new ArrayDeque<Vertex>();
boolean[] visited = new boolean[vertices.size()];
Vertex[] parent = new Vertex[vertices.siz... |
4f093b7f-ac40-4dcb-9859-f04cdd93ef87 | 7 | private static SphereCluster calculateCenter(ArrayList<Cluster> cluster, int dimensions) {
double[] res = new double[dimensions];
for (int i = 0; i < res.length; i++) {
res[i] = 0.0;
}
if (cluster.size() == 0) {
return new SphereCluster(res, 0.0);
}
... |
cc609db6-3f4a-4a6c-ac61-feb2d3eacc8c | 1 | public void dragGestureRecognized(DragGestureEvent event) {
System.out.println("grag gesture");
Cursor cursor = null;
if (event.getDragAction() == DnDConstants.ACTION_COPY) {
cursor = DragSource.DefaultCopyDrop;
}
event.startDrag(cursor, this);
} |
a811ba8c-e6b8-40b1-bcda-25d50e8d55a8 | 2 | public static double min(double[] values) {
double min = values[0];
for (double value : values) {
if (value < min) min = value;
}
return min;
} |
4e502f15-a43c-461b-8b78-f657bc4418a6 | 7 | static double getProb(int c1,int c2,int c3,int c4){
int v1,v2,v3,v4,h1,h2,tmp,index;
if(c1>c2){
tmp=c1;
c1=c2;
c2=tmp;
}
if(c3>c4){
tmp=c3;
c3=c4;
c4=tmp;
}
if(c1%4!=c2%4){
v1=c1/4;
v2=c2/4;
}else{
v1=c2/4;
v2=c1/4;
}
if(c3%4!=c4%4){
v3=c3/4;
v4=c4/4;
}els... |
b6026bc6-518c-413e-8002-7c1ed0524867 | 2 | @Override
public void executeAll() {
try {
for(IMovesCommand c : _movesCommandLog) {
c.setExecutor(movesFacade);
c.execute();
}
} catch (CommandException e) {
System.err.println("Error: Illegal/Invalid command was stored in MovesCommandLog");
e.printStackTrace();
}
} |
ec93278f-c07f-4879-b12d-d4ed357838f5 | 9 | private static void handleConstructor(ComponentConfig config, Class<?> clazz) {
try {
for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
Class<?>[] parameters = constructor.getParameterTypes();
Type[] parameterTypes = constructor.get... |
89634081-e0a3-468b-9200-97637a0ecaef | 3 | public static boolean isWhitespace(int c) {
return isNewLine(c) || c == '\r' || c == ' ' || c == '\t';
} |
e2ab1d0a-4b0f-4ffe-a2d3-418ed1f63629 | 6 | protected void addCurrentLineHighlightListeners() {
boolean add = true;
MouseMotionListener[] mouseMotionListeners = getMouseMotionListeners();
for (int i=0; i<mouseMotionListeners.length; i++) {
if (mouseMotionListeners[i]==mouseListener) {
add = false;
break;
}
}
if (add==true) {
//System.e... |
4155fbd5-2407-4a34-b802-c2cdf73fc893 | 3 | private int askNumber(String type, String text, int max) {
try {
String txt = JOptionPane.showInputDialog("Inserte numero de " + type + " para " + text + " :");
int num = Integer.parseInt(txt);
if (num > 10 || num < 0)
throw new RuntimeException();
... |
1346b9f5-7398-4b40-88c8-47f7034f483f | 8 | @Override
public void run() {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
try {
Registry registry = LocateRegistry
.getRegistry(JobUtility.getPort());
IJobProcessingService comp = (IJobProcessingService) registry
.lookup(JobUtility.getDispatch... |
77d9317b-768d-48df-9819-af65b285a42a | 8 | private void getFriendRealQQ() {
HashMap<String, String> properties = new HashMap<String, String>();
properties.put(PROPERTY_REFER,URL_REFER_GET_INFO);
properties.put(PROPERTY_ACCEPT,"*/*");
properties.put(PROPERTY_ACCEPT_ENCODING, "gzip,deflate,sdch");
properties.put(PROPERTY_CONNECTION,"keep-alive");
prop... |
dfd0b353-e9a8-41b3-a90b-f430e24dbd39 | 2 | public Digraph digraph()
{
Digraph g = new Digraph(V());
try
{
for (WeightedDirectedEdge e : edges())
g.addEdge(e.from(), e.to());
}
catch (Exception e)
{
e.printStackTrace();
System.exit(1);
}
return g;
} |
fa4ce488-c7f5-40f9-9801-9622d1448b37 | 8 | void moveForwardTo(int newPos) {
System.out.println("moving tracks to " + newPos);
if (newPos - 1 >= reference.length)
throw new RuntimeException("New position is beyond the reference: " + newPos);
if (newPos < position)
throw new RuntimeException("Cannot shift to smaller position on the reference.");
i... |
8c67af09-a4be-4403-9532-7cadf5a1455a | 2 | public List<String> getLines() throws IOException {
List<String> copy = new ArrayList<String>();
do {
try {
copy.add(lines.take());
} catch (InterruptedException e) {
throw new IOException(e);
}
} while (lines.size() > 0);
return copy;
} |
d0fd1e52-425d-450d-9567-9038cf372885 | 6 | public void run() {
if(url != null)
{
// Obtain the results of the project's file feed
if(readFeed())
{
if(versionCheck(versionTitle))
{
String fileLink = getFile(versionLink);
... |
16b39a6e-6648-47ba-9c5c-cc558f2da62b | 4 | public Vector<Vector<Object>> eventsTable() {
try {
String[] keys = {"calendar", "eventID", "description", "active"};
crs = qb.selectFrom(keys, "events").all().executeQuery();
data.clear();
while(crs.next()) {
Vector<Object> row = new Vector<Object>();
ResultSetMetaData metadata = crs.getMetaDa... |
ff0b89e2-d1af-4edb-8039-bfdcdecd0240 | 4 | public boolean accept( File f )
{
if ( f != null )
{
if ( f.isDirectory() )
{
return true ;
}
String extension = getExtension( f ) ;
if ( extension != null && filters.get( getExtension( f ) ) != null )
{
return true ;
}
;
}
return false ... |
3586eb8f-e008-45ac-980a-a4950943703e | 3 | public String toString()
{
String string;
string = "file: " + path + System.getProperty("line.separator");
if (hasImage==1)
{
string = string + "image: " + img.getPath();
}else if(hasImage==0)
{
string = string + "No Image Found!";
}else if(hasImage==2)
{
string = string + "Image ignored, fil... |
3235d8c8-91c5-46a4-b6ba-388fa3388aeb | 2 | public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Counting words");
int n = scan.nextInt();
String[] wordsStr = new String[n];
for(int i=0; i<n; i++)
{
wordsStr[i] = scan.next();
}
Arrays.sort(wordsStr);
for(int i=0; i<n; i++)
{
System.... |
4ac5c782-ce73-4b3b-b193-a2654274aa7b | 0 | @Override
public void setValue(Object o) {
this.nativeValue=convertObject(o);
} |
e82f28f2-7f2d-455d-a694-e20f11389846 | 8 | private void method98(Entity entity)
{
if(entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527))
{
int i = entity.anInt1548 - entity.anInt1547;
int j = loopCycle - entity.anInt1547;
int k = entity.anIn... |
2091a822-62d6-47d0-a32f-99dd71642edf | 3 | public static boolean run(CommandSender sender, boolean isPlayer, String[] args, Logger log) {
if (!isPlayer){sender.sendMessage(notPlayer);return false;}
Player p = (Player)sender;
Location to = p.getLocation();
for (Player v : Bukkit.getOnlinePlayers()){
if( !p.hasPermission(Utils.exemptPerm) | !v.getDi... |
29c157c7-c7c8-400e-b5a8-c2cfa0c778cc | 6 | private void displayScore() {
System.out.print("Final score: ");
int scoreSum = 0;
for (int i = 0; i < deckPlayedArray.length; i++) {
scoreSum += deckPlayedArray[i].getCardCount();
}
System.out.println(scoreSum);
System.out.print("Overall impression: ");
if (scoreSum <= 5) {
System.out.println("Horr... |
ef373f2d-a2b3-4774-bb2b-b264433a1e5a | 6 | public String expand(String text)
{
boolean b = true;
String[] s = text.split("(?!^)");
for(int i = 0; i < s.length; i++)
{
if(s[i].equals("_"))
{
if(b)
{
s[i] = "<i>";
b = false;
}
else
{
s[i] = "</i>";
b = true;
}
}
else
if(s[i].equals("*"))
... |
9d0cabf2-d912-4a51-93ca-9cbfe9cba99f | 2 | public void start() {
if (t == null) {
t = new Thread(this);
threadSuspended = false;
t.start();
} else {
if (threadSuspended) {
threadSuspended = false;
synchronized(this) {
t.notify();
}... |
6d359aee-f9e2-4550-86f5-1375688035f2 | 7 | public final void performAStarTime(int start, int stop, JPFMap map){
//initialize
if (map==null) return;
Node node = new Node(null, start, map, stop);
PriorityQueue<Node> open = new PriorityQueue<Node>();
//search & visualisation phase
while(node.val != stop){
... |
faf3dfdd-6e0a-4e4e-b88b-de1e7e5a9d51 | 2 | public void printShortestPath() {
int vertex = 0;
int nextV = 0;
Iterator<Integer> it = shortestPath.keySet().iterator();
while (it.hasNext()) {
vertex = it.next();
System.out.print(vertex + ":");
LinkedList<Integer> pathV = shortestPath.get(vertex);
for (int i = 0; i < pathV.size(); i++) {
nex... |
2aed1f53-6f1f-4f52-83fe-b0565332e945 | 9 | private boolean dataEquals( Arc otherArc )
{
char[] data1 = getData();
char[] data2 = otherArc.getData();
if ( (data1==null&&data2!=null)||(data1!=null&&data2==null) )
return false;
else if ( data1==null&&data2==null)
return true;
else if ( data1.length != data2.length )
return false;
else
{
... |
f01839fe-4c76-4997-bcc4-b33434ff4bcc | 6 | private boolean isValid(Node node) {
if (node.x < 0 || node.y < 0 || node.x >= width || node.y >= height)
return false;
else {
if (isInInvalidArray(node))
return false;
else {
if (isInClosedArray(node))
return false;
else return true;
}
}
} |
26f51f05-f662-4afa-9f63-b4eb81a00430 | 1 | public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x)
throws JSONException {
JSONArray ja = rowToJSONArray(x);
return ja != null ? ja.toJSONObject(names) : null;
} |
bed8a1f6-7f4e-48bf-bd59-c59be47df928 | 2 | public void buildMapBuffer()
{
Scene SelectedScene = Scenes.get(SceneIndex);
BufferedImage MapBuffer = new BufferedImage(SelectedScene.getSize().getWidth(), SelectedScene.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) MapBuffer.getGraphics();
for(... |
efe474e5-51d5-41a0-88f4-77690c73f14d | 6 | private void findNearest(double[][] dataset, double[] query, int[] matches,
int nn, int skip, Metric metric) {
int n = nn + skip;
Integer[] match = new Integer[n];
Double[] dists = new Double[n];
dists[0] = metric.distance(dataset[0], query);
match[0] = 0;
int dcnt = 1;
for (int i = 1; i < dataset.le... |
c8fab57b-dabb-45e0-8c03-a6077d90af8f | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CustomCategoryURLGenerator)) {
return false;
}
CustomCategoryURLGenerator generator = (CustomCategoryURLGenerator) obj;
int listCount = getList... |
f2a34fcc-15be-4e7d-837c-de8a4c8066ef | 6 | public static void main (String args[]) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int m = Integer.parseInt(reader.readLine());
String currentOperation;
int currentNumber;
boolean isSuccess;
for (int i=0; i<m; i++) {
isSuccess = true;
int n = Inte... |
798fb3ae-af52-47f9-986c-4974b12b36e4 | 6 | private void printResult(PDFInfoHolder pdfInfoHolder)
{
if(pdfInfoHolder.isDifferent() && pdfInfoHolder.getDifferent() != DifferenceType.MISSINGDOCUMENT)
{
String differencesOnPage = "";
for (PDFPageHolder pdfPageHolder : pdfInfoHolder.getPDFStructure1().getPageHolders()) {
// get counter part pdf ... |
533dc4b4-09da-48b3-a6a5-822483ebf9ae | 3 | public List<LoginEntry> readLoginsDate(String date) {
List<LoginEntry> retList = new ArrayList<LoginEntry>();
try {
ResultSet rs = _sqLite.query("SELECT login.*, player.playername as playername FROM player, login "
+ "WHERE player.id = login.id_player "
+ "AND date(login.time_login) = '" ... |
8b4e805c-e435-4653-aa65-966f3e2367bf | 8 | @Override
public boolean validate(MessageCollector collector, IssueForm target) {
boolean result = true;
if (!newIssue) {
if (!visitor.isGranted(Permission.EDIT_ALL)) {
if (visitor.isGranted(Permission.EDIT_SELF)) {
if (!visitor.equals... |
eec8351c-f103-440c-a45f-4659925a0ca3 | 1 | public static void spawnSkeletonWarriorDiamond (Location loc, int amount) {
int i = 0;
while (i < amount) {
Skeleton SkeletonWarriorIron = (Skeleton) loc.getWorld()
.spawnEntity(loc, EntityType.SKELETON);
SkeletonWarriorIron.getEquipment().setChestplate(
... |
cfa9ff91-0f9b-422b-bd81-38f7a3bf8eae | 7 | private void updateAndClose(final String initials) {
if (!closing && getDate() != null) {
closing = true;
try {
Connection conn = MySql.getConnection();
PreparedStatement statement = conn.prepareStatement(MySql.OPENING_COUNT_UPDATE);
final ... |
37dbc326-e3f4-4777-bfe8-4a882396baad | 1 | public TankConnect(Socket socket,int id){
this.socket = socket;
String idString = ""+id;
this.id = id;//Ϊ˺ͶӦ̹idƥ
try {
// oos = new ObjectOutputStream(this.socket.getOutputStream());
// ois = new ObjectInputStream(this.socket.getInputStream());
// oos.writeObject(idString);
// oos.flush();
in = new B... |
b2047c50-0e41-4e18-802d-874b8df05f6c | 0 | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
System.out.println("==start Element");
} |
065a2906-65b0-4f1a-9f2d-29810074ea79 | 5 | protected void agregarEnJuego(){
final Disparo controllerDisparo = this;
Color color = Color.BLUE;
switch(this.tipo){
case CONVENCIONAL:
color = Color.BLUE;
break;
case MINA_SIMPLE:
color = Color.GREEN;
break;
case MINA_DOBLE:
color = Color.RED;
break;
case MINA_TRIPLE:
col... |
96c43925-685b-43d5-ad19-cf7cc6268650 | 3 | private double calculateFinishTime(Packet np, double nextTime)
{
double time = 0;
double ratio = 0;
try
{
int type = np.getNetServiceType();
if (type >= weights.length) // out of bound array error checking
{
System.out.println(na... |
7d2535e7-93df-4f54-89db-0475582e8983 | 3 | public File getEnclosingFile() {
if(getParent()==null)
return null;
if(MediaTag.class.isAssignableFrom(getParent().getClass()))
return ((MediaTag)getParent()).getEnclosingFile();
if(MediaFile.class.isAssignableFrom(getParent().getClass()))
return ((MediaFile)g... |
8a3e72e2-7da4-4d56-8e3c-2b6651401fdd | 6 | private void handlePageElement(Attributes atts) {
int i;
//Size
int width = 0;
int height = 0;
if ((i = atts.getIndex(ATTR_width)) >= 0) {
width = new Integer(atts.getValue(i));
}
if ((i = atts.getIndex(ATTR_height)) >= 0) {
height = new Integer(atts.getValue(i));
}
page.getLayout().setSize(wid... |
571ca3d4-2a84-4c57-b8e3-8b45c1d54667 | 0 | @Override
public PropertyFilter removeFilter(int index) throws IndexOutOfBoundsException {
return (PropertyFilter) filters.remove(index);
} |
79f15885-409a-4622-9a1c-2f208aff2a9f | 5 | public int compareTo(JixelEntity e) {
if (e == null) {
return -1;
}
if (e.getY() + e.getOriginY() > getY() + getOriginY()) {
return -1;
} else if (e.getY() == getY()) {
if (e.getX() + e.getOriginX() > getX() + getOriginX()) {
return -1;
} else if (e.getX() == getX()) {
return 0;
}
retu... |
f48156b5-6595-4914-bf8d-829162709541 | 8 | public PrimitiveOperator combineRightNRightOnMid(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 2 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[1]) ? 2 : 0) | 1]; //001
newTruthTable[2] = truthTable[((... |
30d2f6fe-30d1-4476-85bf-268ef0283ece | 4 | @Override
public void messageReceived(MessageEvent arg0) {
final String msg = arg0.getMessage().toLowerCase();
if (msg.contains("you carefully cut the root into 5 sagaie shafts.")) {
sagaieMade = sagaieMade + 5;
}
if (msg.contains("you chop some logs. the heat of the inferno adze incinerates them.")) {
bu... |
f8a95a95-f47a-4297-aaae-81106ac701ad | 6 | boolean isInCycle(int theX, int theY, Cycle c){
int count = 0;
int detVirt;
int j;
Integer[] l = new Integer[c.vxList.size()];
c.vxList.toArray(l);
for(int i=1; i<l.length; i++){
j = (i==l.length-1 ? 0: i);
detVirt = det(vertices[l[i]].x,
vertices[l[i-1]].y,
vertices[l[i]].x,
vertice... |
07ab9282-9a06-42f8-9235-cd6038dcc62b | 6 | public static boolean encodeFileToFile( String infile, String outfile )
{
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try{
in = new Base64.InputStream(
new java.io.BufferedInputStream(
... |
b9b3ccbd-4cd5-418c-bac6-f3b8c30faefc | 3 | public void configure(Configuration conf) throws ConfigurationException {
String portString = conf.getProperty("broadcastTCPServerInputConnector.port");
if(portString == null)
throw new ConfigurationException("broadcastTCPServerInputConnector.port not specified");
try {
port = Integer.parseInt(portString);
... |
89f1a066-a688-4ee2-be12-c2f2f66d608f | 8 | public char[][] loadMap(FileInputStream fis)
{
char[][] map = new char[length][width];
try{
byte[] buf = new byte[8];
int i = 0;
int j = 0;
char a = ' ';
while (fis.read(buf) >= 0){
for (byte bit : buf){
a = ((char)bit);
if (bit == 10){
i++;
j =... |
9665eba5-a8c4-4f49-9b14-00b10b181f2a | 9 | public void merge(int A[], int m, int B[], int n) {
if (A == null || B == null) {
return;
}
int total = m + n;
int indexA = 0;
int indexB = 0;
int[] c = new int[total];
for (int i = 0; i < total; i++) {
if (indexA < m && indexB < n) {
... |
e5d2720f-1a78-40fb-a79a-98325fbab936 | 9 | @Override public boolean equals(Object obj) {
if (this.getClass() != obj.getClass())
return false;
Triple<?, ?, ?> other = (Triple<?, ?, ?>) obj;
return (this.getX().equals(other.getX())
&& this.getY().equals(other.getY())
&& this.getZ().equals(other.getZ()));
} |
1cbbf543-140d-45ca-8e58-898686cad24d | 4 | public void initializeUserFriends() {
userFriends = new TreeMap<Integer, HashSet<Integer>>();
for (int i = 0; i < friends.length; i++) {
if (friends[i][0] == friends[i][1]) { // User with no friends
HashSet<Integer> hs = new HashSet<Integer>();
userFriends.put(friends[i][0], hs);
} else { // User with... |
f687c107-8706-4c6f-a855-4346a09b1f13 | 8 | private static void calcNrMines(char[][] m, int r, int c) {
int rowEdgeIndex = m.length - 1;
int colEdgeIndex = m[0].length - 1;
if (c == 0) {
if (r == 0) { // top left corner
m[r][c] = getNrMinesCornerCase(m, r, c, 1, 1);
} else if (r == rowEdgeIndex) { /... |
0d1204f8-ff80-405d-bf40-1e3455340eaa | 5 | @Test
public void testGetAuthor() throws Exception {
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/librarysystem?user=admin&password=123456");
Statement st = conn.createStatement();
ResultSet rs = null;
try {
//Unmatched isbn
ArrayList<Author> auths = bh.getAuthors(0L, st, rs);
... |
7bac8f1c-4712-4035-abdc-5f1bb213ed53 | 0 | private Being getClosestBeing(ConditionChecker checker) {
return WorldPhysics.getClosestBeing(myBeing.getPosition(), myBeing.getSurroundingBeings(), checker);
} |
d52eaf0e-3c11-4307-bdec-de3d775ad362 | 1 | public void connectDb() {
startSQL();
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url, user, password);
st = con.createStatement();
} catch (Exception e) {
e.printStackTrace();
... |
fef6caac-cbea-45b3-ba34-4925485bdb59 | 8 | @Override
public List<AdminCol> getColList(String tblNm) {
log.debug("get column list for table = " + tblNm);
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
ArrayList<AdminCol> list = new ArrayList<AdminCol>();
StringBuilder sql = new StringBuilder();
sql.append(" sel... |
c9ac3368-57eb-4162-8d70-fc3b1acd481e | 2 | public ArrayList<Path> getAudioListFromPath(String pathStart) {
final ArrayList<Path> audioList = new ArrayList<Path>();
final MimeUtil2 mimeUtil = new MimeUtil2();
mimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
Path pathToScan = Paths.get(pathStart);
try{
Files.walk... |
2002eb5f-556f-4a21-9e1c-5aa123fc9128 | 0 | public AnnotatedHandlerBuilder<Constructor> handleConstructor()
{
return this.handleElement( Constructor.class );
} |
29095054-f99e-4db4-84db-d3a4cb4769aa | 8 | public static CodexTokenList parseSecondLevel(CodexTokenList list) {
CodexTokenList result = new CodexTokenList();
while (list.hasNextToken()) {
TokenInfo t = list.getNextToken();
if (t.getToken() == Tokens.STRING_VALUE) {
if (t.getTokenData().toString().equals("if")) {
result.addToken(new Toke... |
cd128063-a908-4318-8658-e774597e82a7 | 9 | public int nextInt() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
int result;
if (p == PEEKED_LONG) {
result = (int) peekedLong;
if (peekedLong != result) { // Make sure no precision was lost casting to 'int'.
throw new NumberFormatException... |
cf2a06a5-26dd-4f8f-bd65-ba0203461571 | 6 | public String toString() {
StringWriter ret=new StringWriter();
String typeName;
if (type==EVENT_READYSTATE) typeName="ReadyState";
else if (type==EVENT_MESSAGE) typeName="Message";
else if (type==EVENT_ERROR) typeName="Error";
else typeName=String.valueOf(type);
ret.write("<Event ");
ret.ap... |
e2503de3-bcf1-4e07-893b-641f00c69877 | 7 | private JsonArray jArray() throws MalformedJsonException{
JsonArray ret = new JsonArray();
while(true){
if(current==']'){
next();
sqBracketNum--;
return ret;
}
ret.add(jValue());
begin:
while(true){
switch(current){
case ',':
next();
break begin;
c... |
484668ef-8185-4c16-840c-021f5aeb2262 | 8 | public boolean searchAux(int[] A, int target, int low, int high) {
if (low > high) {
return false;
}
//divide into two parts
int mid = (low + high) / 2;
//find the target
if (A[mid] == target) {
return true;
}
//search in each pa... |
78875de7-979f-497f-8e49-78a9c1900ee5 | 1 | void setEnableControls(boolean enable) {
runButton.setEnabled(enable);
stopButton.setEnabled(!enable);
saveButton.setEnabled(enable);
if (!isGroovy()) {
buildButton.setEnabled(enable);
logLabel.setEnabled(enable);
syslogCombo.setEnabled(enable);
... |
08d5517b-0732-4431-b86a-8e14a0a76f4c | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof Room)&&(numDone<numMax))
{
final Room R=(Room)affected;
DeadBody B=null;
for(int i=0;i<R.numItems();i++)
{
final Item I=R.getItem(i);
if((I instanceof DeadBody)
&&(I.container()==null)
... |
02969d2b-1957-49a5-b8e9-fc5a03787f27 | 2 | public Value<?> put (final String key, final Value<?> val) {
return value.put(key, val);
} |
50ea6140-5fee-44b3-bc53-9652b05aeec0 | 9 | public Vector<TSCall> getTSCalls() {
Vector<TSCall> tsCallVector = new Vector<TSCall>();
Vector<TSCall> tsDevCallVector = null;
waitToInitialize();
for (int i = 0; i < this.tsMonitorableDevices.size(); i++) {
tsDevCallVector = doCallSnapshot((String) this.tsMonitorableDevices
.elementAt(i));
if (t... |
efc4fde6-ccce-469d-aad4-7696e5131cc5 | 3 | public static void move(int column) {
switch(column){
case 0:
cell0 = MainClass.currentXorO + "|";
break;
case 1:
cell1 = MainClass.currentXorO;
break;
case 2:
cell2 = "|" + MainClass.currentXorO... |
e6bc3de6-5c13-4776-8d9a-4305da3a1c47 | 1 | public static CustomCommandsWindow getInstance() {
if (instance == null)
instance = new CustomCommandsWindow();
return instance;
} |
1d520c75-dc15-4632-abfd-19fc6898f6f4 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
4d516c94-e507-41ea-a42e-a9bc718d11c2 | 5 | public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
TreeMap<String, TreeMap<String, Integer>> users = new TreeMap<>();
for (int i = 0; i < n; i++) {
String[] userInput = scan.nextLine().split(" ");... |
25d576cf-492b-4bc9-8a56-4dcc0c64fd44 | 0 | public boolean isFull() {
return this.carList.size() >= this.totalNum;
} |
f1650b7f-51b6-49e9-906a-e4bff4e630b2 | 4 | protected static void leertodo(){
try {
ObjectInputStream dataIn = new ObjectInputStream(Files.newInputStream(path));
while(true ){
Product product=(Product) dataIn.readObject();
System.out.println(product.toString());
}
}catch(EOFException e){
System.out.println("Fin de fichero"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.