method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e59f8bf3-3c42-4ce2-b163-3f3c6861d2c4 | 8 | @Override
public double calculateFractalWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Complex[3];
complex[0] = ... |
fd07ef6b-77b1-4360-ab7b-89770b1347fc | 9 | public void rotateTo(int x, int y, int handle) {
if (savedCenter == null)
savedCenter = getCenterOfMass2D();
double dx = x - savedCenter.getX();
double dy = y - savedCenter.getY();
double distance = Math.hypot(dx, dy);
if (distance < 1.0)
return;
double sintheta0 = 0, costheta0 = 0;
boolean b = s... |
922c6df5-1138-4e90-acff-d9f09876fbfd | 4 | protected Upgrade bonusFor(int state) {
switch (state) {
case (DRILL_MELEE ) : return Garrison.MELEE_TRAINING ;
case (DRILL_RANGED ) : return Garrison.MARKSMAN_TRAINING ;
case (DRILL_ENDURANCE) : return Garrison.ENDURANCE_TRAINING ;
case (DRILL_AID ) : return Garrison.AID_TRAI... |
38fa91d0-3126-415c-a4cd-46cf08a90e8e | 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 Cotizacion)) {
return false;
}
Cotizacion other = (Cotizacion) object;
if ((this.idCotizacion == null && other.... |
a2204dfd-ea11-445c-bb70-b75cc26a4c26 | 0 | public int tapes() {
return toRead.size();
} |
2b141d27-e94c-4b1d-91f0-5dd03d7af602 | 1 | public ArrayList<BEPlaylist> getAllPlaylists() throws SQLException {
ArrayList<BEPlaylist> result = new ArrayList<BEPlaylist>();
Statement stm = DBConnection.getConnection().createStatement();
stm.execute("Select * From Playlist");
ResultSet res = stm.getResultSet();
while (res.... |
d0b41e93-9ebb-4a4a-b66f-c0de0bc7b515 | 2 | private void var_decl_id() {
if( is(TK.ID) ) {
if (symtab.add_entry(tok.string, tok.lineNumber, TK.VAR)) {
gcprint("int ");
gcprintid(tok.string);
gcprint("="+initialValueEVariable+";");
}
scan();
}
else {
... |
87fe6d18-393e-40cb-9c57-4b1da468e302 | 8 | public Game(JavaPlugin plugin, int gameid, int maxPlayers, Location signLoc, String gameName, GameStage gamestage, ArrayList<Location> teamspawns, long delay, long period) {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
if (!plugin.isEnabled())... |
7b72e318-05fe-4d47-8ef4-f55a519de0e7 | 0 | @Override
public void setInvokeHandler(Object invokeHandler) {
this.invokeHandler = invokeHandler;
} |
8d6f1305-0e0e-403a-97eb-7ced95de5cce | 3 | private static ArrayList<Fact> getNonAnswers(ArrayList<Fact> list) {
ArrayList<Fact> newList = new ArrayList();
for (Fact f : list) {
if (!f.isAnswer() && !f.isMiddle()) {
newList.add(f);
}
}
Collections.sort(newList);
... |
7349054b-ada4-487d-9c74-23e5549e5a6a | 7 | public void mouseDragged(MouseEvent e) {
if (dragCallback != null) {
int mask = e.getModifiers();
int index = 0;
if ((mask & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {
index = MouseEvent.BUTTON1;
} else if ((mask & InputEvent.BUTTON2_MA... |
badd7f3c-95e1-4e1b-999d-95b672755628 | 3 | public static void main(String args[]) {
int portnumber = 0;
if (args.length > 0) {
portnumber = Integer.parseInt(args[0]);
} else {
System.out.println("The portnumber to listen to is: ");
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
if(!line.isEmpty()) {
portnum... |
7a1082b6-873c-4be0-9de1-501b8e276247 | 2 | void parseLocation(String loc) {
loc = loc.replaceAll("[<>()]", "");
if (loc.startsWith("complement")) {
complement = true;
loc = loc.substring(COMPLEMENT_STRING.length());
}
String se[] = loc.split("[\\.]+");
if (se.length > 1) {
start = Gpr.parseIntSafe(se[0]);
end = Gpr.parseIntSafe(se[1]);
... |
474d11c9-7bbb-43ca-b1e3-24def4fbe905 | 8 | private static List<OtuHolder> getOTUList(HashMap<Integer, Holder> map, OtuWrapper wrapper) throws Exception
{
List<OtuHolder> list = new ArrayList<OtuHolder>();
List<Integer> keys = new ArrayList<Integer>();
int numOTUS =wrapper.getOtuNames().size();
for( Integer key : map.keySet())
{
Holder h ... |
60c27fb2-a8b9-4432-a740-df6aea10605e | 0 | public void removeServiceListener(IServiceListener listener)
{
this._listeners.remove(listener);
} |
d84c1a56-8069-4728-b77d-69744d9fcb09 | 5 | public void print(Graphics g, int x, int lag){
g.drawImage(bg.getImg(), 0, 0, null);
int j0 = (x-lag)/genObstacle.sWidth -1; // part of the grid to draw the obstacles (j0<0 special case)
int j1 = j0 + Stubi.WINDX/genObstacle.sWidth + 2;
for (int i = 0; i<obstacles.length;++i){ // i = y coord
for (int j = j0;... |
0371f1ce-85b2-4c08-8628-9acf9c3d7359 | 9 | default WorldCoord getSubassemblySize(Entity excluding, Entity part) {
WorldCoord s = part.getSize();
double x = s.x, y = s.y, z = s.z;
if (getJoints().has(part)) {
EnumMap<JointType, Double> extents = new EnumMap<>(JointType.class);
for (Joint j : getJoints().get(part)) {
if (j.to != excluding) ... |
2ca799eb-993f-43c3-bbcd-a6bc84377178 | 2 | public static RoadGraph findNearestForStation(Point p) {
RoadGraph nearestPoint = null;
double minDistance = Double.POSITIVE_INFINITY;
double dist;
for (RoadGraph i : JMaps.getRoadGraphList()) {
dist = Math.sqrt((i.getPoint().x - p.x) * (i.getPoint().x - p.x) + (i.getPoint().... |
279132d2-c8a0-4042-afa1-c5241f75639d | 5 | public boolean doesNotSurpassGrid(){
int moveable = 0;
if(this.vehicle.isHorizontal()){
moveable = this.vehicle.position.x;
} else {
moveable = this.vehicle.position.y;
}
if(moveable + this.steps + (this.vehicle.length-1) < this.gridSize && steps > 0){
return true;
} else if (moveable + this.steps ... |
adffaba4-82ab-488f-b958-f2a9afab3afe | 6 | @EventHandler
public void EnderDragonHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEnderDragonConfig().getDouble("Ender... |
576d8296-e7b6-49c8-9c83-c65f3ab258bc | 0 | public PdbTMReaderWriter () {
super() ;
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbTMReaderWriter:constructor:DLL is loaded? " + bNativeInterfaceCodeLoaded); }
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbTMReaderWriter:constructor:DLL is initialized? " + bNativeInterfaceCode... |
a06aa10c-47d5-4407-9e2b-7c50ff311fd1 | 3 | public ReleaseType getLatestType() {
this.waitForThread();
if (this.versionType != null) {
for (ReleaseType type : ReleaseType.values()) {
if (this.versionType.equals(type.name().toLowerCase())) {
return type;
}
}
... |
0799a801-72d2-46cc-8cba-7b0d0a1fa07f | 5 | protected void remove(TileObjectDisplayData displayData){
//check if any of the three categories has the displayData, and remove it.
if (displayData == characterData){
clearCharacterData();
notifyDataRemoved(displayData);
return;
}
if (itemData.contains(displayData)){
itemData.remove(displayDa... |
c0c01d30-10d1-4e90-9058-5b92bd8987e7 | 6 | HashMap<Character,Integer> generate_map(String k, int[] num)
{
//int num_size=num.length;
int cur_num=0;
HashMap<Character,Integer> m=new HashMap<Character,Integer>();
boolean[] filled=new boolean[26];
for(int i=0;i<k.length();i++)
{
char cur_char=k.charAt(i);
int pos=cur_char-'A';
if(!fill... |
691e9629-4f05-4f99-a8d5-f03ce0a86095 | 3 | public ScrambleDataInfo getScrambleInfo()
{
if (this.mStream == null)
throw new AssertionError();
if (this.mDataInfo != null)
throw new AssertionError();
this.mDataInfo = new ScrambleDataInfo();
try
{
byte[] hdrArr = new byte[2];
this.mStream.read(hdrArr, 0, 2);
this.... |
be04e901-4ab9-4bb3-9f45-3a7e2e962bc9 | 0 | public String toString() {
String affiche = "message actionneur";
return affiche;
} |
d091269b-da7d-4f53-b9c3-4354fd663fb7 | 7 | private SubField[] parseSubFields(String name, int ior, String desc) {
int totalbits = 0;
int count = 0;
SubField[] sfs = new SubField[8];
StringCharacterIterator i = new StringCharacterIterator(desc);
int ior_hbit = 7;
while ( ior_hbit >= 0 && i.current() != CharacterIte... |
2d46d49f-60b9-4c45-a1b1-be497b0f206f | 9 | private void LoadAllLists() {
ResultSet tasksOnAssetListResultSet = null;
Statement statement;
try {
statement = connection.createStatement();
tasksOnAssetListResultSet = statement.executeQuery("SELECT * FROM Task WHERE projectID = " + projectID + "... |
cb56271b-2235-41ac-82ad-7772c5085fbd | 8 | public void generation(GameField currentField, GameField generateTo) {
if(currentField.width!=generateTo.width || currentField.height!=generateTo.height) {
//what the holy fuck are you trying to do?
throw new RuntimeException();
}
this.currentField=currentField;
... |
d1c16c47-4bac-4e5a-a73d-9377fed6a1da | 3 | @Override
public void insert(Matrix matrix, int matrix_id) throws SQLException {
deleteMatrix(matrix_id);
int rows = matrix.getRowsCount();
int cols = matrix.getColsCount();
long startTime = System.currentTimeMillis();
statement = connection.prepareStatement(insertMatrixS... |
d3aed4e8-50c9-4de6-8742-656a90339502 | 2 | public ContentBody toContentBody() {
if (file != null) {
return new FileBody(file) {
@Override
public String getFilename() {
return fileName;
}
};
} else if (data != null) {
... |
7e6e25bb-ce18-4608-9898-b9c3df645824 | 8 | public static final void FormatTable2() {
final File readFile = new File("printerfriendly.htm");
final File writeFile = new File("Table2.txt");
try {
writeFile.createNewFile(); // create write file
final FileWriter outStream = new FileWriter(writeFile); // open filewriter stream
final BufferedWrite... |
d2c2133a-2a7d-4384-9b99-9bfabc712c14 | 0 | public boolean isRunning(){
return this.running;
} |
3b8ce406-b4aa-4702-9317-27b8eb77f377 | 4 | public void addAgent(String key, GenericAgent agent)
{
try
{
if (agent instanceof Organization)
return;
AgentRole role = agent.getAllAgentRoles().values().iterator().next();
AgentController control = role.getOwner().getContainerController().acceptNewAgent(key, agent);
//control.start();
... |
65bdfb4d-78b3-4f20-b789-5edb3411b145 | 0 | @Override
public Address getAddress() {
return super.getAddress();
} |
50b0f2d1-8a90-4d6e-8781-b80961f35c8e | 5 | @Override
protected String crearTextoRespuesta() {
StringBuilder sb = new StringBuilder("***Resultados del algoritmo de inducción***\n\n");
sb = sb.append("Explicación:\n");
sb = sb.append("Objetivo: ").append(objetivo).append('\n');
for (Regla r : reglasDisparadas) {
sb... |
97815ed5-e2e8-4225-b990-ce68384d8225 | 2 | public void update(long deltaMs) {
GameActor a = Application.get().getLogic().getActor(actor);
if(a != null) {
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent");
x = pc.getX();
y = pc.getY();
z = pc.getZ();
setRotation(... |
083c1a26-f226-4965-957a-9b7786718e63 | 5 | @Test
public void testRemoveArgs() {
System.out.println("removeArgs");
NodeVariable.resetIds();
NodeFunction.resetIds();
NodeArgument.resetIds();
COP_Instance cop = null;
try {
cop = Cerberus.getInstanceFromFile("bounded_arity5.cop2");
} catch ... |
4527cb0f-c36e-48cd-b839-f6f1a39b9f14 | 4 | public ThePanel(String name, String imgPath) {
setBackground(BG_COLOR);
setLayout(new BorderLayout());
label.setForeground(FG_COLOR);
label.setFont(new Font("Sans", Font.BOLD, 90));
label.setVerticalAlignment(SwingConstants.CENTER);
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setText(name)... |
fe149beb-8a85-44c4-88ee-5deac551dd1c | 1 | public Object put(Object key, Object value) {
processQueue();
Object rtn = hash.put(key, SoftValueRef.create(key, value, queue));
if (rtn != null)
rtn = ((SoftReference)rtn).get();
return rtn;
} |
7df098bf-e98e-4129-b0da-1c0a2b63a3db | 1 | public boolean InsertarTipoCultivo(TipoCultivo p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
6c66f4e1-d857-409d-b502-66f3c238b059 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof DateSimple)) {
return false;
}
DateSimple d = (DateSimple) obj;
return year == d.year && month == d.month && day == d.day;
} |
f08b0994-2d79-4bf9-b752-2dcb4d9b62ec | 1 | public Boolean isLastCoffer(Player player){
if(player==null)
return null;
return (getTotalCoffers(player)==1);
} |
3fd7f627-71cc-4c78-964f-4a5278cb0be9 | 5 | public void CreateAccount(RequestPacket request, DBCollection coll, User user) {
try {
if(!(paramValidator.validate(request.getUser_name(), "username") &&
paramValidator.validate(request.getEmail(), "email"))) {
user.sendMessage(msgTransformer.writeMessage(new ResponsePacket().setResponse("response").set... |
c2d226e3-cb80-4e89-9544-b19b924f7eaa | 8 | public int Finder(int start, int end, int elementToFind)
{
int mid;
System.out.println("start:"+start+ " "+"end:"+end);
if(start > end)
{
return -1;
}
mid = (start+end)/2;
System.out.println("mid : "+number[mid] + " " + elementToFind);
if(number[mid] == elementToFind)
{
return mid;
}
... |
0d275276-6770-4929-b2bc-c40572918577 | 4 | static void returnConnection(Connection conn) throws DaoConnectException {
try {
if (conn == null || !conn.isValid(DB_ISVALID_TIMEOUT)) {
throw new DaoConnectException("Can't return: null or unvalid connection.");
}
} catch (SQLException ex) {
throw ne... |
e3e546f8-bf18-497a-a468-3c865a5fc78a | 5 | public void doAction(String value) {
char choice = value.toUpperCase().charAt(0);
while (choice != 'A' && choice != 'B' && choice != 'C' && choice != 'D') {
System.out.println("Invalid selection");
value = getInput();
choice = value.toUpperCase().charAt(0);
}... |
5228f072-75ec-4997-9995-18113a8e7964 | 7 | private SubFrameResidual(int partitionOrder, int bits, int escapeCode, BitsReader data) throws IOException {
this.partitionOrder = partitionOrder;
numPartitions = 1<<partitionOrder;
riceParams = new int[numPartitions];
int numSamples = 0;
if (partitionOrder >... |
510fd319-af90-45a9-b6d9-1e3fd79684e8 | 1 | public Character fetchAbbr() {
if(!hasAbbArg()) {
throw new InputMismatchException("There is no abbreviation at the head of ArgSet.");
} else {
String s = pop();
return s.charAt(1);
}
} |
5e68b1c0-9edb-4699-bcc4-1e1d13b9ed2b | 7 | private static <T> Entry<T> mergeLists(Entry<T> one, Entry<T> two) {
/* There are four cases depending on whether the lists are null or not.
* We consider each separately.
*/
if (one == null && two == null) { // Both null, resulting list is null.
return null;
}
... |
997973d1-77d5-44d4-9004-3e98b73c8473 | 0 | @Override
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
} |
99615151-2d01-40bf-8ac7-09d8202faa1d | 4 | @Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Combination that = (Combination)o;
if (!Arrays.equals(coins, that.coins)) {
ret... |
c50d1647-0cf5-44d2-ac9c-7a37e1bb3245 | 5 | private boolean isDiagonallyOccupied(HantoCell from, HantoCell to){
boolean isOccupied = false;
if (to.getX() > from.getX()){
for (int i = from.getX() + 1; i < to.getX(); i++){
if (findCell(i, -i) == null){
isOccupied = false;
break;
}
}
} else {
for (int i = to.getX() - 1; i < from.get... |
95c7ec70-db52-4a11-b9c8-e2fc059ce328 | 8 | private void readIndex() throws IOException {
// read the index entirely into memory
if (this.keys != null) {
return;
}
this.count = 0;
this.keys = new WritableComparable[1024];
this.positions = new long[1024];
try {
... |
1a91457f-54f4-4211-995d-f9c2530e5f14 | 7 | public synchronized boolean put(String key, String value) throws Exception {
if (key != null) {
key = key.replaceAll("[\n|\r]+","").trim();
if (key.length() > 0) {
key = new String(key.getBytes());
//if (!this.contains(key)) {
value = ne... |
057ce4bb-8d1c-4102-b7b2-476cf33521a9 | 6 | private void setBackgroundColor(int r, int g, int b) {
if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255)
this.view.color.setBackground(new Color(r,g,b));
} |
9f13fef4-c0bc-436d-a1f4-f6ce1d0cf59b | 8 | public static void putResult(String barrierServer, LinkedList<Record> records, Map<Long, LinkedList<Long>> edgeListMap, int blockSize){
BServer server;
try {
server = (BServer) Naming.lookup(barrierServer);
Result [] results = new Result[blockSize];
int remainLen = records.size();
ListIterator<Record> c... |
aead0156-6fcd-45e7-8024-db5a43b66f80 | 2 | public FlowBlock getNextFlowBlock(StructuredBlock subBlock) {
if (subBlock == subBlocks[0]) {
if (subBlocks[1].isEmpty())
return subBlocks[1].getNextFlowBlock();
else
return null;
}
return getNextFlowBlock();
} |
3a64002d-7dad-41fe-805e-84f882eb3037 | 3 | public SingleTreeNode uct() {
SingleTreeNode selected = null;
double bestValue = -Double.MAX_VALUE;
for (SingleTreeNode child : this.children)
{
double hvVal = child.totValue;
double childValue = hvVal / (child.nVisits + this.epsilon);
childValue =... |
13bc5c78-acdb-4830-a837-37162654c84a | 2 | public static Boolean dateIncrense(Date staticsDate){
Date d = new Date();
Date d1 = new Date();
Date d2 = new Date();
d1.setHours(0);
d1.setMinutes(0);
d1.setSeconds(0);
d2.setHours(23);
d2.setMinutes(59);
d2.setSeconds(59);
if(staticsDate.after(d1) && staticsDate.before(d2)){
return false... |
de736e97-dd5f-47b2-91e8-718b9a132935 | 7 | public String calculateGrade() {
double totalMarks = (quiz1 + quiz2 + quiz3 + quiz4) * .10;
totalMarks += (midTerm1) * .20;
totalMarks += (midTerm2) * .15;
totalMarks += finalTerm * .25;
double percentage = totalMarks; //because total maximum marks are 100 hence totalMarks would... |
82cc30a9-8d5c-4a2c-b780-32e3c98c32d5 | 5 | public void deliverMode(Player p){
if(this == PREVOTE){
p.setMaxHealth(20);
for(Objective o : p.getScoreboard().getObjectives()){
o.unregister();
}
}else if(this == VOTE){
p.setScoreboard(Vote.output);
MenuManager.sendPlayerVoteMenu(p);
}else if(this == POSTVOTE){
}else if(this == GAME){
... |
d94c1ecd-a754-4bdd-ba57-ae52f9183215 | 9 | public synchronized void bestowBlessings(MOB mob)
{
norecurse=true;
try
{
if((!alreadyBlessed(mob))&&(numBlessings()>0))
{
mob.location().show(this,mob,CMMsg.MSG_OK_VISUAL,L("You feel the presence of <S-NAME> in <T-NAME>."));
if((mob.charStats().getCurrentClass().baseClass().equals("Cleric"))
|... |
6652e199-750b-48aa-aab9-58ba655ae3b1 | 2 | public BufferedImage render() {
BufferedImage res = new BufferedImage(MainPanel.GAME_WIDTH,MainPanel.GAME_HEIGHT,BufferedImage.TYPE_INT_ARGB);
Graphics g = res.getGraphics();
g.setFont(MainPanel.font);
// black background for in case of
g.setColor(Color.black);
g.fillRect(0, 0, MainPanel.GAME_WIDTH, M... |
fa7a276b-0b77-4220-ac13-e72a75d48ba1 | 5 | @Override
/**
* @see IPlayer#bid(int, Pile)
*
* Return an integer of our bid. The bid must be higher than the current highest bid.
* Use the cards in our hand to determine how high we want to bid.
*/
public boolean bid(int currentHighestBid,Pile hand,boolean canMatch)
{
if(maxBid==-1)
{
/* First ti... |
5f002dc6-0efc-4448-bf3a-3a579ab834d6 | 9 | public static void main(String args[]) {
String cfgPath = "sephiabot.xml";
boolean greet = true;
final String usage = "\nUsage: sephiabot [-c config file] [--nogreet]\n" +
" Default config file: ./sephiabot.xml";
if (args != null && args.length > 0) {
for (int i = 0; i < args.length; i++) {
if (args[... |
c5c17a25-45ff-46ae-bb1b-27d37dbd34f4 | 2 | private void addHardwareSystemIfNew(HardwareSystem hardwareSystem) {
for(HardwareSystem hardwareSystemPresent : project.getHardwareSystemsCalculated())
if(hardwareSystemPresent.getId().equals(hardwareSystem.getId()))
return;
project.getHardwareSystems().add(hardwareSystem);
} |
eecc5732-4b18-49bb-811c-cd2271f633f5 | 7 | private void updateStateEntry(List<Keyword> keywords, List<String> terms, boolean inAden, boolean askPrice) {
if(keywords.isEmpty()) {
DialogManager.giveDialogManager().setInErrorState(true);
return;
}
int k_count = 0;
int t_count = 0;
for( Keyword kw : keywords) {
if(kw.getKeywordData().getWord().cont... |
e1242070-e6d8-4061-8dc6-477f581544cc | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(mob.fetchEffect(this.ID())!=null)
return Ability.QUALITY_INDIFFERENT;
final Room R=mob.location();
if(R!=null)
{
for(int r=0;r<R.numInhabitants();r++)
{
final MOB M=R.fetchInhabitant(r);
if((M!=nu... |
1c72c451-d9fa-42a5-a873-b82db9fa03ea | 6 | public void validaCampos(String dataInicio, String dataFim, boolean pendencia, String probInformado, String probDetectado, String probSolucao, String probPendencia) {
if (dataInicio.equals(" / / : ") == true) {
JOptionPane.showMessageDialog(null, "Data Início inválida!");
txt_da... |
36697af8-0a03-4d2e-a0c0-da9c0dcc894b | 8 | public static AbstractEvento manutencaoParseEvento(FuncionarioModel funcionario, ManutencaoModel model, EnumEtapasManutencao enumEM) {
if (enumEM.equals(EnumEtapasManutencao.RANQUEAMENTO)) {
return new EventoRanqueamento(model, funcionario);
} else if (enumEM.equals(EnumEtapasManutencao.ANAL... |
e900ef7d-d0c5-4f2c-b586-02558e07f7af | 2 | public static String unicode2String(String unicodeStr) {
StringBuffer sb = new StringBuffer();
String str[] = unicodeStr.toUpperCase().split("U");
for (int i = 0; i < str.length; i++) {
if (str[i].equals(""))
continue;
char c = (char) Integer.parseInt(str[i].trim(), 16);
sb.append(c);
}
return sb... |
1bce9235-f723-4c22-bff2-a01490dbbfd3 | 7 | public static void main(String[] args) {
if (args.length != 2) {
greska();
}
int algNum = -1;
try {
algNum = Integer.parseInt(args[0]);
} catch (NumberFormatException ex) {
greska();
}
File file = new File(args[1]);
if (!file.exists()) {
greska();
}
List<String> lines = null;
try {
... |
f6446c6d-0955-4030-b5da-1adb8c3b8d84 | 2 | private void deleteBall(int x, int y)
{
for(int i=0; i<Balls.size(); i++)
{
if(Math.sqrt(((x-Balls.elementAt(i).getPosition()[0])*(x-Balls.elementAt(i).getPosition()[0])) + ((y-Balls.elementAt(i).getPosition()[1])*(y-Balls.elementAt(i).getPosition()[1]))) <= Balls.elementAt(i).getRadius())
{
Balls.elemen... |
adbc4cfb-5f78-4c5e-a44c-37946a21d9bb | 5 | @Override
public MapConnector<String, Long> forceSynchronization() throws Exception {
try (Connection con = getConnectorInfo().getConnection()) {
forceClear();
int n = 0;
StringBuilder values = new StringBuilder();
String stm;
for (String s : getMa... |
1991b4ce-77f0-42ba-84c0-466db4c7e60e | 1 | public synchronized void put(T message) {
for (MessageQueue<T> q : outputs) {
q.put(message);
}
} |
9d095ae2-b528-4424-92ca-68c8a1f02cd9 | 2 | public static void main(String[] args) {
try {
Date dt = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
//System.err.println("DBThread Runs");
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.ge... |
8df3822d-63fd-469d-9cf5-11164c2d1a8e | 7 | public ArrayList<Auction> searchWinnerByUsername(String username,
String winner) {
try {
ArrayList<Auction> auctions = new ArrayList<Auction>();
String[] keywords = username.split(" ");
String[] usernames = winner.split(" ");
String sql = "select * from (select * from " + tableName
+ " where ";
... |
bcd41507-3dd9-49ef-a51e-a415041fe780 | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
e24fcec1-bbac-472c-b444-7a9cee457667 | 6 | private static void exportNode(final Node node, final BufferedWriter writer, final boolean force) throws IOException{
if (!node.isModified() && !force) {
return;
}
final StringBuilder nodeString = new StringBuilder();
nodeString.append(" ");
nodeString.append("<node"... |
36106d47-0b9a-4506-a390-d16cbaeb611d | 6 | public void mainMenu() {
do {
System.out.println();
MenuActions action = userInputManager.showMenu("QUIZ PLAYER MENU", playerMenu);
try {
switch (action) {
case SELECT_QUIZ_FROM_LIST:
try {
... |
ed836572-a5a0-4ddf-8c93-cd41a1c4bca4 | 8 | private Component luoAsetukset() {
JPanel panel = new JPanel(new GridLayout(4, 2));
JLabel pelaaja1Teksti = new JLabel("Pelaaja X: ");
final JTextField pelaaja1 = new JTextField();
JLabel pelaaja2Teksti = new JLabel("Pelaaja 0: ");
final JTextField pelaaja2 = new JTextField();
... |
d7a25aa6-15de-498a-9956-b2abcc8c95d1 | 7 | public double calculateSimilarity(float[] value1, float[] value2) {
float sum = 0.0f;
float sum1 = 0.0f;
float sum2 = 0.0f;
for (int i = 0; i < value1.length; i++) {
float v1 = value1[i];
float v2 = value2[i];
if ((!Float.isNaN(v1)) && (!Float.isNaN(v2... |
9d3a6f96-7b7e-4e52-a941-d8b752f1d341 | 3 | void startUp() {
try {
updateProgress("Unpacking archives...", 25);
titleArchive = getArchive(1);
small = new RSFont(false, "p11_full", titleArchive);
regular = new RSFont(false, "p12_full", titleArchive);
bold = new RSFont(false, "b12_full", titleArchive);
fancy = new RSFont(true, "q8_full", titleA... |
fdee34f9-303b-4835-a978-62a5634be93d | 9 | public static RNASecStr loadSecStrCT(String path)
{
RNASecStr res = null;
try
{
BufferedReader fr = new BufferedReader(new FileReader(path));
String line = fr.readLine();
String seqTmp = "";
Vector<Integer> strTmp = new Vector<Integer>();
while(line!= null)
{
line = line.trim();... |
6490f377-668e-43d8-bea9-ceb493fa15a7 | 2 | public boolean deleteAllSongs() {
try {
if (connection == null) {
connection = getConnection();
}
String sql = "delete from org.music";
Statement stmt = connection.createStatement();
return stmt.executeUpdate(sql) > -1;
} catch (Exception e) {
log.log(Level.SEVERE,e.getMessag... |
f412f8a7-1747-4d2e-9fe5-00585ea49c29 | 5 | public void doPrint() {
List<String> nodes = this.graph.getVertexes();
for (String node : nodes) {
List<String> edges = this.graph.getIncident(node);
for (String edge : edges) {
if (this.graph.getSource(edge).equals(node)) {
System.out.format("%4s (%3s,%3s) %4s",
node,
this.graph.g... |
692baf73-8d70-4ace-b2cf-5eb127459a78 | 7 | public String woundTaken(int épDamage, int fpDamage) {
if (épDamage != 0) {
épDamage -= armor.getSfé();
Ép -= épDamage;
Fp -= épDamage * 2;
} else {
fpDamage -= armor.getSfé();
Fp -= fpDamage;
}
if (Fp < 0) {
Ép -= ... |
0fb44684-6d7d-4543-85c9-411b7cbc70e1 | 9 | public Object[][] getMultipleRows(String testcase) {
String testSheetName = getTestSheetName(testcase);
if(testSheetName.equalsIgnoreCase("TestSheet Not Found")){
return null;
}
HSSFSheet testSheet = workBook.getSheet(testSheetName);
String cellData;
int totalRows = testSheet.getPhysicalNumberOfRows(); ... |
7565917c-6683-4276-adff-07a1c38f6604 | 9 | @Override
public boolean getNGramsFromService(String context, int maxResults)
throws NGramException {
try {
NgramServiceFactory factory = NgramServiceFactory
.newInstance(NGramStore.Key);
if (factory == null) {
// NGramException if the service fails to connect
throw new NGramException(
... |
8c0aeb82-05de-492a-a523-d1cc7b65dd88 | 1 | public void setUserlistImageOverlay_Height(int height) {
if (height <= 0) {
this.userlistImgOverlay_Height = UISizeInits.USERLIST_IMAGEOVERLAY.getHeight();
} else {
this.userlistImgOverlay_Height = height;
}
somethingChanged();
} |
78fbd9af-bd5f-481c-8851-f8336f4b33df | 0 | public void setCatched() {
catched = true;
} |
d2c1626c-90a6-400f-beea-e40d4ff8faa2 | 1 | public void drawHighlight(Graphics2D g) {
if (needsRefresh)
refreshCurve();
Graphics2D g2 = (Graphics2D) g.create();
g2.setStroke(new java.awt.BasicStroke(6.0f));
g2.setColor(HIGHLIGHT_COLOR);
g2.draw(curve);
g2.transform(affineToText);
g2.fill(bounds);
g2.dispose();
} |
d0fda837-df1c-4e0f-8d58-6cb7077c3a69 | 8 | public byte mixWt(String fileName) throws IOException {
initialize(fileName);
FileOutputStream fos = null;
DataOutputStream dos = null;
try{
// create file output stream
fos = new FileOutputStream("mixWt_bin");
// create data output stream
dos = new DataOutputStream(fos);
Strin... |
b6a8f390-cd34-4d7b-9c3e-abc9e567d140 | 0 | public void setTitle(String title) {
this.title = title;
} |
88f42acf-c99f-44cf-98fe-0060b2bd467c | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(!mob.amDead())
&&((mob.fetchAbility(ID())==null)||proficiencyCheck(mob,0,false)))
{
boolean yep=(msg.targetMinor()==C... |
9c8032e2-6ab0-47fb-89e5-fbc115d27a10 | 6 | public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column){
super.getTableCellRendererComponent(table, value, selected, focused, row, column);
if (column == 0 || column == 6){ //Week-end
setBackground(new Color(255, 220, 220));
}
e... |
0a0f8017-67b1-40b6-8bb3-0603675c7737 | 8 | public void poistaPieni() {
if (tyhja()) {
return;
}
boolean jarjVaihtoOk = false;
BinomiNode prev = null;
BinomiNode prevMin = null;
BinomiNode current = root;
BinomiNode currentMin = root;
BinomiKeko keko;
while (current != null) {
... |
b3ae9554-04a2-4057-b182-394ee0ffc33f | 6 | public static void main(String[] args) {
FileInputStream fis=null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream("MyBinaryFile.g");
ois =new ObjectInputStream(fis);
int x = ois.readInt();
double y = ois.readDouble();
Circle obj = (Circle)ois.readObject();
int radius=obj.g... |
83e4eecd-8822-43d3-af09-94fa5ac2ecb9 | 2 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
try {
String nome = jTextField1.getText();
long tel = Long.parseLong(jTextField2.getText());
String email = jTextField3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.