method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1bece946-2861-4daa-a414-b2ed355fc7fd | 6 | public void construct(String file_name) {
try {
BufferedReader br = new BufferedReader(new FileReader(file_name));
String line, cell = "";
String[] tokens;
boolean first_line = true;
while ((line = br.readLine()) != null) {
tokens = lin... |
57b135ee-d339-4d86-94bb-e36944d64fc1 | 4 | @SuppressWarnings("unchecked")
@Test
public void QueryStudent(){
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
List<Student> slist = new ArrayList<Student>();
String hql = "select s from Student as s";
Query q = session.createQuery(hql);
slist = q.lis... |
3ee2a126-c439-492a-8569-51f254a21e9c | 1 | public String toString() {
return "FROM:" + boardIndexFrom + " TOP CARD INDEX: " + toMoveTop + (boardIndexTo == -1 ? "" : " TO " + boardIndexTo);
} |
3befbb9e-52a6-4711-963e-a9886a8829ce | 9 | private static void addPeakCalls(HashMap<String, List<Holder>> map ) throws Exception
{
for(String contig : map.keySet())
{
List<Holder> list = map.get(contig);
for(int x=0 ; x < list.size(); x++)
{
Holder h = list.get(x);
Holder lastH = x >0 ? list.get(x-1) : null;
if( h.regressionSlope == nu... |
9f96c29c-8b09-472a-9599-4e915b2fe706 | 4 | public static void UpperPlaceOfPublication(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedSt... |
0f18244b-97d6-470e-b1c3-1dcfa706582d | 7 | public void writeFlightReportToXML(FlightReport report) {
try {
if(!fileWriter.checkIfFileExistsOrCreateNew(FlightReportPath)){
createFlightReportToXMLFile(report);
}
// create document from existing file
DocumentBuilder... |
5627bf38-cf0c-49e2-a0c3-149f3a75d576 | 7 | public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} catch (ClassCastException exc) {
System.err.println("The first argument to ma... |
7b0a4bf7-a45f-4276-8792-c82cf9aeedd4 | 7 | private void key(KeyEvent event, boolean pressed) {
if (this.hasFocus()) {
if (event.getKeyCode() == KeyEvent.VK_ALT && event.isControlDown()
&& isFullscreen) {
// Special case for Ctrl-Alt-Ins to be mapped to
// Ctrl-Alt-Delete.
//... |
25025968-aef7-4972-ab8d-aa0025b11385 | 0 | public Tpv(int idTpv, GregorianCalendar fecha, GregorianCalendar hora, Cliente cliente, double total, double entrega) {
this.idTpv = idTpv;
this.fecha = fecha;
this.hora = hora;
this.cliente = cliente;
this.total = total;
this.entrega = entrega;
} |
0793f533-115c-4fc9-9c4b-5382eabf2fb2 | 9 | static void indexDocs(IndexWriter writer, File file) throws IOException {
// do not try to index files that cannot be read
if (file.canRead()) {
if (file.isDirectory()) {
String[] files = file.list();
// an IO error could occur
if (files != null) {
for (int i = 0; i < files.length; i++) {
... |
a8497a73-1db1-472f-8999-b2810e4a8195 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String criterio = "";
boolean isCompra = false;
BigDecimal rangoMax = BigDecimal.ZERO;
BigDecimal rangoMin = BigDecimal.ZERO;
if(rbtCompra.isSelected())
... |
d7ff65f7-072f-4a0b-8dc1-aecbae0960a5 | 4 | public boolean canGoAtDirection(Direction direction, Location from) {
switch (direction) {
case UP:
return isWalkablePath(from.getX(), from.getY() - 1);
case DOWN:
return isWalkablePath(from.getX(), from.getY() + 1);
case LEFT:
... |
bddd7645-6b60-4fc3-9e5a-63c33d18cd55 | 4 | public static PVector resolveTopRight(PVector v) {
PVector result = new PVector();
if (((v.heading() > (float)(Math.PI/4)) && (v.heading() <= (float)Math.PI)) ||
((v.heading() > (float)-Math.PI) && (v.heading() < (float)(-3*Math.PI/4)))) // NB brackets round second PI expression before float cast
{
result.... |
56891488-2213-4631-ba0c-101462fa0d5c | 9 | @Override
public JFormCollection load() {
if (loaded) return this;
String body = null;
try {
body = JHttpClientUtil.postText(
context.getUrl() + JHttpClientUtil.Forms.URL,
JHttpClientUtil.Forms.GetFormCollection.replace("{listName}", list.... |
65b84e05-1f43-4e7b-9df6-0156fc82f2bf | 3 | @SuppressWarnings("unchecked")
public void start() {
if(hasStarted()) {
throw new IllegalStateException("Machine has already started.");
}
if(stateGraph == null) {
throw new IllegalStateException("No state graph specified.");
}
if(stateGraph.getStartState()==null) {
throw new IllegalStateException("... |
0b282890-9144-4ff6-b926-9ac68bb6d867 | 1 | private boolean jj_3_76() {
if (jj_scan_token(EXCLAM)) return true;
return false;
} |
6c5775a7-b5c9-40a1-817c-25e4ce1f5eec | 1 | public boolean start() {
stopWaiting = false;
if (startServerSocket()) {
new Thread(new Runnable() {
@Override
public void run() {
waitForConnections();
}
}, "wait for connections").start();
return tr... |
5a5ccf1c-e838-4656-9c28-5ce1cb46dd3c | 0 | public static void addToProductionWithUsefulVariableSet(
Production production, Set set) {
set.add(production);
} |
0574b47f-a001-49e0-9a88-7296db45c74f | 7 | @Override
public void getInput() {
int selection = -1;
boolean isValid = false;
do {
this.displayMenu();
Scanner input = SnakeWithPartner.getInFile();
do {
try {
selection = input.nextInt();
isValid ... |
6376ed38-de28-4a64-a0b7-675d228be539 | 5 | public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
screen.clear();
int xScroll = player.x - screen.width / 2;
int yScroll = player.y - screen.height / 2;
level.render(xScroll, yScroll, screen);
player.render(screen);
... |
6ed58684-f975-4b07-be5c-d0ee5d244dd7 | 0 | public static void output()
{
System.out.println("hello wold !");
} |
6bd47621-48b0-44b5-b1cf-e3f2df2c9181 | 3 | private void registerListeners() {
// Add volume listener.
mediaPlayer.addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
@Override
public void playing(MediaPlayer mediaPlayer) {
updateVolume(mediaPlayer.getVolume());
}
});
//... |
930c331a-6871-4284-a104-233ebae29aa5 | 8 | @Override
public String getColumnName(int columnIndex) {
switch(columnIndex) {
case 0:
return "Ranking";
case 1:
return "Team #";
case 2:
return "Team Name";
case 3:
return "Round 1";
case 4:
return "Round 2";
case 5:
return "Round 3";
case 6:
return "Round 4";
case 7:
return ... |
081fe5f7-f364-4fd9-9be8-ec477b5f2507 | 4 | private static void getAllTestNgTests(List<String> urlsOrFiles) throws Exception {
List<TestResultData> testNgResultData = parseTestNgResultFromFilesOrUrls(urlsOrFiles);
List<String> testNgTests =
(List<String>) CollectionUtils
.collect(testNgResultData, new BeanT... |
1eec3fdd-3997-44a5-8188-3776c7e25c7e | 3 | public static pgrid.service.corba.exchange.ExchangeHandle narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof pgrid.service.corba.exchange.ExchangeHandle)
return (pgrid.service.corba.exchange.ExchangeHandle)obj;
else if (!obj._is_a (id ()))
throw new... |
f23df5b9-65e4-4401-926f-cdfbd6862f82 | 4 | public static void main(String[] args)
{
if(args == null || args.length !=3)
{
System.err.println("usage: java Replace <instring> <what> <with>");
System.exit(1);
}
System.out.println("creating Replace object r ...");
Replace r = new Replace(args[0]);
System.out.println("r after method replaceFirst:... |
3ad830f0-9468-4314-bcf1-e5ad2a034e4b | 0 | public int getpointValue() {//Accesses the Card's point value
return pointValue;
} |
327948e9-49b8-434b-be97-0dc5bc078360 | 2 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
return obj instanceof LengthValue && super.equals(obj);
} |
0895b78e-8c6c-4626-ae59-250c3ace2c2f | 9 | static final void method365(Class318_Sub1 class318_sub1,
Class348_Sub1[] class348_sub1s) {
if (Mob.aBoolean10221) {
int i = class318_sub1.method2384(class348_sub1s, 49);
Class9.aHa171.method3642(i, class348_sub1s);
}
if (Class332.aSArray4142 == aa_Sub1.aSArray5191) {
boolean bool = false;
boo... |
512dda9a-e8a2-4c3f-b720-72728eefb51b | 7 | public void tookDamage(double damageTaken) {
if(invincibility<=0){
game.isDamaged();
invincibility=invTime;
armour-=damageTaken;
if(armour<=0){
Random r = new Random();
Color c;
int numSparks;
if(Spark.glowEnabled){
n... |
eb29d664-5eb7-4df7-9cb1-4d8be5c1f1d2 | 1 | public void detectCols() {
for (int i = 5; i > 2; i--) {
detectCol(i);
}
} |
5d319945-af34-431a-9137-2aea1e975fef | 9 | public void paint(Graphics gr1d, Object destinationComponent, Boolean b) {
final Graphics2D gr = (Graphics2D) gr1d;
gr.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
final int n = G.getVerticesCount();
if (n == 0)
return;
AbstractGraphRenderer.getCurrentG... |
9d8f8d71-6b46-4373-9f54-b459de02693b | 7 | private void findNextTime(int timeUnit, int timeUnitCount) {
switch (timeUnit) {
case SECOND:
calendar.add(Calendar.SECOND, timeUnitCount);
break;
case MINUTE:
calendar.add(Calendar.MINUTE, timeUnitCount);
break;
case HOUR:
cale... |
3a5e3965-aeb0-4587-8c20-f505146f36b7 | 4 | public static void printBattleProgress()
{
b1.allowedToPaintExp=true;
//System.out.println(enemy[enemyIndex].toHPOnlyString()+" Remaining Pokemon:"+
//Mechanics.remainingPokemon(enemy, enemyNumOfPokemon));
//System.out.println(user[userIndex].toBattleString());
System.out.print("Waiting for command...");
i... |
690a440b-04c1-4fd2-a145-f3a8849869ef | 9 | public void testRemove() {
int element_count = 10;
TIntList a = new TIntArrayList();
assertTrue( a.isEmpty() );
for ( int i = 1; i <= element_count; i++ ) {
a.add( i );
}
assertEquals( 6, a.get( 5 ) );
assertTrue( a.remove( 5 ) );
for ( int ... |
43b687d4-20b2-41d3-9572-993bf95d61cd | 3 | public char getTipo(String nombre){
getLista g = new getLista();
ListaClientes = g.getListaCliente();
ListaProveedores = g.getListaProveedor();
for(int i = 0;i<ListaClientes.size();i++){
if(ListaClientes.get(i).getNick().equals(nombre)){
return ... |
65e5d326-a502-4ade-96d4-5cb81d124090 | 8 | public List<Graph> getErrorToConfidenceGraph() {
Map<Double, Integer> timeMap = new HashMap<Double, Integer>();
Map<Double, Integer> stepsMap = new HashMap<Double, Integer>();
Map<Double, Integer> timeCount = new HashMap<Double, Integer>();
Map<Double, Integer> stepsCount = new HashMap<Double, Integer>();
... |
777643ac-0d0d-4ad3-b6b8-5f5059d62cf1 | 0 | public RegularTransitionTool(AutomatonPane view, AutomatonDrawer drawer,
FSAToREController controller) {
super(view, drawer);
this.controller = controller;
} |
d44f12a3-d885-49af-9591-e48feb653d7c | 8 | @Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
String metodo = request.getParameter("metodo");
... |
0b6f5633-2b2c-42cd-a49f-0b4cbb0f9614 | 2 | @Override
public boolean addAll( Collection<? extends E> collection )
{
boolean changed = false;
for (E element : collection)
{
changed |= add( element );
}
return changed;
} |
c480aeee-4ac0-4211-a92a-091204cda7ad | 3 | public static JSONValue parse(TokenReader tokens, String token)
throws IOException, ParseException {
JSONObject result = new JSONObject();
if ((token = tokens.next()).equals("}")) {
return result;
}
do {
String key = JSONString.parse(tokens, token).toString();
tokens.parseAssert((token = tokens.ne... |
2e54c70b-d881-4de4-bec8-e8aa14f23f15 | 4 | public int compareTo(HandRank handRank) {
int compare = getRank().compareTo(handRank.getRank());
if (compare != 0) {
return compare;
}
Cards myHand = getHand();
Cards theirHand = handRank.getHand();
for (int i = 0; i < HAND_SIZE; i++) {
if (myHand.... |
b7bb1e01-b855-4735-a47a-43c788dfaf59 | 1 | public void serializeFile(String filename) {
try {
FileOutputStream file = new FileOutputStream(filename);
ObjectOutputStream o = new ObjectOutputStream(file);
o.writeObject(this);
o.close();
} catch (IOException e) {
System.err.println(e);
}
} |
f08d427b-6856-4cf6-abf7-ca7de7f9a0cf | 0 | public String getEmailPer() {
return emailPer;
} |
8d2b89ad-ad17-4864-b7b7-d31a95e7b6f3 | 4 | private static void sortSameSuitCards(CardArray cards,
CardArray suitCards) {
int[] cardsNums = new int[suitCards.size()];
int y = 0; // index
for (Card i : suitCards) {
cardsNums[y] = i.num();
y++;
}
Arrays.sort(cardsNums);
for (int n : cardsNums) {
for (Car... |
86583f52-94c9-4fe7-ab7c-22be71922f56 | 4 | public boolean equals(Object o) {
if (!(o instanceof FilterChain)) {
return false;
}
FilterChain otherChain = (FilterChain) o;
int size = filters.size();
if (size != otherChain.getFilters().size()) {
return false;
}
for (int i = 0; i < size... |
f5e824c3-3efe-4cf8-a79b-3412df0aa67c | 0 | public void setBrakes(int brakes) {
this.brakes = brakes;
} |
5fd29c6e-4ecd-4c78-b8e1-3da6319f13ff | 3 | private void IDLE(Vector3f direction, float distance)
{
Vector2f lineStart = new Vector2f(transform.getTranslation().getX(), transform.getTranslation().getZ());
Vector2f castDirection = new Vector2f(direction.getX(),direction.getZ());
Vector2f lineEnd = lineStart.add... |
2c6268ef-4dd3-462d-a6b9-aa7d382adfbe | 1 | public boolean isAValidDirectory() {
try {
return args[0] != null;
} catch (ArrayIndexOutOfBoundsException e) {
return false;
}
} |
3772b341-5a50-468c-8cdf-4d96e6639f03 | 6 | private void setState(ModelStates state) {
Point windowPoint = currentWindow == null ? new Point(50, 50)
: currentWindow.getLocation();
switch (state) {
case loginsingup:
currentWindow = loginsingup;
loginsingup.setLocation(windowPoint);// set window is a custom
// location
endgamewindow... |
884f2531-da71-40f5-b6c5-7e121da1d5d7 | 5 | public Enemy setEnemy(int layerPosition,int x, int y, int damage, int health, int gravity, String name[], boolean canColide){
String namePath[] = new String[name.length];
for (int i =0; i< name.length; i++){
namePath[i] = "res/images/" + name[i];
}
if(name[0].compareTo("Jumper_0.png")==0){
listOfEnemies[l... |
b5b70259-31ca-4268-b2bd-a447b41161d0 | 5 | private static ArrayList<String> getDataFromMap(String key) {
if (null == key || "N".equalsIgnoreCase(key) || "".equals(key))
return null;
String[] temp = key.split("、");
ArrayList<String> resultList = new ArrayList<String>();
if(temp.length > 1){
for(String t : temp){
resultList.addAll(getData(t));... |
0db5290a-a45a-48e0-815f-428427b3e852 | 3 | private boolean checkFeetCollision(Cell[][] tiles){
int feetX = feetBox.getX()/Cell.CELL_WIDTH;
for(int i = 0; i < tiles.length; i++){
if(tiles[i][feetX] != null && feetBox.checkCollision(tiles[i][feetX].getHitbox())){
return true;
}
}
return false;
} |
9937fe19-a160-46d1-8067-f30fc9fb6043 | 8 | @Override
public boolean onCommand(CommandSender sender, Command command, String sabel, String[] args) {
if (Utils.commandCheck(sender, command, "maleficus")) {
Player player = (Player) sender;
if (args.length == 0) {
player.sendMessage(Utils.center("--- §6[§fMaleficus§6]§f ---"));
player.sendMessage("... |
b206d51a-6f7a-4398-830c-d37b44610bb8 | 9 | private void addToCounts(Instance instance) {
double [] countsPointer;
if(instance.classIsMissing())
return; // ignore instances with missing class
int classVal = (int)instance.classValue();
double weight = instance.weight();
m_ClassCounts[classVal] += weight;
m_SumInstances += w... |
d8c43ad7-760f-407d-8c3e-627b57e74a37 | 6 | public Map<Player, Player> Command_refuse(Map<Player, Player> Map) {
tpMap = Map;
StringBuilder message = new StringBuilder();
for(int i = 0; i < args.length ; i++) {
message.append(args[i]);
message.append(" ");
}
for(Entry<Player, Player> entry : tpMap.entrySet()) {
Player key = en... |
be7fbb0c-8bac-486a-aecb-4bff2eccc1e4 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof XPosition))
return false;
XPosition other = (XPosition) obj;
if (column != other.column)
return false;
if (line != other.line)
return false;
if (pos != other.pos)
return false;
if (source == nu... |
ece753ba-b6ae-4868-b658-05efe1129c27 | 2 | public boolean comprobarAdmin(String nick, String password){
beansAdministrador admin = buscarAdmin(nick);
if(admin != null){
if(admin.getPassword().equals(password)){
setAdmin(admin);
return true;
}
}
return false;
} |
9799b710-c72b-4d2f-94c6-c083bf6a31ca | 0 | public MealyMachine()
{
super();
} |
00aa21cf-99f3-48e0-b089-c599862dbf9e | 2 | public void saveGameInformation(Game currentGame)
{
PrintWriter gameWriter;
String saveFile = "saveFile.txt";
try
{
gameWriter = new PrintWriter(saveFile);
gameWriter.append(currentGame.getGameTitle() + "\r\n");
gameWriter.append(Integer.toString(currentGame.getFunRanking()) + "\r\n");
for (int c... |
a8d28e06-de32-425a-aded-ab386975c1db | 8 | private double findSplitNumericNumeric(int index) throws Exception {
double bestVal = Double.MAX_VALUE, currVal, currCutPoint;
int numMissing = 0;
double[] sumsSquares = new double[3], sumOfWeights = new double[3];
double[][] bestDist = new double[3][1];
double totalSum = 0, totalSumOfWeights = 0;
... |
1767f495-1281-4460-b27e-a1484c2e9e5c | 4 | @Override
public void run() {
//say our server is starting
logger.debug("Server starting");
//set this in case it was set to false
keepRunning = true;
//set up some buffer for ourselves
byte[] recvData = new byte[64];
logger.debug("About to enter server con... |
aecd824f-12ca-430b-9413-5866d05147d0 | 8 | public static CustomButton makeTextExplorerLauchButton(
final String buttonTitle) {
final CustomButton a = new CustomButton(buttonTitle);
a.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (!Database.loaded)
return;
JFrame jf = new JFrame(b... |
9bba14a6-e0c7-4597-95a6-04649c14c7bb | 4 | @Override
public void takeInfo(InfoPacket info) throws Exception {
super.takeSuperInfo(info);
Iterator<Pair<?>> i = info.namedValues.iterator();
Pair<?> pair = null;
Label label = null;
while(i.hasNext()){
pair = i.next();
label = pair.getLabel();
switch (label){
case RPMs:
RPM = (Double) pai... |
7a4ffbc3-fb1d-482a-b29f-966352753d5f | 8 | public void setImgPath_CommandBtnArrow(Path img, Imagetype type) {
switch (type) {
case KEYFOCUS:
this.imgComArrow_KFoc = handleImage(img, UIResNumbers.COMBTNARROW_KFOC.getNum());
if (this.imgComArrow_KFoc == null) {
this.imgComArrow_KFoc = UIDefau... |
f336f958-14d7-4834-a550-449a27ef0e0c | 3 | private void getLinkList() {
try {
List<Link> links;
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
dos.writeBytes(ServerFrame.getLinkListCmd + "\n");
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
links = (List<Link>) ois.readObject();
up... |
e078fd3f-478d-462d-bf85-6079c22275da | 3 | private double calcOutput(int targetLayer,int position){
int[] relPos;
int absPos = this.calcAbsolutePosition(targetLayer, position);
double[] input = new double[addedNeurons];
double[] weights = new double[addedNeurons];
boolean inputNeuron=true;
for(int row = 0; row < addedNeurons;row++){
if(weightMat... |
cb83c266-6597-4712-9810-14b2ec379822 | 4 | void guess(String solution){
int count = 0;
count++;
int a = getA(solution, "1234");
int b = getB(solution, "1234");
if (a == 4) {
}
updateAnsSet("1234", a, b);
String step = String.valueOf(count);
outcome = "";
outcome = outcome + "Step" + ... |
9b24bc7c-28b7-4924-885e-4b33440664bf | 2 | public void llenarCombobox() {
String to = System.getProperty("user.dir"); // recupero el directorio del proyecto
String separator = System.getProperty("file.separator"); //recupero el separador ex: Windows= '\' , Linux='/'
to = to + separator + "src" + separator + "src" + separator; // concaten... |
9c0b591a-0f26-4949-bda0-f99b8608c56a | 1 | public void run() {
while (canContinue()) {
// System.out.println(word.getWord());
printHangman();
printLetters();
System.out.print("\n\nPlease guess a letter!:");
String guess = sc.next();
char guessChar = validate(guess);
word.checkGuess(guessChar);
}
printHangman();
printLetters();... |
8c6e8d5a-76dc-49bb-ab14-09f470ad5630 | 0 | public HostInfo getHostByName(String name) {
return this.hosts.get(name);
} |
98e53aea-e2e7-44d7-9011-4bb55197aa75 | 5 | public void loot(Item item, Stage stage) {
// Get slot of item to loot
int slot = 0;
if(item instanceof WeaponItem)
slot = item.getWeaponSlot();
else if(item instanceof ArmorItem)
slot = item.getArmorSlot();
// If player can equip, equip
if(stage.player.getEquipment().canEquip(item, slot)) {
sta... |
88b18e10-b387-4a17-8ba2-87c2b82312af | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TracksHaveHashtags that = (TracksHaveHashtags) o;
if (hashtagId != that.hashtagId) return false;
if (trackId != that.trackId) return false;
... |
765bce67-ee57-46a9-9b89-02ff0a9b838f | 3 | @Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null )
{
return false;
}
if ( !(o instanceof Degree) )
{
return false;
}
final Degree other = (Degree) ... |
19a17bd4-d849-4f38-abd3-9e968701ca1d | 3 | public void removeMeanFriends()
{
// YOUR CODE HERE
// Remove all the friends who don't have you as a friend.
// You may want to use the find method.
ArrayList<Person> meanFriends = new ArrayList<Person>();
for (Person each : friends)
{
if (each.find(this)... |
a0bd6620-6165-4fac-9340-d51e3cf1ced4 | 8 | private Map<String, BoundField> getBoundFields(Gson context, TypeToken<?> type, Class<?> raw) {
Map<String, BoundField> result = new LinkedHashMap<String, BoundField>();
if (raw.isInterface()) {
return result;
}
Type declaredType = type.getType();
while (raw != Object.class) {
Field[] f... |
c3a00c5f-11c6-4e08-aea9-71f2ab2d80b8 | 5 | public Void visitUnit(UnitTree tree) {
String name = options.getOutputName();
if (name == null) {
name = tree.getSource();
int dot = name.lastIndexOf('.');
if (dot > 0) name = name.substring(0, dot);
}
File file = new File(options.getOutputDir(), name+".java");
try {
output = new PrintStream(file)... |
380b5e3e-1e48-4b21-b7a0-8ad908a68838 | 5 | public String authenticate(String userName, String password)
throws ConnectException, InvalidLoginException {
Connection con = ConnectionService.getConnection();
try {
String query = "select * from Login where username=?";
PreparedStatement preparestatement = con.prepareStatement(query);
preparestateme... |
2a66709f-55df-4cb6-b332-9bc617fcd298 | 7 | public void updateReactToPyroState(double s_elapsed) {
can_growl = true;
if (!target_unit.isInMap()) {
initState(RobotPilotState.INACTIVE);
can_growl = true;
}
else if (target_object_room.equals(current_room)) {
if (!target_unit.getRoom().equals(target_object_room)) {
initState... |
dc5ad418-1706-4cd9-b41a-00e71a882bfa | 5 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._caso_ == oldChild)
{
setCaso((TCaso) newChild);
return;
}
if(this._valor_ == oldChild)
{
... |
f8677bff-f2b9-4403-8bd7-b68bad77e5ec | 8 | public void divideNo(No x, int i, No y) {
int t = (int) Math.floor((ordem - 1) / 2);
//cria nó z
No z = new No(ordem);
z.setFolha(y.isFolha());
z.setN(t);
//passa as t ultimas chaves de y para z
for (int j = 0; j < t; j++) {
if ((ordem - 1) % 2 == 0) ... |
86dd5558-5987-4692-bacd-85f022a42721 | 7 | public Move findbest(Game g) throws GameException {
try {
boolean max;
int bestVal;
// if first player, then find the max value
// otherwise find the min value
if (g.whoseTurn() == Game.FIRST_PLAYER) {
max = true;
bestVal = Integer.MIN_VALUE; // running max, starts at bottom
} else {
ma... |
40437856-2dc7-4b6e-b9fe-d502d922e4ce | 3 | private void initializeLogger() {
this.log = Logger.getLogger(this.getClass().getName());
try {
FileHandler fh = new FileHandler(this.getClass().getName()
.replace("class ", "")
+ ".log");
fh.setFormatter(new SimpleFormatter());
this.log.addHandler(fh);
} catch (SecurityException e1) {
// TO... |
508e7f53-403c-4846-b528-50dfefdf42f9 | 2 | public State stateCreate(Point point) {
if (currentStep != CREATE_SINGLE_FINAL) {
outOfOrder();
return null;
}
State[] finals = automaton.getFinalStates();
drawer.clearSelected();
for (int i = 0; i < finals.length; i++) {
automaton.removeFinalState(finals[i]);
drawer.addSelected(finals[i]);
}
... |
881d4de5-bfab-453b-ae50-792c04701561 | 5 | protected void update() {
//Arc lenght angle
double arcAngleLengthInRadians = Math.toRadians(getLength());
//Angle rotation of the item
double startAngleInRadians = Math.toRadians(getStartAngle() + ANGLE_TO_START_AT_ZERO_DEGREE);
moveTo.setX(getInnerRadius() * Math.cos(startAngleInRadians));
move... |
f8ee4329-d505-49ea-837a-6bca3231b26e | 8 | public String resolveFilename(String filename) {
if (filename.startsWith("/") || filename.startsWith("\\"))
filename = filename.substring(1);
if (!usingMod) {
return mainDirName + filename;
}
String[] splitPath = splitParent(filename);
... |
400aa24b-079c-4641-bec6-5f4a9012a23d | 8 | private void antialias(int ch, int gr)
{
int sb18, ss, sb18lim;
gr_info_s gr_info = (si.ch[ch].gr[gr]);
// 31 alias-reduction operations between each pair of sub-bands
// with 8 butterflies between each pair
if ((gr_info.window_switching_flag !=0) && (gr_info.block_type == 2) &&
!(gr_info.mixed... |
abb2473d-f1ac-43cd-838e-3dfc010c75ef | 3 | public boolean finish() {
if (!started) return false;
boolean ok = true;
started = false;
try {
out.write(0x3b); // gif trailer
out.flush();
if (closeStream) {
out.close();
}
} catch (IOException e) {
ok = false;
}
// reset for subsequent use
transIndex = 0;
out = null;
image = n... |
38e0b83e-7d18-485b-a3c1-0a123e67e2f3 | 4 | public List<Stock> getStocks(List<String> symbols)
throws SymbolNotFoundInNasdaq {
// save data to tmp list, after update done, point with service list to
// tmp...
List<Stock> ret = new LinkedList<Stock>();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < symbols.size(); i++) {
// if(i > ... |
867daef4-8894-4c2b-a8e3-35717fd65916 | 6 | public void createTables() throws Exception {
if (!MineAuction.enabled) return;
Connection c = null;
Statement s = null;
c = MineAuction.db.openConnection();
s = c.createStatement();
if (plugin.getResource("create.sql") == null) {
if (MineAuction.enabled) {
Log.error("Unable to find create.sql, ... |
b73d9410-8e81-41a5-915c-f3585a1cffc5 | 8 | private void createGUI() {
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel topPanel = new JPanel(new MigLayout("fill"));
// Панель быстрого поиска
JPanel searchPanel = new JPanel(new MigLayout("fill"));
searchPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.cr... |
3e90b835-b263-4997-923e-366952567e1a | 0 | public static void main(String[] args) {
// int [] arr={2,7,13,19};
// System.out.println(new NthUglyNumber().nthSuperUglyNumber(12,arr));
String s="我钱懿斐";
System.out.println(s.length());
} |
0804856c-4d3d-49ca-8351-94ed65e6eb2a | 3 | public Archive getSelectedArchive() {
if (showOpenDialog(component) == 0) {
File selectedFile = getSelectedFile();
if (selectedFile.getName().endsWith(".class"))
return new ClassFile(selectedFile);
else
try {
return new JavaArchive(new JarFile(selectedFile));
} catch (IOException e) {
e... |
e96a5c87-7dbc-48bb-9e98-465a2593e35e | 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 TaxonObservationFilterElementType)) {
return false;
}
TaxonObservationFilterElementType other = (TaxonObservationFilter... |
920fb009-f8f5-480f-b392-d8741825beaf | 6 | public static void main(String[] args) {
Reader in = new Reader();
Writer out = new Writer();
int n,m,k,v;
while (true) {
try {
n = in.nextInt();
m = in.nextInt();
} catch (Exception e) {
break;
}
... |
999ec825-5fce-4e67-a932-566c03a8bfc3 | 5 | public static void main(String[] args) {
// TODO code application logic here
// 2. Mira esta serie: 2, 2, 4, 12, 48, ... la semilla de esta serie fue el número 2 Mira esta serie:. 3, 3, 6, 18, 72, ... la semilla de esta serie fue el número 3.
//Cree una función que recibe dos enteros: x, y y. Si alguno de ... |
a2affad4-b5a1-49ea-8dfa-9af11b38dba4 | 4 | public String toString() {
StringBuilder out = new StringBuilder();
for (TraverseMode mode : TraverseMode.values()) {
int mask = getMaskForMode(mode);
if (mask != 0 && (modes & mask) == mask) {
if (out.length() != 0) {
out.append(",");
... |
95c9696f-ccb3-44e4-bb43-e28326dc9faa | 2 | @Test
public void testSerial() {
System.out.println("ASD");
LineTextField f = new LineTextField();
f.setFieldName("HELLO");
f.setMaxChars(100);
try {
FileOutputStream fos = new FileOutputStream("testfile");
ObjectOutputStream oos = new ObjectOutputStre... |
64d9159b-7d0d-4047-b22b-8483c5a594ec | 8 | private void mongoCreator() throws UnknownHostException {
DBHandler db = new DBHandler();
MongoHandler dbmon = new MongoHandler();
DB dbmongo = dbmon.connect();
dbmongo.dropDatabase();
db.openConnection();
Statement st;
String cadena[];
String ca... |
cc1eab96-ae9f-4d6c-825e-470a6ac45f34 | 1 | static public TreeMap<Integer, TreeSet<Integer>> stringToGraph(String str)
{
TreeMap<Integer, TreeSet<Integer> > tmpNoeuds = new TreeMap<Integer, TreeSet<Integer> >();
StringTokenizer tokenizer = new StringTokenizer(str);
while (tokenizer.hasMoreTokens()) {
Integer token = Integer.parseInt(tokeni... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.