method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5c2c09f3-b4ed-4c23-b6a0-30ab6d71960b | 9 | public int minDistance(String word1, String word2){
int rowSize = word1.length();
int colSize = word2.length();
if(rowSize == 0){
return colSize;
}
if(colSize == 0){
return rowSize;
}
int res[][] = new int[rowSize+1][colSize+1];
for(int i=0; i<=rowSize; i++){
res[i][0] = i;
}
for(int j=0; j... |
11b9feb0-2300-4142-af4d-d274a100d81d | 5 | public static void main(String[] args) throws KeyNotUpdatedException, KeyNotFoundException {
RepositoryUpdate theMerge = new RepositoryUpdate();
PlayerRepository<Schema.Player> repository = JacksonPlayerRepository.create("/master.player.json");
for(Schema.Player p : repository.getPlayers()) {... |
609a4cef-a60e-4169-aae0-4deca0187595 | 2 | public static void ChooseCody ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Cody";
Game.CharacterOneHP = CharacterStats.CodyHP;
Game.CharacterOneAttack = CharacterStats.CodyAttack;
Game.CharacterOneMana = CharacterStats.CodyMana;
Game.CharacterOneRegen = CharacterStats.CodyRe... |
b34cf076-bf49-427c-bd4c-760389e0ab53 | 1 | public void load45DegreeSlope(Rectangle2D e) {
for(int x = 0; x < TileSet.tileWidth; x++) {
platforms.add(new Platform(new Rectangle2D.Double(e.getX() + x, e.getY() + x, 1f, 2f)));
}
} |
08f6b0fa-bef0-4c89-84be-17bb5359080f | 3 | public Transition modifyTransition(Transition transition, TableModel model) {
TMTransition t = (TMTransition) transition;
try {
String[] reads = new String[machine.tapes()];
String[] writes = new String[machine.tapes()];
String[] dirs = new String[machine.tapes()];
for (int i = 0; i < machine.tapes(); i... |
6fa1dcb5-f819-4dcf-9881-ec13241737a4 | 9 | @Override
public void initWithMessage(String messageString) {
Matcher matcher = PATTERN.matcher(messageString);
if (matcher.matches()) {
if (!matcher.group(1).equals("null")) {
this.setplayerPositionID1(Integer.parseInt(matcher.group(1)));
}
if (!... |
1162d1c1-a8f4-4910-b16b-fb0bdab70e84 | 6 | public void AtualizarProjeto(Projeto projeto) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_UPDATE_UM_PROJETO);
comando.setString(1, ... |
6d167674-d74e-4cdc-b9c3-3d1d9e7947b1 | 2 | public Constant newMethod(final String owner, final String name,
final String desc, final boolean itf) {
key3.set(itf ? 'N' : 'M', owner, name, desc);
Constant result = get(key3);
if (result == null) {
newClass(owner);
newNameType(name, desc);
result = new Constant(key3);
put(result);
}
return ... |
2f17c7ab-583b-400e-b86d-dac367ed9eea | 9 | private void initRat() {
Reflections reflections = new Reflections("de.LittleRolf.MazeOverkill");
Set<Class<? extends MazeRat>> subTypes = reflections
.getSubTypesOf(MazeRat.class);
for (Class<? extends MazeRat> clazz : subTypes) {
try {
rats.add(clazz.getConstructor(Point.class, Maze.class)
.n... |
6bf35546-b9ca-4ec4-a1c4-cb9cda27e73c | 7 | private static String toSimpleCase(String value, boolean upper) {
if (value == null || value.length() == 0) {
return value;
}
char[] ca = value.toCharArray();
for (int i = 0; i < ca.length; i++) {
int type = getType(ca[i]);
if (upper && type == LOWER) {
ca[i] = (char)(ca[i] - 32);
} else if (!up... |
f5ebf865-14b9-4791-ae15-8b1e0164e2d8 | 7 | public double[] train(List<Instance> trainingInstances, List<Instance> testingInstances) {
int dimension = trainingInstances.get(0).getFeatures().length;
int trainSize= trainingInstances.size();
int testSize = testingInstances.size();
List<double[]> weights = new ArrayList<double[]>();
List<Integer> c = ne... |
4b471f3d-04ff-4dd8-b20a-cc9fe1b2bc25 | 6 | @EventHandler
public void CaveSpiderBlindness(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.getCaveSpiderConfig().getDouble("Cave... |
68c7d3e0-d7b6-45b3-9cae-79e4a034f973 | 4 | private void jPanel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseClicked
String message = jTextArea1.getText().replace("\n", "");
//sending message
try
{
String selected = this.getjList1().getSelectedValue().toString().trim();
... |
309b2e62-6bc6-4908-a5db-625de40d56ec | 7 | public void doRun(int run) throws Exception {
if (m_ResultProducer == null) {
throw new Exception("No ResultProducer set");
}
if (m_ResultListener == null) {
throw new Exception("No ResultListener set");
}
if (m_Instances == null) {
throw new Exception("No Instances set");
}
... |
92e28a76-02d4-4e75-ad91-220a5411626c | 4 | private ArrayList<Move> getAttackingMoves(ArrayList<Move> allMoves) {
// TODO Auto-generated method stub
ArrayList<Move> answer = new ArrayList<Move>(allMoves.size());
for(Move m : allMoves)
{
Piece pieceBeingAttacked=myGame.getPiece(m.getCurrentLocation());
if(pieceBeingAttacked!=null&&pieceBeingAtta... |
98c94cc1-94e1-4412-b0b3-d31a5d1ea432 | 0 | public Socket getSocket() {
return _socket;
} |
25f27f71-678c-45a4-a517-8c20f3013081 | 2 | public static void update() {
for (int i = 0; i < NUM_KEYCODES; i++)
lastKeys[i] = getKey(i);
for (int i = 0; i < NUM_MOUSEBUTTONS; i++)
lastMouse[i] = getMouse(i);
} |
932a2ab0-b592-4c77-92b8-743ca17e40ee | 2 | public static void main(String args[]) throws Exception {
ExecutorService pool = Executors.newFixedThreadPool(4);
Set<Future<Integer>> set = new HashSet<Future<Integer>>();
String[] args1 = "13 12 12 14".split(" ");
for (String word: args1) {
Callable<Integer> callable = new ... |
2da513fe-de65-414b-8493-152fc366e8ce | 5 | private ArrayList<String> fetchMatchingAnstallda() {
String searchFor = tfAnstalldSearch.getText();
ArrayList<HashMap<String, String>> temp = null;
try {
temp = DB.fetchRows("select * from anstalld");
} catch (InfException e) {
e.getMessage();
}
A... |
eb9086f3-0e57-4ad4-81e5-3f05a10153bc | 7 | private String useTextBoxVariables(String s) {
int n = view.getNumberOfInstances(TextBoxComponent.class);
if (n <= 0)
return s;
int lb = s.indexOf("%textbox[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
TextBoxComponent text;
while (lb != -1 && rb != -1) {
v = s.substring(lb +... |
603f2c87-03c6-4b2a-a79f-74a87eab917c | 3 | public AngleDR Mapqk(Stardata s, AMParams amprms) {
int i;
double pmt, gr2e, ab1, eb[], ehn[], abv[], q[], pxr, w, em[] = new double[3], p[] = new double[3], pn[] =
new double[3], pde, pdep1, p1[] = new double[3], p1dv, p2[] = new double[3], p3[] = new double[3];
TRACE("Mapqk");... |
ced3159e-eb77-430f-872d-bb9890b197d8 | 1 | public List<ExtensionsType> getExtensions() {
if (extensions == null) {
extensions = new ArrayList<ExtensionsType>();
}
return this.extensions;
} |
c8230489-e20e-4007-8d3f-e98bec4376d9 | 5 | public void cleanFactory() {
List<M> models = new ArrayList<M>(this.models);
for (M model : models)
if (model.getModelId().isNewId()
&& model.getModelStatus() == ModelStatus.TO_DELETE)
this.markDeleted(model);
for (M model : models)
if (model.getModelStatus() == ModelStatus.DELETED)
this.unr... |
9361d955-19fe-4b2d-a4e2-df7f0f802016 | 8 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... |
c481d533-c5ba-45b9-bd24-dbc797723ec6 | 3 | private void inicializarNivel(String nivelIngresado){
if(nivelIngresado.equals("Basico")){
nivel = nivel + nivelIngresado;
intentos = 6;
pistasPermitidas = 3;
}
if(nivelIngresado.equals("Intermedio")){
nivel = nivel + "Intermedio";
intentos = 4;
... |
ac88dd5b-0611-41c9-99d4-8219aa84cdac | 3 | public Robot createRobotInstance(final ClassInfo info) throws IOException, ReflectiveOperationException {
final PluginClassLoader loader = new PluginClassLoader(ClassLoader.getSystemClassLoader());
final ClassOrigin origin = info.getOrigin();
if(origin.inJar) {
loader.defineJar(info);
} else {
Set<ClassI... |
ecc63f62-1970-4f8c-b73a-f13e49d2675d | 9 | public CropState state() {
if (this instanceof IWeeds) {
if (((IWeeds) this).weeds() > 0) {
return CropState.WEEDS;
}
}
if (empty()) {
return CropState.EMPTY;
}
if (this instanceof ICanDie) {
ICanDie canDie = (ICanDie) this;
if (canDie.diseased()) {
return CropState.DISEASED;
}
... |
738b8c5a-232e-44ae-ab57-23e91f572ff5 | 5 | public CheckResultMessage check21(int day) {
int r = get(39, 5);
int c = get(40, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r + 1, c + day, 10).subtract(
getValue(r, c + ... |
d354ae41-2bf3-4279-ac07-d8be69de93cb | 2 | public boolean canPlaceRobber(HexLocation hexLoc) {
if(hexLoc.equals(serverModel.getMap().getRobber().getLocation()) || gameModel.getBoard().get(hexLoc).getType() == HexType.WATER)
return false;
return true;
} |
bc5eb154-4919-4060-97b6-06abf124f080 | 1 | public static void streamCopy(InputStream is, OutputStream os) throws IOException {
byte[] buffer = new byte[1024 * 1024];
int bytesRead;
while ((bytesRead = is.read(buffer)) > 0) {
os.write(buffer, 0, bytesRead);
}
} |
5dbba976-c4dc-4886-9418-a4068c65a92b | 1 | @SuppressWarnings({ "rawtypes", "unchecked" })
public JList getFontStyleList()
{
if (fontStyleList == null)
{
fontStyleList = new JList(getFontStyleNames());
fontStyleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fontStyleList.addListSelectionListen... |
1adeb276-673b-4a66-8239-bc7db1fd923d | 7 | public static double similarity(int userId1, int userId2,
MoviesAndRatings mar1, MoviesAndRatings mar2) throws SQLException {
double result = 0;
List<Movie> list1 = mar1.getMovies();
List<Movie> list2 = mar2.getMovies();
if (movies == null)
movies = getMovies();
List<Movie> commonMovies = new LinkedList... |
42eb6b34-6fb3-4b3c-831d-24d3cdfdabbb | 1 | @Override
public int getValues(AnimatedScore target, int tweenType, float[] returnValues) {
switch(tweenType) {
case ALPHA:
returnValues[0] = target.getColor().a;
return 1;
default:
assert false;
retu... |
ce8b1582-001c-40e1-9fdb-6aaef2920f9b | 9 | private void actuallyLoad() {
if (this.current < 0)
return;
if (this.current == this.loader.getIndex()) {
// We are in the process of pre-fetching the image we want to
// display.
if (this.loader.isLoaded()) {
this.onLoaded(this.loader.get... |
803bd30e-28ce-410c-a388-cb7100cd0e78 | 0 | @Test
public void findDuplicateTypeHand_whenThreeFoursTwoJacksTwoKingsExist_returnsFullHouseFoursOverKings() {
Hand hand = findDuplicateTypeHand(foursFullWithTwoJacksAndTwoKings());
assertEquals(HandRank.FullHouse, hand.handRank);
assertEquals(Rank.Four, hand.ranks.get(0));
assertEquals(Rank.King, hand.ranks.g... |
76e1774f-e4dc-4ab4-ad13-8e4c13dcb653 | 9 | public void giveBump(Entity e){
char bumpIdentity = e.getIdentity();
if (bumpIdentity == analagousStates[0]){
decisions.analagousGas(e);
}
if (bumpIdentity == analagousStates[1]){
decisions.analagousLiquid(e);
}
if (bumpIdentity == analagousStates[2]){
decisions.analagousSolid... |
61f508e4-3efd-44b2-979c-f55b9b25a988 | 6 | public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.drawImage(new ImageIcon(Utils.getLocalImage("/images/news_bg.p... |
1646dfca-e54b-48f4-b746-1163f7a08bcc | 1 | CompilerGUI() {
super("Compiler");//标题
setLayout(null);//布局
setBackground(Color.gray);//背景色
setSize(1240, 700);//
setVisible(true);//设置可见
load = new Button("Load File");//创建按钮
ge_token = new Button("GE Token");
ge_tree = new Button("GE Tree");
ge_l... |
a004825c-beb7-4b63-a23f-48b42ba55afe | 7 | private Exam parseExam(final Node exam) {
String name = "";
String mark = "";
final NodeList fields = exam.getChildNodes();
for (int i = 0; i < fields.getLength(); ++i) {
final Node field = fields.item(i);
if (field != null) {
if (field.getNodeType() == Node.ELEMENT_NODE) {
final Node item = fie... |
b2568b86-e1b9-41d3-b784-1d81acfaac21 | 9 | @Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
if (msg instanceof HttpResponse) {
HttpResponse response = (HttpResponse) msg;
System.err.println("STATUS: " + response.getStatus());
System.err.println("VERSION: " + response.getProtocolVers... |
47f6bfbe-838c-4a69-9e8b-507a292f32c3 | 2 | private JButton getBtnGetLyrics() {
if (btnGetLyrics == null) {
btnGetLyrics = new JButton("Get lyrics");
btnGetLyrics.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
WikiaXMLHandler xmlHandler = new WikiaXMLHandler();
SongFinder songFinder = new Song... |
46281d65-53db-4069-ae8b-261f8d084271 | 2 | public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals(add.getActionCommand())){
PositionTransformation pt = parent.getTransformator();
if(pt.supportReverseTranslation()) {
pt.translateToLogicPosition(pos.x, pos.y);
parent.addSingleNode(new Position(pt.logicX, pt.logicY, pt.logicZ)... |
717a450a-10b8-42b8-b9a4-8c8d2edbb9b3 | 5 | private void handleRegionRect(Attributes atts) {
if (currentRects == null)
return;
int i, l=0, t=0, r=0, b=0;
if ((i = atts.getIndex(ATTR_l)) >= 0) {
l = new Integer(atts.getValue(i));
}
if ((i = atts.getIndex(ATTR_t)) >= 0) {
t = new Integer(atts.getValue(i));
}
if ((i = atts.getIndex(ATTR_... |
f828a386-c68f-4c9f-bbfb-7fa121dedce7 | 2 | private boolean memeChecker(String input)
{
boolean isAMeme = false;
for (String currentMeme : memeList)
{
if (input.equalsIgnoreCase(currentMeme))
{
isAMeme = true;
}
}
return isAMeme;
} |
acce516b-cab8-4c9e-bc66-ee83b939a524 | 0 | private void initPathField(){
/*
* Initialize text field to form which sets the path to dictionaries;
*/
directoryPath = new JTextField(destinationDir.getAbsolutePath());
directoryPath.setSize(FP_TFIELD_SIZE);
directoryPath.setLocation(5, 10);
/*
* ... |
577fd242-2a14-4ca7-ac0b-730c21e2417f | 6 | public Leaf(Link key, int t, Junction parent, Leaf next, Leaf previous){
this.T= t;
this.size= 1;
this.data= new Vector<Link>();
this.next= next;
this.parent= parent;
if ((previous != null) && (next != null)){ //sets the new Link's 'next' and 'prev' values
this.data.add(key);
key.setNext(next.getFirst... |
20ef26ba-86f1-498a-920b-10f88308bb90 | 3 | public int findPath(int beginning, int target, Oergi oergi) {
this.path = new ArrayList<Integer>();
this.oergi = oergi;
prioritizeVortexes(beginning);
while (!vortexHeap.isEmpty()) {
Vortex closestVortex = vortexHeap.remove();
if (closestVortex.getId() == target) {
backtrackPath(closestVortex);
... |
c09b80fd-6e0a-421c-b985-4dfac4dbad6e | 9 | private static void afficherEtudiantCours() {
ArrayList<Cours> listeCours = ListeCours.getInstance().getListe(); // Liste des cours
int i = 0; // Compteur
int element; // Nombre lu au clavier representant le numero d'un cours
Cours choix = null; // Cours dont on veut affiche... |
3766c64c-90d1-47c3-a454-ac2a2cce24e0 | 9 | public synchronized static AlienFXController getAlienFXDevice()
throws AlienFXControllerNotFoundException, AlienFXControllerUnknownDeviceException,
AlienFXCommunicationException
{
if(controller != null)
return controller;
int deviceId = LEDController.initialize();
if(deviceId == LEDController... |
b72f9f19-3dfc-4ba1-869c-22e96ce6edb3 | 5 | public static boolean shouldBuild() {
int bays = UnitCounter.getNumberOfUnits(buildingType);
// int barracks =
// UnitCounter.getNumberOfUnits(TerranBarracks.getBuildingType());
int factories = UnitCounter.getNumberOfUnits(TerranFactory.getBuildingType());
// // Version for expansion with cannons
// if (Bo... |
2edb0bc7-e6b3-44de-ad95-e960b41b7ce7 | 9 | private static void checkName(String label, String ident) {
if (ident.length() == 0) {
throw new EdnSyntaxException("The " + label +
" must not be empty.");
}
char first = ident.charAt(0);
if (isDigit(first)) {
throw new EdnSyntaxException("The... |
812d30cb-9c9b-4733-b114-4799b9bf48a5 | 9 | public static StringBuffer cstats(CharStats E, char c, HTTPRequest httpReq, java.util.Map<String,String> parms, int borderSize)
{
final StringBuffer str=new StringBuffer("");
final PairVector<String,String> theclasses=new PairVector<String,String>();
if(httpReq.isUrlParameter(c+"CSTATS1"))
{
int num=1;
S... |
4ee9e5ec-c7c0-4f04-9b66-116643620122 | 7 | @Override
@JsonIgnore
public void applyDefaultValues(boolean force) {
if (force || sourceRoutingKey == null) {
sourceRoutingKey = "#";
}
if (force || requeue == null) {
requeue = false;
}
if (force || number == null || number < 1) {
number = 1;
}
} |
81dfa1fb-361f-46f4-bc0f-29a0d2a88b30 | 7 | * @param mvdPos the start-position of the first term in the mvd
* @param firstTerm the first term of the query
* @return the set of versions it was found in (may be empty)
*/
public BitSet find( String query, int mvdPos, String firstTerm )
{
int pos = 0;
String rhs = query;
... |
47883ce2-1742-42be-819c-42ef81cac480 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "AgreementMethod")
public JAXBElement<AgreementMethodType> createAgreementMethod(AgreementMethodType value) {
return new JAXBElement<AgreementMethodType>(_AgreementMethod_QNAME, AgreementMethodType.class, null, value);
} |
e078a19a-902d-4172-8492-8d24c10b0f4a | 2 | CountByType countMarkerTypes(Collection<Marker> markersToCount) {
CountByType countByMarkerType = new CountByType();
for (Marker marker : markersToCount) {
String type = markerTypes.getType(marker);
String subtype = markerTypes.getSubType(marker);
countByMarkerType.inc(type);
if (subtype != null) countB... |
780343d1-8f51-4b9c-ae61-a8682c9a7a24 | 8 | private boolean isSymmetricAndHasZeroDiagonal() throws NonZeroDiagonalException
{
boolean execute = true, result = true ;
for(int i = 0 ; i < this.row ; i++) {
for(int j = 0 ; j < this.col ; j++) {
if(i != j && matrix[i][j] != matrix[j][i]) {
//If the current entry is not on the m... |
1e056834-7911-426a-ac4e-ee66ef3d43f7 | 6 | public Configuration(ButtonWarpRandom plugin){
Configuration.plugin = plugin;
plugin.getConfig().options().copyDefaults(true);
plugin.getLogger().info("Configuration loaded!");
List<?> biomesInc = plugin.getConfig().getList("included-biomes");
for (Object b : biomesInc){
String biome = ((... |
79fbbe2d-173e-4af0-8798-e807717ed472 | 6 | public void searchMultiTripFlightsPartTwo() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = null;
Conne... |
9c481699-ff13-4b59-afcf-d68d77d9bd0e | 1 | public Expr parseExpression(String xpathExpression){
try {
JaxenHandler handler = new JaxenHandler();
XPathReader reader = XPathReaderFactory.createReader();
reader.setXPathHandler(handler);
//Parse an XPath expression, and send event callbacks to an XPathHandler.
reader.parse(xpathExpress... |
a929b8cd-a74e-4518-b96a-9ccfed3acedf | 4 | public static void keyIndexedCounting(int[] a, int R) {
int N = a.length;
int[] count = new int[R + 1];
int[] aux = new int[N];
// count frequencies
for (int i = 0; i < N; i++)
count[a[i] + 1]++;
// accumulate freq
for (int r = 0; r < R; r++)
count[r + 1] += count[r];
// sort
for (int i... |
4a8e8f8b-4326-4028-a44b-2001b14a5ca5 | 9 | public boolean waitForConnection() {
if (connected) {
log("error: connection has been already established");
return true;
}
if (connecting) {
log("error: already waiting for client");
return true;
}
connecting = true;
abortRequestSent = false;
if (!serverSocketOpened)
openServerSocket();
... |
dd11a746-4b51-4793-8c1e-ebc226ee6fb8 | 4 | private void setPreferredRaces() {
if (!_raceLocked) {
_raceBox.removeActionListener(_raceListener);
_raceBox.removeAllItems();
Vector<BaseRace> preferred = _character.getRankedRaces(16);
Vector<BaseRace> average = _character.getRankedRaces(15);
Vector... |
24b7a6e4-e916-4238-9caa-ad70692dc746 | 5 | private void addKompToList() {
lblKompError.setVisible(false);
DefaultListModel<AnstalldKompPlattNiva> dlm = (DefaultListModel<AnstalldKompPlattNiva>) listChosenKomp.getModel();
Kompetensdoman chosenKomp = (Kompetensdoman) cbKompNamn.getSelectedItem();
Plattform chosenPlat = (Plattform) ... |
bcdaa874-ada0-455c-ba62-a1e15b322fa9 | 6 | @Override
public void run(){
while(!super.detener){
try{
if(!this.guerreroColaAtaques.isEmpty())
recibirdaño();
if(this.objectivo.x==0&&this.objectivo.y==0)
this.objectivo=getObjectivo();
... |
00d88ad3-a35e-4f41-8a8b-973c963781f1 | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
c6239102-8943-4172-b877-333ceb6b2f52 | 6 | public static Cons removeDuplicatesFromLongList(Cons self, boolean equaltestP) {
{ int tablesize = Native.ceiling(self.length() * 0.3);
Cons[] table = new Cons[tablesize];
Cons cursor = self;
Stella_Object item = null;
Cons bucket = null;
int bucketindex = 0;
{ int i = Stella.NU... |
8f92fda3-81f9-43ed-a7ab-16f4cdd0514f | 4 | private Object handleForm(Object tos) {
if (tos instanceof GedcomVersion && ((GedcomVersion)tos).getForm() == null) {
return new FieldRef(tos, "Form");
}
else if (tos instanceof Media && ((Media)tos).getFormat() == null) {
return new FieldRef(tos, "Format");
}
return null... |
5000e222-e29e-4138-846e-38c6df515ba0 | 1 | private String[] getLogToFilesPropertyValue(final Properties properties) {
String values = this.getPropertyValue(properties, LOG_TO_FILES_TAG, null);
if (values == null) {
return null;
}
return values.split(OUTPUT_SEPARATOR);
} |
ca0b616b-d86c-41d8-81ae-ec2cf4999e08 | 0 | protected Element createAutomatonElement(Document document, Automaton auto,
String name) {
Element se = document.getDocumentElement();
Element be = createElement(document, name, null, null);
se.appendChild(be);
//System.out.println("auto: " + auto);
writeFields(document, auto, be);
return be;
} |
5a490972-c472-4de1-887e-e3000dc1998f | 0 | public void setValueAt(Object value, int row, int column) {
despaceSet((String) value, entries[row][column - 1]);
fireTableCellUpdated(row, column);
} |
b0c91386-64c6-4135-9631-4cce5a665897 | 5 | Class33(GameMode class230, int i, IndexLoader class45) {
do {
try {
aClass45_458 = class45;
if (aClass45_458 == null)
break;
int i_6_ = -1 + aClass45_458.getAmountChildren();
aClass45_458.getAmountChildEntries(i_6_);
} catch (RuntimeException runtimeexception) {
throw Class348_Sub17.method292... |
d7f2bb08-2545-499b-a840-93cded51443e | 0 | public BoundaryBox getBB(){
return bb;
} |
d7f92c55-035c-4bd8-af34-8fc961e96e35 | 6 | private PortalScript getPortalScript(String scriptName) {
if (scripts.containsKey(scriptName)) {
return scripts.get(scriptName);
}
File scriptFile = new File("scripts/portal/" + scriptName + ".js");
if (!scriptFile.exists()) {
scripts.put(scriptName, null);
return null;
}
FileReader fr = null;
... |
9a1e821c-037a-42b1-96c7-cd9ec6fb845a | 2 | public void lisaaJonoonArvollinen(Arvollinen lisattava)
throws IllegalArgumentException, IllegalStateException {
if (lisattava == null) {
throw new IllegalArgumentException();
}
if (seuraavaArvollinen != null) {
throw new IllegalStateException();
... |
7d325999-2909-4df5-b19f-9ff07941f9d6 | 9 | private boolean canCastleQueenSide( int position ) {
return ( !hasPieceMoved( pieceAt( position ) ) && !kingInCheck() && pieceTypeAt( position + 3 ) == ROOK && !hasPieceMoved( pieceAt( position - 4 ) )
&& squareEmpty( position - 1 ) && !squareAttacked( position - 1 )
&& squareEmpty( positi... |
c582238e-3f0f-4493-8e51-387898c6db59 | 1 | public void setTextFill(float textFill) {
if(textFill == -1)
this.textFill = getLength();
else
this.textFill = textFill;
} |
69f84ca9-afdb-46d5-bae2-9c6bb7abbfc4 | 0 | public void removeVisitor(Element element) {
elements.remove(element);
} |
46ae128c-2487-4191-8bab-aad48ab8605b | 5 | static boolean SendMessage(ForwarderMessage message){
if (message.to.equalsIgnoreCase(Setup.ROUTER_NAME)) {
// we are the target
Setup.println("<<Received Incoming Message to ME from " + message.from + ">>\n" + message.text + "\n");
return true;
}
InetAddress ... |
6459d538-58b2-44fe-aa72-8892e6c85859 | 1 | private void addOximata(){
/*
* vazei ta oximata apo thn vash sthn dropdown lista
*/
ArrayList<String> oximata=con.getOximata(); //pairnei ta oximata apo tin vasi kai ta apothikeui sthn ArrayList<String>
for(int i=0;i<oximata.size();i++){
oximataBox.addItem(oximata.get(i)); //prostheti to oxima sthn dropdown l... |
e7044e3e-ce12-48cf-8201-5fec7438eae6 | 2 | public static void addNanoPostsIntoTree(ArrayList<NanoPost> npList, JTree tree, NBFrame nbf) {
// Add all OP posts and their child posts in tree
DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode)tree.getModel().getRoot();
for (NanoPost np : npList) {
DefaultMutableTr... |
bb4f3c35-861d-43cf-8c6f-7f6d2cb049be | 9 | public void run()
{
theLogger.info("Entering the Client Worker Thread :: "+threadId);
try {
registerCommands();
} catch (ServiceException ex) {
theLogger.log(Level.SEVERE, "Unable to register the commmands: impossible to proceed",
ex);
... |
0952afa0-396a-48a8-acd3-6d4363ae75b0 | 7 | public Image hsi_adjust(Image im, int width, int height, int hue, int saturation, int brightness)
{
// The hue, saturation, and brightness variables represent values in the range
// from -100 to 100. -100 is a full decrease in value, 0 is no change, and 100 is a full
// increase.
//... |
1ac4f391-190b-4d8f-baa9-f1d58b4226da | 3 | public void acquirePowerUp(PowerUp powerUp) {
// remove it from the map
map.removeSprite(powerUp);
if (powerUp instanceof PowerUp.Star) {
// do something here, like give the player points
soundManager.play(prizeSound);
}
else if (powerUp instanceof PowerU... |
384527eb-1a1e-4d61-aa3e-303b23a333eb | 5 | public void insertObjects(ConnectionWrapper cw, ProtectionManager protectionManager)
throws SQLException
{
ArrayList<InsertionObject> toRemove = new ArrayList<InsertionObject>();
for (InsertionObject i : buffer)
{
// insert the object
Long id = persist.saveObjectUnprotected(cw, i.getInsertionObject(), t... |
16c70ccc-6e02-4409-96fe-ec10a93e4c9c | 7 | @Override
public Team[] balance(Player[] players) {
int playersByTeam = players.length / 2;
Team team1 = new Team(playersByTeam);
Team team2 = new Team(playersByTeam);
Team t1;
Team t2;
int playersInT1;
int playersInT2;
int difference = 0;
for (Player player : players) {
difference += player.g... |
6ec064cd-2f46-4d31-8330-bb7ea3e3c464 | 8 | public static void main(String[] args) {
BlackJackGame bjg;
Scanner stdin=new Scanner(in);
String prompt;
boolean shouldRun=true;
out.println("Welcome to BlackJack!");
out.println("What is your name?");
String name = stdin.nextLine();
out.println("How many decks do you want to play?");
int numOfDecks=... |
58345e27-0e1b-438d-b4cc-6464d71c0fca | 7 | public int update(String[] updateStrings)
{
DBConnection DBToUse=null;
int Result=-1;
String updateString=null;
try
{
DBToUse=DBFetch();
for (final String updateString2 : updateStrings)
{
updateString=updateString2;
try
{
Result=DBToUse.update(updateString,0);
}
catch(final ... |
67c2fc20-1ebe-4574-a39e-4b9cc14447bc | 7 | public boolean nextP() {
{ StellaHashTableIterator self = this;
{ KvCons cursor = self.bucketCursor;
if (self.firstIterationP) {
self.firstIterationP = false;
}
else if (cursor != null) {
cursor = cursor.rest;
}
if (cursor == null) {
{ Kv... |
bc679d32-6af4-4032-9d51-2ba0c7116ab0 | 4 | @Override
public int hashByteArray(byte[] array) {
final int c1 = 0xcc9e2d51;
final int c2 = 0x1b873593;
int length = array.length;
int h1 = 0xdeadbeef ^ length;
int pt = 0;
while(length >= 4){
int k1 = (array[pt] & 0xFF) << 24;
k1 |= (array[pt + 1] & 0xFF) << 1... |
98d7f582-bf08-4239-a556-0572c879d11e | 3 | public void setToZero(){
beings.clear();
for (Being being: zeroBeings){
if (being.isHuman()){
beings.add(new Human(being.getX(), being.getY()));
}
if (being.isZombie()){
beings.add(new Zombie(being.getX(), being.getY()));
}
... |
85977e91-a978-45b5-a9d7-0fed2687912c | 1 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof TVC)) {
return false;
}
return id == ((TVC) obj).id;
} |
eb43e083-eee1-4dde-89b2-9e490371115f | 5 | @Override
public void onFirstUpdate(){
if(ParticleSystem.isEnabled()){
// XXX DANGER WILL ROBINSON XXX
List<Vector3f> hotSpots = getHotSpotsFor("Engine");
if( hotSpots == null) {
// No Engine hotspots defined
return;
... |
b3ff2304-a644-45af-8852-58a173ced28d | 1 | public ModeloCliente(ControladorCliente c) {
controlador = c;
ParseadorDeXML parser = new ParseadorDeXML();
if (!parser.chequearSiExisteXML(ControladorCliente.ARCHIVO_CONEXION))
parser.crearXML(ControladorCliente.BACKUP_CONEXION, ControladorCliente.ARCHIVO_CONEXION);
parser.parsearXML(ControladorCliente.ARCH... |
90126707-d394-4835-966b-80e0cc75d9d2 | 0 | public String getNote() {
return note;
} |
9b997089-01a2-4632-ba33-45cb590de92d | 7 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.ban + " (PlayerName) (message)");
return;
}
... |
a321f564-bc93-4e79-bcbb-90875ced1dc8 | 4 | @Override
public double getValue(int row, int col) throws MatrixIndexOutOfBoundsException {
if ((row < 0) || (col < 0) || (row >= mas.length) || (col >= mas[0].length)) {
throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index.");
}
return mas[row][col];
} |
9b250dd9-3b6f-4bcb-8130-f7d41d7fed59 | 5 | public void testStaticQueryInvalidSourceText2() {
String goal = "p(]";
try {
Query.hasSolution(goal); // should throw exception
fail(goal + " (bad syntax) succeeded"); // shouldn't get to here
} catch (org.jpl7.PrologException e) { // expected exception
if (e.term().hasFunctor("error", 2) && e.term().arg... |
916029ee-3be0-4d8d-80be-ddfecd0e48b8 | 8 | @Override
public void run(){
try {
Registry reg = LocateRegistry.createRegistry(Util.puertoServidor);
ServidorCentral servidor = new ServidorCentral();
reg.rebind("servidor",servidor);
} catch (Exception e) {
e.printStackTrace();
} ... |
d36fe539-9651-4e1d-b1f1-033348d02d66 | 3 | private double calculatePearson() {
double total1 = 0, total2 = 0;
for (int i = 0; i < itemIds.length; i++) {
total1 += ratings1[i];
total2 += ratings2[i];
}
double average1 = total1 / itemIds.length, average2 = total2 / itemIds.length;
double numerator = 0, denominator1 = 0, denominator2 = 0;
for (in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.