method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3f63b389-756f-4612-a407-8d4b256db7af | 7 | protected Field getField(Object obj, String fieldname)
{
Class<?> type = obj.getClass();
// Creates the fields cache
if (fields == null)
{
fields = new HashMap<Class, Map<String, Field>>();
}
// Creates the fields cache entry for the given type
Map<String, Field> map = fields.get(type);
if (map =... |
df28f20a-45f3-44bf-a9d7-70587adeb4e6 | 8 | public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) {
Assert.notNull(request, "Request must not be null");
Enumeration<String> paramNames = request.getParameterNames();
Map<String, Object> params = new TreeMap<String, Object>();
if (prefix == null) {
prefix = ""... |
c1268ce8-b9f0-401b-aa33-68bba8fed11e | 0 | public static void createButtonList(){
buttons.add(czajowniaButton);
buttons.add(renomaButton);
buttons.add(odZmierzchuDoŚwituButton);
buttons.add(galeriaDominikańskaButton);
buttons.add(magnoliaButton);
buttons.add(monopolRoofButton);
buttons.add(arkadyButton);
... |
cdd7c9fd-9e38-431a-a759-fa3574e28e3b | 0 | public void setMedico(Medico medico) {
this.medico = medico;
} |
eefcbb8a-253e-4ab5-b180-fdc2e02eb5cf | 5 | @Override
public final String uri() {
final int key = this._key_;
final BEXFileLoader owner = this._owner_;
switch (BEXLoader._typeOf_(key)) {
case BEX_ATTR_NODE:
return owner._attrUriText_.get(owner._attrUriRef_.get(BEXLoader._refOf_(key)));
case BEX_ELEM_NODE:
return owner._chldUriText_.g... |
2ebb3490-69ff-4470-ad8c-5cb65d80507c | 4 | public Car(int x, int y, int type, int imageCode) {
this.type = type;
isModified = false;
this.imageCode = imageCode;
switch(type){
case GO_LEFT:
speedX = DEFAULT_SPEED_LEFT;
speedY = 0;
rect = new Rectangle(x, y, DEFAULT_WIDTH_L, DEFAULT_HEIGHT_L);
colliBound = new Rectangle(x-10, y, DEFAULT_WIDT... |
2a3b6a39-ecd1-4b5d-b585-07266454c660 | 3 | private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked
ArrayList<User> onlineUsers = null;
System.out.println("REFRESH CLICKED");
try {
onlineUsers = UserClient.getOnlineUsers();
} catch (UnknownHostException e... |
f90d8740-0096-487d-ace4-8723b3f7eed9 | 5 | private boolean isRecordsValid(ArrayList<ArrayList<String>> records,
int columnNumber) {
if (records == null || columnNumber < 1) {
return false;
}
if (records.isEmpty()) {
return false;
}
else {
f... |
942061bc-4909-4ed1-b985-ae5bdc5c1ba1 | 3 | @Override
public void setSpecialTile(Location loc) {
if(!isValidLocation(loc)) return;
Tile t = loc.getTile();
if(t==null || !(t instanceof SpecialTile)){
return;
}
specialTiles.add(loc);
} |
50cf78aa-da6b-4b56-8bab-689247750624 | 6 | public void execute(String s){
s=s.trim();
if(s.startsWith("exec")){
previous=s;
s=s.substring(5);
String script = s.split(" ")[0];
String function = s.split(" ")[1];
txt.append("\n>"+man.s(script).eval(function, null).toString()+"\n\n");
... |
55dba6a6-e78f-42c7-b06d-2f4e7d53481d | 7 | public double recursive(int timeslot, long numberOndemandAvailable,long numberReservedAvailable, int[][][]tempMatrix)
{
if(timeslot<0 ||timeslot>timeWindow)
{
//initialOptimalMatrix();//set every element is matrix to -1
return 0;
}
// call function to estimate the number reserved still available at ti... |
91dbdd8a-611c-431e-b2db-7642d5cea2d5 | 4 | public static boolean initialiseConnections() {
Connection connection = null;
for ( int i = 0; i < MainConfig.threads; i++ ) {
try {
Class.forName( "com.mysql.jdbc.Driver" );
connection = DriverManager.getConnection( "jdbc:mysql://" + MainConfig.host + ":" + M... |
ae2f8a8f-d69f-4e79-8e95-d17bd00e7f82 | 6 | public void draw(Graphics g, boolean b, DrawObject d)
{
Graphics2D g2d = (Graphics2D) g;
if(b || (!b && (d != null)))
{
g2d.drawOval((int) x, (int) y, (int) width, (int) height);
if(isKlicked || connectedTo != null)
{
g2d.fillOval((int) x, (int) y, (int) width, (int) height);
}
}
if(connecte... |
a36545c3-7d33-4d3f-9161-3f6f857794fd | 6 | @Override
public void train(List<Instance> instances) {
// initialize linearParam
for (Instance instance : instances) {
for (Entry<Integer, Double> entry : instance.getFeatureVector().getVector().entrySet()) {
linearParam.add(entry.getKey(), 0.0);
}
}
int iter = 0;
while (iter < iters) {
iter... |
aba4e60e-3c7a-423e-9156-5a832f323faa | 8 | public void start() {
List<VkAudio> audios = new ArrayList<>();
VkAudioCountRequest vkACR = new VkAudioCountRequest(accessToken, ownerId);
int numAudios = vkACR.get();
VkAudioGetRequest vkAGR = new VkAudioGetRequest(accessToken, ownerId);
for (int i = 1; i <= numAudios / 6000; i++) {
audios.addAll(vkAGR.g... |
2dd2f02e-a98f-41f4-81a6-1a8afd0f5d32 | 9 | public void setAttackStyle(int style) {
int maxSize = 3;
int weaponId = player.getEquipment().getWeaponId();
String name = weaponId == -1 ? "" : ItemDefinitions
.getItemDefinitions(weaponId).getName().toLowerCase();
if (weaponId == -1 || PlayerCombat.isRanging(player) != 0
|| name.contains("whip") || na... |
f0a46a62-0c8c-4d98-b1de-caefd9301a71 | 2 | public Pessoa Abrir(int idPessoa) throws Exception{
Pessoa pessoa = null;
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM pessoas WHERE id = ? ");
comando.setInt(1, idPessoa);
ResultSet... |
ee1d4c07-b21f-4b0b-bf87-92b36f24103e | 8 | private void checkCollision() {
if ((sprite.collidesWith(dummy) && sprite.getCurrentFrame() == 35
&& sprite.animationDirection == 1 && dummy.position.x > sprite.position.x) ||
(sprite.collidesWith(dummy) && sprite.getCurrentFrame() == 47
&& sprite.animationDirection == -1 && dummy.position.x < sprite... |
c08ed8ac-6991-4953-9dbc-16e646ec9054 | 4 | @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if(!(obj instanceof Lock))
return false;
Lock l = (Lock) obj;
return (transaction.equals(l.getTransaction()) && (index == l.getIndex()) && isWrite == l.isWrite());
} |
7fe25dc4-e3f6-4ddb-82ff-1afa9d3a52fd | 0 | public ConnectionLogger get_logger()
{
return logger;
} |
e9096a53-dc84-441a-9135-79296ce4ecb7 | 1 | public ResultSet exeRead(String sql){
try {
Statement statement = mc.getConnection().createStatement();
ResultSet rs;
rs = statement.executeQuery(sql);
return rs;
} catch (SQLException ex) {
Logger.getLogger(Crud.class.getName()).log(Level.SEVE... |
dad027ea-9370-4186-9a3f-7c3ad295e03f | 9 | public HashMap parseEvent(HashMap eventData) {
String event, parms, data, target;
String type, parameters;
event = (String) eventData.get($EVENT$);
parms = (String) eventData.get($PARMS$);
target = (String) eventData.get($TARGET$);
if ((!event.equals("NOTICE") && !event.equals("PRIVMSG")) || parms == nul... |
61824490-3bfd-45d8-82e0-4870bb5beb15 | 8 | public void checkforclicked() {
MouseInfo mouse = Greenfoot.getMouseInfo();
if(mouse != null){
mx = mouse.getX();
my = mouse.getY();
}
if(mx >= 83 && mx <= 716 && my >= 143 && my <= 257) { //Greenfoot.getMouseInfo().getX() // alternativ
setImag... |
fa12596c-69a2-45db-abf8-20609a9a7bd7 | 9 | public void calcTargets(int position, int steps){
path.push(position);
//Record first position to test against starting on a door
if(startPosition==-1){
startPosition=position;
}
//Calc adjacencies first so that we can getAdjecencies
calcAdjacencies(getRowCol(position)[1], getRowCol(position)[... |
99845038-1993-4a2d-8461-522c036f7b2f | 4 | @Override
public void update() {
if(!Rocket.getRocket().network.isConnected){
closeGui(this);
}
if(!host){
}else{
}
for(int i = 3; i < compList.toArray().length; i++){
if(focusedButton != i){
((Button) compList.get(i)).click(false);
}
}
} |
45915740-2d43-405d-abc4-83724b7e4720 | 4 | private boolean hit() {
Shape s = shapeBoard.getShape();
int x = shapeBoard.getX();
int y = shapeBoard.getY();
for (int r = 0; r < s.getHeight(); r++) {
for (int c = 0; c < s.getWidth(); c++) {
if (gameBoard.checkSlot(r + y, c + x) && s.checkSlot(r, c))
return true;
}
}
return false;
} |
c7d5a764-d9ef-4569-aa58-cc42b08a3ea8 | 1 | public void AtualizaPosDosVertices(Point deslocamento) {
Colider colider = this.getColider();
for (Point ponto : colider.pontos) {
ponto.x += deslocamento.x;
ponto.y += deslocamento.y;
}
} |
ef13d1b9-b3c4-4528-915e-93f98774970f | 1 | public void customProcess(Entity entity, GameTime gameTime) {
Spatial spatial = entity.getComponent(Spatial.class);
ParticleEmitter emitterDetails = entity.getComponent(ParticleEmitter.class);
// If the first element of our list of current particles is empty, it's
// safe to assume the rest are also. This will... |
a84f45d2-0578-46ba-b9ff-5008fb5343c0 | 6 | private void analyzeClassInterfaceCallbacks(SootClass baseClass, SootClass sootClass,
SootClass lifecycleElement) {
// We cannot create instances of abstract classes anyway, so there is no
// reason to look for interface implementations
if (!baseClass.isConcrete())
return;
// For a first take, we consi... |
d1884f46-7933-499a-8046-69c96956064b | 5 | @Override
protected PedEntry readNext() {
try {
if (reader.ready()) {
line = reader.readLine(); // Read a line (only if needed)
if (line != null) {
lineNum++;
try {
PedEntry pedEntry = parseLine(line);
if (pedEntry != null) return pedEntry;
} catch (Throwable t) {
throw ne... |
3d841963-deb0-43bc-869e-b07a41bd8ec7 | 6 | private void regist(ActionEvent e) {
boolean flg = true;
String msg = null;
String userName = this.userName.getText();
String pwd = new String(this.pwd.getPassword());
String pwdConfirm = new String(this.pwdConfirm.getPassword());
if(userName.length() == Constants.NUM_ZERO || null == userName){
flg = fal... |
b953514c-fe21-41c2-b4eb-8677b6264f64 | 1 | private String CharToHamming(char c)
{
// binary format of ascii of char c
String binaryStringShort = Integer.toBinaryString((int)c);
// fill the 0s to get 8 bits
StringBuffer paddingBuffer = new StringBuffer();
while(paddingBuffer.length() < 8 - binaryStringShort.length())
{
paddingBuffer.append("0"... |
5c60907b-7570-48a8-a65c-8fc0982e6fba | 6 | private CFGResult statSequence(Block lastBlock) throws IOException, SyntaxFormatException {
CFGResult statementResult = statement(lastBlock);
if (statementResult != null) {
while (checkCurrentType(TokenType.SEMICOMA)) {
moveToNextToken();
Block blk = statementResult.getLastBlock();
if (blk == null ||... |
1412117d-5251-487e-a8ff-c15bc1e74ba7 | 4 | Power(String name, int properties, String imgFile, String helpInfo) {
this.name = name ;
this.helpInfo = helpInfo ;
this.buttonTex = Texture.loadTexture(IMG_DIR+imgFile) ;
this.properties = properties ;
} |
d65d468c-69e8-4e78-8d91-5917aa517942 | 2 | public static Object invokeConverter(GenericConverter converter, Object source, Class<?> sourceType, Class<?> targetType) {
return converter.convert(source, sourceType, targetType);
} |
3a7ee182-1efe-4bed-bbbf-5419833ffd4a | 4 | public int opposite(int direction){
switch(direction)
{
case UP:
return DOWN;
case DOWN:
return UP;
case RIGHT:
return LEFT;
case LEFT:
return RIGHT;
default:
}
return 0;
} |
05116967-a509-4ca5-b533-df8cca59cb0f | 5 | private void initCmdMap()
{
if (!comandsProps.isEmpty())
{
Enumeration propertyNames = comandsProps.propertyNames();
while (propertyNames.hasMoreElements())
{
String operName = (String)propertyNames.nextElement();
String operClass =... |
4a69f501-87da-4bf1-87e1-d5400610c985 | 1 | public static void initializeBoundaries() {
Boundaries[] theBoundaries = Boundaries.values();
theBoxes = new BoundaryBox[theBoundaries.length];
for (int i = 0; i < theBoundaries.length; i++) {
theBoxes[i] = theBoundaries[i].getBox();
}
} |
4e0f3fea-23d5-4bff-8971-38a0b8871b19 | 4 | public provinceInfo getProvinceByID(int id) {
if (id == 0)
return null;
if (provinceIDCache.containsKey(id))
return provinceIDCache.get(id);
provinceInfo province = null;
String SQL = "SELECT * FROM `Monarchy_Provinces` WHERE `id` = ?";
Connection con = getSQLConnection();
try {
PreparedStatem... |
a0a6ea41-7820-487f-a4e5-abccc4d9e658 | 2 | public String editar(){
System.out.println(atividadeaux.toString());
for(int i=0;i<repositorio.atividades.size();i++){
if(atividadeaux.getTitulo().equals(repositorio.atividades.get(i).getTitulo())){
System.out.println("ENTROUUUUUUUUUUUUUUUUu");
repositorio.atividades.get(i).setTitulo(ativ... |
08c82cec-b462-47fe-8e6f-a9ef17da9389 | 1 | public void saveObject(String c, Object o){
if(!pool.containsKey(c)){
ObjectPool mypool = new ObjectPool(400);
pool.put(c, mypool);
}
pool.get(c).freeObject(o);
} |
e08124f2-ce9f-4b75-bb8c-74177976dc04 | 8 | public void spread(int x, int y, World lvl, ArrayList<Vector2f> blocks, String toSpread)
{
blocks.add(Points.getPoint(x,y));
String top = lvl.getBlockAt(x,y+1);
String left = lvl.getBlockAt(x-1,y);
String right = lvl.getBlockAt(x+1,y);
String bottom = lvl.getBlockAt(x,y-1);
if(top.equals(blockName) && !blo... |
cb500bb0-ed2a-416c-a8d4-73d253ad5453 | 7 | public static Chunk[] overlay( Match match, Chunk[] chunks )
{
int begin = 0;
int matchStart = match.offset;
int matchEnd = match.offset+match.length;
ArrayList<Chunk> newChunks = new ArrayList<Chunk>();
for ( int i=0;i<chunks.length;i++ )
{
Chunk current = chunks[i];
// 1. current overlaps match on ... |
8649578b-9d79-49f4-9673-5bbacb3e83cf | 9 | static String uneval(Context cx, Scriptable scope, Object value)
{
if (value == null) {
return "null";
}
if (value == Undefined.instance) {
return "undefined";
}
if (value instanceof String) {
String escaped = escapeString((String)value);
... |
3b8cf79a-bae0-40ca-862d-9314ce291691 | 0 | public void setjTextFieldNom(JTextField jTextFieldNom) {
this.jTextFieldNom = jTextFieldNom;
} |
50dd831d-80db-4741-a911-57da03d15336 | 4 | public Double checkEmotionalSentimentLookUpTable ( String str ) {
// if ( positiveLookUp.containsKey(str) ) return 1.0;
// else if ( negativeLookUp.containsKey(str) ) return -1.0;
// else return 0.0;
for ( String temp : positiveLookTable ) {
if ( str.startsWith(temp... |
b6582e3d-59ae-4285-9abb-3439817bfa98 | 1 | public static void sendJsonContent(String jsonText, HttpURLConnection conn){
System.out.println("PROXY ===> "+jsonText);
OutputStream outputStream;
try {
outputStream = conn.getOutputStream();
outputStream.write(jsonText.getBytes());
outputStream.flush();
} catch (IOException e) {
// TODO Auto-gener... |
9856e54c-053a-4a42-9a82-4e343fe145de | 2 | @Override
protected double mass(int x) {
if (x == 1) {
return p;
} else if (x == 0) {
return 1 - p;
} else {
return 0;
}
} |
b8a8bb0c-7f1c-4819-b727-287e9b2b69dd | 7 | private static int runToNextInputFrameHiLoL(Gameboy gbL, Gameboy gbR, DualState initial, int limit) {
int joypadInputFirst = Math.min(gbL.rom.readJoypadInputHi, gbL.rom.readJoypadInputLo);
int joypadInputLast = Math.max(gbL.rom.readJoypadInputHi, gbL.rom.readJoypadInputLo);
if (!gbL.onFrameBoundaries)
... |
bc363be3-adf0-42a0-8d71-459d6c7ad1a2 | 5 | private void copyBootstrapMethods(final ClassWriter classWriter,
final Item[] items, final char[] c) {
// finds the "BootstrapMethods" attribute
int u = getAttributes();
boolean found = false;
for (int i = readUnsignedShort(u); i > 0; --i) {
String attrName = read... |
9d888a62-85b1-49e3-8e5c-793244b52168 | 3 | public List<Integer> genDistinct(int len, int range) {
if (range < len) {
System.out.println("The range is too small to generate distinct list");
return null;
}
List<Integer> list = new ArrayList<>();
HashSet<Integer> tmp = new HashSet<>();
int idx = 0;
... |
e7b547fa-00f2-49e9-a508-e8bda1111104 | 7 | public static void handleChannelLeaveEvent(ChannelLeaveEvent event)
{
String playerName = event.getPlayer();
ChatChannel chatChannel = event.getChatChannel();
String channelName = chatChannel.getName();
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled())
{
chatChannel.remo... |
88708ea0-bfdb-42b4-9437-23533023984a | 3 | private Set<Coordinate> possibleMoves(Coordinate startingCoord) {
Set<Coordinate> coords = new LinkedHashSet<Coordinate>();
if (color == Color.WHITE) {
coords.add(startingCoord.transform(0, 1));
if (startingCoord.getRow() == Constants.INITIAL_WHITE_PAWN_RANK)
coords.add(startingCoord.transform(0, 2));
}... |
e2e09fd4-1b48-4b59-8323-23de88aa7fa3 | 3 | private boolean bottomEdge(int particle, int cubeRoot) {
for(int i = 0; i < cubeRoot; i++){
if(particle > i * cubeRoot * cubeRoot && particle < i * cubeRoot * cubeRoot + cubeRoot - 1){
return true;
}
}
return false;
} |
ede19a03-d66a-4943-bce0-deb93dd1bf26 | 8 | public static SearchEngineType getByName(String name) {
if (name != null) {
name = name.toUpperCase();
if ("MASCOT".equals(name) || "MATRIX SCIENCE MASCOT".equals(name)) return MASCOT;
if ("XTANDEM".equals(name)) return XTANDEM;
if ("SEQUEST".equals(name)) return ... |
08b0a3b1-cb9e-41be-a4fd-6ce2325a2137 | 8 | public String dbRepresentation(int column, Object value) {
int type;
if (value == null) {
return "null";
}
try {
type = metaData.getColumnType(column + 1);
} catch (SQLException e) {
return value.toString();
}
switch (type) {
case Types.INTEGER:
case Types.DOUBLE:
case Types.FLOAT:
re... |
e9270615-da9b-44d6-82fd-cd63a1b37de6 | 6 | public void run() {
// Run continuously
for (;;) {
// If the audio device is ready , the program wants to and we aren't already then
// get data from the audio device.
if ((audioReady==true)&&(loadingFile==false)&&(gettingAudio==false)) getSample();
else if (loadingFile==true) getFileD... |
d42ebf04-945c-4b4c-adb9-880baf66cfa2 | 6 | public static Move inverse(Move move) {
switch(move) {
case ROLL:
return UNROLL;
case YAW:
return UNYAW;
case PITCH:
return UNPITCH;
case UNROLL:
return ROLL;
case UNYAW:
return YAW;
case UNPITCH:
return PITCH;
default:
break;
}
return null;
} |
baa37249-6ddc-4d2d-9889-3b3fa0d414bd | 3 | private GraphPoint[] getSelectedPointInOrder() {
if (this.selectlist.size() != 2) {
return null;
}
Iterator<Map.Entry<Integer, GraphElement>> it = this.selectlist.entrySet().iterator();
GraphElement gp1 = it.next().getValue();
GraphElement gp2 = it.next().getValue();
... |
63e5089b-9b28-4400-a57f-862ada7a6d5a | 9 | public int generatePrestamosPorAlumno(int nroLegajo){
String qry = "SELECT alumnos.nroLegajo, alumnos.Nombre, alumnos.Apellido, prestamos.codRecurso, prestamos.fechaPres"
+ ", prestamos.fechaPrevDevo, prestamos.fechaDevo "
+ " FROM prestamos JOIN alumnos ON prestamos.nroLegajo = ... |
ea888dcc-6063-4bf9-9969-18f5d9490b41 | 8 | public Vector<BigIntegerPoly> ifactor()
{
/* this ought be entirely rewritten in terms of the LLL algorithm
*/
Vector<BigIntegerPoly> fac = new Vector<BigIntegerPoly>() ;
/* collect integer roots (polynomial factors of degree 1) */
... |
797b34d7-bf91-485c-98f4-a050f08a1007 | 0 | public void paint(Graphics g, int x, int y){
g.clearRect(x, y, BLOCK_SIZE, BLOCK_SIZE);
} |
dc321da3-3c08-462a-ac22-6b911bc6f77e | 1 | private static void initRotateBilinear(Composite inComposite, int heightHint) {
final Composite toolbar = new Composite(inComposite, SWT.BORDER);
final Composite imageContainer = new Composite(inComposite, SWT.BORDER);
GridData toolbarGridData = new GridData(GridData.FILL_HORIZONTAL);
toolbarGridData.grabExces... |
64eb5b4d-7a89-41e3-9e10-b9a7e3af9e48 | 0 | public MealyTransition(State from, State to, String label, String output)
{
super(from, to);
setLabel(label);
setOutput(output);
} |
01de36bd-1414-4beb-8db2-c9c39a873c33 | 7 | public final void setCurrentScreen(GuiScreen newScreen) {
if (currentScreen != null) {
currentScreen.onClose();
}
HUDScreen.chatLocation = 0;
// SURVIVAL: Game over
if (newScreen == null && player.health <= 0) {
newScreen = new GameOverScreen();
}... |
952f1b4e-13b4-4083-ae77-fd05caea370b | 7 | private void drawBoardSpace(BoardSpace boardSpace, Coordinate coordinate) {
this.drawBoardSpaceBorder(coordinate, Color.RESET);
final TerrainType terrainType = boardSpace.getTopTerrainType();
final String terrainTypeIndicator;
//TODO: Implement Visitor Design Pattern
if (terra... |
fba2df24-7967-48f9-a8dc-d4e692e94597 | 7 | boolean checkValue(int Red, int Green, int Blue){
int maxValue = 1;
for(int i = 0; i < bitPerPixel/numOfColorComponents; i++){
int temp = 2;
maxValue = maxValue*temp;
}
maxValue = maxValue - 1 ;
if(Red < 0 || Green < 0 || Blue < 0){
System.out.println("エラー:RGB値に負の値は使えない");
ret... |
128441ec-810f-4fd5-b00c-ae04a417a54c | 8 | public boolean isSatisfied(int x, int y) {
//first check the square is actually non-mine
if (board[x][y].isMine()) return false;
//the square must also have at least 1 adjacent mine
if (board[x][y].numMines() == 0) return false;
int surrounding = 0;
for (int i = x - 1; i <= x + 1; i++) {
for (int j = ... |
1556bb38-3b01-40ac-b29e-1f02809cd604 | 0 | @Override
public void speak()
{
System.out.println("The husky says \"Dude, what's up?\"");
} |
4e853000-5567-4685-b606-154b327e5c5b | 1 | public Object objectValue() {
if (newObj != null)
return newObj.objectValue();
return value;
} |
b0825152-d18a-4139-989c-8fecc371e9ff | 3 | @Override
public void update(Titre obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("update Titre set nom=?, annee=?, where id=? ;");
pst.setString(1, obj.getNom());
pst.setString(2, obj.getAnnee());
pst.setInt(3, obj.ge... |
96184c53-e134-49ad-a424-3e84a42c9773 | 3 | @Override
public List<Rule> getRulesForRhs(List<Specie> species) {
List<Rule> affectingRHSRules = new ArrayList<Rule>();
for (Rule rule : rules) {
for (Specie specie : species) {
if (!rule.getRhs().contains(specie)) {
break;
}
affectingRHSRules.add(rule);
}
}
return affectingRHSRules;
} |
85e14177-e8b7-4e6b-a61e-421b8db9dcbc | 3 | public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException {
int p0 = getStartOffset();
int p1 = getEndOffset();
if ((pos >= p0) && (pos <= p1)) {
Rectangle r = a.getBounds();
if (pos == p1) {
r.x += r.width;
}
r.width = 0;
return r;
}
return null;
} |
d4f25f17-9c3e-4689-a24a-d3cd91a6aef0 | 5 | public void click() {
if (inMenu()) {
mainMenu.click(Mouse.location.x, Mouse.location.y);
} else if (currentDemo != null) {
if (currentDemo.running()) {
currentDemo.click(Mouse.location.x, Mouse.location.y);
} else {
if (resume.contains... |
8b827d40-1274-4ae7-a99c-62efa4b2b26d | 3 | @EventHandler
public void onPlayerSendCommand(PlayerCommandPreprocessEvent event) {
if (event.isCancelled())
return;
Player player = event.getPlayer();
if (parentarena.getplayers().contains(player)) {
String commands[] = event.getMessage().split(" ");
if (!parentarena.getPlugin().getCommandList().cont... |
d29c11a1-019f-4cc6-b6c2-b9f74f11df17 | 1 | @Override
public void onMessage(IMessage message) throws JFException {
// 注文の約定や決済、その他各種メッセージを受信した際に呼ばれます。
IOrder order = message.getOrder();
switch (order.getState()) {
case CLOSED:
LOGGER.info("onMessage : " + message + " Close:" + order.getClosePrice());
break;
default:
LOGGER.info("onMessage :... |
03781eb2-1422-4c60-8fc4-5e2b03656b51 | 9 | private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed
//disable all text fields
dateTextField.setEditable(false);
toTextField.setEditable(false);
fromTextField.setEditable(false);
subjectTextField.setEditable(false);
... |
538ea788-e03c-41de-b691-3bee42ecaf52 | 8 | private void paintFrozenBlocks(final Graphics2D the_graphics, final Color the_clear)
{
final List<Block[]> blocks = my_board.getFrozenBlocks();
if ((blocks.size() >= my_board.getHeight() - DANGER_HEIGHT)
&& (my_player.getIndex() != DANGER_SONG)
&& (!my_board.gameIsOver()))
{
my_play... |
4092cf0e-7cb4-40af-b659-ec9f248771de | 9 | private static void identifyCriticalSecurityGoal(RequirementGraph req_model, ActorAssociationGraph actor_model) throws FileNotFoundException,
UnsupportedEncodingException, IOException, ScriptException {
String ex_req_model_file = req_model.generateExhaustiveFormalExpression();
// normally the actor associatio... |
f41751e8-abad-4105-b2e2-614a5cd52b66 | 8 | @SuppressWarnings("SimplifiableIfStatement")
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HgClone hgClone = (HgClone) o;
if (pathToHg != null ? !pathToHg.equals(hgClone.pathToHg) : hgClone.pathToHg != null) return false;
... |
41d0c305-22ff-49c3-987a-1f362c8d27a8 | 5 | private static int connectedEdges(boolean[][] nabomatrise, boolean[] visited) {
int antallKanter = 0;
for (int i = 0; i < visited.length; i++) {
if(!visited[i]){
antallNoderMed++;
for (int j = 0; j < nabomatrise.length; j++) {
if(nabomatrise[i][j] && !visited[j]) {
antallKanter++;
}
}... |
a49d4f54-a427-47ec-801d-8a25cb7d5dd7 | 7 | public ChangeView(SingleFrameApplication app) {
super(app);
initComponents();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
... |
3c7a7395-8347-4fac-9ecb-63bac070dc3e | 7 | private static int[][][] iter_splitranges_dispersal(int[] rng) {
int numofzeros = 0;
for (int i = 0; i < rng.length; i++) {
if (rng[i] == 0)
numofzeros++;
}
int[][][] retA = new int[0][][];
if (numofzeros > 0) {
for (int i = 0; i < rng.length; i++) {
int[] tempLA = new int[rng.length];
int[]... |
a92052f2-68db-47ab-b8a8-3973cb343287 | 4 | private void listen() {
EIError.debugMsg("Trying to listen...");
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException e) {
//oh well, ain't no thang
}
}
serverSocket = null;
try {
... |
8b9f6130-6b54-48e7-a004-87dcd03e33ec | 1 | public AccessorMaker getAccessorMaker() {
if (accessors == null)
accessors = new AccessorMaker(this);
return accessors;
} |
99cfff40-689f-4cc4-a0ba-f1c2a048fa7e | 9 | private static JMenu getFileJMenu() {
JMenu fileJMenu = new JMenu("File");
JMenuItem newGraphJMenuItem = new JMenuItem("New graph");
JMenuItem saveJMenuItem = new JMenuItem("Save");
JMenuItem loadMenuItem = new JMenuItem("Load");
JMenuItem quitJMenuItem = new JMenuItem("Quit");
newGraphJMenuItem.setToolTi... |
f844b98c-85c7-456d-a5f0-8a1ee1756c50 | 4 | private ArrayList<FaceData> readToFaceData(String faceFile)
throws FileNotFoundException {
BufferedReader br = new BufferedReader(new FileReader(faceFile));
String currentLine;
ArrayList<FaceData> data = new ArrayList<FaceData>();
try {
while ((currentLine = jumpToNextImage(br)) != null) {
String im... |
5f50105e-376e-431e-b3e4-f2dec0a60a4b | 2 | public outputWindow(){
win=Boolean.valueOf(GosLink2.prps("window"));
if (win==true){
String imagePath = "smokin.png";
InputStream imgStream = outputWindow.class.getResourceAsStream(imagePath);
try{BufferedImage myImg = ImageIO.read(imgStream);
setIconImage(myImg);
}catch (Exception e){e.printStackTra... |
a27d6310-6024-4ff5-bd8f-e525a2f33e72 | 5 | @Override
public int next() throws IOException {
int n = -1;
if ((n = get()) != -1) {
offset++;
if (n == '\r') {
lines++;
columns = 0;
} else if (n == '\n') {
if (start < 2 || buf[start-2] != '\r') {
lines++;
columns = 0;
}
} else {
columns++;
}
}
return n;
} |
bf468e1a-a150-4510-a618-05aed642e7c1 | 3 | public void verify() throws VerifyException {
try {
doVerify();
} catch (VerifyException ex) {
for (Iterator i = bi.getInstructions().iterator(); i.hasNext();) {
Instruction instr = (Instruction) i.next();
VerifyInfo info = (VerifyInfo) instr.getTmpInfo();
if (info != null)
GlobalOptions.err.... |
b4467659-0022-444f-ab14-1f0998c95fbd | 3 | private void collect(TreeNode root, String prefix, LinkedList<String> q){
if(root == null)return;
if(root.value != null)q.add(prefix);
Iterator<Entry<Character, TreeNode>> childrenIterator = root.children.entrySet().iterator();
while(childrenIterator.hasNext()){
Entry<Character, TreeNode> e = childrenIterato... |
cac0d0c1-df8b-4ac4-826c-c58972b88005 | 2 | private Date getMinDate(List<Stat> vals) {
List<Date> dates = new ArrayList<Date>();
for (Stat st: vals) if (st != null) dates.add(st.getWhen());
return Collections.min(dates);
} |
69bae960-063c-4e22-b459-01e58a9e3d04 | 8 | public static void main(String args[]) throws IOException{
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For detai... |
c9d083db-4cdd-49cf-8099-4ad1a9183244 | 5 | public Interval merge(Interval i1,Interval i2){
Interval res = new Interval();
/**
* st1 ed1
* st2 ed2
* st2 ed2
*
*/
if( ( i2.end <i1.start )|| (i1.end<i2.start) ){
return null;
}
/**
* st1 ed1
* st2 ed2
* st2 ed2
*/
else if( i2.start <= i1.start )... |
6ce4fd60-79b1-4525-8f67-c943b61e565c | 4 | protected static Ptg calcRight( Ptg[] operands )
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
String origstr = String.valueOf( operands[0].getValue() );
if( origstr.equals( "" ) )
{
return new PtgStr( "" );
}
int numchars = operands[1].getIntVal();
if( numchars > ori... |
6ab895d7-48e2-4e6a-82b6-218fbea14326 | 8 | public String format(Object object, String format) {
if (object == null) {
return getNullMessage();
}
StringBuilder builder = new StringBuilder();
char[] formatChars = format.toCharArray();
int i = 0;
while (i < formatChars.length) {
char token = formatChars[i];
if (OPEN_TAG == token) {
int end... |
2389fc36-32d9-4e88-813f-20520044c798 | 4 | private static String comment(OntResource r) {
String comment = r.getComment("en");
comment = (comment == null || comment.isEmpty()) ? r.getComment(null) : comment;
comment = (comment == null) || comment.isEmpty() ? "TODO add comment" : comment;
return comment;
} |
e6b34f1a-88af-4bdc-acd9-f59d96cafc45 | 1 | private static Process runEXE (String cmd) {
try {
Process p = Runtime.getRuntime().exec(cmd);
return p;
} catch (Exception e) {
System.out.println("Error exe: "+e.getMessage());
}
return null;
} |
ee0380ac-1057-4098-a489-541aa12b944c | 5 | @Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass())
return false;
final Event event = (Event) o;
return _bid == event._bid
&& Double.compare(event._prob, _prob) == 0
... |
1f7615e2-62fd-4711-a4e9-62bb3b2eed4d | 0 | @Override
public String toString() {
return "Capture from " + getStart() + " to " + getDestination();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.