method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6a97fa2c-e0df-4c58-bfa4-116b0b4cbea6 | 2 | public Double getDouble(String key)
{
Object val = get(key);
if (val == null)
return null;
else if (val instanceof Double)
return (Double)val;
else
return ((Integer)val).doubleValue();
} |
db6b675e-3af0-46ed-ad25-94838a8605bd | 9 | public static Class<?> wrapperEquivalentOf(Class<?> aClass)
{
Iterator<Map.Entry<Class<?>, Class<?>>> it = objectToPrimitiveMap
.entrySet().iterator();
while (it.hasNext())
{
Map.Entry<Class<?>, Class<?>> entry = it.next();
if (aClass.equals(entry.getValue()))
return (Class<?>) entry.getKey();
}
... |
8c5c2f6e-c095-423d-a434-9a2c42686491 | 6 | public double score(StringWrapper s0, StringWrapper t0) {
SourcedStringWrapper s = (SourcedStringWrapper)s0;
SourcedStringWrapper t = (SourcedStringWrapper)t0;
checkTrainingHasHappened(s, t);
UnitVector sBag = asUnitVector(s);
UnitVector tBag = asUnitVector(t);
List<Simil... |
6c4049f5-ad4f-403d-9788-46372d4da733 | 5 | public void run() {
try {
while (isMultiplayerGame()) {
int id = inputStream.readInt();
IPacket packet = PacketList.instance.getPacketFromID(id);
if (packet != null){
if (!packet.isServerPacket() || packet.isClientPacket()){
... |
16a6cd8c-6eb6-444d-856f-4fbca0bdc93e | 4 | private void connectToFtpServer() {
FTPClient client = new FTPClient();
try {
client.connect("ftp.site.com");
boolean login = client.login("username", "password");
if (login) {
System.out.println("Connection established...");
// Try to ... |
b3b52b03-56f0-4d6d-9de9-2f1a41e0ec23 | 0 | public AbstractPlay get(int number) {
return plays.get(number);
} |
05e5c07d-3656-48d6-8e80-3cfce7ad1cc2 | 7 | public void paintElement() {
this.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
switch (sItem) {
case rect:
currentObject = new Rectangle();
break;
case oval:
currentObject = new Oval();
break;
case polygon:
drawPolygon(e);
return;
... |
70995691-3fe0-432c-973d-f4a8546304ff | 4 | public void move(Direction d) {
int x = coord.getX();
int y = coord.getY();
switch(d) {
case NORTH:
coord.setY(y-1);
break;
case SOUTH:
... |
694c8a98-34ed-4064-a3a0-b83ce8470156 | 1 | public boolean InsertarAfecta(Afecta p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
1fd5287a-1b2f-4dd8-aa51-ff76341be1bd | 1 | public static String toHexString(String input) {
try {
byte[] bytes = input.getBytes(Torrent.BYTE_ENCODING);
return Torrent.byteArrayToHexString(bytes);
} catch (UnsupportedEncodingException uee) {
return null;
}
} |
afff9524-1f8b-4126-9af5-6df3d2c27f22 | 5 | @Override
public void act(){
Quest testQuest = player.questList.getQuest("TestQuest");
String speech;
if (testQuest == null) {
testQuest = new TestQuest(stateManager, player);
player.questList.add(testQuest);
testQuest.step = "Start";
}
if (testQuest.step.equal... |
c65b2300-b899-41aa-9c26-694f6eb01ad2 | 7 | public double GetCameraTime(int CameraIPIndex) {
if (Parent.GetNoCameraParameter()) {
return 0;
}
URLConnection conn = null;
BufferedReader data = null;
String line;
String result;
StringBuffer buf = new StringBuffer();
URL CommandURL = null;
... |
f1db38cd-71d6-44d2-8784-a86ca565b14b | 9 | @Override
public ElementHandler createHandler(String name) {
if ("material".equals(name)) {
return new MaterialBuilder(context, new FinishCallback<Material>() {
@Override
public void handle(Material value) {
SceneObjectsBuilder.this.context.pu... |
ac5e0073-d360-4270-abb3-16e6824a78fd | 9 | public long set(int desde, int hasta, long newValue) {
if(flag)
propagar(setValue);
if(desde==cotaDesde&&hasta==cotaHasta) {
propagar(newValue);
}
else {
if(izq!=null&&izq.cotaDesde<=desde&&izq.cotaHasta>=hasta) {
//CHANGE FUNCTION
value=izq.set(desde, hasta, newValue)+der.get(der.cota... |
67104f90-e8de-49fc-af97-71fa9b39224c | 8 | public int canCompleteCircuit(int[] gas, int[] cost) {
if (gas == null || cost == null || gas.length == 0 || cost.length == 0 || gas.length != cost.length) {
return -1;
}
//sum after reach every station
int sum = 0;
//start position, will be change later if possible
... |
312a9177-ba62-4005-b500-c982a2418561 | 3 | public char squareContentSprite(final int x, final int y) {
char result;
final Pawn content = getSquareContent(x,y);
if (content == null) {
if (isBonusSquare(x, y)) {
result = '#';
} else
result = '.';
} else {
if (conte... |
c43b9790-2316-4d74-8bb1-86f17fb74b0f | 6 | * @param e
*/
public static void ride(Player p, Entity e) {
if (e instanceof Creature) {
((Creature) e).setTarget(null);
}
if (e.getType() == EntityType.ENDER_DRAGON) {
EnderDragon dr = (EnderDragon) e;
dr.setPassenger(p);
p.sendMessage(RideThaMob.cprefix + Lang._(LangType.RIDE_DRAGON));
return... |
58d14d1e-c618-494e-b5f1-366c75f07b0f | 1 | public int hashCode() {
if (cachedHash != 0xdeadbeef)
return cachedHash;
int[] bounds = new int[2];
this.nonTrivial(bounds);
return cachedHash = buffer.substring(bounds[0], bounds[1]).hashCode();
} |
68df5311-48c1-4ddb-aca2-ca61af4e096e | 8 | public static void main (String args[]) throws InterruptedException
{
int n = 50;
int timeMS = 10000;
boolean prio = true;
for (int i = 0; i < args.length; i++)
{
if (args[i].equals("-n"))
n = new Integer(args[++i]).intValue();
else if (args[i].equals("-p"))
prio = args[++i].charAt(0) != '0';
... |
2a677e69-69bc-4fdd-8090-7bee7597a8ca | 9 | public void Checkwhile(String cond){
if(new_flag==2){
current_register--;
}
new_flag=0;
current_label++;
TypeTable.put(current_register,current_element.E_type);
if(cond.equals("TRUE")){
AddOperation("STOR... |
a1703396-62f5-40da-aaf5-2b9fab800a53 | 9 | private void helper() {
int N = r.nextInt(199) + 2;
List<Vertex> G = new ArrayList<Vertex>(N);
for (int i = 0; i < N; i++) {
G.add(new Vertex(i));
}
boolean[][] connected = new boolean[N][N];
int numEdges = r.nextInt(N * (N-1)+1);
for (int i = 0; i < ... |
90016d6b-cd25-41b0-ab53-8e1fcfbc04a9 | 3 | public static String arrayToString(Double[][] array) {
String result = "";
int n = array.length;
result += n + "\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
result += array[i][j];
if (j + 1 != n) {
result += ",";
}
}
result += "\n";
}
return result;
} |
623b74c6-df3f-4bf1-b0aa-b22b7f794bb7 | 8 | public Location getFirstSquareNeighborLocation(int row, int col, int dist,
int id) {
for (int x = row - dist; x <= row + dist; x++) {
if (isInBounds(x)) {
for (int y = col - dist; y <= col + dist; y++) {
if (isInB... |
7c76aed5-21a8-48d7-a830-006d47ca58e2 | 4 | public void reproduce(PokemonTeam parent1, PokemonTeam parent2, int rankFit)
{
ArrayList<Pokemon> totalPokes = new ArrayList<Pokemon>();
for (int y =0; y< rankFit; y ++)
{
PokemonTeam child = new PokemonTeam();
child.removeAll2();
ArrayList<String> circum... |
d76de5f9-c1d6-462b-99d4-aa9779dfa6bb | 9 | @Override
public void keyReleased(KeyEvent keyEvent) {
if (keyEvent.getKeyCode() == KeyEvent.VK_P) {
bPausa = !bPausa;
}
if (keyEvent.getKeyCode() == KeyEvent.VK_I) {
if (!bInicio) {
bInicio = true;
sonSelect.play();
sonIntr... |
003661c6-1961-436e-8746-5127b6373647 | 5 | public void put(int key, int value) {
HashPrinter.tryPut(key, value);
/** Index that moves through array slots */
int runner = 0;
int hash = (key % table.length);
if (table[hash] == null) {
table[hash] = new Node(key, value);
HashPrinter.successfulInsertion(key, hash);
size++;
} else {
/... |
bcd69bb4-c771-4b9a-991d-2851d542acad | 7 | private String techLevel(int t) {
switch (t) {
case 0:
return "Pre-Agriculture";
case 1:
return "Agriculture";
case 2:
return "Medieval";
case 3:
return "Renaissance";
case 4:
... |
2dcb0586-142f-4df4-a184-ce38212a9b1f | 3 | public void update(double dt, Snake[] snakes) {
timer += dt;
if (timer > PELLET_TIMER) {
generatePellet();
timer -= PELLET_TIMER;
}
for (int i = bullets.size()-1; i >= 0; i --) {
bullets.get(i).update(this, snakes, dt);
if (bullets.get(i).isFinished()) {
bullets.remove(i);
}
}
} |
da391a0b-b7e6-4d7e-85f0-99bd5671b65d | 6 | public final void skipWS() {
byte ch;
while (pos < length) {
ch = src[pos];
if ((ch != 0x20) && (ch != 0x09) && (ch != 0x0A) && (ch != 0x0D) && (ch != 0x00)) {
break;
}
pos++;
}
} |
a6fc2593-dad2-4131-8493-a2c10591394c | 5 | protected String removeSurroundingSpaces(String html) {
//remove spaces around provided tags
if(removeSurroundingSpaces != null) {
Pattern pattern;
if(removeSurroundingSpaces.equalsIgnoreCase(BLOCK_TAGS_MIN)) {
pattern = surroundingSpacesMinPattern;
} else if(removeSurroundingSpaces.equalsIgnoreCase(BL... |
c8148ef4-521f-40eb-8e78-23a4fc9020ce | 2 | @Override
public void onMessage(String channel, String message) {
if (_callbacks.containsKey(channel)) {
for (ClientEventCallback callback : _callbacks.get(channel)) {
callback.setMessage(channel, message);
_pool.execute(callback);
}
}
} |
f0cf06d4-9385-4e46-b20f-57db640608be | 8 | public static void main(String[] args) throws Exception {
if (args.length < 1 || args.length > 2) {
System.out.println("[ERROR] Incorrect number arguments");
return;
}
if (args[0].equals("ArrayQueue")) {
if (args.length < 2 || args[1].equals("")) {
... |
ee23ba73-1764-4961-ad8d-04ca07e9c9cf | 4 | public Resource getClosest(Point p) {
Resource resource = null;
Resource closestResource = null;
double closestDistance = 0;
try {
for (String key : resources.keySet()) {
resource = (Resource) resources.get(key);
double distance = p.distance(... |
44450a8a-350b-4e02-ba6a-a64a0703102d | 7 | private void actionOptimise()
{
Object[][] data = ((MyTableModel)(tableContainer.getTable().getModel())).getData();
if (data.length > 1 && mapScrollPane.isCreated())
{
ArrayList<House> houses = new ArrayList<House>();
for (int i = 0; i < data.length - 1; i++)
{
System.out.println(data[i][2]... |
988c1e00-b3b8-42bc-bb5d-43f90fd42eed | 3 | @Test()
public void whiteBoxTestQuadTree() {
/* WHITE BOX QUADTREE TEST.
*
* We want to create a QuadTree with the following parameters:
* Length: 800.
* Number of QuadTrees: 16 (See below for ASCII 'art').
* Number of Points in each: (Check ASCII).
* T... |
e1ba96e6-e699-4bfb-9f08-549ab3878397 | 8 | public void locateAllSubTrees(Vertex v, double radius, double offSet) {
if (placedVertices.contains(root)) {
double angularSpan = (Double) v.getProp().obj;
int numberOfDivides = 1;
numberOfDivides = g.getOutDegree(v);
if (numberOfDivides == 0) {
re... |
e024721a-42ae-40f9-a441-e10ad422dd80 | 3 | public int getPreferredColumnWidth(TreeColumn column) {
Dimension size = column.calculatePreferredHeaderSize(this);
boolean isFirst = column == mColumns.get(0);
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
int width = column.calculatePreferredWidth(row);
if (isFirst) {
width ... |
4971b1dd-cd46-4662-bdb2-4a74e4eef714 | 5 | public void store(String id) {
Ident ident = Yaka.tabident.chercheIdent(id);
if (ident != null) {// l'ident existe var_param_const
if (ident.isVar()) {// ident est une variable
int type = this.type.peek();
String t;
t = this.typeToString(type);
if (type == ident.getType()) {// teste si l'expressi... |
58c98567-66d3-42e5-8cbc-33cc2005ec67 | 8 | @SuppressWarnings("unchecked")
public static <K> ArrayList<K> getObjectArray(JSONArray jsonArray, Class<K> clazz)
{
K[] result = (K[]) Array.newInstance(clazz, jsonArray.length());
for (int i = 0; i < jsonArray.length(); i++) {
try {
result[i] = clazz.getConstructor(J... |
9c71ce8c-7eb7-4788-a9c3-994f466dd8cd | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HandlerType that = (HandlerType) o;
if (event != null ? !event.equals(that.event) : that.event != null) return false;
i... |
d340a6d7-709f-4c45-a452-051dbf2491d2 | 3 | public boolean addCommentToSpecificPost(Comment comment) {
{
/*
* function gets an POST ID of the specific comment we want to add and the user name
* we make sure to update the number of comments we have i that specific post
* we update also the number of posts this user have plus 1
* we save all t... |
ea88d54d-dbaa-41f3-a7af-70a2361d1661 | 5 | public static void maxHeapify(int[] A, int i, int heapSize){
int left = i*2+1;
int right = left+1;
int largest = i;
if(left < heapSize && A[left] > A[i]){
largest = left;
}
if(right < heapSize && A[right] > A[largest]){
largest = right;
}
if(largest != i){
//exchange x and y
A[i] = A[... |
1017b25c-998b-49fb-ae83-c46a5de3c0d6 | 4 | public static boolean canSell(String uid, String id, int amount) {
if(checkUserExistance(uid))
{
stocks = UserControl.getUserStock(uid);
if(!stocks.isEmpty())
{
if (stocks.containsKey(id)) {
if (stocks.get(id) >= amount) {
return true;
}
}
... |
b2a018ee-bf44-4242-aa75-5e80355f71ac | 4 | public List<urlObj> parseH5Urls(selectObj selectObj, urlObj urlObj) throws IOException {
Document doc = Jsoup.connect(urlObj.getUrl()).get();
Elements elements = doc.select(selectObj.getDocumentSelect());
List<urlObj> list = new ArrayList<urlObj>();
System.out.println("Fetching : " + ur... |
2cc92afa-7161-45bd-ab13-26b03a61aa10 | 1 | public void subtractGold(int goldloss) {
gold -= goldloss;
if ( gold < 0)
gold = 0;
} |
e6baf897-8afa-4f27-8e19-2f7c95896b9e | 5 | public void consultar(String chave) {
int indice = chave.hashCode();
Nodo nodoAux = raiz;
while (nodoAux.indice != indice) {
if (indice > nodoAux.indice) {
if (nodoAux.direita.indice == indice) {
System.out.println("Pai: " +nodoAux.direita.pai.conteudo + "\r\n" + "Conteudo: "+ nodoA... |
9d152881-7418-4945-b14e-d6a1673363aa | 4 | public boolean Chk_RivalRate(String str){
boolean bl = false;
Integer num, len;
try{
bl = util.isNumric(str);
if (bl){
num = Integer.parseInt(str);
len = str.length();
if((util.isRange(num, 0, 10000) && util.isRange(len, 0, 4))){
bl = true;
}else{
bl = false;
}
... |
89093b9d-1180-48b8-a19b-ec5928666e42 | 6 | public static boolean CheckID (String s)
{ String [] tab=s.split ("");
if(tab.length==12 && "7".equals(tab[1]) && "0".equals(tab[2]) && "5".equals(tab[3]) &&"0".equals(tab[10])&& "1".equals(tab[11]))
{ System.out.println("ID correct");
return true;
}
else
{ System.out.println("ID incor... |
83203d11-8b19-4f5b-98da-731b961154f6 | 3 | private void refreshTable() {
if (modelInventory.getRowCount() > 0) {
for (int i = modelInventory.getRowCount() - 1; i > -1; i--) {
modelInventory.removeRow(i);
}
}
try {
populateTable();
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
73834570-e840-44bb-a136-c3eb8bd7e478 | 9 | @Override
public void detectRelationships(Obituary obit) throws Exception {
List<List<Term>> sentences = extractor.tagEntities(obit);
for (List<Term> sentence : sentences) {
sentence = EntityUtils.combineEntities(sentence);
chunker.addBIOChunks(sentence);
tagSentence(sentence);
Tree tree = getTree(sent... |
a46f13be-3891-4dbc-8996-70e0e9a78e13 | 6 | private boolean HandleCreatureCommand(String s) {
if (s.matches("^attack \\S+ with \\S+$")) {
// attack (creature) with (item)
String []words = s.split(" ");
String creatureName = words[1];
String itemName = words[3];
if (! inventory.contains(itemName)) {
System.out.println("Bad Command");
retu... |
3be8e661-85eb-430b-9a85-ef49856e383d | 3 | private static List<Shape> buscarParce(List<Shape> shapes){
List<Shape> shapeList = new ArrayList<Shape>();
for(Shape shape : shapes)
if (shape != null && shape instanceof ShapeParcela)
shapeList.add((ShapeParcela) shape);
return shapeList;
} |
55b2744a-c9a4-447b-a742-a91d81ee786d | 9 | private DBObject _create( List<String> path ){
Class c = null;
if ( _collection != null && _collection._objectClass != null){
if ( path == null || path.size() == 0 ){
c = _collection._objectClass;
}
else {
StringBuilder buf = new Stri... |
e9611fed-b8e7-42c6-8535-c6e214677efc | 8 | public void print_t37convert81(){
for (int i=0; i<t37convert81.length ; i++){
if (i==4||i==9||i==15||i==22||i==28||i==33||i==37) System.out.println();
System.out.print(t37convert81[i]+"\t");
}System.out.println();
} |
24782941-90f7-4646-a4b4-77145416b6d1 | 4 | @Override
public void doLogic() {
if (inputList[0] == true || inputList[1] == true || inputList[2] == true || inputList[0] == true){
power = false;
} else {
power = true;
}
inputList[0] = false;
inputList[1] = false;
inputList[2] = false;
inputList[3] = false;
} |
b3fa5277-24ae-4a68-9aea-a028ff36a6b1 | 8 | public ArrayList<Spielfeld> schritte(){
ArrayList<Spielfeld> result = new ArrayList<>();
if(linkerN != null && linkerN != Rand) result.add(linkerN);
if(rechterN != null && rechterN != Rand) result.add(rechterN);
if(obererN != null && obererN != Rand) result.add(obererN);
if(untererN != null && untererN != Ran... |
3c8a7c35-d8f4-4e6e-8422-fe806ee14649 | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 165
v_1 = limit - cursor;
// tomark, line 165
if (cursor < I_pV)
{
return false;
}
... |
7636bad5-0aa2-403d-bb29-6d019be61917 | 8 | @Override
public void keyPressed(KeyEvent ke) {
if(ke.getKeyChar() == 'c') {
lastTool = curTool;
curTool = 2;
} else if(ke.getKeyChar() == 'l') {
lastTool = curTool;
curTool = 3;
} else if(ke.getKeyChar() == 'f') {
lastTool = curTool;
curTool = 1;
} else if(ke.getKeyChar() == 'd') {
lastTo... |
d4092047-6928-48ab-a041-9c14a763e747 | 7 | @MCCommand(cmds = { "create" }, op = true, usage = PORT_CREATE)
public boolean portCreate(Player p, String name, String[] args)
{
Port port = pc.getPort(name);
if (port != null)
{
return sendMessage(p,
"&4There is already a port with that name. Please pick a unique name.");
}
Selection sel = wep.get... |
bbcbfac1-478e-42c0-86bc-f73a103c14f8 | 4 | public static boolean isBorderLegal(int width, int height) {
if (width < 11 && width > 6 && height > 6 && height < 11) {
return true;
} else {
return false;
}
} |
2a69ce25-1caf-4520-b0f8-f22cfc06740f | 4 | @Override
protected void setAttrs(Post model, PreparedStatement stmt) throws SQLException {
if (model.getTitle() == null) {
stmt.setNull(1, java.sql.Types.CHAR);
} else {
stmt.setString(1, model.getTitle());
}
if (model.getPostedAtMillis() == null) {
stmt.setNull(2, java.sql.Types.DA... |
0e2e57cb-8b96-4b60-a5ab-38d36bcc699b | 9 | public void run() {
while (true) { // sempre esperando
if (waiting) {
try {
int myColor;
int itsColor = Piece.cNeutral;
serverSocket = new ServerSocket(waitingPort);
socket = serverSocket.accept();
client.writeMessage(3, "INFO: \"" + socket.getInetAddress() + ":" + socket.getPort() + ... |
c8eaffbd-af1b-4223-b473-05204b34298f | 1 | public String logout() {
if(session.containsKey(USER_OBJ))
session.remove(USER_OBJ);
return SUCCESS;
} |
7fb0ab39-78ee-4b80-af67-e4fb06f2f8d4 | 9 | public void actionPerformed(ActionEvent event)
{
// System.out.println(event);
ArrayList<JTextField> fields = parent.getFields();
String msg = "";
//check the first text field
if (!fields.get(0).getText().equals(""))
{
ButtonGroup bg = parent.getButtons();
Enumeration<AbstractButton> buttons = bg.ge... |
ff6b9a87-47a0-4245-90a2-ed3c15b04eb2 | 3 | @SuppressWarnings("unchecked")
@Override
public void process(final Exchange exchange) throws Exception {
final List<JUGSession> listOfSessions = new ArrayList<JUGSession>();
exchange.getIn().setBody(null);
// Récupération de l'entityManager
final EntityManager em = EntityManagerUtil.getEntityManager();
fi... |
bb3d9e46-1133-42db-be83-4a35685be35d | 1 | public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.err.println(
"Usage: java RFS862_UdpClient <destination host> <destination port>");
System.exit(1);
}
//get the dest host + port from console
String dest_h... |
ea4354a9-2302-45c7-bd47-8cd3565af947 | 4 | public void update() {
up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
C = keys[KeyEvent.VK_C];
R = keys[K... |
05385383-411d-4554-b04c-7db42380c233 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PreparedStatementKey that = (PreparedStatementKey) o;
if (!sql.equals(that.sql)) return false;
if (!mappedStatement.equ... |
8b8e7cdf-9150-401b-8556-e143d6997e42 | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenB... |
9fda2426-e132-4f3d-ac7c-777e91cc003c | 1 | private boolean jj_2_11(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_11(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(10, xla); }
} |
53387cd2-74cc-4f0d-8b95-ac0f18687f91 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PosRecibeDePosEntityPK that = (PosRecibeDePosEntityPK) o;
if (prpIdElemento != that.prpIdElemento) return false;
if (prpMoaConsec != that.prpMo... |
e867e9a5-80af-4c22-ab87-839b96ddebb1 | 5 | public int[] searchRange(int[] A, int target) {
int i = 0;
int j = A.length - 1;
int[] results = {-1, -1};
//the idea is to put the lower bound in i
while (i < j) {
int mid = i + (j - i) / 2;
if (target <= A[mid]) {
j = mid;
} e... |
5a52e60d-1fea-402b-9d12-da51a5499213 | 2 | private Mesh LoadMesh(String fileName)
{
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
if(!ext.equals("obj"))
{
System.err.println("Error: '" + ext + "' file format not supported for mesh data.");
new Exception().printStackTrace();
System.exit(1);
}
... |
e24cca81-29d0-4ccc-ab2a-82d79a75696e | 9 | private void lex(TokenStream tokenStream) {
ASTNode n = root;
Token t = null;
int index = 0;
while (index < tokenStream.size()) {
t = tokenStream.get(index);
switch (t.type) {
case Function:
case Block:
Type endType;
if (t.type == Type.Block)
endType = Type.BlockClose;
else
... |
4426a6a8-2005-446f-b478-74d2944adc39 | 7 | @SuppressWarnings("deprecation")
public void setSystemDefaultHeader(Request req, Response resp) {
resp.setStatuCode(200);
Date now = new Date();
resp.setHeader("Server", this.getServerName());
resp.setHeader("Content-Type", getMimeType(req));
resp.setHeader("Date", now.toGMTString());
resp.setHeader("Expir... |
6f76f293-fd70-4397-a787-e8c8e5285bed | 3 | public ArrayList<Integer> grayCode(int n) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
ArrayList<Integer> res = new ArrayList<Integer>(1 << n);
res.add(0);
if(n == 0) return res;
res.add(1);... |
e37d954a-9d3f-4858-9a2c-849da9e55e68 | 7 | public void paint(Position p, int moves)
{
boolean valid = false;
//System.out.println("painting "+p);
if ( maze.getValueAt(p) == '.')
{
valid = true;
maze.setValue(p, moves);
}
else if ((int)maze.getValueAt(p) > moves)
{
valid = true;
maze.setValue(p, moves);
}
if ( valid )
{
Pos... |
cf364c96-51e1-46d5-9576-fe18ad8f4dc2 | 8 | public static char convertToChar (String string)
{
int length;
Character item;
char ret;
ret = 0;
length = string.length ();
if (0 < length)
{
if ('&' == string.charAt (0))
{
string = string.substring (1);
... |
3c9e1daf-f4c1-4617-8e4f-61e99877c72b | 4 | public Shape getSahpe(String shapeType){
if(shapeType==null){
return null;
}
if("CIRCLE".equalsIgnoreCase(shapeType)){
return new Circle();
}else if("RECTANGLE".equalsIgnoreCase(shapeType)){
return new Rectangle();
}else if("SQUARE".equalsIgnoreCase(shapeType)){
return new Square();
}
retur... |
f81d1dbf-b38c-41fd-acc8-29c5561598ec | 8 | public ASNode route(ASNode source, String name) throws FileNotFoundException, IOException {
ASNode cnode = source, nnbr = source;
int routingHops = 0;
int totalLatency = 0;
int ovHops = 0;
while (!cnode.prefix.isMatch(name)) {
if (ovHops > Math.log(nodeStore.length) /... |
fa9e85b9-4d29-44c5-a961-03a91623bf35 | 8 | public BufferedImage parseUserSkin(BufferedImage par1BufferedImage)
{
if (par1BufferedImage == null)
{
return null;
}
imageWidth = 64;
imageHeight = 32;
BufferedImage bufferedimage = new BufferedImage(imageWidth, imageHeight, 2);
Graphics g = buff... |
58ea7c76-2810-4523-8a22-9594f510d34a | 2 | @Override
public void union(int p, int q)
{
int pRoot = find(p); // component of p
int qRoot = find(q); // component of q
// Do nothing if p and q belong to the same component
if (pRoot == qRoot)
return;
// Take care to make smaller tree point to larger one thus keeping the
// component-tree height r... |
f845d234-0b5d-47f5-8f2a-1488a0b8bd84 | 7 | public static void main(String[] args) {
// E A I
final int MAXVOLUME[] = { 15, 10, 5 };
final int MAXJOUR[] = { 45, 20, 30};
String strNumero;
char charCategorie;
int iCategorie = 0;
int iPossession;
int iEmprunt;
Boolean bResultat;
//ramasser les données... |
dd27e90d-9641-4967-8511-2a65e72d2726 | 9 | private String balance(String input) {
int tam = input.length();
char stack[] = new char[tam];
int top = 0;
for ( int i = 0; i < tam; i++ ) {
char c = input.charAt(i);
if ( c == '(' || c == '[') {
stack[top] = c;
top++;
} else if ( top == 0 ) {
return "No";
} else {
char topChar = st... |
7ef6ac58-80e1-452d-ad73-d723f5253ac4 | 3 | public void fillCustomerOrder(int orderid) {
//System.out.println("FillCustomerOrder-------------------");
try {
// Here you only need one statement I think. You are subtracting amount from stock number
PreparedStatement stmt = connection.prepareStatement("select stock_number, amo... |
f47e861f-66ad-45bc-a142-abc2904717a7 | 4 | public void removePathsContaining(final Block block) {
for (int i = paths.size() - 1; i >= 0; i--) {
final Block[] path = (Block[]) paths.get(i);
if ((path[0] == block) || (path[1] == block)) {
if (FlowGraph.DEBUG) {
System.out.println("removing path " + path[0] + " -> "
+ path[1]);
}
pa... |
feb15b40-e62a-4049-9f19-d7af880cd25e | 0 | @Override public String toString(){
return expression;
} |
b6d8b178-060b-4709-8b01-f5b039addce5 | 0 | PhysObject3D(Object3D obj, String name, SimpleVector velocity) {
super(obj);
setName(name);
this.velocity = velocity;
this.acceleration = new SimpleVector();
} |
f1f2d778-4211-4d6e-95b9-39f662e1e8c6 | 5 | AllImagesIterator(final String first, final String prefix, final boolean lexicographicalOrder, final Long minimumLength, final Long maximumLength, final String sha1) {
super("aifrom", first /* can also be null */);
getParams = paramValuesToMap("action", "query", "format", "xml", "list", "allimages", "ailimit", "... |
331febd2-7e25-4b7c-93d7-b41a230c4f37 | 0 | public void die() {
alive = false;
} |
f2dd05fe-890e-4120-9641-16cfe6769005 | 7 | public byte[] decrypt(byte[] textEncrypted, String key){
byte[] decrypted = null;
try{
//keygenerator.init(bits); // 192 and bits bits may not be available
byte[] keyPadded = new byte[bits / 8];
for(int i = 0; i < bits / 8 && i < key.length(); i++){
keyPadded[i] = (byte)key.charAt(i);
}
/*... |
b8218b6c-570b-4c36-84a7-5497894a76cc | 9 | public void dessinerObjet(Graphics g) {
int size = 600; //size in pixels
BufferedImage bufImg = new BufferedImage(size, size, BufferedImage.TYPE_4BYTE_ABGR);
BufferedImage solo;
try {
solo = ImageIO.read(new File("carrenoir.jpeg"));
... |
65a5a338-04e4-4445-9eb2-2223051ee306 | 9 | public double getBECharge(int reactor_type, int tech_number, double capacity, int DDFlag, int year) {
double cumMass = getBECumMass(reactor_type, tech_number, capacity, DDFlag, year);
double tempCost = 0.;
double charge = 0.;
double tech_capacity = 0.;
int i, j;
// TODO why is SFReprocessed 0?
/* fo... |
e1a77356-51dd-4610-8828-2d2e29723c4f | 9 | public synchronized int[] baseNumberCds2Pos() {
if (cds2pos != null) return cds2pos;
calcCdsStartEnd();
cds2pos = new int[cds().length()];
for (int i = 0; i < cds2pos.length; i++)
cds2pos[i] = -1;
int cdsMin = Math.min(cdsStart, cdsEnd);
int cdsMax = Math.max(cdsStart, cdsEnd);
// For each exon, ad... |
ad62748b-10d7-4f1f-82dd-a6e84fed44db | 8 | public static void main( String [ ] args )
{
PairingHeap<Integer> h = new PairingHeap<>( );
int numItems = 10000;
int i = 37;
int j;
System.out.println( "Checking; no bad output is good" );
for( i = 37; i != 0; i = ( i + 37 ) % numItems )
h.insert( i );
for( i = 1; i < numIt... |
2ff5c4f2-7f8b-41eb-8787-184b30214f39 | 0 | public SaveAction(Environment environment) {
super(environment);
putValue(NAME, "Save");
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S,
MAIN_MENU_MASK));
this.environment = environment;
} |
85ca2bd7-814c-4c57-a5ec-34dd51843bce | 4 | public HashMap<String, List<Integer>> fillHashMap(HashMap<String, List<Integer>> allKMers, String pathToFile) throws IOException {
LinkedList<Character> helpList = new LinkedList<Character>();
FileReader fr;
fr = new FileReader(pathToFile);
BufferedReader br = new BufferedReader(fr);
... |
8e593094-616d-49c8-8bce-2d95db7e70eb | 0 | public final double getLineWidth() {
return lineWidth;
} |
b7125325-f473-4b22-a89c-3b8f28fbf70c | 7 | private void beginServing() {
if (m_ServletMap.size() > 0) {
do {
// System.out.println("=========================");
// System.out.println("SERVER PULSE");
// System.out.println("=========================");
for (int i = 0; i < SERVLET_TYPE.values().length; i++) {
SERVLET_TYPE servletType = S... |
b8077222-e15b-471b-9b18-5d9a2d747a6a | 2 | public void draw(Graphics g) {
g.setColor(Color.ORANGE);
for (Meat meat : meats) {
g.fillOval(meat.getX(), meat.getY(), 8, 8);
}
g.setColor(Color.black);
for (Meat meat : meats) {
g.drawOval(meat.getX(), meat.getY(), 8, 8);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.