method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1c4a3a28-a0a6-4735-8f57-a88552fe8c24 | 2 | public Tile getOtherTile(Tile currentTile){
if (currentTile == null){
throw new IllegalArgumentException("currentTile may not be null");
}
if (currentTile == tile1) return tile2;
return tile1;
} |
613f7c06-5f7f-44df-b0cc-e18c1ea2f97c | 2 | public int getModifiers() {
ClassFile cf = getClassFile2();
int acc = cf.getAccessFlags();
acc = AccessFlag.clear(acc, AccessFlag.SUPER);
int inner = cf.getInnerAccessFlags();
if (inner != -1 && (inner & AccessFlag.STATIC) != 0)
acc |= AccessFlag.STATIC;
retu... |
56dada18-430d-48ff-83a8-c2dc84732e54 | 7 | public static int svm_check_probability_model(svm_model model)
{
if (((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&
model.probA!=null && model.probB!=null) ||
((model.param.svm_type == svm_parameter.EPSILON_SVR || model.param.svm_type == svm_parameter.NU_SVR) &&... |
ab6244c9-0cce-4f36-a135-feedfaa3dc06 | 1 | public double evaluate(double x) {
if(x < 0) return 0;
return 1;
} |
1bbeab1b-eff7-4299-8871-e28feb7c13f0 | 2 | public static final int StateUpdateChar(int index)
{
if (index < 4)
return 0;
if (index < 10)
return index - 3;
return index - 6;
} |
7cca406b-f5fd-41fe-88ce-40a2e3d907c0 | 7 | @Override
public void moveSessionToCorrectThreadGroup(final Session session, int theme)
{
final int themeDex=CMath.firstBitSetIndex(theme);
if((themeDex>=0)&&(themeDex<Area.THEME_BIT_NAMES.length))
{
final ThreadGroup privateGroup=CMProps.getPrivateOwner(Area.THEME_BIT_NAMES[themeDex]+"PLAYERS");
if((priv... |
8d6f733b-52b3-4814-80ef-7b86cdaa38d5 | 6 | public static void main(String args[]) {
/* 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 details see http://down... |
736d16ea-09e5-4de9-81f5-2d18e1650a9e | 7 | public int firstMissingPositive(int[] A) {
int len = A.length;
for (int i =0;i<len;i++){
while (A[i]!=i+1&&A[i]<=len&&A[i]>0&&A[i]!=A[A[i]-1]){
int temp = A[A[i]-1];
A[A[i]-1] = A[i];
A[i] = temp;
}
}
for (int i =0;i... |
54d2fa45-0b67-40f5-acbe-f42c2c0b1788 | 9 | public void renderizarEntidad(int xp, int yp, RepresentacionEntidad rep)
{
Sprite sprite = rep.getSprite();
final int tamanio = sprite.getTamanio();
xp -= xOffset;
yp -= yOffset;
for(int y = 0; y < tamanio; y++)
{
int ya = y + yp;
if(ya < 0 || ya >= altura)
break;
for(int x = 0; x <... |
cdb202ff-9404-4181-8131-e38ed6815a35 | 6 | public OptionsMenu() {
super();
/*try {
displayModes = Display.getAvailableDisplayModes();
for(DisplayMode d : displayModes)
modes += d.toString() + "\n";
} catch (LWJGLException e) {
e.printStackTrace();
}*/
Label optionsLabel = new Label("Options");
optionsLabel.setPosition(() -> Camera.ge... |
deb08bce-cf3c-4d64-9e2e-5f4d9d812778 | 5 | private boolean isValidCard(Card playedCard) {
// Grab our player index who wishes to play this card.
int curPlayerIndex = (this.firstToPlayIndex + this.cardsPlayed.getNumCards()) % PLAYER_COUNT;
Pile curPlayerHand = this.players[curPlayerIndex].getHandPile();
// If our card isn't even in our hand, there's a... |
2856b37b-c559-4279-9a21-71a698695592 | 8 | public static boolean areIdenticalIterative(ListNode l1, ListNode l2) {
ListNode ptr1 = l1;
ListNode ptr2 = l2;
while (true) {
if (ptr1 == null && ptr2 == null) {
return true;
}
if (ptr1 == null && ptr2 != null) {
return false;
}
if (ptr2 == null && ptr1 != null) {
r... |
74f622a1-7eca-4503-9869-5d24d62135e1 | 6 | public Object getMedianElement() {
if (listHolder == null) {
System.out.println("Provided list is null.");
return null;
}
if (listHolder.next() == null
&& listHolder.getElement() == null) {
System.out.println("Provided list is empty.");
... |
32ef2081-b50b-44ee-b5f0-c72165bb8851 | 8 | Component getComponent(String GComponentInterfaceClassName) {
String clazz = GComponentInterfaceClassName;
if (!(clazz == null) && !(clazz.equals(""))) {
Class t = clazz2Class(clazz);
Constructor c = null;
Object[] o = {blackboard};
try {
c... |
8297eb62-0ba8-41d5-b5f3-24ed07c95126 | 2 | public void setTileCircuit2(float x, float y, int circuit, int inputID){
Vector2f temp = new Vector2f(x,y);
for(Tile tile : tileList ) {
if (TileUtil.getCoordinate(tile.getPosition()).equals(temp)){
tile.setCircuit(circuit);
tile.setInput(inputID);
}
}
} |
5159fcdb-6bad-4d4c-83e9-3b03fc54540b | 1 | public void leaveUser(int userID) {
alstLeftUser.add(userID);
Match currentMatch = getCurrentMatch(userID);
if(currentMatch == null){
//
}else{
getCurrentMatch(userID).setLeftUser(alstLeftUser.toArray(new Integer[0]));
}
} |
2d37389b-963f-4545-bbfa-6727db9e5efc | 7 | public boolean storeImageRGBFreqsToDb(String imageFileName, long[][][] rgbBin, long totalPixels) {
StopWatch sw = new StopWatch();
sw.start();
String insert_sql = "INSERT INTO filenames(filename) values(?)";
StringBuilder sql = new StringBuilder("INSERT INTO rgb_frequ... |
e3a30174-c802-41e0-861f-0945622afa3a | 1 | public void paivitaAukiolot(Aukiolo aukiolo) throws DAOPoikkeus {
// Avataan ensin tietokantayhteys
Connection yhteys = avaaYhteys();
try {
// Suoritetaan haku
// Alustetaan sql-lause
String sql = "UPDATE Aukiolot SET arkialku=?,arkiloppu=?,vklpalku=?,vklploppu=? WHERE aukioloID=1";
PreparedStatemen... |
9c20114e-38dc-4977-b9bc-fb0ccce9b7e9 | 7 | public void inxbuild() {
int i, j, smallpos, smallval;
int[] p;
int[] q;
int previouscol, startpos;
previouscol = 0;
startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
... |
e41ce477-3f2c-4817-94fe-24f6b9f44320 | 6 | public int compareTo(TailString ts) {
for(int i=s.length()-1, j=ts.s.length()-1;; i--, j--)
if(i < 0) return j < 0 ? 0 : 1;
else if(j < 0) return -1;
else if(s.charAt(i) > ts.s.charAt(j)) return -1;
else if(s.charAt(i) < ts.s.charAt(j)) return 1;
} |
ff724c1c-bd14-4532-ab44-2dec08ef361b | 6 | private void drawTetris( Graphics g, ImageObserver imgObserver ) {
// グリッドの描画
short[][] grid = _model.getGrid();
short[][] gridColor = _model.getGridColor();
for ( int y = 0; y < Game.GRID_Y; y++ ) {
for ( int x = 0; x < Game.GRID_X; x++ ) {
if (grid[ y ][ x ] == 1) {
g.drawImag... |
ceacd4b2-5f34-4d7f-ac9c-b3037a063b59 | 5 | public Object match(final String path) {
if (rules.containsKey(path)) {
return rules.get(path);
}
int n = path.lastIndexOf('/');
for (Iterator it = lpatterns.iterator(); it.hasNext();) {
String pattern = (String) it.next();
... |
8c560b31-7132-4fc4-b17f-3f3fbb0ec490 | 2 | private void initializeCurrentTransition(IWorkbenchPartReference activePart) {
currentTransition = findTransitionContaining(activePart);
if(currentTransition == null)
currentTransition = findFirstNonEmptyTransition();
if(currentTransition == null)
currentTransition = transitions.get(0);
currentTran... |
38cdaa80-dae6-4a99-a694-6d6b74a5b211 | 7 | @Override
public boolean equals(Object o )
{
if(o == null)
return false;
if(o == this)
return true;
if(!(o instanceof Fertigungsplan))
return false;
Fertigungsplan f = (Fertigungsplan)o;
if(f.nr != nr || f.id != id || f.auftragNr != au... |
75e86042-95ef-4cf0-b77c-327745262df6 | 3 | public void visitLdcInsn(final Object cst) {
mv.visitLdcInsn(cst);
if (constructor) {
pushValue(OTHER);
if (cst instanceof Double || cst instanceof Long) {
pushValue(OTHER);
}
}
} |
954a8133-7f7b-4182-8734-705e54c381d6 | 2 | public double standardizedAverageCorrelationCoefficientsWithTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.standardizedMeanRhoWithTotals;
} |
b2a9a3b8-4841-4a81-bcfb-f2f8d130113c | 1 | public static void main(String[] args) {
try {
ArchitectureUi dialog = new ArchitectureUi();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
} |
42cff6aa-d2e2-4048-9f11-ee3c082fdaf7 | 5 | protected static Object checkSurrounds(
Holding holding, int upgradeLevel, boolean verbose
) {
final boolean NV = ! verbose ;
float safety = 0 - holding.base().dangerMap.longTermVal(holding.origin()) ;
if (holding.stocks.amountOf(PRESSFEED) > 0.5f) safety += 1.5f ;
if (safety < SAFETY_NEEDS[u... |
e8cd8c26-5ebb-4c13-85f9-c4f12670451f | 0 | @Override
public int hashCode() {
return this.username.hashCode();
} |
e3e510cd-561b-4e7a-8715-ee52d3ad8d86 | 2 | public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", false);
... |
52214458-d49c-4c57-b419-d9dfba563d29 | 8 | private void handleFirstStageMessage(FirstStageMessage fsm) {
MnPeerState peerState = mnPeer.getPeerState();
if(! mnPeer.isMainPeer()) {
throw new Error("First stage message must be forwarded to main peer");
}
if(ssCache.contains(fsm.getMessageId())) {
// Can happen if a 1st stage message is re-sent
/... |
6a9275ea-8569-4c48-a093-d74abd8a2d91 | 6 | public void Collision()
{
Actor collision1 = getOneIntersectingObject(Spikyball2.class);
Actor collision2 = getOneIntersectingObject(Spikyball3.class);
Actor collision3 = getOneIntersectingObject(Ghost.class);
if(collision1 != null)//if you have not run into it
{
World myWorld = getWor... |
ef76afdd-f523-49ee-9604-81834d7ba5a6 | 4 | public void increaseKey(int i, Key key) {
if (i < 0 || i >= NMAX) throw new IndexOutOfBoundsException();
if (!contains(i)) throw new NoSuchElementException("index is not in the priority queue");
if (keys[i].compareTo(key) >= 0) throw new IllegalArgumentException("Calling increaseKey() with given... |
c1daba42-6956-401b-9d74-f0cc1804dc71 | 7 | public EPConnectablesDialog(ElementPanel panel, Component ele) {
this.setTitle("Input Connectors");
this.setModal(true);
for (Component e : panel.getElements()) {
if (e == ele)
continue;
if (e instanceof InputStub)
continue;
for (Connector c : e.getConnectors()) {
if (c instanceof InputConne... |
ab917d06-e591-47dc-9096-a6155da6c17f | 1 | public CtClass makeClassIfNew(InputStream classfile)
throws IOException, RuntimeException
{
compress();
classfile = new BufferedInputStream(classfile);
CtClass clazz = new CtClassType(classfile, this);
clazz.checkModify();
String classname = clazz.getName();
C... |
d51f7b43-448d-4b62-b66d-415eef5b616c | 8 | public void XbIDX9 (int n, int Dir, String Step2){
String ff;
int ln;
switch(n)
{
case 0:
Step2 = Step2.replace("xb", "E0");
ff = Integer.toHexString(Dir);
ln = ff.length();
if(ln == 1)
ff = "0" + ff;
Step2 = Step2.replace("ff", ff);
machCod2.add(Step2);
... |
96d5160d-2fb6-424e-bf55-9994318565d5 | 9 | protected PseudoSequencePair getFirstInstanceOfPrefixSequenceNEW(List<Itemset> prefix, int i){
int remainingToMatchFromPrefix = i;
List<Position> listPositions = new ArrayList<Position>();
int prefixItemsetPosition = 0;
// for each itemset of sequence
for(int j=0; j< size(); j++){
int itemInPrefi... |
e3648037-76f4-4eb8-8b47-80c509d9b043 | 7 | public static Stella_Object inlinableMethodBody(MethodSlot method) {
{ Cons definition = null;
Stella_Object body = KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_CACHED_INLINABLE_METHOD_BODY, null);
if (body == method) {
return (null);
}
if (body != null) {
... |
944391ed-1ce4-4f0d-939a-e079f52187a3 | 0 | public void setCitta(String citta) {
this.citta = citta;
} |
7ee111ca-c28c-4482-a929-017e52290f30 | 9 | public PersistenceDelegate getPersistenceDelegate(Class<?> type) {
if (type == null) {
return nullPD; // may be return a special PD?
}
// registered delegate
PersistenceDelegate registeredPD = delegates.get(type);
if (registeredPD != null) {
return regist... |
e7e79510-82cd-47ae-a6ca-f4cf6c147385 | 7 | public int toInt(Piece p){
if(p.toString().charAt(1)== 'P')
return 1;
if(p.toString().charAt(1)=='N')
return 3;
if(p.toString().charAt(1)=='B')
return 4;
if(p.toString().charAt(1)== 'R')
return 5;
if(p.toString().charAt(1)== 'Q')
return 9;
if(p.toString().charAt(1)== 'K')
return 50;
if(p... |
32d82d1d-2025-43d0-a2b2-f5eb2fd75092 | 1 | public void stop() {
// Note: writePointer will be one ahead of the last message byte, so
// we can read it as size in this case
byte[] message = new byte[writePointer];
for(int i = 0; i < writePointer; i++) {
message[i] = currentMessage[i];
}
synchronized(messageBuffer) {
messageBuffer.add(me... |
46749be5-7393-4b1d-99a7-559bc4dcff9d | 6 | public static void main(String[] argv) {
try {
// Retrieve a character in a Xml file
Character character = XmlMarshaller.unMarshallCharacter();
// Default localhost host and default port 1099 is used by RMI
Registry registry = LocateRegistry.getRegistry();
Registry registry2 = LocateRegistry.getRegist... |
d8daaaca-cfd0-4282-81a3-00a28aa79114 | 3 | @Override
public void run(){
try{
System.out.println("waiting for worker join in");
while(true){
Socket workerSocket = serverSocket.accept();
System.out.println("worker: "+workerSocket.getInetAddress()+":"+workerSocke... |
d93a529b-eec2-4234-b437-f269f4a82dad | 8 | @Override
public void move(int x, int y, EPlayer player) {
try {
if (x >= 0 && x < super.getGameSize() && y >= 0 && y < super.getGameSize()) {
if (getField(x, y) == EField.Empty) {
super.move(x, y, player);
if(player == EPlayer.FirstPlayer ... |
a7c06513-71cf-4af6-b6f3-860a1eabbc91 | 4 | @Override
public void mouseClicked(MouseEvent e) {
int sizeOfTile = this.getPreferredSize().height / drawingSize;
int x = e.getX();
int y = e.getY();
// convert coordinates to column and row
int i = (int) Math.floor((float) x / (float) sizeOfTile);
int j = (int) Math.... |
501ffede-5773-45ed-b0d0-e51db37e8ccc | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SchoolOfficer that = (SchoolOfficer) o;
if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) return false;
if (i... |
88b45bb9-a6d2-49e5-a492-21547b6273a1 | 6 | private static boolean doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream fis = null;
F... |
878f5835-214e-4fbb-9d6e-5c1d80adb215 | 7 | public static void main(String args[]) {
/*
* 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 fe... |
c0a48334-d119-4ea3-ad21-0bbf5bf3aca5 | 2 | public Car getRentedCars(){
for (Car car:CARS){
if(car.isCarRented() == true){
return car;
}
}
return null;
} |
7633ade5-a39a-4690-8db9-e71072e775dc | 9 | public static int ifOne(int n){
if(n==1 || n==2 || n==6)
return 3;
else if(n==3 || n==7 || n==8)
return 5;
else if(n==4 || n==5 || n==9)
return 4;
else
return 0;
} |
13ca8b55-016f-4e3a-84e1-d4de2ca3eeb0 | 6 | @Override
public boolean equals(Object other) {
if (other == null)
return false;
if (other == this)
return true;
if (this.getRoom() == null)
return false;
// if (this.getMovie() == null)
// return false;
if ( !(other instanceof Seance))
return false;
Seance ... |
abdbb210-c5b3-46b1-9539-90a2553e3c2d | 2 | public static int[] getValue(Integer key) {
for (Integer i : map.keySet()) {
if (i==key) {
return map.get(i);
}
}
return null;
} |
fbc6c594-5b40-4402-9bb7-2fb3b6fae539 | 9 | public final NiklausParser.variabledeclaration_return variabledeclaration() throws RecognitionException {
NiklausParser.variabledeclaration_return retval = new NiklausParser.variabledeclaration_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token VAR24=null;
T... |
d5a485f1-ba92-41a8-836f-7479dc349043 | 1 | public void addMany(int ...elements)//parameter can be more.
{
if(manyItems + elements.length > data.length)
{
ensureCapacity((manyItems + elements.length)*2);
}
System.arraycopy(elements, 0, data, manyItems, elements.length);
manyItems += elements.length;
} |
f12ba254-9f68-477f-8b55-8d85a5d29f93 | 2 | @Override
public void start() throws ConnectorLoadException {
if (twitterFactory != null)
throw new ConnectorLoadException("Invalid state; Twitter factory already declared.");
if (twitterToken != null)
throw new ConnectorLoadException("Invalid state; Twitter OAuth tokens already declared.");
twitterFactory... |
dafb8c2a-40c9-4578-9a77-f0a34ff21b15 | 6 | @Override
protected void tick() {
Date currentDate = new Date();
double initialInterval = (double)(playerData.getUsedWeapon() - playerData.getstartCD());
double currentInterval = (double)(playerData.getUsedWeapon() - currentDate.getTime());
doub... |
72d626d3-1151-426d-9fbf-e1ddc262da1c | 7 | protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - inte... |
b8d07281-ee06-469d-ac83-c82386bc7c6e | 1 | private void disconnectQuietly() {
synchronized(CONNECTION_LOCK) {
try {
//inform the server of the client's intent to disconnect
logger.finer("Sending disconnect packet");
sendPacket(Packet.createClientDisconnectPacket(clientId));
}
catch(CouldNotSendPacketException e) {
//ignore all excepti... |
0da30f9d-2bd1-443a-89ef-bc24703c6277 | 5 | @Test
public void testRollbackFail2() throws InvalidProcessStateException, ProcessExecutionException,
InterruptedException, ExecutionException, ProcessRollbackException {
for (int i = 0; i < 25; i++) {
logger.debug(String.format("Run %s/25.", i + 1));
// test executing component (execution ongoing)
IPr... |
92fefec5-b8f5-44aa-84bf-1028a90eb66b | 9 | public void displayData(List<Session> sessions, int trackCount) {
List<String> outputText = new ArrayList<String>();
Collections.sort(sessions);
String maxNetworkingTime = null;
Calendar cal = new GregorianCalendar();
SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mma");
Date d;
try {
d = dateF... |
110ff90a-1115-47e3-8213-68f3075fe5f2 | 5 | public static void main(String[] args) {
String urlStr = null;
while (true) {
try {
System.out.println("Enter url: ");
// read from standard input
BufferedReader reader = new BufferedReader(
new InputStreamReader(System.in));
// read a line of input from the keyboard until the ENTER key is
... |
1b7732e7-8675-446c-a317-b116be1332f4 | 4 | public static Class<?> getActualType(final Field field) {
Type type = field.getGenericType();
if (type instanceof ParameterizedType) {
return (Class<?>)((ParameterizedType) type).getActualTypeArguments()[0];
}
if (field.getType().isArray()) {
return field.getType().getComponentType();
}
// Field ty... |
118dcd24-e49e-423a-a7c0-41e7057a69c7 | 9 | public static void main(String[] args)
{
Fila aFila = new Fila(5); // criamos uma fila que comporta 5 itens
if (!aFila.isFull())
aFila.insert(10); // inserimos 4 itens
if (!aFila.isFull())
aFila.insert(20);
if (!aFila.isFull())
aFila.insert(30);
... |
db27dea3-3585-4937-93ca-b31f99f55e41 | 0 | public int getDepth()
{
return depth;
} |
35303768-d3da-488f-953c-3ccab2696296 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof HandTypesKey)) return false;
HandTypesKey that = (HandTypesKey) o;
if (getInt() != that.getInt()) return false;
if (getBoolean() != that.getBoolean()) return false;
return true;
} |
1821a9f1-10d8-4226-af03-56e5cb63efe2 | 1 | synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (HelloCorba.HelloHelper.id (), "Hello");
}
return __typeCode;
} |
48078d86-820e-4888-88bd-713865c56093 | 3 | private static Boolean toBoolean(String paramName, Object o, boolean required) throws BadConfig {
if (o == null) {
if (required)
throw new BadConfig("Parameter \"" + paramName + "\" is required");
return null;
}
if (!(o instanceof Boolean))
throw new BadConfig("In parameter \"" + paramName + "\", val... |
2432e12e-6e24-4072-8a8e-09aec1b7dd9e | 8 | @Override
public void processMessage(Privmsg privmsg) {
String[] parts = privmsg.getMessage().split(" ", 2);
int id = Integer.parseInt(parts[1]);
boolean state = false;
String action = "opened";
if (parts[0].charAt(1) == 'c') {
state = true;
action = "... |
15b71c6c-d14f-4798-9bca-21a0f2a2ee77 | 6 | static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
... |
661515c4-f7cf-40c3-9ce9-ec5041fadd31 | 1 | public void visitStaticFieldExpr(final StaticFieldExpr expr) {
// C.f
// [declared field type] <= [C.f]
final MemberRef field = expr.field();
if (!expr.isDef()) {
start(expr, field.type());
}
} |
1a65b364-93e7-4c06-8dda-7275d1caa5ac | 6 | public int minJumpsRecursive(int[] a, int l, int h) {
/* Base case: array of length 1*/
if (l == h) {
return 0;
}
/* Base case: if no jumps out of position i */
if (a[l] == 0) {
return Integer.MAX_VALUE;
}
/* Compute the minJumps from all j rechable from l; pick the min and add 1 */
int m... |
49be990e-4620-48e4-8152-a14ef81673c4 | 9 | public void buildListModel() {
if(mapPanel.backdrop != null) {
listModel.addElement(mapPanel.backdrop.toString());
}
if(!mapPanel.backgroundMusic.matches("")) {
listModel.addElement(mapPanel.backgroundMusic);
}
if(mapPanel.player != null) {
listModel.addElement(mapPanel.player.toString());
}
if(!... |
d573ab7f-f575-44a9-a287-9d17bf269748 | 1 | @Override
public boolean accept(File file) {
// Allow only directories, or files with ".txt" extension
return file.isDirectory() || file.getAbsolutePath().endsWith(".asm");
} |
2fb975e0-ecad-4f9c-9e5b-e9baa59453ae | 1 | private boolean jj_2_9(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_9(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(8, xla); }
} |
13dc69ef-dc8e-4040-8cbf-9a46e8643a41 | 0 | public Jason()
{
super("Jason", 8000, 300, 30, 80, as);
as.setSkill(0, "Poke", 30, 10, "Jason pokes his enemy lightly.");
as.setSkill(1, "Jab", 200, 60, "Jason jabs his enemy.");
as.setSkill(2, "Kick", 600, 100, "Jason kicks his enemy.");
as.setSkill(3, "Round-House Kick", 4500, 200, "Jason roundhouse kicks ... |
ed8e1d27-ddf8-42c3-90fa-8360727c570d | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
a7399a00-7a33-4c48-905c-ff6afd20e75e | 2 | public void setWeapon(Weapon weapon) {
weaponIndexDirty = true;
for (int i = 0; i < getWeaponsData().size(); i++) {
if (getWeaponsData().get(i).getWeapon().equals(weapon)) {
weaponIndex = i;
break;
}
}
} |
c5bb749b-3ee9-45cd-b7f1-ba2c10719973 | 3 | public boolean validateTransition(MoveMessageType move, Integer playerID) {
// Ueberpruefen ob das Reinschieben der Karte gueltig ist
Position sm = new Position(move.getShiftPosition());
if (!sm.isInsertablePosition() || sm.equals(forbidden)) {
System.err.println("Warning: verbotene Position der Schiebekarte"... |
2319a32e-6dce-49da-a48a-967fa10c1542 | 6 | public static int maxSinglePathSum(TreeNode root, List<Integer> max) {
if (null == root) return 0;
int left = maxSinglePathSum(root.left, max);
int right = maxSinglePathSum(root.right, max);
int m = root.val;
m = m < left + root.val ? left + root.val : m;
m = m < right + root.val ? right +... |
d18e60c1-bc4d-4627-a8db-15894671b18e | 3 | public Object getValueAt(int row, int col) {
if(row>-1 && col>-1 && data!=null)
return data[row][col];
else
return null;
} |
e422aa86-7fb9-4552-9d52-3e1d0b07e695 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
c0a9a1be-40f8-4451-8c85-6971989ef1f2 | 0 | public void removePropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(listener);
} |
f518edb8-9970-4775-ad36-786c34fd269d | 6 | public void checkPawn(){
if(color=='W'){
for(int i=0;i<8;i++){
if(aiarr[i][0].toString().charAt(1)=='P'){
aiarr[i][0]=new Queen(true);
}
}
}
if(color=='B'){
for(int i=0;i<8;i++){
if(aiarr[i][7].toString().charAt(1)=='P'){
aiarr[i][7]=new Queen(false);
}
}
}
} |
ebf9f3eb-dc21-410a-b5b8-9d28b3f53807 | 6 | @Override
public int compareTo(TimeSeriesKey other) {
/*System.out.println("In Compareto.......");
if( this.kpi.compareTo(other.getKpi())!=0){ // compare keys
return this.kpi.compareTo(other.getKpi());
}else if (this.time.compareTo(other.getTimestamp())!=0){ //If KPI's are the same then order by time
r... |
322ff2ad-85a1-42ca-b699-4e7055f37d9b | 0 | public String getTax(){ return taxAdapter.getTaxes("20"); } |
012c5a19-163f-405d-b623-548c138d5fac | 2 | public void leftMultiplyBy(Matrix that) {
double[][] values = new double[3][3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
values[i][j] = that.m[i][0] * this.m[0][j] + that.m[i][1]
* this.m[1][j] + that.m[i][2] * this.m[2][j];
setComponents(values);
} |
b7e9d88f-304e-4875-8c62-f92d4ca6bc50 | 3 | @Override
public List<ProductModel> getProductByName(String productName)
throws WebshopAppException {
if (productName != null) {
try (Connection conn = getConnection()) {
String sql = "SELECT * FROM products WHERE name = ?";
try (PreparedStatement pstmt = conn.prepareStatement(sql)) {
setString... |
69a5f2dd-8680-4888-b372-ccd49aae0a2c | 9 | void render(Graphics2D g, Object p, boolean b) {
if (!renderable)
return;
double x = 0, y = 0, grx = -5.0, gry = -5.0, gd = 10.0;
if (p instanceof GayBerneParticle) {
GayBerneParticle gb = (GayBerneParticle) p;
x = gb.rx;
y = gb.ry;
grx += x - 0.2 * gb.breadth;
gry += y - 0.2 * gb.breadth;
... |
88818782-0033-4db7-b37a-ee4d6a1151b4 | 4 | protected void computeCoordinates() {
final double innerRadiusValue = innerRadius.get();
final double startAngleValue = startAngle.get();
final double length = this.length.get();
final double graphicAngle = startAngleValue + (length / 2.0);
final double radiusValue = radius.get();
final double graphicRadius = in... |
bda9ec93-7aec-4ec2-a7ac-a9a14a18d210 | 0 | public Result(PropertyTree firstMatchingNode) {
super();
nodes=new ArrayList<PropertyTree>(1);
nodes.add(firstMatchingNode);
} |
5e65c1c4-5d5f-4047-9a27-67054af0d00b | 3 | public void use(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
PokeInstance p;
if (this.target == Target.target) {
p = target;
} else {
p = user;
}
p.battleStatus.flags[flag] = false;
if (text != null) {
text = text.replace("$target", p.getName());
if (p.battleStat... |
6a4f8574-f2c4-4f8d-8ce2-b89a082921b9 | 2 | public void sort(double[] input) {
int N = input.length;
for (int sz = 2; sz < N*2; sz *= 2) {
for (int lo = 0; lo < N; lo += sz) {
int hi = Math.min(lo + sz, N);
int mid = lo + sz / 2;
MergeSort.merge(input, lo, mid, hi);
}
}
} |
f8df1a94-64b0-4769-ab97-ca1518890c52 | 6 | public int match_main(String text, String pattern, int loc) {
// Check for null inputs.
if (text == null || pattern == null) {
throw new IllegalArgumentException("Null inputs. (match_main)");
}
loc = Math.max(0, Math.min(loc, text.length()));
if (text.equals(pattern)) {
// Shortcut (pot... |
29b5a8e3-01db-48b1-b895-a3ff254d8f50 | 9 | public void processWeatherMultiplierConfiguration() throws ConfigurationException {
final String NO_WEATHER_STATION = "ERROR: cannot have weather_multiplier values without a weatherstation configured";
// If any of the multiplier values are configured then try and process a multiplier
// configuration.
... |
1a2441d4-aa36-4fc8-aca1-e98b870003d9 | 6 | public static boolean checkHeader(ByteBuffer packet, int flag, int len, int id){
// (header s->c or c->s) [action flag | payload len | client id]
// (client id is 0 if client is sening connect request)
// parse packet
int buf_flag = packet.getInt(0);
int buf_len = packet.getInt(4);
int buf_id = packet.g... |
246451bb-6719-4239-89a0-58bcf44e4088 | 9 | public static void addPrenotazioni(HttpServletRequest req, PrintWriter out) {
HttpSession s = req.getSession();
UserBean user = (UserBean) s.getAttribute("user");
String username = user.getUsername();
JSONArray jarr = null;
HashMap<String, Integer> carrello = new HashMap<>();
... |
002e72b9-db6c-437e-aee5-8a575ce010c3 | 2 | public DefaultTokenizer() {
for (Operation op : Operation.values()) {
addOperation(op);
}
for (Function function : Function.values()) {
addFunction(function);
}
addConstant("pi", BigDecimal.valueOf(Math.PI));
addConstant("e", BigDecimal.valueOf(Ma... |
657b5194-8b27-4318-a5a5-60c5a37d7d01 | 4 | public void show(){ //Displays the Matching question.
Out.setDisp(2); //Set to Voice
Out.getDisp().renderLine(prompt);
String formL,formR; //Strings to hold left and right values to make formatting easier
for (int count = 1; count <= left.size() || count <= right.size(); count++){ //If either side still has ... |
9a8949a2-473a-410a-94b7-8e4952f065fb | 3 | public static String vectorCaddieToHTML(Vector<Caddie> rs){
if (rs.isEmpty())
return "<p class=\"plusbas\">Le caddie est vide.</p>";
String toReturn = "<TABLE BORDER='1' width=\"1000\">";
toReturn+="<CAPTION>Le caddie :</CAPTION>";
toReturn+="<TR>";
toReturn+="<TH> <i>Reservation n°</i></TH>";
toRet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.