code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public void add(final CheckBox checkBox) {
checkBox.setValue(Boolean.FALSE);
m_checkboxes.add(checkBox);
ValueChangeListener listener = new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void valueChange(ValueChangeEvent event) {
if (m_runningEvent) {
return;
} else {
try {
m_runningEvent = true;
if (((Boolean)event.getProperty().getValue()).booleanValue()) {
if ((m_selected != null) && (m_selected != checkBox)) {
m_selected.setValue(Boolean.FALSE);
}
setActiveCheckBox(checkBox);
} else {
setActiveCheckBox(null);
m_selected = null;
}
// TODO Auto-generated method stub
} finally {
m_runningEvent = false;
}
}
}
};
checkBox.addValueChangeListener(listener);
m_listeners.put(checkBox, listener);
} }
|
public class class_name {
public void add(final CheckBox checkBox) {
checkBox.setValue(Boolean.FALSE);
m_checkboxes.add(checkBox);
ValueChangeListener listener = new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void valueChange(ValueChangeEvent event) {
if (m_runningEvent) {
return; // depends on control dependency: [if], data = [none]
} else {
try {
m_runningEvent = true; // depends on control dependency: [try], data = [none]
if (((Boolean)event.getProperty().getValue()).booleanValue()) {
if ((m_selected != null) && (m_selected != checkBox)) {
m_selected.setValue(Boolean.FALSE); // depends on control dependency: [if], data = [none]
}
setActiveCheckBox(checkBox); // depends on control dependency: [if], data = [none]
} else {
setActiveCheckBox(null); // depends on control dependency: [if], data = [none]
m_selected = null; // depends on control dependency: [if], data = [none]
}
// TODO Auto-generated method stub
} finally {
m_runningEvent = false;
}
}
}
};
checkBox.addValueChangeListener(listener);
m_listeners.put(checkBox, listener);
} }
|
public class class_name {
private static Object toLong( BigDecimal value)
{
Object number;
try
{
number =
value.scale() == 0
? Long.valueOf( value.longValueExact())
: null;
}
catch( Exception e)
{
number = null;
}
return number;
} }
|
public class class_name {
private static Object toLong( BigDecimal value)
{
Object number;
try
{
number =
value.scale() == 0
? Long.valueOf( value.longValueExact())
: null; // depends on control dependency: [try], data = [none]
}
catch( Exception e)
{
number = null;
} // depends on control dependency: [catch], data = [none]
return number;
} }
|
public class class_name {
public static void convert(File srcImageFile, File destImageFile) {
Assert.notNull(srcImageFile);
Assert.notNull(destImageFile);
Assert.isFalse(srcImageFile.equals(destImageFile), "Src file is equals to dest file!");
final String srcExtName = FileUtil.extName(srcImageFile);
final String destExtName = FileUtil.extName(destImageFile);
if (StrUtil.equalsIgnoreCase(srcExtName, destExtName)) {
// 扩展名相同直接复制文件
FileUtil.copy(srcImageFile, destImageFile, true);
}
ImageOutputStream imageOutputStream = null;
try {
imageOutputStream = getImageOutputStream(destImageFile);
convert(read(srcImageFile), destExtName, imageOutputStream, StrUtil.equalsIgnoreCase(IMAGE_TYPE_PNG, srcExtName));
} finally {
IoUtil.close(imageOutputStream);
}
} }
|
public class class_name {
public static void convert(File srcImageFile, File destImageFile) {
Assert.notNull(srcImageFile);
Assert.notNull(destImageFile);
Assert.isFalse(srcImageFile.equals(destImageFile), "Src file is equals to dest file!");
final String srcExtName = FileUtil.extName(srcImageFile);
final String destExtName = FileUtil.extName(destImageFile);
if (StrUtil.equalsIgnoreCase(srcExtName, destExtName)) {
// 扩展名相同直接复制文件
FileUtil.copy(srcImageFile, destImageFile, true);
// depends on control dependency: [if], data = [none]
}
ImageOutputStream imageOutputStream = null;
try {
imageOutputStream = getImageOutputStream(destImageFile);
// depends on control dependency: [try], data = [none]
convert(read(srcImageFile), destExtName, imageOutputStream, StrUtil.equalsIgnoreCase(IMAGE_TYPE_PNG, srcExtName));
// depends on control dependency: [try], data = [none]
} finally {
IoUtil.close(imageOutputStream);
}
} }
|
public class class_name {
@Override
public void onRegisterStatus(Context context, com.meizu.cloud.pushsdk.platform.message.RegisterStatus registerStatus) {
//调用新版订阅PushManager.register(context,appId,appKey)回调
if (null == context || null == registerStatus) {
return;
}
LOGGER.d("register successed, pushId=" + registerStatus.getPushId());
String pushId = registerStatus.getPushId();
if (!StringUtil.isEmpty(pushId)) {
updateAVInstallation(pushId);
}
} }
|
public class class_name {
@Override
public void onRegisterStatus(Context context, com.meizu.cloud.pushsdk.platform.message.RegisterStatus registerStatus) {
//调用新版订阅PushManager.register(context,appId,appKey)回调
if (null == context || null == registerStatus) {
return; // depends on control dependency: [if], data = [none]
}
LOGGER.d("register successed, pushId=" + registerStatus.getPushId());
String pushId = registerStatus.getPushId();
if (!StringUtil.isEmpty(pushId)) {
updateAVInstallation(pushId); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void removeChange(DiffEntry change) {
if (checkConfigFilePath(change.getOldPath())) {
Path configFilePath = new Path(this.repositoryDir, change.getOldPath());
String flowName = FSSpecStore.getSpecName(configFilePath);
String flowGroup = FSSpecStore.getSpecGroup(configFilePath);
// build a dummy config to get the proper URI for delete
Config dummyConfig = ConfigBuilder.create()
.addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowGroup)
.addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowName)
.build();
FlowSpec spec = FlowSpec.builder()
.withConfig(dummyConfig)
.withVersion(SPEC_VERSION)
.withDescription(SPEC_DESCRIPTION)
.build();
this.flowCatalog.remove(spec.getUri());
}
} }
|
public class class_name {
@Override
public void removeChange(DiffEntry change) {
if (checkConfigFilePath(change.getOldPath())) {
Path configFilePath = new Path(this.repositoryDir, change.getOldPath());
String flowName = FSSpecStore.getSpecName(configFilePath);
String flowGroup = FSSpecStore.getSpecGroup(configFilePath);
// build a dummy config to get the proper URI for delete
Config dummyConfig = ConfigBuilder.create()
.addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowGroup)
.addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowName)
.build();
FlowSpec spec = FlowSpec.builder()
.withConfig(dummyConfig)
.withVersion(SPEC_VERSION)
.withDescription(SPEC_DESCRIPTION)
.build();
this.flowCatalog.remove(spec.getUri()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected static int hashEnumList(List<? extends EnumLite> list) {
int hash = 1;
for (EnumLite e : list) {
hash = 31 * hash + hashEnum(e);
}
return hash;
} }
|
public class class_name {
protected static int hashEnumList(List<? extends EnumLite> list) {
int hash = 1;
for (EnumLite e : list) {
hash = 31 * hash + hashEnum(e); // depends on control dependency: [for], data = [e]
}
return hash;
} }
|
public class class_name {
private void setConnectionReadOnly(Connection connection, boolean readOnly) {
if (supportsReadOnly) {
try {
connection.setReadOnly(readOnly);
} catch (Throwable th) {
logger.info("Read-only connections not supported ({})", th.getMessage());
supportsReadOnly = false;
}
}
} }
|
public class class_name {
private void setConnectionReadOnly(Connection connection, boolean readOnly) {
if (supportsReadOnly) {
try {
connection.setReadOnly(readOnly); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
logger.info("Read-only connections not supported ({})", th.getMessage());
supportsReadOnly = false;
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public EventFilter withEventTypeCategories(String... eventTypeCategories) {
if (this.eventTypeCategories == null) {
setEventTypeCategories(new java.util.ArrayList<String>(eventTypeCategories.length));
}
for (String ele : eventTypeCategories) {
this.eventTypeCategories.add(ele);
}
return this;
} }
|
public class class_name {
public EventFilter withEventTypeCategories(String... eventTypeCategories) {
if (this.eventTypeCategories == null) {
setEventTypeCategories(new java.util.ArrayList<String>(eventTypeCategories.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : eventTypeCategories) {
this.eventTypeCategories.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private void handleRequestFailure(long requestId, Throwable error, ThreadContext context) {
ByteBuf buffer = channel.alloc().buffer(10)
.writeByte(RESPONSE)
.writeLong(requestId)
.writeByte(FAILURE);
try {
writeError(buffer, error, context);
} catch (SerializationException e) {
return;
}
channel.writeAndFlush(buffer, channel.voidPromise());
} }
|
public class class_name {
private void handleRequestFailure(long requestId, Throwable error, ThreadContext context) {
ByteBuf buffer = channel.alloc().buffer(10)
.writeByte(RESPONSE)
.writeLong(requestId)
.writeByte(FAILURE);
try {
writeError(buffer, error, context); // depends on control dependency: [try], data = [none]
} catch (SerializationException e) {
return;
} // depends on control dependency: [catch], data = [none]
channel.writeAndFlush(buffer, channel.voidPromise());
} }
|
public class class_name {
protected Map<String, List<CmsResource>> createFolderLookupMap(List<CmsResource> resources) {
Map<String, List<CmsResource>> result = new HashMap<String, List<CmsResource>>(128);
Iterator<CmsResource> i = resources.iterator();
while (i.hasNext()) {
CmsResource res = i.next();
String folderPath = CmsResource.getFolderPath(res.getRootPath());
List<CmsResource> folderContent = result.get(folderPath);
if (folderContent == null) {
folderContent = new ArrayList<CmsResource>(32);
result.put(folderPath, folderContent);
}
folderContent.add(res);
}
return result;
} }
|
public class class_name {
protected Map<String, List<CmsResource>> createFolderLookupMap(List<CmsResource> resources) {
Map<String, List<CmsResource>> result = new HashMap<String, List<CmsResource>>(128);
Iterator<CmsResource> i = resources.iterator();
while (i.hasNext()) {
CmsResource res = i.next();
String folderPath = CmsResource.getFolderPath(res.getRootPath());
List<CmsResource> folderContent = result.get(folderPath);
if (folderContent == null) {
folderContent = new ArrayList<CmsResource>(32); // depends on control dependency: [if], data = [none]
result.put(folderPath, folderContent); // depends on control dependency: [if], data = [none]
}
folderContent.add(res); // depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public void marshall(Counters counters, ProtocolMarshaller protocolMarshaller) {
if (counters == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(counters.getTotal(), TOTAL_BINDING);
protocolMarshaller.marshall(counters.getPassed(), PASSED_BINDING);
protocolMarshaller.marshall(counters.getFailed(), FAILED_BINDING);
protocolMarshaller.marshall(counters.getWarned(), WARNED_BINDING);
protocolMarshaller.marshall(counters.getErrored(), ERRORED_BINDING);
protocolMarshaller.marshall(counters.getStopped(), STOPPED_BINDING);
protocolMarshaller.marshall(counters.getSkipped(), SKIPPED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Counters counters, ProtocolMarshaller protocolMarshaller) {
if (counters == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(counters.getTotal(), TOTAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(counters.getPassed(), PASSED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(counters.getFailed(), FAILED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(counters.getWarned(), WARNED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(counters.getErrored(), ERRORED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(counters.getStopped(), STOPPED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(counters.getSkipped(), SKIPPED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(DescribeDocumentPermissionRequest describeDocumentPermissionRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDocumentPermissionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDocumentPermissionRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(describeDocumentPermissionRequest.getPermissionType(), PERMISSIONTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeDocumentPermissionRequest describeDocumentPermissionRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDocumentPermissionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDocumentPermissionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeDocumentPermissionRequest.getPermissionType(), PERMISSIONTYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String encryptPassword(String plain) {
Preconditions.checkArgument(this.encryptors.size() > 0,
"A master password needs to be provided for encrypting passwords.");
try {
return this.encryptors.get(0).encrypt(plain);
} catch (Exception e) {
throw new RuntimeException("Failed to encrypt password", e);
}
} }
|
public class class_name {
public String encryptPassword(String plain) {
Preconditions.checkArgument(this.encryptors.size() > 0,
"A master password needs to be provided for encrypting passwords.");
try {
return this.encryptors.get(0).encrypt(plain); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Failed to encrypt password", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public EClass getGCOMT() {
if (gcomtEClass == null) {
gcomtEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(445);
}
return gcomtEClass;
} }
|
public class class_name {
public EClass getGCOMT() {
if (gcomtEClass == null) {
gcomtEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(445); // depends on control dependency: [if], data = [none]
}
return gcomtEClass;
} }
|
public class class_name {
public ArrayList<Frame> prepareBody(WsByteBuffer[] wsbb, int length, boolean isFinalWrite) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareBody entry : final write: " + isFinalWrite);
}
ArrayList<Frame> dataFrames = new ArrayList<Frame>();
FrameData dataFrame;
if (wsbb == null || length == 0) {
// this empty data frame will have an end of stream flag set, signalling stream closure
dataFrame = new FrameData(streamID, null, 0, isFinalWrite);
dataFrames.add(dataFrame);
return dataFrames;
}
boolean endStream = isFinalWrite;
boolean lastData = false;
int lengthWritten = 0;
// if there's more than one buffer passed in we can't assume it will end the stream
if (wsbb.length > 1) {
endStream = false;
}
// create a data frame for every buffer in the array
for (int i = 0; i < wsbb.length; i++) {
WsByteBuffer b = wsbb[i];
if (b == null) {
continue;
}
lengthWritten += b.remaining();
if (b.remaining() != 0) {
if (lengthWritten >= length) {
// the current buffer meets the expected total write length,
// so we'll mark this as the last data frame on the stream
lastData = true;
endStream = lastData && isFinalWrite ? true : false;
}
dataFrame = new FrameData(streamID, b, b.remaining(), endStream);
dataFrames.add(dataFrame);
if (lastData) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareBody exit : " + dataFrames);
}
return dataFrames;
}
}
}
return dataFrames;
} }
|
public class class_name {
public ArrayList<Frame> prepareBody(WsByteBuffer[] wsbb, int length, boolean isFinalWrite) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareBody entry : final write: " + isFinalWrite); // depends on control dependency: [if], data = [none]
}
ArrayList<Frame> dataFrames = new ArrayList<Frame>();
FrameData dataFrame;
if (wsbb == null || length == 0) {
// this empty data frame will have an end of stream flag set, signalling stream closure
dataFrame = new FrameData(streamID, null, 0, isFinalWrite); // depends on control dependency: [if], data = [none]
dataFrames.add(dataFrame); // depends on control dependency: [if], data = [none]
return dataFrames; // depends on control dependency: [if], data = [none]
}
boolean endStream = isFinalWrite;
boolean lastData = false;
int lengthWritten = 0;
// if there's more than one buffer passed in we can't assume it will end the stream
if (wsbb.length > 1) {
endStream = false; // depends on control dependency: [if], data = [none]
}
// create a data frame for every buffer in the array
for (int i = 0; i < wsbb.length; i++) {
WsByteBuffer b = wsbb[i];
if (b == null) {
continue;
}
lengthWritten += b.remaining(); // depends on control dependency: [for], data = [none]
if (b.remaining() != 0) {
if (lengthWritten >= length) {
// the current buffer meets the expected total write length,
// so we'll mark this as the last data frame on the stream
lastData = true; // depends on control dependency: [if], data = [none]
endStream = lastData && isFinalWrite ? true : false; // depends on control dependency: [if], data = [none]
}
dataFrame = new FrameData(streamID, b, b.remaining(), endStream); // depends on control dependency: [if], data = [none]
dataFrames.add(dataFrame); // depends on control dependency: [if], data = [none]
if (lastData) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "prepareBody exit : " + dataFrames); // depends on control dependency: [if], data = [none]
}
return dataFrames; // depends on control dependency: [if], data = [none]
}
}
}
return dataFrames;
} }
|
public class class_name {
private static HashMap<String, String> getValuesByHeaderPrefix(final HttpURLConnection request, final String prefix) {
final HashMap<String, String> retVals = new HashMap<String, String>();
final Map<String, List<String>> headerMap = request.getHeaderFields();
final int prefixLength = prefix.length();
for (final Entry<String, List<String>> entry : headerMap.entrySet()) {
if (entry.getKey() != null && entry.getKey().startsWith(prefix)) {
final List<String> currHeaderValues = entry.getValue();
retVals.put(entry.getKey().substring(prefixLength), currHeaderValues.get(0));
}
}
return retVals;
} }
|
public class class_name {
private static HashMap<String, String> getValuesByHeaderPrefix(final HttpURLConnection request, final String prefix) {
final HashMap<String, String> retVals = new HashMap<String, String>();
final Map<String, List<String>> headerMap = request.getHeaderFields();
final int prefixLength = prefix.length();
for (final Entry<String, List<String>> entry : headerMap.entrySet()) {
if (entry.getKey() != null && entry.getKey().startsWith(prefix)) {
final List<String> currHeaderValues = entry.getValue();
retVals.put(entry.getKey().substring(prefixLength), currHeaderValues.get(0)); // depends on control dependency: [if], data = [(entry.getKey()]
}
}
return retVals;
} }
|
public class class_name {
private void shutdown(final Map<String, Object> respMap) {
try {
logger.warn("Shutting down executor...");
// Set the executor to inactive. Will receive no new flows.
setActiveInternal(false);
this.application.shutdown();
respMap.put(ConnectorParams.STATUS_PARAM, ConnectorParams.RESPONSE_SUCCESS);
} catch (final Exception e) {
logger.error(e.getMessage(), e);
respMap.put(ConnectorParams.RESPONSE_ERROR, e.getMessage());
}
} }
|
public class class_name {
private void shutdown(final Map<String, Object> respMap) {
try {
logger.warn("Shutting down executor..."); // depends on control dependency: [try], data = [none]
// Set the executor to inactive. Will receive no new flows.
setActiveInternal(false); // depends on control dependency: [try], data = [none]
this.application.shutdown(); // depends on control dependency: [try], data = [none]
respMap.put(ConnectorParams.STATUS_PARAM, ConnectorParams.RESPONSE_SUCCESS); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
logger.error(e.getMessage(), e);
respMap.put(ConnectorParams.RESPONSE_ERROR, e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Context toFunctional(Context context) {
if (context == Context.PURE) {
return context;
} else {
return Context.FUNCTIONAL;
}
} }
|
public class class_name {
public Context toFunctional(Context context) {
if (context == Context.PURE) {
return context; // depends on control dependency: [if], data = [none]
} else {
return Context.FUNCTIONAL; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
void processPersistenceUnit(JPAPXml pxml, JPAApplInfo applInfo) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processPersistenceUnit" + pxml);
synchronized (pxmlsInfo) {
URL pxmlRootURL = pxml.getRootURL();
String pxmlInfoKey = scope == JPAPuScope.EAR_Scope ? pxml.getArchiveName() : pxmlRootURL.toString();
JPAPxmlInfo pxmlInfo = pxmlsInfo.get(pxmlInfoKey);
// if root URL is defined for this persistence.xml, it has been processed before,
// i.e. deployed web module processing will find persistence.xml in the ejb module
// since the ejb module is in the web module classpath.
if (pxmlInfo == null) {
pxmlInfo = new JPAPxmlInfo(this, pxmlRootURL); // F743-23167
pxmlsInfo.put(pxmlInfoKey, pxmlInfo);
JPAIntrospection.beginPXmlInfoVisit(pxmlInfo);
try {
// read in all the persistence unit define in this persistence.xml
pxmlInfo.extractPersistenceUnits(pxml); //PK62950
} finally {
JPAIntrospection.endPXmlInfoVisit();
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processPersistenceUnit", getPUList());
} }
|
public class class_name {
void processPersistenceUnit(JPAPXml pxml, JPAApplInfo applInfo) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "processPersistenceUnit" + pxml);
synchronized (pxmlsInfo) {
URL pxmlRootURL = pxml.getRootURL();
String pxmlInfoKey = scope == JPAPuScope.EAR_Scope ? pxml.getArchiveName() : pxmlRootURL.toString();
JPAPxmlInfo pxmlInfo = pxmlsInfo.get(pxmlInfoKey);
// if root URL is defined for this persistence.xml, it has been processed before,
// i.e. deployed web module processing will find persistence.xml in the ejb module
// since the ejb module is in the web module classpath.
if (pxmlInfo == null) {
pxmlInfo = new JPAPxmlInfo(this, pxmlRootURL); // F743-23167 // depends on control dependency: [if], data = [none]
pxmlsInfo.put(pxmlInfoKey, pxmlInfo); // depends on control dependency: [if], data = [(pxmlInfo]
JPAIntrospection.beginPXmlInfoVisit(pxmlInfo); // depends on control dependency: [if], data = [(pxmlInfo]
try {
// read in all the persistence unit define in this persistence.xml
pxmlInfo.extractPersistenceUnits(pxml); //PK62950 // depends on control dependency: [try], data = [none]
} finally {
JPAIntrospection.endPXmlInfoVisit();
}
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processPersistenceUnit", getPUList());
} }
|
public class class_name {
public Double getAvgDelayTime() {
Double avgDelayTime = 0.0;
if (items.size() != 0) {
for (DelayStat item : items) {
avgDelayTime += item.getDelayTime();
}
avgDelayTime = avgDelayTime / items.size();
}
return avgDelayTime;
} }
|
public class class_name {
public Double getAvgDelayTime() {
Double avgDelayTime = 0.0;
if (items.size() != 0) {
for (DelayStat item : items) {
avgDelayTime += item.getDelayTime(); // depends on control dependency: [for], data = [item]
}
avgDelayTime = avgDelayTime / items.size(); // depends on control dependency: [if], data = [none]
}
return avgDelayTime;
} }
|
public class class_name {
public String encodeBookmarkableURL(String baseUrl,
Map<String, List<String>> parameters) {
if (defaultExternalContext != null) {
return defaultExternalContext.encodeBookmarkableURL(baseUrl,
parameters);
}
throw new UnsupportedOperationException();
} }
|
public class class_name {
public String encodeBookmarkableURL(String baseUrl,
Map<String, List<String>> parameters) {
if (defaultExternalContext != null) {
return defaultExternalContext.encodeBookmarkableURL(baseUrl,
parameters); // depends on control dependency: [if], data = [none]
}
throw new UnsupportedOperationException();
} }
|
public class class_name {
public static void validateResourcePools(Collection<? extends ResourcePool> pools) {
List<SizedResourcePool> ordered = new ArrayList<>(pools.size());
for(ResourcePool pool : pools) {
if (pool instanceof SizedResourcePool) {
ordered.add((SizedResourcePool)pool);
}
}
ordered.sort((o1, o2) -> {
int retVal = o2.getType().getTierHeight() - o1.getType().getTierHeight();
if (retVal == 0) {
return o1.toString().compareTo(o2.toString());
} else {
return retVal;
}
});
for (int i = 0; i < ordered.size(); i++) {
for (int j = 0; j < i; j++) {
SizedResourcePool upper = ordered.get(j);
SizedResourcePool lower = ordered.get(i);
boolean inversion;
boolean ambiguity;
try {
ambiguity = upper.getType().getTierHeight() == lower.getType().getTierHeight();
inversion = (upper.getUnit().compareTo(upper.getSize(), lower.getSize(), lower.getUnit()) >= 0)
|| (lower.getUnit().compareTo(lower.getSize(), upper.getSize(), upper.getUnit()) <= 0);
} catch (IllegalArgumentException e) {
ambiguity = false;
inversion = false;
}
if (ambiguity) {
throw new IllegalArgumentException("Tiering Ambiguity: '" + upper + "' has the same tier height as '" + lower + "'");
}
if (inversion) {
throw new IllegalArgumentException("Tiering Inversion: '" + upper + "' is not smaller than '" + lower + "'");
}
}
}
} }
|
public class class_name {
public static void validateResourcePools(Collection<? extends ResourcePool> pools) {
List<SizedResourcePool> ordered = new ArrayList<>(pools.size());
for(ResourcePool pool : pools) {
if (pool instanceof SizedResourcePool) {
ordered.add((SizedResourcePool)pool); // depends on control dependency: [if], data = [none]
}
}
ordered.sort((o1, o2) -> {
int retVal = o2.getType().getTierHeight() - o1.getType().getTierHeight();
if (retVal == 0) {
return o1.toString().compareTo(o2.toString()); // depends on control dependency: [if], data = [none]
} else {
return retVal; // depends on control dependency: [if], data = [none]
}
});
for (int i = 0; i < ordered.size(); i++) {
for (int j = 0; j < i; j++) {
SizedResourcePool upper = ordered.get(j);
SizedResourcePool lower = ordered.get(i);
boolean inversion;
boolean ambiguity;
try {
ambiguity = upper.getType().getTierHeight() == lower.getType().getTierHeight(); // depends on control dependency: [try], data = [none]
inversion = (upper.getUnit().compareTo(upper.getSize(), lower.getSize(), lower.getUnit()) >= 0)
|| (lower.getUnit().compareTo(lower.getSize(), upper.getSize(), upper.getUnit()) <= 0); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
ambiguity = false;
inversion = false;
} // depends on control dependency: [catch], data = [none]
if (ambiguity) {
throw new IllegalArgumentException("Tiering Ambiguity: '" + upper + "' has the same tier height as '" + lower + "'");
}
if (inversion) {
throw new IllegalArgumentException("Tiering Inversion: '" + upper + "' is not smaller than '" + lower + "'");
}
}
}
} }
|
public class class_name {
@Override
protected Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> getTypeParameterMapping() {
if (typeParameterMapping == null) {
typeParameterMapping = initializeTypeParameterMapping();
}
return typeParameterMapping;
} }
|
public class class_name {
@Override
protected Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> getTypeParameterMapping() {
if (typeParameterMapping == null) {
typeParameterMapping = initializeTypeParameterMapping(); // depends on control dependency: [if], data = [none]
}
return typeParameterMapping;
} }
|
public class class_name {
public Observable<ServiceResponse<Contacts>> deleteCertificateContactsWithServiceResponseAsync(String vaultBaseUrl) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.deleteCertificateContacts(this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Contacts>>>() {
@Override
public Observable<ServiceResponse<Contacts>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Contacts> clientResponse = deleteCertificateContactsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Contacts>> deleteCertificateContactsWithServiceResponseAsync(String vaultBaseUrl) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.deleteCertificateContacts(this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Contacts>>>() {
@Override
public Observable<ServiceResponse<Contacts>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Contacts> clientResponse = deleteCertificateContactsDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static Map<String, String> readProperties(CmsObject cms, I_CmsXmlContentLocation baseLocation) {
Map<String, String> result = new HashMap<String, String>();
String elementName = CmsXmlContentProperty.XmlNode.Properties.name();
String nameElementName = CmsXmlContentProperty.XmlNode.Name.name();
List<I_CmsXmlContentValueLocation> propertyLocations = baseLocation.getSubValues(elementName);
for (I_CmsXmlContentValueLocation propertyLocation : propertyLocations) {
I_CmsXmlContentValueLocation nameLocation = propertyLocation.getSubValue(nameElementName);
String name = nameLocation.asString(cms).trim();
String value = null;
I_CmsXmlContentValueLocation valueLocation = propertyLocation.getSubValue(
CmsXmlContentProperty.XmlNode.Value.name());
I_CmsXmlContentValueLocation stringLocation = valueLocation.getSubValue(
CmsXmlContentProperty.XmlNode.String.name());
I_CmsXmlContentValueLocation fileListLocation = valueLocation.getSubValue(
CmsXmlContentProperty.XmlNode.FileList.name());
if (stringLocation != null) {
value = stringLocation.asString(cms).trim();
} else if (fileListLocation != null) {
List<CmsUUID> idList = new ArrayList<CmsUUID>();
List<I_CmsXmlContentValueLocation> fileLocations = fileListLocation.getSubValues(
CmsXmlContentProperty.XmlNode.Uri.name());
for (I_CmsXmlContentValueLocation fileLocation : fileLocations) {
CmsUUID structureId = fileLocation.asId(cms);
idList.add(structureId);
}
value = CmsStringUtil.listAsString(idList, CmsXmlContentProperty.PROP_SEPARATOR);
}
if (value != null) {
result.put(name, value);
}
}
return result;
} }
|
public class class_name {
public static Map<String, String> readProperties(CmsObject cms, I_CmsXmlContentLocation baseLocation) {
Map<String, String> result = new HashMap<String, String>();
String elementName = CmsXmlContentProperty.XmlNode.Properties.name();
String nameElementName = CmsXmlContentProperty.XmlNode.Name.name();
List<I_CmsXmlContentValueLocation> propertyLocations = baseLocation.getSubValues(elementName);
for (I_CmsXmlContentValueLocation propertyLocation : propertyLocations) {
I_CmsXmlContentValueLocation nameLocation = propertyLocation.getSubValue(nameElementName);
String name = nameLocation.asString(cms).trim();
String value = null;
I_CmsXmlContentValueLocation valueLocation = propertyLocation.getSubValue(
CmsXmlContentProperty.XmlNode.Value.name());
I_CmsXmlContentValueLocation stringLocation = valueLocation.getSubValue(
CmsXmlContentProperty.XmlNode.String.name());
I_CmsXmlContentValueLocation fileListLocation = valueLocation.getSubValue(
CmsXmlContentProperty.XmlNode.FileList.name());
if (stringLocation != null) {
value = stringLocation.asString(cms).trim(); // depends on control dependency: [if], data = [none]
} else if (fileListLocation != null) {
List<CmsUUID> idList = new ArrayList<CmsUUID>();
List<I_CmsXmlContentValueLocation> fileLocations = fileListLocation.getSubValues(
CmsXmlContentProperty.XmlNode.Uri.name());
for (I_CmsXmlContentValueLocation fileLocation : fileLocations) {
CmsUUID structureId = fileLocation.asId(cms);
idList.add(structureId); // depends on control dependency: [for], data = [none]
}
value = CmsStringUtil.listAsString(idList, CmsXmlContentProperty.PROP_SEPARATOR); // depends on control dependency: [if], data = [none]
}
if (value != null) {
result.put(name, value); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
private int stateLength(int state) {
int arc = state;
while (!isArcLast(arc)) {
arc += ARC_SIZE;
}
return arc - state + ARC_SIZE;
} }
|
public class class_name {
private int stateLength(int state) {
int arc = state;
while (!isArcLast(arc)) {
arc += ARC_SIZE; // depends on control dependency: [while], data = [none]
}
return arc - state + ARC_SIZE;
} }
|
public class class_name {
public <F> void updateProfileField(ProfileField<F, ?> field, List<F> values) {
if (field.isSingle()) {
throw new IllegalArgumentException(
"Field is only valid for single value");
} else {
getResourceFactory()
.getApiResource("/user/profile/" + field.getName())
.entity(new ProfileFieldMultiValue<F>(values),
MediaType.APPLICATION_JSON_TYPE).put();
}
} }
|
public class class_name {
public <F> void updateProfileField(ProfileField<F, ?> field, List<F> values) {
if (field.isSingle()) {
throw new IllegalArgumentException(
"Field is only valid for single value");
} else {
getResourceFactory()
.getApiResource("/user/profile/" + field.getName())
.entity(new ProfileFieldMultiValue<F>(values),
MediaType.APPLICATION_JSON_TYPE).put(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void writeLOC(XEntry xentry) throws IOException {
ZipEntry e = xentry.entry;
int flag = e.flag;
int elen = (e.extra != null) ? e.extra.length : 0;
boolean hasZip64 = false;
writeInt(LOCSIG); // LOC header signature
if ((flag & 8) == 8) {
writeShort(version(e)); // version needed to extract
writeShort(flag); // general purpose bit flag
writeShort(e.method); // compression method
writeInt(e.time); // last modification time
// store size, uncompressed size, and crc-32 in data descriptor
// immediately following compressed entry data
writeInt(0);
writeInt(0);
writeInt(0);
} else {
if (e.csize >= ZIP64_MAGICVAL || e.size >= ZIP64_MAGICVAL) {
hasZip64 = true;
writeShort(45); // ver 4.5 for zip64
} else {
writeShort(version(e)); // version needed to extract
}
writeShort(flag); // general purpose bit flag
writeShort(e.method); // compression method
writeInt(e.time); // last modification time
writeInt(e.crc); // crc-32
if (hasZip64) {
writeInt(ZIP64_MAGICVAL);
writeInt(ZIP64_MAGICVAL);
elen += 20; //headid(2) + size(2) + size(8) + csize(8)
} else {
writeInt(e.csize); // compressed size
writeInt(e.size); // uncompressed size
}
}
byte[] nameBytes = zc.getBytes(e.name);
writeShort(nameBytes.length);
writeShort(elen);
writeBytes(nameBytes, 0, nameBytes.length);
if (hasZip64) {
writeShort(ZIP64_EXTID);
writeShort(16);
writeLong(e.size);
writeLong(e.csize);
}
if (e.extra != null) {
writeBytes(e.extra, 0, e.extra.length);
}
locoff = written;
} }
|
public class class_name {
private void writeLOC(XEntry xentry) throws IOException {
ZipEntry e = xentry.entry;
int flag = e.flag;
int elen = (e.extra != null) ? e.extra.length : 0;
boolean hasZip64 = false;
writeInt(LOCSIG); // LOC header signature
if ((flag & 8) == 8) {
writeShort(version(e)); // version needed to extract
writeShort(flag); // general purpose bit flag
writeShort(e.method); // compression method
writeInt(e.time); // last modification time
// store size, uncompressed size, and crc-32 in data descriptor
// immediately following compressed entry data
writeInt(0);
writeInt(0);
writeInt(0);
} else {
if (e.csize >= ZIP64_MAGICVAL || e.size >= ZIP64_MAGICVAL) {
hasZip64 = true; // depends on control dependency: [if], data = [none]
writeShort(45); // ver 4.5 for zip64 // depends on control dependency: [if], data = [none]
} else {
writeShort(version(e)); // version needed to extract // depends on control dependency: [if], data = [none]
}
writeShort(flag); // general purpose bit flag
writeShort(e.method); // compression method
writeInt(e.time); // last modification time
writeInt(e.crc); // crc-32
if (hasZip64) {
writeInt(ZIP64_MAGICVAL); // depends on control dependency: [if], data = [none]
writeInt(ZIP64_MAGICVAL); // depends on control dependency: [if], data = [none]
elen += 20; //headid(2) + size(2) + size(8) + csize(8) // depends on control dependency: [if], data = [none]
} else {
writeInt(e.csize); // compressed size // depends on control dependency: [if], data = [none]
writeInt(e.size); // uncompressed size // depends on control dependency: [if], data = [none]
}
}
byte[] nameBytes = zc.getBytes(e.name);
writeShort(nameBytes.length);
writeShort(elen);
writeBytes(nameBytes, 0, nameBytes.length);
if (hasZip64) {
writeShort(ZIP64_EXTID);
writeShort(16);
writeLong(e.size);
writeLong(e.csize);
}
if (e.extra != null) {
writeBytes(e.extra, 0, e.extra.length);
}
locoff = written;
} }
|
public class class_name {
public static void annotate(String doubleName, double doubleValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotate(doubleName, doubleValue);
}
} }
|
public class class_name {
public static void annotate(String doubleName, double doubleValue) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotate(doubleName, doubleValue); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public final RuleMatch[] match(AnalyzedSentence sentence) {
List<RuleMatch> ruleMatches = new ArrayList<>();
AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace();
boolean repetition = false;
Set<String> inflectedWords = new TreeSet<>();
String prevLemma;
int curToken = 0;
// start from real token, 0 = SENT_START
for (int i = 1; i < tokens.length; i++) {
String token = tokens[i].getToken();
// avoid "..." etc. to be matched:
boolean isWord = true;
boolean hasLemma = true;
if (token.length() < 2) {
isWord = false;
}
for (AnalyzedToken analyzedToken : tokens[i]) {
String posTag = analyzedToken.getPOSTag();
if (posTag != null) {
if (StringTools.isEmpty(posTag)) {
isWord = false;
break;
}
String lemma = analyzedToken.getLemma();
if (lemma == null) {
hasLemma = false;
break;
}
if (getExcludedWordsPattern().contains(lemma)) {
isWord = false;
break;
}
Matcher m2 = getExcludedPos().matcher(posTag);
if (m2.matches()) {
isWord = false;
break;
}
} else {
hasLemma = false;
}
}
Matcher m1 = getExcludedNonWordsPattern().matcher(tokens[i].getToken());
if (isWord && m1.matches()) {
isWord = false;
}
prevLemma = "";
if (isWord) {
boolean notSentEnd = false;
for (AnalyzedToken analyzedToken : tokens[i]) {
String pos = analyzedToken.getPOSTag();
if (pos != null) {
notSentEnd |= JLanguageTool.SENTENCE_END_TAGNAME.equals(pos);
}
if (hasLemma) {
String curLemma = analyzedToken.getLemma();
if (!prevLemma.equals(curLemma) && !notSentEnd) {
if (inflectedWords.contains(curLemma) && curToken != i) {
repetition = true;
} else {
inflectedWords.add(analyzedToken.getLemma());
curToken = i;
}
}
prevLemma = curLemma;
} else {
if (inflectedWords.contains(tokens[i].getToken()) && !notSentEnd) {
repetition = true;
} else {
inflectedWords.add(tokens[i].getToken());
}
}
}
}
if (repetition) {
int pos = tokens[i].getStartPos();
RuleMatch ruleMatch = new RuleMatch(this, sentence, pos, pos
+ token.length(), getMessage(), getShortMessage());
ruleMatches.add(ruleMatch);
repetition = false;
}
}
return toRuleMatchArray(ruleMatches);
} }
|
public class class_name {
@Override
public final RuleMatch[] match(AnalyzedSentence sentence) {
List<RuleMatch> ruleMatches = new ArrayList<>();
AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace();
boolean repetition = false;
Set<String> inflectedWords = new TreeSet<>();
String prevLemma;
int curToken = 0;
// start from real token, 0 = SENT_START
for (int i = 1; i < tokens.length; i++) {
String token = tokens[i].getToken();
// avoid "..." etc. to be matched:
boolean isWord = true;
boolean hasLemma = true;
if (token.length() < 2) {
isWord = false; // depends on control dependency: [if], data = [none]
}
for (AnalyzedToken analyzedToken : tokens[i]) {
String posTag = analyzedToken.getPOSTag();
if (posTag != null) {
if (StringTools.isEmpty(posTag)) {
isWord = false; // depends on control dependency: [if], data = [none]
break;
}
String lemma = analyzedToken.getLemma();
if (lemma == null) {
hasLemma = false; // depends on control dependency: [if], data = [none]
break;
}
if (getExcludedWordsPattern().contains(lemma)) {
isWord = false; // depends on control dependency: [if], data = [none]
break;
}
Matcher m2 = getExcludedPos().matcher(posTag);
if (m2.matches()) {
isWord = false; // depends on control dependency: [if], data = [none]
break;
}
} else {
hasLemma = false; // depends on control dependency: [if], data = [none]
}
}
Matcher m1 = getExcludedNonWordsPattern().matcher(tokens[i].getToken());
if (isWord && m1.matches()) {
isWord = false; // depends on control dependency: [if], data = [none]
}
prevLemma = ""; // depends on control dependency: [for], data = [none]
if (isWord) {
boolean notSentEnd = false;
for (AnalyzedToken analyzedToken : tokens[i]) {
String pos = analyzedToken.getPOSTag();
if (pos != null) {
notSentEnd |= JLanguageTool.SENTENCE_END_TAGNAME.equals(pos); // depends on control dependency: [if], data = [(pos]
}
if (hasLemma) {
String curLemma = analyzedToken.getLemma();
if (!prevLemma.equals(curLemma) && !notSentEnd) {
if (inflectedWords.contains(curLemma) && curToken != i) {
repetition = true; // depends on control dependency: [if], data = [none]
} else {
inflectedWords.add(analyzedToken.getLemma()); // depends on control dependency: [if], data = [none]
curToken = i; // depends on control dependency: [if], data = [none]
}
}
prevLemma = curLemma; // depends on control dependency: [if], data = [none]
} else {
if (inflectedWords.contains(tokens[i].getToken()) && !notSentEnd) {
repetition = true; // depends on control dependency: [if], data = [none]
} else {
inflectedWords.add(tokens[i].getToken()); // depends on control dependency: [if], data = [none]
}
}
}
}
if (repetition) {
int pos = tokens[i].getStartPos();
RuleMatch ruleMatch = new RuleMatch(this, sentence, pos, pos
+ token.length(), getMessage(), getShortMessage());
ruleMatches.add(ruleMatch); // depends on control dependency: [if], data = [none]
repetition = false; // depends on control dependency: [if], data = [none]
}
}
return toRuleMatchArray(ruleMatches);
} }
|
public class class_name {
public String getHtmlString(Record recMenu)
{
String strCellFormat = null;
if ((strCellFormat == null) || (strCellFormat.length() == 0))
{
ResourceBundle reg = ((BaseApplication)((BaseMenuScreen)this.getScreenField()).getTask().getApplication()).getResources(HtmlConstants.HTML_RESOURCE, false);
strCellFormat = reg.getString("htmlAppMenu");
}
if ((strCellFormat == null) || (strCellFormat.length() == 0))
strCellFormat = "<items columns=\"5\"><td align=center valign=\"top\"><a href=\""
+ HtmlConstants.LINK_TAG + "\"><img src=\"" + HtmlConstants.HTML_ROOT + HtmlConstants.ICON_TAG
+ "\" width=\"24\" height=\"24\"><br/>" + HtmlConstants.TITLE_TAG + "</a></td></items>";
return strCellFormat;
} }
|
public class class_name {
public String getHtmlString(Record recMenu)
{
String strCellFormat = null;
if ((strCellFormat == null) || (strCellFormat.length() == 0))
{
ResourceBundle reg = ((BaseApplication)((BaseMenuScreen)this.getScreenField()).getTask().getApplication()).getResources(HtmlConstants.HTML_RESOURCE, false);
strCellFormat = reg.getString("htmlAppMenu"); // depends on control dependency: [if], data = [none]
}
if ((strCellFormat == null) || (strCellFormat.length() == 0))
strCellFormat = "<items columns=\"5\"><td align=center valign=\"top\"><a href=\""
+ HtmlConstants.LINK_TAG + "\"><img src=\"" + HtmlConstants.HTML_ROOT + HtmlConstants.ICON_TAG
+ "\" width=\"24\" height=\"24\"><br/>" + HtmlConstants.TITLE_TAG + "</a></td></items>";
return strCellFormat;
} }
|
public class class_name {
private void buildShipFile() {
// Build variable list (var(station,time))
List<GempakStation> stations = gemreader.getStations();
int numObs = stations.size();
//Trace.msg("GEMPAKSIOSP: now have " + numObs + " stations");
Dimension record = new Dimension("record", numObs, true,
(numObs == 0), false);
ncfile.addDimension(null, record);
List<Dimension> records = new ArrayList<>(1);
records.add(record);
// time
Variable timeVar = new Variable(ncfile, null, null, TIME_VAR,
DataType.DOUBLE, (String)null);
timeVar.addAttribute(
new Attribute(CDM.UNITS, "seconds since 1970-01-01 00:00:00"));
timeVar.addAttribute(new Attribute("long_name", TIME_VAR));
ncfile.addDimension(null, DIM_LEN8);
ncfile.addDimension(null, DIM_LEN4);
ncfile.addDimension(null, DIM_LEN2);
List<Variable> stationVars = makeStationVars(stations, null);
List<GempakParameter> params =
gemreader.getParameters(GempakSurfaceFileReader.SFDT);
if (params == null) {
return;
}
Structure sVar = new Structure(ncfile, null, null, "Obs");
sVar.setDimensions(records);
// loop through and add to ncfile
boolean hasElevation = false;
for (Variable stnVar : stationVars) {
if (stnVar.getShortName().equals("SELV")) {
hasElevation = true;
}
sVar.addMemberVariable(stnVar);
}
sVar.addMemberVariable(timeVar);
for (GempakParameter param : params) {
Variable var = makeParamVariable(param, null);
sVar.addMemberVariable(var);
}
sVar.addMemberVariable(makeMissingVariable());
String coords = "Obs.time Obs.SLAT Obs.SLON";
if (hasElevation) {
coords = coords + " Obs.SELV";
}
sVar.addAttribute(new Attribute(CF.COORDINATES, coords));
ncfile.addVariable(null, sVar);
ncfile.addAttribute(null,
new Attribute("CF:featureType",
CF.FeatureType.point.toString()));
} }
|
public class class_name {
private void buildShipFile() {
// Build variable list (var(station,time))
List<GempakStation> stations = gemreader.getStations();
int numObs = stations.size();
//Trace.msg("GEMPAKSIOSP: now have " + numObs + " stations");
Dimension record = new Dimension("record", numObs, true,
(numObs == 0), false);
ncfile.addDimension(null, record);
List<Dimension> records = new ArrayList<>(1);
records.add(record);
// time
Variable timeVar = new Variable(ncfile, null, null, TIME_VAR,
DataType.DOUBLE, (String)null);
timeVar.addAttribute(
new Attribute(CDM.UNITS, "seconds since 1970-01-01 00:00:00"));
timeVar.addAttribute(new Attribute("long_name", TIME_VAR));
ncfile.addDimension(null, DIM_LEN8);
ncfile.addDimension(null, DIM_LEN4);
ncfile.addDimension(null, DIM_LEN2);
List<Variable> stationVars = makeStationVars(stations, null);
List<GempakParameter> params =
gemreader.getParameters(GempakSurfaceFileReader.SFDT);
if (params == null) {
return;
// depends on control dependency: [if], data = [none]
}
Structure sVar = new Structure(ncfile, null, null, "Obs");
sVar.setDimensions(records);
// loop through and add to ncfile
boolean hasElevation = false;
for (Variable stnVar : stationVars) {
if (stnVar.getShortName().equals("SELV")) {
hasElevation = true;
// depends on control dependency: [if], data = [none]
}
sVar.addMemberVariable(stnVar);
// depends on control dependency: [for], data = [stnVar]
}
sVar.addMemberVariable(timeVar);
for (GempakParameter param : params) {
Variable var = makeParamVariable(param, null);
sVar.addMemberVariable(var);
// depends on control dependency: [for], data = [none]
}
sVar.addMemberVariable(makeMissingVariable());
String coords = "Obs.time Obs.SLAT Obs.SLON";
if (hasElevation) {
coords = coords + " Obs.SELV";
// depends on control dependency: [if], data = [none]
}
sVar.addAttribute(new Attribute(CF.COORDINATES, coords));
ncfile.addVariable(null, sVar);
ncfile.addAttribute(null,
new Attribute("CF:featureType",
CF.FeatureType.point.toString()));
} }
|
public class class_name {
public static Integer getIntegerProperty(Properties properties, String key) {
String property = getStringProperty(properties, key);
if (property == null) {
return null;
}
Integer value;
try {
value = Integer.parseInt(property);
} catch (RuntimeException e) {
throw new ODataClientRuntimeException("Unable to parse property. " + property, e);
}
return value;
} }
|
public class class_name {
public static Integer getIntegerProperty(Properties properties, String key) {
String property = getStringProperty(properties, key);
if (property == null) {
return null; // depends on control dependency: [if], data = [none]
}
Integer value;
try {
value = Integer.parseInt(property); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw new ODataClientRuntimeException("Unable to parse property. " + property, e);
} // depends on control dependency: [catch], data = [none]
return value;
} }
|
public class class_name {
public Observable<ServiceResponse<List<Image>>> getImagesByIdsWithServiceResponseAsync(UUID projectId, List<String> imageIds, UUID iterationId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(imageIds);
String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV);
return service.getImagesByIds(projectId, imageIdsConverted, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Image>>>>() {
@Override
public Observable<ServiceResponse<List<Image>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<Image>> clientResponse = getImagesByIdsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<List<Image>>> getImagesByIdsWithServiceResponseAsync(UUID projectId, List<String> imageIds, UUID iterationId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(imageIds);
String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV);
return service.getImagesByIds(projectId, imageIdsConverted, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Image>>>>() {
@Override
public Observable<ServiceResponse<List<Image>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<Image>> clientResponse = getImagesByIdsDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public void removeListener(IWebSocketDataListener listener, String path) {
log.trace("removeListener: {}", listener);
WebSocketScope scope = getScope(path);
if (scope != null) {
scope.removeListener(listener);
if (!scope.isValid()) {
// scope is not valid. delete this
removeWebSocketScope(scope);
}
} else {
log.info("Scope not found for path: {}", path);
}
} }
|
public class class_name {
public void removeListener(IWebSocketDataListener listener, String path) {
log.trace("removeListener: {}", listener);
WebSocketScope scope = getScope(path);
if (scope != null) {
scope.removeListener(listener); // depends on control dependency: [if], data = [none]
if (!scope.isValid()) {
// scope is not valid. delete this
removeWebSocketScope(scope); // depends on control dependency: [if], data = [none]
}
} else {
log.info("Scope not found for path: {}", path); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void sendRequestBody(WsByteBuffer[] body) throws IOException, MessageSentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "sendRequestBody(sync)");
}
if (isMessageSent()) {
throw new MessageSentException("Message already sent");
}
// if headers haven't been sent, set for partial body transfer
if (!headersSent()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Setting partial body true");
}
setPartialBody(true);
}
getLink().setAllowReconnect(true);
try {
sendOutgoing(body, getRequestImpl());
} catch (IOException e) {
// no FFDC necessary
reConnect(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "sendRequestBody(sync)");
}
} }
|
public class class_name {
@Override
public void sendRequestBody(WsByteBuffer[] body) throws IOException, MessageSentException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "sendRequestBody(sync)");
}
if (isMessageSent()) {
throw new MessageSentException("Message already sent");
}
// if headers haven't been sent, set for partial body transfer
if (!headersSent()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Setting partial body true"); // depends on control dependency: [if], data = [none]
}
setPartialBody(true);
}
getLink().setAllowReconnect(true);
try {
sendOutgoing(body, getRequestImpl());
} catch (IOException e) {
// no FFDC necessary
reConnect(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "sendRequestBody(sync)");
}
} }
|
public class class_name {
private void SetResultsFromScript(InteractiveObject interactiveObjectFinal, Bindings localBindings) {
// A SCRIPT can have mutliple defined objects, so we don't use getDefinedItem()
// instead we go through the field values
try {
ScriptObject scriptObject = interactiveObjectFinal.getScriptObject();
for (ScriptObject.Field fieldNode : scriptObject.getFieldsArrayList()) {
if ((scriptObject.getFieldAccessType(fieldNode) == ScriptObject.AccessType.OUTPUT_ONLY) ||
(scriptObject.getFieldAccessType(fieldNode) == ScriptObject.AccessType.INPUT_OUTPUT)) {
String fieldType = scriptObject.getFieldType(fieldNode);
DefinedItem scriptObjectToDefinedItem = scriptObject.getToDefinedItem(fieldNode);
EventUtility scriptObjectToEventUtility = scriptObject.getToEventUtility(fieldNode);
Object returnedJavaScriptValue = localBindings.get(scriptObject.getFieldName(fieldNode));
// Script fields contain all the values that can be returned from a JavaScript function.
// However, not all JavaScript functions set returned-values, and thus left null. For
// example the initialize() method may not set some Script field values, so don't
// process those and thus check if returnedJavaScriptValue != null
if ((returnedJavaScriptValue != null) && ( !(returnedJavaScriptValue instanceof V8Object) )) {
if (fieldType.equalsIgnoreCase("SFBool")) {
SFBool sfBool = (SFBool) returnedJavaScriptValue;
if ( scriptObjectToDefinedItem != null) {
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
GVRComponent gvrComponent = scriptObjectToDefinedItem.getGVRSceneObject().getComponent(
GVRLight.getComponentType());
if (gvrComponent != null) {
gvrComponent.setEnable(sfBool.getValue());
}
} // end if the SceneObject has a light component attached
} // end scriptObjectToDefinedItem != null
else if ( scriptObjectToEventUtility != null) {
scriptObjectToEventUtility.setToggle(sfBool.getValue());
}
else if ( scriptObject.getToTimeSensor(fieldNode) != null) {
TimeSensor timeSensor = scriptObject.getToTimeSensor(fieldNode);
if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "loop") ) {
timeSensor.setLoop( sfBool.getValue(), gvrContext );
}
if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "enabled") ) {
timeSensor.setEnabled( sfBool.getValue(), gvrContext );
}
}
else {
Log.e(TAG, "Error: Not setting SFBool '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFBool
else if (fieldType.equalsIgnoreCase("SFFloat")) {
SFFloat sfFloat = (SFFloat) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
GVRMaterial gvrMaterial= scriptObjectToDefinedItem.getGVRMaterial();
// shininess and transparency are part of X3D Material node
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "shininess") ) {
gvrMaterial.setSpecularExponent(sfFloat.getValue());
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "transparency") ) {
gvrMaterial.setOpacity(sfFloat.getValue());
}
else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "rotation") ) {
// rotationn is part of TextureTransform node
scriptObjectToDefinedItem.setTextureRotation( sfFloat.getValue() );
Matrix3f textureTransform = SetTextureTransformMatrix(
scriptObjectToDefinedItem.getTextureTranslation(),
scriptObjectToDefinedItem.getTextureCenter(),
scriptObjectToDefinedItem.getTextureScale(),
scriptObjectToDefinedItem.getTextureRotation());
float[] texMtx = new float[9];
textureTransform.get(texMtx);
gvrMaterial.setFloatArray("texture_matrix", texMtx);
}
else {
Log.e(TAG, "Error: Not setting SFFloat to Material '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} else if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
GVRComponent gvrComponent = scriptObjectToDefinedItem.getGVRSceneObject().getComponent(
GVRLight.getComponentType());
if (gvrComponent != null) {
if (gvrComponent instanceof GVRSpotLight) {
GVRSpotLight gvrSpotLightBase = (GVRSpotLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "beamWidth") ) {
gvrSpotLightBase.setInnerConeAngle(sfFloat.getValue() * 180 / (float) Math.PI);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "cutOffAngle") ) {
gvrSpotLightBase.setOuterConeAngle(sfFloat.getValue() * 180 / (float) Math.PI);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "intensity") ) {
//TODO: we aren't changing intensity since this would be multiplied by color
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "radius") ) {
//TODO: radius is not currently supported in GearVR for the spot light
}
} else if (gvrComponent instanceof GVRPointLight) {
GVRPointLight gvrPointLightBase = (GVRPointLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "intensity") ) {
//TODO: we aren't changing intensity since this would be multiplied by color
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "radius") ) {
//TODO: radius is not currently supported in GearVR for the point light
}
} else if (gvrComponent instanceof GVRDirectLight) {
GVRDirectLight gvrDirectLightBase = (GVRDirectLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "intensity") ) {
//TODO: we aren't changing intensity since GVR multiplies this by color
}
}
} // end presumed to be a light
} // end GVRScriptObject ! null
else if ( scriptObjectToDefinedItem.getGVRVideoSceneObject() != null) {
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "speed") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "pitch") ) {
GVRVideoSceneObjectPlayer gvrVideoSceneObjectPlayer = scriptObjectToDefinedItem.getGVRVideoSceneObject().getMediaPlayer();
ExoPlayer exoPlayer = (ExoPlayer) gvrVideoSceneObjectPlayer.getPlayer();
PlaybackParameters currPlaybackParamters = exoPlayer.getPlaybackParameters();
PlaybackParameters playbackParamters = new PlaybackParameters(sfFloat.getValue(), sfFloat.getValue());
exoPlayer.setPlaybackParameters(playbackParamters);
}
}
else {
Log.e(TAG, "Error: Not setting SFFloat '" + scriptObject.getToDefinedItemField(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFFloat
else if (fieldType.equalsIgnoreCase("SFTime")) {
SFTime sfTime = (SFTime) returnedJavaScriptValue;
if ( scriptObject.getToTimeSensor(fieldNode) != null) {
TimeSensor timeSensor = scriptObject.getToTimeSensor(fieldNode);
if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "startTime") ) {
timeSensor.startTime = (float)sfTime.getValue();
}
else if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "stopTime") ) {
timeSensor.stopTime = (float)sfTime.getValue();
}
else if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "cycleInterval") ) {
timeSensor.setCycleInterval( (float)sfTime.getValue() );
}
else Log.e(TAG, "Error: Not setting " + (float)sfTime.getValue() + " to SFTime '" +
scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
else if ( scriptObject.getToDefinedItemField( fieldNode ) != null) {
DefinedItem definedItem = scriptObject.getToDefinedItem(fieldNode);
if ( definedItem.getGVRVideoSceneObject() != null ) {
GVRVideoSceneObjectPlayer gvrVideoSceneObjectPlayer = scriptObjectToDefinedItem.getGVRVideoSceneObject().getMediaPlayer();
ExoPlayer exoPlayer = (ExoPlayer) gvrVideoSceneObjectPlayer.getPlayer();
if (StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "startTime")) {
exoPlayer.seekTo( (long)sfTime.getValue() );
}
else Log.e(TAG, "Error: MovieTexture " + scriptObject.getToDefinedItemField(fieldNode) + " in " +
scriptObject.getName() + " script not supported." );
}
else Log.e(TAG, "Error: Not setting " + (float)sfTime.getValue() + " to SFTime. " +
"MovieTexture node may not be defined to connect from SCRIPT '" + scriptObject.getName() + "'." );
}
else Log.e(TAG, "Error: Not setting SFTime '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
} // end SFTime
else if (fieldType.equalsIgnoreCase("SFColor")) {
SFColor sfColor = (SFColor) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
// SFColor change to a GVRMaterial
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "diffuseColor") ) {
scriptObjectToDefinedItem.getGVRMaterial().setVec4("diffuse_color", sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1.0f);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "specularColor") ) {
scriptObjectToDefinedItem.getGVRMaterial().setVec4("specular_color", sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1.0f);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "emissiveColor") ) {
scriptObjectToDefinedItem.getGVRMaterial().setVec4("emissive_color", sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1.0f);
}
} // end SFColor change to a GVRMaterial
else if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// GVRSceneObject
GVRSceneObject gvrSceneObject = scriptObjectToDefinedItem.getGVRSceneObject();
GVRComponent gvrComponent = gvrSceneObject.getComponent(GVRLight.getComponentType());
if (gvrComponent != null) {
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "color") ) {
// SFColor change to a GVRSceneObject (likely a Light Component)
if (gvrComponent instanceof GVRSpotLight) {
GVRSpotLight gvrSpotLightBase = (GVRSpotLight) gvrComponent;
gvrSpotLightBase.setDiffuseIntensity(sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1);
} else if (gvrComponent instanceof GVRPointLight) {
GVRPointLight gvrPointLightBase = (GVRPointLight) gvrComponent;
gvrPointLightBase.setDiffuseIntensity(sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1);
} else if (gvrComponent instanceof GVRDirectLight) {
GVRDirectLight gvrDirectLightBase = (GVRDirectLight) gvrComponent;
gvrDirectLightBase.setDiffuseIntensity(sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1);
}
}
}
} // SFColor change to a GVRSceneObject (likely a Light)
else {
Log.e(TAG, "Error: Not setting SFColor '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFColor (to a light or Material)
else if (fieldType.equalsIgnoreCase("SFVec3f")) {
SFVec3f sfVec3f = (SFVec3f) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// SFVec3f change to a GVRSceneObject
GVRSceneObject gvrSceneObject = scriptObjectToDefinedItem.getGVRSceneObject();
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "translation") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "location") ) {
// location applies to point light and spot light
GVRSceneObject gvrSceneObjectTranslation = root
.getSceneObjectByName((scriptObjectToDefinedItem.getGVRSceneObject().getName() + x3dObject.TRANSFORM_TRANSLATION_));
if (gvrSceneObjectTranslation != null)
gvrSceneObjectTranslation.getTransform().setPosition(sfVec3f.x, sfVec3f.y, sfVec3f.z);
else
gvrSceneObject.getTransform().setPosition(sfVec3f.x, sfVec3f.y, sfVec3f.z);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "scale") ) {
GVRSceneObject gvrSceneObjectScale = root
.getSceneObjectByName((scriptObjectToDefinedItem.getGVRSceneObject().getName() + x3dObject.TRANSFORM_SCALE_));
if (gvrSceneObjectScale != null)
gvrSceneObjectScale.getTransform().setScale(sfVec3f.x, sfVec3f.y, sfVec3f.z);
else
gvrSceneObject.getTransform().setScale(sfVec3f.x, sfVec3f.y, sfVec3f.z);
} else {
// could be parameters for a light
GVRComponent gvrComponent = gvrSceneObject.getComponent(
GVRLight.getComponentType());
if (gvrComponent != null) {
if (gvrComponent instanceof GVRSpotLight) {
GVRSpotLight gvrSpotLightBase = (GVRSpotLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "attenuation") ) {
gvrSpotLightBase.setAttenuation(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ());
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "direction") ) {
scriptObjectToDefinedItem.setDirection(sfVec3f.x, sfVec3f.y, sfVec3f.z);
Vector3f v3 = new Vector3f(sfVec3f).normalize();
Quaternionf q = ConvertDirectionalVectorToQuaternion(v3);
gvrSpotLightBase.getTransform().setRotation(q.w, q.x, q.y, q.z);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "location") ) {
gvrSpotLightBase.getTransform().setPosition(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ());
}
} else if (gvrComponent instanceof GVRPointLight) {
GVRPointLight gvrPointLightBase = (GVRPointLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "attenuation") ) {
gvrPointLightBase.setAttenuation(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ());
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "location") ) {
gvrPointLightBase.getTransform().setPosition(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ());
}
} else if (gvrComponent instanceof GVRDirectLight) {
GVRDirectLight gvrDirectLightBase = (GVRDirectLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "direction") ) {
scriptObjectToDefinedItem.setDirection(sfVec3f.x, sfVec3f.y, sfVec3f.z);
Vector3f v3 = new Vector3f(sfVec3f).normalize();
Quaternionf q = ConvertDirectionalVectorToQuaternion(v3);
gvrDirectLightBase.getTransform().setRotation(q.w, q.x, q.y, q.z);
}
}
}
} // end it could be a light
} // end GVRSceneObject with SFVec3f
else {
Log.e(TAG, "Error: Not setting SFVec3f '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFVec3f
else if (fieldType.equalsIgnoreCase("SFVec2f")) {
SFVec2f sfVec2f = (SFVec2f) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
// SFVec2f change to a Texture Transform
GVRMaterial gvrMaterial= scriptObjectToDefinedItem.getGVRMaterial();
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "translation") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "scale") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "center") ) {
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "translation") )
scriptObjectToDefinedItem.setTextureTranslation(sfVec2f.getX(), -sfVec2f.getY());
else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "scale") )
scriptObjectToDefinedItem.setTextureScale( sfVec2f.getX(), sfVec2f.getY() );
else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "center") )
scriptObjectToDefinedItem.setTextureCenter( -sfVec2f.getX(), sfVec2f.getY());
Matrix3f textureTransform = SetTextureTransformMatrix(
scriptObjectToDefinedItem.getTextureTranslation(),
scriptObjectToDefinedItem.getTextureCenter(),
scriptObjectToDefinedItem.getTextureScale(),
scriptObjectToDefinedItem.getTextureRotation());
float[] texMtx = new float[9];
textureTransform.get(texMtx);
gvrMaterial.setFloatArray("texture_matrix", texMtx);
}
else {
Log.e(TAG, "Error: Not setting SFVec2f '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
}
else {
Log.e(TAG, "Error: Not setting SFVec2f '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFVec2f
else if (fieldType.equalsIgnoreCase("SFRotation")) {
SFRotation sfRotation = (SFRotation) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// SFRotation change to a GVRSceneObject
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "rotation") ) {
scriptObjectToDefinedItem.setAxisAngle(sfRotation.angle, sfRotation.x, sfRotation.y, sfRotation.z);
GVRSceneObject gvrSceneObjectRotation = root
.getSceneObjectByName((scriptObjectToDefinedItem.getGVRSceneObject().getName() + x3dObject.TRANSFORM_ROTATION_));
float angleDegrees = (float) Math.toDegrees(sfRotation.angle); // convert radians to degrees
if (gvrSceneObjectRotation != null) {
gvrSceneObjectRotation.getTransform().setRotationByAxis(angleDegrees, sfRotation.x, sfRotation.y, sfRotation.z);
} else {
scriptObjectToDefinedItem.getGVRSceneObject().getTransform().setRotationByAxis(sfRotation.angle, sfRotation.x, sfRotation.y, sfRotation.z);
}
} // definedItem != null
} // end GVRSceneObject with SFRotation
else {
Log.e(TAG, "Error: Not setting SFRotation '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFRotation
else if (fieldType.equalsIgnoreCase("SFInt32")) {
try {
SFInt32 sfInt32 = new SFInt32(new Integer(returnedJavaScriptValue.toString()).intValue() );
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// Check if the field is 'whichChoice', meaning it's a Switch node
if ( StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "whichChoice") ) {
GVRSceneObject gvrSwitchSceneObject = scriptObject.getToDefinedItem(fieldNode).getGVRSceneObject();
GVRComponent gvrComponent = gvrSwitchSceneObject.getComponent(GVRSwitch.getComponentType());
if (gvrComponent instanceof GVRSwitch) {
// Set the value inside the Switch node
GVRSwitch gvrSwitch = (GVRSwitch) gvrComponent;
// Check if we are to switch to a value out of range (i.e. no mesh exists)
// and thus set to not show any object.
if ( (gvrSwitchSceneObject.getChildrenCount() <= sfInt32.getValue()) ||
(sfInt32.getValue() < 0) ) {
sfInt32.setValue( gvrSwitchSceneObject.getChildrenCount() );
}
gvrSwitch.setSwitchIndex( sfInt32.getValue() );
}
}
} // end GVRSceneObject with SFInt32
else {
Log.e(TAG, "Error: Not setting SFInt32 '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'.");
}
}
catch (Exception e) {
Log.e(TAG, "Error: Not setting SFInt32 '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT " + scriptObject.getName() + "'.");
Log.e(TAG, "Exception: " + e);
}
} // end SFInt32
else if (fieldType.equalsIgnoreCase("SFString")) {
SFString sfString = (SFString) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRTextViewSceneObject() != null) {
GVRTextViewSceneObject gvrTextViewSceneObject = scriptObjectToDefinedItem.getGVRTextViewSceneObject();
if (scriptObject.getToDefinedItemField(fieldNode).endsWith("style")) {
String value = sfString.getValue().toUpperCase();
GVRTextViewSceneObject.fontStyleTypes fontStyle = null;
if ( value.equals("BOLD")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.BOLD;
else if ( value.equals("ITALIC")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.ITALIC;
else if ( value.equals("BOLDITALIC")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.BOLDITALIC;
else if ( value.equals("PLAIN")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.PLAIN;
if ( fontStyle != null ) {
gvrTextViewSceneObject.setTypeface(gvrContext,
gvrTextViewSceneObject.getFontFamily(), fontStyle);
}
else {
Log.e(TAG, "Error: " + value + " + not recognized X3D FontStyle style in SCRIPT '" + scriptObject.getName() + "'." );
}
}
else Log.e(TAG, "Error: Setting not SFString value'" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
else {
Log.e(TAG, "Error: Not setting SFString '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end SFString
else if (fieldType.equalsIgnoreCase("MFString")) {
MFString mfString = (MFString) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRTexture() != null) {
GVRTexture gvrTexture = scriptObjectToDefinedItem.getGVRTexture();
// MFString change to a GVRTexture object
if (StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "url")) {
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
// We have the GVRMaterial that contains a GVRTexture
if (!gvrTexture.getImage().getFileName().equals(mfString.get1Value(0))) {
// Only loadTexture if it is different than the current
GVRAssetLoader.TextureRequest request = new GVRAssetLoader.TextureRequest(assetRequest,
gvrTexture, mfString.get1Value(0));
assetRequest.loadTexture(request);
}
} // end having GVRMaterial containing GVRTexture
else {
Log.e(TAG, "Error: No GVRMaterial associated with MFString Texture url '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'.");
}
} // definedItem != null
else {
Log.e(TAG, "Error: No url associated with MFString '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'.");
}
} // end GVRTexture != null
else if (scriptObjectToDefinedItem.getGVRVideoSceneObject() != null) {
// MFString change to a GVRVideoSceneObject object
if (StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "url")) {
try {
GVRVideoSceneObjectPlayer gvrVideoSceneObjectPlayer = scriptObjectToDefinedItem.getGVRVideoSceneObject().getMediaPlayer();
ExoPlayer exoPlayer = (ExoPlayer) gvrVideoSceneObjectPlayer.getPlayer();
exoPlayer.stop();
final DataSource.Factory dataSourceFactory = new DataSource.Factory() {
@Override
public DataSource createDataSource() {
return new AssetDataSource(gvrContext.getContext());
}
};
final MediaSource mediaSource = new ExtractorMediaSource(Uri.parse("asset:///" + mfString.get1Value(0)),
dataSourceFactory,
new DefaultExtractorsFactory(), null, null);
exoPlayer.prepare(mediaSource);
Log.e(TAG, "Load movie " + mfString.get1Value(0) + ".");
gvrVideoSceneObjectPlayer.start();
} catch (Exception e) {
Log.e(TAG, "X3D MovieTexture Asset " + mfString.get1Value(0) + " not loaded." + e);
e.printStackTrace();
}
} // end definedItem != null, contains url
else {
Log.e(TAG, "Error: No MovieTexure url associated with MFString '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end GVRVideoSceneObject != null
if (scriptObjectToDefinedItem.getGVRTextViewSceneObject() != null) {
GVRTextViewSceneObject gvrTextViewSceneObject = scriptObjectToDefinedItem.getGVRTextViewSceneObject();
if (scriptObject.getToDefinedItemField(fieldNode).equalsIgnoreCase("string")) {
gvrTextViewSceneObject.setText(mfString.get1Value(0));
}
else Log.e(TAG, "Error: Setting not MFString string '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end MFString
else {
Log.e(TAG, "Error: " + fieldType + " in '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "' not supported." );
}
} // end value != null
else {
Log.e(TAG, "Warning: " + fieldType + " '" + scriptObject.getFieldName(fieldNode) + "' from SCRIPT '" + scriptObject.getName() + "' may not be set.");
}
} // end OUTPUT-ONLY or INPUT_OUTPUT
} // end for-loop list of fields for a single script
} catch (Exception e) {
Log.e(TAG, "Error setting values returned from JavaScript in SCRIPT '" +
interactiveObjectFinal.getScriptObject().getName() +
"'. Check JavaScript or ROUTE's. Exception: " + e);
}
} }
|
public class class_name {
private void SetResultsFromScript(InteractiveObject interactiveObjectFinal, Bindings localBindings) {
// A SCRIPT can have mutliple defined objects, so we don't use getDefinedItem()
// instead we go through the field values
try {
ScriptObject scriptObject = interactiveObjectFinal.getScriptObject();
for (ScriptObject.Field fieldNode : scriptObject.getFieldsArrayList()) {
if ((scriptObject.getFieldAccessType(fieldNode) == ScriptObject.AccessType.OUTPUT_ONLY) ||
(scriptObject.getFieldAccessType(fieldNode) == ScriptObject.AccessType.INPUT_OUTPUT)) {
String fieldType = scriptObject.getFieldType(fieldNode);
DefinedItem scriptObjectToDefinedItem = scriptObject.getToDefinedItem(fieldNode);
EventUtility scriptObjectToEventUtility = scriptObject.getToEventUtility(fieldNode);
Object returnedJavaScriptValue = localBindings.get(scriptObject.getFieldName(fieldNode));
// Script fields contain all the values that can be returned from a JavaScript function.
// However, not all JavaScript functions set returned-values, and thus left null. For
// example the initialize() method may not set some Script field values, so don't
// process those and thus check if returnedJavaScriptValue != null
if ((returnedJavaScriptValue != null) && ( !(returnedJavaScriptValue instanceof V8Object) )) {
if (fieldType.equalsIgnoreCase("SFBool")) {
SFBool sfBool = (SFBool) returnedJavaScriptValue;
if ( scriptObjectToDefinedItem != null) {
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
GVRComponent gvrComponent = scriptObjectToDefinedItem.getGVRSceneObject().getComponent(
GVRLight.getComponentType());
if (gvrComponent != null) {
gvrComponent.setEnable(sfBool.getValue()); // depends on control dependency: [if], data = [none]
}
} // end if the SceneObject has a light component attached
} // end scriptObjectToDefinedItem != null
else if ( scriptObjectToEventUtility != null) {
scriptObjectToEventUtility.setToggle(sfBool.getValue()); // depends on control dependency: [if], data = [none]
}
else if ( scriptObject.getToTimeSensor(fieldNode) != null) {
TimeSensor timeSensor = scriptObject.getToTimeSensor(fieldNode);
if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "loop") ) {
timeSensor.setLoop( sfBool.getValue(), gvrContext ); // depends on control dependency: [if], data = [none]
}
if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "enabled") ) {
timeSensor.setEnabled( sfBool.getValue(), gvrContext ); // depends on control dependency: [if], data = [none]
}
}
else {
Log.e(TAG, "Error: Not setting SFBool '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFBool
else if (fieldType.equalsIgnoreCase("SFFloat")) {
SFFloat sfFloat = (SFFloat) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
GVRMaterial gvrMaterial= scriptObjectToDefinedItem.getGVRMaterial();
// shininess and transparency are part of X3D Material node
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "shininess") ) {
gvrMaterial.setSpecularExponent(sfFloat.getValue()); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "transparency") ) {
gvrMaterial.setOpacity(sfFloat.getValue()); // depends on control dependency: [if], data = [none]
}
else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "rotation") ) {
// rotationn is part of TextureTransform node
scriptObjectToDefinedItem.setTextureRotation( sfFloat.getValue() ); // depends on control dependency: [if], data = [none]
Matrix3f textureTransform = SetTextureTransformMatrix(
scriptObjectToDefinedItem.getTextureTranslation(),
scriptObjectToDefinedItem.getTextureCenter(),
scriptObjectToDefinedItem.getTextureScale(),
scriptObjectToDefinedItem.getTextureRotation());
float[] texMtx = new float[9];
textureTransform.get(texMtx); // depends on control dependency: [if], data = [none]
gvrMaterial.setFloatArray("texture_matrix", texMtx); // depends on control dependency: [if], data = [none]
}
else {
Log.e(TAG, "Error: Not setting SFFloat to Material '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} else if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
GVRComponent gvrComponent = scriptObjectToDefinedItem.getGVRSceneObject().getComponent(
GVRLight.getComponentType());
if (gvrComponent != null) {
if (gvrComponent instanceof GVRSpotLight) {
GVRSpotLight gvrSpotLightBase = (GVRSpotLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "beamWidth") ) {
gvrSpotLightBase.setInnerConeAngle(sfFloat.getValue() * 180 / (float) Math.PI); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "cutOffAngle") ) {
gvrSpotLightBase.setOuterConeAngle(sfFloat.getValue() * 180 / (float) Math.PI); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "intensity") ) {
//TODO: we aren't changing intensity since this would be multiplied by color
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "radius") ) {
//TODO: radius is not currently supported in GearVR for the spot light
}
} else if (gvrComponent instanceof GVRPointLight) {
GVRPointLight gvrPointLightBase = (GVRPointLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "intensity") ) {
//TODO: we aren't changing intensity since this would be multiplied by color
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "radius") ) {
//TODO: radius is not currently supported in GearVR for the point light
}
} else if (gvrComponent instanceof GVRDirectLight) {
GVRDirectLight gvrDirectLightBase = (GVRDirectLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "intensity") ) {
//TODO: we aren't changing intensity since GVR multiplies this by color
}
}
} // end presumed to be a light
} // end GVRScriptObject ! null
else if ( scriptObjectToDefinedItem.getGVRVideoSceneObject() != null) {
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "speed") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "pitch") ) {
GVRVideoSceneObjectPlayer gvrVideoSceneObjectPlayer = scriptObjectToDefinedItem.getGVRVideoSceneObject().getMediaPlayer();
ExoPlayer exoPlayer = (ExoPlayer) gvrVideoSceneObjectPlayer.getPlayer();
PlaybackParameters currPlaybackParamters = exoPlayer.getPlaybackParameters();
PlaybackParameters playbackParamters = new PlaybackParameters(sfFloat.getValue(), sfFloat.getValue());
exoPlayer.setPlaybackParameters(playbackParamters); // depends on control dependency: [if], data = [none]
}
}
else {
Log.e(TAG, "Error: Not setting SFFloat '" + scriptObject.getToDefinedItemField(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFFloat
else if (fieldType.equalsIgnoreCase("SFTime")) {
SFTime sfTime = (SFTime) returnedJavaScriptValue;
if ( scriptObject.getToTimeSensor(fieldNode) != null) {
TimeSensor timeSensor = scriptObject.getToTimeSensor(fieldNode);
if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "startTime") ) {
timeSensor.startTime = (float)sfTime.getValue(); // depends on control dependency: [if], data = [none]
}
else if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "stopTime") ) {
timeSensor.stopTime = (float)sfTime.getValue(); // depends on control dependency: [if], data = [none]
}
else if ( StringFieldMatch( scriptObject.getFieldName(fieldNode), "cycleInterval") ) {
timeSensor.setCycleInterval( (float)sfTime.getValue() ); // depends on control dependency: [if], data = [none]
}
else Log.e(TAG, "Error: Not setting " + (float)sfTime.getValue() + " to SFTime '" +
scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
else if ( scriptObject.getToDefinedItemField( fieldNode ) != null) {
DefinedItem definedItem = scriptObject.getToDefinedItem(fieldNode);
if ( definedItem.getGVRVideoSceneObject() != null ) {
GVRVideoSceneObjectPlayer gvrVideoSceneObjectPlayer = scriptObjectToDefinedItem.getGVRVideoSceneObject().getMediaPlayer();
ExoPlayer exoPlayer = (ExoPlayer) gvrVideoSceneObjectPlayer.getPlayer();
if (StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "startTime")) {
exoPlayer.seekTo( (long)sfTime.getValue() ); // depends on control dependency: [if], data = [none]
}
else Log.e(TAG, "Error: MovieTexture " + scriptObject.getToDefinedItemField(fieldNode) + " in " +
scriptObject.getName() + " script not supported." );
}
else Log.e(TAG, "Error: Not setting " + (float)sfTime.getValue() + " to SFTime. " +
"MovieTexture node may not be defined to connect from SCRIPT '" + scriptObject.getName() + "'." );
}
else Log.e(TAG, "Error: Not setting SFTime '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
} // end SFTime
else if (fieldType.equalsIgnoreCase("SFColor")) {
SFColor sfColor = (SFColor) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
// SFColor change to a GVRMaterial
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "diffuseColor") ) {
scriptObjectToDefinedItem.getGVRMaterial().setVec4("diffuse_color", sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1.0f); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "specularColor") ) {
scriptObjectToDefinedItem.getGVRMaterial().setVec4("specular_color", sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1.0f); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "emissiveColor") ) {
scriptObjectToDefinedItem.getGVRMaterial().setVec4("emissive_color", sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1.0f); // depends on control dependency: [if], data = [none]
}
} // end SFColor change to a GVRMaterial
else if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// GVRSceneObject
GVRSceneObject gvrSceneObject = scriptObjectToDefinedItem.getGVRSceneObject();
GVRComponent gvrComponent = gvrSceneObject.getComponent(GVRLight.getComponentType());
if (gvrComponent != null) {
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "color") ) {
// SFColor change to a GVRSceneObject (likely a Light Component)
if (gvrComponent instanceof GVRSpotLight) {
GVRSpotLight gvrSpotLightBase = (GVRSpotLight) gvrComponent;
gvrSpotLightBase.setDiffuseIntensity(sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1); // depends on control dependency: [if], data = [none]
} else if (gvrComponent instanceof GVRPointLight) {
GVRPointLight gvrPointLightBase = (GVRPointLight) gvrComponent;
gvrPointLightBase.setDiffuseIntensity(sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1); // depends on control dependency: [if], data = [none]
} else if (gvrComponent instanceof GVRDirectLight) {
GVRDirectLight gvrDirectLightBase = (GVRDirectLight) gvrComponent;
gvrDirectLightBase.setDiffuseIntensity(sfColor.getRed(), sfColor.getGreen(), sfColor.getBlue(), 1); // depends on control dependency: [if], data = [none]
}
}
}
} // SFColor change to a GVRSceneObject (likely a Light)
else {
Log.e(TAG, "Error: Not setting SFColor '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFColor (to a light or Material)
else if (fieldType.equalsIgnoreCase("SFVec3f")) {
SFVec3f sfVec3f = (SFVec3f) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// SFVec3f change to a GVRSceneObject
GVRSceneObject gvrSceneObject = scriptObjectToDefinedItem.getGVRSceneObject();
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "translation") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "location") ) {
// location applies to point light and spot light
GVRSceneObject gvrSceneObjectTranslation = root
.getSceneObjectByName((scriptObjectToDefinedItem.getGVRSceneObject().getName() + x3dObject.TRANSFORM_TRANSLATION_));
if (gvrSceneObjectTranslation != null)
gvrSceneObjectTranslation.getTransform().setPosition(sfVec3f.x, sfVec3f.y, sfVec3f.z);
else
gvrSceneObject.getTransform().setPosition(sfVec3f.x, sfVec3f.y, sfVec3f.z);
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "scale") ) {
GVRSceneObject gvrSceneObjectScale = root
.getSceneObjectByName((scriptObjectToDefinedItem.getGVRSceneObject().getName() + x3dObject.TRANSFORM_SCALE_));
if (gvrSceneObjectScale != null)
gvrSceneObjectScale.getTransform().setScale(sfVec3f.x, sfVec3f.y, sfVec3f.z);
else
gvrSceneObject.getTransform().setScale(sfVec3f.x, sfVec3f.y, sfVec3f.z);
} else {
// could be parameters for a light
GVRComponent gvrComponent = gvrSceneObject.getComponent(
GVRLight.getComponentType());
if (gvrComponent != null) {
if (gvrComponent instanceof GVRSpotLight) {
GVRSpotLight gvrSpotLightBase = (GVRSpotLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "attenuation") ) {
gvrSpotLightBase.setAttenuation(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ()); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "direction") ) {
scriptObjectToDefinedItem.setDirection(sfVec3f.x, sfVec3f.y, sfVec3f.z); // depends on control dependency: [if], data = [none]
Vector3f v3 = new Vector3f(sfVec3f).normalize();
Quaternionf q = ConvertDirectionalVectorToQuaternion(v3);
gvrSpotLightBase.getTransform().setRotation(q.w, q.x, q.y, q.z); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "location") ) {
gvrSpotLightBase.getTransform().setPosition(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ()); // depends on control dependency: [if], data = [none]
}
} else if (gvrComponent instanceof GVRPointLight) {
GVRPointLight gvrPointLightBase = (GVRPointLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "attenuation") ) {
gvrPointLightBase.setAttenuation(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ()); // depends on control dependency: [if], data = [none]
} else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "location") ) {
gvrPointLightBase.getTransform().setPosition(sfVec3f.getX(), sfVec3f.getY(), sfVec3f.getZ()); // depends on control dependency: [if], data = [none]
}
} else if (gvrComponent instanceof GVRDirectLight) {
GVRDirectLight gvrDirectLightBase = (GVRDirectLight) gvrComponent;
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "direction") ) {
scriptObjectToDefinedItem.setDirection(sfVec3f.x, sfVec3f.y, sfVec3f.z); // depends on control dependency: [if], data = [none]
Vector3f v3 = new Vector3f(sfVec3f).normalize();
Quaternionf q = ConvertDirectionalVectorToQuaternion(v3);
gvrDirectLightBase.getTransform().setRotation(q.w, q.x, q.y, q.z); // depends on control dependency: [if], data = [none]
}
}
}
} // end it could be a light
} // end GVRSceneObject with SFVec3f
else {
Log.e(TAG, "Error: Not setting SFVec3f '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFVec3f
else if (fieldType.equalsIgnoreCase("SFVec2f")) {
SFVec2f sfVec2f = (SFVec2f) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
// SFVec2f change to a Texture Transform
GVRMaterial gvrMaterial= scriptObjectToDefinedItem.getGVRMaterial();
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "translation") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "scale") ||
StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "center") ) {
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "translation") )
scriptObjectToDefinedItem.setTextureTranslation(sfVec2f.getX(), -sfVec2f.getY());
else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "scale") )
scriptObjectToDefinedItem.setTextureScale( sfVec2f.getX(), sfVec2f.getY() );
else if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "center") )
scriptObjectToDefinedItem.setTextureCenter( -sfVec2f.getX(), sfVec2f.getY());
Matrix3f textureTransform = SetTextureTransformMatrix(
scriptObjectToDefinedItem.getTextureTranslation(),
scriptObjectToDefinedItem.getTextureCenter(),
scriptObjectToDefinedItem.getTextureScale(),
scriptObjectToDefinedItem.getTextureRotation());
float[] texMtx = new float[9];
textureTransform.get(texMtx); // depends on control dependency: [if], data = [none]
gvrMaterial.setFloatArray("texture_matrix", texMtx); // depends on control dependency: [if], data = [none]
}
else {
Log.e(TAG, "Error: Not setting SFVec2f '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
}
else {
Log.e(TAG, "Error: Not setting SFVec2f '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFVec2f
else if (fieldType.equalsIgnoreCase("SFRotation")) {
SFRotation sfRotation = (SFRotation) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// SFRotation change to a GVRSceneObject
if ( StringFieldMatch( scriptObject.getToDefinedItemField(fieldNode), "rotation") ) {
scriptObjectToDefinedItem.setAxisAngle(sfRotation.angle, sfRotation.x, sfRotation.y, sfRotation.z); // depends on control dependency: [if], data = [none]
GVRSceneObject gvrSceneObjectRotation = root
.getSceneObjectByName((scriptObjectToDefinedItem.getGVRSceneObject().getName() + x3dObject.TRANSFORM_ROTATION_));
float angleDegrees = (float) Math.toDegrees(sfRotation.angle); // convert radians to degrees
if (gvrSceneObjectRotation != null) {
gvrSceneObjectRotation.getTransform().setRotationByAxis(angleDegrees, sfRotation.x, sfRotation.y, sfRotation.z); // depends on control dependency: [if], data = [none]
} else {
scriptObjectToDefinedItem.getGVRSceneObject().getTransform().setRotationByAxis(sfRotation.angle, sfRotation.x, sfRotation.y, sfRotation.z); // depends on control dependency: [if], data = [none]
}
} // definedItem != null
} // end GVRSceneObject with SFRotation
else {
Log.e(TAG, "Error: Not setting SFRotation '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFRotation
else if (fieldType.equalsIgnoreCase("SFInt32")) {
try {
SFInt32 sfInt32 = new SFInt32(new Integer(returnedJavaScriptValue.toString()).intValue() );
if (scriptObjectToDefinedItem.getGVRSceneObject() != null) {
// Check if the field is 'whichChoice', meaning it's a Switch node
if ( StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "whichChoice") ) {
GVRSceneObject gvrSwitchSceneObject = scriptObject.getToDefinedItem(fieldNode).getGVRSceneObject();
GVRComponent gvrComponent = gvrSwitchSceneObject.getComponent(GVRSwitch.getComponentType());
if (gvrComponent instanceof GVRSwitch) {
// Set the value inside the Switch node
GVRSwitch gvrSwitch = (GVRSwitch) gvrComponent;
// Check if we are to switch to a value out of range (i.e. no mesh exists)
// and thus set to not show any object.
if ( (gvrSwitchSceneObject.getChildrenCount() <= sfInt32.getValue()) ||
(sfInt32.getValue() < 0) ) {
sfInt32.setValue( gvrSwitchSceneObject.getChildrenCount() ); // depends on control dependency: [if], data = [none]
}
gvrSwitch.setSwitchIndex( sfInt32.getValue() ); // depends on control dependency: [if], data = [none]
}
}
} // end GVRSceneObject with SFInt32
else {
Log.e(TAG, "Error: Not setting SFInt32 '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'."); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
Log.e(TAG, "Error: Not setting SFInt32 '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT " + scriptObject.getName() + "'.");
Log.e(TAG, "Exception: " + e);
} // depends on control dependency: [catch], data = [none]
} // end SFInt32
else if (fieldType.equalsIgnoreCase("SFString")) {
SFString sfString = (SFString) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRTextViewSceneObject() != null) {
GVRTextViewSceneObject gvrTextViewSceneObject = scriptObjectToDefinedItem.getGVRTextViewSceneObject();
if (scriptObject.getToDefinedItemField(fieldNode).endsWith("style")) {
String value = sfString.getValue().toUpperCase();
GVRTextViewSceneObject.fontStyleTypes fontStyle = null;
if ( value.equals("BOLD")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.BOLD;
else if ( value.equals("ITALIC")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.ITALIC;
else if ( value.equals("BOLDITALIC")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.BOLDITALIC;
else if ( value.equals("PLAIN")) fontStyle = GVRTextViewSceneObject.fontStyleTypes.PLAIN;
if ( fontStyle != null ) {
gvrTextViewSceneObject.setTypeface(gvrContext,
gvrTextViewSceneObject.getFontFamily(), fontStyle); // depends on control dependency: [if], data = [none]
}
else {
Log.e(TAG, "Error: " + value + " + not recognized X3D FontStyle style in SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
}
else Log.e(TAG, "Error: Setting not SFString value'" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
else {
Log.e(TAG, "Error: Not setting SFString '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end SFString
else if (fieldType.equalsIgnoreCase("MFString")) {
MFString mfString = (MFString) returnedJavaScriptValue;
if (scriptObjectToDefinedItem.getGVRTexture() != null) {
GVRTexture gvrTexture = scriptObjectToDefinedItem.getGVRTexture();
// MFString change to a GVRTexture object
if (StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "url")) {
if (scriptObjectToDefinedItem.getGVRMaterial() != null) {
// We have the GVRMaterial that contains a GVRTexture
if (!gvrTexture.getImage().getFileName().equals(mfString.get1Value(0))) {
// Only loadTexture if it is different than the current
GVRAssetLoader.TextureRequest request = new GVRAssetLoader.TextureRequest(assetRequest,
gvrTexture, mfString.get1Value(0));
assetRequest.loadTexture(request); // depends on control dependency: [if], data = [none]
}
} // end having GVRMaterial containing GVRTexture
else {
Log.e(TAG, "Error: No GVRMaterial associated with MFString Texture url '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'."); // depends on control dependency: [if], data = [none]
}
} // definedItem != null
else {
Log.e(TAG, "Error: No url associated with MFString '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'."); // depends on control dependency: [if], data = [none]
}
} // end GVRTexture != null
else if (scriptObjectToDefinedItem.getGVRVideoSceneObject() != null) {
// MFString change to a GVRVideoSceneObject object
if (StringFieldMatch(scriptObject.getToDefinedItemField(fieldNode), "url")) {
try {
GVRVideoSceneObjectPlayer gvrVideoSceneObjectPlayer = scriptObjectToDefinedItem.getGVRVideoSceneObject().getMediaPlayer();
ExoPlayer exoPlayer = (ExoPlayer) gvrVideoSceneObjectPlayer.getPlayer();
exoPlayer.stop(); // depends on control dependency: [try], data = [none]
final DataSource.Factory dataSourceFactory = new DataSource.Factory() {
@Override
public DataSource createDataSource() {
return new AssetDataSource(gvrContext.getContext());
}
};
final MediaSource mediaSource = new ExtractorMediaSource(Uri.parse("asset:///" + mfString.get1Value(0)),
dataSourceFactory,
new DefaultExtractorsFactory(), null, null);
exoPlayer.prepare(mediaSource); // depends on control dependency: [try], data = [none]
Log.e(TAG, "Load movie " + mfString.get1Value(0) + "."); // depends on control dependency: [try], data = [none]
gvrVideoSceneObjectPlayer.start(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Log.e(TAG, "X3D MovieTexture Asset " + mfString.get1Value(0) + " not loaded." + e);
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} // end definedItem != null, contains url
else {
Log.e(TAG, "Error: No MovieTexure url associated with MFString '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." ); // depends on control dependency: [if], data = [none]
}
} // end GVRVideoSceneObject != null
if (scriptObjectToDefinedItem.getGVRTextViewSceneObject() != null) {
GVRTextViewSceneObject gvrTextViewSceneObject = scriptObjectToDefinedItem.getGVRTextViewSceneObject();
if (scriptObject.getToDefinedItemField(fieldNode).equalsIgnoreCase("string")) {
gvrTextViewSceneObject.setText(mfString.get1Value(0)); // depends on control dependency: [if], data = [none]
}
else Log.e(TAG, "Error: Setting not MFString string '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "'." );
}
} // end MFString
else {
Log.e(TAG, "Error: " + fieldType + " in '" + scriptObject.getFieldName(fieldNode) + "' value from SCRIPT '" + scriptObject.getName() + "' not supported." ); // depends on control dependency: [if], data = [none]
}
} // end value != null
else {
Log.e(TAG, "Warning: " + fieldType + " '" + scriptObject.getFieldName(fieldNode) + "' from SCRIPT '" + scriptObject.getName() + "' may not be set."); // depends on control dependency: [if], data = [none]
}
} // end OUTPUT-ONLY or INPUT_OUTPUT
} // end for-loop list of fields for a single script
} catch (Exception e) {
Log.e(TAG, "Error setting values returned from JavaScript in SCRIPT '" +
interactiveObjectFinal.getScriptObject().getName() +
"'. Check JavaScript or ROUTE's. Exception: " + e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Predicate withConditions(Condition... conditions) {
if (this.conditions == null) {
setConditions(new java.util.ArrayList<Condition>(conditions.length));
}
for (Condition ele : conditions) {
this.conditions.add(ele);
}
return this;
} }
|
public class class_name {
public Predicate withConditions(Condition... conditions) {
if (this.conditions == null) {
setConditions(new java.util.ArrayList<Condition>(conditions.length)); // depends on control dependency: [if], data = [none]
}
for (Condition ele : conditions) {
this.conditions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void close() {
// clean up collections
if (consumers != null) {
consumers.clear();
consumers = null;
}
if (providers != null) {
providers.clear();
providers = null;
}
if (listeners != null) {
listeners.clear();
listeners = null;
}
} }
|
public class class_name {
public void close() {
// clean up collections
if (consumers != null) {
consumers.clear(); // depends on control dependency: [if], data = [none]
consumers = null; // depends on control dependency: [if], data = [none]
}
if (providers != null) {
providers.clear(); // depends on control dependency: [if], data = [none]
providers = null; // depends on control dependency: [if], data = [none]
}
if (listeners != null) {
listeners.clear(); // depends on control dependency: [if], data = [none]
listeners = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
String getGeoLocation(String remoteAddr) {
try {
CityResponse city = this.reader.city(InetAddress.getByName(remoteAddr));
String cityName = city.getCity().getName();
String countryName = city.getCountry().getName();
if (cityName == null && countryName == null) {
return null;
}
else if (cityName == null) {
return countryName;
}
else if (countryName == null) {
return cityName;
}
return cityName + ", " + countryName;
}
catch (Exception ex) {
return UNKNOWN;
}
} }
|
public class class_name {
String getGeoLocation(String remoteAddr) {
try {
CityResponse city = this.reader.city(InetAddress.getByName(remoteAddr));
String cityName = city.getCity().getName();
String countryName = city.getCountry().getName();
if (cityName == null && countryName == null) {
return null; // depends on control dependency: [if], data = [none]
}
else if (cityName == null) {
return countryName; // depends on control dependency: [if], data = [none]
}
else if (countryName == null) {
return cityName; // depends on control dependency: [if], data = [none]
}
return cityName + ", " + countryName; // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
return UNKNOWN;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public boolean add(T e) {
if (elements.add(e)) {
ordered.add(e);
return true;
} else {
return false;
}
} }
|
public class class_name {
@Override
public boolean add(T e) {
if (elements.add(e)) {
ordered.add(e); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static DataSource getDataSource(Map<?, ?> config) {
String ignoreString = (String) config.remove(JdbcReaderFactoryParams.IGNORE);
boolean ignore = !"false".equals(ignoreString);
String dataSourceName = (String) config.remove(JdbcReaderFactoryParams.DATASOURCE);
DataSource dataSource = null;
if (dataSourceName != null) {
dataSource = jndiDataSource(fixJndiName(dataSourceName));
if (dataSource == null) {
log.error("Data source {} not found.", dataSourceName);
if (!ignore) {
throw new IllegalArgumentException("No data source found.");
}
}
} else {
log.error("No data source configured.");
if (!ignore) {
throw new IllegalArgumentException("No data source configured.");
}
}
return dataSource;
} }
|
public class class_name {
public static DataSource getDataSource(Map<?, ?> config) {
String ignoreString = (String) config.remove(JdbcReaderFactoryParams.IGNORE);
boolean ignore = !"false".equals(ignoreString);
String dataSourceName = (String) config.remove(JdbcReaderFactoryParams.DATASOURCE);
DataSource dataSource = null;
if (dataSourceName != null) {
dataSource = jndiDataSource(fixJndiName(dataSourceName)); // depends on control dependency: [if], data = [(dataSourceName]
if (dataSource == null) {
log.error("Data source {} not found.", dataSourceName); // depends on control dependency: [if], data = [none]
if (!ignore) {
throw new IllegalArgumentException("No data source found.");
}
}
} else {
log.error("No data source configured."); // depends on control dependency: [if], data = [none]
if (!ignore) {
throw new IllegalArgumentException("No data source configured.");
}
}
return dataSource;
} }
|
public class class_name {
public TColumn getColumnByIndex(int index) {
if (columns == null) {
return null;
}
TColumn result = null;
for (TColumn column : columns) {
if (column.getIndex() == index) {
result = column;
break;
}
}
return result;
} }
|
public class class_name {
public TColumn getColumnByIndex(int index) {
if (columns == null) {
return null; // depends on control dependency: [if], data = [none]
}
TColumn result = null;
for (TColumn column : columns) {
if (column.getIndex() == index) {
result = column; // depends on control dependency: [if], data = [none]
break;
}
}
return result;
} }
|
public class class_name {
ColumnRange removeColumn(int column) {
// first, let's see if this is a 1-column range that should
// be destroyed
if (isSingleCol()) {
return null;
} else if (column == left) {
left++;
return this;
} else if (column + 1 == right) {
right--;
return this;
} else {
ColumnRange created = new ColumnRange(this.element, this.locator,
column + 1, this.right);
created.next = this.next;
this.next = created;
this.right = column;
return created;
}
} }
|
public class class_name {
ColumnRange removeColumn(int column) {
// first, let's see if this is a 1-column range that should
// be destroyed
if (isSingleCol()) {
return null; // depends on control dependency: [if], data = [none]
} else if (column == left) {
left++; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
} else if (column + 1 == right) {
right--; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
} else {
ColumnRange created = new ColumnRange(this.element, this.locator,
column + 1, this.right);
created.next = this.next; // depends on control dependency: [if], data = [none]
this.next = created; // depends on control dependency: [if], data = [none]
this.right = column; // depends on control dependency: [if], data = [none]
return created; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean contains(final BinaryString substring) {
ensureMaterialized();
substring.ensureMaterialized();
if (substring.sizeInBytes == 0) {
return true;
}
int find = SegmentsUtil.find(
segments, offset, sizeInBytes,
substring.segments, substring.offset, substring.sizeInBytes);
return find != -1;
} }
|
public class class_name {
public boolean contains(final BinaryString substring) {
ensureMaterialized();
substring.ensureMaterialized();
if (substring.sizeInBytes == 0) {
return true; // depends on control dependency: [if], data = [none]
}
int find = SegmentsUtil.find(
segments, offset, sizeInBytes,
substring.segments, substring.offset, substring.sizeInBytes);
return find != -1;
} }
|
public class class_name {
@Pure
public static float floatValue(CharSequence value) {
try {
return Float.parseFloat(value.toString());
} catch (Throwable exception) {
// Silent exception.
}
return 0;
} }
|
public class class_name {
@Pure
public static float floatValue(CharSequence value) {
try {
return Float.parseFloat(value.toString()); // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
// Silent exception.
} // depends on control dependency: [catch], data = [none]
return 0;
} }
|
public class class_name {
public void convertIntoBundleStructure(List<Se3_F64> motions,
DMatrixRMaj K,
double[] distort,
List<CalibrationObservation> obs ) {
structure = new SceneStructureMetric(false);
observations = new SceneObservations(motions.size(),true);
structure.initialize(1,motions.size(),layout.size(),1);
// A single camera is assumed, that's what is being calibrated!
structure.setCamera(0,false,cameraGenerator.initalizeCamera(K,distort));
// A single rigid planar target is being viewed. It is assumed to be centered at the origin
structure.setRigid(0,true,new Se3_F64(),layout.size());
// Where the points are on the calibration target
SceneStructureMetric.Rigid rigid = structure.rigids[0];
for (int i = 0; i < layout.size(); i++) {
rigid.setPoint(i,layout.get(i).x,layout.get(i).y,0);
}
// Add the initial estimate of each view's location and the points observed
for (int viewIdx = 0; viewIdx < motions.size(); viewIdx++) {
structure.setView(viewIdx,false,motions.get(viewIdx));
SceneObservations.View v = observations.getViewRigid(viewIdx);
structure.connectViewToCamera(viewIdx,0);
CalibrationObservation ca = obs.get(viewIdx);
for (int j = 0; j < ca.size(); j++) {
PointIndex2D_F64 p = ca.get(j);
v.add(p.index, (float)p.x, (float)p.y);
structure.connectPointToView(p.index,viewIdx);
}
}
} }
|
public class class_name {
public void convertIntoBundleStructure(List<Se3_F64> motions,
DMatrixRMaj K,
double[] distort,
List<CalibrationObservation> obs ) {
structure = new SceneStructureMetric(false);
observations = new SceneObservations(motions.size(),true);
structure.initialize(1,motions.size(),layout.size(),1);
// A single camera is assumed, that's what is being calibrated!
structure.setCamera(0,false,cameraGenerator.initalizeCamera(K,distort));
// A single rigid planar target is being viewed. It is assumed to be centered at the origin
structure.setRigid(0,true,new Se3_F64(),layout.size());
// Where the points are on the calibration target
SceneStructureMetric.Rigid rigid = structure.rigids[0];
for (int i = 0; i < layout.size(); i++) {
rigid.setPoint(i,layout.get(i).x,layout.get(i).y,0); // depends on control dependency: [for], data = [i]
}
// Add the initial estimate of each view's location and the points observed
for (int viewIdx = 0; viewIdx < motions.size(); viewIdx++) {
structure.setView(viewIdx,false,motions.get(viewIdx)); // depends on control dependency: [for], data = [viewIdx]
SceneObservations.View v = observations.getViewRigid(viewIdx);
structure.connectViewToCamera(viewIdx,0); // depends on control dependency: [for], data = [viewIdx]
CalibrationObservation ca = obs.get(viewIdx);
for (int j = 0; j < ca.size(); j++) {
PointIndex2D_F64 p = ca.get(j);
v.add(p.index, (float)p.x, (float)p.y); // depends on control dependency: [for], data = [none]
structure.connectPointToView(p.index,viewIdx); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public Method createObjectMethod(Object ownerClass, String methodName,
Class[] paramTypes) {
Method m = null;
try {
m = ownerClass.getClass().getMethod(methodName, paramTypes);
} catch (NoSuchMethodException nsme) {
String errS = " NoSuchMethod:" + methodName + " in className:"
+ ownerClass.getClass().getName() + " or method's args type error";
Debug.logError(errS, module);
} catch (Exception ex) {
Debug.logError("[JdonFramework] createMethod error:" + ex, module);
}
return m;
} }
|
public class class_name {
public Method createObjectMethod(Object ownerClass, String methodName,
Class[] paramTypes) {
Method m = null;
try {
m = ownerClass.getClass().getMethod(methodName, paramTypes);
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException nsme) {
String errS = " NoSuchMethod:" + methodName + " in className:"
+ ownerClass.getClass().getName() + " or method's args type error";
Debug.logError(errS, module);
} catch (Exception ex) {
// depends on control dependency: [catch], data = [none]
Debug.logError("[JdonFramework] createMethod error:" + ex, module);
}
// depends on control dependency: [catch], data = [none]
return m;
} }
|
public class class_name {
public List<String> readFromFile(final String filePath,
final int lineToStart, final int lineToEnd, final String encoding)
throws IOException {
if (lineToStart > lineToEnd) {
throw new IllegalArgumentException(
"Line to start must be lower than line to end");
}
LOG.info("Reading from file: " + filePath);
List<String> result = new ArrayList<String>();
BufferedReader reader = null;
int i = 0;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(filePath), encoding));
String line = reader.readLine();
while (line != null && i >= lineToStart && i <= lineToEnd) {
result.add(line);
i++;
line = reader.readLine();
}
} finally {
if (reader != null) {
reader.close();
}
}
LOG.info("Returning: " + result);
return result;
} }
|
public class class_name {
public List<String> readFromFile(final String filePath,
final int lineToStart, final int lineToEnd, final String encoding)
throws IOException {
if (lineToStart > lineToEnd) {
throw new IllegalArgumentException(
"Line to start must be lower than line to end");
}
LOG.info("Reading from file: " + filePath);
List<String> result = new ArrayList<String>();
BufferedReader reader = null;
int i = 0;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(filePath), encoding));
String line = reader.readLine();
while (line != null && i >= lineToStart && i <= lineToEnd) {
result.add(line); // depends on control dependency: [while], data = [(line]
i++; // depends on control dependency: [while], data = [none]
line = reader.readLine(); // depends on control dependency: [while], data = [none]
}
} finally {
if (reader != null) {
reader.close(); // depends on control dependency: [if], data = [none]
}
}
LOG.info("Returning: " + result);
return result;
} }
|
public class class_name {
private boolean isQueryBeanPackage(String domainPackage) {
for (int i = 0; i < packages.length; i++) {
if (domainPackage.startsWith(packages[i])) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean isQueryBeanPackage(String domainPackage) {
for (int i = 0; i < packages.length; i++) {
if (domainPackage.startsWith(packages[i])) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static int getDimension(INDArray arr, boolean defaultRows) {
// FIXME: int cast
//ignore ordering for vectors
if (arr.isVector()) {
return defaultRows ? (int) arr.rows() : (int) arr.columns();
}
if (arr.ordering() == NDArrayFactory.C)
return defaultRows ? (int) arr.columns() : (int) arr.rows();
return defaultRows ? (int) arr.rows() : (int) arr.columns();
} }
|
public class class_name {
public static int getDimension(INDArray arr, boolean defaultRows) {
// FIXME: int cast
//ignore ordering for vectors
if (arr.isVector()) {
return defaultRows ? (int) arr.rows() : (int) arr.columns(); // depends on control dependency: [if], data = [none]
}
if (arr.ordering() == NDArrayFactory.C)
return defaultRows ? (int) arr.columns() : (int) arr.rows();
return defaultRows ? (int) arr.rows() : (int) arr.columns();
} }
|
public class class_name {
@NullSafe
public static boolean close(Socket socket) {
if (socket != null) {
try {
socket.close();
return true;
}
catch (IOException ignore) {
}
}
return false;
} }
|
public class class_name {
@NullSafe
public static boolean close(Socket socket) {
if (socket != null) {
try {
socket.close(); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
}
catch (IOException ignore) {
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
public final void persistentRepresentationIsUnstable() throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "persistentRepresentationIsUnstable");
boolean notifyRequired = false;
synchronized (this)
{
// we are going to need the item in memory, so we make sure that
// we pin it with a hard reference
if (_strongReferenceToItem == NULL_STRONG_REF && null != _softReferenceToItem)
{
// Someone else may still have a reference to the item,
// so we can save some trouble by recovering the item
// from the weak reference. If the weak reference has been
// cleared then the item will still be null, and the calling
// code will just need to cope with it.
_strongReferenceToItem = (AbstractItem) _softReferenceToItem.get();
// Defect 601995
// Set the reference to the named class if still null
// after the call to the soft reference.
if (_strongReferenceToItem == null)
{
_strongReferenceToItem = NULL_STRONG_REF;
}
}
if (_persistentRepresentationIsStable)
{
// if we have become unstable, and we were releasable
// then we need to notify cache
notifyRequired = _itemIsDiscardableIfPersistentRepresentationStable;
_persistentRepresentationIsStable = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "stable=false available=" + _itemIsDiscardableIfPersistentRepresentationStable);
}
if (notifyRequired)
{
_declareNotReleasable();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "persistentRepresentationIsUnstable");
} }
|
public class class_name {
public final void persistentRepresentationIsUnstable() throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "persistentRepresentationIsUnstable");
boolean notifyRequired = false;
synchronized (this)
{
// we are going to need the item in memory, so we make sure that
// we pin it with a hard reference
if (_strongReferenceToItem == NULL_STRONG_REF && null != _softReferenceToItem)
{
// Someone else may still have a reference to the item,
// so we can save some trouble by recovering the item
// from the weak reference. If the weak reference has been
// cleared then the item will still be null, and the calling
// code will just need to cope with it.
_strongReferenceToItem = (AbstractItem) _softReferenceToItem.get(); // depends on control dependency: [if], data = [none]
// Defect 601995
// Set the reference to the named class if still null
// after the call to the soft reference.
if (_strongReferenceToItem == null)
{
_strongReferenceToItem = NULL_STRONG_REF; // depends on control dependency: [if], data = [none]
}
}
if (_persistentRepresentationIsStable)
{
// if we have become unstable, and we were releasable
// then we need to notify cache
notifyRequired = _itemIsDiscardableIfPersistentRepresentationStable; // depends on control dependency: [if], data = [none]
_persistentRepresentationIsStable = false; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "stable=false available=" + _itemIsDiscardableIfPersistentRepresentationStable);
}
if (notifyRequired)
{
_declareNotReleasable();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "persistentRepresentationIsUnstable");
} }
|
public class class_name {
public void setTrajectory(Trajectory traj) {
if (this.footprint == null) {
throw new NoFootprintException("No footprint set for " + this + ", please specify one before setting the trajecotry.");
}
else{
createOuterEnvelope(traj);
}
if(this.innerFootprint != null){
createInnerEnvelope(traj);
}
} }
|
public class class_name {
public void setTrajectory(Trajectory traj) {
if (this.footprint == null) {
throw new NoFootprintException("No footprint set for " + this + ", please specify one before setting the trajecotry.");
}
else{
createOuterEnvelope(traj); // depends on control dependency: [if], data = [none]
}
if(this.innerFootprint != null){
createInnerEnvelope(traj); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String getTypeName( Type type ) {
CheckArg.isNotNull(type, "type");
if (type.isPrimitiveType()) {
PrimitiveType primitiveType = (PrimitiveType)type;
return primitiveType.getPrimitiveTypeCode().toString();
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
return JavaMetadataUtil.getName(simpleType.getName());
}
if (type.isParameterizedType()) {
ParameterizedType parameterizedType = (ParameterizedType)type;
return getTypeName(parameterizedType.getType());
}
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
// the element type is never an array type
Type elementType = arrayType.getElementType();
if (elementType.isPrimitiveType()) {
return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();
}
// can't be an array type
if (elementType.isSimpleType()) {
return JavaMetadataUtil.getName(((SimpleType)elementType).getName());
}
}
return null;
} }
|
public class class_name {
private String getTypeName( Type type ) {
CheckArg.isNotNull(type, "type");
if (type.isPrimitiveType()) {
PrimitiveType primitiveType = (PrimitiveType)type;
return primitiveType.getPrimitiveTypeCode().toString(); // depends on control dependency: [if], data = [none]
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
return JavaMetadataUtil.getName(simpleType.getName()); // depends on control dependency: [if], data = [none]
}
if (type.isParameterizedType()) {
ParameterizedType parameterizedType = (ParameterizedType)type;
return getTypeName(parameterizedType.getType()); // depends on control dependency: [if], data = [none]
}
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
// the element type is never an array type
Type elementType = arrayType.getElementType();
if (elementType.isPrimitiveType()) {
return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString(); // depends on control dependency: [if], data = [none]
}
// can't be an array type
if (elementType.isSimpleType()) {
return JavaMetadataUtil.getName(((SimpleType)elementType).getName()); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static void initialise(@NonNull Application app, @NonNull ComapiConfig config, Callback<ComapiClient> callback) {
String error = checkIfCanInitialise(app, config, false);
if (!TextUtils.isEmpty(error) && callback != null) {
callback.error(new Exception(error));
}
ComapiClient client = new ComapiClient(config);
CallbackAdapter adapter = config.getCallbackAdapter() != null ? config.getCallbackAdapter() : new CallbackAdapter();
client.initialise(app, adapter, callback);
} }
|
public class class_name {
public static void initialise(@NonNull Application app, @NonNull ComapiConfig config, Callback<ComapiClient> callback) {
String error = checkIfCanInitialise(app, config, false);
if (!TextUtils.isEmpty(error) && callback != null) {
callback.error(new Exception(error)); // depends on control dependency: [if], data = [none]
}
ComapiClient client = new ComapiClient(config);
CallbackAdapter adapter = config.getCallbackAdapter() != null ? config.getCallbackAdapter() : new CallbackAdapter();
client.initialise(app, adapter, callback);
} }
|
public class class_name {
protected void validateConnections(ManagedConnectionFactory managedConnectionFactory, boolean prepopulateEnabled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "validateConnections", gConfigProps.cfName);
}
/*
* Get all of the managed connections wrappers.
*/
Set<ManagedConnection> mcSet = new HashSet<ManagedConnection>();
LinkedList<MCWrapper> failedMCWList = new LinkedList<MCWrapper>();
mcToMCWMapWrite.lock();
try {
Collection<MCWrapper> mcWrappers = mcToMCWMap.values();
Iterator<MCWrapper> mcWrapperIt = mcWrappers.iterator();
while (mcWrapperIt.hasNext()) {
MCWrapper mcw = mcWrapperIt.next();
if (mcw.getPoolState() == 1 && !mcw.isStale()) {
/*
* Only add valid managed connections to this set.
*/
mcSet.add(mcw.getManagedConnection());
mcw.setPoolState(50); // set the state to 50, which basically means we are interacting with the resource adapter
try {
Set<?> set = ((ValidatingManagedConnectionFactory) managedConnectionFactory).getInvalidConnections(mcSet);
Iterator<?> it = set.iterator();
while (it.hasNext()) {
it.next();
failedMCWList.add(mcw);
}
mcSet.clear();
} catch (ResourceException e) {
Object[] parms = new Object[] { "fatalErrorNotification", CommonFunction.exceptionList(e), "ResourceException", gConfigProps.cfName };
Tr.error(tc, "ATTEMPT_TO_VALIDATE_MC_CONNECTIONS_J2CA0285", parms);
} finally {
// we do a check above to ensure we are in the free pool (1), therefore we shouldn't have to worry
// about capturing the current state and setting it back here - it is expected to be the free pool.
mcw.setPoolState(MCWrapper.ConnectionState_freePool);
}
if (prepopulateEnabled) {
// We prepopulate is enabled, we need to reset
// the idle time out to keep the good connections
// in the pool. All of the bad connection will be
// destored before we leave this method. The idle
// time will not matter for them. :-)
((com.ibm.ejs.j2c.MCWrapper) mcw).resetIdleTimeOut();
}
}
}
} finally {
mcToMCWMapWrite.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Calling getInvalidConnections on the managedConnectionFactory with " + mcSet.size()
+ " managed connections");
}
/*
* Ask the mcf to validate the managed connections and return the
* failing managed connections
*/
if (!failedMCWList.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Returned from getInvalidConnections. There are " + failedMCWList.size() + " failing connections.");
}
/*
* Check for failing connections
*/
/*
* Transfer the failing connection to an iterator
*/
Iterator<MCWrapper> it = failedMCWList.iterator();
/*
* Iterate through the failed managed connection marking the
* associated mcw stale
*/
while (it.hasNext()) {
MCWrapper mcWrapper = it.next();
if (mcWrapper != null) {
mcWrapper.markStale();
checkForConnectionInFreePool(mcWrapper);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "null mc in set returned from getInvalidConnections");
}
}
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Returned from getInvalidConnections. The returned set is null");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "validateConnections");
}
} }
|
public class class_name {
protected void validateConnections(ManagedConnectionFactory managedConnectionFactory, boolean prepopulateEnabled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "validateConnections", gConfigProps.cfName); // depends on control dependency: [if], data = [none]
}
/*
* Get all of the managed connections wrappers.
*/
Set<ManagedConnection> mcSet = new HashSet<ManagedConnection>();
LinkedList<MCWrapper> failedMCWList = new LinkedList<MCWrapper>();
mcToMCWMapWrite.lock();
try {
Collection<MCWrapper> mcWrappers = mcToMCWMap.values();
Iterator<MCWrapper> mcWrapperIt = mcWrappers.iterator();
while (mcWrapperIt.hasNext()) {
MCWrapper mcw = mcWrapperIt.next();
if (mcw.getPoolState() == 1 && !mcw.isStale()) {
/*
* Only add valid managed connections to this set.
*/
mcSet.add(mcw.getManagedConnection()); // depends on control dependency: [if], data = [none]
mcw.setPoolState(50); // set the state to 50, which basically means we are interacting with the resource adapter // depends on control dependency: [if], data = [none]
try {
Set<?> set = ((ValidatingManagedConnectionFactory) managedConnectionFactory).getInvalidConnections(mcSet);
Iterator<?> it = set.iterator();
while (it.hasNext()) {
it.next(); // depends on control dependency: [while], data = [none]
failedMCWList.add(mcw); // depends on control dependency: [while], data = [none]
}
mcSet.clear(); // depends on control dependency: [try], data = [none]
} catch (ResourceException e) {
Object[] parms = new Object[] { "fatalErrorNotification", CommonFunction.exceptionList(e), "ResourceException", gConfigProps.cfName };
Tr.error(tc, "ATTEMPT_TO_VALIDATE_MC_CONNECTIONS_J2CA0285", parms);
} finally { // depends on control dependency: [catch], data = [none]
// we do a check above to ensure we are in the free pool (1), therefore we shouldn't have to worry
// about capturing the current state and setting it back here - it is expected to be the free pool.
mcw.setPoolState(MCWrapper.ConnectionState_freePool);
}
if (prepopulateEnabled) {
// We prepopulate is enabled, we need to reset
// the idle time out to keep the good connections
// in the pool. All of the bad connection will be
// destored before we leave this method. The idle
// time will not matter for them. :-)
((com.ibm.ejs.j2c.MCWrapper) mcw).resetIdleTimeOut(); // depends on control dependency: [if], data = [none]
}
}
}
} finally {
mcToMCWMapWrite.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Calling getInvalidConnections on the managedConnectionFactory with " + mcSet.size()
+ " managed connections"); // depends on control dependency: [if], data = [none]
}
/*
* Ask the mcf to validate the managed connections and return the
* failing managed connections
*/
if (!failedMCWList.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Returned from getInvalidConnections. There are " + failedMCWList.size() + " failing connections."); // depends on control dependency: [if], data = [none]
}
/*
* Check for failing connections
*/
/*
* Transfer the failing connection to an iterator
*/
Iterator<MCWrapper> it = failedMCWList.iterator();
/*
* Iterate through the failed managed connection marking the
* associated mcw stale
*/
while (it.hasNext()) {
MCWrapper mcWrapper = it.next();
if (mcWrapper != null) {
mcWrapper.markStale(); // depends on control dependency: [if], data = [none]
checkForConnectionInFreePool(mcWrapper); // depends on control dependency: [if], data = [(mcWrapper]
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "null mc in set returned from getInvalidConnections"); // depends on control dependency: [if], data = [none]
}
}
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Returned from getInvalidConnections. The returned set is null"); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "validateConnections"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean update(final V value, final long maxTime, final TimeUnit timeUnit) {
final K key = keyOf(value);
if (key != null) {
return collectionWithWriteTimeout(maxTime, timeUnit)
.replaceOne(byId(key), encode(value))
.getModifiedCount() == 1;
} else {
throw new IllegalArgumentException("Key must not be null");
}
} }
|
public class class_name {
public boolean update(final V value, final long maxTime, final TimeUnit timeUnit) {
final K key = keyOf(value);
if (key != null) {
return collectionWithWriteTimeout(maxTime, timeUnit)
.replaceOne(byId(key), encode(value))
.getModifiedCount() == 1; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Key must not be null");
}
} }
|
public class class_name {
@SuppressWarnings("UnusedParameters")
protected String[] createRequiredDatabasesMetaData(
String parameterName, DatabaseChangeProperty changePropertyAnnotation
) {
if (changePropertyAnnotation == null) {
return new String[]{ChangeParameterMetaData.COMPUTE};
} else {
return changePropertyAnnotation.requiredForDatabase();
}
} }
|
public class class_name {
@SuppressWarnings("UnusedParameters")
protected String[] createRequiredDatabasesMetaData(
String parameterName, DatabaseChangeProperty changePropertyAnnotation
) {
if (changePropertyAnnotation == null) {
return new String[]{ChangeParameterMetaData.COMPUTE}; // depends on control dependency: [if], data = [none]
} else {
return changePropertyAnnotation.requiredForDatabase(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static boolean isValidJson (@Nonnull @WillClose final InputStream aIS, @Nonnull final Charset aFallbackCharset)
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
try
{
final Reader aReader = CharsetHelper.getReaderByBOM (aIS, aFallbackCharset);
return isValidJson (aReader);
}
finally
{
StreamHelper.close (aIS);
}
} }
|
public class class_name {
public static boolean isValidJson (@Nonnull @WillClose final InputStream aIS, @Nonnull final Charset aFallbackCharset)
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset");
try
{
final Reader aReader = CharsetHelper.getReaderByBOM (aIS, aFallbackCharset);
return isValidJson (aReader); // depends on control dependency: [try], data = [none]
}
finally
{
StreamHelper.close (aIS);
}
} }
|
public class class_name {
public static boolean isAvailable(Context context) {
boolean connected = false;
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
NetworkInfo ni = cm.getActiveNetworkInfo();
if (ni != null) {
connected = ni.isConnected();
}
}
return connected;
} }
|
public class class_name {
public static boolean isAvailable(Context context) {
boolean connected = false;
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
NetworkInfo ni = cm.getActiveNetworkInfo();
if (ni != null) {
connected = ni.isConnected(); // depends on control dependency: [if], data = [none]
}
}
return connected;
} }
|
public class class_name {
@Pure
public static String getPreferredAttributeNameForRoadWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_WIDTH_ATTR_NAME", DEFAULT_ATTR_ROAD_WIDTH); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_WIDTH;
} }
|
public class class_name {
@Pure
public static String getPreferredAttributeNameForRoadWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_WIDTH_ATTR_NAME", DEFAULT_ATTR_ROAD_WIDTH); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
return DEFAULT_ATTR_ROAD_WIDTH;
} }
|
public class class_name {
protected Annotation parseAnnotationTypeDoc(AnnotationTypeDoc annotationTypeDoc) {
Annotation annotationNode = objectFactory.createAnnotation();
annotationNode.setName(annotationTypeDoc.name());
annotationNode.setQualified(annotationTypeDoc.qualifiedName());
String comment = annotationTypeDoc.commentText();
if (comment.length() > 0) {
annotationNode.setComment(comment);
}
annotationNode.setIncluded(annotationTypeDoc.isIncluded());
annotationNode.setScope(parseScope(annotationTypeDoc));
for (AnnotationTypeElementDoc annotationTypeElementDoc : annotationTypeDoc.elements()) {
annotationNode.getElement().add(parseAnnotationTypeElementDoc(annotationTypeElementDoc));
}
for (AnnotationDesc annotationDesc : annotationTypeDoc.annotations()) {
annotationNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, annotationTypeDoc.qualifiedName()));
}
for (Tag tag : annotationTypeDoc.tags()) {
annotationNode.getTag().add(parseTag(tag));
}
return annotationNode;
} }
|
public class class_name {
protected Annotation parseAnnotationTypeDoc(AnnotationTypeDoc annotationTypeDoc) {
Annotation annotationNode = objectFactory.createAnnotation();
annotationNode.setName(annotationTypeDoc.name());
annotationNode.setQualified(annotationTypeDoc.qualifiedName());
String comment = annotationTypeDoc.commentText();
if (comment.length() > 0) {
annotationNode.setComment(comment); // depends on control dependency: [if], data = [none]
}
annotationNode.setIncluded(annotationTypeDoc.isIncluded());
annotationNode.setScope(parseScope(annotationTypeDoc));
for (AnnotationTypeElementDoc annotationTypeElementDoc : annotationTypeDoc.elements()) {
annotationNode.getElement().add(parseAnnotationTypeElementDoc(annotationTypeElementDoc)); // depends on control dependency: [for], data = [annotationTypeElementDoc]
}
for (AnnotationDesc annotationDesc : annotationTypeDoc.annotations()) {
annotationNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, annotationTypeDoc.qualifiedName())); // depends on control dependency: [for], data = [annotationDesc]
}
for (Tag tag : annotationTypeDoc.tags()) {
annotationNode.getTag().add(parseTag(tag)); // depends on control dependency: [for], data = [tag]
}
return annotationNode;
} }
|
public class class_name {
public <E> List<Object> getForeignKeysFromJoinTable(String inverseJoinColumnName, List<Column> columns,
Class columnJavaType)
{
List<Object> foreignKeys = new ArrayList<Object>();
if (columns == null || columns.isEmpty())
{
return foreignKeys;
}
for (Column c : columns)
{
try
{
// Thrift Column name
String thriftColumnName = PropertyAccessorFactory.STRING.fromBytes(String.class, c.getName());
// Thrift Column Value
byte[] thriftColumnValue = c.getValue();
if (null == thriftColumnValue)
{
continue;
}
if (thriftColumnName != null && thriftColumnName.startsWith(inverseJoinColumnName))
{
Object val = PropertyAccessorHelper.getObject(columnJavaType, thriftColumnValue);
foreignKeys.add(val);
}
}
catch (PropertyAccessException e)
{
continue;
}
}
return foreignKeys;
} }
|
public class class_name {
public <E> List<Object> getForeignKeysFromJoinTable(String inverseJoinColumnName, List<Column> columns,
Class columnJavaType)
{
List<Object> foreignKeys = new ArrayList<Object>();
if (columns == null || columns.isEmpty())
{
return foreignKeys; // depends on control dependency: [if], data = [none]
}
for (Column c : columns)
{
try
{
// Thrift Column name
String thriftColumnName = PropertyAccessorFactory.STRING.fromBytes(String.class, c.getName());
// Thrift Column Value
byte[] thriftColumnValue = c.getValue();
if (null == thriftColumnValue)
{
continue;
}
if (thriftColumnName != null && thriftColumnName.startsWith(inverseJoinColumnName))
{
Object val = PropertyAccessorHelper.getObject(columnJavaType, thriftColumnValue);
foreignKeys.add(val); // depends on control dependency: [if], data = [none]
}
}
catch (PropertyAccessException e)
{
continue;
} // depends on control dependency: [catch], data = [none]
}
return foreignKeys;
} }
|
public class class_name {
public void unsubscribe (DObjectManager omgr)
{
if (!_active) {
// we may be non-active and have no object which could mean
// that subscription failed; in which case we don't want to
// complain about anything, just quietly ignore the
// unsubscribe request
if (_object == null && !_pending) {
return;
}
log.warning("Inactive safesub asked to unsubscribe " + this + ".", new Exception());
}
// note that we no longer desire to be subscribed
_active = false;
if (_pending) {
// make sure we don't have an object reference
if (_object != null) {
log.warning("Incroyable! A safesub has an object and is " +
"pending!? " + this + ".", new Exception());
} else {
// nothing to do but wait for the subscription to complete
// at which point we'll pitch the object post-haste
return;
}
}
// make sure we have our object
if (_object == null) {
log.warning("Zut alors! A safesub _was_ active and not " +
"pending yet has no object!? " + this + ".", new Exception());
// nothing to do since we're apparently already unsubscribed
return;
}
// clear out any listeners we added
for (ChangeListener listener : _listeners) {
_object.removeListener(listener);
}
// finally effect our unsubscription
_object = null;
omgr.unsubscribeFromObject(_oid, this);
} }
|
public class class_name {
public void unsubscribe (DObjectManager omgr)
{
if (!_active) {
// we may be non-active and have no object which could mean
// that subscription failed; in which case we don't want to
// complain about anything, just quietly ignore the
// unsubscribe request
if (_object == null && !_pending) {
return; // depends on control dependency: [if], data = [none]
}
log.warning("Inactive safesub asked to unsubscribe " + this + ".", new Exception()); // depends on control dependency: [if], data = [none]
}
// note that we no longer desire to be subscribed
_active = false;
if (_pending) {
// make sure we don't have an object reference
if (_object != null) {
log.warning("Incroyable! A safesub has an object and is " +
"pending!? " + this + ".", new Exception()); // depends on control dependency: [if], data = [none]
} else {
// nothing to do but wait for the subscription to complete
// at which point we'll pitch the object post-haste
return; // depends on control dependency: [if], data = [none]
}
}
// make sure we have our object
if (_object == null) {
log.warning("Zut alors! A safesub _was_ active and not " +
"pending yet has no object!? " + this + ".", new Exception()); // depends on control dependency: [if], data = [none]
// nothing to do since we're apparently already unsubscribed
return; // depends on control dependency: [if], data = [none]
}
// clear out any listeners we added
for (ChangeListener listener : _listeners) {
_object.removeListener(listener); // depends on control dependency: [for], data = [listener]
}
// finally effect our unsubscription
_object = null;
omgr.unsubscribeFromObject(_oid, this);
} }
|
public class class_name {
public void marshall(PatchComplianceData patchComplianceData, ProtocolMarshaller protocolMarshaller) {
if (patchComplianceData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(patchComplianceData.getTitle(), TITLE_BINDING);
protocolMarshaller.marshall(patchComplianceData.getKBId(), KBID_BINDING);
protocolMarshaller.marshall(patchComplianceData.getClassification(), CLASSIFICATION_BINDING);
protocolMarshaller.marshall(patchComplianceData.getSeverity(), SEVERITY_BINDING);
protocolMarshaller.marshall(patchComplianceData.getState(), STATE_BINDING);
protocolMarshaller.marshall(patchComplianceData.getInstalledTime(), INSTALLEDTIME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PatchComplianceData patchComplianceData, ProtocolMarshaller protocolMarshaller) {
if (patchComplianceData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(patchComplianceData.getTitle(), TITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patchComplianceData.getKBId(), KBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patchComplianceData.getClassification(), CLASSIFICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patchComplianceData.getSeverity(), SEVERITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patchComplianceData.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(patchComplianceData.getInstalledTime(), INSTALLEDTIME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private synchronized void rootWindowClosing(WindowEvent evt) {
// Notify to all the debuggers to stop debugging
for (EnhancedDebugger debugger : debuggers) {
debugger.cancel();
}
// Release any reference to the debuggers
debuggers.clear();
// Release the default instance
instance = null;
frame = null;
notifyAll();
} }
|
public class class_name {
private synchronized void rootWindowClosing(WindowEvent evt) {
// Notify to all the debuggers to stop debugging
for (EnhancedDebugger debugger : debuggers) {
debugger.cancel(); // depends on control dependency: [for], data = [debugger]
}
// Release any reference to the debuggers
debuggers.clear();
// Release the default instance
instance = null;
frame = null;
notifyAll();
} }
|
public class class_name {
LocatedBlocksWithMetaInfo updateDatanodeInfo(LocatedBlocks locatedBlocks)
throws IOException {
if (locatedBlocks.getLocatedBlocks().size() == 0)
return new LocatedBlocksWithMetaInfo(locatedBlocks.getFileLength(),
locatedBlocks.getLocatedBlocks(), false,
DataTransferProtocol.DATA_TRANSFER_VERSION, getNamespaceId(),
this.nameNode.getClientProtocolMethodsFingerprint());
List<LocatedBlock> newBlocks = new ArrayList<LocatedBlock>();
readLock();
try {
for (LocatedBlock locBlock: locatedBlocks.getLocatedBlocks()) {
Block block = locBlock.getBlock();
int numNodes = blocksMap.numNodes(block);
int numCorruptNodes = countNodes(block).corruptReplicas();
int numCorruptReplicas = corruptReplicas.numCorruptReplicas(block);
if (numCorruptNodes != numCorruptReplicas) {
LOG.warn("Inconsistent number of corrupt replicas for " +
block + "blockMap has " + numCorruptNodes +
" but corrupt replicas map has " + numCorruptReplicas);
}
boolean blockCorrupt = numCorruptNodes == numNodes;
int numMachineSet = blockCorrupt ? numNodes : (numNodes - numCorruptNodes);
DatanodeDescriptor[] machineSet = new DatanodeDescriptor[numMachineSet];
if (numMachineSet > 0) {
numNodes = 0;
for(Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(block);
it.hasNext();) {
DatanodeDescriptor dn = it.next();
boolean replicaCorrupt = corruptReplicas.isReplicaCorrupt(block, dn);
if (blockCorrupt || (!blockCorrupt && !replicaCorrupt))
machineSet[numNodes++] = dn;
}
}
// We need to make a copy of the block object before releasing the lock
// to prevent the state of block is changed after that and before the
// object is serialized to clients, to avoid potential inconsistency.
// Further optimization is possible to avoid some object copy. Since it
// is so far not a critical path. We leave a safe approach here.
//
Block blockCopy = null;
if (block != null) {
blockCopy = new Block(block);
}
LocatedBlock newBlock = new LocatedBlock(blockCopy, machineSet, 0,
blockCorrupt);
newBlocks.add(newBlock);
}
} finally {
readUnlock();
}
return new LocatedBlocksWithMetaInfo(locatedBlocks.getFileLength(),
newBlocks, false, DataTransferProtocol.DATA_TRANSFER_VERSION,
getNamespaceId(), this.nameNode.getClientProtocolMethodsFingerprint());
} }
|
public class class_name {
LocatedBlocksWithMetaInfo updateDatanodeInfo(LocatedBlocks locatedBlocks)
throws IOException {
if (locatedBlocks.getLocatedBlocks().size() == 0)
return new LocatedBlocksWithMetaInfo(locatedBlocks.getFileLength(),
locatedBlocks.getLocatedBlocks(), false,
DataTransferProtocol.DATA_TRANSFER_VERSION, getNamespaceId(),
this.nameNode.getClientProtocolMethodsFingerprint());
List<LocatedBlock> newBlocks = new ArrayList<LocatedBlock>();
readLock();
try {
for (LocatedBlock locBlock: locatedBlocks.getLocatedBlocks()) {
Block block = locBlock.getBlock();
int numNodes = blocksMap.numNodes(block);
int numCorruptNodes = countNodes(block).corruptReplicas();
int numCorruptReplicas = corruptReplicas.numCorruptReplicas(block);
if (numCorruptNodes != numCorruptReplicas) {
LOG.warn("Inconsistent number of corrupt replicas for " +
block + "blockMap has " + numCorruptNodes +
" but corrupt replicas map has " + numCorruptReplicas); // depends on control dependency: [if], data = [none]
}
boolean blockCorrupt = numCorruptNodes == numNodes;
int numMachineSet = blockCorrupt ? numNodes : (numNodes - numCorruptNodes);
DatanodeDescriptor[] machineSet = new DatanodeDescriptor[numMachineSet];
if (numMachineSet > 0) {
numNodes = 0; // depends on control dependency: [if], data = [none]
for(Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(block);
it.hasNext();) {
DatanodeDescriptor dn = it.next();
boolean replicaCorrupt = corruptReplicas.isReplicaCorrupt(block, dn);
if (blockCorrupt || (!blockCorrupt && !replicaCorrupt))
machineSet[numNodes++] = dn;
}
}
// We need to make a copy of the block object before releasing the lock
// to prevent the state of block is changed after that and before the
// object is serialized to clients, to avoid potential inconsistency.
// Further optimization is possible to avoid some object copy. Since it
// is so far not a critical path. We leave a safe approach here.
//
Block blockCopy = null;
if (block != null) {
blockCopy = new Block(block); // depends on control dependency: [if], data = [(block]
}
LocatedBlock newBlock = new LocatedBlock(blockCopy, machineSet, 0,
blockCorrupt);
newBlocks.add(newBlock); // depends on control dependency: [for], data = [none]
}
} finally {
readUnlock();
}
return new LocatedBlocksWithMetaInfo(locatedBlocks.getFileLength(),
newBlocks, false, DataTransferProtocol.DATA_TRANSFER_VERSION,
getNamespaceId(), this.nameNode.getClientProtocolMethodsFingerprint());
} }
|
public class class_name {
public static double dirichletPdf(double[] pi, double[] ai) {
double probability=1.0;
double sumAi=0.0;
double productGammaAi=1.0;
double tmp;
int piLength=pi.length;
for(int i=0;i<piLength;++i) {
tmp=ai[i];
sumAi+= tmp;
productGammaAi*=gamma(tmp);
probability*=Math.pow(pi[i], tmp-1);
}
probability*=gamma(sumAi)/productGammaAi;
return probability;
} }
|
public class class_name {
public static double dirichletPdf(double[] pi, double[] ai) {
double probability=1.0;
double sumAi=0.0;
double productGammaAi=1.0;
double tmp;
int piLength=pi.length;
for(int i=0;i<piLength;++i) {
tmp=ai[i]; // depends on control dependency: [for], data = [i]
sumAi+= tmp; // depends on control dependency: [for], data = [none]
productGammaAi*=gamma(tmp); // depends on control dependency: [for], data = [none]
probability*=Math.pow(pi[i], tmp-1); // depends on control dependency: [for], data = [i]
}
probability*=gamma(sumAi)/productGammaAi;
return probability;
} }
|
public class class_name {
public int removeKey(String inputKey) {
String key = Normalizer.normalize(inputKey, Normalizer.NORMALIZE_LOWER);
int num_removed = 0;
List<String> vals = this.values.remove(key);
if (null != vals) {
num_removed = vals.size();
}
this.num_items -= num_removed;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeKey: key=" + key + " " + num_removed);
}
return num_removed;
} }
|
public class class_name {
public int removeKey(String inputKey) {
String key = Normalizer.normalize(inputKey, Normalizer.NORMALIZE_LOWER);
int num_removed = 0;
List<String> vals = this.values.remove(key);
if (null != vals) {
num_removed = vals.size(); // depends on control dependency: [if], data = [none]
}
this.num_items -= num_removed;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeKey: key=" + key + " " + num_removed); // depends on control dependency: [if], data = [none]
}
return num_removed;
} }
|
public class class_name {
private void failWithMessage(String errorMessage) {
AssertionError assertionError = Failures.instance().failureIfErrorMessageIsOverridden(info);
if (assertionError == null) {
// error message was not overridden, build it.
String description = MessageFormatter.instance().format(info.description(), info.representation(), "");
assertionError = new AssertionError(description + errorMessage);
}
Failures.instance().removeAssertJRelatedElementsFromStackTraceIfNeeded(assertionError);
throw assertionError;
} }
|
public class class_name {
private void failWithMessage(String errorMessage) {
AssertionError assertionError = Failures.instance().failureIfErrorMessageIsOverridden(info);
if (assertionError == null) {
// error message was not overridden, build it.
String description = MessageFormatter.instance().format(info.description(), info.representation(), "");
assertionError = new AssertionError(description + errorMessage); // depends on control dependency: [if], data = [none]
}
Failures.instance().removeAssertJRelatedElementsFromStackTraceIfNeeded(assertionError);
throw assertionError;
} }
|
public class class_name {
public void marshall(FailedCreateWorkspaceRequest failedCreateWorkspaceRequest, ProtocolMarshaller protocolMarshaller) {
if (failedCreateWorkspaceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(failedCreateWorkspaceRequest.getWorkspaceRequest(), WORKSPACEREQUEST_BINDING);
protocolMarshaller.marshall(failedCreateWorkspaceRequest.getErrorCode(), ERRORCODE_BINDING);
protocolMarshaller.marshall(failedCreateWorkspaceRequest.getErrorMessage(), ERRORMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(FailedCreateWorkspaceRequest failedCreateWorkspaceRequest, ProtocolMarshaller protocolMarshaller) {
if (failedCreateWorkspaceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(failedCreateWorkspaceRequest.getWorkspaceRequest(), WORKSPACEREQUEST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(failedCreateWorkspaceRequest.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(failedCreateWorkspaceRequest.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void expandBuffers() {
if (this.serialized.length < size + ARC_SIZE * MAX_LABELS) {
serialized = java.util.Arrays.copyOf(serialized, serialized.length + bufferGrowthSize);
serializationBufferReallocations++;
}
} }
|
public class class_name {
private void expandBuffers() {
if (this.serialized.length < size + ARC_SIZE * MAX_LABELS) {
serialized = java.util.Arrays.copyOf(serialized, serialized.length + bufferGrowthSize); // depends on control dependency: [if], data = [none]
serializationBufferReallocations++; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
String lastLink() {
if (totalResults == null || currentLimit == 0L) {
return null;
}
Long lastOffset;
if (totalResults % currentLimit == 0L) {
lastOffset = totalResults - currentLimit;
} else {
// Truncation due to integral division gives floor-like behavior for free.
lastOffset = totalResults / currentLimit * currentLimit;
}
return urlWithUpdatedPagination(lastOffset, currentLimit);
} }
|
public class class_name {
String lastLink() {
if (totalResults == null || currentLimit == 0L) {
return null; // depends on control dependency: [if], data = [none]
}
Long lastOffset;
if (totalResults % currentLimit == 0L) {
lastOffset = totalResults - currentLimit; // depends on control dependency: [if], data = [none]
} else {
// Truncation due to integral division gives floor-like behavior for free.
lastOffset = totalResults / currentLimit * currentLimit; // depends on control dependency: [if], data = [none]
}
return urlWithUpdatedPagination(lastOffset, currentLimit);
} }
|
public class class_name {
private void destroy()
{
if (log.isLoggable(Level.FINEST)) {
log.finest(this + " destroying connection");
}
try {
_socket.forceShutdown();
} catch (Throwable e) {
}
try {
closeConnection();
} catch (Throwable e) {
log.log(Level.FINER, e.toString(), e);
}
// XXX:
_port.removeConnection(this);
} }
|
public class class_name {
private void destroy()
{
if (log.isLoggable(Level.FINEST)) {
log.finest(this + " destroying connection"); // depends on control dependency: [if], data = [none]
}
try {
_socket.forceShutdown(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
} // depends on control dependency: [catch], data = [none]
try {
closeConnection(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
log.log(Level.FINER, e.toString(), e);
} // depends on control dependency: [catch], data = [none]
// XXX:
_port.removeConnection(this);
} }
|
public class class_name {
private void stopPondLife(int id)
{
PondLife pl = null;
synchronized(this)
{
pl=_pondLife[id];
if (pl!=null)
{
_pondLife[id]=null;
_index[--_size]=id;
if (_available>_size)
_available=_size;
}
}
if (pl!=null)
pl.leavePool();
} }
|
public class class_name {
private void stopPondLife(int id)
{
PondLife pl = null;
synchronized(this)
{
pl=_pondLife[id];
if (pl!=null)
{
_pondLife[id]=null; // depends on control dependency: [if], data = [none]
_index[--_size]=id; // depends on control dependency: [if], data = [none]
if (_available>_size)
_available=_size;
}
}
if (pl!=null)
pl.leavePool();
} }
|
public class class_name {
private void initializeStructure(List<AssociatedTriple> listObs, DMatrixRMaj P2, DMatrixRMaj P3) {
List<DMatrixRMaj> cameraMatrices = new ArrayList<>();
cameraMatrices.add(P1);
cameraMatrices.add(P2);
cameraMatrices.add(P3);
List<Point2D_F64> triangObs = new ArrayList<>();
triangObs.add(null);
triangObs.add(null);
triangObs.add(null);
structure = new SceneStructureProjective(true);
structure.initialize(3,listObs.size());
observations = new SceneObservations(3);
structure.setView(0,true, P1,0,0);
structure.setView(1,false,P2,0,0);
structure.setView(2,false,P3,0,0);
boolean needsPruning = false;
Point4D_F64 X = new Point4D_F64();
for (int i = 0; i < listObs.size(); i++) {
AssociatedTriple t = listObs.get(i);
triangObs.set(0,t.p1);
triangObs.set(1,t.p2);
triangObs.set(2,t.p3);
// triangulation can fail if all 3 views have the same pixel value. This has been observed in
// simulated 3D scenes
if( triangulator.triangulate(triangObs,cameraMatrices,X)) {
observations.getView(0).add(i,(float)t.p1.x,(float)t.p1.y);
observations.getView(1).add(i,(float)t.p2.x,(float)t.p2.y);
observations.getView(2).add(i,(float)t.p3.x,(float)t.p3.y);
structure.points[i].set(X.x,X.y,X.z,X.w);
} else {
needsPruning = true;
}
}
if( needsPruning ) {
PruneStructureFromSceneProjective pruner = new PruneStructureFromSceneProjective(structure,observations);
pruner.prunePoints(1);
}
} }
|
public class class_name {
private void initializeStructure(List<AssociatedTriple> listObs, DMatrixRMaj P2, DMatrixRMaj P3) {
List<DMatrixRMaj> cameraMatrices = new ArrayList<>();
cameraMatrices.add(P1);
cameraMatrices.add(P2);
cameraMatrices.add(P3);
List<Point2D_F64> triangObs = new ArrayList<>();
triangObs.add(null);
triangObs.add(null);
triangObs.add(null);
structure = new SceneStructureProjective(true);
structure.initialize(3,listObs.size());
observations = new SceneObservations(3);
structure.setView(0,true, P1,0,0);
structure.setView(1,false,P2,0,0);
structure.setView(2,false,P3,0,0);
boolean needsPruning = false;
Point4D_F64 X = new Point4D_F64();
for (int i = 0; i < listObs.size(); i++) {
AssociatedTriple t = listObs.get(i);
triangObs.set(0,t.p1); // depends on control dependency: [for], data = [none]
triangObs.set(1,t.p2); // depends on control dependency: [for], data = [none]
triangObs.set(2,t.p3); // depends on control dependency: [for], data = [none]
// triangulation can fail if all 3 views have the same pixel value. This has been observed in
// simulated 3D scenes
if( triangulator.triangulate(triangObs,cameraMatrices,X)) {
observations.getView(0).add(i,(float)t.p1.x,(float)t.p1.y); // depends on control dependency: [if], data = [none]
observations.getView(1).add(i,(float)t.p2.x,(float)t.p2.y); // depends on control dependency: [if], data = [none]
observations.getView(2).add(i,(float)t.p3.x,(float)t.p3.y); // depends on control dependency: [if], data = [none]
structure.points[i].set(X.x,X.y,X.z,X.w); // depends on control dependency: [if], data = [none]
} else {
needsPruning = true; // depends on control dependency: [if], data = [none]
}
}
if( needsPruning ) {
PruneStructureFromSceneProjective pruner = new PruneStructureFromSceneProjective(structure,observations);
pruner.prunePoints(1); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static BufferedWriter newWriter(File file, String charset, boolean append, boolean writeBom) throws IOException {
boolean shouldWriteBom = writeBom && !file.exists();
if (append) {
FileOutputStream stream = new FileOutputStream(file, append);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(stream, charset);
}
return new EncodingAwareBufferedWriter(new OutputStreamWriter(stream, charset));
} else {
FileOutputStream stream = new FileOutputStream(file);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(stream, charset);
}
return new EncodingAwareBufferedWriter(new OutputStreamWriter(stream, charset));
}
} }
|
public class class_name {
public static BufferedWriter newWriter(File file, String charset, boolean append, boolean writeBom) throws IOException {
boolean shouldWriteBom = writeBom && !file.exists();
if (append) {
FileOutputStream stream = new FileOutputStream(file, append);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(stream, charset); // depends on control dependency: [if], data = [none]
}
return new EncodingAwareBufferedWriter(new OutputStreamWriter(stream, charset));
} else {
FileOutputStream stream = new FileOutputStream(file);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(stream, charset); // depends on control dependency: [if], data = [none]
}
return new EncodingAwareBufferedWriter(new OutputStreamWriter(stream, charset));
}
} }
|
public class class_name {
public static int offsetByCodePoints(CharSequence text, int index, int codePointOffset) {
if (index < 0 || index > text.length()) {
throw new IndexOutOfBoundsException("index ( " + index +
") out of range 0, " + text.length());
}
if (codePointOffset < 0) {
while (++codePointOffset <= 0) {
char ch = text.charAt(--index);
while (ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE && index > 0) {
ch = text.charAt(--index);
if (ch < MIN_HIGH_SURROGATE || ch > MAX_HIGH_SURROGATE) {
if (++codePointOffset > 0) {
return index+1;
}
}
}
}
} else {
int limit = text.length();
while (--codePointOffset >= 0) {
char ch = text.charAt(index++);
while (ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE && index < limit) {
ch = text.charAt(index++);
if (ch < MIN_LOW_SURROGATE || ch > MAX_LOW_SURROGATE) {
if (--codePointOffset < 0) {
return index-1;
}
}
}
}
}
return index;
} }
|
public class class_name {
public static int offsetByCodePoints(CharSequence text, int index, int codePointOffset) {
if (index < 0 || index > text.length()) {
throw new IndexOutOfBoundsException("index ( " + index +
") out of range 0, " + text.length());
}
if (codePointOffset < 0) {
while (++codePointOffset <= 0) {
char ch = text.charAt(--index);
while (ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE && index > 0) {
ch = text.charAt(--index); // depends on control dependency: [while], data = [none]
if (ch < MIN_HIGH_SURROGATE || ch > MAX_HIGH_SURROGATE) {
if (++codePointOffset > 0) {
return index+1; // depends on control dependency: [if], data = [none]
}
}
}
}
} else {
int limit = text.length();
while (--codePointOffset >= 0) {
char ch = text.charAt(index++);
while (ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE && index < limit) {
ch = text.charAt(index++); // depends on control dependency: [while], data = [none]
if (ch < MIN_LOW_SURROGATE || ch > MAX_LOW_SURROGATE) {
if (--codePointOffset < 0) {
return index-1; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return index;
} }
|
public class class_name {
public java.util.List<String> getZoneNames() {
if (zoneNames == null) {
zoneNames = new com.amazonaws.internal.SdkInternalList<String>();
}
return zoneNames;
} }
|
public class class_name {
public java.util.List<String> getZoneNames() {
if (zoneNames == null) {
zoneNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return zoneNames;
} }
|
public class class_name {
@Override
public void paint(final RenderContext renderContext) {
UIContext uic = UIContextHolder.getCurrent();
// Generate the HTML
StringWriter outputBuffer = new StringWriter();
PrintWriter outputWriter = new PrintWriter(outputBuffer);
WebXmlRenderContext outputContext = new WebXmlRenderContext(outputWriter, uic.getLocale());
super.paint(outputContext);
String html = outputBuffer.toString();
// Only process TEMPLATE if has I18N brackets
if (html.contains("{{#i18n")) {
// Create a new instance of factory to avoid caching the page.
// https://github.com/spullara/mustache.java/issues/117
final MustacheFactory mf = new DefaultMustacheFactory();
Mustache mustache = mf.compile(new StringReader(html), UUID.randomUUID().toString());
StringWriter templateWriter = new StringWriter();
mustache.execute(templateWriter, new I18NContext(getResourceBundle()));
html = templateWriter.toString();
}
// Get the OUTPUT writer
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
writer.print(html);
} }
|
public class class_name {
@Override
public void paint(final RenderContext renderContext) {
UIContext uic = UIContextHolder.getCurrent();
// Generate the HTML
StringWriter outputBuffer = new StringWriter();
PrintWriter outputWriter = new PrintWriter(outputBuffer);
WebXmlRenderContext outputContext = new WebXmlRenderContext(outputWriter, uic.getLocale());
super.paint(outputContext);
String html = outputBuffer.toString();
// Only process TEMPLATE if has I18N brackets
if (html.contains("{{#i18n")) {
// Create a new instance of factory to avoid caching the page.
// https://github.com/spullara/mustache.java/issues/117
final MustacheFactory mf = new DefaultMustacheFactory();
Mustache mustache = mf.compile(new StringReader(html), UUID.randomUUID().toString());
StringWriter templateWriter = new StringWriter();
mustache.execute(templateWriter, new I18NContext(getResourceBundle())); // depends on control dependency: [if], data = [none]
html = templateWriter.toString(); // depends on control dependency: [if], data = [none]
}
// Get the OUTPUT writer
WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
PrintWriter writer = webRenderContext.getWriter();
writer.print(html);
} }
|
public class class_name {
@Override
public ManagerStatusResponse handleStatusRequest(int viewId) {
try {
// As long as we have an older view, we can still process topologies from the old coordinator
waitForView(viewId, getGlobalTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Shutting down, send back an empty status
Thread.currentThread().interrupt();
return new ManagerStatusResponse(Collections.emptyMap(), true);
}
Map<String, CacheStatusResponse> caches = new HashMap<>();
synchronized (runningCaches) {
latestStatusResponseViewId = viewId;
for (Map.Entry<String, LocalCacheStatus> e : runningCaches.entrySet()) {
String cacheName = e.getKey();
LocalCacheStatus cacheStatus = runningCaches.get(cacheName);
caches.put(e.getKey(), new CacheStatusResponse(cacheStatus.getJoinInfo(),
cacheStatus.getCurrentTopology(), cacheStatus.getStableTopology(),
cacheStatus.getPartitionHandlingManager().getAvailabilityMode()));
}
}
boolean rebalancingEnabled = true;
// Avoid adding a direct dependency to the ClusterTopologyManager
ReplicableCommand command = new CacheTopologyControlCommand(null,
CacheTopologyControlCommand.Type.POLICY_GET_STATUS, transport.getAddress(),
transport.getViewId());
try {
gcr.wireDependencies(command);
SuccessfulResponse response = (SuccessfulResponse) command.invoke();
rebalancingEnabled = (Boolean) response.getResponseValue();
} catch (Throwable t) {
log.warn("Failed to obtain the rebalancing status", t);
}
log.debugf("Sending cluster status response for view %d", viewId);
return new ManagerStatusResponse(caches, rebalancingEnabled);
} }
|
public class class_name {
@Override
public ManagerStatusResponse handleStatusRequest(int viewId) {
try {
// As long as we have an older view, we can still process topologies from the old coordinator
waitForView(viewId, getGlobalTimeout(), TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
// Shutting down, send back an empty status
Thread.currentThread().interrupt();
return new ManagerStatusResponse(Collections.emptyMap(), true);
} // depends on control dependency: [catch], data = [none]
Map<String, CacheStatusResponse> caches = new HashMap<>();
synchronized (runningCaches) {
latestStatusResponseViewId = viewId;
for (Map.Entry<String, LocalCacheStatus> e : runningCaches.entrySet()) {
String cacheName = e.getKey();
LocalCacheStatus cacheStatus = runningCaches.get(cacheName);
caches.put(e.getKey(), new CacheStatusResponse(cacheStatus.getJoinInfo(),
cacheStatus.getCurrentTopology(), cacheStatus.getStableTopology(),
cacheStatus.getPartitionHandlingManager().getAvailabilityMode())); // depends on control dependency: [for], data = [e]
}
}
boolean rebalancingEnabled = true;
// Avoid adding a direct dependency to the ClusterTopologyManager
ReplicableCommand command = new CacheTopologyControlCommand(null,
CacheTopologyControlCommand.Type.POLICY_GET_STATUS, transport.getAddress(),
transport.getViewId());
try {
gcr.wireDependencies(command); // depends on control dependency: [try], data = [none]
SuccessfulResponse response = (SuccessfulResponse) command.invoke();
rebalancingEnabled = (Boolean) response.getResponseValue(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
log.warn("Failed to obtain the rebalancing status", t);
} // depends on control dependency: [catch], data = [none]
log.debugf("Sending cluster status response for view %d", viewId);
return new ManagerStatusResponse(caches, rebalancingEnabled);
} }
|
public class class_name {
public void init() {
// the current user name
String userName = getSettings().getUser().getName();
if (m_typesLocalized[0] == null) {
m_typesLocalized[0] = key(Messages.GUI_LABEL_GROUP_0);
m_typesLocalized[1] = key(Messages.GUI_LABEL_USER_0);
m_typesLocalized[2] = key(Messages.GUI_LABEL_ROLE_0);
m_typesLocalized[3] = key(Messages.GUI_LABEL_ALLOTHERS_0);
m_typesLocalized[4] = key(Messages.GUI_LABEL_OVERWRITEALL_0);
}
// set flags to show editable or non editable entries
setEditable(false);
setInheritOption(false);
String resName = getParamResource();
try {
// get the current users' permissions
setCurPermissions(getCms().getPermissions(getParamResource(), userName));
// check if the current resource is a folder
CmsResource resource = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
if (resource.isFolder()) {
// only folders have the inherit option activated
setInheritOption(true);
if (!resName.endsWith("/")) {
// append manually a "/" to folder name to avoid issues with check if resource is in project
resName += "/";
}
}
} catch (CmsException e) {
// can usually be ignored
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage());
}
}
// check the current users permission to change access control entries
if ((!getCms().getRequestContext().getCurrentProject().isOnlineProject()
&& getCms().isInsideCurrentProject(resName))
&& (OpenCms.getRoleManager().hasRole(getCms(), CmsRole.VFS_MANAGER)
|| (((m_curPermissions.getAllowedPermissions() & CmsPermissionSet.PERMISSION_CONTROL) > 0)
&& !((m_curPermissions.getDeniedPermissions() & CmsPermissionSet.PERMISSION_CONTROL) > 0)))) {
if (isBlockingLocked()) {
m_errorMessages.add(key(Messages.ERR_PERMISSION_BLOCKING_LOCKS_0));
} else {
setEditable(true);
}
}
} }
|
public class class_name {
public void init() {
// the current user name
String userName = getSettings().getUser().getName();
if (m_typesLocalized[0] == null) {
m_typesLocalized[0] = key(Messages.GUI_LABEL_GROUP_0); // depends on control dependency: [if], data = [none]
m_typesLocalized[1] = key(Messages.GUI_LABEL_USER_0); // depends on control dependency: [if], data = [none]
m_typesLocalized[2] = key(Messages.GUI_LABEL_ROLE_0); // depends on control dependency: [if], data = [none]
m_typesLocalized[3] = key(Messages.GUI_LABEL_ALLOTHERS_0); // depends on control dependency: [if], data = [none]
m_typesLocalized[4] = key(Messages.GUI_LABEL_OVERWRITEALL_0); // depends on control dependency: [if], data = [none]
}
// set flags to show editable or non editable entries
setEditable(false);
setInheritOption(false);
String resName = getParamResource();
try {
// get the current users' permissions
setCurPermissions(getCms().getPermissions(getParamResource(), userName)); // depends on control dependency: [try], data = [none]
// check if the current resource is a folder
CmsResource resource = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
if (resource.isFolder()) {
// only folders have the inherit option activated
setInheritOption(true); // depends on control dependency: [if], data = [none]
if (!resName.endsWith("/")) {
// append manually a "/" to folder name to avoid issues with check if resource is in project
resName += "/"; // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
// can usually be ignored
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
// check the current users permission to change access control entries
if ((!getCms().getRequestContext().getCurrentProject().isOnlineProject()
&& getCms().isInsideCurrentProject(resName))
&& (OpenCms.getRoleManager().hasRole(getCms(), CmsRole.VFS_MANAGER)
|| (((m_curPermissions.getAllowedPermissions() & CmsPermissionSet.PERMISSION_CONTROL) > 0)
&& !((m_curPermissions.getDeniedPermissions() & CmsPermissionSet.PERMISSION_CONTROL) > 0)))) {
if (isBlockingLocked()) {
m_errorMessages.add(key(Messages.ERR_PERMISSION_BLOCKING_LOCKS_0)); // depends on control dependency: [if], data = [none]
} else {
setEditable(true); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Observable<ServiceResponse<List<CertificateEmailInner>>> retrieveCertificateEmailHistoryWithServiceResponseAsync(String resourceGroupName, String name) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.retrieveCertificateEmailHistory(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<CertificateEmailInner>>>>() {
@Override
public Observable<ServiceResponse<List<CertificateEmailInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<CertificateEmailInner>> clientResponse = retrieveCertificateEmailHistoryDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<List<CertificateEmailInner>>> retrieveCertificateEmailHistoryWithServiceResponseAsync(String resourceGroupName, String name) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.retrieveCertificateEmailHistory(resourceGroupName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<CertificateEmailInner>>>>() {
@Override
public Observable<ServiceResponse<List<CertificateEmailInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<CertificateEmailInner>> clientResponse = retrieveCertificateEmailHistoryDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static String lpad(String base, Integer len, String pad)
{
if (len < 0) {
return null;
} else if (len == 0) {
return "";
}
char[] data = new char[len];
// The length of the padding needed
int pos = Math.max(len - base.length(), 0);
// Copy the padding
for (int i = 0; i < pos; i += pad.length()) {
for (int j = 0; j < pad.length() && j < pos - i; j++) {
data[i + j] = pad.charAt(j);
}
}
// Copy the base
for (int i = 0; pos + i < len && i < base.length(); i++) {
data[pos + i] = base.charAt(i);
}
return new String(data);
} }
|
public class class_name {
public static String lpad(String base, Integer len, String pad)
{
if (len < 0) {
return null; // depends on control dependency: [if], data = [none]
} else if (len == 0) {
return ""; // depends on control dependency: [if], data = [none]
}
char[] data = new char[len];
// The length of the padding needed
int pos = Math.max(len - base.length(), 0);
// Copy the padding
for (int i = 0; i < pos; i += pad.length()) {
for (int j = 0; j < pad.length() && j < pos - i; j++) {
data[i + j] = pad.charAt(j); // depends on control dependency: [for], data = [j]
}
}
// Copy the base
for (int i = 0; pos + i < len && i < base.length(); i++) {
data[pos + i] = base.charAt(i); // depends on control dependency: [for], data = [i]
}
return new String(data);
} }
|
public class class_name {
protected void noteConstraints (int constrain, int size)
{
switch (constrain) {
case HORIZONTAL:
if (size == 0) {
_constrain = HORIZONTAL;
} else {
_label.setTargetWidth(size);
}
break;
case VERTICAL:
if (size == 0) {
_constrain = VERTICAL;
} else {
_label.setTargetHeight(size);
}
break;
case GOLDEN:
_label.setGoldenLayout();
break;
case NONE:
// nothing doing
break;
default:
throw new IllegalArgumentException("Invalid constraint orientation " + constrain);
}
} }
|
public class class_name {
protected void noteConstraints (int constrain, int size)
{
switch (constrain) {
case HORIZONTAL:
if (size == 0) {
_constrain = HORIZONTAL; // depends on control dependency: [if], data = [none]
} else {
_label.setTargetWidth(size); // depends on control dependency: [if], data = [(size]
}
break;
case VERTICAL:
if (size == 0) {
_constrain = VERTICAL; // depends on control dependency: [if], data = [none]
} else {
_label.setTargetHeight(size); // depends on control dependency: [if], data = [(size]
}
break;
case GOLDEN:
_label.setGoldenLayout();
break;
case NONE:
// nothing doing
break;
default:
throw new IllegalArgumentException("Invalid constraint orientation " + constrain);
}
} }
|
public class class_name {
public void stop() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
// Stop accepting work
stopped = true;
// Cancel futures for submitted work
for (Future<Void> future = futures.poll(); future != null; future = futures.poll())
if (!future.isDone() && future.cancel(true))
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "canceled", future);
// Release running work
for (Work work = runningWork.poll(); work != null; work = runningWork.poll()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "release", work);
work.release();
}
} }
|
public class class_name {
public void stop() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
// Stop accepting work
stopped = true;
// Cancel futures for submitted work
for (Future<Void> future = futures.poll(); future != null; future = futures.poll())
if (!future.isDone() && future.cancel(true))
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "canceled", future);
// Release running work
for (Work work = runningWork.poll(); work != null; work = runningWork.poll()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "release", work);
work.release(); // depends on control dependency: [for], data = [work]
}
} }
|
public class class_name {
public boolean tick (Pathable pable, long tickstamp)
{
if (tickstamp >= _startStamp + _duration) {
if (_source != null) {
pable.setLocation(_source.x, _source.y);
}
pable.pathCompleted(tickstamp);
return (_source != null);
}
// If necessary, move the sprite to the supplied location
if (_source != null && (pable.getX() != _source.x ||
pable.getY() != _source.y)) {
pable.setLocation(_source.x, _source.y);
return true;
}
return false;
} }
|
public class class_name {
public boolean tick (Pathable pable, long tickstamp)
{
if (tickstamp >= _startStamp + _duration) {
if (_source != null) {
pable.setLocation(_source.x, _source.y); // depends on control dependency: [if], data = [(_source]
}
pable.pathCompleted(tickstamp); // depends on control dependency: [if], data = [(tickstamp]
return (_source != null); // depends on control dependency: [if], data = [none]
}
// If necessary, move the sprite to the supplied location
if (_source != null && (pable.getX() != _source.x ||
pable.getY() != _source.y)) {
pable.setLocation(_source.x, _source.y); // depends on control dependency: [if], data = [(_source]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static Range create3D(Device _device, int _globalWidth, int _globalHeight, int _globalDepth) {
final Range withoutLocal = create3D(_device, _globalWidth, _globalHeight, _globalDepth, 1, 1, 1);
if (withoutLocal.isValid()) {
withoutLocal.setLocalIsDerived(true);
final int[] widthFactors = getFactors(_globalWidth, withoutLocal.getMaxWorkItemSize()[0]);
final int[] heightFactors = getFactors(_globalHeight, withoutLocal.getMaxWorkItemSize()[1]);
final int[] depthFactors = getFactors(_globalDepth, withoutLocal.getMaxWorkItemSize()[2]);
withoutLocal.setLocalSize_0(1);
withoutLocal.setLocalSize_1(1);
withoutLocal.setLocalSize_2(1);
int max = 1;
int perimeter = 0;
for (final int w : widthFactors) {
for (final int h : heightFactors) {
for (final int d : depthFactors) {
final int size = w * h * d;
if (size > withoutLocal.getMaxWorkGroupSize()) {
break;
}
if (size > max) {
max = size;
perimeter = w + h + d;
withoutLocal.setLocalSize_0(w);
withoutLocal.setLocalSize_1(h);
withoutLocal.setLocalSize_2(d);
} else if (size == max) {
final int localPerimeter = w + h + d;
if (localPerimeter < perimeter) { // is this the shortest perimeter so far
perimeter = localPerimeter;
withoutLocal.setLocalSize_0(w);
withoutLocal.setLocalSize_1(w);
withoutLocal.setLocalSize_2(d);
}
}
}
}
}
withoutLocal.setValid((withoutLocal.getLocalSize_0() > 0)
&& (withoutLocal.getLocalSize_1() > 0)
&& (withoutLocal.getLocalSize_2() > 0)
&& ((withoutLocal.getLocalSize_0() * withoutLocal.getLocalSize_1() * withoutLocal.getLocalSize_2()) <= withoutLocal
.getMaxWorkGroupSize()) && (withoutLocal.getLocalSize_0() <= withoutLocal.getMaxWorkItemSize()[0])
&& (withoutLocal.getLocalSize_1() <= withoutLocal.getMaxWorkItemSize()[1])
&& (withoutLocal.getLocalSize_2() <= withoutLocal.getMaxWorkItemSize()[2])
&& ((withoutLocal.getGlobalSize_0() % withoutLocal.getLocalSize_0()) == 0)
&& ((withoutLocal.getGlobalSize_1() % withoutLocal.getLocalSize_1()) == 0)
&& ((withoutLocal.getGlobalSize_2() % withoutLocal.getLocalSize_2()) == 0));
}
return (withoutLocal);
} }
|
public class class_name {
public static Range create3D(Device _device, int _globalWidth, int _globalHeight, int _globalDepth) {
final Range withoutLocal = create3D(_device, _globalWidth, _globalHeight, _globalDepth, 1, 1, 1);
if (withoutLocal.isValid()) {
withoutLocal.setLocalIsDerived(true); // depends on control dependency: [if], data = [none]
final int[] widthFactors = getFactors(_globalWidth, withoutLocal.getMaxWorkItemSize()[0]);
final int[] heightFactors = getFactors(_globalHeight, withoutLocal.getMaxWorkItemSize()[1]);
final int[] depthFactors = getFactors(_globalDepth, withoutLocal.getMaxWorkItemSize()[2]);
withoutLocal.setLocalSize_0(1); // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_1(1); // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_2(1); // depends on control dependency: [if], data = [none]
int max = 1;
int perimeter = 0;
for (final int w : widthFactors) {
for (final int h : heightFactors) {
for (final int d : depthFactors) {
final int size = w * h * d;
if (size > withoutLocal.getMaxWorkGroupSize()) {
break;
}
if (size > max) {
max = size; // depends on control dependency: [if], data = [none]
perimeter = w + h + d; // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_0(w); // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_1(h); // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_2(d); // depends on control dependency: [if], data = [none]
} else if (size == max) {
final int localPerimeter = w + h + d;
if (localPerimeter < perimeter) { // is this the shortest perimeter so far
perimeter = localPerimeter; // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_0(w); // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_1(w); // depends on control dependency: [if], data = [none]
withoutLocal.setLocalSize_2(d); // depends on control dependency: [if], data = [none]
}
}
}
}
}
withoutLocal.setValid((withoutLocal.getLocalSize_0() > 0)
&& (withoutLocal.getLocalSize_1() > 0)
&& (withoutLocal.getLocalSize_2() > 0)
&& ((withoutLocal.getLocalSize_0() * withoutLocal.getLocalSize_1() * withoutLocal.getLocalSize_2()) <= withoutLocal
.getMaxWorkGroupSize()) && (withoutLocal.getLocalSize_0() <= withoutLocal.getMaxWorkItemSize()[0])
&& (withoutLocal.getLocalSize_1() <= withoutLocal.getMaxWorkItemSize()[1])
&& (withoutLocal.getLocalSize_2() <= withoutLocal.getMaxWorkItemSize()[2])
&& ((withoutLocal.getGlobalSize_0() % withoutLocal.getLocalSize_0()) == 0)
&& ((withoutLocal.getGlobalSize_1() % withoutLocal.getLocalSize_1()) == 0)
&& ((withoutLocal.getGlobalSize_2() % withoutLocal.getLocalSize_2()) == 0)); // depends on control dependency: [if], data = [none]
}
return (withoutLocal);
} }
|
public class class_name {
public Map<String, Object> getNamedBindings() {
ImmutableMap.Builder<String, Object> builder = ImmutableSortedMap.naturalOrder();
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
builder.put(binding.getKey(), binding.getValue().getCursorOrValue());
}
return builder.build();
} }
|
public class class_name {
public Map<String, Object> getNamedBindings() {
ImmutableMap.Builder<String, Object> builder = ImmutableSortedMap.naturalOrder();
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
builder.put(binding.getKey(), binding.getValue().getCursorOrValue()); // depends on control dependency: [for], data = [binding]
}
return builder.build();
} }
|
public class class_name {
private void generateMap() {
if (getActivity()==null) //java.lang.IllegalStateException: Fragment HeatMap{44f341d0} not attached to Activity
return;
if (renderJobActive)
return;
renderJobActive = true;
int densityDpi = (int) (dm.density * cellSizeInDp);
//10 dpi sized cells
IGeoPoint iGeoPoint = mMapView.getProjection().fromPixels(0, 0);
IGeoPoint iGeoPoint2 = mMapView.getProjection().fromPixels(densityDpi, densityDpi);
//delta is the size of our cell in lat,lon
//since this is zoom dependent, rerun the calculations on zoom changes
double xCellSizeLongitude = Math.abs(iGeoPoint.getLongitude() - iGeoPoint2.getLongitude());
double yCellSizeLatitude = Math.abs(iGeoPoint.getLatitude() - iGeoPoint2.getLatitude());
BoundingBox view = mMapView.getBoundingBox();
//a set of a GeoPoints representing what we want a heat map of.
List<IGeoPoint> pts = loadPoints(view);
//the highest value in our collection of stuff
int maxHeat = 0;
//a temp container of all grid cells and their hit count (which turns into a color on render)
//the lower the cell size the more cells and items in the map.
Map<BoundingBox, Integer> heatmap = new HashMap<BoundingBox, Integer>();
//create the grid
Log.i(TAG, "heatmap builder " + yCellSizeLatitude + " " + xCellSizeLongitude);
Log.i(TAG, "heatmap builder " + view);
//populate the cells
for (double lat = view.getLatNorth(); lat >= view.getLatSouth(); lat = lat - yCellSizeLatitude) {
for (double lon = view.getLonEast(); lon >= view.getLonWest(); lon = lon - xCellSizeLongitude) {
//Log.i(TAG,"heatmap builder " + lat + "," + lon);
heatmap.put(new BoundingBox(lat, lon, lat - yCellSizeLatitude, lon - xCellSizeLongitude), 0);
}
}
Log.i(TAG, "generating the heatmap");
long now = System.currentTimeMillis();
//generate the map, put the items in each cell
for (int i = 0; i < pts.size(); i++) {
//get the box for this pt's coordinates
int x = increment(pts.get(i), heatmap);
if (x > maxHeat)
maxHeat = x;
}
Log.i(TAG, "generating the heatmap, done " + (System.currentTimeMillis() - now));
//figure out the color scheme
//if you need a more logirthmic scale, this is the place to do it.
//cells with a 0 value are blank
//cells 1 to 1/3 of the max value are yellow
//cells from 1/3 to 2/3 are organge
//cells 2/3 or higher are red
int redthreshold = maxHeat * 2 / 3; //upper 1/3
int orangethreshold = maxHeat * 1 / 3; //middle 1/3
//render the map
Log.i(TAG, "rendering");
now = System.currentTimeMillis();
//each bounding box if the hit count > 0 create a polygon with the bounding box coordinates with the right fill color
final FolderOverlay group = new FolderOverlay();
Iterator<Map.Entry<BoundingBox, Integer>> iterator = heatmap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<BoundingBox, Integer> next = iterator.next();
if (next.getValue() > 0) {
group.add(createPolygon(next.getKey(), next.getValue(), redthreshold, orangethreshold));
}
}
Log.i(TAG, "render done , done " + (System.currentTimeMillis() - now));
if (getActivity()==null) //java.lang.IllegalStateException: Fragment HeatMap{44f341d0} not attached to Activity
return;
if (mMapView==null) //java.lang.IllegalStateException: Fragment HeatMap{44f341d0} not attached to Activity
return;
mMapView.post(new Runnable() {
@Override
public void run() {
if (heatmapOverlay != null)
mMapView.getOverlayManager().remove(heatmapOverlay);
mMapView.getOverlayManager().add(group);
heatmapOverlay = group;
mMapView.invalidate();
renderJobActive = false;
}
});
} }
|
public class class_name {
private void generateMap() {
if (getActivity()==null) //java.lang.IllegalStateException: Fragment HeatMap{44f341d0} not attached to Activity
return;
if (renderJobActive)
return;
renderJobActive = true;
int densityDpi = (int) (dm.density * cellSizeInDp);
//10 dpi sized cells
IGeoPoint iGeoPoint = mMapView.getProjection().fromPixels(0, 0);
IGeoPoint iGeoPoint2 = mMapView.getProjection().fromPixels(densityDpi, densityDpi);
//delta is the size of our cell in lat,lon
//since this is zoom dependent, rerun the calculations on zoom changes
double xCellSizeLongitude = Math.abs(iGeoPoint.getLongitude() - iGeoPoint2.getLongitude());
double yCellSizeLatitude = Math.abs(iGeoPoint.getLatitude() - iGeoPoint2.getLatitude());
BoundingBox view = mMapView.getBoundingBox();
//a set of a GeoPoints representing what we want a heat map of.
List<IGeoPoint> pts = loadPoints(view);
//the highest value in our collection of stuff
int maxHeat = 0;
//a temp container of all grid cells and their hit count (which turns into a color on render)
//the lower the cell size the more cells and items in the map.
Map<BoundingBox, Integer> heatmap = new HashMap<BoundingBox, Integer>();
//create the grid
Log.i(TAG, "heatmap builder " + yCellSizeLatitude + " " + xCellSizeLongitude);
Log.i(TAG, "heatmap builder " + view);
//populate the cells
for (double lat = view.getLatNorth(); lat >= view.getLatSouth(); lat = lat - yCellSizeLatitude) {
for (double lon = view.getLonEast(); lon >= view.getLonWest(); lon = lon - xCellSizeLongitude) {
//Log.i(TAG,"heatmap builder " + lat + "," + lon);
heatmap.put(new BoundingBox(lat, lon, lat - yCellSizeLatitude, lon - xCellSizeLongitude), 0); // depends on control dependency: [for], data = [lon]
}
}
Log.i(TAG, "generating the heatmap");
long now = System.currentTimeMillis();
//generate the map, put the items in each cell
for (int i = 0; i < pts.size(); i++) {
//get the box for this pt's coordinates
int x = increment(pts.get(i), heatmap);
if (x > maxHeat)
maxHeat = x;
}
Log.i(TAG, "generating the heatmap, done " + (System.currentTimeMillis() - now));
//figure out the color scheme
//if you need a more logirthmic scale, this is the place to do it.
//cells with a 0 value are blank
//cells 1 to 1/3 of the max value are yellow
//cells from 1/3 to 2/3 are organge
//cells 2/3 or higher are red
int redthreshold = maxHeat * 2 / 3; //upper 1/3
int orangethreshold = maxHeat * 1 / 3; //middle 1/3
//render the map
Log.i(TAG, "rendering");
now = System.currentTimeMillis();
//each bounding box if the hit count > 0 create a polygon with the bounding box coordinates with the right fill color
final FolderOverlay group = new FolderOverlay();
Iterator<Map.Entry<BoundingBox, Integer>> iterator = heatmap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<BoundingBox, Integer> next = iterator.next();
if (next.getValue() > 0) {
group.add(createPolygon(next.getKey(), next.getValue(), redthreshold, orangethreshold)); // depends on control dependency: [if], data = [none]
}
}
Log.i(TAG, "render done , done " + (System.currentTimeMillis() - now));
if (getActivity()==null) //java.lang.IllegalStateException: Fragment HeatMap{44f341d0} not attached to Activity
return;
if (mMapView==null) //java.lang.IllegalStateException: Fragment HeatMap{44f341d0} not attached to Activity
return;
mMapView.post(new Runnable() {
@Override
public void run() {
if (heatmapOverlay != null)
mMapView.getOverlayManager().remove(heatmapOverlay);
mMapView.getOverlayManager().add(group);
heatmapOverlay = group;
mMapView.invalidate();
renderJobActive = false;
}
});
} }
|
public class class_name {
public static Object createParameterObject(List<String> paramValues,
Class<?> paramType,
Type genericType,
Annotation[] paramAnns,
String defaultValue,
boolean decoded,
ParameterType pathParam,
Message message) {
//CHECKSTYLE:ON
if (paramValues == null) {
if (defaultValue != null) {
paramValues = Collections.singletonList(defaultValue);
} else {
if (paramType.isPrimitive()) {
paramValues = Collections.singletonList(
boolean.class == paramType ? "false"
: char.class == paramType ? Character.toString('\u0000') : "0");
} else if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
paramValues = Collections.emptyList();
} else {
return null;
}
}
}
Object value = null;
if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
MultivaluedMap<String, String> paramValuesMap = new MetadataMap<>();
paramValuesMap.put("", paramValues);
value = InjectionUtils.injectIntoCollectionOrArray(paramType, genericType, paramAnns,
paramValuesMap, false, decoded, pathParam, message);
} else {
String result = null;
if (!paramValues.isEmpty()) {
boolean isLast = pathParam == ParameterType.PATH ? true : false;
result = isLast ? paramValues.get(paramValues.size() - 1)
: paramValues.get(0);
}
if (result != null) {
value = InjectionUtils.handleParameter(result, decoded, paramType, genericType,
paramAnns, pathParam, message);
}
}
return value;
} }
|
public class class_name {
public static Object createParameterObject(List<String> paramValues,
Class<?> paramType,
Type genericType,
Annotation[] paramAnns,
String defaultValue,
boolean decoded,
ParameterType pathParam,
Message message) {
//CHECKSTYLE:ON
if (paramValues == null) {
if (defaultValue != null) {
paramValues = Collections.singletonList(defaultValue); // depends on control dependency: [if], data = [(defaultValue]
} else {
if (paramType.isPrimitive()) {
paramValues = Collections.singletonList(
boolean.class == paramType ? "false"
: char.class == paramType ? Character.toString('\u0000') : "0"); // depends on control dependency: [if], data = [none]
} else if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
paramValues = Collections.emptyList(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
}
}
Object value = null;
if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
MultivaluedMap<String, String> paramValuesMap = new MetadataMap<>();
paramValuesMap.put("", paramValues); // depends on control dependency: [if], data = [none]
value = InjectionUtils.injectIntoCollectionOrArray(paramType, genericType, paramAnns,
paramValuesMap, false, decoded, pathParam, message); // depends on control dependency: [if], data = [none]
} else {
String result = null;
if (!paramValues.isEmpty()) {
boolean isLast = pathParam == ParameterType.PATH ? true : false;
result = isLast ? paramValues.get(paramValues.size() - 1)
: paramValues.get(0); // depends on control dependency: [if], data = [none]
}
if (result != null) {
value = InjectionUtils.handleParameter(result, decoded, paramType, genericType,
paramAnns, pathParam, message); // depends on control dependency: [if], data = [(result]
}
}
return value;
} }
|
public class class_name {
protected void initPasswordDigest() {
if(saltGenerator == null) {
saltGenerator = new Default16ByteSaltGenerator();
}
if (passwordEncryptor == null) {
passwordEncryptor = new Sha512HashDigest();
}
if(customPasswordChecker == null) {
customPasswordChecker = Collections.emptyList();
}
if(passwordManager == null) {
passwordManager = new PasswordManager(passwordEncryptor, customPasswordChecker);
}
} }
|
public class class_name {
protected void initPasswordDigest() {
if(saltGenerator == null) {
saltGenerator = new Default16ByteSaltGenerator(); // depends on control dependency: [if], data = [none]
}
if (passwordEncryptor == null) {
passwordEncryptor = new Sha512HashDigest(); // depends on control dependency: [if], data = [none]
}
if(customPasswordChecker == null) {
customPasswordChecker = Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
if(passwordManager == null) {
passwordManager = new PasswordManager(passwordEncryptor, customPasswordChecker); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static DbaseFileHeader dBaseHeaderFromMetaData(ResultSetMetaData metaData, List<Integer> retainedColumns) throws SQLException {
DbaseFileHeader dbaseFileHeader = new DbaseFileHeader();
for(int fieldId= 1; fieldId <= metaData.getColumnCount(); fieldId++) {
final String fieldTypeName = metaData.getColumnTypeName(fieldId);
// TODO postgis check field type
if(!fieldTypeName.equalsIgnoreCase("geometry")) {
DBFType dbfType = getDBFType(metaData.getColumnType(fieldId), fieldTypeName, metaData.getColumnDisplaySize(fieldId), metaData.getPrecision(fieldId));
try {
dbaseFileHeader.addColumn(metaData.getColumnName(fieldId),dbfType.type, dbfType.fieldLength, dbfType.decimalCount);
retainedColumns.add(fieldId);
} catch (DbaseFileException ex) {
throw new SQLException(ex.getLocalizedMessage(), ex);
}
}
}
return dbaseFileHeader;
} }
|
public class class_name {
public static DbaseFileHeader dBaseHeaderFromMetaData(ResultSetMetaData metaData, List<Integer> retainedColumns) throws SQLException {
DbaseFileHeader dbaseFileHeader = new DbaseFileHeader();
for(int fieldId= 1; fieldId <= metaData.getColumnCount(); fieldId++) {
final String fieldTypeName = metaData.getColumnTypeName(fieldId);
// TODO postgis check field type
if(!fieldTypeName.equalsIgnoreCase("geometry")) {
DBFType dbfType = getDBFType(metaData.getColumnType(fieldId), fieldTypeName, metaData.getColumnDisplaySize(fieldId), metaData.getPrecision(fieldId));
try {
dbaseFileHeader.addColumn(metaData.getColumnName(fieldId),dbfType.type, dbfType.fieldLength, dbfType.decimalCount); // depends on control dependency: [try], data = [none]
retainedColumns.add(fieldId); // depends on control dependency: [try], data = [none]
} catch (DbaseFileException ex) {
throw new SQLException(ex.getLocalizedMessage(), ex);
} // depends on control dependency: [catch], data = [none]
}
}
return dbaseFileHeader;
} }
|
public class class_name {
public static boolean canRejected(NodeModel current, NodeModel parent) {
if(parent instanceof TaskModel && !((TaskModel)parent).isPerformAny()) {
return false;
}
boolean result = false;
for(TransitionModel tm : current.getInputs()) {
NodeModel source = tm.getSource();
if(source == parent) {
return true;
}
if(source instanceof ForkModel
|| source instanceof JoinModel
|| source instanceof SubProcessModel
|| source instanceof StartModel) {
continue;
}
result = result || canRejected(source, parent);
}
return result;
} }
|
public class class_name {
public static boolean canRejected(NodeModel current, NodeModel parent) {
if(parent instanceof TaskModel && !((TaskModel)parent).isPerformAny()) {
return false; // depends on control dependency: [if], data = [none]
}
boolean result = false;
for(TransitionModel tm : current.getInputs()) {
NodeModel source = tm.getSource();
if(source == parent) {
return true; // depends on control dependency: [if], data = [none]
}
if(source instanceof ForkModel
|| source instanceof JoinModel
|| source instanceof SubProcessModel
|| source instanceof StartModel) {
continue;
}
result = result || canRejected(source, parent); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
private void waitForNewTableMetadata() {
TableMetadata metadata;
int retries = 0;
final int waitTime = 100;
do {
metadata = getSession()
.getCluster()
.getMetadata()
.getKeyspace(this.catalog)
.getTable(quote(this.table));
if (metadata != null) {
continue;
}
LOG.warn(String.format("Metadata for new table %s.%s NOT FOUND, waiting %d millis", this.catalog,
this.table, waitTime));
try {
Thread.sleep(waitTime);
} catch (InterruptedException e) {
LOG.error("Sleep interrupted", e);
}
retries++;
if (retries >= 10) {
throw new DeepIOException("Cannot retrieve metadata for the newly created CF ");
}
} while (metadata == null);
} }
|
public class class_name {
private void waitForNewTableMetadata() {
TableMetadata metadata;
int retries = 0;
final int waitTime = 100;
do {
metadata = getSession()
.getCluster()
.getMetadata()
.getKeyspace(this.catalog)
.getTable(quote(this.table));
if (metadata != null) {
continue;
}
LOG.warn(String.format("Metadata for new table %s.%s NOT FOUND, waiting %d millis", this.catalog,
this.table, waitTime));
try {
Thread.sleep(waitTime); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
LOG.error("Sleep interrupted", e);
} // depends on control dependency: [catch], data = [none]
retries++;
if (retries >= 10) {
throw new DeepIOException("Cannot retrieve metadata for the newly created CF ");
}
} while (metadata == null);
} }
|
public class class_name {
protected void asNonLoginRequired(LoginHandlingResource resource) throws LoginRequiredException {
if (!isSuppressRememberMeOfNonLoginRequired(resource)) { // option just in case
logger.debug("...Checking login status for non login required");
if (tryAlreadyLoginOrRememberMe(resource)) {
checkPermission(resource); // throws if denied
return; // Good
}
}
if (isLoginRedirectBeanKeptAction(resource)) {
// keep login-redirect path in session
logger.debug("...Passing login check as login action (or redirect-kept action)");
} else {
clearLoginRedirectBean();
logger.debug("...Passing login check as non login required");
}
} }
|
public class class_name {
protected void asNonLoginRequired(LoginHandlingResource resource) throws LoginRequiredException {
if (!isSuppressRememberMeOfNonLoginRequired(resource)) { // option just in case
logger.debug("...Checking login status for non login required");
if (tryAlreadyLoginOrRememberMe(resource)) {
checkPermission(resource); // throws if denied // depends on control dependency: [if], data = [none]
return; // Good // depends on control dependency: [if], data = [none]
}
}
if (isLoginRedirectBeanKeptAction(resource)) {
// keep login-redirect path in session
logger.debug("...Passing login check as login action (or redirect-kept action)");
} else {
clearLoginRedirectBean();
logger.debug("...Passing login check as non login required");
}
} }
|
public class class_name {
public final long getRemainingTimeToLive() {
long ttl = getHdr2().getLongField(JsHdr2Access.TIMETOLIVE);
if (ttl > 0) {
return ttl - getMessageWaitTime().longValue();
}
else {
return -1;
}
} }
|
public class class_name {
public final long getRemainingTimeToLive() {
long ttl = getHdr2().getLongField(JsHdr2Access.TIMETOLIVE);
if (ttl > 0) {
return ttl - getMessageWaitTime().longValue(); // depends on control dependency: [if], data = [none]
}
else {
return -1; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String makeDescription(Object value) {
String answer; // Not initialized, so the compiler tells if we miss a
// case
if (value == null) {
answer = "null";
} else if (value instanceof String) {
answer = "\"" + value + "\"";
} else {
Class<?> objClass = value.getClass();
if ((objClass == Boolean.class) || (objClass == Character.class) || (objClass == Byte.class) || (objClass == Short.class) || (objClass == Integer.class)
|| (objClass == Long.class) || (objClass == Float.class) || (objClass == Double.class)) {
answer = value.toString();
} else if (objClass.isArray()) {
if (objClass.getComponentType().isPrimitive()) {
answer = convertSimpleArrayToString(value);
} else {
answer = objClass.getComponentType() + "[" + Array.getLength(value) + "]";
}
} else {
answer = value.getClass().toString() + "@" + Integer.toHexString(System.identityHashCode(value));
}
}
return answer;
} }
|
public class class_name {
private String makeDescription(Object value) {
String answer; // Not initialized, so the compiler tells if we miss a
// case
if (value == null) {
answer = "null"; // depends on control dependency: [if], data = [none]
} else if (value instanceof String) {
answer = "\"" + value + "\""; // depends on control dependency: [if], data = [none]
} else {
Class<?> objClass = value.getClass();
if ((objClass == Boolean.class) || (objClass == Character.class) || (objClass == Byte.class) || (objClass == Short.class) || (objClass == Integer.class)
|| (objClass == Long.class) || (objClass == Float.class) || (objClass == Double.class)) {
answer = value.toString(); // depends on control dependency: [if], data = [none]
} else if (objClass.isArray()) {
if (objClass.getComponentType().isPrimitive()) {
answer = convertSimpleArrayToString(value); // depends on control dependency: [if], data = [none]
} else {
answer = objClass.getComponentType() + "[" + Array.getLength(value) + "]"; // depends on control dependency: [if], data = [none]
}
} else {
answer = value.getClass().toString() + "@" + Integer.toHexString(System.identityHashCode(value)); // depends on control dependency: [if], data = [none]
}
}
return answer;
} }
|
public class class_name {
protected String encode(String value)
{
try
{
return URLEncoder.encode(value,"UTF-8");
}
catch (UnsupportedEncodingException e)
{
throw new ClientException(500,"Error encoding parameter.",e);
}
} }
|
public class class_name {
protected String encode(String value)
{
try
{
return URLEncoder.encode(value,"UTF-8"); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e)
{
throw new ClientException(500,"Error encoding parameter.",e);
} // depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.